Commit 6f099471203b0458bc6c98b0ab54d1af64545950
Committed by
João M. M. da Silva
1 parent
25cb803e
Exists in
master
and in
29 other branches
[Mezuro] draft to fix edit project periodicity
Showing
3 changed files
with
9 additions
and
3 deletions
Show diff stats
plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb
... | ... | @@ -18,4 +18,8 @@ class MezuroPlugin::Helpers::ContentViewerHelper |
18 | 18 | :data => values, |
19 | 19 | :axis_with_labels => 'y') |
20 | 20 | end |
21 | + | |
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] | |
24 | + end | |
21 | 25 | end | ... | ... |
plugins/mezuro/views/cms/mezuro_plugin/_project_content.html.erb
... | ... | @@ -3,6 +3,7 @@ |
3 | 3 | <% |
4 | 4 | begin |
5 | 5 | @project = @article.title.nil? ? nil : Kalibro::Client::ProjectClient.project(@article.title) |
6 | + @kalibro_client = Kalibro::Client::KalibroClient.new | |
6 | 7 | rescue |
7 | 8 | @project = nil |
8 | 9 | end |
... | ... | @@ -21,7 +22,7 @@ |
21 | 22 | |
22 | 23 | <%= f.text_field :description %><br/> |
23 | 24 | |
24 | -<% @repository_types = Kalibro::Client::KalibroClient.new.supported_repository_types.sort %> | |
25 | +<% @repository_types = @kalibro_client.supported_repository_types.sort %> | |
25 | 26 | <% @selected = (@project.nil? ? @repository_types : @project.repository.type) %> |
26 | 27 | <%= required labelled_form_field _('Repository type'), |
27 | 28 | f.select(:repository_type, @repository_types, {:selected => @selected}) %><br/> |
... | ... | @@ -33,5 +34,6 @@ |
33 | 34 | <%= required labelled_form_field _('Configuration'), |
34 | 35 | f.select(:configuration_name, @configuration_names.sort, {:selected => @selected}) %><br/> |
35 | 36 | |
37 | +<% @periodicity = (@project.nil? ? 0 : @kalibro_client.process_period(@project.name)) %> | |
36 | 38 | <%= required labelled_form_field _('Periodic Avaliation'), |
37 | - f.select(:periodicity_in_days, MezuroPlugin::Helpers::ContentViewerHelper.create_periodicity_options ,{:selected => 0}) %><br/> | |
39 | + f.select(:periodicity_in_days, MezuroPlugin::Helpers::ContentViewerHelper.create_periodicity_options ,{:selected => @periodicity}) %><br/> | ... | ... |
plugins/mezuro/views/content_viewer/show_project.rhtml
... | ... | @@ -34,7 +34,7 @@ |
34 | 34 | </tr> |
35 | 35 | <tr> |
36 | 36 | <td><%= _('Periodicity') %></td> |
37 | - <td><%= @project.periodicity_in_days %> </td> | |
37 | + <td><%= MezuroPlugin::Helpers::ContentViewerHelper.get_periodicity_option(@page.periodicity_in_days) %></td> | |
38 | 38 | </tr> |
39 | 39 | <tr> |
40 | 40 | <td><%= _('Status')%></td> | ... | ... |