Commit dbfafb3deaf501632ae92886ec3e0b2253e64af0
Committed by
Paulo Meireles
1 parent
cc5e18e1
Exists in
master
and in
29 other branches
[Mezuro] Using Noosfero's colorpicker script.
Showing
6 changed files
with
10 additions
and
26 deletions
Show diff stats
plugins/mezuro/lib/kalibro/range.rb
... | ... | @@ -35,11 +35,7 @@ class Kalibro::Range < Kalibro::Model |
35 | 35 | end |
36 | 36 | |
37 | 37 | def mezuro_color |
38 | - @color.nil? ? "#e4ca2d" : @color.gsub(/^ff/, "#") | |
38 | + @color.nil? ? "e4ca2d" : @color.gsub(/^ff/, "") | |
39 | 39 | end |
40 | - | |
41 | - def color=(new_color) | |
42 | - @color = new_color.gsub(/^#/, "ff") | |
43 | - end | |
44 | - | |
40 | + | |
45 | 41 | end | ... | ... |
plugins/mezuro/test/unit/kalibro/range_test.rb
... | ... | @@ -18,15 +18,11 @@ class RangeTest < ActiveSupport::TestCase |
18 | 18 | end |
19 | 19 | |
20 | 20 | should 'create a default color for new range' do |
21 | - assert_equal "#e4ca2d", Kalibro::Range.new.mezuro_color | |
21 | + assert_equal "e4ca2d", Kalibro::Range.new.mezuro_color | |
22 | 22 | end |
23 | 23 | |
24 | 24 | should "convert color from 'ff' to '#'" do |
25 | - assert_equal "#ff0000", @range.mezuro_color | |
25 | + assert_equal "ff0000", @range.mezuro_color | |
26 | 26 | end |
27 | 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 | - | |
32 | 28 | end | ... | ... |
plugins/mezuro/views/mezuro_plugin_metric_configuration/edit_compound_metric_configuration.html.erb
1 | 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> | |
2 | +<script src="/javascripts/colorpicker.js" type="text/javascript"></script> | |
3 | +<script src="/javascripts/colorpicker-noosfero.js" type="text/javascript"></script> | |
4 | 4 | |
5 | 5 | <h2><%= @configuration_content.name %> Configuration</h2> |
6 | 6 | ... | ... |
plugins/mezuro/views/mezuro_plugin_metric_configuration/edit_metric_configuration.html.erb
1 | 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> | |
2 | +<script src="/javascripts/colorpicker.js" type="text/javascript"></script> | |
3 | +<script src="/javascripts/colorpicker-noosfero.js" type="text/javascript"></script> | |
4 | 4 | |
5 | 5 | <h2><%= @configuration_content.name %> Configuration</h2> |
6 | 6 | ... | ... |
plugins/mezuro/views/mezuro_plugin_range/_range.html.erb
... | ... | @@ -11,7 +11,7 @@ |
11 | 11 | <td> |
12 | 12 | <%=range.grade%> |
13 | 13 | </td> |
14 | - <td bgcolor="#<%= range.color[2..-1] %>"></td> | |
14 | + <td bgcolor="#<%= range.color %>"></td> | |
15 | 15 | <% if (not user.nil?) && user.id == @profile.id %> |
16 | 16 | <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} %> |
17 | 17 | </td> | ... | ... |
plugins/mezuro/views/mezuro_plugin_range/_range_form.html.erb
... | ... | @@ -39,7 +39,7 @@ |
39 | 39 | <%= f.label :color, "(*) Color:" %> |
40 | 40 | </td> |
41 | 41 | <td> |
42 | - <%= f.text_field(:color, :id => "range_color", :value => @range.mezuro_color) %> | |
42 | + <%= colorpicker_field(:range, :color, :value => @range.mezuro_color) %>Click in the field to change Color | |
43 | 43 | </td> |
44 | 44 | </tr> |
45 | 45 | <tr> |
... | ... | @@ -52,11 +52,3 @@ |
52 | 52 | </tr> |
53 | 53 | </table> |
54 | 54 | <%= f.submit "Save Range" %> |
55 | - | |
56 | -<script>jQuery(document).ready(function($) { | |
57 | - $('#range_color').colorPicker({ | |
58 | - onColorChange : function(id, newValue) { | |
59 | - jQuery('#range_color').val(newValue); | |
60 | - } | |
61 | - }); | |
62 | -});</script> | ... | ... |