Commit 39fe9156202bbe1789ae2c94109f8d295a1c73ed
Exists in
master
and in
28 other branches
Merge branch 'fix_edit_project' into mezuro-dev
Showing
4 changed files
with
17 additions
and
5 deletions
Show diff stats
plugins/mezuro/lib/kalibro/entities/project.rb
| @@ -9,5 +9,4 @@ class Kalibro::Entities::Project < Kalibro::Entities::Entity | @@ -9,5 +9,4 @@ class Kalibro::Entities::Project < Kalibro::Entities::Entity | ||
| 9 | def error=(value) | 9 | def error=(value) |
| 10 | @error = to_entity(value, Kalibro::Entities::Error) | 10 | @error = to_entity(value, Kalibro::Entities::Error) |
| 11 | end | 11 | end |
| 12 | - | ||
| 13 | -end | ||
| 14 | \ No newline at end of file | 12 | \ No newline at end of file |
| 13 | +end |
plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb
| @@ -18,4 +18,10 @@ class MezuroPlugin::Helpers::ContentViewerHelper | @@ -18,4 +18,10 @@ class MezuroPlugin::Helpers::ContentViewerHelper | ||
| 18 | :data => values, | 18 | :data => values, |
| 19 | :axis_with_labels => 'y') | 19 | :axis_with_labels => 'y') |
| 20 | end | 20 | end |
| 21 | + | ||
| 22 | + def self.get_periodicity_option(index) | ||
| 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 | ||
| 26 | + end | ||
| 21 | end | 27 | end |
plugins/mezuro/views/cms/mezuro_plugin/_project_content.html.erb
| @@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
| 3 | <% | 3 | <% |
| 4 | begin | 4 | begin |
| 5 | @project = @article.title.nil? ? nil : Kalibro::Client::ProjectClient.project(@article.title) | 5 | @project = @article.title.nil? ? nil : Kalibro::Client::ProjectClient.project(@article.title) |
| 6 | + @kalibro_client = Kalibro::Client::KalibroClient.new | ||
| 6 | rescue | 7 | rescue |
| 7 | @project = nil | 8 | @project = nil |
| 8 | end | 9 | end |
| @@ -21,7 +22,7 @@ | @@ -21,7 +22,7 @@ | ||
| 21 | 22 | ||
| 22 | <%= f.text_field :description %><br/> | 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 | <% @selected = (@project.nil? ? @repository_types : @project.repository.type) %> | 26 | <% @selected = (@project.nil? ? @repository_types : @project.repository.type) %> |
| 26 | <%= required labelled_form_field _('Repository type'), | 27 | <%= required labelled_form_field _('Repository type'), |
| 27 | f.select(:repository_type, @repository_types, {:selected => @selected}) %><br/> | 28 | f.select(:repository_type, @repository_types, {:selected => @selected}) %><br/> |
| @@ -31,7 +32,9 @@ | @@ -31,7 +32,9 @@ | ||
| 31 | <% @configuration_names = Kalibro::Client::ConfigurationClient.new.configuration_names.sort %> | 32 | <% @configuration_names = Kalibro::Client::ConfigurationClient.new.configuration_names.sort %> |
| 32 | <% @selected = (@project.nil? ? @configuration_names[0] : @project.configuration_name) %> | 33 | <% @selected = (@project.nil? ? @configuration_names[0] : @project.configuration_name) %> |
| 33 | <%= required labelled_form_field _('Configuration'), | 34 | <%= required labelled_form_field _('Configuration'), |
| 34 | - f.select(:configuration_name, @configuration_names.sort, {:selected => @selected}) %><br/> | 35 | + f.select(:configuration_name, @configuration_names, {:selected => @selected}) %><br/> |
| 35 | 36 | ||
| 37 | + | ||
| 38 | +<% selected = (@project.nil? ? 0 : @kalibro_client.process_period(@article.title).to_i) %> | ||
| 36 | <%= required labelled_form_field _('Periodic Avaliation'), | 39 | <%= required labelled_form_field _('Periodic Avaliation'), |
| 37 | - f.select(:periodicity_in_days, MezuroPlugin::Helpers::ContentViewerHelper.create_periodicity_options ,{:selected => 0}) %><br/> | 40 | + f.select(:periodicity_in_days, MezuroPlugin::Helpers::ContentViewerHelper.create_periodicity_options ,{:selected => selected}) %><br/> |
plugins/mezuro/views/content_viewer/show_project.rhtml
| @@ -32,6 +32,10 @@ | @@ -32,6 +32,10 @@ | ||
| 32 | <td><%= _('Configuration') %></td> | 32 | <td><%= _('Configuration') %></td> |
| 33 | <td><%= @project.configuration_name %></td> | 33 | <td><%= @project.configuration_name %></td> |
| 34 | </tr> | 34 | </tr> |
| 35 | + <tr> | ||
| 36 | + <td><%= _('Periodicity') %></td> | ||
| 37 | + <td><%= MezuroPlugin::Helpers::ContentViewerHelper.get_periodicity_option(@page.periodicity_in_days) %></td> | ||
| 38 | + </tr> | ||
| 35 | <tr> | 39 | <tr> |
| 36 | <td><%= _('Status')%></td> | 40 | <td><%= _('Status')%></td> |
| 37 | <td> | 41 | <td> |