comfy_carousel 0.0.0 → 0.0.1

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 (61) hide show
  1. data/Gemfile +1 -0
  2. data/Gemfile.lock +7 -0
  3. data/LICENSE +20 -0
  4. data/README.md +35 -2
  5. data/Rakefile +1 -1
  6. data/VERSION +1 -1
  7. data/app/assets/javascripts/slides.jquery.js +555 -0
  8. data/app/assets/javascripts/slides.min.jquery.js +20 -0
  9. data/app/controllers/admin/carousel/base_controller.rb +10 -0
  10. data/app/controllers/admin/carousel/carousels_controller.rb +50 -0
  11. data/app/controllers/admin/carousel/slides_controller.rb +12 -4
  12. data/app/helpers/carousel/application_helper.rb +12 -0
  13. data/app/models/carousel/carousel.rb +25 -0
  14. data/app/models/carousel/slide.rb +21 -17
  15. data/app/views/admin/carousel/_navigation.html.erb +1 -0
  16. data/app/views/admin/carousel/carousels/_form.html.erb +4 -0
  17. data/app/views/admin/carousel/carousels/edit.html.erb +5 -0
  18. data/app/views/admin/carousel/carousels/index.html.erb +20 -0
  19. data/app/views/admin/carousel/carousels/new.html.erb +5 -0
  20. data/app/views/admin/carousel/slides/_form.html.erb +12 -14
  21. data/app/views/admin/carousel/slides/edit.html.erb +4 -3
  22. data/app/views/admin/carousel/slides/index.html.erb +20 -21
  23. data/app/views/admin/carousel/slides/new.html.erb +4 -3
  24. data/comfy_carousel.gemspec +112 -0
  25. data/config/application.rb +3 -0
  26. data/config/environments/development.rb +1 -1
  27. data/config/environments/test.rb +1 -1
  28. data/config/initializers/comfy_carousel.rb +12 -0
  29. data/config/routes.rb +9 -1
  30. data/db/migrate/01_create_comfy_carousel.rb +17 -2
  31. data/db/schema.rb +40 -0
  32. data/lib/comfy_carousel.rb +25 -0
  33. data/lib/comfy_carousel/configuration.rb +22 -0
  34. data/lib/comfy_carousel/engine.rb +19 -0
  35. data/lib/comfy_carousel/form_builder.rb +50 -0
  36. data/lib/generators/comfy/carousel/README +11 -0
  37. data/lib/generators/comfy/carousel/carousel_generator.rb +35 -0
  38. data/lib/tasks/comfy_carousel.rake +4 -0
  39. data/test/fixtures/carousel/carousels.yml +3 -0
  40. data/test/fixtures/carousel/slides.yml +9 -0
  41. data/test/fixtures/files/image.jpg +0 -0
  42. data/test/functional/admin/carousel/carousels_controller_test.rb +92 -0
  43. data/test/functional/admin/carousel/slides_controller_test.rb +59 -30
  44. data/test/test_helper.rb +30 -5
  45. data/test/unit/carousel_test.rb +30 -0
  46. data/test/unit/configuration_test.rb +17 -0
  47. data/test/unit/slide_test.rb +29 -0
  48. metadata +49 -21
  49. data/app/assets/images/rails.png +0 -0
  50. data/app/assets/javascripts/application.js +0 -15
  51. data/app/assets/stylesheets/application.css +0 -13
  52. data/app/helpers/application_helper.rb +0 -2
  53. data/config/environments/production.rb +0 -67
  54. data/config/initializers/backtrace_silencers.rb +0 -7
  55. data/config/initializers/inflections.rb +0 -15
  56. data/config/initializers/mime_types.rb +0 -5
  57. data/config/initializers/secret_token.rb +0 -7
  58. data/config/initializers/session_store.rb +0 -8
  59. data/config/initializers/wrap_parameters.rb +0 -14
  60. data/db/seeds.rb +0 -7
  61. data/lib/assets/.gitkeep +0 -0
