Commit ad1a898d0c2cc77dad4f94de87a44cc337b16ce7
Committed by
Paulo Meireles
1 parent
e61f62c6
Exists in
staging
and in
42 other branches
[Mezuro] Resolved missing files
Showing
14 changed files
with
486 additions
and
0 deletions
Show diff stats
plugins/mezuro/controllers/mezuro_plugin_myprofile_controller.rb
0 → 100644
| ... | ... | @@ -0,0 +1,141 @@ |
| 1 | +class MezuroPluginMyprofileController < ProfileController | |
| 2 | + | |
| 3 | + append_view_path File.join(File.dirname(__FILE__) + '/../views') | |
| 4 | + | |
| 5 | + | |
| 6 | + def choose_base_tool | |
| 7 | + @configuration_name = params[:configuration_name] | |
| 8 | + @tool_names = Kalibro::Client::BaseToolClient.new | |
| 9 | + end | |
| 10 | + | |
| 11 | + def choose_metric | |
| 12 | + @configuration_name = params[:configuration_name] | |
| 13 | + @collector_name = params[:collector_name] | |
| 14 | + @collector = Kalibro::Client::BaseToolClient.new.base_tool(@collector_name) | |
| 15 | + end | |
| 16 | + def new_metric_configuration | |
| 17 | + metric_name = params[:metric_name] | |
| 18 | + collector_name = params[:collector_name] | |
| 19 | + collector = Kalibro::Client::BaseToolClient.new.base_tool(collector_name) | |
| 20 | + @metric = collector.supported_metrics.find {|metric| metric.name == metric_name} | |
| 21 | + @configuration_name = params[:configuration_name] | |
| 22 | + end | |
| 23 | + def edit_metric_configuration | |
| 24 | + metric_name = params[:metric_name] | |
| 25 | + @configuration_name = params[:configuration_name] | |
| 26 | + @metric_configuration = Kalibro::Client::MetricConfigurationClient.new.metric_configuration(@configuration_name, metric_name) | |
| 27 | + @metric = @metric_configuration.metric | |
| 28 | + end | |
| 29 | + def create_metric_configuration | |
| 30 | + @configuration_name = params[:configuration_name] | |
| 31 | + metric_configuration = new_metric_configuration_instance | |
| 32 | + Kalibro::Client::MetricConfigurationClient.new.save(metric_configuration, @configuration_name) | |
| 33 | + redirect_to "/#{profile.identifier}/#{@configuration_name.downcase.gsub(/\s/, '-')}" | |
| 34 | + end | |
| 35 | + | |
| 36 | + def update_metric_configuration | |
| 37 | + @configuration_name = params[:configuration_name] | |
| 38 | + metric_name = params[:metric][:name] | |
| 39 | + metric_configuration = Kalibro::Client::MetricConfigurationClient.new.metric_configuration(@configuration_name, metric_name) | |
| 40 | + assign_metric_configuration_instance (metric_configuration) | |
| 41 | + Kalibro::Client::MetricConfigurationClient.new.save(metric_configuration, @configuration_name) | |
| 42 | + redirect_to "/#{profile.identifier}/#{@configuration_name.downcase.gsub(/\s/, '-')}" | |
| 43 | + end | |
| 44 | + | |
| 45 | + def new_range | |
| 46 | + @metric_name = params[:metric_name] | |
| 47 | + @configuration_name = params[:configuration_name] | |
| 48 | + end | |
| 49 | + | |
| 50 | + def edit_range | |
| 51 | + @metric_name = params[:metric_name] | |
| 52 | + @configuration_name = params[:configuration_name] | |
| 53 | + @beginning_id = params[:beginning_id] | |
| 54 | + | |
| 55 | + metric_configuration_client = Kalibro::Client::MetricConfigurationClient.new | |
| 56 | + metric_configuration = metric_configuration_client.metric_configuration(@configuration_name, @metric_name) | |
| 57 | + @range = metric_configuration.ranges.find{ |range| range.beginning == @beginning_id.to_f } | |
| 58 | + end | |
| 59 | + | |
| 60 | + def create_range | |
| 61 | + @range = new_range_instance | |
| 62 | + configuration_name = params[:configuration_name] | |
| 63 | + metric_name = params[:metric_name] | |
| 64 | + beginning_id = params[:beginning_id] | |
| 65 | + metric_configuration_client = Kalibro::Client::MetricConfigurationClient.new | |
| 66 | + metric_configuration = metric_configuration_client.metric_configuration(configuration_name, metric_name) | |
| 67 | + metric_configuration.add_range(@range) | |
| 68 | + metric_configuration_client.save(metric_configuration, configuration_name) | |
| 69 | + end | |
| 70 | + | |
| 71 | + def update_range | |
| 72 | + metric_name = params[:metric_name] | |
| 73 | + configuration_name = params[:configuration_name] | |
| 74 | + beginning_id = params[:beginning_id] | |
| 75 | + metric_configuration_client = Kalibro::Client::MetricConfigurationClient.new | |
| 76 | + metric_configuration = metric_configuration_client.metric_configuration(configuration_name, metric_name) | |
| 77 | + index = metric_configuration.ranges.index{ |range| range.beginning == beginning_id.to_f } | |
| 78 | + metric_configuration.ranges[index] = new_range_instance | |
| 79 | + Kalibro::Client::MetricConfigurationClient.new.save(metric_configuration, configuration_name) | |
| 80 | + end | |
| 81 | + | |
| 82 | + def remove_range | |
| 83 | + configuration_name = params[:configuration_name] | |
| 84 | + metric_name = params[:metric_name] | |
| 85 | + beginning_id = params[:range_beginning] | |
| 86 | + metric_configuration_client = Kalibro::Client::MetricConfigurationClient.new | |
| 87 | + metric_configuration = metric_configuration_client.metric_configuration(configuration_name, metric_name) | |
| 88 | + metric_configuration.ranges.delete_if { |range| range.beginning == beginning_id.to_f }.inspect | |
| 89 | + Kalibro::Client::MetricConfigurationClient.new.save(metric_configuration, configuration_name) | |
| 90 | + formatted_configuration_name = configuration_name.gsub(/\s/, '+') | |
| 91 | + 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}" | |
| 93 | + end | |
| 94 | + | |
| 95 | + def remove_metric_configuration | |
| 96 | + configuration_name = params[:configuration_name] | |
| 97 | + metric_name = params[:metric_name] | |
| 98 | + Kalibro::Client::MetricConfigurationClient.new.remove(configuration_name, metric_name) | |
| 99 | + redirect_to "/#{profile.identifier}/#{configuration_name.downcase.gsub(/\s/, '-')}" | |
| 100 | + end | |
| 101 | + | |
| 102 | + def module_metrics_history | |
| 103 | + metric_name = params[:metric_name] | |
| 104 | + content = profile.articles.find(params[:id]) | |
| 105 | + module_history = content.result_history(params[:module_name]) | |
| 106 | + date_history = module_history.collect { |x| x.date } | |
| 107 | + metric_history = module_history.collect { |x| (x.metric_results.select { |y| y.metric.name.delete("() ") == metric_name })[0] } | |
| 108 | + render :partial => 'content_viewer/metric_history', :locals => {:metric_history => metric_history, :date_history => date_history } | |
| 109 | + end | |
| 110 | + private | |
| 111 | + | |
| 112 | + def new_metric_configuration_instance | |
| 113 | + metric_configuration = Kalibro::Entities::MetricConfiguration.new | |
| 114 | + metric_configuration.metric = Kalibro::Entities::NativeMetric.new | |
| 115 | + assign_metric_configuration_instance (metric_configuration) | |
| 116 | + end | |
| 117 | + | |
| 118 | + def assign_metric_configuration_instance (metric_configuration) | |
| 119 | + metric_configuration.metric.name = params[:metric][:name] | |
| 120 | + metric_configuration.metric.description = params[:description] | |
| 121 | + metric_configuration.metric.origin = params[:metric][:origin] | |
| 122 | + metric_configuration.metric.scope = params[:scope] | |
| 123 | + metric_configuration.metric.language = params[:language] | |
| 124 | + metric_configuration.code = params[:metric_configuration][:code] | |
| 125 | + metric_configuration.weight = params[:metric_configuration][:weight] | |
| 126 | + metric_configuration.aggregation_form = params[:metric_configuration][:aggregation_form] | |
| 127 | + metric_configuration | |
| 128 | + end | |
| 129 | + | |
| 130 | + def new_range_instance | |
| 131 | + range = Kalibro::Entities::Range.new | |
| 132 | + range.beginning = params[:range][:beginning] | |
| 133 | + range.end = params[:range][:end] | |
| 134 | + range.label = params[:range][:label] | |
| 135 | + range.grade = params[:range][:grade] | |
| 136 | + range.color = params[:range][:color] | |
| 137 | + range.comments = params[:range][:comments] | |
| 138 | + range | |
| 139 | + end | |
| 140 | + | |
| 141 | +end | ... | ... |
plugins/mezuro/test/functional/mezuro_plugin_myprofile_controller_test.rb
0 → 100644
| ... | ... | @@ -0,0 +1,108 @@ |
| 1 | +require 'test_helper' | |
| 2 | + | |
| 3 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/error_fixtures" | |
| 4 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/base_tool_fixtures" | |
| 5 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/native_metric_fixtures" | |
| 6 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_configuration_fixtures" | |
| 7 | + | |
| 8 | +class MezuroPluginMyprofileControllerTest < ActionController::TestCase | |
| 9 | + | |
| 10 | + def setup | |
| 11 | + @controller = MezuroPluginMyprofileController.new | |
| 12 | + @request = ActionController::TestRequest.new | |
| 13 | + @response = ActionController::TestResponse.new | |
| 14 | + @profile = fast_create(Community) | |
| 15 | + | |
| 16 | + @collector = BaseToolFixtures.analizo | |
| 17 | + @base_tool_client = Kalibro::Client::BaseToolClient.new | |
| 18 | + @metric = NativeMetricFixtures.amloc | |
| 19 | + @metric_configuration_client = Kalibro::Client::MetricConfigurationClient.new | |
| 20 | + @metric_configuration = MetricConfigurationFixtures.amloc_configuration | |
| 21 | + end | |
| 22 | + | |
| 23 | + should 'assign configuration name in choose_base_tool' do | |
| 24 | + get :choose_base_tool, :profile => @profile.identifier, :configuration_name => "test name" | |
| 25 | + assert_equal assigns(:configuration_name), "test name" | |
| 26 | + end | |
| 27 | + | |
| 28 | + should 'create base tool client' do | |
| 29 | + get :choose_base_tool, :profile => @profile.identifier, :configuration_name => "test name" | |
| 30 | + assert assigns(:tool_names).instance_of?(Kalibro::Client::BaseToolClient) | |
| 31 | + end | |
| 32 | + | |
| 33 | + should 'assign configuration and collector name in choose_metric' do | |
| 34 | + Kalibro::Client::BaseToolClient.expects(:new).returns(@base_tool_client) | |
| 35 | + @base_tool_client.expects(:base_tool).with(@collector.name).returns(@collector) | |
| 36 | + get :choose_metric, :profile => @profile.identifier, :configuration_name => "test name", :collector_name => "Analizo" | |
| 37 | + assert_equal assigns(:configuration_name), "test name" | |
| 38 | + assert_equal assigns(:collector_name), "Analizo" | |
| 39 | + end | |
| 40 | + | |
| 41 | + should 'get collector by name' do | |
| 42 | + Kalibro::Client::BaseToolClient.expects(:new).returns(@base_tool_client) | |
| 43 | + @base_tool_client.expects(:base_tool).with(@collector.name).returns(@collector) | |
| 44 | + get :choose_metric, :profile => @profile.identifier, :configuration_name => "test name", :collector_name => "Analizo" | |
| 45 | + assert_equal assigns(:collector), @collector | |
| 46 | + end | |
| 47 | + | |
| 48 | + should 'get choosed native metric and configuration name' do | |
| 49 | + Kalibro::Client::BaseToolClient.expects(:new).returns(@base_tool_client) | |
| 50 | + @base_tool_client.expects(:base_tool).with(@collector.name).returns(@collector) | |
| 51 | + get :new_metric_configuration, :profile => @profile.identifier, :configuration_name => "test name", :collector_name => "Analizo", :metric_name => @metric.name | |
| 52 | + assert_equal assigns(:configuration_name), "test name" | |
| 53 | + assert_equal assigns(:metric), @metric | |
| 54 | + end | |
| 55 | + | |
| 56 | + should 'assign configuration name and get metric_configuration' do | |
| 57 | + Kalibro::Client::MetricConfigurationClient.expects(:new).returns(@metric_configuration_client) | |
| 58 | + @metric_configuration_client.expects(:metric_configuration).with("test name", @metric.name).returns(@metric_configuration) | |
| 59 | + get :edit_metric_configuration, :profile => @profile.identifier, :configuration_name => "test name", :metric_name => @metric.name | |
| 60 | + assert_equal assigns(:configuration_name), "test name" | |
| 61 | + assert_equal assigns(:metric_configuration), @metric_configuration | |
| 62 | + assert_equal assigns(:metric), @metric_configuration.metric | |
| 63 | + end | |
| 64 | + | |
| 65 | + should 'test metric creation' do | |
| 66 | + Kalibro::Client::MetricConfigurationClient.expects(:new).returns(@metric_configuration_client) | |
| 67 | + @metric_configuration_client.expects(:save) | |
| 68 | + get :create_metric_configuration, :profile => @profile.identifier, :configuration_name => "test name", :description => @metric.description, | |
| 69 | + :scope => @metric.scope, :language => @metric.language, :metric => { :name => @metric.name, :origin => @metric.origin}, | |
| 70 | + :metric_configuration => { :code => @metric_configuration.code, :weight => @metric_configuration.code, :aggregation => @metric_configuration.aggregation_form } | |
| 71 | + assert_equal assigns(:configuration_name), "test name" | |
| 72 | + assert_response 302 | |
| 73 | + end | |
| 74 | + | |
| 75 | + should 'test metric edition' do | |
| 76 | + Kalibro::Client::MetricConfigurationClient.expects(:new).returns(@metric_configuration_client) | |
| 77 | + @metric_configuration_client.expects(:save) | |
| 78 | + 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" | |
| 82 | + assert_response 302 | |
| 83 | + end | |
| 84 | + | |
| 85 | + should 'assign configuration name and metric name to new range' do | |
| 86 | + get :new_range, :profile => @profile.identifier, :configuration_name => "test name", :metric_name => @metric.name | |
| 87 | + assert_equal assigns(:configuration_name), "test name" | |
| 88 | + assert_equal assigns(:metric_name), @metric.name | |
| 89 | + end | |
| 90 | + | |
| 91 | + should 'create instance range' do | |
| 92 | + Kalibro::Client::MetricConfigurationClient.expects(:new).returns(@metric_configuration_client) | |
| 93 | + @metric_configuration_client.expects(:metric_configuration).with("test name", @metric.name).returns(@metric_configuration) | |
| 94 | + @metric_configuration_client.expects(:save) | |
| 95 | + range = @metric_configuration.ranges[0] | |
| 96 | + get :create_range, :profile => @profile.identifier, :range => { :beginning => range.beginning, :end => range.end, :label => range.label, | |
| 97 | + :grade => range.grade, :color => range.color, :comments => range.comments }, :configuration_name => "test name", :metric_name => @metric.name | |
| 98 | + assert assigns(:range).instance_of?(Kalibro::Entities::Range) | |
| 99 | + end | |
| 100 | + | |
| 101 | + should 'redirect from remove metric configuration' do | |
| 102 | + Kalibro::Client::MetricConfigurationClient.expects(:new).returns(@metric_configuration_client) | |
| 103 | + @metric_configuration_client.expects(:remove) | |
| 104 | + get :remove_metric_configuration, :profile => @profile.identifier, :configuration_name => "test name", :metric_name => @metric.name | |
| 105 | + assert_response 302 | |
| 106 | + end | |
| 107 | + | |
| 108 | +end | ... | ... |
plugins/mezuro/views/mezuro_plugin_myprofile/_edit_range.html.erb
0 → 100644
| ... | ... | @@ -0,0 +1,4 @@ |
| 1 | +<% remote_form_for :range, :url => {:action =>"update_range", :controller => "mezuro_plugin_myprofile"}, :method => :get do |f| %> | |
| 2 | + <%= hidden_field_tag :beginning_id, beginning_id %> | |
| 3 | + <%= render :partial => "range_form", :locals => {:f => f, :metric_name => metric_name, :configuration_name => configuration_name, :beginning_id => beginning_id, :range => range } %> | |
| 4 | +<% end %> | ... | ... |
plugins/mezuro/views/mezuro_plugin_myprofile/_new_range.html.erb
0 → 100644
| ... | ... | @@ -0,0 +1,3 @@ |
| 1 | +<% remote_form_for :range, :url => {:action =>"create_range", :controller => "mezuro_plugin_myprofile"}, :method => :get do |f| %> | |
| 2 | + <%= render :partial => "range_form", :locals => {:f => f, :metric_name => metric_name, :configuration_name => configuration_name } %> | |
| 3 | +<% end %> | ... | ... |
plugins/mezuro/views/mezuro_plugin_myprofile/_range.html.erb
0 → 100644
| ... | ... | @@ -0,0 +1,17 @@ |
| 1 | +<tr> | |
| 2 | + <td> | |
| 3 | + <%=range.label%> | |
| 4 | + </td> | |
| 5 | + <td> | |
| 6 | + <%=range.beginning%> | |
| 7 | + </td> | |
| 8 | + <td> | |
| 9 | + <%=range.end%> | |
| 10 | + </td> | |
| 11 | + <td> | |
| 12 | + <%=range.grade%> | |
| 13 | + </td> | |
| 14 | + <td bgcolor="#<%= range.color[2..-1] %>"></td> | |
| 15 | + <td><%= link_to_remote "Edit", :url => {:action =>"edit_range", :controller => "mezuro_plugin_myprofile", :configuration_name => params[:configuration_name], :metric_name => params[:metric_name], :beginning_id => range.beginning} %></td> | |
| 16 | + <td><%= link_to "Remove", :action =>"remove_range", :controller => "mezuro_plugin_myprofile", :configuration_name => params[:configuration_name], :metric_name => params[:metric_name], :range_beginning => range.beginning %></td> | |
| 17 | +</tr> | ... | ... |
plugins/mezuro/views/mezuro_plugin_myprofile/_range_form.html.erb
0 → 100644
| ... | ... | @@ -0,0 +1,53 @@ |
| 1 | +<%= hidden_field_tag :configuration_name, configuration_name %> | |
| 2 | +<%= hidden_field_tag :metric_name, metric_name %> | |
| 3 | +<table> | |
| 4 | + <tr> | |
| 5 | + <td> | |
| 6 | + <%= f.label :label, "Label:" %> | |
| 7 | + </td> | |
| 8 | + <td> | |
| 9 | + <%= f.text_field :label %> | |
| 10 | + </td> | |
| 11 | + </tr> | |
| 12 | + <tr> | |
| 13 | + <td> | |
| 14 | + <%= f.label :beginning, "Beginning:" %> | |
| 15 | + </td> | |
| 16 | + <td> | |
| 17 | + <%= f.text_field :beginning %> | |
| 18 | + </td> | |
| 19 | + </tr> | |
| 20 | + <tr> | |
| 21 | + <td> | |
| 22 | + <%= f.label :end, "End:" %> | |
| 23 | + </td> | |
| 24 | + <td> | |
| 25 | + <%= f.text_field :end %> | |
| 26 | + </td> | |
| 27 | + </tr> | |
| 28 | + <tr> | |
| 29 | + <td> | |
| 30 | + <%= f.label :grade, "Grade:" %> | |
| 31 | + </td> | |
| 32 | + <td> | |
| 33 | + <%= f.text_field :grade %> | |
| 34 | + </td> | |
| 35 | + </tr> | |
| 36 | + <tr> | |
| 37 | + <td> | |
| 38 | + <%= f.label :color, "Color:" %> | |
| 39 | + </td> | |
| 40 | + <td> | |
| 41 | + <%= f.text_field :color %> | |
| 42 | + </td> | |
| 43 | + </tr> | |
| 44 | + <tr> | |
| 45 | + <td> | |
| 46 | + <%= f.label :comments, "Comments:" %> | |
| 47 | + </td> | |
| 48 | + <td> | |
| 49 | + <%= f.text_field :comments %> | |
| 50 | + </td> | |
| 51 | + </tr> | |
| 52 | +</table> | |
| 53 | +<%= f.submit "Save Range" %> | ... | ... |
plugins/mezuro/views/mezuro_plugin_myprofile/choose_base_tool.html.erb
0 → 100644
| ... | ... | @@ -0,0 +1,13 @@ |
| 1 | +<h2><%= @configuration_name%> Configuration</h2> | |
| 2 | + | |
| 3 | +<h5>Base Tools:</h5> | |
| 4 | +<table id="project_info"> | |
| 5 | + <% @tool_names.base_tool_names.each do |collector_name| %> | |
| 6 | + <tr> | |
| 7 | + <td> | |
| 8 | + <%= link_to collector_name, :controller => "mezuro_plugin_myprofile", :action => "choose_metric", :params => | |
| 9 | + {:configuration_name => @configuration_name, :collector_name => collector_name} %> | |
| 10 | + </td> | |
| 11 | + </tr> | |
| 12 | + <% end %> | |
| 13 | +</table> | ... | ... |
plugins/mezuro/views/mezuro_plugin_myprofile/choose_metric.html.erb
0 → 100644
| ... | ... | @@ -0,0 +1,18 @@ |
| 1 | +<h2><%= @configuration_name %> Configuration</h2> | |
| 2 | + | |
| 3 | +<table id="project_info"> | |
| 4 | + <tr> | |
| 5 | + <h5>Metric Collector: <%= @collector_name %></h5> | |
| 6 | + </tr> | |
| 7 | + <tr> | |
| 8 | + <h5>Choose a metric to add:</h5> | |
| 9 | + </tr> | |
| 10 | + <% @collector.supported_metrics.each do |metric| %> | |
| 11 | + <tr class="metric" title="<%= metric.name %>"> | |
| 12 | + <td> | |
| 13 | + <%= link_to metric.name, :controller => "mezuro_plugin_myprofile", :action => "new_metric_configuration", :params => {:metric_name => metric.name, | |
| 14 | + :collector_name => @collector_name, :configuration_name => @configuration_name} %> | |
| 15 | + </td> | |
| 16 | + </tr> | |
| 17 | + <% end %> | |
| 18 | +</table> | ... | ... |
plugins/mezuro/views/mezuro_plugin_myprofile/create_range.rjs
0 → 100644
plugins/mezuro/views/mezuro_plugin_myprofile/edit_metric_configuration.html.erb
0 → 100644
| ... | ... | @@ -0,0 +1,78 @@ |
| 1 | +<h2><%= @configuration_name %> Configuration</h2> | |
| 2 | + | |
| 3 | +<% form_for :metric_configuration, :url => {:action =>"update_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 | + <% @metric.language.each do |language| %> | |
| 8 | + <%= hidden_field_tag "language[]", language %> | |
| 9 | + <% end %> | |
| 10 | + | |
| 11 | + <p> | |
| 12 | + <%= f.label :origin, "Collector Name:" %> | |
| 13 | + <%= @metric.origin %> | |
| 14 | + <%= hidden_field_tag "metric[origin]", @metric.origin %> | |
| 15 | + </p> | |
| 16 | + <p> | |
| 17 | + <%= f.label :metric_name, "Metric Name:" %> | |
| 18 | + <%= @metric.name %> | |
| 19 | + <%= hidden_field_tag "metric[name]", @metric.name %> | |
| 20 | + </p> | |
| 21 | + <p> | |
| 22 | + <%= f.label :description, "Description:" %> | |
| 23 | + <%= @metric.description %> | |
| 24 | + <%= text_field_tag "metric[description]", @metric.description %> | |
| 25 | + </p> | |
| 26 | + <p> | |
| 27 | + <%= f.label :code, "Code:" %> | |
| 28 | + <%= @metric_configuration.code %> | |
| 29 | + <%= f.hidden_field :code, :value => @metric_configuration.code %> | |
| 30 | + </p> | |
| 31 | + <p> | |
| 32 | + <%= f.label :aggregation_form, "Aggregation Form:" %> | |
| 33 | + <%= f.select :aggregation_form, [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"], | |
| 34 | + ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]] %> | |
| 35 | + </p> | |
| 36 | + <p> | |
| 37 | + <%= f.label :weight, "Weight:" %> | |
| 38 | + <%= f.text_field :weight %> | |
| 39 | + </p> | |
| 40 | + | |
| 41 | + <p> | |
| 42 | + <%= f.submit "Save" %> | |
| 43 | + </p> | |
| 44 | +<% end %> | |
| 45 | + | |
| 46 | + | |
| 47 | +<h5> Ranges </h5><br/> | |
| 48 | + | |
| 49 | +<table id="ranges"> | |
| 50 | + <tr> | |
| 51 | + <td> | |
| 52 | + Label | |
| 53 | + </td> | |
| 54 | + <td> | |
| 55 | + Beginning | |
| 56 | + </td> | |
| 57 | + <td> | |
| 58 | + End | |
| 59 | + </td> | |
| 60 | + <td> | |
| 61 | + Grade | |
| 62 | + </td> | |
| 63 | + <td> | |
| 64 | + Color | |
| 65 | + </td> | |
| 66 | + </tr> | |
| 67 | + <% if (@metric_configuration.ranges!=nil) | |
| 68 | + @metric_configuration.ranges.each do |range| %> | |
| 69 | + <%= render :partial => "range", :locals => {:range => range, :configuration_name => @configuration_name, | |
| 70 | + :metric_name => @metric_configuration.metric.name} %> | |
| 71 | + <% end | |
| 72 | + end %> | |
| 73 | +</table> | |
| 74 | + | |
| 75 | +<br/> | |
| 76 | +<%= link_to_remote "New Range", :url => {:action =>"new_range", :controller => "mezuro_plugin_myprofile", :configuration_name => @configuration_name, :metric_name => @metric.name} %> | |
| 77 | +<div id="range_form" style="display:none"></div> | |
| 78 | + | ... | ... |
plugins/mezuro/views/mezuro_plugin_myprofile/edit_range.rjs
0 → 100644
plugins/mezuro/views/mezuro_plugin_myprofile/new_metric_configuration.html.erb
0 → 100644
| ... | ... | @@ -0,0 +1,44 @@ |
| 1 | +<h2><%= @configuration_name %> Configuration</h2> | |
| 2 | + | |
| 3 | +<% form_for :metric_configuration, :url => {:action =>"create_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 | + <% @metric.language.each do |language| %> | |
| 8 | + <%= hidden_field_tag "language[]", language %> | |
| 9 | + <% end %> | |
| 10 | + | |
| 11 | + <p> | |
| 12 | + <%= f.label :origin, "Collector Name:" %> | |
| 13 | + <%= @metric.origin %> | |
| 14 | + <%= hidden_field_tag "metric[origin]", @metric.origin %> | |
| 15 | + </p> | |
| 16 | + <p> | |
| 17 | + <%= f.label :metric_name, "Metric Name:" %> | |
| 18 | + <%= @metric.name %> | |
| 19 | + <%= hidden_field_tag "metric[name]", @metric.name %> | |
| 20 | + </p> | |
| 21 | + <p> | |
| 22 | + <%= f.label :description, "Description:" %> | |
| 23 | + <%= @metric.description %> | |
| 24 | + <%= text_field_tag :description %> | |
| 25 | + </p> | |
| 26 | + <p> | |
| 27 | + <%= f.label :code, "Code:" %> | |
| 28 | + <%= f.text_field :code %> | |
| 29 | + </p> | |
| 30 | + <p> | |
| 31 | + <%= f.label :aggregation_form, "Aggregation:" %> | |
| 32 | + <%= f.select :aggregation_form, [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"], | |
| 33 | + ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]] %> | |
| 34 | + </p> | |
| 35 | + <p> | |
| 36 | + <%= f.label :weight, "Weight:" %> | |
| 37 | + <%= f.text_field :weight %> | |
| 38 | + </p> | |
| 39 | + | |
| 40 | + <p> | |
| 41 | + <%= f.submit "Add" %> | |
| 42 | + </p> | |
| 43 | + | |
| 44 | +<% end %> | ... | ... |
plugins/mezuro/views/mezuro_plugin_myprofile/new_range.rjs
0 → 100644
plugins/mezuro/views/mezuro_plugin_myprofile/update_range.rjs
0 → 100644
| ... | ... | @@ -0,0 +1 @@ |
| 1 | +page.reload() | ... | ... |