From 3cc0d8679a26274f38228a31f6c9e5d0c449edb1 Mon Sep 17 00:00:00 2001 From: Diego Araújo + Rafael Manzo Date: Tue, 28 Aug 2012 16:51:32 -0300 Subject: [PATCH] [Mezuro] Inserted license combo box in project content. --- plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb | 14 ++++++++++++++ plugins/mezuro/licenses.yaml.example | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ plugins/mezuro/views/cms/mezuro_plugin/_project_content.html.erb | 4 +++- 3 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 plugins/mezuro/licenses.yaml.example diff --git a/plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb b/plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb index e9d532f..0a0af0c 100644 --- a/plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb +++ b/plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb @@ -9,6 +9,14 @@ class MezuroPlugin::Helpers::ContentViewerHelper [["Not Periodically", 0], ["1 day", 1], ["2 days", 2], ["Weekly", 7], ["Biweeky", 15], ["Monthly", 30]] end + def self.create_license_options + options = YAML.load_file("#{RAILS_ROOT}/plugins/mezuro/licenses.yaml") + options = options.split(";") + formated_options = [] + options.each { |option| formated_options << [option, option] } + formated_options + end + def self.generate_chart(values) Gchart.line( :title_color => 'FF0000', @@ -31,4 +39,10 @@ class MezuroPlugin::Helpers::ContentViewerHelper def self.format_name(metric_result) metric_result.metric.name.delete("() ") end + + def self.get_license_option(selected) + options = YAML.load_file("#{RAILS_ROOT}/plugins/mezuro/licenses.yaml") + options.split(";") + selected_option = options.find { |license| license == selected } + end end diff --git a/plugins/mezuro/licenses.yaml.example b/plugins/mezuro/licenses.yaml.example new file mode 100644 index 0000000..d3f910e --- /dev/null +++ b/plugins/mezuro/licenses.yaml.example @@ -0,0 +1,69 @@ +Academic Free License 3.0 (AFL-3.0); +Affero GNU Public License (AGPL-3.0); +Adaptive Public License (APL-1.0); +Apache License 2.0 (Apache-2.0); +Apple Public Source License (APSL-2.0); +Artistic license 2.0 (Artistic-2.0); +Attribution Assurance Licenses (AAL); +BSD 3-Clause "New" or "Revised" License (BSD-3-Clause); +BSD 2-Clause "Simplified" or "FreeBSD" License (BSD-2-Clause); +Boost Software License (BSL-1.0); +Computer Associates Trusted Open Source License 1.1 (CATOSL-1.1); +Common Development and Distribution License 1.0 (CDDL-1.0); +Common Public Attribution License 1.0 (CPAL-1.0); +CUA Office Public License Version 1.0 (CUA-OPL-1.0); +EU DataGrid Software License (EUDatagrid); +Eclipse Public License 1.0 (EPL-1.0); +Educational Community License, Version 2.0 (ECL-2.0); +Eiffel Forum License V2.0 (EFL-2.0); +Entessa Public License (Entessa); +European Union Public License, Version 1.1 (EUPL-1.1); +Fair License (FAIR); +Frameworx License (Frameworx-1.0); +GNU Affero General Public License v3 (AGPL-3.0); +GNU General Public License version 2.0 (GPL-2.0); +GNU General Public License version 3.0 (GPL-3.0); +GNU Library or "Lesser" General Public License version 2.1 (LGPL-2.1); +GNU Library or "Lesser" General Public License version 3.0 (LGPL-3.0); +Historical Permission Notice and Disclaimer (HPND); +IBM Public License 1.0 (IPL-1.0); +IPA Font License (IPA); +ISC License (ISC); +LaTeX Project Public License 1.3c (LPPL-1.3c); +Lucent Public License Version 1.02 (LPL-1.02); +MirOS Licence (MirOS); +Microsoft Public License (Ms-PL); +Microsoft Reciprocal License (Ms-RL); +MIT license (MIT); +Motosoto License (Motosoto); +Mozilla Public License 2.0 (MPL-2.0); +Multics License (Multics); +NASA Open Source Agreement 1.3 (NASA 1.3); +NTP License (NTP); +Naumen Public License (Naumen); +Nethack General Public License (NGPL); +Nokia Open Source License (Nokia); +Non-Profit Open Software License 3.0 (NPOSL-3.0); +OCLC Research Public License 2.0 (OCLC-2.0); +Open Font License 1.1 (OFL 1.1); +Open Group Test Suite License (OGTSL); +Open Software License 3.0 (OSL-3.0); +PHP License 3.0 (PHP-3.0); +The PostgreSQL License (PostgreSQL); +Python License (Python-2.0); +CNRI Python license (CNRI-Python); +Q Public License (QPL-1.0); +RealNetworks Public Source License V1.0 (RPSL-1.0); +Reciprocal Public License 1.5 (RPL-1.5); +Ricoh Source Code Public License (RSCPL); +Simple Public License 2.0 (SimPL-2.0); +Sleepycat License (Sleepycat); +Sun Public License 1.0 (SPL-1.0); +Sybase Open Watcom Public License 1.0 (Watcom-1.0); +University of Illinois/NCSA Open Source License (NCSA); +Vovida Software License v. 1.0 (VSL-1.0); +W3C License (W3C); +wxWindows Library License (WXwindows); +X.Net License (Xnet); +Zope Public License 2.0 (ZPL-2.0); +zlib/libpng license (Zlib); diff --git a/plugins/mezuro/views/cms/mezuro_plugin/_project_content.html.erb b/plugins/mezuro/views/cms/mezuro_plugin/_project_content.html.erb index 656cb7f..46cd961 100644 --- a/plugins/mezuro/views/cms/mezuro_plugin/_project_content.html.erb +++ b/plugins/mezuro/views/cms/mezuro_plugin/_project_content.html.erb @@ -24,7 +24,9 @@ <%= required f.text_field(:name) %> <% end %> -<%= f.text_field :project_license %>
+<% selected = (@project.nil? ? "" : @project.license) %> +<%= required labelled_form_field _('License'), + f.select(:project_license, MezuroPlugin::Helpers::ContentViewerHelper.create_license_options ,{:selected => selected}) %>
<%= f.text_field :description %>
-- libgit2 0.21.2