data/test/test_helper.rb CHANGED
@@ -3,11 +3,36 @@ require File.expand_path('../../config/environment', __FILE__)
3
3
  require 'rails/test_help'
4
4
 
5
5
  class ActiveSupport::TestCase
6
- # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
7
- #
8
- # Note: You'll currently still have to declare fixtures explicitly in integration tests
9
- # -- they do not yet inherit this setting
6
+
10
7
  fixtures :all
8
+
9
+ include ActionDispatch::TestProcess
10
+
11
+ def setup
12
+ reset_config
13
+ end
14
+
15
+ # resetting default configuration
16
+ def reset_config
17
+ ComfyCarousel.configure do |config|
18
+ config.admin_route_prefix = 'admin'
19
+ config.admin_controller = 'ApplicationController'
20
+ config.form_builder = 'ComfyCarousel::FormBuilder'
21
+ end
22
+ end
11
23
 
12
- # Add more helper methods to be used by all tests here...
24
+ # Example usage:
25
+ # assert_has_errors_on( @record, [:field_1, :field_2] )
26
+ # assert_has_errors_on( @record, {:field_1 => 'Message1', :field_2 => 'Message 2'} )
27
+ def assert_has_errors_on(record, fields)
28
+ fields = [fields].flatten unless fields.is_a?(Hash)
29
+ fields.each do |field, message|
30
+ assert record.errors.to_hash.has_key?(field.to_sym), "#{record.class.name} should error on invalid #{field}"
31
+ if message && record.errors[field].is_a?(Array) && !message.is_a?(Array)
32
+ assert_not_nil record.errors[field].index(message)
33
+ elsif message
34
+ assert_equal message, record.errors[field]
35
+ end
36
+ end
37
+ end
13
38
  end
@@ -0,0 +1,30 @@
1
+ require File.expand_path('../test_helper', File.dirname(__FILE__))
2
+
3
+ class CarouselTest < ActiveSupport::TestCase
4
+
5
+ def test_fixtures_validity
6
+ Carousel::Carousel.all.each do |carousel|
7
+ assert carousel.valid?, carousel.errors.inspect
8
+ end
9
+ end
10
+
11
+ def test_validations
12
+ carousel = Carousel::Carousel.new
13
+ assert carousel.invalid?
14
+ assert_has_errors_on carousel, [:label, :identifier]
15
+ end
16
+
17
+ def test_creation
18
+ assert_difference 'Carousel::Carousel.count' do
19
+ carousel = Carousel::Carousel.create(:identifier => 'test')
20
+ assert_equal 'Test', carousel.label
21
+ end
22
+ end
23
+
24
+ def test_destruction
25
+ assert_difference ['Carousel::Carousel.count', 'Carousel::Slide.count'], -1 do
26
+ carousel_carousels(:default).destroy
27
+ end
28
+ end
29
+
30
+ end
@@ -0,0 +1,17 @@
1
+ require File.expand_path('../test_helper', File.dirname(__FILE__))
2
+
3
+ class ConfigurationTest < ActiveSupport::TestCase
4
+
5
+ def test_configuration
6
+ assert config = ComfyCarousel.configuration
7
+ assert_equal 'admin', config.admin_route_prefix
8
+ assert_equal 'ApplicationController', config.admin_controller
9
+ assert_equal 'ComfyCarousel::FormBuilder', config.form_builder
10
+ end
11
+
12
+ def test_initialization_overrides
13
+ ComfyCarousel.config.admin_route_prefix = 'new-admin'
14
+ assert_equal 'new-admin', ComfyCarousel.config.admin_route_prefix
15
+ end
16
+
17
+ end
@@ -0,0 +1,29 @@
1
+ require File.expand_path('../test_helper', File.dirname(__FILE__))
2
+
3
+ class SlideTest < ActiveSupport::TestCase
4
+
5
+ def test_fixtures_validity
6
+ Carousel::Slide.all.each do |slide|
7
+ assert slide.valid?, slide.errors.inspect
8
+ end
9
+ end
10
+
11
+ def test_validations
12
+ slide = Carousel::Slide.new
13
+ assert slide.invalid?
14
+ assert_has_errors_on slide, [:carousel_id, :label]
15
+ end
16
+
17
+ def test_creation
18
+ assert_difference 'Carousel::Slide.count' do
19
+ slide = carousel_carousels(:default).slides.create(
20
+ :label => 'Test',
21
+ :content => 'Test Content',
22
+ :url => 'http://google.com',
23
+ :file => fixture_file_upload('files/image.jpg', 'image/jpeg')
24
+ )
25
+ assert_equal 1, slide.position
26
+ end
27
+ end
28
+
29
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comfy_carousel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-02-06 00:00:00.000000000Z
13
+ date: 2012-02-07 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
17
- requirement: &70165374775500 !ruby/object:Gem::Requirement
17
+ requirement: &70348692094640 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 3.1.0
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70165374775500
25
+ version_requirements: *70348692094640
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: jquery-rails
28
- requirement: &70165374774500 !ruby/object:Gem::Requirement
28
+ requirement: &70348692091400 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,62 +33,90 @@ dependencies:
33
33
  version: 1.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *70165374774500
