Commit 6f00a24ab72d13844929af4c5c2e7dfad0a6b30f
Exists in
master
and in
29 other branches
Merge branch 'refactoring_controllers' into mezuro-dev
Showing
60 changed files
with
1380 additions
and
1202 deletions
Show diff stats
plugins/mezuro/controllers/mezuro_plugin_myprofile_controller.rb
... | ... | @@ -1,187 +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 | - def new_range | |
113 | - @configuration_content = profile.articles.find(params[:id]) | |
114 | - @metric_name = params[:metric_name] | |
115 | - @range = Kalibro::Range.new | |
116 | - @range_color = "#000000" | |
117 | - end | |
118 | - | |
119 | - def edit_range | |
120 | - @configuration_content = profile.articles.find(params[:id]) | |
121 | - @metric_name = params[:metric_name] | |
122 | - @beginning_id = params[:beginning_id] | |
123 | - metric_configuration = Kalibro::MetricConfiguration.find_by_configuration_name_and_metric_name(@configuration_content.name, @metric_name) | |
124 | - @range = metric_configuration.ranges.find{|range| range.beginning == @beginning_id.to_f || @beginning_id =="-INF" } | |
125 | - @range_color = "#" + @range.color.to_s.gsub(/^ff/, "") | |
126 | - end | |
127 | - | |
128 | - def create_range | |
129 | - @configuration_content = profile.articles.find(params[:id]) | |
130 | - @range = Kalibro::Range.new params[:range] | |
131 | - metric_name = params[:metric_name] | |
132 | - metric_configuration = Kalibro::MetricConfiguration.find_by_configuration_name_and_metric_name(@configuration_content.name, metric_name) | |
133 | - metric_configuration.add_range(@range) | |
134 | - metric_configuration.save | |
135 | - if metric_configuration_has_errors? metric_configuration | |
136 | - redirect_to_error_page metric_configuration.errors[0].message | |
137 | - end | |
138 | - end | |
139 | - | |
140 | - def update_range | |
141 | - configuration_content = profile.articles.find(params[:id]) | |
142 | - metric_name = params[:metric_name] | |
143 | - beginning_id = params[:beginning_id] | |
144 | - metric_configuration = Kalibro::MetricConfiguration.find_by_configuration_name_and_metric_name(configuration_content.name, metric_name) | |
145 | - index = metric_configuration.ranges.index{ |range| range.beginning == beginning_id.to_f || beginning_id == "-INF" } | |
146 | - metric_configuration.ranges[index] = Kalibro::Range.new params[:range] | |
147 | - metric_configuration.save | |
148 | - if metric_configuration_has_errors? metric_configuration | |
149 | - redirect_to_error_page metric_configuration.errors[0].message | |
150 | - end | |
151 | - end | |
152 | - | |
153 | - def remove_range | |
154 | - configuration_content = profile.articles.find(params[:id]) | |
155 | - metric_name = params[:metric_name] | |
156 | - beginning_id = params[:beginning_id] | |
157 | - metric_configuration = Kalibro::MetricConfiguration.find_by_configuration_name_and_metric_name(configuration_content.name, metric_name) | |
158 | - metric_configuration.ranges.delete_if { |range| range.beginning == beginning_id.to_f || beginning_id == "-INF" } | |
159 | - metric_configuration.save | |
160 | - if metric_configuration_has_errors? metric_configuration | |
161 | - redirect_to_error_page metric_configuration.errors[0].message | |
162 | - else | |
163 | - formatted_metric_name = metric_name.gsub(/\s/, '+') | |
164 | - if metric_configuration.metric.class == Kalibro::CompoundMetric | |
165 | - redirect_to "/myprofile/#{profile.identifier}/plugin/mezuro/edit_compound_metric_configuration?id=#{configuration_content.id}&metric_name=#{formatted_metric_name}" | |
166 | - else | |
167 | - redirect_to "/myprofile/#{profile.identifier}/plugin/mezuro/edit_metric_configuration?id=#{configuration_content.id}&metric_name=#{formatted_metric_name}" | |
168 | - end | |
169 | - end | |
170 | - end | |
171 | - | |
172 | - private | |
173 | - | |
174 | - def redirect_to_error_page(message) | |
175 | - message = URI.escape(CGI.escape(message),'.') | |
176 | - redirect_to "/myprofile/#{profile.identifier}/plugin/mezuro/error_page?message=#{message}" | |
177 | - end | |
178 | - | |
179 | - def configuration_content_has_errors? | |
180 | - not @configuration_content.errors[:base].nil? | |
181 | - end | |
182 | - | |
183 | - def metric_configuration_has_errors? metric_configuration | |
184 | - not metric_configuration.errors.empty? | |
185 | - end | |
186 | - | |
187 | -end |
plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb
... | ... | @@ -1,120 +0,0 @@ |
1 | -class MezuroPluginProfileController < ProfileController | |
2 | - | |
3 | - append_view_path File.join(File.dirname(__FILE__) + '/../views') | |
4 | - | |
5 | - def error_page | |
6 | - @message = params[:message] | |
7 | - end | |
8 | - | |
9 | - def project_state | |
10 | - @content = profile.articles.find(params[:id]) | |
11 | - project = @content.project | |
12 | - if project_content_has_errors? | |
13 | - redirect_to_error_page(@content.errors[:base]) | |
14 | - else | |
15 | - state = project.kalibro_error.nil? ? project.state : "ERROR" | |
16 | - render :text => state | |
17 | - end | |
18 | - end | |
19 | - | |
20 | - def project_error | |
21 | - @content = profile.articles.find(params[:id]) | |
22 | - @project = @content.project | |
23 | - if project_content_has_errors? | |
24 | - redirect_to_error_page(@content.errors[:base]) | |
25 | - else | |
26 | - render :partial => 'content_viewer/project_error' | |
27 | - end | |
28 | - end | |
29 | - | |
30 | - def project_result | |
31 | - @content = profile.articles.find(params[:id]) | |
32 | - date = params[:date] | |
33 | - @project_result = date.nil? ? @content.project_result : @content.project_result_with_date(date) | |
34 | - if project_content_has_errors? | |
35 | - redirect_to_error_page(@content.errors[:base]) | |
36 | - else | |
37 | - render :partial => 'content_viewer/project_result' | |
38 | - end | |
39 | - end | |
40 | - | |
41 | - def module_result | |
42 | - @content = profile.articles.find(params[:id]) | |
43 | - @module_result = @content.module_result(params) | |
44 | - @module = @module_result.module | |
45 | - @module_label = "#{@module.name} (#{@module.granularity})" | |
46 | - if project_content_has_errors? | |
47 | - redirect_to_error_page(@content.errors[:base]) | |
48 | - else | |
49 | - render :partial => 'content_viewer/module_result' | |
50 | - end | |
51 | - end | |
52 | - | |
53 | - def project_tree | |
54 | - @content = profile.articles.find(params[:id]) | |
55 | - date = params[:date] | |
56 | - project_result = date.nil? ? @content.project_result : @content.project_result_with_date(date) | |
57 | - @project_name = @content.project.name if not @content.project.nil? | |
58 | - if project_content_has_errors? | |
59 | - redirect_to_error_page(@content.errors[:base]) | |
60 | - else | |
61 | - @source_tree = project_result.node(params[:module_name]) | |
62 | - render :partial =>'content_viewer/source_tree' | |
63 | - end | |
64 | - end | |
65 | - | |
66 | - def module_metrics_history | |
67 | - metric_name = params[:metric_name] | |
68 | - @content = profile.articles.find(params[:id]) | |
69 | - module_history = @content.result_history(params[:module_name]) | |
70 | - if project_content_has_errors? | |
71 | - redirect_to_error_page(@content.errors[:base]) | |
72 | - else | |
73 | - @score_history = filtering_metric_history(metric_name, module_history) | |
74 | - render :partial => 'content_viewer/score_history' | |
75 | - end | |
76 | - end | |
77 | - | |
78 | - def module_grade_history | |
79 | - @content = profile.articles.find(params[:id]) | |
80 | - modules_results = @content.result_history(params[:module_name]) | |
81 | - if project_content_has_errors? | |
82 | - redirect_to_error_page(@content.errors[:base]) | |
83 | - else | |
84 | - @score_history = modules_results.map do |module_result| | |
85 | - [module_result.grade, format_date_to_simple_form(module_result.date)] | |
86 | - end | |
87 | - render :partial => 'content_viewer/score_history' | |
88 | - end | |
89 | - end | |
90 | - | |
91 | - private | |
92 | - | |
93 | - def filtering_metric_history(metric_name, module_history) | |
94 | - metrics_history = module_history.map do |module_result| | |
95 | - [module_result.metric_results, format_date_to_simple_form(module_result.date)] | |
96 | - end | |
97 | - metric_history = metrics_history.map do |metric_results_with_date| | |
98 | - [(metric_results_with_date.first.select do |metric_result| | |
99 | - metric_result.metric.name.delete("() ") == metric_name | |
100 | - end).first, metric_results_with_date.last] | |
101 | - end | |
102 | - metric_history.map do |metric_result_with_date| | |
103 | - [metric_result_with_date.first.value, metric_result_with_date.last] | |
104 | - end | |
105 | - end | |
106 | - | |
107 | - def redirect_to_error_page(message) | |
108 | - message = URI.escape(CGI.escape(message),'.') | |
109 | - redirect_to "/profile/#{profile.identifier}/plugins/mezuro/error_page?message=#{message}" | |
110 | - end | |
111 | - | |
112 | - def project_content_has_errors? | |
113 | - not @content.errors[:base].nil? | |
114 | - end | |
115 | - | |
116 | - def format_date_to_simple_form date | |
117 | - date.to_s[0..9] | |
118 | - end | |
119 | - | |
120 | -end |
plugins/mezuro/controllers/myprofile/mezuro_plugin_base_tool_controller.rb
0 → 100644
... | ... | @@ -0,0 +1,17 @@ |
1 | +class MezuroPluginBaseToolController < MezuroPluginMyprofileController | |
2 | + | |
3 | + append_view_path File.join(File.dirname(__FILE__) + '/../../views') | |
4 | + | |
5 | + def choose_base_tool | |
6 | + @configuration_content = profile.articles.find(params[:id]) | |
7 | + @base_tools = Kalibro::BaseTool.all_names | |
8 | + end | |
9 | + | |
10 | + def choose_metric | |
11 | + @configuration_content = profile.articles.find(params[:id]) | |
12 | + @base_tool = params[:base_tool] | |
13 | + base_tool = Kalibro::BaseTool.find_by_name(@base_tool) | |
14 | + @supported_metrics = base_tool.nil? ? [] : base_tool.supported_metrics | |
15 | + end | |
16 | + | |
17 | +end | ... | ... |
plugins/mezuro/controllers/myprofile/mezuro_plugin_metric_configuration_controller.rb
0 → 100644
... | ... | @@ -0,0 +1,97 @@ |
1 | +class MezuroPluginMetricConfigurationController < MezuroPluginMyprofileController | |
2 | + | |
3 | + append_view_path File.join(File.dirname(__FILE__) + '/../../views') | |
4 | + | |
5 | + def new_metric_configuration | |
6 | + @configuration_content = profile.articles.find(params[:id]) | |
7 | + @metric = Kalibro::BaseTool.find_by_name(params[:base_tool]).metric params[:metric_name] | |
8 | + end | |
9 | + | |
10 | + def new_compound_metric_configuration | |
11 | + @configuration_content = profile.articles.find(params[:id]) | |
12 | + @metric_configurations = @configuration_content.metric_configurations | |
13 | + if configuration_content_has_errors? | |
14 | + redirect_to_error_page @configuration_content.errors[:base] | |
15 | + end | |
16 | + end | |
17 | + | |
18 | + def edit_metric_configuration | |
19 | + @configuration_content = profile.articles.find(params[:id]) | |
20 | + @metric_configuration = Kalibro::MetricConfiguration.find_by_configuration_name_and_metric_name(@configuration_content.name, params[:metric_name]) | |
21 | + @metric = @metric_configuration.metric | |
22 | + end | |
23 | + | |
24 | + def edit_compound_metric_configuration | |
25 | + @configuration_content = profile.articles.find(params[:id]) | |
26 | + @metric_configuration = Kalibro::MetricConfiguration.find_by_configuration_name_and_metric_name(@configuration_content.name, params[:metric_name]) | |
27 | + @metric_configurations = @configuration_content.metric_configurations | |
28 | + @metric = @metric_configuration.metric | |
29 | + end | |
30 | + | |
31 | + def create_metric_configuration | |
32 | + id = params[:id] | |
33 | + metric_name = params[:metric_configuration][:metric][:name] | |
34 | + metric_configuration = Kalibro::MetricConfiguration.new(params[:metric_configuration]) | |
35 | + metric_configuration.save | |
36 | + if metric_configuration_has_errors? metric_configuration | |
37 | + redirect_to_error_page metric_configuration.errors[0].message | |
38 | + else | |
39 | + redirect_to "edit_metric_configuration?id=#{id}&metric_name=#{metric_name.gsub(/\s/, '+')}" | |
40 | + end | |
41 | + end | |
42 | + | |
43 | + def create_compound_metric_configuration | |
44 | + id = params[:id] | |
45 | + metric_name = params[:metric_configuration][:metric][:name] | |
46 | + metric_configuration = Kalibro::MetricConfiguration.new(params[:metric_configuration]) | |
47 | + metric_configuration.save | |
48 | + if metric_configuration_has_errors? metric_configuration | |
49 | + redirect_to_error_page metric_configuration.errors[0].message | |
50 | + else | |
51 | + redirect_to "edit_compound_metric_configuration?id=#{id}&metric_name=#{metric_name.gsub(/\s/, '+')}" | |
52 | + end | |
53 | + end | |
54 | + | |
55 | + def update_metric_configuration | |
56 | + @configuration_content = profile.articles.find(params[:id]) | |
57 | + metric_name = params[:metric_configuration][:metric][:name] | |
58 | + metric_configuration = Kalibro::MetricConfiguration.find_by_configuration_name_and_metric_name(@configuration_content.name, metric_name) | |
59 | + metric_configuration.update_attributes params[:metric_configuration] | |
60 | + if metric_configuration_has_errors? metric_configuration | |
61 | + redirect_to_error_page metric_configuration.errors[0].message | |
62 | + else | |
63 | + redirect_to "/#{profile.identifier}/#{@configuration_content.slug}" | |
64 | + end | |
65 | + end | |
66 | + | |
67 | + def update_compound_metric_configuration | |
68 | + @configuration_content = profile.articles.find(params[:id]) | |
69 | + metric_name = params[:metric_configuration][:metric][:name] | |
70 | + metric_configuration = Kalibro::MetricConfiguration.find_by_configuration_name_and_metric_name(@configuration_content.name, metric_name) | |
71 | + metric_configuration.update_attributes params[:metric_configuration] | |
72 | + if metric_configuration_has_errors? metric_configuration | |
73 | + redirect_to_error_page metric_configuration.errors[0].message | |
74 | + else | |
75 | + redirect_to "/#{profile.identifier}/#{@configuration_content.slug}" | |
76 | + end | |
77 | + end | |
78 | + | |
79 | + def remove_metric_configuration | |
80 | + configuration_content = profile.articles.find(params[:id]) | |
81 | + metric_name = params[:metric_name] | |
82 | + metric_configuration = Kalibro::MetricConfiguration.find_by_configuration_name_and_metric_name(configuration_content.name, metric_name) | |
83 | + metric_configuration.destroy | |
84 | + if metric_configuration_has_errors? metric_configuration | |
85 | + redirect_to_error_page metric_configuration.errors[0].message | |
86 | + else | |
87 | + redirect_to "/#{profile.identifier}/#{configuration_content.slug}" | |
88 | + end | |
89 | + end | |
90 | + | |
91 | + private | |
92 | + | |
93 | + def configuration_content_has_errors? | |
94 | + not @configuration_content.errors[:base].nil? | |
95 | + end | |
96 | + | |
97 | +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/controllers/myprofile/mezuro_plugin_range_controller.rb
0 → 100644
... | ... | @@ -0,0 +1,65 @@ |
1 | +class MezuroPluginRangeController < MezuroPluginMyprofileController | |
2 | + | |
3 | + append_view_path File.join(File.dirname(__FILE__) + '/../../views') | |
4 | + | |
5 | + def new_range | |
6 | + @configuration_content = profile.articles.find(params[:id]) | |
7 | + @metric_name = params[:metric_name] | |
8 | + @range = Kalibro::Range.new | |
9 | + @range_color = "#000000" | |
10 | + end | |
11 | + | |
12 | + def edit_range | |
13 | + @configuration_content = profile.articles.find(params[:id]) | |
14 | + @metric_name = params[:metric_name] | |
15 | + @beginning_id = params[:beginning_id] | |
16 | + metric_configuration = Kalibro::MetricConfiguration.find_by_configuration_name_and_metric_name(@configuration_content.name, @metric_name) | |
17 | + @range = metric_configuration.ranges.find{|range| range.beginning == @beginning_id.to_f || @beginning_id =="-INF" } | |
18 | + @range_color = "#" + @range.color.to_s.gsub(/^ff/, "") | |
19 | + end | |
20 | + | |
21 | + def create_range | |
22 | + @configuration_content = profile.articles.find(params[:id]) | |
23 | + @range = Kalibro::Range.new params[:range] | |
24 | + metric_name = params[:metric_name] | |
25 | + metric_configuration = Kalibro::MetricConfiguration.find_by_configuration_name_and_metric_name(@configuration_content.name, metric_name) | |
26 | + metric_configuration.add_range(@range) | |
27 | + metric_configuration.save | |
28 | + if metric_configuration_has_errors? metric_configuration | |
29 | + redirect_to_error_page metric_configuration.errors[0].message | |
30 | + end | |
31 | + end | |
32 | + | |
33 | + def update_range | |
34 | + configuration_content = profile.articles.find(params[:id]) | |
35 | + metric_name = params[:metric_name] | |
36 | + beginning_id = params[:beginning_id] | |
37 | + metric_configuration = Kalibro::MetricConfiguration.find_by_configuration_name_and_metric_name(configuration_content.name, metric_name) | |
38 | + index = metric_configuration.ranges.index{ |range| range.beginning == beginning_id.to_f || beginning_id == "-INF" } | |
39 | + metric_configuration.ranges[index] = Kalibro::Range.new params[:range] | |
40 | + metric_configuration.save | |
41 | + if metric_configuration_has_errors? metric_configuration | |
42 | + redirect_to_error_page metric_configuration.errors[0].message | |
43 | + end | |
44 | + end | |
45 | + | |
46 | + def remove_range | |
47 | + configuration_content = profile.articles.find(params[:id]) | |
48 | + metric_name = params[:metric_name] | |
49 | + beginning_id = params[:beginning_id] | |
50 | + metric_configuration = Kalibro::MetricConfiguration.find_by_configuration_name_and_metric_name(configuration_content.name, metric_name) | |
51 | + metric_configuration.ranges.delete_if { |range| range.beginning == beginning_id.to_f || beginning_id == "-INF" } | |
52 | + metric_configuration.save | |
53 | + if metric_configuration_has_errors? metric_configuration | |
54 | + redirect_to_error_page metric_configuration.errors[0].message | |
55 | + else | |
56 | + formatted_metric_name = metric_name.gsub(/\s/, '+') | |
57 | + if metric_configuration.metric.class == Kalibro::CompoundMetric | |
58 | + redirect_to "/myprofile/#{profile.identifier}/plugin/mezuro/edit_compound_metric_configuration?id=#{configuration_content.id}&metric_name=#{formatted_metric_name}" | |
59 | + else | |
60 | + redirect_to "/myprofile/#{profile.identifier}/plugin/mezuro/edit_metric_configuration?id=#{configuration_content.id}&metric_name=#{formatted_metric_name}" | |
61 | + end | |
62 | + end | |
63 | + end | |
64 | + | |
65 | +end | ... | ... |
plugins/mezuro/controllers/profile/mezuro_plugin_module_controller.rb
0 → 100644
... | ... | @@ -0,0 +1,67 @@ |
1 | +class MezuroPluginModuleController < MezuroPluginProfileController | |
2 | + | |
3 | + append_view_path File.join(File.dirname(__FILE__) + '/../../views') | |
4 | + | |
5 | + def module_result | |
6 | + @content = profile.articles.find(params[:id]) | |
7 | + @module_result = @content.module_result(params) | |
8 | + @module = @module_result.module | |
9 | + @module_label = "#{@module.name} (#{@module.granularity})" | |
10 | + if project_content_has_errors? | |
11 | + redirect_to_error_page(@content.errors[:base]) | |
12 | + else | |
13 | + render :partial => 'module_result' | |
14 | + end | |
15 | + end | |
16 | + | |
17 | + def module_metrics_history | |
18 | + metric_name = params[:metric_name] | |
19 | + @content = profile.articles.find(params[:id]) | |
20 | + module_history = @content.result_history(params[:module_name]) | |
21 | + if project_content_has_errors? | |
22 | + redirect_to_error_page(@content.errors[:base]) | |
23 | + else | |
24 | + @score_history = filtering_metric_history(metric_name, module_history) | |
25 | + render :partial => 'score_history' | |
26 | + end | |
27 | + end | |
28 | + | |
29 | + def module_grade_history | |
30 | + @content = profile.articles.find(params[:id]) | |
31 | + modules_results = @content.result_history(params[:module_name]) | |
32 | + if project_content_has_errors? | |
33 | + redirect_to_error_page(@content.errors[:base]) | |
34 | + else | |
35 | + @score_history = modules_results.map do |module_result| | |
36 | + [module_result.grade, format_date_to_simple_form(module_result.date)] | |
37 | + end | |
38 | + render :partial => 'score_history' | |
39 | + end | |
40 | + end | |
41 | + | |
42 | + private | |
43 | + | |
44 | + def filtering_metric_history(metric_name, module_history) | |
45 | + metrics_history = module_history.map do |module_result| | |
46 | + [module_result.metric_results, format_date_to_simple_form(module_result.date)] | |
47 | + end | |
48 | + metric_history = metrics_history.map do |metric_results_with_date| | |
49 | + [(metric_results_with_date.first.select do |metric_result| | |
50 | + metric_result.metric.name.delete("() ") == metric_name | |
51 | + end).first, metric_results_with_date.last] | |
52 | + end | |
53 | + metric_history.map do |metric_result_with_date| | |
54 | + [metric_result_with_date.first.value, metric_result_with_date.last] | |
55 | + end | |
56 | + end | |
57 | + | |
58 | + def redirect_to_error_page(message) | |
59 | + message = URI.escape(CGI.escape(message),'.') | |
60 | + redirect_to "/profile/#{profile.identifier}/plugins/mezuro/error_page?message=#{message}" | |
61 | + end | |
62 | + | |
63 | + def format_date_to_simple_form date | |
64 | + date.to_s[0..9] | |
65 | + end | |
66 | + | |
67 | +end | ... | ... |
plugins/mezuro/controllers/profile/mezuro_plugin_profile_controller.rb
0 → 100644
... | ... | @@ -0,0 +1,16 @@ |
1 | +class MezuroPluginProfileController < ProfileController | |
2 | + | |
3 | + append_view_path File.join(File.dirname(__FILE__) + '/../../views') | |
4 | + | |
5 | + def error_page | |
6 | + @message = params[:message] | |
7 | + end | |
8 | + | |
9 | + protected | |
10 | + | |
11 | + def project_content_has_errors? | |
12 | + not @content.errors[:base].nil? | |
13 | + end | |
14 | + | |
15 | +end | |
16 | + | ... | ... |
plugins/mezuro/controllers/profile/mezuro_plugin_project_controller.rb
0 → 100644
... | ... | @@ -0,0 +1,50 @@ |
1 | +class MezuroPluginProjectController < MezuroPluginProfileController | |
2 | + | |
3 | + append_view_path File.join(File.dirname(__FILE__) + '/../../views') | |
4 | + | |
5 | + def project_state | |
6 | + @content = profile.articles.find(params[:id]) | |
7 | + project = @content.project | |
8 | + if project_content_has_errors? | |
9 | + redirect_to_error_page(@content.errors[:base]) | |
10 | + else | |
11 | + state = project.kalibro_error.nil? ? project.state : "ERROR" | |
12 | + render :text => state | |
13 | + end | |
14 | + end | |
15 | + | |
16 | + def project_error | |
17 | + @content = profile.articles.find(params[:id]) | |
18 | + @project = @content.project | |
19 | + if project_content_has_errors? | |
20 | + redirect_to_error_page(@content.errors[:base]) | |
21 | + else | |
22 | + render :partial => 'project_error' | |
23 | + end | |
24 | + end | |
25 | + | |
26 | + def project_result | |
27 | + @content = profile.articles.find(params[:id]) | |
28 | + date = params[:date] | |
29 | + @project_result = date.nil? ? @content.project_result : @content.project_result_with_date(date) | |
30 | + if project_content_has_errors? | |
31 | + redirect_to_error_page(@content.errors[:base]) | |
32 | + else | |
33 | + render :partial => 'project_result' | |
34 | + end | |
35 | + end | |
36 | + | |
37 | + def project_tree | |
38 | + @content = profile.articles.find(params[:id]) | |
39 | + date = params[:date] | |
40 | + project_result = date.nil? ? @content.project_result : @content.project_result_with_date(date) | |
41 | + @project_name = @content.project.name if not @content.project.nil? | |
42 | + if project_content_has_errors? | |
43 | + redirect_to_error_page(@content.errors[:base]) | |
44 | + else | |
45 | + @source_tree = project_result.node(params[:module_name]) | |
46 | + render :partial =>'source_tree' | |
47 | + end | |
48 | + end | |
49 | + | |
50 | +end | ... | ... |
plugins/mezuro/public/javascripts/project_content.js
... | ... | @@ -10,7 +10,7 @@ jQuery(function (){ |
10 | 10 | }); |
11 | 11 | |
12 | 12 | function showProjectContent() { |
13 | - callAction('project_state', {}, showProjectContentFor); | |
13 | + callAction('project', 'project_state', {}, showProjectContentFor); | |
14 | 14 | } |
15 | 15 | |
16 | 16 | function display_metric_history() { |
... | ... | @@ -18,14 +18,14 @@ function display_metric_history() { |
18 | 18 | var metric_name = jQuery(this).attr('show-metric-history'); |
19 | 19 | toggle_mezuro("." + metric_name); |
20 | 20 | metricName = metric_name; |
21 | - callAction('module_metrics_history', {module_name: module_name, metric_name: metric_name}, show_metrics); | |
21 | + callAction('module', 'module_metrics_history', {module_name: module_name, metric_name: metric_name}, show_metrics); | |
22 | 22 | return false; |
23 | 23 | } |
24 | 24 | |
25 | 25 | function display_grade_history() { |
26 | 26 | var module_name = jQuery(this).attr('data-module-name'); |
27 | 27 | toggle_mezuro("#historical-grade"); |
28 | - callAction('module_grade_history', {module_name: module_name}, show_grades); | |
28 | + callAction('module', 'module_grade_history', {module_name: module_name}, show_grades); | |
29 | 29 | return false; |
30 | 30 | } |
31 | 31 | |
... | ... | @@ -46,8 +46,8 @@ function reloadModule(){ |
46 | 46 | var module_name = jQuery(this).attr('data-module-name'); |
47 | 47 | showLoadingProcess(false); |
48 | 48 | processingTree = true; |
49 | - callAction('project_tree', {module_name: module_name }, showProjectTree); | |
50 | - callAction('module_result', {module_name: module_name}, showModuleResult); | |
49 | + callAction('project', 'project_tree', {module_name: module_name }, showProjectTree); | |
50 | + callAction('module', 'module_result', {module_name: module_name}, showModuleResult); | |
51 | 51 | return false; |
52 | 52 | } |
53 | 53 | |
... | ... | @@ -59,23 +59,23 @@ function reloadProjectWithDate(date){ |
59 | 59 | function reloadProject(date){ |
60 | 60 | showLoadingProcess(true); |
61 | 61 | |
62 | - callAction('project_result', {date: date}, showProjectResult); | |
63 | - callAction('project_tree', {date: date}, showProjectTree); | |
64 | - callAction('module_result', {date: date}, showModuleResult); | |
62 | + callAction('project', 'project_result', {date: date}, showProjectResult); | |
63 | + callAction('project', 'project_tree', {date: date}, showProjectTree); | |
64 | + callAction('module', 'module_result', {date: date}, showModuleResult); | |
65 | 65 | } |
66 | 66 | |
67 | 67 | function showProjectContentFor(state){ |
68 | 68 | if (state == 'ERROR') { |
69 | 69 | jQuery('#project-state').html('ERROR'); |
70 | - callAction('project_error', {}, showProjectResult); | |
70 | + callAction('project', 'project_error', {}, showProjectResult); | |
71 | 71 | } |
72 | 72 | else if (state == 'READY') { |
73 | 73 | jQuery('#msg-time').html(''); |
74 | 74 | jQuery('#project-state').html('READY'); |
75 | - callAction('project_result', {}, showProjectResult); | |
76 | - callAction('project_tree', {}, showProjectTree); | |
75 | + callAction('project', 'project_result', {}, showProjectResult); | |
76 | + callAction('project','project_tree', {}, showProjectTree); | |
77 | 77 | var project_name = jQuery("#project-result").attr('data-project-name'); |
78 | - callAction('module_result', {module_name: project_name}, showModuleResult); | |
78 | + callAction('module', 'module_result', {module_name: project_name}, showModuleResult); | |
79 | 79 | } |
80 | 80 | else if (state.endsWith("ING")) { |
81 | 81 | jQuery('#project-state').html(state); |
... | ... | @@ -109,10 +109,10 @@ function showModuleResult(content){ |
109 | 109 | return false; |
110 | 110 | } |
111 | 111 | |
112 | -function callAction(action, params, callback){ | |
112 | +function callAction(controller, action, params, callback){ | |
113 | 113 | var profile = projectContentData('profile'); |
114 | 114 | var content = projectContentData('content'); |
115 | - var endpoint = '/profile/' + profile + '/plugins/mezuro/' + action + '/' + content; | |
115 | + var endpoint = '/profile/' + profile + '/plugin/mezuro/' + controller + '/' + action + '/' + content; | |
116 | 116 | jQuery.get(endpoint, params, callback); |
117 | 117 | } |
118 | 118 | ... | ... |
plugins/mezuro/test/functional/mezuro_plugin_myprofile_controller_test.rb
... | ... | @@ -5,7 +5,6 @@ require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/base_tool_fixtures" |
5 | 5 | require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/native_metric_fixtures" |
6 | 6 | require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_configuration_fixtures" |
7 | 7 | require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/configuration_fixtures" |
8 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/range_fixtures" | |
9 | 8 | |
10 | 9 | class MezuroPluginMyprofileControllerTest < ActionController::TestCase |
11 | 10 | |
... | ... | @@ -35,9 +34,6 @@ class MezuroPluginMyprofileControllerTest < ActionController::TestCase |
35 | 34 | @native_hash.delete :attributes! |
36 | 35 | @compound_hash = @compound_metric_configuration.to_hash.merge({:configuration_name => @compound_metric_configuration.configuration_name}) |
37 | 36 | @compound_hash.delete :attributes! |
38 | - | |
39 | - @range = RangeFixtures.range_excellent | |
40 | - @range_hash = RangeFixtures.range_excellent_hash | |
41 | 37 | end |
42 | 38 | |
43 | 39 | should 'test choose base tool' do |
... | ... | @@ -57,172 +53,4 @@ class MezuroPluginMyprofileControllerTest < ActionController::TestCase |
57 | 53 | assert_response 200 |
58 | 54 | end |
59 | 55 | |
60 | - should 'test new metric configuration' do | |
61 | - Kalibro::BaseTool.expects(:request).with("BaseTool", :get_base_tool, {:base_tool_name => @base_tool.name}).returns({:base_tool => @base_tool_hash}) | |
62 | - get :new_metric_configuration, :profile => @profile.identifier, :id => @content.id, :base_tool => @base_tool.name, :metric_name => @metric.name | |
63 | - assert_equal @content, assigns(:configuration_content) | |
64 | - assert_equal @metric.name, assigns(:metric).name | |
65 | - assert_response 200 | |
66 | - end | |
67 | - | |
68 | - | |
69 | - should 'test new compound metric configuration' do | |
70 | - Kalibro::Configuration.expects(:request).with("Configuration", :get_configuration, {:configuration_name => @content.name}).returns({:configuration => @configuration_hash}) | |
71 | - get :new_compound_metric_configuration, :profile => @profile.identifier, :id => @content.id | |
72 | - assert_equal @content, assigns(:configuration_content) | |
73 | - assert_equal @configuration.metric_configuration[0].code, assigns(:metric_configurations)[0].code | |
74 | - assert_response 200 | |
75 | - end | |
76 | - | |
77 | - should 'test edit metric configuration' do | |
78 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { | |
79 | - :configuration_name => @content.name, | |
80 | - :metric_name => @metric_configuration.metric.name}).returns({:metric_configuration => @metric_configuration_hash}) | |
81 | - get :edit_metric_configuration, :profile => @profile.identifier, :id => @content.id, :metric_name => @metric.name | |
82 | - assert_equal @content, assigns(:configuration_content) | |
83 | - assert_equal @metric_configuration.code, assigns(:metric_configuration).code | |
84 | - assert_equal @metric_configuration.metric.name, assigns(:metric).name | |
85 | - assert_response 200 | |
86 | - end | |
87 | - | |
88 | - should 'test edit compound metric configuration' do | |
89 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { | |
90 | - :configuration_name => @content.name, | |
91 | - :metric_name => @compound_metric_configuration.metric.name}).returns({:metric_configuration => @compound_metric_configuration_hash}) | |
92 | - Kalibro::Configuration.expects(:request).with("Configuration", :get_configuration, {:configuration_name => @content.name}).returns({:configuration => @configuration_hash}) | |
93 | - get :edit_compound_metric_configuration, | |
94 | - :profile => @profile.identifier, | |
95 | - :id => @content.id, | |
96 | - :metric_name => @compound_metric_configuration.metric.name | |
97 | - assert_equal @content, assigns(:configuration_content) | |
98 | - assert_equal @compound_metric_configuration.code, assigns(:metric_configuration).code | |
99 | - assert_equal @compound_metric_configuration.metric.name, assigns(:metric).name | |
100 | - assert_equal @configuration.metric_configuration[0].code, assigns(:metric_configurations)[0].code | |
101 | - assert_response 200 | |
102 | - end | |
103 | - | |
104 | - should 'test create native metric configuration' do | |
105 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, { | |
106 | - :metric_configuration => @metric_configuration.to_hash, | |
107 | - :configuration_name => @metric_configuration.configuration_name}) | |
108 | - get :create_metric_configuration, | |
109 | - :profile => @profile.identifier, | |
110 | - :id => @content.id, | |
111 | - :metric_configuration => @native_hash | |
112 | - assert_response 302 | |
113 | - end | |
114 | - | |
115 | - should 'test compound metric creation' do | |
116 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, { | |
117 | - :metric_configuration => @compound_metric_configuration.to_hash, | |
118 | - :configuration_name => @compound_metric_configuration.configuration_name}) | |
119 | - get :create_compound_metric_configuration, :profile => @profile.identifier, :id => @content.id, | |
120 | - :metric_configuration => @compound_hash | |
121 | - assert_response 302 | |
122 | - end | |
123 | - | |
124 | - should 'test update native metric configuration' do | |
125 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { | |
126 | - :configuration_name => @content.name, | |
127 | - :metric_name => @metric_configuration.metric.name}).returns({:metric_configuration => @metric_configuration_hash}) | |
128 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, { | |
129 | - :metric_configuration => @metric_configuration.to_hash, | |
130 | - :configuration_name => @metric_configuration.configuration_name}) | |
131 | - get :update_metric_configuration, :profile => @profile.identifier, :id => @content.id, | |
132 | - :metric_configuration => @native_hash | |
133 | - assert_equal @content, assigns(:configuration_content) | |
134 | - assert_response 302 | |
135 | - end | |
136 | - | |
137 | - should 'test update compound metric configuration' do | |
138 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { | |
139 | - :configuration_name => @content.name, | |
140 | - :metric_name => @compound_metric_configuration.metric.name}).returns({:metric_configuration => @compound_metric_configuration_hash}) | |
141 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, { | |
142 | - :metric_configuration => @compound_metric_configuration.to_hash, | |
143 | - :configuration_name => @compound_metric_configuration.configuration_name}) | |
144 | - get :update_compound_metric_configuration, :profile => @profile.identifier, :id => @content.id, | |
145 | - :metric_configuration => @compound_hash | |
146 | - assert_equal @content, assigns(:configuration_content) | |
147 | - assert_response 302 | |
148 | - end | |
149 | - | |
150 | - should 'test remove metric configuration' do | |
151 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { | |
152 | - :configuration_name => @content.name, | |
153 | - :metric_name => @metric.name}).returns({:metric_configuration => @metric_configuration_hash}) | |
154 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :remove_metric_configuration, { | |
155 | - :metric_name => @metric.name, | |
156 | - :configuration_name => @metric_configuration.configuration_name}) | |
157 | - get :remove_metric_configuration, :profile => @profile.identifier, :id => @content.id, :metric_name => @metric.name | |
158 | - assert_response 302 | |
159 | - end | |
160 | - | |
161 | - should 'test new range' do | |
162 | - get :new_range, :profile => @profile.identifier, :id => @content.id, :metric_name => @metric.name | |
163 | - assert_equal @content, assigns(:configuration_content) | |
164 | - assert_equal @metric.name, assigns(:metric_name) | |
165 | - assert_response 200 | |
166 | - end | |
167 | - | |
168 | - should 'test edit range' do | |
169 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { | |
170 | - :configuration_name => @content.name, | |
171 | - :metric_name => @metric.name}).returns({:metric_configuration => @metric_configuration_hash}) | |
172 | - get :edit_range, :profile => @profile.identifier, :id => @content.id, :metric_name => @metric.name, :beginning_id => @range.beginning | |
173 | - assert_equal @content, assigns(:configuration_content) | |
174 | - assert_equal @metric.name, assigns(:metric_name) | |
175 | - assert_equal @range.beginning, assigns(:beginning_id) | |
176 | - assert_equal @range.end, assigns(:range).end | |
177 | - assert_response 200 | |
178 | - end | |
179 | - | |
180 | - should 'test create instance range' do | |
181 | - metric_configuration = @metric_configuration | |
182 | - metric_configuration.add_range(@range) | |
183 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { | |
184 | - :configuration_name => @content.name, | |
185 | - :metric_name => @metric.name}).returns({:metric_configuration => @metric_configuration_hash}) | |
186 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, { | |
187 | - :metric_configuration => metric_configuration.to_hash, | |
188 | - :configuration_name => metric_configuration.configuration_name}) | |
189 | - get :create_range, :profile => @profile.identifier, :range => @range_hash, :id => @content.id, :metric_name => @metric.name | |
190 | - assert_equal @content, assigns(:configuration_content) | |
191 | - assert_equal @range.end, assigns(:range).end | |
192 | - assert_response 200 | |
193 | - end | |
194 | - | |
195 | - should 'test update range' do | |
196 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { | |
197 | - :configuration_name => @content.name, | |
198 | - :metric_name => @metric.name}).returns({:metric_configuration => @metric_configuration_hash}) | |
199 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, { | |
200 | - :metric_configuration => @metric_configuration.to_hash, | |
201 | - :configuration_name => @metric_configuration.configuration_name}) | |
202 | - get :update_range, | |
203 | - :profile => @profile.identifier, | |
204 | - :range => @range_hash, | |
205 | - :id => @content.id, | |
206 | - :metric_name => @metric.name, | |
207 | - :beginning_id => @range.beginning | |
208 | - assert_response 200 | |
209 | - end | |
210 | - | |
211 | - should 'test remove range' do | |
212 | - metric_configuration = @metric_configuration | |
213 | - metric_configuration.ranges.delete_if { |range| range.beginning == @range.beginning.to_f } | |
214 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { | |
215 | - :configuration_name => @content.name, | |
216 | - :metric_name => @metric.name}).returns({:metric_configuration => @metric_configuration_hash}) | |
217 | - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, { | |
218 | - :metric_configuration => metric_configuration.to_hash, | |
219 | - :configuration_name => metric_configuration.configuration_name}) | |
220 | - get :remove_range, | |
221 | - :profile => @profile.identifier, | |
222 | - :id => @content.id, | |
223 | - :metric_name => @metric.name, | |
224 | - :beginning_id => @range.beginning | |
225 | - assert_response 302 | |
226 | - end | |
227 | - | |
228 | 56 | end | ... | ... |
plugins/mezuro/test/functional/mezuro_plugin_profile_controller_test.rb
... | ... | @@ -1,141 +0,0 @@ |
1 | -require 'test_helper' | |
2 | - | |
3 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/module_result_fixtures" | |
4 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/project_result_fixtures" | |
5 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/error_fixtures" | |
6 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/repository_fixtures" | |
7 | - | |
8 | -class MezuroPluginProfileControllerTest < ActionController::TestCase | |
9 | - | |
10 | - def setup | |
11 | - @controller = MezuroPluginProfileController.new | |
12 | - @request = ActionController::TestRequest.new | |
13 | - @response = ActionController::TestResponse.new | |
14 | - @profile = fast_create(Community) | |
15 | - | |
16 | - @project_result = ProjectResultFixtures.project_result | |
17 | - @module_result = ModuleResultFixtures.module_result | |
18 | - @repository_url = RepositoryFixtures.repository.address | |
19 | - @project = @project_result.project | |
20 | - @date = "2012-04-13T20:39:41+04:00" | |
21 | - | |
22 | - Kalibro::Project.expects(:all_names).returns([]) | |
23 | - @content = MezuroPlugin::ProjectContent.new(:profile => @profile, :name => @project.name, :repository_url => @repository_url) | |
24 | - @content.expects(:send_project_to_service).returns(nil) | |
25 | - @content.save | |
26 | - end | |
27 | - | |
28 | - should 'test project state without kalibro_error' do | |
29 | - Kalibro::Project.expects(:request).with("Project", :get_project, :project_name => @project.name).returns({:project => @project.to_hash}) | |
30 | - get :project_state, :profile => @profile.identifier, :id => @content.id | |
31 | - assert_response 200 | |
32 | - assert_equal @content, assigns(:content) | |
33 | - end | |
34 | - | |
35 | - should 'test project state with kalibro_error' do | |
36 | - Kalibro::Project.expects(:request).with("Project", :get_project, :project_name => @project.name).returns({:project => @project.to_hash.merge({:error => ErrorFixtures.error_hash})}) | |
37 | - get :project_state, :profile => @profile.identifier, :id => @content.id | |
38 | - assert_response 200 | |
39 | - assert_equal "ERROR", @response.body | |
40 | - assert_equal @content, assigns(:content) | |
41 | - end | |
42 | - | |
43 | - should 'test project error' do | |
44 | - Kalibro::Project.expects(:request).with("Project", :get_project, :project_name => @project.name).returns({:project => @project.to_hash.merge({:error => ErrorFixtures.error_hash})}) | |
45 | - get :project_error, :profile => @profile.identifier, :id => @content.id | |
46 | - assert_response 200 | |
47 | - assert_select('h3', 'ERROR') | |
48 | - assert_equal @content, assigns(:content) | |
49 | - assert_equal @project.name, assigns(:project).name | |
50 | - end | |
51 | - | |
52 | - should 'test project result without date' do | |
53 | - Kalibro::ProjectResult.expects(:request).with("ProjectResult", :get_last_result_of, {:project_name => @project.name}).returns({:project_result => @project_result.to_hash}) | |
54 | - get :project_result, :profile => @profile.identifier, :id => @content.id, :date => nil | |
55 | - assert_equal @content, assigns(:content) | |
56 | - assert_equal @project_result.project.name, assigns(:project_result).project.name | |
57 | - assert_response 200 | |
58 | - assert_select('h4', 'Last Result') | |
59 | - end | |
60 | - | |
61 | - should 'test project results from a specific date' do | |
62 | - request_body = {:project_name => @project.name, :date => @date} | |
63 | - Kalibro::ProjectResult.expects(:request).with("ProjectResult", :has_results_before, request_body).returns({:has_results => true}) | |
64 | - Kalibro::ProjectResult.expects(:request).with("ProjectResult", :get_last_result_before, request_body).returns({:project_result => @project_result.to_hash}) | |
65 | - get :project_result, :profile => @profile.identifier, :id => @content.id, :date => @date | |
66 | - assert_equal @content, assigns(:content) | |
67 | - assert_equal @project_result.project.name, assigns(:project_result).project.name | |
68 | - assert_response 200 | |
69 | - assert_select('h4', 'Last Result') | |
70 | - end | |
71 | - | |
72 | - | |
73 | - should 'get module result without date' do | |
74 | - date_with_milliseconds = Kalibro::ProjectResult.date_with_milliseconds(@project_result.date) | |
75 | - Kalibro::ProjectResult.expects(:request). | |
76 | - with("ProjectResult", :get_last_result_of, {:project_name => @project.name}). | |
77 | - returns({:project_result => @project_result.to_hash}) | |
78 | - Kalibro::ModuleResult.expects(:request). | |
79 | - with("ModuleResult", :get_module_result, {:project_name => @project.name, :module_name => @project.name, :date => date_with_milliseconds}). | |
80 | - returns({:module_result => @module_result.to_hash}) | |
81 | - get :module_result, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name, :date => nil | |
82 | - assert_equal @content, assigns(:content) | |
83 | - assert_equal @module_result.grade, assigns(:module_result).grade | |
84 | - assert_response 200 | |
85 | - assert_select('h5', 'Metric results for: Qt-Calculator (APPLICATION)') | |
86 | - end | |
87 | - | |
88 | - should 'get module result with a specific date' do | |
89 | - date_with_milliseconds = Kalibro::ProjectResult.date_with_milliseconds(@project_result.date) | |
90 | - request_body = {:project_name => @project.name, :date => @project_result.date} | |
91 | - Kalibro::ProjectResult.expects(:request).with("ProjectResult", :has_results_before, request_body).returns({:has_results => true}) | |
92 | - Kalibro::ProjectResult.expects(:request).with("ProjectResult", :get_last_result_before, request_body).returns({:project_result => @project_result.to_hash}) | |
93 | - Kalibro::ModuleResult.expects(:request).with("ModuleResult", :get_module_result, {:project_name => @project.name, :module_name => @project.name, :date => date_with_milliseconds}).returns({:module_result => @module_result.to_hash}) | |
94 | - get :module_result, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name, :date => @project_result.date | |
95 | - assert_equal @content, assigns(:content) | |
96 | - assert_equal @module_result.grade, assigns(:module_result).grade | |
97 | - assert_response 200 | |
98 | - assert_select('h5', 'Metric results for: Qt-Calculator (APPLICATION)') | |
99 | - end | |
100 | - | |
101 | - should 'test project tree without date' do | |
102 | - Kalibro::ProjectResult.expects(:request).with("ProjectResult", :get_last_result_of, {:project_name => @project.name}).returns({:project_result => @project_result.to_hash}) | |
103 | - Kalibro::Project.expects(:request).with("Project", :get_project, :project_name => @project.name).returns({:project => @project.to_hash}) | |
104 | - get :project_tree, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name, :date => nil | |
105 | - assert_equal @content, assigns(:content) | |
106 | - assert_equal @project.name, assigns(:project_name) | |
107 | - assert_equal @project_result.source_tree.module.name, assigns(:source_tree).module.name | |
108 | - assert_response 200 | |
109 | - assert_select('h2', /Qt-Calculator/) | |
110 | - end | |
111 | - | |
112 | - should 'test project tree with a specific date' do | |
113 | - request_body = {:project_name => @project.name, :date => @project_result.date} | |
114 | - Kalibro::Project.expects(:request).with("Project", :get_project, :project_name => @project.name).returns({:project => @project.to_hash}) | |
115 | - Kalibro::ProjectResult.expects(:request).with("ProjectResult", :has_results_before, request_body).returns({:has_results => true}) | |
116 | - Kalibro::ProjectResult.expects(:request).with("ProjectResult", :get_last_result_before, request_body).returns({:project_result => @project_result.to_hash}) | |
117 | - get :project_tree, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name, :date => @project_result.date | |
118 | - assert_equal @content, assigns(:content) | |
119 | - assert_equal @project.name, assigns(:project_name) | |
120 | - assert_equal @project_result.source_tree.module.name, assigns(:source_tree).module.name | |
121 | - assert_response 200 | |
122 | - end | |
123 | - | |
124 | - should 'test module metrics history' do | |
125 | - Kalibro::ModuleResult.expects(:request).with("ModuleResult", :get_result_history, {:project_name => @project.name, :module_name => @project.name}).returns({:module_result => @module_result}) | |
126 | - get :module_metrics_history, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name, | |
127 | - :metric_name => @module_result.metric_result.first.metric.name.delete("() ") | |
128 | - assert_equal @content, assigns(:content) | |
129 | - assert_equal [[@module_result.metric_result[0].value, @module_result.date.to_s[0..9]]], assigns(:score_history) | |
130 | - assert_response 200 | |
131 | - end | |
132 | - | |
133 | - should 'test grade history' do | |
134 | - Kalibro::ModuleResult.expects(:request).with("ModuleResult", :get_result_history, {:project_name => @project.name, :module_name => @project.name}).returns({:module_result => @module_result}) | |
135 | - get :module_grade_history, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name | |
136 | - assert_equal @content, assigns(:content) | |
137 | - assert_equal [[@module_result.grade, @module_result.date.to_s[0..9]]], assigns(:score_history) | |
138 | - assert_response 200 | |
139 | - end | |
140 | - | |
141 | -end |
plugins/mezuro/test/functional/myprofile/mezuro_plugin_base_tool_controller_test.rb
0 → 100644
... | ... | @@ -0,0 +1,42 @@ |
1 | +require 'test_helper' | |
2 | + | |
3 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/base_tool_fixtures" | |
4 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/configuration_fixtures" | |
5 | + | |
6 | +class MezuroPluginBaseToolControllerTest < ActionController::TestCase | |
7 | + | |
8 | + def setup | |
9 | + @controller = MezuroPluginBaseToolController.new | |
10 | + @request = ActionController::TestRequest.new | |
11 | + @response = ActionController::TestResponse.new | |
12 | + @profile = fast_create(Community) | |
13 | + | |
14 | + @base_tool = BaseToolFixtures.base_tool | |
15 | + @base_tool_hash = BaseToolFixtures.base_tool_hash | |
16 | + @configuration = ConfigurationFixtures.configuration | |
17 | + | |
18 | + Kalibro::Configuration.expects(:all_names).returns([]) | |
19 | + @content = MezuroPlugin::ConfigurationContent.new(:profile => @profile, :name => @configuration.name) | |
20 | + @content.expects(:send_kalibro_configuration_to_service).returns(nil) | |
21 | + @content.stubs(:solr_save) | |
22 | + @content.save | |
23 | + end | |
24 | + | |
25 | + should 'test choose base tool' do | |
26 | + Kalibro::BaseTool.expects(:request).with("BaseTool", :get_base_tool_names).returns({:base_tool_name => @base_tool.name}) | |
27 | + get :choose_base_tool, :profile => @profile.identifier, :id => @content.id | |
28 | + assert_equal [@base_tool.name], assigns(:base_tools) | |
29 | + assert_equal @content, assigns(:configuration_content) | |
30 | + assert_response 200 | |
31 | + end | |
32 | + | |
33 | + should 'test choose metric' do | |
34 | + Kalibro::BaseTool.expects(:request).with("BaseTool", :get_base_tool, {:base_tool_name => @base_tool.name}).returns({:base_tool => @base_tool_hash}) | |
35 | + get :choose_metric, :profile => @profile.identifier, :id => @content.id, :base_tool => @base_tool.name | |
36 | + assert_equal @content, assigns(:configuration_content) | |
37 | + assert_equal @base_tool.name, assigns(:base_tool) | |
38 | + assert_equal @base_tool.supported_metric[0].name, assigns(:supported_metrics)[0].name | |
39 | + assert_response 200 | |
40 | + end | |
41 | + | |
42 | +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/test/functional/myprofile/mezuro_plugin_range_controller_test.rb
0 → 100644
... | ... | @@ -0,0 +1,97 @@ |
1 | +require 'test_helper' | |
2 | + | |
3 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/native_metric_fixtures" | |
4 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_configuration_fixtures" | |
5 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/configuration_fixtures" | |
6 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/range_fixtures" | |
7 | + | |
8 | +class MezuroPluginRangeControllerTest < ActionController::TestCase | |
9 | + | |
10 | + def setup | |
11 | + @controller = MezuroPluginRangeController.new | |
12 | + @request = ActionController::TestRequest.new | |
13 | + @response = ActionController::TestResponse.new | |
14 | + @profile = fast_create(Community) | |
15 | + | |
16 | + @metric = NativeMetricFixtures.amloc | |
17 | + @metric_configuration = MetricConfigurationFixtures.amloc_metric_configuration | |
18 | + @metric_configuration_hash = MetricConfigurationFixtures.amloc_metric_configuration_hash | |
19 | + @configuration = ConfigurationFixtures.configuration | |
20 | + | |
21 | + Kalibro::Configuration.expects(:all_names).returns([]) | |
22 | + @content = MezuroPlugin::ConfigurationContent.new(:profile => @profile, :name => @configuration.name) | |
23 | + @content.expects(:send_kalibro_configuration_to_service).returns(nil) | |
24 | + @content.stubs(:solr_save) | |
25 | + @content.save | |
26 | + | |
27 | + @range = RangeFixtures.range_excellent | |
28 | + @range_hash = RangeFixtures.range_excellent_hash | |
29 | + end | |
30 | + | |
31 | + should 'test new range' do | |
32 | + get :new_range, :profile => @profile.identifier, :id => @content.id, :metric_name => @metric.name | |
33 | + assert_equal @content, assigns(:configuration_content) | |
34 | + assert_equal @metric.name, assigns(:metric_name) | |
35 | + assert_response 200 | |
36 | + end | |
37 | + | |
38 | + should 'test edit range' do | |
39 | + Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { | |
40 | + :configuration_name => @content.name, | |
41 | + :metric_name => @metric.name}).returns({:metric_configuration => @metric_configuration_hash}) | |
42 | + get :edit_range, :profile => @profile.identifier, :id => @content.id, :metric_name => @metric.name, :beginning_id => @range.beginning | |
43 | + assert_equal @content, assigns(:configuration_content) | |
44 | + assert_equal @metric.name, assigns(:metric_name) | |
45 | + assert_equal @range.beginning, assigns(:beginning_id) | |
46 | + assert_equal @range.end, assigns(:range).end | |
47 | + assert_response 200 | |
48 | + end | |
49 | + | |
50 | + should 'test create instance range' do | |
51 | + metric_configuration = @metric_configuration | |
52 | + metric_configuration.add_range(@range) | |
53 | + Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { | |
54 | + :configuration_name => @content.name, | |
55 | + :metric_name => @metric.name}).returns({:metric_configuration => @metric_configuration_hash}) | |
56 | + Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, { | |
57 | + :metric_configuration => metric_configuration.to_hash, | |
58 | + :configuration_name => metric_configuration.configuration_name}) | |
59 | + get :create_range, :profile => @profile.identifier, :range => @range_hash, :id => @content.id, :metric_name => @metric.name | |
60 | + assert_equal @content, assigns(:configuration_content) | |
61 | + assert_equal @range.end, assigns(:range).end | |
62 | + assert_response 200 | |
63 | + end | |
64 | + | |
65 | + should 'test update range' do | |
66 | + Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { | |
67 | + :configuration_name => @content.name, | |
68 | + :metric_name => @metric.name}).returns({:metric_configuration => @metric_configuration_hash}) | |
69 | + Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, { | |
70 | + :metric_configuration => @metric_configuration.to_hash, | |
71 | + :configuration_name => @metric_configuration.configuration_name}) | |
72 | + get :update_range, | |
73 | + :profile => @profile.identifier, | |
74 | + :range => @range_hash, | |
75 | + :id => @content.id, | |
76 | + :metric_name => @metric.name, | |
77 | + :beginning_id => @range.beginning | |
78 | + assert_response 200 | |
79 | + end | |
80 | + | |
81 | + should 'test remove range' do | |
82 | + metric_configuration = @metric_configuration | |
83 | + metric_configuration.ranges.delete_if { |range| range.beginning == @range.beginning.to_f } | |
84 | + Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { | |
85 | + :configuration_name => @content.name, | |
86 | + :metric_name => @metric.name}).returns({:metric_configuration => @metric_configuration_hash}) | |
87 | + Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, { | |
88 | + :metric_configuration => metric_configuration.to_hash, | |
89 | + :configuration_name => metric_configuration.configuration_name}) | |
90 | + get :remove_range, | |
91 | + :profile => @profile.identifier, | |
92 | + :id => @content.id, | |
93 | + :metric_name => @metric.name, | |
94 | + :beginning_id => @range.beginning | |
95 | + assert_response 302 | |
96 | + end | |
97 | +end | ... | ... |
plugins/mezuro/test/functional/profile/mezuro_plugin_module_controller_test.rb
0 → 100644
... | ... | @@ -0,0 +1,74 @@ |
1 | +require 'test_helper' | |
2 | + | |
3 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/module_result_fixtures" | |
4 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/project_result_fixtures" | |
5 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/error_fixtures" | |
6 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/repository_fixtures" | |
7 | + | |
8 | +class MezuroPluginModuleControllerTest < ActionController::TestCase | |
9 | + | |
10 | + def setup | |
11 | + @controller = MezuroPluginModuleController.new | |
12 | + @request = ActionController::TestRequest.new | |
13 | + @response = ActionController::TestResponse.new | |
14 | + @profile = fast_create(Community) | |
15 | + | |
16 | + @project_result = ProjectResultFixtures.project_result | |
17 | + @module_result = ModuleResultFixtures.module_result | |
18 | + @repository_url = RepositoryFixtures.repository.address | |
19 | + @project = @project_result.project | |
20 | + @date = "2012-04-13T20:39:41+04:00" | |
21 | + | |
22 | + Kalibro::Project.expects(:all_names).returns([]) | |
23 | + @content = MezuroPlugin::ProjectContent.new(:profile => @profile, :name => @project.name, :repository_url => @repository_url) | |
24 | + @content.expects(:send_project_to_service).returns(nil) | |
25 | + @content.save | |
26 | + end | |
27 | + | |
28 | + | |
29 | + should 'get module result without date' do | |
30 | + date_with_milliseconds = Kalibro::ProjectResult.date_with_milliseconds(@project_result.date) | |
31 | + Kalibro::ProjectResult.expects(:request). | |
32 | + with("ProjectResult", :get_last_result_of, {:project_name => @project.name}). | |
33 | + returns({:project_result => @project_result.to_hash}) | |
34 | + Kalibro::ModuleResult.expects(:request). | |
35 | + with("ModuleResult", :get_module_result, {:project_name => @project.name, :module_name => @project.name, :date => date_with_milliseconds}). | |
36 | + returns({:module_result => @module_result.to_hash}) | |
37 | + get :module_result, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name, :date => nil | |
38 | + assert_equal @content, assigns(:content) | |
39 | + assert_equal @module_result.grade, assigns(:module_result).grade | |
40 | + assert_response 200 | |
41 | + assert_select('h5', 'Metric results for: Qt-Calculator (APPLICATION)') | |
42 | + end | |
43 | + | |
44 | + should 'get module result with a specific date' do | |
45 | + date_with_milliseconds = Kalibro::ProjectResult.date_with_milliseconds(@project_result.date) | |
46 | + request_body = {:project_name => @project.name, :date => @project_result.date} | |
47 | + Kalibro::ProjectResult.expects(:request).with("ProjectResult", :has_results_before, request_body).returns({:has_results => true}) | |
48 | + Kalibro::ProjectResult.expects(:request).with("ProjectResult", :get_last_result_before, request_body).returns({:project_result => @project_result.to_hash}) | |
49 | + Kalibro::ModuleResult.expects(:request).with("ModuleResult", :get_module_result, {:project_name => @project.name, :module_name => @project.name, :date => date_with_milliseconds}).returns({:module_result => @module_result.to_hash}) | |
50 | + get :module_result, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name, :date => @project_result.date | |
51 | + assert_equal @content, assigns(:content) | |
52 | + assert_equal @module_result.grade, assigns(:module_result).grade | |
53 | + assert_response 200 | |
54 | + assert_select('h5', 'Metric results for: Qt-Calculator (APPLICATION)') | |
55 | + end | |
56 | + | |
57 | + should 'test module metrics history' do | |
58 | + Kalibro::ModuleResult.expects(:request).with("ModuleResult", :get_result_history, {:project_name => @project.name, :module_name => @project.name}).returns({:module_result => @module_result}) | |
59 | + get :module_metrics_history, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name, | |
60 | + :metric_name => @module_result.metric_result.first.metric.name.delete("() ") | |
61 | + assert_equal @content, assigns(:content) | |
62 | + assert_equal [[@module_result.metric_result[0].value, @module_result.date.to_s[0..9]]], assigns(:score_history) | |
63 | + assert_response 200 | |
64 | + end | |
65 | + | |
66 | + should 'test grade history' do | |
67 | + Kalibro::ModuleResult.expects(:request).with("ModuleResult", :get_result_history, {:project_name => @project.name, :module_name => @project.name}).returns({:module_result => @module_result}) | |
68 | + get :module_grade_history, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name | |
69 | + assert_equal @content, assigns(:content) | |
70 | + assert_equal [[@module_result.grade, @module_result.date.to_s[0..9]]], assigns(:score_history) | |
71 | + assert_response 200 | |
72 | + end | |
73 | + | |
74 | +end | ... | ... |
plugins/mezuro/test/functional/profile/mezuro_plugin_project_controller_test.rb
0 → 100644
... | ... | @@ -0,0 +1,92 @@ |
1 | +require 'test_helper' | |
2 | + | |
3 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/project_result_fixtures" | |
4 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/error_fixtures" | |
5 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/repository_fixtures" | |
6 | + | |
7 | +class MezuroPluginProjectControllerTest < ActionController::TestCase | |
8 | + def setup | |
9 | + @controller = MezuroPluginProjectController.new | |
10 | + @request = ActionController::TestRequest.new | |
11 | + @response = ActionController::TestResponse.new | |
12 | + @profile = fast_create(Community) | |
13 | + | |
14 | + @project_result = ProjectResultFixtures.project_result | |
15 | + @repository_url = RepositoryFixtures.repository.address | |
16 | + @project = @project_result.project | |
17 | + @date = "2012-04-13T20:39:41+04:00" | |
18 | + | |
19 | + Kalibro::Project.expects(:all_names).returns([]) | |
20 | + @content = MezuroPlugin::ProjectContent.new(:profile => @profile, :name => @project.name, :repository_url => @repository_url) | |
21 | + @content.expects(:send_project_to_service).returns(nil) | |
22 | + @content.save | |
23 | + end | |
24 | + | |
25 | + should 'test project state without kalibro_error' do | |
26 | + Kalibro::Project.expects(:request).with("Project", :get_project, :project_name => @project.name).returns({:project => @project.to_hash}) | |
27 | + get :project_state, :profile => @profile.identifier, :id => @content.id | |
28 | + assert_response 200 | |
29 | + assert_equal @content, assigns(:content) | |
30 | + end | |
31 | + | |
32 | + should 'test project state with kalibro_error' do | |
33 | + Kalibro::Project.expects(:request).with("Project", :get_project, :project_name => @project.name).returns({:project => @project.to_hash.merge({:error => ErrorFixtures.error_hash})}) | |
34 | + get :project_state, :profile => @profile.identifier, :id => @content.id | |
35 | + assert_response 200 | |
36 | + assert_equal "ERROR", @response.body | |
37 | + assert_equal @content, assigns(:content) | |
38 | + end | |
39 | + | |
40 | + should 'test project error' do | |
41 | + Kalibro::Project.expects(:request).with("Project", :get_project, :project_name => @project.name).returns({:project => @project.to_hash.merge({:error => ErrorFixtures.error_hash})}) | |
42 | + get :project_error, :profile => @profile.identifier, :id => @content.id | |
43 | + assert_response 200 | |
44 | + assert_select('h3', 'ERROR') | |
45 | + assert_equal @content, assigns(:content) | |
46 | + assert_equal @project.name, assigns(:project).name | |
47 | + end | |
48 | + | |
49 | + should 'test project result without date' do | |
50 | + Kalibro::ProjectResult.expects(:request).with("ProjectResult", :get_last_result_of, {:project_name => @project.name}).returns({:project_result => @project_result.to_hash}) | |
51 | + get :project_result, :profile => @profile.identifier, :id => @content.id, :date => nil | |
52 | + assert_equal @content, assigns(:content) | |
53 | + assert_equal @project_result.project.name, assigns(:project_result).project.name | |
54 | + assert_response 200 | |
55 | + assert_select('h4', 'Last Result') | |
56 | + end | |
57 | + | |
58 | + should 'test project results from a specific date' do | |
59 | + request_body = {:project_name => @project.name, :date => @date} | |
60 | + Kalibro::ProjectResult.expects(:request).with("ProjectResult", :has_results_before, request_body).returns({:has_results => true}) | |
61 | + Kalibro::ProjectResult.expects(:request).with("ProjectResult", :get_last_result_before, request_body).returns({:project_result => @project_result.to_hash}) | |
62 | + get :project_result, :profile => @profile.identifier, :id => @content.id, :date => @date | |
63 | + assert_equal @content, assigns(:content) | |
64 | + assert_equal @project_result.project.name, assigns(:project_result).project.name | |
65 | + assert_response 200 | |
66 | + assert_select('h4', 'Last Result') | |
67 | + end | |
68 | + | |
69 | + should 'test project tree without date' do | |
70 | + Kalibro::ProjectResult.expects(:request).with("ProjectResult", :get_last_result_of, {:project_name => @project.name}).returns({:project_result => @project_result.to_hash}) | |
71 | + Kalibro::Project.expects(:request).with("Project", :get_project, :project_name => @project.name).returns({:project => @project.to_hash}) | |
72 | + get :project_tree, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name, :date => nil | |
73 | + assert_equal @content, assigns(:content) | |
74 | + assert_equal @project.name, assigns(:project_name) | |
75 | + assert_equal @project_result.source_tree.module.name, assigns(:source_tree).module.name | |
76 | + assert_response 200 | |
77 | + assert_select('h2', /Qt-Calculator/) | |
78 | + end | |
79 | + | |
80 | + should 'test project tree with a specific date' do | |
81 | + request_body = {:project_name => @project.name, :date => @project_result.date} | |
82 | + Kalibro::Project.expects(:request).with("Project", :get_project, :project_name => @project.name).returns({:project => @project.to_hash}) | |
83 | + Kalibro::ProjectResult.expects(:request).with("ProjectResult", :has_results_before, request_body).returns({:has_results => true}) | |
84 | + Kalibro::ProjectResult.expects(:request).with("ProjectResult", :get_last_result_before, request_body).returns({:project_result => @project_result.to_hash}) | |
85 | + get :project_tree, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name, :date => @project_result.date | |
86 | + assert_equal @content, assigns(:content) | |
87 | + assert_equal @project.name, assigns(:project_name) | |
88 | + assert_equal @project_result.source_tree.module.name, assigns(:source_tree).module.name | |
89 | + assert_response 200 | |
90 | + end | |
91 | + | |
92 | +end | ... | ... |
plugins/mezuro/views/content_viewer/_module_result.rhtml
... | ... | @@ -1,52 +0,0 @@ |
1 | -<h5><%= _('Metric results for: ') + @module_label %> </h5> | |
2 | - | |
3 | -<hr/> | |
4 | -<div class="zoomable-image"> | |
5 | -<table> | |
6 | - <thead> | |
7 | - <tr> | |
8 | - <th>Metric</th> | |
9 | - <th>Value</th> | |
10 | - <th>Weight</th> | |
11 | - <th>Threshold</th> | |
12 | - </tr> | |
13 | - </thead> | |
14 | - <tbody> | |
15 | - <% @module_result.metric_results.each do |metric_result| %> | |
16 | - <% range = metric_result.range %> | |
17 | - <% if !range.nil? %> | |
18 | - <tr> | |
19 | - <td><a href="#" show-metric-history="<%= MezuroPlugin::Helpers::ContentViewerHelper.format_name(metric_result) %>" data-module-name="<%= @module.name %>"><%= metric_result.metric.name %></a></td> | |
20 | - <td><%= MezuroPlugin::Helpers::ContentViewerHelper.format_grade(metric_result.value) %></td> | |
21 | - <td><%= metric_result.weight %></td> | |
22 | - <td style="background-color: #<%= range.color[2..-1] %>"><%= range.label %></td> | |
23 | - </tr> | |
24 | - <tr class="<%= MezuroPlugin::Helpers::ContentViewerHelper.format_name(metric_result) %>" style="display: none;"> | |
25 | - <td colspan="3"> | |
26 | - <div id='historical-<%= MezuroPlugin::Helpers::ContentViewerHelper.format_name(metric_result) %>'> | |
27 | - </div> | |
28 | - </td> | |
29 | - <td align="right"> | |
30 | - <%= range.comments.nil? ? '' : range.comments %> | |
31 | - </td> | |
32 | - </tr> | |
33 | - <% end %> | |
34 | - <% end %> | |
35 | - </tbody> | |
36 | - <tfoot> | |
37 | - <tr> | |
38 | - <td colspan = "3"> | |
39 | - <div id='historical-grade' style="display: none;"></div> | |
40 | - </td> | |
41 | - <td align = "right"> | |
42 | - <a href="#" show-grade-history="<%= @module_result.module.name %>" data-module-name="<%= @module.name%>" > | |
43 | - <strong> | |
44 | - <%= _('Grade:') %> | |
45 | - <%= "%.02f" % @module_result.grade %> | |
46 | - </strong> | |
47 | - </a> | |
48 | - </td> | |
49 | - </tr> | |
50 | - </tfoot> | |
51 | -</table> | |
52 | -</div> |
plugins/mezuro/views/content_viewer/_project_error.rhtml
... | ... | @@ -1,12 +0,0 @@ |
1 | -<h3><%= _('ERROR') %></h3> | |
2 | -<p> | |
3 | - <%= "State when error ocurred: #{@project.state}" %> | |
4 | - <br/> | |
5 | - <% error = @project.kalibro_error %> | |
6 | - <%= error.message %> | |
7 | -<ul> | |
8 | - <% error.stack_trace.each do |trace| %> | |
9 | - <li><%= "#{trace.declaring_class}.#{trace.method_name}(#{trace.file_name}:#{trace.line_number})" %></li> | |
10 | - <% end %> | |
11 | -</ul> | |
12 | -</p> |
plugins/mezuro/views/content_viewer/_project_result.rhtml
... | ... | @@ -1,39 +0,0 @@ |
1 | -<% unless @content.errors[:base].nil? %> | |
2 | - <%= @content.errors[:base] %> | |
3 | -<% else %> | |
4 | - <p> Choose a date to see specific project results: </p> | |
5 | - <div id="datepicker" data-date="<%= @project_result.date %>"> | |
6 | - <input id="datepicker_field" style="display:none"/> | |
7 | - </div> | |
8 | - | |
9 | - <h4><%= _('Last Result') %></h4> | |
10 | - | |
11 | - <table> | |
12 | - <tr> | |
13 | - <td><%= _('Date') %></td> | |
14 | - <td><%= @project_result.date %></td> | |
15 | - </tr> | |
16 | - <tr> | |
17 | - <td><%= _('Load time') %></td> | |
18 | - <td><%= @project_result.formatted_load_time %></td> | |
19 | - </tr> | |
20 | - <tr> | |
21 | - <td><%= _('Analysis time') %></td> | |
22 | - <td><%= @project_result.formatted_analysis_time %></td> | |
23 | - </tr> | |
24 | - </table> | |
25 | - | |
26 | - | |
27 | - <script> | |
28 | - jQuery(document).ready(function($) { | |
29 | - $("#datepicker").datepicker({ altField: '#datepicker_field', showOn: 'button', dateFormat: "yy-mm-dd", | |
30 | - buttonImageOnly: true, buttonImage: '/images/calendar_date_select/calendar.png', | |
31 | - onSelect: function(dateText, inst) { | |
32 | - reloadProjectWithDate(dateText) } }); | |
33 | - var date = jQuery("#datepicker").attr('data-date').substr(0,10); | |
34 | - $("#datepicker").datepicker( "setDate" , date ); | |
35 | - | |
36 | - }); | |
37 | - </script> | |
38 | - | |
39 | -<% end %> |
plugins/mezuro/views/content_viewer/_score_history.rhtml
plugins/mezuro/views/content_viewer/_source_tree.rhtml
... | ... | @@ -1,45 +0,0 @@ |
1 | -<% unless @content.errors[:base].nil? %> | |
2 | - <%= @content.errors[:base] %> | |
3 | -<% else %> | |
4 | - <h4><%= _('Source tree') %></h4> | |
5 | - <% module_name = @source_tree.module.name %> | |
6 | - <% module_label = "#{module_name} (#{@source_tree.module.granularity})" %> | |
7 | - | |
8 | - <p><h2 class="path"> | |
9 | - <% if module_name != @project_name %> | |
10 | - <a href="#" class="source-tree-link" data-module-name="<%= @project_name %>"> | |
11 | - <%= @project_name %> | |
12 | - </a> | |
13 | - <% end %> | |
14 | - | |
15 | - | |
16 | - <% split_link = @source_tree.module.ancestor_names %> | |
17 | - <% split_link.each do |link| %> | |
18 | - /<a href="#" class="source-tree-link" data-module-name="<%= link %>"> | |
19 | - <%= link.split(".").last %> | |
20 | - </a> | |
21 | - <% end %> | |
22 | - </h2></p> | |
23 | - | |
24 | - <% if @source_tree.children %> | |
25 | - <table border="0" class="source-tree"> | |
26 | - <% @source_tree.children.each do |child| %> | |
27 | - <% if child.module.granularity=='PACKAGE' %> | |
28 | - <tr> | |
29 | - <td class="icon"><%= image_tag('/plugins/mezuro/images/folder.png')%></td> | |
30 | - <td class="source-tree-text"><a href='#' class="source-tree-link" data-module-name="<%= child.module.name %>"><%= child.module.name %></a></td> | |
31 | - </tr> | |
32 | - <% else %> | |
33 | - <tr> | |
34 | - <td class="icon"><%= image_tag('/plugins/mezuro/images/file.png') %></td> | |
35 | - <td class="source-tree-text"> | |
36 | - <a href='#' class="source-tree-link" data-module-name="<%= child.module.name %>"> | |
37 | - <%= child.module.name %> | |
38 | - </a> | |
39 | - </td> | |
40 | - </tr> | |
41 | - <% end %> | |
42 | - <% end %> | |
43 | - </table> | |
44 | - <% end %> | |
45 | -<% end %> |
plugins/mezuro/views/content_viewer/show_configuration.rhtml
... | ... | @@ -3,7 +3,7 @@ |
3 | 3 | <% unless @page.errors[:base].nil? %> |
4 | 4 | <% if @page.errors[:base] =~ /There is no configuration named/ %> |
5 | 5 | <h3>Warning:</h3> |
6 | - <p>This Configuration doesn't exist on the Web Service. Do you want to <a href="/myprofile/<%= @page.profile.name %>/cms/destroy/<%= @page.id%>">delete</a> or <a href="/myprofile/<%= @page.profile.name %>/cms/edit/<%= @page.id%>">save it again</a>?</p> | |
6 | + <p>This Configuration doesn't exist on the Web Service. Do you want to <%= link_to 'delete', :action => 'destroy', :controller => 'cms', :profile => @page.profile.identifier, :id => @page.id %> or <%= link_to 'save it again', :action => 'edit', :controller => 'cms', :profile => @page.profile.identifier, :id => @page.id %>?</p> | |
7 | 7 | <% else %> |
8 | 8 | <%= @page.errors[:base] %> |
9 | 9 | <% end %> |
... | ... | @@ -22,8 +22,10 @@ |
22 | 22 | |
23 | 23 | <br/> |
24 | 24 | |
25 | - <%= link_to "#{image_tag ('/plugins/mezuro/images/plus.png')}Add Metric", :controller => "mezuro_plugin_myprofile", | |
26 | - :action => "choose_base_tool", :params => { :id => @configuration_content.id } %><br/> | |
25 | + <%= link_to "#{image_tag ('/plugins/mezuro/images/plus.png')}Add Metric", :controller => "mezuro_plugin_base_tool", | |
26 | + :profile => @page.profile.identifier, | |
27 | + :action => "choose_base_tool", | |
28 | + :id => @configuration_content.id %><br/> | |
27 | 29 | |
28 | 30 | <table> |
29 | 31 | <tr class="titles"> |
... | ... | @@ -40,19 +42,22 @@ |
40 | 42 | <%= metric_configuration.metric.origin %> |
41 | 43 | </td> |
42 | 44 | <td><%= metric_configuration.code %></td> |
43 | - <td><%= link_to "Edit", :controller => "mezuro_plugin_myprofile", :action => "edit_metric_configuration", :params => | |
44 | - {:metric_name => metric_configuration.metric.name, :id => @configuration_content.id} %></td> | |
45 | + <td><%= link_to "Edit", :controller => "mezuro_plugin_metric_configuration", :action => "edit_metric_configuration", | |
46 | + :metric_name => metric_configuration.metric.name, :id => @configuration_content.id, | |
47 | + :profile => @page.profile.identifier %></td> | |
45 | 48 | <% else %> |
46 | 49 | <td> |
47 | 50 | Compound Metric |
48 | 51 | </td> |
49 | 52 | <td><%= metric_configuration.code %></td> |
50 | - <td><%= link_to "Edit", :controller => "mezuro_plugin_myprofile", :action => "edit_compound_metric_configuration", :params => | |
51 | - {:metric_name => metric_configuration.metric.name, :id => @configuration_content.id} %></td> | |
53 | + <td><%= link_to "Edit", :controller => "mezuro_plugin_metric_configuration", | |
54 | + :action => "edit_compound_metric_configuration", :metric_name => metric_configuration.metric.name, | |
55 | + :id => @configuration_content.id, :profile => @page.profile.identifier %></td> | |
52 | 56 | <% end %> |
53 | 57 | |
54 | - <td><%= link_to "Remove", :controller => "mezuro_plugin_myprofile", :action => "remove_metric_configuration", :params => | |
55 | - {:metric_name => metric_configuration.metric.name, :id => @configuration_content.id} %></td> | |
58 | + <td><%= link_to "Remove", :controller => "mezuro_plugin_metric_configuration", :action => "remove_metric_configuration", | |
59 | + :metric_name => metric_configuration.metric.name, :id => @configuration_content.id, | |
60 | + :profile => @page.profile.identifier %></td> | |
56 | 61 | </tr> |
57 | 62 | <% end %> |
58 | 63 | </table> | ... | ... |
plugins/mezuro/views/content_viewer/show_project.rhtml
... | ... | @@ -4,7 +4,7 @@ |
4 | 4 | <% unless @page.errors[:base].nil? %> |
5 | 5 | <% if @page.errors[:base] =~ /There is no project named/ %> |
6 | 6 | <h3>Warning:</h3> |
7 | - <p>This project doesn't exist on the Web Service. Do you want to <a href="/myprofile/<%= @page.profile.name %>/cms/destroy/<%= @page.id%>">delete</a> or <a href="/myprofile/<%= @page.profile.name %>/cms/edit/<%= @page.id%>">save it again</a>?</p> | |
7 | + <p>This project doesn't exist on the Web Service. Do you want to <%= link_to 'delete', :action => 'destroy', :controller => 'cms', :profile => @page.profile.identifier, :id => @page.id %> or <%= link_to 'save it again', :action => 'edit', :controller => 'cms', :profile => @page.profile.identifier, :id => @page.id %>?</p> | |
8 | 8 | <% else %> |
9 | 9 | <%= @page.errors[:base] %> |
10 | 10 | <% end %> | ... | ... |
plugins/mezuro/views/mezuro_plugin_base_tool/choose_base_tool.html.erb
0 → 100644
... | ... | @@ -0,0 +1,16 @@ |
1 | +<h2><%= @configuration_content.name%> Configuration</h2> | |
2 | + | |
3 | +<%= link_to "New Compound Metric", :controller => "mezuro_plugin_metric_configuration", :action => "new_compound_metric_configuration", | |
4 | + :id => @configuration_content.id %> | |
5 | + | |
6 | +<h5>Base Tools:</h5> | |
7 | +<table id="project_info"> | |
8 | + <% @base_tools.each do |base_tool| %> | |
9 | + <tr> | |
10 | + <td> | |
11 | + <%= link_to base_tool, :controller => "mezuro_plugin_base_tool", :action => "choose_metric", :base_tool => base_tool, | |
12 | + :id => @configuration_content.id %> | |
13 | + </td> | |
14 | + </tr> | |
15 | + <% end %> | |
16 | +</table> | ... | ... |
plugins/mezuro/views/mezuro_plugin_base_tool/choose_metric.html.erb
0 → 100644
... | ... | @@ -0,0 +1,18 @@ |
1 | +<h2><%= @configuration_content.name %> Configuration</h2> | |
2 | + | |
3 | +<table id="project_info"> | |
4 | + <tr> | |
5 | + <h5>Metric Collector: <%= @base_tool %></h5> | |
6 | + </tr> | |
7 | + <tr> | |
8 | + <h5>Choose a metric to add:</h5> | |
9 | + </tr> | |
10 | + <% @supported_metrics.each do |metric| %> | |
11 | + <tr class="metric" title="<%= metric.name %>"> | |
12 | + <td> | |
13 | + <%= link_to metric.name, :controller => "mezuro_plugin_metric_configuration", :action => "new_metric_configuration", | |
14 | + :metric_name => metric.name, :base_tool => @base_tool, :id => @configuration_content.id %> | |
15 | + </td> | |
16 | + </tr> | |
17 | + <% end %> | |
18 | +</table> | ... | ... |
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 => "mezuro_plugin_range/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 => "mezuro_plugin_range/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_module/_module_result.rhtml
0 → 100644
... | ... | @@ -0,0 +1,52 @@ |
1 | +<h5><%= _('Metric results for: ') + @module_label %> </h5> | |
2 | + | |
3 | +<hr/> | |
4 | +<div class="zoomable-image"> | |
5 | +<table> | |
6 | + <thead> | |
7 | + <tr> | |
8 | + <th>Metric</th> | |
9 | + <th>Value</th> | |
10 | + <th>Weight</th> | |
11 | + <th>Threshold</th> | |
12 | + </tr> | |
13 | + </thead> | |
14 | + <tbody> | |
15 | + <% @module_result.metric_results.each do |metric_result| %> | |
16 | + <% range = metric_result.range %> | |
17 | + <% if !range.nil? %> | |
18 | + <tr> | |
19 | + <td><a href="#" show-metric-history="<%= MezuroPlugin::Helpers::ContentViewerHelper.format_name(metric_result) %>" data-module-name="<%= @module.name %>"><%= metric_result.metric.name %></a></td> | |
20 | + <td><%= MezuroPlugin::Helpers::ContentViewerHelper.format_grade(metric_result.value) %></td> | |
21 | + <td><%= metric_result.weight %></td> | |
22 | + <td style="background-color: #<%= range.color[2..-1] %>"><%= range.label %></td> | |
23 | + </tr> | |
24 | + <tr class="<%= MezuroPlugin::Helpers::ContentViewerHelper.format_name(metric_result) %>" style="display: none;"> | |
25 | + <td colspan="3"> | |
26 | + <div id='historical-<%= MezuroPlugin::Helpers::ContentViewerHelper.format_name(metric_result) %>'> | |
27 | + </div> | |
28 | + </td> | |
29 | + <td align="right"> | |
30 | + <%= range.comments.nil? ? '' : range.comments %> | |
31 | + </td> | |
32 | + </tr> | |
33 | + <% end %> | |
34 | + <% end %> | |
35 | + </tbody> | |
36 | + <tfoot> | |
37 | + <tr> | |
38 | + <td colspan = "3"> | |
39 | + <div id='historical-grade' style="display: none;"></div> | |
40 | + </td> | |
41 | + <td align = "right"> | |
42 | + <a href="#" show-grade-history="<%= @module_result.module.name %>" data-module-name="<%= @module.name%>" > | |
43 | + <strong> | |
44 | + <%= _('Grade:') %> | |
45 | + <%= "%.02f" % @module_result.grade %> | |
46 | + </strong> | |
47 | + </a> | |
48 | + </td> | |
49 | + </tr> | |
50 | + </tfoot> | |
51 | +</table> | |
52 | +</div> | ... | ... |
plugins/mezuro/views/mezuro_plugin_module/_score_history.rhtml
0 → 100644
... | ... | @@ -0,0 +1 @@ |
1 | +<%= image_tag(MezuroPlugin::Helpers::ContentViewerHelper.generate_chart(@score_history)) %> | ... | ... |
plugins/mezuro/views/mezuro_plugin_myprofile/_edit_range.html.erb
... | ... | @@ -1,4 +0,0 @@ |
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, :id => id, :beginning_id => beginning_id, :range => range } %> | |
4 | -<% end %> |
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/_new_range.html.erb
plugins/mezuro/views/mezuro_plugin_myprofile/_range.html.erb
... | ... | @@ -1,17 +0,0 @@ |
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", :id => params[:id], :metric_name => params[:metric_name], :beginning_id => range.beginning} %></td> | |
16 | - <td><%= link_to "Remove", :action =>"remove_range", :controller => "mezuro_plugin_myprofile", :id => params[:id], :metric_name => params[:metric_name], :beginning_id => range.beginning %></td> | |
17 | -</tr> |
plugins/mezuro/views/mezuro_plugin_myprofile/_range_form.html.erb
... | ... | @@ -1,61 +0,0 @@ |
1 | -<%= hidden_field_tag :id, id %> | |
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, :value => @range.beginning %> | |
18 | - </td> | |
19 | - </tr> | |
20 | - <tr> | |
21 | - <td> | |
22 | - <%= f.label :end, "(*) End:" %> | |
23 | - </td> | |
24 | - <td> | |
25 | - <%= f.text_field :end, :value => @range.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, :id => "range_color", :value => @range.mezuro_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" %> | |
54 | - | |
55 | -<script>jQuery(document).ready(function($) { | |
56 | - $('#range_color').colorPicker({ | |
57 | - onColorChange : function(id, newValue) { | |
58 | - jQuery('#range_color').val(newValue); | |
59 | - } | |
60 | - }); | |
61 | -});</script> |
plugins/mezuro/views/mezuro_plugin_myprofile/choose_base_tool.html.erb
... | ... | @@ -1,16 +0,0 @@ |
1 | -<h2><%= @configuration_content.name%> Configuration</h2> | |
2 | - | |
3 | -<%= link_to "New Compound Metric", :controller => "mezuro_plugin_myprofile", :action => "new_compound_metric_configuration", :params => | |
4 | -{ :id => @configuration_content.id } %> | |
5 | - | |
6 | -<h5>Base Tools:</h5> | |
7 | -<table id="project_info"> | |
8 | - <% @base_tools.each do |base_tool| %> | |
9 | - <tr> | |
10 | - <td> | |
11 | - <%= link_to base_tool, :controller => "mezuro_plugin_myprofile", :action => "choose_metric", :params => | |
12 | - { :base_tool => base_tool, :id => @configuration_content.id} %> | |
13 | - </td> | |
14 | - </tr> | |
15 | - <% end %> | |
16 | -</table> |
plugins/mezuro/views/mezuro_plugin_myprofile/choose_metric.html.erb
... | ... | @@ -1,18 +0,0 @@ |
1 | -<h2><%= @configuration_content.name %> Configuration</h2> | |
2 | - | |
3 | -<table id="project_info"> | |
4 | - <tr> | |
5 | - <h5>Metric Collector: <%= @base_tool %></h5> | |
6 | - </tr> | |
7 | - <tr> | |
8 | - <h5>Choose a metric to add:</h5> | |
9 | - </tr> | |
10 | - <% @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 | - :base_tool => @base_tool, :id => @configuration_content.id } %> | |
15 | - </td> | |
16 | - </tr> | |
17 | - <% end %> | |
18 | -</table> |
plugins/mezuro/views/mezuro_plugin_myprofile/create_range.rjs
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_myprofile", :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,89 +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_myprofile", :id => @configuration_content.id, :metric_name => @metric.name} %> | |
87 | -<div id="range_form" style="display:none"></div> | |
88 | - | |
89 | - |
plugins/mezuro/views/mezuro_plugin_myprofile/edit_range.rjs
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 | - |
plugins/mezuro/views/mezuro_plugin_myprofile/new_range.rjs
plugins/mezuro/views/mezuro_plugin_myprofile/update_range.rjs
... | ... | @@ -1 +0,0 @@ |
1 | -page.reload() |
plugins/mezuro/views/mezuro_plugin_project/_project_error.rhtml
0 → 100644
... | ... | @@ -0,0 +1,12 @@ |
1 | +<h3><%= _('ERROR') %></h3> | |
2 | +<p> | |
3 | + <%= "State when error ocurred: #{@project.state}" %> | |
4 | + <br/> | |
5 | + <% error = @project.kalibro_error %> | |
6 | + <%= error.message %> | |
7 | +<ul> | |
8 | + <% error.stack_trace.each do |trace| %> | |
9 | + <li><%= "#{trace.declaring_class}.#{trace.method_name}(#{trace.file_name}:#{trace.line_number})" %></li> | |
10 | + <% end %> | |
11 | +</ul> | |
12 | +</p> | ... | ... |
plugins/mezuro/views/mezuro_plugin_project/_project_result.rhtml
0 → 100644
... | ... | @@ -0,0 +1,39 @@ |
1 | +<% unless @content.errors[:base].nil? %> | |
2 | + <%= @content.errors[:base] %> | |
3 | +<% else %> | |
4 | + <p> Choose a date to see specific project results: </p> | |
5 | + <div id="datepicker" data-date="<%= @project_result.date %>"> | |
6 | + <input id="datepicker_field" style="display:none"/> | |
7 | + </div> | |
8 | + | |
9 | + <h4><%= _('Last Result') %></h4> | |
10 | + | |
11 | + <table> | |
12 | + <tr> | |
13 | + <td><%= _('Date') %></td> | |
14 | + <td><%= @project_result.date %></td> | |
15 | + </tr> | |
16 | + <tr> | |
17 | + <td><%= _('Load time') %></td> | |
18 | + <td><%= @project_result.formatted_load_time %></td> | |
19 | + </tr> | |
20 | + <tr> | |
21 | + <td><%= _('Analysis time') %></td> | |
22 | + <td><%= @project_result.formatted_analysis_time %></td> | |
23 | + </tr> | |
24 | + </table> | |
25 | + | |
26 | + | |
27 | + <script> | |
28 | + jQuery(document).ready(function($) { | |
29 | + $("#datepicker").datepicker({ altField: '#datepicker_field', showOn: 'button', dateFormat: "yy-mm-dd", | |
30 | + buttonImageOnly: true, buttonImage: '/images/calendar_date_select/calendar.png', | |
31 | + onSelect: function(dateText, inst) { | |
32 | + reloadProjectWithDate(dateText) } }); | |
33 | + var date = jQuery("#datepicker").attr('data-date').substr(0,10); | |
34 | + $("#datepicker").datepicker( "setDate" , date ); | |
35 | + | |
36 | + }); | |
37 | + </script> | |
38 | + | |
39 | +<% end %> | ... | ... |
plugins/mezuro/views/mezuro_plugin_project/_source_tree.rhtml
0 → 100644
... | ... | @@ -0,0 +1,45 @@ |
1 | +<% unless @content.errors[:base].nil? %> | |
2 | + <%= @content.errors[:base] %> | |
3 | +<% else %> | |
4 | + <h4><%= _('Source tree') %></h4> | |
5 | + <% module_name = @source_tree.module.name %> | |
6 | + <% module_label = "#{module_name} (#{@source_tree.module.granularity})" %> | |
7 | + | |
8 | + <p><h2 class="path"> | |
9 | + <% if module_name != @project_name %> | |
10 | + <a href="#" class="source-tree-link" data-module-name="<%= @project_name %>"> | |
11 | + <%= @project_name %> | |
12 | + </a> | |
13 | + <% end %> | |
14 | + | |
15 | + | |
16 | + <% split_link = @source_tree.module.ancestor_names %> | |
17 | + <% split_link.each do |link| %> | |
18 | + /<a href="#" class="source-tree-link" data-module-name="<%= link %>"> | |
19 | + <%= link.split(".").last %> | |
20 | + </a> | |
21 | + <% end %> | |
22 | + </h2></p> | |
23 | + | |
24 | + <% if @source_tree.children %> | |
25 | + <table border="0" class="source-tree"> | |
26 | + <% @source_tree.children.each do |child| %> | |
27 | + <% if child.module.granularity=='PACKAGE' %> | |
28 | + <tr> | |
29 | + <td class="icon"><%= image_tag('/plugins/mezuro/images/folder.png')%></td> | |
30 | + <td class="source-tree-text"><a href='#' class="source-tree-link" data-module-name="<%= child.module.name %>"><%= child.module.name %></a></td> | |
31 | + </tr> | |
32 | + <% else %> | |
33 | + <tr> | |
34 | + <td class="icon"><%= image_tag('/plugins/mezuro/images/file.png') %></td> | |
35 | + <td class="source-tree-text"> | |
36 | + <a href='#' class="source-tree-link" data-module-name="<%= child.module.name %>"> | |
37 | + <%= child.module.name %> | |
38 | + </a> | |
39 | + </td> | |
40 | + </tr> | |
41 | + <% end %> | |
42 | + <% end %> | |
43 | + </table> | |
44 | + <% end %> | |
45 | +<% end %> | ... | ... |
plugins/mezuro/views/mezuro_plugin_range/_edit_range.html.erb
0 → 100644
... | ... | @@ -0,0 +1,4 @@ |
1 | +<% remote_form_for :range, :url => {:action =>"update_range", :controller => "mezuro_plugin_range"}, :method => :get do |f| %> | |
2 | + <%= hidden_field_tag :beginning_id, beginning_id %> | |
3 | + <%= render :partial => "range_form", :locals => {:f => f, :metric_name => metric_name, :id => id, :beginning_id => beginning_id, :range => range } %> | |
4 | +<% end %> | ... | ... |
plugins/mezuro/views/mezuro_plugin_range/_new_range.html.erb
0 → 100644
plugins/mezuro/views/mezuro_plugin_range/_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_range", :id => params[:id], :metric_name => params[:metric_name], :beginning_id => range.beginning} %></td> | |
16 | + <td><%= link_to "Remove", :action =>"remove_range", :controller => "mezuro_plugin_range", :id => params[:id], :metric_name => params[:metric_name], :beginning_id => range.beginning %></td> | |
17 | +</tr> | ... | ... |
plugins/mezuro/views/mezuro_plugin_range/_range_form.html.erb
0 → 100644
... | ... | @@ -0,0 +1,61 @@ |
1 | +<%= hidden_field_tag :id, id %> | |
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, :value => @range.beginning %> | |
18 | + </td> | |
19 | + </tr> | |
20 | + <tr> | |
21 | + <td> | |
22 | + <%= f.label :end, "(*) End:" %> | |
23 | + </td> | |
24 | + <td> | |
25 | + <%= f.text_field :end, :value => @range.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, :id => "range_color", :value => @range.mezuro_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" %> | |
54 | + | |
55 | +<script>jQuery(document).ready(function($) { | |
56 | + $('#range_color').colorPicker({ | |
57 | + onColorChange : function(id, newValue) { | |
58 | + jQuery('#range_color').val(newValue); | |
59 | + } | |
60 | + }); | |
61 | +});</script> | ... | ... |
plugins/mezuro/views/mezuro_plugin_range/create_range.rjs
0 → 100644
plugins/mezuro/views/mezuro_plugin_range/update_range.rjs
0 → 100644
... | ... | @@ -0,0 +1 @@ |
1 | +page.reload() | ... | ... |
test/test_helper.rb
1 | 1 | ENV["RAILS_ENV"] = "test" |
2 | 2 | |
3 | 3 | # Start/stop Solr |
4 | -if not $test_helper_loaded | |
5 | - abort unless system 'rake -s solr:start' | |
6 | - at_exit { system 'rake -s solr:stop' } | |
7 | - $test_helper_loaded = true | |
8 | -end | |
4 | +#if not $test_helper_loaded | |
5 | +# abort unless system 'rake -s solr:start' | |
6 | +# at_exit { system 'rake -s solr:stop' } | |
7 | +# $test_helper_loaded = true | |
8 | +#end | |
9 | 9 | |
10 | 10 | require File.expand_path(File.dirname(__FILE__) + "/../config/environment") |
11 | 11 | require 'test_help' | ... | ... |