Commit 904478e97c97c1d70bfb5563cbd57502b6955fd0

Authored by João M. M. da Silva + Alessandro Palmeira
Committed by Alessandro Palmeira
1 parent e83773f9

[Mezuro] edit_repository view fully working

plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb
... ... @@ -6,8 +6,8 @@ class MezuroPlugin::Helpers::ContentViewerHelper
6 6 sprintf("%.2f", grade.to_f)
7 7 end
8 8  
9   - def self.create_periodicity_options
10   - [["Not Periodically", 0], ["1 day", 1], ["2 days", 2], ["Weekly", 7], ["Biweeky", 15], ["Monthly", 30]]
  9 + def self.periodicity_options
  10 + [["Not Periodically", 0], ["1 day", 1], ["2 days", 2], ["Weekly", 7], ["Biweeky", 15], ["Monthly", 30]]
11 11 end
12 12  
13 13 def self.create_license_options
... ... @@ -39,11 +39,6 @@ class MezuroPlugin::Helpers::ContentViewerHelper
39 39 )
40 40 end
41 41  
42   - def self.get_periodicity_option(index)
43   - options = [["Not Periodically", 0], ["1 day", 1], ["2 days", 2], ["Weekly", 7], ["Biweeky", 15], ["Monthly", 30]]
44   - selected_option = options.find { |option| option.last == index.to_i }
45   - selected_option.first
46   - end
47 42  
48 43 def self.format_name(metric_configuration_snapshot)
49 44 metric_configuration_snapshot.metric.name.delete("() ")
... ...
plugins/mezuro/views/mezuro_plugin_repository/edit.html.erb
... ... @@ -8,19 +8,23 @@
8 8 <%= f.label :name, "Name:" %>
9 9 <%= f.text_field :name %>
10 10 </p>
  11 +
11 12 <p>
12 13 <%= f.label :description, "Description:" %>
13 14 <%= f.text_field :description %>
14 15 </p>
15 16  
16   - <%= required labelled_form_field _('License'),
17   - f.select(:license, MezuroPlugin::Helpers::ContentViewerHelper.create_license_options) %><br/>
18 17 <p>
  18 + <%= required labelled_form_field _('License'),
  19 + f.select(:license, MezuroPlugin::Helpers::ContentViewerHelper.create_license_options) %><br/>
  20 + </p>
19 21  
20 22 <p>
21 23 <%= f.label :process_period, "Process Period:" %>
22   - <%= f.select(:process_period, MezuroPlugin::Helpers::ContentViewerHelper.create_periodicity_options) %>
  24 + <%= f.select(:process_period, MezuroPlugin::Helpers::ContentViewerHelper.periodicity_options, :selected => @repository.process_period.to_i) %>
23 25 </p>
  26 +
  27 + <p>
24 28 <%= f.label :type, "Type:" %>
25 29 <%= f.select :type, @repository_types%>
26 30 </p>
... ... @@ -30,7 +34,7 @@
30 34 <%= f.text_field :address%>
31 35 </p>
32 36  
33   - </p>
  37 + <p>
34 38 <%= f.label :configuration_id, "Configuration:" %>
35 39 <%= f.select :configuration_id, @configuration_select, :selected => @repository.configuration_id.to_i %>
36 40 </p>
... ...