Commit fa1b55b8d65da975b9546e75dbfe543617deec1d
Exists in
master
and in
29 other branches
Merge branch 'mezuro-dev' into mezuro
Conflicts: plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb plugins/mezuro/views/mezuro_plugin_myprofile/_range_form.html.erb
Showing
10 changed files
with
110 additions
and
94 deletions
Show diff stats
plugins/mezuro/controllers/mezuro_plugin_myprofile_controller.rb
@@ -60,7 +60,7 @@ class MezuroPluginMyprofileController < ProfileController | @@ -60,7 +60,7 @@ class MezuroPluginMyprofileController < ProfileController | ||
60 | redirect_to "/myprofile/#{profile.identifier}/plugin/mezuro/edit_metric_configuration?id=#{id}&metric_name=#{metric_name.gsub(/\s/, '+')}" | 60 | redirect_to "/myprofile/#{profile.identifier}/plugin/mezuro/edit_metric_configuration?id=#{id}&metric_name=#{metric_name.gsub(/\s/, '+')}" |
61 | end | 61 | end |
62 | end | 62 | end |
63 | - | 63 | + |
64 | def create_compound_metric_configuration | 64 | def create_compound_metric_configuration |
65 | id = params[:id] | 65 | id = params[:id] |
66 | metric_name = params[:metric_configuration][:metric][:name] | 66 | metric_name = params[:metric_configuration][:metric][:name] |
@@ -108,14 +108,14 @@ class MezuroPluginMyprofileController < ProfileController | @@ -108,14 +108,14 @@ class MezuroPluginMyprofileController < ProfileController | ||
108 | redirect_to "/#{profile.identifier}/#{configuration_content.slug}" | 108 | redirect_to "/#{profile.identifier}/#{configuration_content.slug}" |
109 | end | 109 | end |
110 | end | 110 | end |
111 | - | 111 | + |
112 | def new_range | 112 | def new_range |
113 | @configuration_content = profile.articles.find(params[:id]) | 113 | @configuration_content = profile.articles.find(params[:id]) |
114 | @metric_name = params[:metric_name] | 114 | @metric_name = params[:metric_name] |
115 | @range = Kalibro::Range.new | 115 | @range = Kalibro::Range.new |
116 | @range_color = "#000000" | 116 | @range_color = "#000000" |
117 | end | 117 | end |
118 | - | 118 | + |
119 | def edit_range | 119 | def edit_range |
120 | @configuration_content = profile.articles.find(params[:id]) | 120 | @configuration_content = profile.articles.find(params[:id]) |
121 | @metric_name = params[:metric_name] | 121 | @metric_name = params[:metric_name] |
@@ -129,14 +129,14 @@ class MezuroPluginMyprofileController < ProfileController | @@ -129,14 +129,14 @@ class MezuroPluginMyprofileController < ProfileController | ||
129 | @configuration_content = profile.articles.find(params[:id]) | 129 | @configuration_content = profile.articles.find(params[:id]) |
130 | @range = Kalibro::Range.new params[:range] | 130 | @range = Kalibro::Range.new params[:range] |
131 | metric_name = params[:metric_name] | 131 | metric_name = params[:metric_name] |
132 | - metric_configuration = Kalibro::MetricConfiguration.find_by_configuration_name_and_metric_name(@configuration_content.name, 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) | 133 | metric_configuration.add_range(@range) |
134 | metric_configuration.save | 134 | metric_configuration.save |
135 | if metric_configuration_has_errors? metric_configuration | 135 | if metric_configuration_has_errors? metric_configuration |
136 | redirect_to_error_page metric_configuration.errors[0].message | 136 | redirect_to_error_page metric_configuration.errors[0].message |
137 | end | 137 | end |
138 | end | 138 | end |
139 | - | 139 | + |
140 | def update_range | 140 | def update_range |
141 | configuration_content = profile.articles.find(params[:id]) | 141 | configuration_content = profile.articles.find(params[:id]) |
142 | metric_name = params[:metric_name] | 142 | metric_name = params[:metric_name] |
@@ -149,7 +149,7 @@ class MezuroPluginMyprofileController < ProfileController | @@ -149,7 +149,7 @@ class MezuroPluginMyprofileController < ProfileController | ||
149 | redirect_to_error_page metric_configuration.errors[0].message | 149 | redirect_to_error_page metric_configuration.errors[0].message |
150 | end | 150 | end |
151 | end | 151 | end |
152 | - | 152 | + |
153 | def remove_range | 153 | def remove_range |
154 | configuration_content = profile.articles.find(params[:id]) | 154 | configuration_content = profile.articles.find(params[:id]) |
155 | metric_name = params[:metric_name] | 155 | metric_name = params[:metric_name] |
plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb
@@ -36,7 +36,7 @@ class MezuroPluginProfileController < ProfileController | @@ -36,7 +36,7 @@ class MezuroPluginProfileController < ProfileController | ||
36 | else | 36 | else |
37 | render :partial => 'content_viewer/project_result' | 37 | render :partial => 'content_viewer/project_result' |
38 | end | 38 | end |
39 | - end | 39 | + end |
40 | 40 | ||
41 | def module_result | 41 | def module_result |
42 | @content = profile.articles.find(params[:id]) | 42 | @content = profile.articles.find(params[:id]) |
@@ -81,24 +81,26 @@ class MezuroPluginProfileController < ProfileController | @@ -81,24 +81,26 @@ class MezuroPluginProfileController < ProfileController | ||
81 | if project_content_has_errors? | 81 | if project_content_has_errors? |
82 | redirect_to_error_page(@content.errors[:base]) | 82 | redirect_to_error_page(@content.errors[:base]) |
83 | else | 83 | else |
84 | - @score_history = modules_results.collect { |module_result| module_result.grade } | 84 | + @score_history = modules_results.map do |module_result| |
85 | + [module_result.grade, format_date_to_simple_form(module_result.date)] | ||
86 | + end | ||
85 | render :partial => 'content_viewer/score_history' | 87 | render :partial => 'content_viewer/score_history' |
86 | end | 88 | end |
87 | end | 89 | end |
88 | - | 90 | + |
89 | private | 91 | private |
90 | - | 92 | + |
91 | def filtering_metric_history(metric_name, module_history) | 93 | def filtering_metric_history(metric_name, module_history) |
92 | metrics_history = module_history.map do |module_result| | 94 | metrics_history = module_history.map do |module_result| |
93 | - module_result.metric_results | 95 | + [module_result.metric_results, format_date_to_simple_form(module_result.date)] |
94 | end | 96 | end |
95 | - metric_history = metrics_history.map do |array_of_metric_result| | ||
96 | - (array_of_metric_result.select do |metric_result| | 97 | + metric_history = metrics_history.map do |metric_results_with_date| |
98 | + [(metric_results_with_date.first.select do |metric_result| | ||
97 | metric_result.metric.name.delete("() ") == metric_name | 99 | metric_result.metric.name.delete("() ") == metric_name |
98 | - end).first | 100 | + end).first, metric_results_with_date.last] |
99 | end | 101 | end |
100 | - metric_history.map do |metric_result| | ||
101 | - metric_result.value | 102 | + metric_history.map do |metric_result_with_date| |
103 | + [metric_result_with_date.first.value, metric_result_with_date.last] | ||
102 | end | 104 | end |
103 | end | 105 | end |
104 | 106 | ||
@@ -110,5 +112,9 @@ class MezuroPluginProfileController < ProfileController | @@ -110,5 +112,9 @@ class MezuroPluginProfileController < ProfileController | ||
110 | def project_content_has_errors? | 112 | def project_content_has_errors? |
111 | not @content.errors[:base].nil? | 113 | not @content.errors[:base].nil? |
112 | end | 114 | end |
113 | -end | ||
114 | 115 | ||
116 | + def format_date_to_simple_form date | ||
117 | + date.to_s[0..9] | ||
118 | + end | ||
119 | + | ||
120 | +end |
plugins/mezuro/lib/kalibro/range.rb
@@ -34,4 +34,12 @@ class Kalibro::Range < Kalibro::Model | @@ -34,4 +34,12 @@ class Kalibro::Range < Kalibro::Model | ||
34 | @grade = value.to_f | 34 | @grade = value.to_f |
35 | end | 35 | end |
36 | 36 | ||
37 | + def mezuro_color | ||
38 | + @color.nil? ? "#e4ca2d" : @color.gsub(/^ff/, "#") | ||
39 | + end | ||
40 | + | ||
41 | + def color=(new_color) | ||
42 | + @color = new_color.gsub(/^#/, "ff") | ||
43 | + end | ||
44 | + | ||
37 | end | 45 | end |
plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb
1 | require 'googlecharts' | 1 | require 'googlecharts' |
2 | 2 | ||
3 | class MezuroPlugin::Helpers::ContentViewerHelper | 3 | class MezuroPlugin::Helpers::ContentViewerHelper |
4 | + | ||
5 | + MAX_NUMBER_OF_LABELS = 5 | ||
6 | + | ||
4 | def self.format_grade(grade) | 7 | def self.format_grade(grade) |
5 | sprintf("%.2f", grade.to_f) | 8 | sprintf("%.2f", grade.to_f) |
6 | end | 9 | end |
@@ -8,7 +11,7 @@ class MezuroPlugin::Helpers::ContentViewerHelper | @@ -8,7 +11,7 @@ class MezuroPlugin::Helpers::ContentViewerHelper | ||
8 | def self.create_periodicity_options | 11 | def self.create_periodicity_options |
9 | [["Not Periodically", 0], ["1 day", 1], ["2 days", 2], ["Weekly", 7], ["Biweeky", 15], ["Monthly", 30]] | 12 | [["Not Periodically", 0], ["1 day", 1], ["2 days", 2], ["Weekly", 7], ["Biweeky", 15], ["Monthly", 30]] |
10 | end | 13 | end |
11 | - | 14 | + |
12 | def self.create_license_options | 15 | def self.create_license_options |
13 | options = YAML.load_file("#{RAILS_ROOT}/plugins/mezuro/licenses.yaml") | 16 | options = YAML.load_file("#{RAILS_ROOT}/plugins/mezuro/licenses.yaml") |
14 | options = options.split(";") | 17 | options = options.split(";") |
@@ -16,15 +19,23 @@ class MezuroPlugin::Helpers::ContentViewerHelper | @@ -16,15 +19,23 @@ class MezuroPlugin::Helpers::ContentViewerHelper | ||
16 | options.each { |option| formated_options << [option, option] } | 19 | options.each { |option| formated_options << [option, option] } |
17 | formated_options | 20 | formated_options |
18 | end | 21 | end |
19 | - | ||
20 | - def self.generate_chart(values) | ||
21 | - Gchart.line( | 22 | + |
23 | + def self.generate_chart(score_history) | ||
24 | + values = [] | ||
25 | + labels = [] | ||
26 | + score_history.each do |score_data| | ||
27 | + values << score_data.first | ||
28 | + labels << score_data.last | ||
29 | + end | ||
30 | + labels = discretize_array labels | ||
31 | + Gchart.line( | ||
22 | :title_color => 'FF0000', | 32 | :title_color => 'FF0000', |
23 | :size => '600x180', | 33 | :size => '600x180', |
24 | :bg => {:color => 'efefef', :type => 'stripes'}, | 34 | :bg => {:color => 'efefef', :type => 'stripes'}, |
25 | :line_colors => 'c4a000', | 35 | :line_colors => 'c4a000', |
26 | :data => values, | 36 | :data => values, |
27 | - :axis_with_labels => 'y', | 37 | + :labels => labels, |
38 | + :axis_with_labels => ['y','x'], | ||
28 | :max_value => values.max, | 39 | :max_value => values.max, |
29 | :min_value => values.min | 40 | :min_value => values.min |
30 | ) | 41 | ) |
@@ -35,14 +46,33 @@ class MezuroPlugin::Helpers::ContentViewerHelper | @@ -35,14 +46,33 @@ class MezuroPlugin::Helpers::ContentViewerHelper | ||
35 | selected_option = options.find { |option| option.last == index.to_i } | 46 | selected_option = options.find { |option| option.last == index.to_i } |
36 | selected_option.first | 47 | selected_option.first |
37 | end | 48 | end |
38 | - | 49 | + |
39 | def self.format_name(metric_result) | 50 | def self.format_name(metric_result) |
40 | metric_result.metric.name.delete("() ") | 51 | metric_result.metric.name.delete("() ") |
41 | end | 52 | end |
42 | - | 53 | + |
43 | def self.get_license_option(selected) | 54 | def self.get_license_option(selected) |
44 | options = YAML.load_file("#{RAILS_ROOT}/plugins/mezuro/licenses.yaml") | 55 | options = YAML.load_file("#{RAILS_ROOT}/plugins/mezuro/licenses.yaml") |
45 | options.split(";") | 56 | options.split(";") |
46 | selected_option = options.find { |license| license == selected } | 57 | selected_option = options.find { |license| license == selected } |
47 | end | 58 | end |
59 | + | ||
60 | + private | ||
61 | + | ||
62 | + def self.discretize_array(array) | ||
63 | + if array.size > MAX_NUMBER_OF_LABELS | ||
64 | + range_array.map { |i| discrete_element(array, i)} | ||
65 | + else | ||
66 | + array | ||
67 | + end | ||
68 | + end | ||
69 | + | ||
70 | + def self.range_array | ||
71 | + (0..(MAX_NUMBER_OF_LABELS - 1)).to_a | ||
72 | + end | ||
73 | + | ||
74 | + def self.discrete_element(array, i) | ||
75 | + array[(i*(array.size - 1))/(MAX_NUMBER_OF_LABELS - 1)] | ||
76 | + end | ||
77 | + | ||
48 | end | 78 | end |
plugins/mezuro/public/javascripts/project_content.js
@@ -51,23 +51,8 @@ function reloadModule(){ | @@ -51,23 +51,8 @@ function reloadModule(){ | ||
51 | return false; | 51 | return false; |
52 | } | 52 | } |
53 | 53 | ||
54 | -function reloadProjectWithDate(){ | ||
55 | - var day = jQuery("#project_date_day").val(); | ||
56 | - var month = jQuery("#project_date_month").val(); | ||
57 | - var year = jQuery("#project_date_year").val(); | ||
58 | - | ||
59 | - if(day.length == 1) | ||
60 | - day = "0" + day; | ||
61 | - if(month.length == 1) | ||
62 | - month = "0" + month; | ||
63 | - | ||
64 | - var date = new Date(year + "-" + month + "-" + day + "T00:00:00+00:00"); | ||
65 | - | ||
66 | - if(isNaN(date)){ | ||
67 | - alert("Invalid date! " + date); | ||
68 | - return false; | ||
69 | - } | ||
70 | - reloadProject(date); | 54 | +function reloadProjectWithDate(date){ |
55 | + reloadProject(date + "T00:00:00+00:00"); | ||
71 | return false; | 56 | return false; |
72 | } | 57 | } |
73 | 58 |
plugins/mezuro/public/javascripts/validations.js
@@ -39,14 +39,6 @@ function IsNotInfinite(value){ | @@ -39,14 +39,6 @@ function IsNotInfinite(value){ | ||
39 | return true; | 39 | return true; |
40 | } | 40 | } |
41 | 41 | ||
42 | -function IsNotHexadecimal(value){ | ||
43 | - if(value.match(/^[0-9a-fA-F]{1,8}$/)) | ||
44 | - { | ||
45 | - return false; | ||
46 | - } | ||
47 | - return true; | ||
48 | -} | ||
49 | - | ||
50 | function validate_new_range_configuration(event){ | 42 | function validate_new_range_configuration(event){ |
51 | var label = jQuery("#range_label").val(); | 43 | var label = jQuery("#range_label").val(); |
52 | var beginning = jQuery("#range_beginning").val(); | 44 | var beginning = jQuery("#range_beginning").val(); |
@@ -56,24 +48,20 @@ function validate_new_range_configuration(event){ | @@ -56,24 +48,20 @@ function validate_new_range_configuration(event){ | ||
56 | 48 | ||
57 | if (is_null(label) || is_null(beginning) || is_null(end) || is_null(color) || is_null(grade)) | 49 | if (is_null(label) || is_null(beginning) || is_null(end) || is_null(color) || is_null(grade)) |
58 | { | 50 | { |
59 | - alert("Please fill all fields marked with (*)"); | 51 | + alert("Please fill all fields marked with (*)."); |
60 | return false; | 52 | return false; |
61 | } | 53 | } |
62 | if ( (IsNotNumeric(beginning) && IsNotInfinite(beginning)) || (IsNotNumeric(end) && IsNotInfinite(end)) || IsNotNumeric(grade)) | 54 | if ( (IsNotNumeric(beginning) && IsNotInfinite(beginning)) || (IsNotNumeric(end) && IsNotInfinite(end)) || IsNotNumeric(grade)) |
63 | { | 55 | { |
64 | - alert("Beginning, End and Grade must be numeric values"); | 56 | + alert("Beginning, End and Grade must be numeric values."); |
65 | return false; | 57 | return false; |
66 | } | 58 | } |
67 | if (parseInt(beginning) > parseInt(end)) | 59 | if (parseInt(beginning) > parseInt(end)) |
68 | { | 60 | { |
69 | if(IsNotInfinite(beginning) && IsNotInfinite(end)){ | 61 | if(IsNotInfinite(beginning) && IsNotInfinite(end)){ |
70 | - alert("End must be greater than Beginning"); | 62 | + alert("End must be greater than Beginning."); |
71 | return false; | 63 | return false; |
72 | } | 64 | } |
73 | } | 65 | } |
74 | - if (IsNotHexadecimal(color)){ | ||
75 | - alert("Color must be an hexadecimal value"); | ||
76 | - return false; | ||
77 | - } | ||
78 | return true; | 66 | return true; |
79 | } | 67 | } |
plugins/mezuro/test/functional/mezuro_plugin_profile_controller_test.rb
@@ -126,7 +126,7 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase | @@ -126,7 +126,7 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase | ||
126 | get :module_metrics_history, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name, | 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("() ") | 127 | :metric_name => @module_result.metric_result.first.metric.name.delete("() ") |
128 | assert_equal @content, assigns(:content) | 128 | assert_equal @content, assigns(:content) |
129 | - assert_equal [@module_result.metric_result[0].value], assigns(:score_history) | 129 | + assert_equal [[@module_result.metric_result[0].value, @module_result.date.to_s[0..9]]], assigns(:score_history) |
130 | assert_response 200 | 130 | assert_response 200 |
131 | end | 131 | end |
132 | 132 | ||
@@ -134,7 +134,7 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase | @@ -134,7 +134,7 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase | ||
134 | Kalibro::ModuleResult.expects(:request).with("ModuleResult", :get_result_history, {:project_name => @project.name, :module_name => @project.name}).returns({:module_result => @module_result}) | 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 | 135 | get :module_grade_history, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name |
136 | assert_equal @content, assigns(:content) | 136 | assert_equal @content, assigns(:content) |
137 | - assert_equal [@module_result.grade], assigns(:score_history) | 137 | + assert_equal [[@module_result.grade, @module_result.date.to_s[0..9]]], assigns(:score_history) |
138 | assert_response 200 | 138 | assert_response 200 |
139 | end | 139 | end |
140 | 140 |
plugins/mezuro/test/unit/kalibro/range_test.rb
@@ -17,4 +17,16 @@ class RangeTest < ActiveSupport::TestCase | @@ -17,4 +17,16 @@ class RangeTest < ActiveSupport::TestCase | ||
17 | assert_equal @hash, @range.to_hash | 17 | assert_equal @hash, @range.to_hash |
18 | end | 18 | end |
19 | 19 | ||
20 | + should 'create a default color for new range' do | ||
21 | + assert_equal "#e4ca2d", Kalibro::Range.new.mezuro_color | ||
22 | + end | ||
23 | + | ||
24 | + should "convert color from 'ff' to '#'" do | ||
25 | + assert_equal "#ff0000", @range.mezuro_color | ||
26 | + end | ||
27 | + | ||
28 | + should "convert color from '#' to 'ff' when creating a new range" do | ||
29 | + assert_equal "ffff0000", Kalibro::Range.new({:color => '#ff0000'}).color | ||
30 | + end | ||
31 | + | ||
20 | end | 32 | end |
plugins/mezuro/views/content_viewer/_project_result.rhtml
1 | <% unless @content.errors[:base].nil? %> | 1 | <% unless @content.errors[:base].nil? %> |
2 | <%= @content.errors[:base] %> | 2 | <%= @content.errors[:base] %> |
3 | <% else %> | 3 | <% else %> |
4 | - <% form_for :project_date, :html=>{:id=>"project_history_date"} do |f| %> | ||
5 | - <%= f.label :day, "Choose project date:" %> | ||
6 | - | ||
7 | - <table> | ||
8 | - <tr> | ||
9 | - <td> | ||
10 | - Day | ||
11 | - </td> | ||
12 | - <td> | ||
13 | - Month | ||
14 | - </td> | ||
15 | - <td> | ||
16 | - Year | ||
17 | - </td> | ||
18 | - </tr> | ||
19 | - <tr> | ||
20 | - <td> | ||
21 | - <%= f.text_field :day, :size => 1, :maxlength => 2, :placeholder =>"dd" %> | ||
22 | - </td> | ||
23 | - <td> | ||
24 | - <%= f.text_field :month, :size => 1, :maxlength => 2, :placeholder =>"mm" %> | ||
25 | - </td> | ||
26 | - <td> | ||
27 | - <%= f.text_field :year, :size => 1, :maxlength => 4, :placeholder =>"yyyy" %> | ||
28 | - </td> | ||
29 | - </tr> | ||
30 | - </table> | ||
31 | - <%= f.submit "Refresh" %> | ||
32 | - <% end %> | ||
33 | - | 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> | ||
34 | 8 | ||
35 | <h4><%= _('Last Result') %></h4> | 9 | <h4><%= _('Last Result') %></h4> |
36 | 10 | ||
@@ -48,4 +22,18 @@ | @@ -48,4 +22,18 @@ | ||
48 | <td><%= @project_result.formatted_analysis_time %></td> | 22 | <td><%= @project_result.formatted_analysis_time %></td> |
49 | </tr> | 23 | </tr> |
50 | </table> | 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 | + | ||
51 | <% end %> | 39 | <% end %> |
plugins/mezuro/views/mezuro_plugin_myprofile/_range_form.html.erb
@@ -38,7 +38,7 @@ | @@ -38,7 +38,7 @@ | ||
38 | <%= f.label :color, "(*) Color:" %> | 38 | <%= f.label :color, "(*) Color:" %> |
39 | </td> | 39 | </td> |
40 | <td> | 40 | <td> |
41 | - <%= f.text_field(:color, :id => "range_color", :value => @range_color) %> | 41 | + <%= f.text_field(:color, :id => "range_color", :value => @range.mezuro_color) %> |
42 | </td> | 42 | </td> |
43 | </tr> | 43 | </tr> |
44 | <tr> | 44 | <tr> |
@@ -53,10 +53,9 @@ | @@ -53,10 +53,9 @@ | ||
53 | <%= f.submit "Save Range" %> | 53 | <%= f.submit "Save Range" %> |
54 | 54 | ||
55 | <script>jQuery(document).ready(function($) { | 55 | <script>jQuery(document).ready(function($) { |
56 | - $('#range_color').colorPicker({ | ||
57 | - onColorChange : function(id, newValue) { | ||
58 | - newValue = newValue.replace(/#/gi, "ff"); | ||
59 | - jQuery('#range_color').val(newValue); | ||
60 | - } | 56 | + $('#range_color').colorPicker({ |
57 | + onColorChange : function(id, newValue) { | ||
58 | + jQuery('#range_color').val(newValue); | ||
59 | + } | ||
61 | }); | 60 | }); |
62 | });</script> | 61 | });</script> |