Commit e9001a6345b6e4863c3eaba4e27c898229e6f108
Exists in
master
and in
28 other branches
Merge branch 'fix_edit_project' of gitorious.org:+mezuro/noosfero/mezuro into fix_edit_project
Showing
11 changed files
with
247 additions
and
30 deletions
Show diff stats
plugins/mezuro/controllers/mezuro_plugin_myprofile_controller.rb
| ... | ... | @@ -13,6 +13,7 @@ class MezuroPluginMyprofileController < ProfileController |
| 13 | 13 | @collector_name = params[:collector_name] |
| 14 | 14 | @collector = Kalibro::Client::BaseToolClient.new.base_tool(@collector_name) |
| 15 | 15 | end |
| 16 | + | |
| 16 | 17 | def new_metric_configuration |
| 17 | 18 | metric_name = params[:metric_name] |
| 18 | 19 | collector_name = params[:collector_name] |
| ... | ... | @@ -20,18 +21,39 @@ class MezuroPluginMyprofileController < ProfileController |
| 20 | 21 | @metric = collector.supported_metrics.find {|metric| metric.name == metric_name} |
| 21 | 22 | @configuration_name = params[:configuration_name] |
| 22 | 23 | end |
| 24 | + | |
| 23 | 25 | def edit_metric_configuration |
| 24 | 26 | metric_name = params[:metric_name] |
| 25 | 27 | @configuration_name = params[:configuration_name] |
| 26 | 28 | @metric_configuration = Kalibro::Client::MetricConfigurationClient.new.metric_configuration(@configuration_name, metric_name) |
| 27 | 29 | @metric = @metric_configuration.metric |
| 28 | 30 | end |
| 31 | + | |
| 32 | + def edit_compound_metric_configuration | |
| 33 | + metric_name = params[:metric_name] | |
| 34 | + @configuration_name = params[:configuration_name] | |
| 35 | + @metric_configuration = Kalibro::Client::MetricConfigurationClient.new.metric_configuration(@configuration_name, metric_name) | |
| 36 | + @metric = @metric_configuration.metric | |
| 37 | + end | |
| 38 | + | |
| 29 | 39 | def create_metric_configuration |
| 30 | 40 | @configuration_name = params[:configuration_name] |
| 31 | 41 | metric_configuration = new_metric_configuration_instance |
| 32 | 42 | Kalibro::Client::MetricConfigurationClient.new.save(metric_configuration, @configuration_name) |
| 33 | 43 | redirect_to "/#{profile.identifier}/#{@configuration_name.downcase.gsub(/\s/, '-')}" |
| 34 | 44 | end |
| 45 | + | |
| 46 | + def new_compound_metric | |
| 47 | + @configuration_name = params[:configuration_name] | |
| 48 | + @metric_configurations = Kalibro::Client::ConfigurationClient.new.configuration(@configuration_name).metric_configurations | |
| 49 | + end | |
| 50 | + | |
| 51 | + def create_compound_metric_configuration | |
| 52 | + @configuration_name = params[:configuration_name] | |
| 53 | + compound_metric_configuration = new_compound_metric_configuration_instance | |
| 54 | + Kalibro::Client::MetricConfigurationClient.new.save(compound_metric_configuration, @configuration_name) | |
| 55 | + redirect_to "/#{profile.identifier}/#{@configuration_name.downcase.gsub(/\s/, '-')}" | |
| 56 | + end | |
| 35 | 57 | |
| 36 | 58 | def update_metric_configuration |
| 37 | 59 | @configuration_name = params[:configuration_name] |
| ... | ... | @@ -41,6 +63,15 @@ class MezuroPluginMyprofileController < ProfileController |
| 41 | 63 | Kalibro::Client::MetricConfigurationClient.new.save(metric_configuration, @configuration_name) |
| 42 | 64 | redirect_to "/#{profile.identifier}/#{@configuration_name.downcase.gsub(/\s/, '-')}" |
| 43 | 65 | end |
| 66 | + | |
| 67 | + def update_compound_metric_configuration | |
| 68 | + @configuration_name = params[:configuration_name] | |
| 69 | + metric_name = params[:metric][:name] | |
| 70 | + metric_configuration = Kalibro::Client::MetricConfigurationClient.new.metric_configuration(@configuration_name, metric_name) | |
| 71 | + assign_compound_metric_configuration_instance (metric_configuration) | |
| 72 | + Kalibro::Client::MetricConfigurationClient.new.save(metric_configuration, @configuration_name) | |
| 73 | + redirect_to "/#{profile.identifier}/#{@configuration_name.downcase.gsub(/\s/, '-')}" | |
| 74 | + end | |
| 44 | 75 | |
| 45 | 76 | def new_range |
| 46 | 77 | @metric_name = params[:metric_name] |
| ... | ... | @@ -89,7 +120,11 @@ class MezuroPluginMyprofileController < ProfileController |
| 89 | 120 | Kalibro::Client::MetricConfigurationClient.new.save(metric_configuration, configuration_name) |
| 90 | 121 | formatted_configuration_name = configuration_name.gsub(/\s/, '+') |
| 91 | 122 | formatted_metric_name = metric_name.gsub(/\s/, '+') |
| 92 | - redirect_to "/myprofile/#{profile.identifier}/plugins/mezuro/edit_metric_configuration?configuration_name=#{formatted_configuration_name}&metric_name=#{formatted_metric_name}" | |
| 123 | + if metric_configuration.metric.class == Kalibro::Entities::CompoundMetric | |
| 124 | + redirect_to "/myprofile/#{profile.identifier}/plugin/mezuro/edit_compound_metric_configuration?configuration_name=#{formatted_configuration_name}&metric_name=#{formatted_metric_name}" | |
| 125 | + else | |
| 126 | + redirect_to "/myprofile/#{profile.identifier}/plugin/mezuro/edit_metric_configuration?configuration_name=#{formatted_configuration_name}&metric_name=#{formatted_metric_name}" | |
| 127 | + end | |
| 93 | 128 | end |
| 94 | 129 | |
| 95 | 130 | def remove_metric_configuration |
| ... | ... | @@ -99,6 +134,8 @@ class MezuroPluginMyprofileController < ProfileController |
| 99 | 134 | redirect_to "/#{profile.identifier}/#{configuration_name.downcase.gsub(/\s/, '-')}" |
| 100 | 135 | end |
| 101 | 136 | |
| 137 | + | |
| 138 | + | |
| 102 | 139 | private |
| 103 | 140 | |
| 104 | 141 | def new_metric_configuration_instance |
| ... | ... | @@ -106,8 +143,14 @@ class MezuroPluginMyprofileController < ProfileController |
| 106 | 143 | metric_configuration.metric = Kalibro::Entities::NativeMetric.new |
| 107 | 144 | assign_metric_configuration_instance (metric_configuration) |
| 108 | 145 | end |
| 109 | - | |
| 110 | - def assign_metric_configuration_instance (metric_configuration) | |
| 146 | + | |
| 147 | + def new_compound_metric_configuration_instance | |
| 148 | + metric_configuration = Kalibro::Entities::MetricConfiguration.new | |
| 149 | + metric_configuration.metric = Kalibro::Entities::CompoundMetric.new | |
| 150 | + assign_compound_metric_configuration_instance (metric_configuration) | |
| 151 | + end | |
| 152 | + | |
| 153 | + def assign_metric_configuration_instance (metric_configuration) | |
| 111 | 154 | metric_configuration.metric.name = params[:metric][:name] |
| 112 | 155 | metric_configuration.metric.description = params[:description] |
| 113 | 156 | metric_configuration.metric.origin = params[:metric][:origin] |
| ... | ... | @@ -119,6 +162,17 @@ class MezuroPluginMyprofileController < ProfileController |
| 119 | 162 | metric_configuration |
| 120 | 163 | end |
| 121 | 164 | |
| 165 | + def assign_compound_metric_configuration_instance (metric_configuration) | |
| 166 | + metric_configuration.metric.name = params[:metric_configuration][:metric_name] | |
| 167 | + metric_configuration.metric.description = params[:metric_configuration][:description] | |
| 168 | + metric_configuration.metric.scope = params[:metric_configuration][:scope] | |
| 169 | + metric_configuration.metric.script = params[:metric_configuration][:script] | |
| 170 | + metric_configuration.code = params[:metric_configuration][:code] | |
| 171 | + metric_configuration.weight = params[:metric_configuration][:weight] | |
| 172 | + metric_configuration.aggregation_form = params[:metric_configuration][:aggregation_form] | |
| 173 | + metric_configuration | |
| 174 | + end | |
| 175 | + | |
| 122 | 176 | def new_range_instance |
| 123 | 177 | range = Kalibro::Entities::Range.new |
| 124 | 178 | range.beginning = params[:range][:beginning] | ... | ... |
plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb
| ... | ... | @@ -12,7 +12,7 @@ class MezuroPlugin::Helpers::ContentViewerHelper |
| 12 | 12 | def self.generate_chart(values) |
| 13 | 13 | Gchart.line( |
| 14 | 14 | :title_color => 'FF0000', |
| 15 | - :size => '700x180', | |
| 15 | + :size => '600x180', | |
| 16 | 16 | :bg => {:color => 'efefef', :type => 'stripes'}, |
| 17 | 17 | :line_colors => 'c4a000', |
| 18 | 18 | :data => values, | ... | ... |
plugins/mezuro/lib/mezuro_plugin/project_content.rb
| ... | ... | @@ -29,7 +29,8 @@ class MezuroPlugin::ProjectContent < Article |
| 29 | 29 | |
| 30 | 30 | def get_date_result(date) |
| 31 | 31 | client = Kalibro::Client::ProjectResultClient.new |
| 32 | - @project_result ||= client.has_results_before(name, date) ? client.last_result_before(name, date) : client.first_result_after(name, date) | |
| 32 | + @project_result ||= client.has_results_before(name, date) ? client.last_result_before(name, date) : | |
| 33 | +client.first_result_after(name, date) | |
| 33 | 34 | end |
| 34 | 35 | |
| 35 | 36 | def module_result(module_name) |
| ... | ... | @@ -50,12 +51,11 @@ class MezuroPlugin::ProjectContent < Article |
| 50 | 51 | |
| 51 | 52 | private |
| 52 | 53 | |
| 53 | - #FIXME | |
| 54 | 54 | def validate_kalibro_project_name |
| 55 | - begin | |
| 56 | - Kalibro::Client::ProjectClient.project(name) | |
| 55 | + existing = Kalibro::Client::ProjectClient.new.project_names | |
| 56 | + | |
| 57 | + if existing.include?(name) | |
| 57 | 58 | errors.add_to_base("Project name already exists in Kalibro") |
| 58 | - rescue | |
| 59 | 59 | end |
| 60 | 60 | end |
| 61 | 61 | ... | ... |
plugins/mezuro/test/functional/mezuro_plugin_myprofile_controller_test.rb
| ... | ... | @@ -18,6 +18,7 @@ class MezuroPluginMyprofileControllerTest < ActionController::TestCase |
| 18 | 18 | @metric = NativeMetricFixtures.amloc |
| 19 | 19 | @metric_configuration_client = Kalibro::Client::MetricConfigurationClient.new |
| 20 | 20 | @metric_configuration = MetricConfigurationFixtures.amloc_configuration |
| 21 | + @compound_metric_configuration = MetricConfigurationFixtures.sc_configuration | |
| 21 | 22 | end |
| 22 | 23 | |
| 23 | 24 | should 'assign configuration name in choose_base_tool' do |
| ... | ... | @@ -71,17 +72,30 @@ class MezuroPluginMyprofileControllerTest < ActionController::TestCase |
| 71 | 72 | assert_equal assigns(:configuration_name), "test name" |
| 72 | 73 | assert_response 302 |
| 73 | 74 | end |
| 74 | - | |
| 75 | - should 'test metric edition' do | |
| 75 | + | |
| 76 | + should 'test compound metric creation' do | |
| 76 | 77 | Kalibro::Client::MetricConfigurationClient.expects(:new).returns(@metric_configuration_client) |
| 77 | 78 | @metric_configuration_client.expects(:save) |
| 78 | 79 | get :create_metric_configuration, :profile => @profile.identifier, :configuration_name => "test name", :description => @metric.description, |
| 79 | - :scope => @metric.scope, :language => @metric.language, :metric => { :name => @metric.name, :origin => @metric.origin}, | |
| 80 | - :metric_configuration => { :code => @metric_configuration.code, :weight => @metric_configuration.code, :aggregation => @metric_configuration.aggregation_form } | |
| 81 | - assert_equal assigns(:configuration_name), "test name" | |
| 80 | + :scope => @metric.scope, :language => @metric.language, :metric => { :name => @metric.name}, | |
| 81 | + :metric_configuration => { :script => @compound_metric_configuration.metric.script, :code => @compound_metric_configuration.code, :weight => @compound_metric_configuration.code, :aggregation => @compound_metric_configuration.aggregation_form} | |
| 82 | 82 | assert_response 302 |
| 83 | 83 | end |
| 84 | 84 | |
| 85 | + should 'test metric edition' do | |
| 86 | + Kalibro::Client::MetricConfigurationClient.expects(:new).returns(@metric_configuration_client) | |
| 87 | + @metric_configuration_client.expects(:metric_configuration).with("test name","test metric name").returns(@metric_configuration) | |
| 88 | + get :edit_metric_configuration, :profile => @profile.identifier, :configuration_name => "test name", :metric_name => "test metric name" | |
| 89 | + assert_response 200 | |
| 90 | + end | |
| 91 | + | |
| 92 | + should 'test compound metric edition' do | |
| 93 | + Kalibro::Client::MetricConfigurationClient.expects(:new).returns(@metric_configuration_client) | |
| 94 | + @metric_configuration_client.expects(:metric_configuration).with("test name","test metric name").returns(@compound_metric_configuration) | |
| 95 | + get :edit_compound_metric_configuration, :profile => @profile.identifier, :configuration_name => "test name", :metric_name => "test metric name" | |
| 96 | + assert_response 200 | |
| 97 | + end | |
| 98 | + | |
| 85 | 99 | should 'assign configuration name and metric name to new range' do |
| 86 | 100 | get :new_range, :profile => @profile.identifier, :configuration_name => "test name", :metric_name => @metric.name |
| 87 | 101 | assert_equal assigns(:configuration_name), "test name" | ... | ... |
plugins/mezuro/test/functional/mezuro_plugin_profile_controller_test.rb
| ... | ... | @@ -21,6 +21,8 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase |
| 21 | 21 | @name = @project.name |
| 22 | 22 | |
| 23 | 23 | @date = "2012-04-13T20:39:41+04:00" |
| 24 | + | |
| 25 | + @date = "2012-04-13T20:39:41+04:00" | |
| 24 | 26 | end |
| 25 | 27 | |
| 26 | 28 | should 'not find module result for inexistent project content' do |
| ... | ... | @@ -65,9 +67,9 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase |
| 65 | 67 | |
| 66 | 68 | should 'get project results from a specific date' do |
| 67 | 69 | create_project_content |
| 68 | - mock_project_result | |
| 69 | - Kalibro::Client::ProjectClient.expects(:project).with(@name).returns(@project) | |
| 70 | - get :project_result, :profile => @profile.identifier, :id => @content.id, :date => @project_result.date | |
| 70 | + mock_project_result | |
| 71 | + Kalibro::Client::ProjectClient.expects(:project).with(@name).returns(@project) | |
| 72 | + get :project_result, :profile => @profile.identifier, :id => @content.id, :date => @project_result.date | |
| 71 | 73 | assert_response 200 |
| 72 | 74 | end |
| 73 | 75 | |
| ... | ... | @@ -121,7 +123,6 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase |
| 121 | 123 | def create_project_content |
| 122 | 124 | @content = MezuroPlugin::ProjectContent.new(:profile => @profile, :name => @name) |
| 123 | 125 | @content.expects(:send_project_to_service).returns(nil) |
| 124 | - Kalibro::Client::ProjectClient.expects(:project).raises("there's no project named macaco") | |
| 125 | 126 | @content.save |
| 126 | 127 | end |
| 127 | 128 | ... | ... |
plugins/mezuro/test/unit/mezuro_plugin/project_content_test.rb
| ... | ... | @@ -92,9 +92,11 @@ returns(module_result) |
| 92 | 92 | end |
| 93 | 93 | |
| 94 | 94 | should 'not save a project with an existing project name in kalibro' do |
| 95 | - Kalibro::Client::ProjectClient.expects(:project).with(@content.name).returns(mock) | |
| 95 | + client = mock | |
| 96 | + Kalibro::Client::ProjectClient.expects(:new).returns(client) | |
| 97 | + client.expects(:project_names).returns([@content.name]) | |
| 96 | 98 | @content.send :validate_kalibro_project_name |
| 97 | - assert_equal @content.errors.on_base, "Project name already exists in Kalibro" | |
| 99 | + assert_equal "Project name already exists in Kalibro", @content.errors.on_base | |
| 98 | 100 | end |
| 99 | 101 | |
| 100 | 102 | private | ... | ... |
plugins/mezuro/views/content_viewer/_module_result.rhtml
| ... | ... | @@ -25,12 +25,12 @@ |
| 25 | 25 | <td style="background-color: #<%= range.color[2..-1] %>"><%= range.label %></td> |
| 26 | 26 | </tr> |
| 27 | 27 | <tr class="<%= metric_result.metric.name.delete("() ")%>" style="display: none;"> |
| 28 | - <td colspan="4"> | |
| 28 | + <td colspan="3"> | |
| 29 | 29 | <div id='historical-<%= metric_result.metric.name.delete("() ") %>'> |
| 30 | 30 | <a href="#" show-metric-history="<%= metric_result.metric.name.delete("() ") %>" data-module-name="<%= the_module.name %>" data-metric-name="<%= metric_result.metric.name.delete("() ") %>"> <p style="text-indent: 3em;"> Get Historical Values </p> </a> |
| 31 | 31 | </div> |
| 32 | 32 | </td> |
| 33 | - <td colspan="3" align="right"> | |
| 33 | + <td align="right"> | |
| 34 | 34 | <%= range.comments.nil? ? '' : range.comments %> |
| 35 | 35 | </td> |
| 36 | 36 | </tr> |
| ... | ... | @@ -39,10 +39,10 @@ |
| 39 | 39 | </tbody> |
| 40 | 40 | <tfoot> |
| 41 | 41 | <tr> |
| 42 | - <td colspan = "1"> | |
| 42 | + <td colspan = "3"> | |
| 43 | 43 | <div id='historical-grade'></div> |
| 44 | 44 | </td> |
| 45 | - <td colspan = "4" align = "right"> | |
| 45 | + <td align = "right"> | |
| 46 | 46 | <a href="#" show-grade-history="<%= module_result.module.name %>" data-module-name="<%= the_module.name%>" > |
| 47 | 47 | <strong> |
| 48 | 48 | <%= _('Grade:') %> | ... | ... |
plugins/mezuro/views/content_viewer/show_configuration.rhtml
| ... | ... | @@ -14,7 +14,7 @@ |
| 14 | 14 | |
| 15 | 15 | <br/> |
| 16 | 16 | |
| 17 | -<%= link_to "#{image_tag ('/plugins/mezuro/images/plus.png')}Add Metric", :controller => "mezuro_plugin_myprofile", | |
| 17 | +<%= link_to "#{image_tag ('/plugins/mezuro/images/plus.png')}Add Metric", :controller => "mezuro_plugin_myprofile", | |
| 18 | 18 | :action => "choose_base_tool", :params => {:configuration_name => @configuration.name} %><br/> |
| 19 | 19 | |
| 20 | 20 | <table> |
| ... | ... | @@ -26,12 +26,24 @@ |
| 26 | 26 | <% @configuration.metric_configurations.each do |metric_configuration| %> |
| 27 | 27 | <tr class="metric"> |
| 28 | 28 | <td><%= metric_configuration.metric.name %></td> |
| 29 | - <td><%= metric_configuration.metric.origin %></td> | |
| 30 | - <td><%= metric_configuration.code %></td> | |
| 31 | - <td><%= link_to "Edit", :controller => "mezuro_plugin_myprofile", :action => "edit_metric_configuration", :params => | |
| 32 | - {:configuration_name => @configuration.name, :metric_name => metric_configuration.metric.name} %></td> | |
| 29 | + <% if metric_configuration.metric.instance_of? Kalibro::Entities::NativeMetric %> | |
| 30 | + <td> | |
| 31 | + <%= metric_configuration.metric.origin %> | |
| 32 | + </td> | |
| 33 | + <td><%= metric_configuration.code %></td> | |
| 34 | + <td><%= link_to "Edit", :controller => "mezuro_plugin_myprofile", :action => "edit_metric_configuration", :params => | |
| 35 | + {:configuration_name => @configuration.name, :metric_name => metric_configuration.metric.name} %></td> | |
| 36 | + <% else %> | |
| 37 | + <td> | |
| 38 | + Compound Metric | |
| 39 | + </td> | |
| 40 | + <td><%= metric_configuration.code %></td> | |
| 41 | + <td><%= link_to "Edit", :controller => "mezuro_plugin_myprofile", :action => "edit_compound_metric_configuration", :params => | |
| 42 | + {:configuration_name => @configuration.name, :metric_name => metric_configuration.metric.name} %></td> | |
| 43 | + <% end %> | |
| 44 | + | |
| 33 | 45 | <td><%= link_to "Remove", :controller => "mezuro_plugin_myprofile", :action => "remove_metric_configuration", :params => |
| 34 | 46 | {:configuration_name => @configuration.name, :metric_name => metric_configuration.metric.name} %></td> |
| 35 | 47 | </tr> |
| 36 | -<% end %> | |
| 48 | + <% end %> | |
| 37 | 49 | </table> | ... | ... |
plugins/mezuro/views/mezuro_plugin_myprofile/choose_base_tool.html.erb
| 1 | 1 | <h2><%= @configuration_name%> Configuration</h2> |
| 2 | 2 | |
| 3 | +<%= link_to "* New Compound Metric *", :controller => "mezuro_plugin_myprofile", :action => "new_compound_metric", :params => | |
| 4 | +{:configuration_name => @configuration_name} %> | |
| 5 | + | |
| 3 | 6 | <h5>Base Tools:</h5> |
| 4 | 7 | <table id="project_info"> |
| 5 | 8 | <% @tool_names.base_tool_names.each do |collector_name| %> | ... | ... |
plugins/mezuro/views/mezuro_plugin_myprofile/edit_compound_metric_configuration.html.erb
0 → 100644
| ... | ... | @@ -0,0 +1,76 @@ |
| 1 | +<h2><%= @configuration_name %> Configuration</h2> | |
| 2 | + | |
| 3 | +<% form_for :metric_configuration, :url => {:action =>"update_compound_metric_configuration", :controller => "mezuro_plugin_myprofile"}, :method => :get do |f| %> | |
| 4 | + <%= hidden_field_tag :configuration_name, @configuration_name %> | |
| 5 | + <%= hidden_field_tag :scope, @metric.scope %> | |
| 6 | + | |
| 7 | + <p> | |
| 8 | + <%= f.label :metric_name, "Metric Name:" %> | |
| 9 | + <%= @metric.name %> | |
| 10 | + <%= hidden_field_tag "metric[name]", @metric.name %> | |
| 11 | + </p> | |
| 12 | + <p> | |
| 13 | + <%= f.label :description, "Description:" %> | |
| 14 | + <%= text_field_tag "metric[description]", @metric.description %> | |
| 15 | + </p> | |
| 16 | + <p> | |
| 17 | + <%= f.label :scope, "Scope:" %> | |
| 18 | + <%= select_tag "metric[scope]", options_for_select([["Teste", "NIL"], ["Class", "CLASS"]], :selected => @metric.scope) %> | |
| 19 | + </p> | |
| 20 | + <p> | |
| 21 | + <%= f.label :code, "Code:" %> | |
| 22 | + <%= text_field_tag "metric[code]", @metric_configuration.code %> | |
| 23 | + </p> | |
| 24 | + <p> | |
| 25 | + <%= f.label :aggregation_form, "Aggregation Form:" %> | |
| 26 | + <%= f.select :aggregation_form, [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"], | |
| 27 | + ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]] %> | |
| 28 | + </p> | |
| 29 | + <p> | |
| 30 | + <%= f.label :weight, "Weight:" %> | |
| 31 | + <%= f.text_field :weight %> | |
| 32 | + </p> | |
| 33 | + | |
| 34 | + <p> | |
| 35 | + <%= f.label :script, "Script:" %> | |
| 36 | + <%= text_area_tag "metric[script]", @metric.script %> | |
| 37 | + </p> | |
| 38 | + | |
| 39 | + <p> | |
| 40 | + <%= f.submit "Save" %> | |
| 41 | + </p> | |
| 42 | +<% end %> | |
| 43 | + | |
| 44 | + | |
| 45 | +<h5> Ranges </h5><br/> | |
| 46 | + | |
| 47 | +<table id="ranges"> | |
| 48 | + <tr> | |
| 49 | + <td> | |
| 50 | + Label | |
| 51 | + </td> | |
| 52 | + <td> | |
| 53 | + Beginning | |
| 54 | + </td> | |
| 55 | + <td> | |
| 56 | + End | |
| 57 | + </td> | |
| 58 | + <td> | |
| 59 | + Grade | |
| 60 | + </td> | |
| 61 | + <td> | |
| 62 | + Color | |
| 63 | + </td> | |
| 64 | + </tr> | |
| 65 | + <% if (@metric_configuration.ranges!=nil) | |
| 66 | + @metric_configuration.ranges.each do |range| %> | |
| 67 | + <%= render :partial => "range", :locals => {:range => range, :configuration_name => @configuration_name, | |
| 68 | + :metric_name => @metric_configuration.metric.name} %> | |
| 69 | + <% end | |
| 70 | + end %> | |
| 71 | +</table> | |
| 72 | + | |
| 73 | +<br/> | |
| 74 | +<%= link_to_remote "New Range", :url => {:action =>"new_range", :controller => "mezuro_plugin_myprofile", :configuration_name => @configuration_name, :metric_name => @metric.name} %> | |
| 75 | +<div id="range_form" style="display:none"></div> | |
| 76 | + | ... | ... |
plugins/mezuro/views/mezuro_plugin_myprofile/new_compound_metric.html.erb
0 → 100644
| ... | ... | @@ -0,0 +1,55 @@ |
| 1 | +<h2><%= @configuration_name %> Configuration</h2> | |
| 2 | + | |
| 3 | +<% form_for :metric_configuration, :url => {:action =>"create_compound_metric_configuration", | |
| 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> | |
| 19 | + <p> | |
| 20 | + <%= f.label :code, "Code:" %> | |
| 21 | + <%= f.text_field :code %> | |
| 22 | + </p> | |
| 23 | + <p> | |
| 24 | + <%= f.label :aggregation_form, "Aggregation:" %> | |
| 25 | + <%= f.select :aggregation_form, [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"], | |
| 26 | + ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]] %> | |
| 27 | + </p> | |
| 28 | + <p> | |
| 29 | + <%= f.label :weight, "Weight:" %> | |
| 30 | + <%= f.text_field :weight %> | |
| 31 | + </p> | |
| 32 | + <p> | |
| 33 | + <%= f.label :script, "Script:" %> | |
| 34 | + <%= f.text_area :script %> | |
| 35 | + </p> | |
| 36 | + | |
| 37 | + <p> | |
| 38 | + <%= f.submit "Add" %> | |
| 39 | + </p> | |
| 40 | + | |
| 41 | +<% end %> | |
| 42 | + | |
| 43 | +<!-- make this prettier --> | |
| 44 | +<table> | |
| 45 | + <tr class="titles"> | |
| 46 | + <td><h5>Metric Name</h5></td> | |
| 47 | + <td><h5>Metric Code</h5></td> | |
| 48 | + </tr> | |
| 49 | + <% @metric_configurations.each do |metric_configuration| %> | |
| 50 | + <tr class="metric"> | |
| 51 | + <td><%= metric_configuration.metric.name %></td> | |
| 52 | + <td><%= metric_configuration.code %></td> | |
| 53 | + </tr> | |
| 54 | + <% end %> | |
| 55 | +</table> | ... | ... |