36
+ version_requirements: *70348692091400
37
+ - !ruby/object:Gem::Dependency
38
+ name: paperclip
39
+ requirement: &70348692083860 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: 2.3.0
45
+ type: :runtime
46
+ prerelease: false
47
+ version_requirements: *70348692083860
37
48
  description: ''
38
49
  email: oleg@twg.ca
39
50
  executables: []
40
51
  extensions: []
41
52
  extra_rdoc_files:
53
+ - LICENSE
42
54
  - README.md
43
55
  files:
44
56
  - Gemfile
45
57
  - Gemfile.lock
58
+ - LICENSE
46
59
  - README.md
47
60
  - Rakefile
48
61
  - VERSION
49
- - app/assets/images/rails.png
50
- - app/assets/javascripts/application.js
51
- - app/assets/stylesheets/application.css
62
+ - app/assets/javascripts/slides.jquery.js
63
+ - app/assets/javascripts/slides.min.jquery.js
64
+ - app/controllers/admin/carousel/base_controller.rb
65
+ - app/controllers/admin/carousel/carousels_controller.rb
52
66
  - app/controllers/admin/carousel/slides_controller.rb
53
67
  - app/controllers/application_controller.rb
54
- - app/helpers/application_helper.rb
68
+ - app/helpers/carousel/application_helper.rb
55
69
  - app/models/.gitkeep
70
+ - app/models/carousel/carousel.rb
56
71
  - app/models/carousel/slide.rb
72
+ - app/views/admin/carousel/_navigation.html.erb
73
+ - app/views/admin/carousel/carousels/_form.html.erb
74
+ - app/views/admin/carousel/carousels/edit.html.erb
75
+ - app/views/admin/carousel/carousels/index.html.erb
76
+ - app/views/admin/carousel/carousels/new.html.erb
57
77
  - app/views/admin/carousel/slides/_form.html.erb
58
78
  - app/views/admin/carousel/slides/edit.html.erb
59
79
  - app/views/admin/carousel/slides/index.html.erb
60
80
  - app/views/admin/carousel/slides/new.html.erb
61
81
  - app/views/layouts/application.html.erb
82
+ - comfy_carousel.gemspec
62
83
  - config.ru
63
84
  - config/application.rb
64
85
  - config/boot.rb
65
86
  - config/database.yml
66
87
  - config/environment.rb
67
88
  - config/environments/development.rb
68
- - config/environments/production.rb
69
89
  - config/environments/test.rb
