muck-comments 0.1.17 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. data/README.rdoc +2 -1
  2. data/VERSION +1 -1
  3. data/app/views/comments/_tiny_mce_form.html.erb +9 -9
  4. data/muck-comments.gemspec +88 -4
  5. data/test/rails_root/config/environment.rb +2 -0
  6. data/test/rails_root/config/initializers/geokit_config.rb +63 -0
  7. data/test/rails_root/db/migrate/20091124203137_add_location_to_profiles.rb +15 -0
  8. data/test/rails_root/db/migrate/20091124205819_add_fields_to_profiles.rb +21 -0
  9. data/test/rails_root/public/images/fancybox/fancy_shadow_e.png +0 -0
  10. data/test/rails_root/public/images/fancybox/fancy_shadow_n.png +0 -0
  11. data/test/rails_root/public/images/fancybox/fancy_shadow_ne.png +0 -0
  12. data/test/rails_root/public/images/fancybox/fancy_shadow_nw.png +0 -0
  13. data/test/rails_root/public/images/fancybox/fancy_shadow_s.png +0 -0
  14. data/test/rails_root/public/images/fancybox/fancy_shadow_se.png +0 -0
  15. data/test/rails_root/public/images/fancybox/fancy_shadow_sw.png +0 -0
  16. data/test/rails_root/public/images/fancybox/fancy_shadow_w.png +0 -0
  17. data/test/rails_root/public/javascripts/jquery/colorpicker.js +450 -0
  18. data/test/rails_root/public/javascripts/jquery/jquery.autocomplete.js.readme +6 -0
  19. data/test/rails_root/public/javascripts/jquery/jquery.autocomplete.min.js +15 -0
  20. data/test/rails_root/public/javascripts/jquery/jquery.autocomplete.pack.js +767 -0
  21. data/test/rails_root/public/javascripts/jquery/jquery.fancybox.js +13 -6
  22. data/test/rails_root/public/javascripts/jquery/jquery.metadata.min.js +13 -0
  23. data/test/rails_root/public/javascripts/jquery/jquery.queryString.js +33 -0
  24. data/test/rails_root/public/javascripts/jquery/jquery.swapimage.js +66 -0
  25. data/test/rails_root/public/javascripts/jquery/jquery.swapimage.min.js +11 -0
  26. data/test/rails_root/public/javascripts/jquery/jquery.tips.js +7 -6
  27. data/test/rails_root/public/javascripts/muck.js +48 -2
  28. data/test/rails_root/public/javascripts/tree.js +107 -0
  29. data/test/rails_root/public/stylesheets/jquery/jquery.autocomplete.css +15 -0
  30. data/test/rails_root/public/stylesheets/jquery/jquery.fancybox.css +19 -25
  31. data/test/rails_root/public/stylesheets/muck-activities.css +1 -1
  32. data/test/rails_root/test/unit/comment_test.rb +3 -3
  33. data/test/rails_root/vendor/plugins/geokit-rails/CHANGELOG.rdoc +46 -0
  34. data/test/rails_root/vendor/plugins/geokit-rails/MIT-LICENSE +20 -0
  35. data/test/rails_root/vendor/plugins/geokit-rails/README.markdown +561 -0
  36. data/test/rails_root/vendor/plugins/geokit-rails/Rakefile +18 -0
  37. data/test/rails_root/vendor/plugins/geokit-rails/about.yml +9 -0
  38. data/test/rails_root/vendor/plugins/geokit-rails/assets/api_keys_template +61 -0
  39. data/test/rails_root/vendor/plugins/geokit-rails/init.rb +2 -0
  40. data/test/rails_root/vendor/plugins/geokit-rails/install.rb +14 -0
  41. data/test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails.rb +26 -0
  42. data/test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/acts_as_mappable.rb +456 -0
  43. data/test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/adapters/abstract.rb +31 -0
  44. data/test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/adapters/mysql.rb +22 -0
  45. data/test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/adapters/postgresql.rb +22 -0
  46. data/test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/adapters/sqlserver.rb +43 -0
  47. data/test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/defaults.rb +22 -0
  48. data/test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/geocoder_control.rb +16 -0
  49. data/test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/ip_geocode_lookup.rb +46 -0
  50. data/test/rails_root/vendor/plugins/geokit-rails/test/acts_as_mappable_test.rb +474 -0
  51. data/test/rails_root/vendor/plugins/geokit-rails/test/boot.rb +25 -0
  52. data/test/rails_root/vendor/plugins/geokit-rails/test/database.yml +20 -0
  53. data/test/rails_root/vendor/plugins/geokit-rails/test/fixtures/companies.yml +7 -0
  54. data/test/rails_root/vendor/plugins/geokit-rails/test/fixtures/custom_locations.yml +54 -0
  55. data/test/rails_root/vendor/plugins/geokit-rails/test/fixtures/locations.yml +54 -0
  56. data/test/rails_root/vendor/plugins/geokit-rails/test/fixtures/mock_addresses.yml +17 -0
  57. data/test/rails_root/vendor/plugins/geokit-rails/test/fixtures/mock_families.yml +2 -0
  58. data/test/rails_root/vendor/plugins/geokit-rails/test/fixtures/mock_houses.yml +9 -0
  59. data/test/rails_root/vendor/plugins/geokit-rails/test/fixtures/mock_organizations.yml +5 -0
  60. data/test/rails_root/vendor/plugins/geokit-rails/test/fixtures/mock_people.yml +5 -0
  61. data/test/rails_root/vendor/plugins/geokit-rails/test/fixtures/stores.yml +0 -0
  62. data/test/rails_root/vendor/plugins/geokit-rails/test/ip_geocode_lookup_test.rb +77 -0
  63. data/test/rails_root/vendor/plugins/geokit-rails/test/models/company.rb +3 -0
  64. data/test/rails_root/vendor/plugins/geokit-rails/test/models/custom_location.rb +12 -0
  65. data/test/rails_root/vendor/plugins/geokit-rails/test/models/location.rb +4 -0
  66. data/test/rails_root/vendor/plugins/geokit-rails/test/models/mock_address.rb +4 -0
  67. data/test/rails_root/vendor/plugins/geokit-rails/test/models/mock_family.rb +3 -0
  68. data/test/rails_root/vendor/plugins/geokit-rails/test/models/mock_house.rb +3 -0
  69. data/test/rails_root/vendor/plugins/geokit-rails/test/models/mock_organization.rb +4 -0
  70. data/test/rails_root/vendor/plugins/geokit-rails/test/models/mock_person.rb +4 -0
  71. data/test/rails_root/vendor/plugins/geokit-rails/test/models/store.rb +3 -0
  72. data/test/rails_root/vendor/plugins/geokit-rails/test/schema.rb +60 -0
  73. data/test/rails_root/vendor/plugins/geokit-rails/test/tasks.rake +31 -0
  74. data/test/rails_root/vendor/plugins/geokit-rails/test/test_helper.rb +23 -0
  75. metadata +85 -2
