Commit 39fe9156202bbe1789ae2c94109f8d295a1c73ed

Authored by João da Silva
2 parents ba38a3cf 4251001f

Merge branch 'fix_edit_project' into mezuro-dev

plugins/mezuro/lib/kalibro/entities/project.rb
... ... @@ -9,5 +9,4 @@ class Kalibro::Entities::Project < Kalibro::Entities::Entity
9 9 def error=(value)
10 10 @error = to_entity(value, Kalibro::Entities::Error)
11 11 end
12   -
13   -end
14 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 18 :data => values,
19 19 :axis_with_labels => 'y')
20 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 27 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/>
... ... @@ -31,7 +32,9 @@
31 32 <% @configuration_names = Kalibro::Client::ConfigurationClient.new.configuration_names.sort %>
32 33 <% @selected = (@project.nil? ? @configuration_names[0] : @project.configuration_name) %>
33 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 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 32 <td><%= _('Configuration') %></td>
33 33 <td><%= @project.configuration_name %></td>
34 34 </tr>
  35 + <tr>
  36 + <td><%= _('Periodicity') %></td>
  37 + <td><%= MezuroPlugin::Helpers::ContentViewerHelper.get_periodicity_option(@page.periodicity_in_days) %></td>
  38 + </tr>
35 39 <tr>
36 40 <td><%= _('Status')%></td>
37 41 <td>
... ...