70
- - config/initializers/backtrace_silencers.rb
71
- - config/initializers/inflections.rb
72
- - config/initializers/mime_types.rb
73
- - config/initializers/secret_token.rb
74
- - config/initializers/session_store.rb
75
- - config/initializers/wrap_parameters.rb
90
+ - config/initializers/comfy_carousel.rb
76
91
  - config/locales/en.yml
77
92
  - config/routes.rb
78
93
  - db/migrate/01_create_comfy_carousel.rb
79
- - db/seeds.rb
94
+ - db/schema.rb
80
95
  - doc/README_FOR_APP
81
- - lib/assets/.gitkeep
96
+ - lib/comfy_carousel.rb
97
+ - lib/comfy_carousel/configuration.rb
98
+ - lib/comfy_carousel/engine.rb
99
+ - lib/comfy_carousel/form_builder.rb
100
+ - lib/generators/comfy/carousel/README
101
+ - lib/generators/comfy/carousel/carousel_generator.rb
82
102
  - lib/tasks/.gitkeep
103
+ - lib/tasks/comfy_carousel.rake
83
104
  - log/.gitkeep
84
105
  - script/rails
85
106
  - test/fixtures/.gitkeep
107
+ - test/fixtures/carousel/carousels.yml
108
+ - test/fixtures/carousel/slides.yml
109
+ - test/fixtures/files/image.jpg
86
110
  - test/functional/.gitkeep
111
+ - test/functional/admin/carousel/carousels_controller_test.rb
87
112
  - test/functional/admin/carousel/slides_controller_test.rb
88
113
  - test/integration/.gitkeep
89
114
  - test/performance/browsing_test.rb
90
115
  - test/test_helper.rb
91
116
  - test/unit/.gitkeep
117
+ - test/unit/carousel_test.rb
118
+ - test/unit/configuration_test.rb
119
+ - test/unit/slide_test.rb
92
120
  - vendor/assets/javascripts/.gitkeep
93
121
  - vendor/assets/stylesheets/.gitkeep
94
122
  - vendor/plugins/.gitkeep
@@ -107,7 +135,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
107
135
  version: '0'
108
136
  segments:
109
137
  - 0
110
- hash: -2049752832162688533
138
+ hash: -1820114394021651927
111
139
  required_rubygems_version: !ruby/object:Gem::Requirement
112
140
  none: false
113
141
  requirements:
@@ -119,5 +147,5 @@ rubyforge_project:
119
147
  rubygems_version: 1.8.10
120
148
  signing_key:
121
149
  specification_version: 3
122
- summary: ComfyCarousel is a carousel engine for Rails 3.1 apps (and ComfortableMexicanSofa)
150
+ summary: ComfyCarousel is a carousel engine for Rails 3.1+ apps (and ComfortableMexicanSofa)
123
151
  test_files: []
