Commit 9f31b259f9b222b1c871e88514927ef03177850b

Authored by Alessandro Palmeira
Committed by João da Silva
1 parent ed0172e0

[Mezuro] Refactoring metric configuration forms

plugins/mezuro/controllers/mezuro_plugin_myprofile_controller.rb
@@ -162,7 +162,7 @@ class MezuroPluginMyprofileController < ProfileController @@ -162,7 +162,7 @@ class MezuroPluginMyprofileController < ProfileController
162 metric_configuration 162 metric_configuration
163 end 163 end
164 164
165 - def assign_compound_metric_configuration_instance (metric_configuration) 165 + def assign_compound_metric_configuration_instance (metric_configuration)
166 metric_configuration.metric.name = params[:metric_configuration][:metric][:name] 166 metric_configuration.metric.name = params[:metric_configuration][:metric][:name]
167 metric_configuration.metric.description = params[:metric_configuration][:metric][:description] 167 metric_configuration.metric.description = params[:metric_configuration][:metric][:description]
168 metric_configuration.metric.scope = params[:metric_configuration][:metric][:scope] 168 metric_configuration.metric.scope = params[:metric_configuration][:metric][:scope]
plugins/mezuro/views/mezuro_plugin_myprofile/new_compound_metric.html.erb
@@ -2,26 +2,31 @@ @@ -2,26 +2,31 @@
2 2
3 <% form_for :metric_configuration, :url => {:action =>"create_compound_metric_configuration", 3 <% form_for :metric_configuration, :url => {:action =>"create_compound_metric_configuration",
4 :controller => "mezuro_plugin_myprofile"}, :method => :get do |f| %> 4 :controller => "mezuro_plugin_myprofile"}, :method => :get do |f| %>
5 - <%= hidden_field_tag :configuration_name, @configuration_name %>  
6 -  
7 - <p>  
8 - <%= f.label :metric_name, "Metric Name:" %>  
9 - <%= f.text_field :metric_name %>  
10 - </p>  
11 - <p>  
12 - <%= f.label :description, "Description:" %>  
13 - <%= f.text_field :description %>  
14 - </p>  
15 - <p>  
16 - <%= f.label :scope, "Scope:" %>  
17 - <%= f.select :scope, [["Class", "CLASS"]] %>  
18 - </p> 5 + <%= hidden_field_tag :configuration_name, @configuration_name %>
  6 + <% f.fields_for :metric do |m| %>
  7 + <p>
  8 + <%= m.label :name, "Name:" %>
  9 + <%= m.text_field "name" %>
  10 + </p>
  11 + <p>
  12 + <%= m.label :description, "Description:" %>
  13 + <%= m.text_field "description" %>
  14 + </p>
  15 + <p>
  16 + <%= m.label :scope, "Scope:" %>
  17 + <%= m.select :scope, [["Class", "CLASS"]] %>
  18 + </p>
  19 + <p>
  20 + <%= m.label :script, "Script:" %>
  21 + <%= m.text_area "script" %>
  22 + </p>
  23 + <% end %>
19 <p> 24 <p>
20 <%= f.label :code, "Code:" %> 25 <%= f.label :code, "Code:" %>
21 - <%= f.text_field :code %> 26 + <%= f.text_field "code" %>
22 </p> 27 </p>
23 <p> 28 <p>
24 - <%= f.label :aggregation_form, "Aggregation:" %> 29 + <%= f.label :aggregation_form, "Aggregation Form:" %>
25 <%= f.select :aggregation_form, [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"], 30 <%= f.select :aggregation_form, [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"],
26 ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]] %> 31 ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]] %>
27 </p> 32 </p>
@@ -30,14 +35,8 @@ @@ -30,14 +35,8 @@
30 <%= f.text_field :weight %> 35 <%= f.text_field :weight %>
31 </p> 36 </p>
32 <p> 37 <p>
33 - <%= f.label :script, "Script:" %>  
34 - <%= f.text_area :script %>  
35 - </p>  
36 -  
37 - <p>  
38 - <%= f.submit "Add" %> 38 + <%= f.submit "Save" %>
39 </p> 39 </p>
40 -  
41 <% end %> 40 <% end %>
42 41
43 <!-- make this prettier --> 42 <!-- make this prettier -->