Commit 1f175117b4870629dcd1d9c7099d9d60eba409e6
Committed by
Paulo Meireles
1 parent
2ca9dda6
Exists in
master
and in
29 other branches
[Mezuro] Refactored my_profile controller to metric_configuration controller
1 test is still failing
Showing
16 changed files
with
555 additions
and
505 deletions
Show diff stats
plugins/mezuro/controllers/mezuro_plugin_myprofile_controller.rb
... | ... | @@ -1,127 +0,0 @@ |
1 | -class MezuroPluginMyprofileController < ProfileController | |
2 | - | |
3 | - append_view_path File.join(File.dirname(__FILE__) + '/../views') | |
4 | - | |
5 | - rescue_from Exception do |exception| | |
6 | - message = URI.escape(CGI.escape(exception.message),'.') | |
7 | - redirect_to_error_page message | |
8 | - end | |
9 | - | |
10 | - def error_page | |
11 | - @message = params[:message] | |
12 | - end | |
13 | - | |
14 | - def choose_base_tool | |
15 | - @configuration_content = profile.articles.find(params[:id]) | |
16 | - @base_tools = Kalibro::BaseTool.all_names | |
17 | - end | |
18 | - | |
19 | - def choose_metric | |
20 | - @configuration_content = profile.articles.find(params[:id]) | |
21 | - @base_tool = params[:base_tool] | |
22 | - base_tool = Kalibro::BaseTool.find_by_name(@base_tool) | |
23 | - @supported_metrics = base_tool.nil? ? [] : base_tool.supported_metrics | |
24 | - end | |
25 | - | |
26 | - def new_metric_configuration | |
27 | - @configuration_content = profile.articles.find(params[:id]) | |
28 | - @metric = Kalibro::BaseTool.find_by_name(params[:base_tool]).metric params[:metric_name] | |
29 | - end | |
30 | - | |
31 | - def new_compound_metric_configuration | |
32 | - @configuration_content = profile.articles.find(params[:id]) | |
33 | - @metric_configurations = @configuration_content.metric_configurations | |
34 | - if configuration_content_has_errors? | |
35 | - redirect_to_error_page @configuration_content.errors[:base] | |
36 | - end | |
37 | - end | |
38 | - | |
39 | - def edit_metric_configuration | |
40 | - @configuration_content = profile.articles.find(params[:id]) | |
41 | - @metric_configuration = Kalibro::MetricConfiguration.find_by_configuration_name_and_metric_name(@configuration_content.name, params[:metric_name]) | |
42 | - @metric = @metric_configuration.metric | |
43 | - end | |
44 | - | |
45 | - def edit_compound_metric_configuration | |
46 | - @configuration_content = profile.articles.find(params[:id]) | |
47 | - @metric_configuration = Kalibro::MetricConfiguration.find_by_configuration_name_and_metric_name(@configuration_content.name, params[:metric_name]) | |
48 | - @metric_configurations = @configuration_content.metric_configurations | |
49 | - @metric = @metric_configuration.metric | |
50 | - end | |
51 | - | |
52 | - def create_metric_configuration | |
53 | - id = params[:id] | |
54 | - metric_name = params[:metric_configuration][:metric][:name] | |
55 | - metric_configuration = Kalibro::MetricConfiguration.new(params[:metric_configuration]) | |
56 | - metric_configuration.save | |
57 | - if metric_configuration_has_errors? metric_configuration | |
58 | - redirect_to_error_page metric_configuration.errors[0].message | |
59 | - else | |
60 | - redirect_to "/myprofile/#{profile.identifier}/plugin/mezuro/edit_metric_configuration?id=#{id}&metric_name=#{metric_name.gsub(/\s/, '+')}" | |
61 | - end | |
62 | - end | |
63 | - | |
64 | - def create_compound_metric_configuration | |
65 | - id = params[:id] | |
66 | - metric_name = params[:metric_configuration][:metric][:name] | |
67 | - metric_configuration = Kalibro::MetricConfiguration.new(params[:metric_configuration]) | |
68 | - metric_configuration.save | |
69 | - if metric_configuration_has_errors? metric_configuration | |
70 | - redirect_to_error_page metric_configuration.errors[0].message | |
71 | - else | |
72 | - redirect_to "/myprofile/#{profile.identifier}/plugin/mezuro/edit_compound_metric_configuration?id=#{id}&metric_name=#{metric_name.gsub(/\s/, '+')}" | |
73 | - end | |
74 | - end | |
75 | - | |
76 | - def update_metric_configuration | |
77 | - @configuration_content = profile.articles.find(params[:id]) | |
78 | - metric_name = params[:metric_configuration][:metric][:name] | |
79 | - metric_configuration = Kalibro::MetricConfiguration.find_by_configuration_name_and_metric_name(@configuration_content.name, metric_name) | |
80 | - metric_configuration.update_attributes params[:metric_configuration] | |
81 | - if metric_configuration_has_errors? metric_configuration | |
82 | - redirect_to_error_page metric_configuration.errors[0].message | |
83 | - else | |
84 | - redirect_to "/#{profile.identifier}/#{@configuration_content.slug}" | |
85 | - end | |
86 | - end | |
87 | - | |
88 | - def update_compound_metric_configuration | |
89 | - @configuration_content = profile.articles.find(params[:id]) | |
90 | - metric_name = params[:metric_configuration][:metric][:name] | |
91 | - metric_configuration = Kalibro::MetricConfiguration.find_by_configuration_name_and_metric_name(@configuration_content.name, metric_name) | |
92 | - metric_configuration.update_attributes params[:metric_configuration] | |
93 | - if metric_configuration_has_errors? metric_configuration | |
94 | - redirect_to_error_page metric_configuration.errors[0].message | |
95 | - else | |
96 | - redirect_to "/#{profile.identifier}/#{@configuration_content.slug}" | |
97 | - end | |
98 | - end | |
99 | - | |
100 | - def remove_metric_configuration | |
101 | - configuration_content = profile.articles.find(params[:id]) | |
102 | - metric_name = params[:metric_name] | |
103 | - metric_configuration = Kalibro::MetricConfiguration.find_by_configuration_name_and_metric_name(configuration_content.name, metric_name) | |
104 | - metric_configuration.destroy | |
105 | - if metric_configuration_has_errors? metric_configuration | |
106 | - redirect_to_error_page metric_configuration.errors[0].message | |
107 | - else | |
108 | - redirect_to "/#{profile.identifier}/#{configuration_content.slug}" | |
109 | - end | |
110 | - end | |
111 | - | |
112 | - private | |
113 | - | |
114 | - def redirect_to_error_page(message) | |
115 | - message = URI.escape(CGI.escape(message),'.') | |
116 | - redirect_to "/myprofile/#{profile.identifier}/plugin/mezuro/error_page?message=#{message}" | |
117 | - end | |
118 | - | |
119 | - def configuration_content_has_errors? | |
120 | - not @configuration_content.errors[:base].nil? | |
121 | - end | |
122 | - | |
123 | - def metric_configuration_has_errors? metric_configuration | |
124 | - not metric_configuration.errors.empty? | |
125 | - end | |
126 | - | |
127 | -end |
plugins/mezuro/controllers/myprofile/mezuro_plugin_metric_configuration_controller.rb
0 → 100644
... | ... | @@ -0,0 +1,98 @@ |
1 | +class MezuroPluginMetricConfigurationController < MezuroPluginMyprofileController | |
2 | + | |
3 | + append_view_path File.join(File.dirname(__FILE__) + '/../../views') | |
4 | + | |
5 | + | |
6 | + def new_metric_configuration | |
7 | + @configuration_content = profile.articles.find(params[:id]) | |
8 | + @metric = Kalibro::BaseTool.find_by_name(params[:base_tool]).metric params[:metric_name] | |
9 | + end | |
10 | + | |
11 | + def new_compound_metric_configuration | |
12 | + @configuration_content = profile.articles.find(params[:id]) | |
13 | + @metric_configurations = @configuration_content.metric_configurations | |
14 | + if configuration_content_has_errors? | |
15 | + redirect_to_error_page @configuration_content.errors[:base] | |
16 | + end | |
17 | + end | |
18 | + | |
19 | + def edit_metric_configuration | |
20 | + @configuration_content = profile.articles.find(params[:id]) | |
21 | + @metric_configuration = Kalibro::MetricConfiguration.find_by_configuration_name_and_metric_name(@configuration_content.name, params[:metric_name]) | |
22 | + @metric = @metric_configuration.metric | |
23 | + end | |
24 | + | |
25 | + def edit_compound_metric_configuration | |
26 | + @configuration_content = profile.articles.find(params[:id]) | |
27 | + @metric_configuration = Kalibro::MetricConfiguration.find_by_configuration_name_and_metric_name(@configuration_content.name, params[:metric_name]) | |
28 | + @metric_configurations = @configuration_content.metric_configurations | |
29 | + @metric = @metric_configuration.metric | |
30 | + end | |
31 | + | |
32 | + def create_metric_configuration | |
33 | + id = params[:id] | |
34 | + metric_name = params[:metric_configuration][:metric][:name] | |
35 | + metric_configuration = Kalibro::MetricConfiguration.new(params[:metric_configuration]) | |
36 | + metric_configuration.save | |
37 | + if metric_configuration_has_errors? metric_configuration | |
38 | + redirect_to_error_page metric_configuration.errors[0].message | |
39 | + else | |
40 | + redirect_to "edit_metric_configuration?id=#{id}&metric_name=#{metric_name.gsub(/\s/, '+')}" | |
41 | + end | |
42 | + end | |
43 | + | |
44 | + def create_compound_metric_configuration | |
45 | + id = params[:id] | |
46 | + metric_name = params[:metric_configuration][:metric][:name] | |
47 | + metric_configuration = Kalibro::MetricConfiguration.new(params[:metric_configuration]) | |
48 | + metric_configuration.save | |
49 | + if metric_configuration_has_errors? metric_configuration | |
50 | + redirect_to_error_page metric_configuration.errors[0].message | |
51 | + else | |
52 | + redirect_to "edit_compound_metric_configuration?id=#{id}&metric_name=#{metric_name.gsub(/\s/, '+')}" | |
53 | + end | |
54 | + end | |
55 | + | |
56 | + def update_metric_configuration | |
57 | + @configuration_content = profile.articles.find(params[:id]) | |
58 | + metric_name = params[:metric_configuration][:metric][:name] | |
59 | + metric_configuration = Kalibro::MetricConfiguration.find_by_configuration_name_and_metric_name(@configuration_content.name, metric_name) | |
60 | + metric_configuration.update_attributes params[:metric_configuration] | |
61 | + if metric_configuration_has_errors? metric_configuration | |
62 | + redirect_to_error_page metric_configuration.errors[0].message | |
63 | + else | |
64 | + redirect_to "/#{profile.identifier}/#{@configuration_content.slug}" | |
65 | + end | |
66 | + end | |
67 | + | |
68 | + def update_compound_metric_configuration | |
69 | + @configuration_content = profile.articles.find(params[:id]) | |
70 | + metric_name = params[:metric_configuration][:metric][:name] | |
71 | + metric_configuration = Kalibro::MetricConfiguration.find_by_configuration_name_and_metric_name(@configuration_content.name, metric_name) | |
72 | + metric_configuration.update_attributes params[:metric_configuration] | |
73 | + if metric_configuration_has_errors? metric_configuration | |
74 | + redirect_to_error_page metric_configuration.errors[0].message | |
75 | + else | |
76 | + redirect_to "/#{profile.identifier}/#{@configuration_content.slug}" | |
77 | + end | |
78 | + end | |
79 | + | |
80 | + def remove_metric_configuration | |
81 | + configuration_content = profile.articles.find(params[:id]) | |
82 | + metric_name = params[:metric_name] | |
83 | + metric_configuration = Kalibro::MetricConfiguration.find_by_configuration_name_and_metric_name(configuration_content.name, metric_name) | |
84 | + metric_configuration.destroy | |
85 | + if metric_configuration_has_errors? metric_configuration | |
86 | + redirect_to_error_page metric_configuration.errors[0].message | |
87 | + else | |
88 | + redirect_to "/#{profile.identifier}/#{configuration_content.slug}" | |
89 | + end | |
90 | + end | |
91 | + | |
92 | + private | |
93 | + | |
94 | + def configuration_content_has_errors? | |
95 | + not @configuration_content.errors[:base].nil? | |
96 | + end | |
97 | + | |
98 | +end | ... | ... |
plugins/mezuro/controllers/myprofile/mezuro_plugin_myprofile_controller.rb
0 → 100644
... | ... | @@ -0,0 +1,37 @@ |
1 | +class MezuroPluginMyprofileController < ProfileController #MyprofileController? | |
2 | + | |
3 | + append_view_path File.join(File.dirname(__FILE__) + '/../../views') | |
4 | + | |
5 | + rescue_from Exception do |exception| | |
6 | + message = URI.escape(CGI.escape(exception.message),'.') | |
7 | + redirect_to_error_page message | |
8 | + end | |
9 | + | |
10 | + def error_page | |
11 | + @message = params[:message] | |
12 | + end | |
13 | + | |
14 | + def choose_base_tool | |
15 | + @configuration_content = profile.articles.find(params[:id]) | |
16 | + @base_tools = Kalibro::BaseTool.all_names | |
17 | + end | |
18 | + | |
19 | + def choose_metric | |
20 | + @configuration_content = profile.articles.find(params[:id]) | |
21 | + @base_tool = params[:base_tool] | |
22 | + base_tool = Kalibro::BaseTool.find_by_name(@base_tool) | |
23 | + @supported_metrics = base_tool.nil? ? [] : base_tool.supported_metrics | |
24 | + end | |
25 | + | |
26 | + protected | |
27 | + | |
28 | + def redirect_to_error_page(message) | |
29 | + message = URI.escape(CGI.escape(message),'.') | |
30 | + redirect_to "/myprofile/#{profile.identifier}/plugin/mezuro/error_page?message=#{message}" | |
31 | + end | |
32 | + | |
33 | + def metric_configuration_has_errors? metric_configuration | |
34 | + not metric_configuration.errors.empty? | |
35 | + end | |
36 | + | |
37 | +end | ... | ... |
plugins/mezuro/test/functional/mezuro_plugin_myprofile_controller_test.rb
... | ... | @@ -53,105 +53,6 @@ class MezuroPluginMyprofileControllerTest < ActionController::TestCase |
53 | 53 | assert_response 200 |
54 | 54 | end |
55 | 55 | |
56 | - should 'test new metric configuration' do | |
57 | - Kalibro::BaseTool.expects(:request).with("BaseTool", :get_base_tool, {:base_tool_name => @base_tool.name}).returns({:base_tool => @base_tool_hash}) | |
58 | - get :new_metric_configuration, :profile => @profile.identifier, :id => @content.id, :base_tool => @base_tool.name, :metric_name => @metric.name | |
59 | - assert_equal @content, assigns(:configuration_content) | |
60 | - assert_equal @metric.name, assigns(:metric).name | |
61 | - assert_response 200 | |
62 | - end | |
63 | - | |
64 | - | |
65 | - should 'test new compound metric configuration' do | |
66 | - Kalibro::Configuration.expects(:request).with("Configuration", :get_configuration, {:configuration_name => @content.name}).returns({:configuration => @configuration_hash}) | |
67 | - get :new_compound_metric_configuration, :profile => @profile.identifier, :id => @content.id | |
68 | - assert_equal @content, assigns(:configuration_content) | |
69 | - assert_equal @configuration.metric_configuration[0].code, assigns(:metric_configurations)[0].code | |
70 | - assert_response 200 | |
71 | - end | |
72 | 56 | |
73 | - should 'test edit metric configuration' do | |
74 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { | |
75 | - :configuration_name => @content.name, | |
76 | - :metric_name => @metric_configuration.metric.name}).returns({:metric_configuration => @metric_configuration_hash}) | |
77 | - get :edit_metric_configuration, :profile => @profile.identifier, :id => @content.id, :metric_name => @metric.name | |
78 | - assert_equal @content, assigns(:configuration_content) | |
79 | - assert_equal @metric_configuration.code, assigns(:metric_configuration).code | |
80 | - assert_equal @metric_configuration.metric.name, assigns(:metric).name | |
81 | - assert_response 200 | |
82 | - end | |
83 | - | |
84 | - should 'test edit compound metric configuration' do | |
85 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { | |
86 | - :configuration_name => @content.name, | |
87 | - :metric_name => @compound_metric_configuration.metric.name}).returns({:metric_configuration => @compound_metric_configuration_hash}) | |
88 | - Kalibro::Configuration.expects(:request).with("Configuration", :get_configuration, {:configuration_name => @content.name}).returns({:configuration => @configuration_hash}) | |
89 | - get :edit_compound_metric_configuration, | |
90 | - :profile => @profile.identifier, | |
91 | - :id => @content.id, | |
92 | - :metric_name => @compound_metric_configuration.metric.name | |
93 | - assert_equal @content, assigns(:configuration_content) | |
94 | - assert_equal @compound_metric_configuration.code, assigns(:metric_configuration).code | |
95 | - assert_equal @compound_metric_configuration.metric.name, assigns(:metric).name | |
96 | - assert_equal @configuration.metric_configuration[0].code, assigns(:metric_configurations)[0].code | |
97 | - assert_response 200 | |
98 | - end | |
99 | - | |
100 | - should 'test create native metric configuration' do | |
101 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, { | |
102 | - :metric_configuration => @metric_configuration.to_hash, | |
103 | - :configuration_name => @metric_configuration.configuration_name}) | |
104 | - get :create_metric_configuration, | |
105 | - :profile => @profile.identifier, | |
106 | - :id => @content.id, | |
107 | - :metric_configuration => @native_hash | |
108 | - assert_response 302 | |
109 | - end | |
110 | - | |
111 | - should 'test compound metric creation' do | |
112 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, { | |
113 | - :metric_configuration => @compound_metric_configuration.to_hash, | |
114 | - :configuration_name => @compound_metric_configuration.configuration_name}) | |
115 | - get :create_compound_metric_configuration, :profile => @profile.identifier, :id => @content.id, | |
116 | - :metric_configuration => @compound_hash | |
117 | - assert_response 302 | |
118 | - end | |
119 | - | |
120 | - should 'test update native metric configuration' do | |
121 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { | |
122 | - :configuration_name => @content.name, | |
123 | - :metric_name => @metric_configuration.metric.name}).returns({:metric_configuration => @metric_configuration_hash}) | |
124 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, { | |
125 | - :metric_configuration => @metric_configuration.to_hash, | |
126 | - :configuration_name => @metric_configuration.configuration_name}) | |
127 | - get :update_metric_configuration, :profile => @profile.identifier, :id => @content.id, | |
128 | - :metric_configuration => @native_hash | |
129 | - assert_equal @content, assigns(:configuration_content) | |
130 | - assert_response 302 | |
131 | - end | |
132 | - | |
133 | - should 'test update compound metric configuration' do | |
134 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { | |
135 | - :configuration_name => @content.name, | |
136 | - :metric_name => @compound_metric_configuration.metric.name}).returns({:metric_configuration => @compound_metric_configuration_hash}) | |
137 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, { | |
138 | - :metric_configuration => @compound_metric_configuration.to_hash, | |
139 | - :configuration_name => @compound_metric_configuration.configuration_name}) | |
140 | - get :update_compound_metric_configuration, :profile => @profile.identifier, :id => @content.id, | |
141 | - :metric_configuration => @compound_hash | |
142 | - assert_equal @content, assigns(:configuration_content) | |
143 | - assert_response 302 | |
144 | - end | |
145 | - | |
146 | - should 'test remove metric configuration' do | |
147 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { | |
148 | - :configuration_name => @content.name, | |
149 | - :metric_name => @metric.name}).returns({:metric_configuration => @metric_configuration_hash}) | |
150 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :remove_metric_configuration, { | |
151 | - :metric_name => @metric.name, | |
152 | - :configuration_name => @metric_configuration.configuration_name}) | |
153 | - get :remove_metric_configuration, :profile => @profile.identifier, :id => @content.id, :metric_name => @metric.name | |
154 | - assert_response 302 | |
155 | - end | |
156 | 57 | |
157 | 58 | end | ... | ... |
plugins/mezuro/test/functional/myprofile/mezuro_plugin_metric_configuration_controller_test.rb
0 → 100644
... | ... | @@ -0,0 +1,141 @@ |
1 | +require 'test_helper' | |
2 | + | |
3 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/base_tool_fixtures" | |
4 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/native_metric_fixtures" | |
5 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_configuration_fixtures" | |
6 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/configuration_fixtures" | |
7 | + | |
8 | +class MezuroPluginMetricConfigurationControllerTest < ActionController::TestCase | |
9 | + | |
10 | + def setup | |
11 | + @controller = MezuroPluginMetricConfigurationController.new | |
12 | + @request = ActionController::TestRequest.new | |
13 | + @response = ActionController::TestResponse.new | |
14 | + @profile = fast_create(Community) | |
15 | + | |
16 | + @base_tool = BaseToolFixtures.base_tool | |
17 | + @base_tool_hash = BaseToolFixtures.base_tool_hash | |
18 | + @metric = NativeMetricFixtures.amloc | |
19 | + @metric_configuration = MetricConfigurationFixtures.amloc_metric_configuration | |
20 | + @metric_configuration_hash = MetricConfigurationFixtures.amloc_metric_configuration_hash | |
21 | + @compound_metric_configuration = MetricConfigurationFixtures.sc_metric_configuration | |
22 | + @compound_metric_configuration_hash = MetricConfigurationFixtures.sc_metric_configuration_hash | |
23 | + @configuration = ConfigurationFixtures.configuration | |
24 | + @configuration_hash = ConfigurationFixtures.configuration_hash | |
25 | + | |
26 | + Kalibro::Configuration.expects(:all_names).returns([]) | |
27 | + @content = MezuroPlugin::ConfigurationContent.new(:profile => @profile, :name => @configuration.name) | |
28 | + @content.expects(:send_kalibro_configuration_to_service).returns(nil) | |
29 | + @content.stubs(:solr_save) | |
30 | + @content.save | |
31 | + | |
32 | + @native_hash = @metric_configuration.to_hash.merge({:configuration_name => @metric_configuration.configuration_name}) | |
33 | + @native_hash.delete :attributes! | |
34 | + @compound_hash = @compound_metric_configuration.to_hash.merge({:configuration_name => @compound_metric_configuration.configuration_name}) | |
35 | + @compound_hash.delete :attributes! | |
36 | + | |
37 | + end | |
38 | + | |
39 | + should 'test new metric configuration' do | |
40 | + Kalibro::BaseTool.expects(:request).with("BaseTool", :get_base_tool, {:base_tool_name => @base_tool.name}).returns({:base_tool => @base_tool_hash}) | |
41 | + get :new_metric_configuration, :profile => @profile.identifier, :id => @content.id, :base_tool => @base_tool.name, :metric_name => @metric.name | |
42 | + assert_equal @content, assigns(:configuration_content) | |
43 | + assert_equal @metric.name, assigns(:metric).name | |
44 | + assert_response 200 | |
45 | + end | |
46 | + | |
47 | + | |
48 | + should 'test new compound metric configuration' do | |
49 | + Kalibro::Configuration.expects(:request).with("Configuration", :get_configuration, { | |
50 | + :configuration_name => @content.name}).returns({:configuration => @configuration_hash}) | |
51 | + get :new_compound_metric_configuration, :profile => @profile.identifier, :id => @content.id | |
52 | + assert_equal @content, assigns(:configuration_content) | |
53 | + assert_equal @configuration.metric_configuration[0].code, assigns(:metric_configurations)[0].code | |
54 | + assert_response 200 | |
55 | + end | |
56 | + | |
57 | + should 'test edit metric configuration' do | |
58 | + Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { | |
59 | + :configuration_name => @content.name, | |
60 | + :metric_name => @metric_configuration.metric.name}).returns({:metric_configuration => @metric_configuration_hash}) | |
61 | + get :edit_metric_configuration, :profile => @profile.identifier, :id => @content.id, :metric_name => @metric.name | |
62 | + assert_equal @content, assigns(:configuration_content) | |
63 | + assert_equal @metric_configuration.code, assigns(:metric_configuration).code | |
64 | + assert_equal @metric_configuration.metric.name, assigns(:metric).name | |
65 | + assert_response 200 | |
66 | + end | |
67 | + | |
68 | + should 'test edit compound metric configuration' do | |
69 | + Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { | |
70 | + :configuration_name => @content.name, | |
71 | + :metric_name => @compound_metric_configuration.metric.name}).returns({:metric_configuration => @compound_metric_configuration_hash}) | |
72 | + Kalibro::Configuration.expects(:request).with("Configuration", :get_configuration, {:configuration_name => @content.name}).returns({:configuration => @configuration_hash}) | |
73 | + get :edit_compound_metric_configuration, | |
74 | + :profile => @profile.identifier, | |
75 | + :id => @content.id, | |
76 | + :metric_name => @compound_metric_configuration.metric.name | |
77 | + assert_equal @content, assigns(:configuration_content) | |
78 | + assert_equal @compound_metric_configuration.code, assigns(:metric_configuration).code | |
79 | + assert_equal @compound_metric_configuration.metric.name, assigns(:metric).name | |
80 | + assert_equal @configuration.metric_configuration[0].code, assigns(:metric_configurations)[0].code | |
81 | + assert_response 200 | |
82 | + end | |
83 | + | |
84 | + should 'test create native metric configuration' do | |
85 | + Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, { | |
86 | + :metric_configuration => @metric_configuration.to_hash, | |
87 | + :configuration_name => @metric_configuration.configuration_name}) | |
88 | + get :create_metric_configuration, | |
89 | + :profile => @profile.identifier, | |
90 | + :id => @content.id, | |
91 | + :metric_configuration => @native_hash | |
92 | + assert_response 302 | |
93 | + end | |
94 | + | |
95 | + should 'test compound metric creation' do | |
96 | + Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, { | |
97 | + :metric_configuration => @compound_metric_configuration.to_hash, | |
98 | + :configuration_name => @compound_metric_configuration.configuration_name}) | |
99 | + get :create_compound_metric_configuration, :profile => @profile.identifier, :id => @content.id, | |
100 | + :metric_configuration => @compound_hash | |
101 | + assert_response 302 | |
102 | + end | |
103 | + | |
104 | + should 'test update native metric configuration' do | |
105 | + Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { | |
106 | + :configuration_name => @content.name, | |
107 | + :metric_name => @metric_configuration.metric.name}).returns({:metric_configuration => @metric_configuration_hash}) | |
108 | + Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, { | |
109 | + :metric_configuration => @metric_configuration.to_hash, | |
110 | + :configuration_name => @metric_configuration.configuration_name}) | |
111 | + get :update_metric_configuration, :profile => @profile.identifier, :id => @content.id, | |
112 | + :metric_configuration => @native_hash | |
113 | + assert_equal @content, assigns(:configuration_content) | |
114 | + assert_response 302 | |
115 | + end | |
116 | + | |
117 | + should 'test update compound metric configuration' do | |
118 | + Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { | |
119 | + :configuration_name => @content.name, | |
120 | + :metric_name => @compound_metric_configuration.metric.name}).returns({:metric_configuration => @compound_metric_configuration_hash}) | |
121 | + Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, { | |
122 | + :metric_configuration => @compound_metric_configuration.to_hash, | |
123 | + :configuration_name => @compound_metric_configuration.configuration_name}) | |
124 | + get :update_compound_metric_configuration, :profile => @profile.identifier, :id => @content.id, | |
125 | + :metric_configuration => @compound_hash | |
126 | + assert_equal @content, assigns(:configuration_content) | |
127 | + assert_response 302 | |
128 | + end | |
129 | + | |
130 | + should 'test remove metric configuration' do | |
131 | + Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { | |
132 | + :configuration_name => @content.name, | |
133 | + :metric_name => @metric.name}).returns({:metric_configuration => @metric_configuration_hash}) | |
134 | + Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :remove_metric_configuration, { | |
135 | + :metric_name => @metric.name, | |
136 | + :configuration_name => @metric_configuration.configuration_name}) | |
137 | + get :remove_metric_configuration, :profile => @profile.identifier, :id => @content.id, :metric_name => @metric.name | |
138 | + assert_response 302 | |
139 | + end | |
140 | + | |
141 | +end | ... | ... |
plugins/mezuro/views/content_viewer/show_configuration.rhtml
... | ... | @@ -40,18 +40,18 @@ |
40 | 40 | <%= metric_configuration.metric.origin %> |
41 | 41 | </td> |
42 | 42 | <td><%= metric_configuration.code %></td> |
43 | - <td><%= link_to "Edit", :controller => "mezuro_plugin_myprofile", :action => "edit_metric_configuration", :params => | |
43 | + <td><%= link_to "Edit", :controller => "mezuro_plugin_metric_configuration", :action => "edit_metric_configuration", :params => | |
44 | 44 | {:metric_name => metric_configuration.metric.name, :id => @configuration_content.id} %></td> |
45 | 45 | <% else %> |
46 | 46 | <td> |
47 | 47 | Compound Metric |
48 | 48 | </td> |
49 | 49 | <td><%= metric_configuration.code %></td> |
50 | - <td><%= link_to "Edit", :controller => "mezuro_plugin_myprofile", :action => "edit_compound_metric_configuration", :params => | |
50 | + <td><%= link_to "Edit", :controller => "mezuro_plugin_metric_configuration", :action => "edit_compound_metric_configuration", :params => | |
51 | 51 | {:metric_name => metric_configuration.metric.name, :id => @configuration_content.id} %></td> |
52 | 52 | <% end %> |
53 | 53 | |
54 | - <td><%= link_to "Remove", :controller => "mezuro_plugin_myprofile", :action => "remove_metric_configuration", :params => | |
54 | + <td><%= link_to "Remove", :controller => "mezuro_plugin_metric_configuration", :action => "remove_metric_configuration", :params => | |
55 | 55 | {:metric_name => metric_configuration.metric.name, :id => @configuration_content.id} %></td> |
56 | 56 | </tr> |
57 | 57 | <% end %> | ... | ... |
plugins/mezuro/views/mezuro_plugin_metric_configuration/_metric_codes.html.erb
0 → 100644
... | ... | @@ -0,0 +1,12 @@ |
1 | +<table> | |
2 | + <tr class="titles"> | |
3 | + <td><h5>Metric Name</h5></td> | |
4 | + <td><h5>Metric Code</h5></td> | |
5 | + </tr> | |
6 | + <% metric_configurations.each do |metric_configuration| %> | |
7 | + <tr class="metric"> | |
8 | + <td><%= metric_configuration.metric.name %></td> | |
9 | + <td><%= metric_configuration.code %></td> | |
10 | + </tr> | |
11 | + <% end %> | |
12 | +</table> | ... | ... |
plugins/mezuro/views/mezuro_plugin_metric_configuration/edit_compound_metric_configuration.html.erb
0 → 100644
... | ... | @@ -0,0 +1,81 @@ |
1 | +<script src="/plugins/mezuro/javascripts/validations.js" type="text/javascript"></script> | |
2 | +<script src="/plugins/mezuro/javascripts/colorPicker/jquery.colorPicker.min.js" type="text/javascript"></script> | |
3 | +<script src="/plugins/mezuro/javascripts/colorPicker/jquery.colorPicker.js" type="text/javascript"></script> | |
4 | + | |
5 | +<h2><%= @configuration_content.name %> Configuration</h2> | |
6 | + | |
7 | +<% form_for :metric_configuration, :url => {:action =>"update_compound_metric_configuration", :controller => "mezuro_plugin_metric_configuration"}, :method => :get do |f| %> | |
8 | + <%= hidden_field_tag :id, @configuration_content.id %> | |
9 | + <%= f.hidden_field :configuration_name, :value => @configuration_content.name %> | |
10 | + | |
11 | + <p> | |
12 | + <%= "Metric Name:" + @metric.name %> | |
13 | + </p> | |
14 | + <% f.fields_for :metric do |m| %> | |
15 | + <%= m.hidden_field :name, :value => @metric.name %> | |
16 | + <p> | |
17 | + <%= m.label :description, "Description:" %> | |
18 | + <%= m.text_field "description", :value => @metric.description %> | |
19 | + </p> | |
20 | + <p> | |
21 | + <%= m.label :scope, "Scope:" %> | |
22 | + <%= m.select :scope, [["Class", "CLASS"]], :selected => @metric.scope %> | |
23 | + </p> | |
24 | + <p> | |
25 | + <%= m.label :script, "Script:" %> | |
26 | + <%= m.text_area "script", :value => @metric.script %> | |
27 | + </p> | |
28 | + <% end %> | |
29 | + <p> | |
30 | + <%= f.label :code, "Code:" %> | |
31 | + <%= f.text_field "code" %> | |
32 | + </p> | |
33 | + <p> | |
34 | + <%= f.label :aggregation_form, "Aggregation Form:" %> | |
35 | + <%= f.select :aggregation_form, [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"], | |
36 | + ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]] %> | |
37 | + </p> | |
38 | + <p> | |
39 | + <%= f.label :weight, "Weight:" %> | |
40 | + <%= f.text_field :weight %> | |
41 | + </p> | |
42 | + <p> | |
43 | + <%= f.submit "Save" %> | |
44 | + </p> | |
45 | +<% end %> | |
46 | + | |
47 | + | |
48 | +<h5> Ranges </h5><br/> | |
49 | + | |
50 | +<table id="ranges"> | |
51 | + <tr> | |
52 | + <td> | |
53 | + Label | |
54 | + </td> | |
55 | + <td> | |
56 | + Beginning | |
57 | + </td> | |
58 | + <td> | |
59 | + End | |
60 | + </td> | |
61 | + <td> | |
62 | + Grade | |
63 | + </td> | |
64 | + <td> | |
65 | + Color | |
66 | + </td> | |
67 | + </tr> | |
68 | + <% if (@metric_configuration.ranges!=nil) | |
69 | + @metric_configuration.ranges.each do |range| %> | |
70 | + <%= render :partial => "range", :locals => {:range => range, :id => @configuration_content.id, | |
71 | + :metric_name => @metric_configuration.metric.name} %> | |
72 | + <% end | |
73 | + end %> | |
74 | +</table> | |
75 | + | |
76 | +<br/> | |
77 | +<%= link_to_remote "New Range", :url => {:action =>"new_range", :controller => "mezuro_plugin_range", :id => @configuration_content.id, :metric_name => @metric.name} %> | |
78 | +<div id="range_form" style="display:none"></div> | |
79 | + | |
80 | +<br/> | |
81 | +<%= render :partial => "metric_codes", :locals => {:metric_configurations => @metric_configurations} %> | ... | ... |
plugins/mezuro/views/mezuro_plugin_metric_configuration/edit_metric_configuration.html.erb
0 → 100644
... | ... | @@ -0,0 +1,88 @@ |
1 | +<script src="/plugins/mezuro/javascripts/validations.js" type="text/javascript"></script> | |
2 | +<script src="/plugins/mezuro/javascripts/colorPicker/jquery.colorPicker.min.js" type="text/javascript"></script> | |
3 | +<script src="/plugins/mezuro/javascripts/colorPicker/jquery.colorPicker.js" type="text/javascript"></script> | |
4 | + | |
5 | +<h2><%= @configuration_content.name %> Configuration</h2> | |
6 | + | |
7 | +<% form_for :metric_configuration, :url => {:action =>"update_metric_configuration", :controller => "mezuro_plugin_metric_configuration"}, :method => :get do |f| %> | |
8 | + <%= hidden_field_tag :id, @configuration_content.id %> | |
9 | + <%= f.hidden_field :configuration_name, :value => @configuration_content.name %> | |
10 | + | |
11 | + <% f.fields_for :metric do |m| %> | |
12 | + | |
13 | + <% @metric.language.each do |language| %> | |
14 | + <%= m.hidden_field :language, :multiple => true, :value => language %> | |
15 | + <% end %> | |
16 | + | |
17 | + <%= m.hidden_field "scope", :value => @metric.scope %> | |
18 | + <p> | |
19 | + <%= m.label :origin, "Collector Name:" %> | |
20 | + <%= @metric.origin %> | |
21 | + <%= m.hidden_field "origin", :value => @metric.origin %> | |
22 | + </p> | |
23 | + <p> | |
24 | + <%= m.label :metric_name, "Metric Name:" %> | |
25 | + <%= @metric.name %> | |
26 | + <%= m.hidden_field "name", :value => @metric.name %> | |
27 | + </p> | |
28 | + <!--<p>--> | |
29 | + <% m.label :description, "Description:" %> | |
30 | + <% @metric.description %> | |
31 | + <% m.hidden_field "description", :value => @metric.description %> | |
32 | + <!--</p>--> | |
33 | + <% end %> | |
34 | + <p> | |
35 | + <%= f.label :code, "Code:" %> | |
36 | + <%= @metric_configuration.code %> | |
37 | + <%= f.hidden_field "code", :value => @metric_configuration.code %> | |
38 | + </p> | |
39 | + <p> | |
40 | + <%= f.label :aggregation_form, "Aggregation Form:" %> | |
41 | + <%= f.select :aggregation_form, [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"], | |
42 | + ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]] %> | |
43 | + </p> | |
44 | + <p> | |
45 | + <%= f.label :weight, "Weight:" %> | |
46 | + <%= f.text_field "weight", :value => @metric_configuration.weight %> | |
47 | + </p> | |
48 | + | |
49 | + <p> | |
50 | + <%= f.submit "Save" %> | |
51 | + </p> | |
52 | +<% end %> | |
53 | + | |
54 | + | |
55 | +<h5> Ranges </h5><br/> | |
56 | + | |
57 | +<table id="ranges"> | |
58 | + <tr> | |
59 | + <td> | |
60 | + Label | |
61 | + </td> | |
62 | + <td> | |
63 | + Beginning | |
64 | + </td> | |
65 | + <td> | |
66 | + End | |
67 | + </td> | |
68 | + <td> | |
69 | + Grade | |
70 | + </td> | |
71 | + <td> | |
72 | + Color | |
73 | + </td> | |
74 | + <td></td> | |
75 | + <td></td> | |
76 | + </tr> | |
77 | + <% if (@metric_configuration.ranges!=nil) | |
78 | + @metric_configuration.ranges.each do |range| %> | |
79 | + <%= render :partial => "range", :locals => {:range => range, :id => @configuration_content.id, | |
80 | + :metric_name => @metric.name} %> | |
81 | + <% end | |
82 | + end %> | |
83 | +</table> | |
84 | + | |
85 | +<br/> | |
86 | +<%= link_to_remote "New Range", :url => {:action =>"new_range", :controller => "mezuro_plugin_range", :id => @configuration_content.id, :metric_name => @metric.name} %> | |
87 | +<div id="range_form" style="display:none"></div> | |
88 | + | ... | ... |
plugins/mezuro/views/mezuro_plugin_metric_configuration/new_compound_metric_configuration.html.erb
0 → 100644
... | ... | @@ -0,0 +1,44 @@ |
1 | +<h2><%= @configuration_content.name %> Configuration</h2> | |
2 | + | |
3 | +<% form_for :metric_configuration, :url => {:action =>"create_compound_metric_configuration", | |
4 | +:controller => "mezuro_plugin_metric_configuration"}, :method => :get do |f| %> | |
5 | + <%= hidden_field_tag :id, @configuration_content.id %> | |
6 | + <%= f.hidden_field :configuration_name, :value => @configuration_content.name %> | |
7 | + | |
8 | + <% f.fields_for :metric do |m| %> | |
9 | + <p> | |
10 | + <%= m.label :name, "Name:" %> | |
11 | + <%= m.text_field "name" %> | |
12 | + </p> | |
13 | + <p> | |
14 | + <%= m.label :description, "Description:" %> | |
15 | + <%= m.text_field "description" %> | |
16 | + </p> | |
17 | + <p> | |
18 | + <%= m.label :scope, "Scope:" %> | |
19 | + <%= m.select :scope, [["Class", "CLASS"]] %> | |
20 | + </p> | |
21 | + <p> | |
22 | + <%= m.label :script, "Script:" %> | |
23 | + <%= m.text_area "script" %> | |
24 | + </p> | |
25 | + <% end %> | |
26 | + <p> | |
27 | + <%= f.label :code, "Code:" %> | |
28 | + <%= f.text_field "code" %> | |
29 | + </p> | |
30 | + <p> | |
31 | + <%= f.label :aggregation_form, "Aggregation Form:" %> | |
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 | + <p> | |
40 | + <%= f.submit "Add" %> | |
41 | + </p> | |
42 | +<% end %> | |
43 | + | |
44 | +<%= render :partial => "metric_codes", :locals => {:metric_configurations => @metric_configurations} %> | ... | ... |
plugins/mezuro/views/mezuro_plugin_metric_configuration/new_metric_configuration.html.erb
0 → 100644
... | ... | @@ -0,0 +1,51 @@ |
1 | +<script src="/plugins/mezuro/javascripts/validations.js" type="text/javascript"></script> | |
2 | + | |
3 | +<h2><%= @configuration_content.name %> Configuration</h2> | |
4 | + | |
5 | +<% form_for :metric_configuration, :url => {:action =>"create_metric_configuration", :controller => "mezuro_plugin_metric_configuration"}, :method => :get do |f| %> | |
6 | + <%= hidden_field_tag :id, @configuration_content.id %> | |
7 | + <%= f.hidden_field :configuration_name, :value => @configuration_content.name %> | |
8 | + | |
9 | + <% f.fields_for :metric do |m| %> | |
10 | + | |
11 | + <% @metric.language.each do |language| %> | |
12 | + <%= m.hidden_field :language, :multiple => true, :value => language %> | |
13 | + <% end %> | |
14 | + | |
15 | + <%= m.hidden_field "scope", :value => @metric.scope %> | |
16 | + <p> | |
17 | + <%= m.label :origin, "Collector Name:" %> | |
18 | + <%= @metric.origin %> | |
19 | + <%= m.hidden_field "origin", :value => @metric.origin %> | |
20 | + </p> | |
21 | + <p> | |
22 | + <%= m.label :name, "Metric Name:" %> | |
23 | + <%= @metric.name %> | |
24 | + <%= m.hidden_field "name", :value => @metric.name %> | |
25 | + </p> | |
26 | + <!--<p>--> | |
27 | + <% m.label :description, "Description:" %> | |
28 | + <% @metric.description %> | |
29 | + <% m.hidden_field "description", :value => @metric.description %> | |
30 | + <!--</p>--> | |
31 | + <% end %> | |
32 | + <p> | |
33 | + <%= f.label :code, "Code:" %> | |
34 | + <%= f.text_field :code %> | |
35 | + </p> | |
36 | + <p> | |
37 | + <%= f.label :aggregation_form, "Aggregation Form:" %> | |
38 | + <%= f.select :aggregation_form, [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"], | |
39 | + ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]] %> | |
40 | + </p> | |
41 | + <p> | |
42 | + <%= f.label :weight, "Weight:" %> | |
43 | + <%= f.text_field :weight %> | |
44 | + </p> | |
45 | + | |
46 | + <p> | |
47 | + <%= f.submit "Add" %> | |
48 | + </p> | |
49 | + | |
50 | +<% end %> | |
51 | + | ... | ... |
plugins/mezuro/views/mezuro_plugin_myprofile/_metric_codes.html.erb
... | ... | @@ -1,12 +0,0 @@ |
1 | -<table> | |
2 | - <tr class="titles"> | |
3 | - <td><h5>Metric Name</h5></td> | |
4 | - <td><h5>Metric Code</h5></td> | |
5 | - </tr> | |
6 | - <% metric_configurations.each do |metric_configuration| %> | |
7 | - <tr class="metric"> | |
8 | - <td><%= metric_configuration.metric.name %></td> | |
9 | - <td><%= metric_configuration.code %></td> | |
10 | - </tr> | |
11 | - <% end %> | |
12 | -</table> |
plugins/mezuro/views/mezuro_plugin_myprofile/edit_compound_metric_configuration.html.erb
... | ... | @@ -1,81 +0,0 @@ |
1 | -<script src="/plugins/mezuro/javascripts/validations.js" type="text/javascript"></script> | |
2 | -<script src="/plugins/mezuro/javascripts/colorPicker/jquery.colorPicker.min.js" type="text/javascript"></script> | |
3 | -<script src="/plugins/mezuro/javascripts/colorPicker/jquery.colorPicker.js" type="text/javascript"></script> | |
4 | - | |
5 | -<h2><%= @configuration_content.name %> Configuration</h2> | |
6 | - | |
7 | -<% form_for :metric_configuration, :url => {:action =>"update_compound_metric_configuration", :controller => "mezuro_plugin_myprofile"}, :method => :get do |f| %> | |
8 | - <%= hidden_field_tag :id, @configuration_content.id %> | |
9 | - <%= f.hidden_field :configuration_name, :value => @configuration_content.name %> | |
10 | - | |
11 | - <p> | |
12 | - <%= "Metric Name:" + @metric.name %> | |
13 | - </p> | |
14 | - <% f.fields_for :metric do |m| %> | |
15 | - <%= m.hidden_field :name, :value => @metric.name %> | |
16 | - <p> | |
17 | - <%= m.label :description, "Description:" %> | |
18 | - <%= m.text_field "description", :value => @metric.description %> | |
19 | - </p> | |
20 | - <p> | |
21 | - <%= m.label :scope, "Scope:" %> | |
22 | - <%= m.select :scope, [["Class", "CLASS"]], :selected => @metric.scope %> | |
23 | - </p> | |
24 | - <p> | |
25 | - <%= m.label :script, "Script:" %> | |
26 | - <%= m.text_area "script", :value => @metric.script %> | |
27 | - </p> | |
28 | - <% end %> | |
29 | - <p> | |
30 | - <%= f.label :code, "Code:" %> | |
31 | - <%= f.text_field "code" %> | |
32 | - </p> | |
33 | - <p> | |
34 | - <%= f.label :aggregation_form, "Aggregation Form:" %> | |
35 | - <%= f.select :aggregation_form, [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"], | |
36 | - ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]] %> | |
37 | - </p> | |
38 | - <p> | |
39 | - <%= f.label :weight, "Weight:" %> | |
40 | - <%= f.text_field :weight %> | |
41 | - </p> | |
42 | - <p> | |
43 | - <%= f.submit "Save" %> | |
44 | - </p> | |
45 | -<% end %> | |
46 | - | |
47 | - | |
48 | -<h5> Ranges </h5><br/> | |
49 | - | |
50 | -<table id="ranges"> | |
51 | - <tr> | |
52 | - <td> | |
53 | - Label | |
54 | - </td> | |
55 | - <td> | |
56 | - Beginning | |
57 | - </td> | |
58 | - <td> | |
59 | - End | |
60 | - </td> | |
61 | - <td> | |
62 | - Grade | |
63 | - </td> | |
64 | - <td> | |
65 | - Color | |
66 | - </td> | |
67 | - </tr> | |
68 | - <% if (@metric_configuration.ranges!=nil) | |
69 | - @metric_configuration.ranges.each do |range| %> | |
70 | - <%= render :partial => "range", :locals => {:range => range, :id => @configuration_content.id, | |
71 | - :metric_name => @metric_configuration.metric.name} %> | |
72 | - <% end | |
73 | - end %> | |
74 | -</table> | |
75 | - | |
76 | -<br/> | |
77 | -<%= link_to_remote "New Range", :url => {:action =>"new_range", :controller => "mezuro_plugin_range", :id => @configuration_content.id, :metric_name => @metric.name} %> | |
78 | -<div id="range_form" style="display:none"></div> | |
79 | - | |
80 | -<br/> | |
81 | -<%= render :partial => "metric_codes", :locals => {:metric_configurations => @metric_configurations} %> |
plugins/mezuro/views/mezuro_plugin_myprofile/edit_metric_configuration.html.erb
... | ... | @@ -1,88 +0,0 @@ |
1 | -<script src="/plugins/mezuro/javascripts/validations.js" type="text/javascript"></script> | |
2 | -<script src="/plugins/mezuro/javascripts/colorPicker/jquery.colorPicker.min.js" type="text/javascript"></script> | |
3 | -<script src="/plugins/mezuro/javascripts/colorPicker/jquery.colorPicker.js" type="text/javascript"></script> | |
4 | - | |
5 | -<h2><%= @configuration_content.name %> Configuration</h2> | |
6 | - | |
7 | -<% form_for :metric_configuration, :url => {:action =>"update_metric_configuration", :controller => "mezuro_plugin_myprofile"}, :method => :get do |f| %> | |
8 | - <%= hidden_field_tag :id, @configuration_content.id %> | |
9 | - <%= f.hidden_field :configuration_name, :value => @configuration_content.name %> | |
10 | - | |
11 | - <% f.fields_for :metric do |m| %> | |
12 | - | |
13 | - <% @metric.language.each do |language| %> | |
14 | - <%= m.hidden_field :language, :multiple => true, :value => language %> | |
15 | - <% end %> | |
16 | - | |
17 | - <%= m.hidden_field "scope", :value => @metric.scope %> | |
18 | - <p> | |
19 | - <%= m.label :origin, "Collector Name:" %> | |
20 | - <%= @metric.origin %> | |
21 | - <%= m.hidden_field "origin", :value => @metric.origin %> | |
22 | - </p> | |
23 | - <p> | |
24 | - <%= m.label :metric_name, "Metric Name:" %> | |
25 | - <%= @metric.name %> | |
26 | - <%= m.hidden_field "name", :value => @metric.name %> | |
27 | - </p> | |
28 | - <!--<p>--> | |
29 | - <% m.label :description, "Description:" %> | |
30 | - <% @metric.description %> | |
31 | - <% m.hidden_field "description", :value => @metric.description %> | |
32 | - <!--</p>--> | |
33 | - <% end %> | |
34 | - <p> | |
35 | - <%= f.label :code, "Code:" %> | |
36 | - <%= @metric_configuration.code %> | |
37 | - <%= f.hidden_field "code", :value => @metric_configuration.code %> | |
38 | - </p> | |
39 | - <p> | |
40 | - <%= f.label :aggregation_form, "Aggregation Form:" %> | |
41 | - <%= f.select :aggregation_form, [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"], | |
42 | - ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]] %> | |
43 | - </p> | |
44 | - <p> | |
45 | - <%= f.label :weight, "Weight:" %> | |
46 | - <%= f.text_field "weight", :value => @metric_configuration.weight %> | |
47 | - </p> | |
48 | - | |
49 | - <p> | |
50 | - <%= f.submit "Save" %> | |
51 | - </p> | |
52 | -<% end %> | |
53 | - | |
54 | - | |
55 | -<h5> Ranges </h5><br/> | |
56 | - | |
57 | -<table id="ranges"> | |
58 | - <tr> | |
59 | - <td> | |
60 | - Label | |
61 | - </td> | |
62 | - <td> | |
63 | - Beginning | |
64 | - </td> | |
65 | - <td> | |
66 | - End | |
67 | - </td> | |
68 | - <td> | |
69 | - Grade | |
70 | - </td> | |
71 | - <td> | |
72 | - Color | |
73 | - </td> | |
74 | - <td></td> | |
75 | - <td></td> | |
76 | - </tr> | |
77 | - <% if (@metric_configuration.ranges!=nil) | |
78 | - @metric_configuration.ranges.each do |range| %> | |
79 | - <%= render :partial => "range", :locals => {:range => range, :id => @configuration_content.id, | |
80 | - :metric_name => @metric.name} %> | |
81 | - <% end | |
82 | - end %> | |
83 | -</table> | |
84 | - | |
85 | -<br/> | |
86 | -<%= link_to_remote "New Range", :url => {:action =>"new_range", :controller => "mezuro_plugin_range", :id => @configuration_content.id, :metric_name => @metric.name} %> | |
87 | -<div id="range_form" style="display:none"></div> | |
88 | - |
plugins/mezuro/views/mezuro_plugin_myprofile/new_compound_metric_configuration.html.erb
... | ... | @@ -1,44 +0,0 @@ |
1 | -<h2><%= @configuration_content.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 :id, @configuration_content.id %> | |
6 | - <%= f.hidden_field :configuration_name, :value => @configuration_content.name %> | |
7 | - | |
8 | - <% f.fields_for :metric do |m| %> | |
9 | - <p> | |
10 | - <%= m.label :name, "Name:" %> | |
11 | - <%= m.text_field "name" %> | |
12 | - </p> | |
13 | - <p> | |
14 | - <%= m.label :description, "Description:" %> | |
15 | - <%= m.text_field "description" %> | |
16 | - </p> | |
17 | - <p> | |
18 | - <%= m.label :scope, "Scope:" %> | |
19 | - <%= m.select :scope, [["Class", "CLASS"]] %> | |
20 | - </p> | |
21 | - <p> | |
22 | - <%= m.label :script, "Script:" %> | |
23 | - <%= m.text_area "script" %> | |
24 | - </p> | |
25 | - <% end %> | |
26 | - <p> | |
27 | - <%= f.label :code, "Code:" %> | |
28 | - <%= f.text_field "code" %> | |
29 | - </p> | |
30 | - <p> | |
31 | - <%= f.label :aggregation_form, "Aggregation Form:" %> | |
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 | - <p> | |
40 | - <%= f.submit "Add" %> | |
41 | - </p> | |
42 | -<% end %> | |
43 | - | |
44 | -<%= render :partial => "metric_codes", :locals => {:metric_configurations => @metric_configurations} %> |
plugins/mezuro/views/mezuro_plugin_myprofile/new_metric_configuration.html.erb
... | ... | @@ -1,51 +0,0 @@ |
1 | -<script src="/plugins/mezuro/javascripts/validations.js" type="text/javascript"></script> | |
2 | - | |
3 | -<h2><%= @configuration_content.name %> Configuration</h2> | |
4 | - | |
5 | -<% form_for :metric_configuration, :url => {:action =>"create_metric_configuration", :controller => "mezuro_plugin_myprofile"}, :method => :get do |f| %> | |
6 | - <%= hidden_field_tag :id, @configuration_content.id %> | |
7 | - <%= f.hidden_field :configuration_name, :value => @configuration_content.name %> | |
8 | - | |
9 | - <% f.fields_for :metric do |m| %> | |
10 | - | |
11 | - <% @metric.language.each do |language| %> | |
12 | - <%= m.hidden_field :language, :multiple => true, :value => language %> | |
13 | - <% end %> | |
14 | - | |
15 | - <%= m.hidden_field "scope", :value => @metric.scope %> | |
16 | - <p> | |
17 | - <%= m.label :origin, "Collector Name:" %> | |
18 | - <%= @metric.origin %> | |
19 | - <%= m.hidden_field "origin", :value => @metric.origin %> | |
20 | - </p> | |
21 | - <p> | |
22 | - <%= m.label :name, "Metric Name:" %> | |
23 | - <%= @metric.name %> | |
24 | - <%= m.hidden_field "name", :value => @metric.name %> | |
25 | - </p> | |
26 | - <!--<p>--> | |
27 | - <% m.label :description, "Description:" %> | |
28 | - <% @metric.description %> | |
29 | - <% m.hidden_field "description", :value => @metric.description %> | |
30 | - <!--</p>--> | |
31 | - <% end %> | |
32 | - <p> | |
33 | - <%= f.label :code, "Code:" %> | |
34 | - <%= f.text_field :code %> | |
35 | - </p> | |
36 | - <p> | |
37 | - <%= f.label :aggregation_form, "Aggregation Form:" %> | |
38 | - <%= f.select :aggregation_form, [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"], | |
39 | - ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]] %> | |
40 | - </p> | |
41 | - <p> | |
42 | - <%= f.label :weight, "Weight:" %> | |
43 | - <%= f.text_field :weight %> | |
44 | - </p> | |
45 | - | |
46 | - <p> | |
47 | - <%= f.submit "Add" %> | |
48 | - </p> | |
49 | - | |
50 | -<% end %> | |
51 | - |