Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Plugin complete TODO: code some tests
- Loading branch information
0 parents
commit 046d842
Showing
17 changed files
with
629 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Copyright (c) 2008 Morgan HOTONNIER<astorsoft@gmail.com> : Plugin author | ||
Copyright (c) 2007 Brandon Arbini/Sevenwire : Picky-color author | ||
|
||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
PickyColor | ||
========== | ||
|
||
PickyColor is a Ruby on Rails plugin for the JS color picker based on Prototype/Scriptaculous named... [picky_color][]! (here [is][picky_color_github] his GitHub page) | ||
|
||
|
||
Installation | ||
============ | ||
|
||
./script/plugin install git://github.com/Astorz/picky-color.git | ||
|
||
|
||
Example usage | ||
============== | ||
|
||
For the case 2 and 3 of this example I will act as if I have to put a color picker for the field color of my model post | ||
|
||
This plugin offer 3 way to use the helper : | ||
|
||
1. Using it like a tag from FormTagHelper. | ||
|
||
<%= picky_color_tag "my_color", "000000" %> | ||
|
||
2. Using it as a FormHelper | ||
|
||
<%= picky_color :post, :color %> | ||
|
||
3. Using it in the Formbuilder | ||
|
||
<%= f.picky_color :color %> | ||
|
||
It is of course possible to add any html option in addition to these parameters as a Hash as last parameter of the methods. They will be applied on the input text field : | ||
|
||
<%= picky_color :post, :color, :class => "my_sexy_class" %> | ||
|
||
In addition to the html options, you have at your disposal 2 custom parameters : **draggable** and **close_text** | ||
|
||
1. *:close_text* takes a string and is the text of the confirm button of the color picker, default is "OK" | ||
|
||
2. *:draggable* takes a boolean and set if the color picker is draggable or not, default is false | ||
|
||
example : | ||
|
||
<%#= picky_color :post, :color, :draggable => true, :close_text => "ColorMe!" %> | ||
|
||
|
||
Authors and credits | ||
=================== | ||
|
||
Author of the plugin : Morgan Hotonnier | ||
Original author of the picker : [Brandon Arbini/Sevenwire][sevenwire] | ||
|
||
Thanks to wildgoose, the author of the rails [calendar_date_select][calendar_date_select_github] plugin, whose code helped me a lot to figure out how to integrate my helper in the built-in formbuilder | ||
|
||
A special thanks to [Gabriel Laskar][gabriel_github_page], who helped me a lot for this plugin, which is my first one. "Merci papi Gabi!" | ||
|
||
|
||
|
||
|
||
Comments and suggestions | ||
------------------------ | ||
|
||
It's my first plugin therefore I'm sure my code is a mess and deserve a lot of improvements, all suggestions are really welcome! | ||
|
||
|
||
[picky_color]: http://code.google.com/p/picky-color/ | ||
[sevenwire]: http://github.com/sevenwire | ||
[picky_color_github]: http://github.com/sevenwire/picky_color/tree/master | ||
[gabriel_github_page]: http://github.com/bibiskuk | ||
[calendar_date_select_github]: http://github.com/timcharper/calendar_date_select/tree/master | ||
|
||
|
||
Copyright (c) 2008 Morgan Hotonnier <astorsoft@gmail.com>, released under the MIT license | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
require 'rake' | ||
require 'rake/testtask' | ||
require 'rake/rdoctask' | ||
|
||
desc 'Default: run unit tests.' | ||
task :default => :test | ||
|
||
desc 'Test the picky_color plugin.' | ||
Rake::TestTask.new(:test) do |t| | ||
t.libs << 'lib' | ||
t.pattern = 'test/**/*_test.rb' | ||
t.verbose = true | ||
end | ||
|
||
desc 'Generate documentation for the picky_color plugin.' | ||
Rake::RDocTask.new(:rdoc) do |rdoc| | ||
rdoc.rdoc_dir = 'rdoc' | ||
rdoc.title = 'PickyColor' | ||
rdoc.options << '--line-numbers' << '--inline-source' | ||
rdoc.rdoc_files.include('README') | ||
rdoc.rdoc_files.include('lib/**/*.rb') | ||
end |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
require "picky_color" | ||
ActionView::Helpers::FormHelper.send :include, PickyColor::FormHelper | ||
ActionView::Base.send :include, PickyColor::FormHelper | ||
ActionView::Base.send :include, PickyColor::FormHelper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
require 'fileutils' | ||
|
||
public_dir = File.join RAILS_ROOT, 'public' | ||
plugin_dir = File.dirname(__FILE__) | ||
|
||
FileUtils.cp File.join(plugin_dir, 'javascripts', 'picky_color.js'), File.join(public_dir, 'javascripts') | ||
FileUtils.cp File.join(plugin_dir, 'stylesheets', 'picky_color.css'), File.join(public_dir, 'stylesheets') | ||
FileUtils.cp_r File.join(plugin_dir, 'images', 'picky_color'), File.join(public_dir, 'images') | ||
|
||
|
Oops, something went wrong.