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,8 +6,8 @@ class MezuroPlugin::Helpers::ContentViewerHelper
6 sprintf("%.2f", grade.to_f) 6 sprintf("%.2f", grade.to_f)
7 end 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 end 11 end
12 12
13 def self.create_license_options 13 def self.create_license_options
@@ -39,11 +39,6 @@ class MezuroPlugin::Helpers::ContentViewerHelper @@ -39,11 +39,6 @@ class MezuroPlugin::Helpers::ContentViewerHelper
39 ) 39 )
40 end 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 def self.format_name(metric_configuration_snapshot) 43 def self.format_name(metric_configuration_snapshot)
49 metric_configuration_snapshot.metric.name.delete("() ") 44 metric_configuration_snapshot.metric.name.delete("() ")
plugins/mezuro/views/mezuro_plugin_repository/edit.html.erb
@@ -8,19 +8,23 @@ @@ -8,19 +8,23 @@
8 <%= f.label :name, "Name:" %> 8 <%= f.label :name, "Name:" %>
9 <%= f.text_field :name %> 9 <%= f.text_field :name %>
10 </p> 10 </p>
  11 +
11 <p> 12 <p>
12 <%= f.label :description, "Description:" %> 13 <%= f.label :description, "Description:" %>
13 <%= f.text_field :description %> 14 <%= f.text_field :description %>
14 </p> 15 </p>
15 16
16 - <%= required labelled_form_field _('License'),  
17 - f.select(:license, MezuroPlugin::Helpers::ContentViewerHelper.create_license_options) %><br/>  
18 <p> 17 <p>
  18 + <%= required labelled_form_field _('License'),
  19 + f.select(:license, MezuroPlugin::Helpers::ContentViewerHelper.create_license_options) %><br/>
  20 + </p>
19 21
20 <p> 22 <p>
21 <%= f.label :process_period, "Process Period:" %> 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 </p> 25 </p>
  26 +
  27 + <p>
24 <%= f.label :type, "Type:" %> 28 <%= f.label :type, "Type:" %>
25 <%= f.select :type, @repository_types%> 29 <%= f.select :type, @repository_types%>
26 </p> 30 </p>
@@ -30,7 +34,7 @@ @@ -30,7 +34,7 @@
30 <%= f.text_field :address%> 34 <%= f.text_field :address%>
31 </p> 35 </p>
32 36
33 - </p> 37 + <p>
34 <%= f.label :configuration_id, "Configuration:" %> 38 <%= f.label :configuration_id, "Configuration:" %>
35 <%= f.select :configuration_id, @configuration_select, :selected => @repository.configuration_id.to_i %> 39 <%= f.select :configuration_id, @configuration_select, :selected => @repository.configuration_id.to_i %>
36 </p> 40 </p>