Binary file
@@ -1,15 +0,0 @@
1
- // This is a manifest file that'll be compiled into application.js, which will include all the files
2
- // listed below.
3
- //
4
- // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
- //
7
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // the compiled file.
9
- //
10
- // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
- // GO AFTER THE REQUIRES BELOW.
12
- //
13
- //= require jquery
14
- //= require jquery_ujs
15
- //= require_tree .
@@ -1,13 +0,0 @@
1
- /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
4
- *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
- *
8
- * You're free to add application-wide styles to this file and they'll appear at the top of the
9
- * compiled file, but it's generally better to create a new file per style scope.
10
- *
11
- *= require_self
12
- *= require_tree .
13
- */
@@ -1,2 +0,0 @@
1
- module ApplicationHelper
2
- end
@@ -1,67 +0,0 @@
1
- ComfyCarousel::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
3
-
4
- # Code is not reloaded between requests
5
- config.cache_classes = true
6
-
7
- # Full error reports are disabled and caching is turned on
8
- config.consider_all_requests_local = false
9
- config.action_controller.perform_caching = true
10
-
11
- # Disable Rails's static asset server (Apache or nginx will already do this)
12
- config.serve_static_assets = false
13
-
14
- # Compress JavaScripts and CSS
15
- config.assets.compress = true
16
-
17
- # Don't fallback to assets pipeline if a precompiled asset is missed
18
- config.assets.compile = false
19
-
20
- # Generate digests for assets URLs
21
- config.assets.digest = true
22
-
23
- # Defaults to Rails.root.join("public/assets")
24
- # config.assets.manifest = YOUR_PATH
25
-
26
- # Specifies the header that your server uses for sending files
27
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
28
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
29
-
30
- # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31
- # config.force_ssl = true
32
-
33
- # See everything in the log (default is :info)
34
- # config.log_level = :debug
35
-
36
- # Prepend all log lines with the following tags
37
- # config.log_tags = [ :subdomain, :uuid ]
38
-
39
- # Use a different logger for distributed setups
40
- # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
41
-
42
- # Use a different cache store in production
43
- # config.cache_store = :mem_cache_store
44
-
45
- # Enable serving of images, stylesheets, and JavaScripts from an asset server
46
- # config.action_controller.asset_host = "http://assets.example.com"
47
-
48
- # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
49
- # config.assets.precompile += %w( search.js )
50
-
51
- # Disable delivery errors, bad email addresses will be ignored
52
- # config.action_mailer.raise_delivery_errors = false
53
-
54
- # Enable threaded mode
55
- # config.threadsafe!
56
-
57
- # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
58
- # the I18n.default_locale when a translation can not be found)
59
- config.i18n.fallbacks = true
60
-
61
- # Send deprecation notices to registered listeners
62
- config.active_support.deprecation = :notify
63
-
64
- # Log the query plan for queries taking more than this (works
65
- # with SQLite, MySQL, and PostgreSQL)
66
- # config.active_record.auto_explain_threshold_in_seconds = 0.5
67
- end
@@ -1,7 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
- # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
-
6
- # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
- # Rails.backtrace_cleaner.remove_silencers!
@@ -1,15 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new inflection rules using the following format
4
- # (all these examples are active by default):
5
- # ActiveSupport::Inflector.inflections do |inflect|
6
- # inflect.plural /^(ox)$/i, '\1en'
7
- # inflect.singular /^(ox)en/i, '\1'
8
- # inflect.irregular 'person', 'people'
9
- # inflect.uncountable %w( fish sheep )
10
- # end
11
- #
12
- # These inflection rules are supported but not enabled by default:
13
- # ActiveSupport::Inflector.inflections do |inflect|
14
- # inflect.acronym 'RESTful'
15
- # end
@@ -1,5 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new mime types for use in respond_to blocks:
4
- # Mime::Type.register "text/richtext", :rtf
5
- # Mime::Type.register_alias "text/html", :iphone
@@ -1,7 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Your secret key for verifying the integrity of signed cookies.
4
- # If you change this key, all old signed cookies will become invalid!
5
- # Make sure the secret is at least 30 characters and all random,
6
- # no regular words or you'll be exposed to dictionary attacks.
7
- ComfyCarousel::Application.config.secret_token = '0e1576eddb4d34f1c850ab71a33970a12a3627947f475d0ed48db31a9922362c19c67332e000310b218cb00a9dd26f4763e914d754531a45def8418ca2e30674'
@@ -1,8 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- ComfyCarousel::Application.config.session_store :cookie_store, key: '_comfy-carousel_session'
4
-
5
- # Use the database for sessions instead of the cookie-based default,
6
- # which shouldn't be used to store highly confidential information
7
- # (create the session table with "rails generate session_migration")
8
- # ComfyCarousel::Application.config.session_store :active_record_store
@@ -1,14 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
- #
3
- # This file contains settings for ActionController::ParamsWrapper which
4
- # is enabled by default.
5
-
6
- # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
- ActiveSupport.on_load(:action_controller) do
8
- wrap_parameters format: [:json]
9
- end
10
-
11
- # Disable root element in JSON by default.
12
- ActiveSupport.on_load(:active_record) do
13
- self.include_root_in_json = false
14
- end