Commit baef9f39bd9b73e1ac7796bae8912e60d43268f2
Committed by
Diego Camarinha
1 parent
75412d95
Exists in
master
and in
29 other branches
[Mezuro] Edit project is now showing the right periodicity.
Showing
2 changed files
with
7 additions
and
4 deletions
Show diff stats
plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb
... | ... | @@ -20,6 +20,8 @@ class MezuroPlugin::Helpers::ContentViewerHelper |
20 | 20 | end |
21 | 21 | |
22 | 22 | def self.get_periodicity_option(index) |
23 | - [["Not Periodically", 0], ["1 day", 1], ["2 days", 2], ["Weekly", 7], ["Biweeky", 15], ["Monthly", 30]][index.to_i][0] | |
23 | + options = [["Not Periodically", 0], ["1 day", 1], ["2 days", 2], ["Weekly", 7], ["Biweeky", 15], ["Monthly", 30]] | |
24 | + selected_option = options.find { |option| option.last == index.to_i } | |
25 | + selected_option.first | |
24 | 26 | end |
25 | 27 | end | ... | ... |
plugins/mezuro/views/cms/mezuro_plugin/_project_content.html.erb
... | ... | @@ -32,8 +32,9 @@ |
32 | 32 | <% @configuration_names = Kalibro::Client::ConfigurationClient.new.configuration_names.sort %> |
33 | 33 | <% @selected = (@project.nil? ? @configuration_names[0] : @project.configuration_name) %> |
34 | 34 | <%= required labelled_form_field _('Configuration'), |
35 | - f.select(:configuration_name, @configuration_names.sort, {:selected => @selected}) %><br/> | |
35 | + f.select(:configuration_name, @configuration_names, {:selected => @selected}) %><br/> | |
36 | 36 | |
37 | -<% @selected = (@project.nil? ? 0 : @kalibro_client.process_period(@article.title)) %> | |
37 | + | |
38 | +<% selected = (@project.nil? ? 0 : @kalibro_client.process_period(@article.title).to_i) %> | |
38 | 39 | <%= required labelled_form_field _('Periodic Avaliation'), |
39 | - f.select(:periodicity_in_days, MezuroPlugin::Helpers::ContentViewerHelper.create_periodicity_options ,{:selected => @selected}) %><br/> | |
40 | + f.select(:periodicity_in_days, MezuroPlugin::Helpers::ContentViewerHelper.create_periodicity_options ,{:selected => selected}) %><br/> | ... | ... |