Commit 5099394bc178a03cd23b15bc4f74fb1e0dba3d69
Committed by
Diego Camarinha
1 parent
26721aef
Exists in
master
and in
28 other branches
[Mezuro] Inserted license combo box in project content.
Showing
2 changed files
with
17 additions
and
1 deletions
Show diff stats
plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb
| ... | ... | @@ -9,6 +9,14 @@ class MezuroPlugin::Helpers::ContentViewerHelper |
| 9 | 9 | [["Not Periodically", 0], ["1 day", 1], ["2 days", 2], ["Weekly", 7], ["Biweeky", 15], ["Monthly", 30]] |
| 10 | 10 | end |
| 11 | 11 | |
| 12 | + def self.create_license_options | |
| 13 | + options = YAML.load_file("#{RAILS_ROOT}/plugins/mezuro/licenses.yaml") | |
| 14 | + options = options.split(";") | |
| 15 | + formated_options = [] | |
| 16 | + options.each { |option| formated_options << [option, option] } | |
| 17 | + formated_options | |
| 18 | + end | |
| 19 | + | |
| 12 | 20 | def self.generate_chart(values) |
| 13 | 21 | Gchart.line( |
| 14 | 22 | :title_color => 'FF0000', |
| ... | ... | @@ -31,4 +39,10 @@ class MezuroPlugin::Helpers::ContentViewerHelper |
| 31 | 39 | def self.format_name(metric_result) |
| 32 | 40 | metric_result.metric.name.delete("() ") |
| 33 | 41 | end |
| 42 | + | |
| 43 | + def self.get_license_option(selected) | |
| 44 | + options = YAML.load_file("#{RAILS_ROOT}/plugins/mezuro/licenses.yaml") | |
| 45 | + options.split(";") | |
| 46 | + selected_option = options.find { |license| license == selected } | |
| 47 | + end | |
| 34 | 48 | end | ... | ... |
plugins/mezuro/views/cms/mezuro_plugin/_project_content.html.erb
| ... | ... | @@ -24,7 +24,9 @@ |
| 24 | 24 | <%= required f.text_field(:name) %> |
| 25 | 25 | <% end %> |
| 26 | 26 | |
| 27 | -<%= f.text_field :project_license %><br/> | |
| 27 | +<% selected = (@project.nil? ? "" : @project.license) %> | |
| 28 | +<%= required labelled_form_field _('License'), | |
| 29 | + f.select(:project_license, MezuroPlugin::Helpers::ContentViewerHelper.create_license_options ,{:selected => selected}) %><br/> | |
| 28 | 30 | |
| 29 | 31 | <%= f.text_field :description %><br/> |
| 30 | 32 | ... | ... |