data/README.rdoc CHANGED
@@ -10,7 +10,8 @@ Install the the awesome_nested_set gem (http://github.com/collectiveidea/awesome
10
10
  Then add it to your environment.rb:
11
11
 
12
12
  config.gem "awesome_nested_set"
13
-
13
+ config.gem "sanitize"
14
+
14
15
  == Usage
15
16
 
16
17
  === Comment model
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.17
1
+ 0.1.18
@@ -1,20 +1,20 @@
1
1
  <%
2
- form_id = "#{parent.dom_id}_comment_form"
3
- mce_id = "#{parent.dom_id}_comment"
4
- message_container_id = "#{@project.dom_id}_message_container"
5
- message_id = "#{@project.dom_id}_message"
2
+ muck_comment_form_id = "#{parent.dom_id}_comment_form"
3
+ muck_comment_mce_id = "#{parent.dom_id}_comment"
4
+ muck_comment_message_container_id = "#{@project.dom_id}_message_container"
5
+ muck_comment_message_id = "#{@project.dom_id}_message"
6
6
  -%>
7
- <div id="<%= message_container_id %>" class="help-box" style="display:none;">
7
+ <div id="<%= muck_comment_message_container_id %>" class="help-box" style="display:none;">
8
8
  <div id="flashMessage" class="message">
9
- <div id="<%= message_id %>" class="notice message"></div>
9
+ <div id="<%= muck_comment_message_id %>" class="notice message"></div>
10
10
  </div>
11
11
  </div>
12
12
  <div id="<%= parent.dom_id %>_new_comment" class="comment-form-wrapper">
13
- <% form_for(:comment, :url => new_comment_path_with_parent(parent), :html => { :id => form_id, :class => "comment-form"} ) do |f| -%>
14
- <%= f.text_area :body, :class => 'mceEditor min', :id => mce_id %>
13
+ <% form_for(:comment, :url => new_comment_path_with_parent(parent), :html => { :id => muck_comment_form_id, :class => "comment-form"} ) do |f| -%>
14
+ <%= f.text_area :body, :class => 'mceEditor min', :id => muck_comment_mce_id %>
15
15
  <%= hidden_field_tag :parent_comment_id, comment.id unless comment.blank? -%>
16
16
  <%= hidden_field_tag :render_new, render_new -%>
17
17
  <%= f.submit t('muck.comments.add_comment_button'), :class => "button #{comment_button_class}", :id => "comment_submit_#{parent.dom_id}" %>
18
18
  <% end -%>
19
19
  </div>
20
- <%= tiny_mce_scripts(:form_id => form_id, :mce_id => mce_id, :message_container_id => message_container_id, :message_id => message_id) -%>
20
+ <%= tiny_mce_scripts(:form_id => muck_comment_form_id, :mce_id => muck_comment_mce_id, :message_container_id => muck_comment_message_container_id, :message_id => muck_comment_message_id, :include_save_page => false) -%>
@@ -1,15 +1,15 @@
1
1
  # Generated by jeweler
2
- # DO NOT EDIT THIS FILE
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{muck-comments}
8
- s.version = "0.1.17"
8
+ s.version = "0.1.18"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Justin Ball", "Joel Duffin"]
12
- s.date = %q{2009-12-02}
12
+ s.date = %q{2010-01-13}
13
13
  s.description = %q{The comment engine for the muck system.}
14
14
  s.email = %q{justin@tatemae.com}
15
15
  s.extra_rdoc_files = [
@@ -114,6 +114,7 @@ Gem::Specification.new do |s|
114
114
  "test/rails_root/config/environments/production.rb",
115
115
  "test/rails_root/config/environments/test.rb",
116
116
  "test/rails_root/config/global_config.yml",
117
+ "test/rails_root/config/initializers/geokit_config.rb",
117
118
  "test/rails_root/config/initializers/inflections.rb",
118
119
  "test/rails_root/config/initializers/mime_types.rb",
119
120
  "test/rails_root/config/initializers/requires.rb",
@@ -137,6 +138,8 @@ Gem::Specification.new do |s|
137
138
  "test/rails_root/db/migrate/20090730154102_allow_null_user.rb",
138
139
  "test/rails_root/db/migrate/20090818204527_add_activity_indexes.rb",
139
140
  "test/rails_root/db/migrate/20090819030523_add_attachable_to_activities.rb",
141
+ "test/rails_root/db/migrate/20091124203137_add_location_to_profiles.rb",
142
+ "test/rails_root/db/migrate/20091124205819_add_fields_to_profiles.rb",
140
143
  "test/rails_root/features/comments.feature",
141
144
  "test/rails_root/features/step_definitions/comment_steps.rb",
142
145
  "test/rails_root/features/step_definitions/common_steps.rb",
@@ -204,12 +207,20 @@ Gem::Specification.new do |s|
204
207
  "test/rails_root/public/javascripts/dragdrop.js",
205
208
  "test/rails_root/public/javascripts/effects.js",
206
209
  "test/rails_root/public/javascripts/fancyzoom.min.js",
210
+ "test/rails_root/public/javascripts/jquery/colorpicker.js",
207
211
  "test/rails_root/public/javascripts/jquery/jquery-ui.js",
212
+ "test/rails_root/public/javascripts/jquery/jquery.autocomplete.js.readme",
213
+ "test/rails_root/public/javascripts/jquery/jquery.autocomplete.min.js",
214
+ "test/rails_root/public/javascripts/jquery/jquery.autocomplete.pack.js",
208
215
  "test/rails_root/public/javascripts/jquery/jquery.easing.js",
209
216
  "test/rails_root/public/javascripts/jquery/jquery.fancybox.js",
210
217
  "test/rails_root/public/javascripts/jquery/jquery.form.js",
211
218
  "test/rails_root/public/javascripts/jquery/jquery.jgrowl.js",
212
219
  "test/rails_root/public/javascripts/jquery/jquery.js",
220
+ "test/rails_root/public/javascripts/jquery/jquery.metadata.min.js",
221
+ "test/rails_root/public/javascripts/jquery/jquery.queryString.js",
222
+ "test/rails_root/public/javascripts/jquery/jquery.swapimage.js",
223
+ "test/rails_root/public/javascripts/jquery/jquery.swapimage.min.js",
213
224
  "test/rails_root/public/javascripts/jquery/jquery.tips.js",
214
225
  "test/rails_root/public/javascripts/jquery/jrails.js",
215
226
  "test/rails_root/public/javascripts/muck.js",
@@ -219,6 +230,7 @@ Gem::Specification.new do |s|
219
230
  "test/rails_root/public/javascripts/scriptaculous.js",
220
231
  "test/rails_root/public/javascripts/slider.js",
221
232
  "test/rails_root/public/javascripts/sound.js",
233
+ "test/rails_root/public/javascripts/tree.js",
222
234
  "test/rails_root/public/robots.txt",
223
235
  "test/rails_root/public/stylesheets/.keep",
224
236
  "test/rails_root/public/stylesheets/admin.css",
@@ -272,6 +284,7 @@ Gem::Specification.new do |s|
272
284
  "test/rails_root/public/stylesheets/jquery/cupertino/images/ui-icons_cd0a0a_256x240.png",
273
285
  "test/rails_root/public/stylesheets/jquery/cupertino/images/ui-icons_ffffff_256x240.png",
274
286
  "test/rails_root/public/stylesheets/jquery/cupertino/jquery-ui-1.7.1.custom.css",
287
+ "test/rails_root/public/stylesheets/jquery/jquery.autocomplete.css",
275
288
  "test/rails_root/public/stylesheets/jquery/jquery.fancybox.css",
276
289
  "test/rails_root/public/stylesheets/jquery/redmond/images/ui-bg_flat_0_aaaaaa_40x100.png",
277
290
  "test/rails_root/public/stylesheets/jquery/redmond/images/ui-bg_flat_55_fbec88_40x100.png",
@@ -347,6 +360,48 @@ Gem::Specification.new do |s|
347
360
  "test/rails_root/test/unit/comment_mailer_test.rb",
348
361
  "test/rails_root/test/unit/comment_test.rb",
349
362
  "test/rails_root/test/unit/user_test.rb",
363
+ "test/rails_root/vendor/plugins/geokit-rails/CHANGELOG.rdoc",
364
+ "test/rails_root/vendor/plugins/geokit-rails/MIT-LICENSE",
365
+ "test/rails_root/vendor/plugins/geokit-rails/README.markdown",
366
+ "test/rails_root/vendor/plugins/geokit-rails/Rakefile",
367
+ "test/rails_root/vendor/plugins/geokit-rails/about.yml",
368
+ "test/rails_root/vendor/plugins/geokit-rails/assets/api_keys_template",
369
+ "test/rails_root/vendor/plugins/geokit-rails/init.rb",
370
+ "test/rails_root/vendor/plugins/geokit-rails/install.rb",
371
+ "test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails.rb",
372
+ "test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/acts_as_mappable.rb",
373
+ "test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/adapters/abstract.rb",
374
+ "test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/adapters/mysql.rb",
375
+ "test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/adapters/postgresql.rb",
376
+ "test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/adapters/sqlserver.rb",
377
+ "test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/defaults.rb",
378
+ "test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/geocoder_control.rb",
379
+ "test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/ip_geocode_lookup.rb",
380
+ "test/rails_root/vendor/plugins/geokit-rails/test/acts_as_mappable_test.rb",
381
+ "test/rails_root/vendor/plugins/geokit-rails/test/boot.rb",
382
+ "test/rails_root/vendor/plugins/geokit-rails/test/database.yml",
383
+ "test/rails_root/vendor/plugins/geokit-rails/test/fixtures/companies.yml",
384
+ "test/rails_root/vendor/plugins/geokit-rails/test/fixtures/custom_locations.yml",
385
+ "test/rails_root/vendor/plugins/geokit-rails/test/fixtures/locations.yml",
386
+ "test/rails_root/vendor/plugins/geokit-rails/test/fixtures/mock_addresses.yml",
387
+ "test/rails_root/vendor/plugins/geokit-rails/test/fixtures/mock_families.yml",
388
+ "test/rails_root/vendor/plugins/geokit-rails/test/fixtures/mock_houses.yml",
389
+ "test/rails_root/vendor/plugins/geokit-rails/test/fixtures/mock_organizations.yml",
390
+ "test/rails_root/vendor/plugins/geokit-rails/test/fixtures/mock_people.yml",
391
+ "test/rails_root/vendor/plugins/geokit-rails/test/fixtures/stores.yml",
392
+ "test/rails_root/vendor/plugins/geokit-rails/test/ip_geocode_lookup_test.rb",
393
+ "test/rails_root/vendor/plugins/geokit-rails/test/models/company.rb",
394
+ "test/rails_root/vendor/plugins/geokit-rails/test/models/custom_location.rb",
395
+ "test/rails_root/vendor/plugins/geokit-rails/test/models/location.rb",
396
+ "test/rails_root/vendor/plugins/geokit-rails/test/models/mock_address.rb",
397
+ "test/rails_root/vendor/plugins/geokit-rails/test/models/mock_family.rb",
398
+ "test/rails_root/vendor/plugins/geokit-rails/test/models/mock_house.rb",
399
+ "test/rails_root/vendor/plugins/geokit-rails/test/models/mock_organization.rb",
400
+ "test/rails_root/vendor/plugins/geokit-rails/test/models/mock_person.rb",
401
+ "test/rails_root/vendor/plugins/geokit-rails/test/models/store.rb",
402
+ "test/rails_root/vendor/plugins/geokit-rails/test/schema.rb",
403
+ "test/rails_root/vendor/plugins/geokit-rails/test/tasks.rake",
404
+ "test/rails_root/vendor/plugins/geokit-rails/test/test_helper.rb",
350
405
  "test/rails_root/vendor/plugins/ssl_requirement/README",
351
406
  "test/rails_root/vendor/plugins/ssl_requirement/lib/ssl_requirement.rb",
352
407
  "test/rails_root/vendor/plugins/ssl_requirement/test/ssl_requirement_test.rb",
@@ -372,6 +427,7 @@ Gem::Specification.new do |s|
372
427
  "test/rails_root/config/environments/development.rb",
373
428
  "test/rails_root/config/environments/production.rb",
374
429
  "test/rails_root/config/environments/test.rb",
430
+ "test/rails_root/config/initializers/geokit_config.rb",
375
431
  "test/rails_root/config/initializers/inflections.rb",
376
432
  "test/rails_root/config/initializers/mime_types.rb",
377
433
  "test/rails_root/config/initializers/requires.rb",
@@ -394,6 +450,8 @@ Gem::Specification.new do |s|
394
450
  "test/rails_root/db/migrate/20090730154102_allow_null_user.rb",
395
451
  "test/rails_root/db/migrate/20090818204527_add_activity_indexes.rb",
396
452
  "test/rails_root/db/migrate/20090819030523_add_attachable_to_activities.rb",
453
+ "test/rails_root/db/migrate/20091124203137_add_location_to_profiles.rb",
454
+ "test/rails_root/db/migrate/20091124205819_add_fields_to_profiles.rb",
397
455
  "test/rails_root/features/step_definitions/comment_steps.rb",
398
456
  "test/rails_root/features/step_definitions/common_steps.rb",
399
457
  "test/rails_root/features/step_definitions/webrat_steps.rb",
@@ -406,6 +464,31 @@ Gem::Specification.new do |s|
406
464
  "test/rails_root/test/unit/comment_mailer_test.rb",
407
465
  "test/rails_root/test/unit/comment_test.rb",
408
466
  "test/rails_root/test/unit/user_test.rb",
467
+ "test/rails_root/vendor/plugins/geokit-rails/init.rb",
468
+ "test/rails_root/vendor/plugins/geokit-rails/install.rb",
469
+ "test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/acts_as_mappable.rb",
470
+ "test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/adapters/abstract.rb",
471
+ "test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/adapters/mysql.rb",
472
+ "test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/adapters/postgresql.rb",
473
+ "test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/adapters/sqlserver.rb",
474
+ "test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/defaults.rb",
475
+ "test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/geocoder_control.rb",
476
+ "test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/ip_geocode_lookup.rb",
477
+ "test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails.rb",
478
+ "test/rails_root/vendor/plugins/geokit-rails/test/acts_as_mappable_test.rb",
479
+ "test/rails_root/vendor/plugins/geokit-rails/test/boot.rb",
480
+ "test/rails_root/vendor/plugins/geokit-rails/test/ip_geocode_lookup_test.rb",
481
+ "test/rails_root/vendor/plugins/geokit-rails/test/models/company.rb",
482
+ "test/rails_root/vendor/plugins/geokit-rails/test/models/custom_location.rb",
483
+ "test/rails_root/vendor/plugins/geokit-rails/test/models/location.rb",
484
+ "test/rails_root/vendor/plugins/geokit-rails/test/models/mock_address.rb",
485
+ "test/rails_root/vendor/plugins/geokit-rails/test/models/mock_family.rb",
486
+ "test/rails_root/vendor/plugins/geokit-rails/test/models/mock_house.rb",
487
+ "test/rails_root/vendor/plugins/geokit-rails/test/models/mock_organization.rb",
488
+ "test/rails_root/vendor/plugins/geokit-rails/test/models/mock_person.rb",
489
+ "test/rails_root/vendor/plugins/geokit-rails/test/models/store.rb",
490
+ "test/rails_root/vendor/plugins/geokit-rails/test/schema.rb",
491
+ "test/rails_root/vendor/plugins/geokit-rails/test/test_helper.rb",
409
492
  "test/rails_root/vendor/plugins/ssl_requirement/lib/ssl_requirement.rb",
410
493
  "test/rails_root/vendor/plugins/ssl_requirement/test/ssl_requirement_test.rb"
411
494
  ]
@@ -432,3 +515,4 @@ Gem::Specification.new do |s|
432
515
  s.add_dependency(%q<muck-users>, [">= 0"])
433
516
  end
434
517
  end
518
+
@@ -22,6 +22,8 @@ Rails::Initializer.run do |config|
22
22
  config.gem "acts-as-taggable-on"
23
23
  config.gem "awesome_nested_set"
24
24
  config.gem "friendly_id"
25
+ config.gem "sanitize"
26
+ config.gem "geokit"
25
27
  config.gem "paperclip"
26
28
  config.gem "babelphish"
27
29
  config.gem 'muck-engine', :lib => 'muck_engine'
@@ -0,0 +1,63 @@
1
+ require 'geokit'
2
+
3
+ if defined? Geokit
4
+
5
+ # These defaults are used in Geokit::Mappable.distance_to and in acts_as_mappable
6
+ Geokit::default_units = :miles
7
+ Geokit::default_formula = :sphere
8
+
9
+ # This is the timeout value in seconds to be used for calls to the geocoder web
10
+ # services. For no timeout at all, comment out the setting. The timeout unit
11
+ # is in seconds.
12
+ Geokit::Geocoders::request_timeout = 3
13
+
14
+ # These settings are used if web service calls must be routed through a proxy.
15
+ # These setting can be nil if not needed, otherwise, addr and port must be
16
+ # filled in at a minimum. If the proxy requires authentication, the username
17
+ # and password can be provided as well.
18
+ Geokit::Geocoders::proxy_addr = nil
19
+ Geokit::Geocoders::proxy_port = nil
20
+ Geokit::Geocoders::proxy_user = nil
21
+ Geokit::Geocoders::proxy_pass = nil
22
+
23
+ # This is your yahoo application key for the Yahoo Geocoder.
24
+ # See http://developer.yahoo.com/faq/index.html#appid
25
+ # and http://developer.yahoo.com/maps/rest/V1/geocode.html
26
+ Geokit::Geocoders::yahoo = GlobalConfig.yahoo_geo_key
27
+
28
+ # This is your Google Maps geocoder key.
29
+ # See http://www.google.com/apis/maps/signup.html
30
+ # and http://www.google.com/apis/maps/documentation/#Geocoding_Examples
31
+ Geokit::Geocoders::google = GlobalConfig.google_geo_key
32
+
33
+ # This is your username and password for geocoder.us.
34
+ # To use the free service, the value can be set to nil or false. For
35
+ # usage tied to an account, the value should be set to username:password.
36
+ # See http://geocoder.us
37
+ # and http://geocoder.us/user/signup
38
+ Geokit::Geocoders::geocoder_us = false
39
+
40
+ # This is your authorization key for geocoder.ca.
41
+ # To use the free service, the value can be set to nil or false. For
42
+ # usage tied to an account, set the value to the key obtained from
43
+ # Geocoder.ca.
44
+ # See http://geocoder.ca
45
+ # and http://geocoder.ca/?register=1
46
+ Geokit::Geocoders::geocoder_ca = false
47
+
48
+ # Uncomment to use a username with the Geonames geocoder
49
+ #Geokit::Geocoders::geonames="REPLACE_WITH_YOUR_GEONAMES_USERNAME"
50
+
51
+ # This is the order in which the geocoders are called in a failover scenario
52
+ # If you only want to use a single geocoder, put a single symbol in the array.
53
+ # Valid symbols are :google, :yahoo, :us, and :ca.
54
+ # Be aware that there are Terms of Use restrictions on how you can use the
55
+ # various geocoders. Make sure you read up on relevant Terms of Use for each
56
+ # geocoder you are going to use.
57
+ Geokit::Geocoders::provider_order = [:google,:us]
58
+
59
+ # The IP provider order. Valid symbols are :ip,:geo_plugin.
60
+ # As before, make sure you read up on relevant Terms of Use for each
61
+ # Geokit::Geocoders::ip_provider_order = [:geo_plugin,:ip]
62
+
63
+ end
@@ -0,0 +1,15 @@
1
+ class AddLocationToProfiles < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :profiles, :location, :string
4
+ add_column :profiles, :lat, :decimal, :precision => 15, :scale => 10
5
+ add_column :profiles, :lng, :decimal, :precision => 15, :scale => 10
6
+ add_index :profiles, [:lat, :lng]
7
+ end
8
+
9
+ def self.down
10
+ remove_index :profiles, [:lat, :lng]
11
+ remove_column :profiles, :location
12
+ remove_column :profiles, :lat
13
+ remove_column :profiles, :lng
14
+ end
15
+ end
@@ -0,0 +1,21 @@
1
+ class AddFieldsToProfiles < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :profiles, :about, :text
4
+ add_column :profiles, :first_name, :string
5
+ add_column :profiles, :last_name, :string
6
+ add_column :profiles, :city, :string
7
+ add_column :profiles, :state_id, :integer
8
+ add_column :profiles, :country_id, :integer
9
+ add_column :profiles, :language_id, :integer
10
+ end
11
+
12
+ def self.down
13
+ remove_column :profiles, :about
14
+ remove_column :profiles, :first_name
15
+ remove_column :profiles, :last_name
16
+ remove_column :profiles, :city
17
+ remove_column :profiles, :state_id
18
+ remove_column :profiles, :country_id
19
+ remove_column :profiles, :language_id
20
+ end
21
+ end
@@ -0,0 +1,450 @@
1
+ /**
2
+ *
3
+ * Color picker
4
+ * Author: Stefan Petre www.eyecon.ro
5
+ *
6
+ */
7
+ (function ($) {
8
+ var ColorPicker = function () {
9
+ var
10
+ ids = {},
11
+ inAction,
12
+ charMin = 65,
13
+ visible,
14
+ tpl = '<div class="colorpicker"><div class="colorpicker_color"><div><div></div></div></div><div class="colorpicker_hue"><div></div></div><div class="colorpicker_new_color"></div><div class="colorpicker_current_color"></div><div class="colorpicker_hex"><input type="text" maxlength="6" size="6" /></div><div class="colorpicker_rgb_r colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_g colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_h colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_s colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_submit"></div></div>',
15
+ defaults = {
16
+ eventName: 'click',
17
+ onShow: function () {},
18
+ onBeforeShow: function(){},
19
+ onHide: function () {},
20
+ onChange: function () {},
21
+ onSubmit: function () {},
22
+ color: 'ff0000',
23
+ livePreview: true,
24
+ flat: false
25
+ },
26
+ fillRGBFields = function (hsb, cal) {
27
+ var rgb = HSBToRGB(hsb);
28
+ $(cal).data('colorpicker').fields
29
+ .eq(1).val(rgb.r).end()
30
+ .eq(2).val(rgb.g).end()
31
+ .eq(3).val(rgb.b).end();
32
+ },
33
+ fillHSBFields = function (hsb, cal) {
34
+ $(cal).data('colorpicker').fields
35
+ .eq(4).val(hsb.h).end()
36
+ .eq(5).val(hsb.s).end()
37
+ .eq(6).val(hsb.b).end();
38
+ },
39
+ fillHexFields = function (hsb, cal) {
40
+ $(cal).data('colorpicker').fields
41
+ .eq(0).val(HSBToHex(hsb)).end();
42
+ },
43
+ setSelector = function (hsb, cal) {
44
+ $(cal).data('colorpicker').selector.css('backgroundColor', '#' + HSBToHex({h: hsb.h, s: 100, b: 100}));
45
+ $(cal).data('colorpicker').selectorIndic.css({
46
+ left: parseInt(150 * hsb.s/100, 10),
47
+ top: parseInt(150 * (100-hsb.b)/100, 10)
48
+ });
49
+ },
50
+ setHue = function (hsb, cal) {
51
+ $(cal).data('colorpicker').hue.css('top', parseInt(150 - 150 * hsb.h/360, 10));
52
+ },
53
+ setCurrentColor = function (hsb, cal) {
54
+ $(cal).data('colorpicker').currentColor.css('backgroundColor', '#' + HSBToHex(hsb));
55
+ },
56
+ setNewColor = function (hsb, cal) {
57
+ $(cal).data('colorpicker').newColor.css('backgroundColor', '#' + HSBToHex(hsb));
58
+ },
59
+ keyDown = function (ev) {
60
+ var pressedKey = ev.charCode || ev.keyCode || -1;
61
+ if ((pressedKey > charMin && pressedKey <= 90) || pressedKey == 32) {
62
+ return false;
63
+ }
64
+ var cal = $(this).parent().parent();
65
+ if (cal.data('colorpicker').livePreview === true) {
66
+ change.apply(this);
67
+ }
68
+ },
69
+ change = function (ev) {
70
+ var cal = $(this).parent().parent(), col;
71
+ if (this.parentNode.className.indexOf('_hex') > 0) {
72
+ cal.data('colorpicker').color = col = HexToHSB(fixHex(this.value));
73
+ } else if (this.parentNode.className.indexOf('_hsb') > 0) {
74
+ cal.data('colorpicker').color = col = fixHSB({
75
+ h: parseInt(cal.data('colorpicker').fields.eq(4).val(), 10),
76
+ s: parseInt(cal.data('colorpicker').fields.eq(5).val(), 10),
77
+ b: parseInt(cal.data('colorpicker').fields.eq(6).val(), 10)
78
+ });
79
+ } else {
80
+ cal.data('colorpicker').color = col = RGBToHSB(fixRGB({
81
+ r: parseInt(cal.data('colorpicker').fields.eq(1).val(), 10),
82
+ g: parseInt(cal.data('colorpicker').fields.eq(2).val(), 10),
83
+ b: parseInt(cal.data('colorpicker').fields.eq(3).val(), 10)
84
+ }));
85
+ }
86
+ if (ev) {
87
+ fillRGBFields(col, cal.get(0));
88
+ fillHexFields(col, cal.get(0));
89
+ fillHSBFields(col, cal.get(0));
90
+ }
91
+ setSelector(col, cal.get(0));
92
+ setHue(col, cal.get(0));
93
+ setNewColor(col, cal.get(0));
94
+ cal.data('colorpicker').onChange.apply(cal, [col, HSBToHex(col), HSBToRGB(col)]);
95
+ },
96
+ blur = function (ev) {
97
+ var cal = $(this).parent().parent();
98
+ cal.data('colorpicker').fields.parent().removeClass('colorpicker_focus')
99
+ },
100
+ focus = function () {
101
+ charMin = this.parentNode.className.indexOf('_hex') > 0 ? 70 : 65;
102
+ $(this).parent().parent().data('colorpicker').fields.parent().removeClass('colorpicker_focus');
103
+ $(this).parent().addClass('colorpicker_focus');
104
+ },
105
+ downIncrement = function (ev) {
106
+ var field = $(this).parent().find('input').focus();
107
+ var current = {
108
+ el: $(this).parent().addClass('colorpicker_slider'),
109
+ max: this.parentNode.className.indexOf('_hsb_h') > 0 ? 360 : (this.parentNode.className.indexOf('_hsb') > 0 ? 100 : 255),
110
+ y: ev.pageY,
111
+ field: field,
112
+ val: parseInt(field.val(), 10),
113
+ preview: $(this).parent().parent().data('colorpicker').livePreview
114
+ };
115
+ $(document).bind('mouseup', current, upIncrement);
116
+ $(document).bind('mousemove', current, moveIncrement);
117
+ },
118
+ moveIncrement = function (ev) {
119
+ ev.data.field.val(Math.max(0, Math.min(ev.data.max, parseInt(ev.data.val + ev.pageY - ev.data.y, 10))));
120
+ if (ev.data.preview) {
121
+ change.apply(ev.data.field.get(0), [true]);
122
+ }
123
+ return false;
124
+ },
125
+ upIncrement = function (ev) {
126
+ change.apply(ev.data.field.get(0), [true]);
127
+ ev.data.el.removeClass('colorpicker_slider').find('input').focus();
128
+ $(document).unbind('mouseup', upIncrement);
129
+ $(document).unbind('mousemove', moveIncrement);
130
+ return false;
131
+ },
132
+ downHue = function (ev) {
133
+ var current = {
134
+ cal: $(this).parent(),
135
+ y: $(this).offset().top
136
+ };
137
+ current.preview = current.cal.data('colorpicker').livePreview;
138
+ $(document).bind('mouseup', current, upHue);
139
+ $(document).bind('mousemove', current, moveHue);
140
+ },
141
+ moveHue = function (ev) {
142
+ change.apply(
143
+ ev.data.cal.data('colorpicker')
144
+ .fields
145
+ .eq(4)
146
+ .val(parseInt(360*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.y))))/150, 10))
147
+ .get(0),
148
+ [ev.data.preview]
149
+ );
150
+ return false;
151
+ },
152
+ upHue = function (ev) {
153
+ fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
154
+ fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
155
+ $(document).unbind('mouseup', upHue);
156
+ $(document).unbind('mousemove', moveHue);
157
+ return false;
158
+ },
159
+ downSelector = function (ev) {
160
+ var current = {
161
+ cal: $(this).parent(),
162
+ pos: $(this).offset()
163
+ };
164
+ current.preview = current.cal.data('colorpicker').livePreview;
165
+ $(document).bind('mouseup', current, upSelector);
166
+ $(document).bind('mousemove', current, moveSelector);
167
+ },
168
+ moveSelector = function (ev) {
169
+ change.apply(
170
+ ev.data.cal.data('colorpicker')
171
+ .fields
172
+ .eq(6)
173
+ .val(parseInt(100*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.pos.top))))/150, 10))
174
+ .end()
175
+ .eq(5)
176
+ .val(parseInt(100*(Math.max(0,Math.min(150,(ev.pageX - ev.data.pos.left))))/150, 10))
177
+ .get(0),
178
+ [ev.data.preview]
179
+ );
180
+ return false;
181
+ },
182
+ upSelector = function (ev) {
183
+ fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
184
+ fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
185
+ $(document).unbind('mouseup', upSelector);
186
+ $(document).unbind('mousemove', moveSelector);
187
+ return false;
188
+ },
189
+ enterSubmit = function (ev) {
190
+ $(this).addClass('colorpicker_focus');
191
+ },
192
+ leaveSubmit = function (ev) {
193
+ $(this).removeClass('colorpicker_focus');
194
+ },
195
+ clickSubmit = function (ev) {
196
+ var cal = $(this).parent();
197
+ var col = cal.data('colorpicker').color;
198
+ cal.data('colorpicker').origColor = col;
199
+ setCurrentColor(col, cal.get(0));
200
+ cal.data('colorpicker').onSubmit(col, HSBToHex(col), HSBToRGB(col));
201
+ },
202
+ show = function (ev) {
203
+ var cal = $('#' + $(this).data('colorpickerId'));
204
+ cal.data('colorpicker').onBeforeShow.apply(this, [cal.get(0)]);
205
+ var pos = $(this).offset();
206
+ var viewPort = getViewport();
207
+ var top = pos.top + this.offsetHeight;
208
+ var left = pos.left;
209
+ if (top + 176 > viewPort.t + viewPort.h) {
210
+ top -= this.offsetHeight + 176;
211
+ }
212
+ if (left + 356 > viewPort.l + viewPort.w) {
213
+ left -= 356;
214
+ }
215
+ cal.css({left: left + 'px', top: top + 'px'});
216
+ if (cal.data('colorpicker').onShow.apply(this, [cal.get(0)]) != false) {
217
+ cal.show();
218
+ }
219
+ $(document).bind('mousedown', {cal: cal}, hide);
220
+ return false;
221
+ },
222
+ hide = function (ev) {
223
+ if (!isChildOf(ev.data.cal.get(0), ev.target, ev.data.cal.get(0))) {
224
+ if (ev.data.cal.data('colorpicker').onHide.apply(this, [ev.data.cal.get(0)]) != false) {
225
+ ev.data.cal.hide();
226
+ }
227
+ $(document).unbind('mousedown', hide);
228
+ }
229
+ },
230
+ isChildOf = function(parentEl, el, container) {
231
+ if (parentEl == el) {
232
+ return true;
233
+ }
234
+ if (parentEl.contains) {
235
+ return parentEl.contains(el);
236
+ }
237
+ if ( parentEl.compareDocumentPosition ) {
238
+ return !!(parentEl.compareDocumentPosition(el) & 16);
239
+ }
240
+ var prEl = el.parentNode;
241
+ while(prEl && prEl != container) {
242
+ if (prEl == parentEl)
243
+ return true;
244
+ prEl = prEl.parentNode;
245
+ }
246
+ return false;
247
+ },
248
+ getViewport = function () {
249
+ var m = document.compatMode == 'CSS1Compat';
250
+ return {
251
+ l : window.pageXOffset || (m ? document.documentElement.scrollLeft : document.body.scrollLeft),
252
+ t : window.pageYOffset || (m ? document.documentElement.scrollTop : document.body.scrollTop),
253
+ w : window.innerWidth || (m ? document.documentElement.clientWidth : document.body.clientWidth),
254
+ h : window.innerHeight || (m ? document.documentElement.clientHeight : document.body.clientHeight)
255
+ };
256
+ },
257
+ fixHSB = function (hsb) {
258
+ return {
259
+ h: Math.min(360, Math.max(0, hsb.h)),
260
+ s: Math.min(100, Math.max(0, hsb.s)),
261
+ b: Math.min(100, Math.max(0, hsb.b))
262
+ };
263
+ },
264
+ fixRGB = function (rgb) {
265
+ return {
266
+ r: Math.min(255, Math.max(0, rgb.r)),
267
+ g: Math.min(255, Math.max(0, rgb.g)),
268
+ b: Math.min(255, Math.max(0, rgb.b))
269
+ };
270
+ },
271
+ fixHex = function (hex) {
272
+ var len = 6 - hex.length;
273
+ if (len > 0) {
274
+ var o = [];
275
+ for (var i=0; i<len; i++) {
276
+ o.push('0');
277
+ }
278
+ o.push(hex);
279
+ hex = o.join('');
280
+ }
281
+ return hex;
282
+ },
283
+ HexToRGB = function (hex) {
284
+ var hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
285
+ return {r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex & 0x0000FF)};
286
+ },
287
+ HexToHSB = function (hex) {
288
+ return RGBToHSB(HexToRGB(hex));
289
+ },
290
+ RGBToHSB = function (rgb) {
291
+ var hsb = {};
292
+ hsb.b = Math.max(Math.max(rgb.r,rgb.g),rgb.b);
293
+ hsb.s = (hsb.b <= 0) ? 0 : Math.round(100*(hsb.b - Math.min(Math.min(rgb.r,rgb.g),rgb.b))/hsb.b);
294
+ hsb.b = Math.round((hsb.b /255)*100);
295
+ if((rgb.r==rgb.g) && (rgb.g==rgb.b)) hsb.h = 0;
296
+ else if(rgb.r>=rgb.g && rgb.g>=rgb.b) hsb.h = 60*(rgb.g-rgb.b)/(rgb.r-rgb.b);
297
+ else if(rgb.g>=rgb.r && rgb.r>=rgb.b) hsb.h = 60 + 60*(rgb.g-rgb.r)/(rgb.g-rgb.b);
298
+ else if(rgb.g>=rgb.b && rgb.b>=rgb.r) hsb.h = 120 + 60*(rgb.b-rgb.r)/(rgb.g-rgb.r);
299
+ else if(rgb.b>=rgb.g && rgb.g>=rgb.r) hsb.h = 180 + 60*(rgb.b-rgb.g)/(rgb.b-rgb.r);
300
+ else if(rgb.b>=rgb.r && rgb.r>=rgb.g) hsb.h = 240 + 60*(rgb.r-rgb.g)/(rgb.b-rgb.g);
301
+ else if(rgb.r>=rgb.b && rgb.b>=rgb.g) hsb.h = 300 + 60*(rgb.r-rgb.b)/(rgb.r-rgb.g);
302
+ else hsb.h = 0;
303
+ hsb.h = Math.round(hsb.h);
304
+ return hsb;
305
+ },
306
+ HSBToRGB = function (hsb) {
307
+ var rgb = {};
308
+ var h = Math.round(hsb.h);
309
+ var s = Math.round(hsb.s*255/100);
310
+ var v = Math.round(hsb.b*255/100);
311
+ if(s == 0) {
312
+ rgb.r = rgb.g = rgb.b = v;
313
+ } else {
314
+ var t1 = v;
315
+ var t2 = (255-s)*v/255;
316
+ var t3 = (t1-t2)*(h%60)/60;
317
+ if(h==360) h = 0;
318
+ if(h<60) {rgb.r=t1; rgb.b=t2; rgb.g=t2+t3}
319
+ else if(h<120) {rgb.g=t1; rgb.b=t2; rgb.r=t1-t3}
320
+ else if(h<180) {rgb.g=t1; rgb.r=t2; rgb.b=t2+t3}
321
+ else if(h<240) {rgb.b=t1; rgb.r=t2; rgb.g=t1-t3}
322
+ else if(h<300) {rgb.b=t1; rgb.g=t2; rgb.r=t2+t3}
323
+ else if(h<360) {rgb.r=t1; rgb.g=t2; rgb.b=t1-t3}
324
+ else {rgb.r=0; rgb.g=0; rgb.b=0}
325
+ }
326
+ return {r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b)};
327
+ },
328
+ RGBToHex = function (rgb) {
329
+ var hex = [
330
+ rgb.r.toString(16),
331
+ rgb.g.toString(16),
332
+ rgb.b.toString(16)
333
+ ];
334
+ $.each(hex, function (nr, val) {
335
+ if (val.length == 1) {
336
+ hex[nr] = '0' + val;
337
+ }
338
+ });
339
+ return hex.join('');
340
+ },
341
+ HSBToHex = function (hsb) {
342
+ return RGBToHex(HSBToRGB(hsb));
343
+ };
344
+ return {
345
+ init: function (options) {
346
+ options = $.extend({}, defaults, options||{});
347
+ if (typeof options.color == 'string') {
348
+ options.color = HexToHSB(options.color);
349
+ } else if (options.color.r != undefined && options.color.g != undefined && options.color.b != undefined) {
350
+ options.color = RGBToHSB(options.color);
351
+ } else if (options.color.h != undefined && options.color.s != undefined && options.color.b != undefined) {
352
+ options.color = fixHSB(options.color);
353
+ } else {
354
+ return this;
355
+ }
356
+ options.origColor = options.color;
357
+ return this.each(function () {
358
+ if (!$(this).data('colorpickerId')) {
359
+ var id = 'collorpicker_' + parseInt(Math.random() * 1000);
360
+ $(this).data('colorpickerId', id);
361
+ var cal = $(tpl).attr('id', id);
362
+ if (options.flat) {
363
+ cal.appendTo(this).show();
364
+ } else {
365
+ cal.appendTo(document.body);
366
+ }
367
+ options.fields = cal
368
+ .find('input')
369
+ .bind('keydown', keyDown)
370
+ .bind('change', change)
371
+ .bind('blur', blur)
372
+ .bind('focus', focus);
373
+ cal.find('span').bind('mousedown', downIncrement);
374
+ options.selector = cal.find('div.colorpicker_color').bind('mousedown', downSelector);
375
+ options.selectorIndic = options.selector.find('div div');
376
+ options.hue = cal.find('div.colorpicker_hue div');
377
+ cal.find('div.colorpicker_hue').bind('mousedown', downHue);
378
+ options.newColor = cal.find('div.colorpicker_new_color');
379
+ options.currentColor = cal.find('div.colorpicker_current_color');
380
+ cal.data('colorpicker', options);
381
+ cal.find('div.colorpicker_submit')
382
+ .bind('mouseenter', enterSubmit)
383
+ .bind('mouseleave', leaveSubmit)
384
+ .bind('click', clickSubmit);
385
+ fillRGBFields(options.color, cal.get(0));
386
+ fillHSBFields(options.color, cal.get(0));
387
+ fillHexFields(options.color, cal.get(0));
388
+ setHue(options.color, cal.get(0));
389
+ setSelector(options.color, cal.get(0));
390
+ setCurrentColor(options.color, cal.get(0));
391
+ setNewColor(options.color, cal.get(0));
392
+ if (options.flat) {
393
+ cal.css({
394
+ position: 'relative',
395
+ display: 'block'
396
+ });
397
+ } else {
398
+ $(this).bind(options.eventName, show);
399
+ }
400
+ }
401
+ });
402
+ },
403
+ showPicker: function() {
404
+ return this.each( function () {
405
+ if ($(this).data('colorpickerId')) {
406
+ show.apply(this);
407
+ }
408
+ });
409
+ },
410
+ hidePicker: function() {
411
+ return this.each( function () {
412
+ if ($(this).data('colorpickerId')) {
413
+ $('#' + $(this).data('colorpickerId')).hide();
414
+ }
415
+ });
416
+ },
417
+ setColor: function(col) {
418
+ if (typeof col == 'string') {
419
+ col = HexToHSB(col);
420
+ } else if (col.r != undefined && col.g != undefined && col.b != undefined) {
421
+ col = RGBToHSB(col);
422
+ } else if (col.h != undefined && col.s != undefined && col.b != undefined) {
423
+ col = fixHSB(col);
424
+ } else {
425
+ return this;
426
+ }
427
+ return this.each(function(){
428
+ if ($(this).data('colorpickerId')) {
429
+ var cal = $('#' + $(this).data('colorpickerId'));
430
+ cal.data('colorpicker').color = col;
431
+ cal.data('colorpicker').origColor = col;
432
+ fillRGBFields(col, cal.get(0));
433
+ fillHSBFields(col, cal.get(0));
434
+ fillHexFields(col, cal.get(0));
435
+ setHue(col, cal.get(0));
436
+ setSelector(col, cal.get(0));
437
+ setCurrentColor(col, cal.get(0));
438
+ setNewColor(col, cal.get(0));
439
+ }
440
+ });
441
+ }
442
+ };
443
+ }();
444
+ $.fn.extend({
445
+ ColorPicker: ColorPicker.init,
446
+ ColorPickerHide: ColorPicker.hide,
447
+ ColorPickerShow: ColorPicker.show,
448
+ ColorPickerSetColor: ColorPicker.setColor
449
+ });
450
+ })(jQuery)