enjoy_cms_gallery 0.4.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/.ruby-gemset +1 -0
  4. data/.ruby-version +1 -0
  5. data/.travis.yml +4 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +41 -0
  9. data/Rakefile +1 -0
  10. data/app/assets/javascripts/enjoy/gallery/init.coffee +2 -0
  11. data/app/assets/javascripts/enjoy/gallery/loaders/gallery_images_loader.coffee +29 -0
  12. data/app/assets/javascripts/enjoy/gallery/loaders/gallery_loader.coffee +29 -0
  13. data/app/assets/javascripts/enjoy/gallery/page_selector.coffee +65 -0
  14. data/app/assets/javascripts/enjoy/gallery.coffee +11 -0
  15. data/app/controllers/concerns/enjoy/gallery/load_gallery.rb +55 -0
  16. data/app/controllers/concerns/enjoy/gallery/load_gallery_images.rb +46 -0
  17. data/app/models/concerns/enjoy/gallery/active_record_paperclip.rb +56 -0
  18. data/app/models/concerns/enjoy/gallery/decorators/embedded_image.rb +5 -0
  19. data/app/models/concerns/enjoy/gallery/decorators/gallery.rb +5 -0
  20. data/app/models/concerns/enjoy/gallery/decorators/image.rb +5 -0
  21. data/app/models/concerns/enjoy/gallery/gallerable.rb +22 -0
  22. data/app/models/concerns/enjoy/gallery/mongoid_paperclip.rb +57 -0
  23. data/app/models/concerns/enjoy/gallery/paperclipable.rb +17 -0
  24. data/app/models/enjoy/gallery/embedded_image.rb +16 -0
  25. data/app/models/enjoy/gallery/gallery.rb +16 -0
  26. data/app/models/enjoy/gallery/image.rb +16 -0
  27. data/bin/console +14 -0
  28. data/bin/setup +7 -0
  29. data/config/initializers/enjoy_rails_admin.rb +51 -0
  30. data/config/initializers/paperclip_fix.rb +4 -0
  31. data/config/locales/enjoy.gallery.ru.yml +16 -0
  32. data/enjoy_cms_gallery.gemspec +41 -0
  33. data/lib/enjoy/gallery/admin/embedded_image.rb +38 -0
  34. data/lib/enjoy/gallery/admin/gallery.rb +56 -0
  35. data/lib/enjoy/gallery/admin/image.rb +33 -0
  36. data/lib/enjoy/gallery/admin.rb +4 -0
  37. data/lib/enjoy/gallery/configuration.rb +21 -0
  38. data/lib/enjoy/gallery/engine.rb +5 -0
  39. data/lib/enjoy/gallery/models/active_record/gallery.rb +19 -0
  40. data/lib/enjoy/gallery/models/active_record/image.rb +21 -0
  41. data/lib/enjoy/gallery/models/embedded_image.rb +26 -0
  42. data/lib/enjoy/gallery/models/gallery.rb +36 -0
  43. data/lib/enjoy/gallery/models/image.rb +30 -0
  44. data/lib/enjoy/gallery/models/mongoid/embedded_image.rb +12 -0
  45. data/lib/enjoy/gallery/models/mongoid/gallery.rb +19 -0
  46. data/lib/enjoy/gallery/models/mongoid/image.rb +18 -0
  47. data/lib/enjoy/gallery/version.rb +5 -0
  48. data/lib/enjoy_cms_gallery.rb +68 -0
  49. data/lib/generators/enjoy/gallery/config/install_generator.rb +13 -0
  50. data/lib/generators/enjoy/gallery/config/templates/enjoy_gallery.erb +4 -0
  51. data/lib/generators/enjoy/gallery/migrations/migration_generator.rb +18 -0
  52. data/lib/generators/enjoy/gallery/migrations/templates/migration_gallery.rb +51 -0
  53. data/lib/generators/enjoy/gallery/models/embedded_image_generator.rb +48 -0
  54. data/lib/generators/enjoy/gallery/models/image_generator.rb +43 -0
  55. data/lib/generators/enjoy/gallery/models/templates/embedded_image.erb +29 -0
  56. data/lib/generators/enjoy/gallery/models/templates/image.erb +22 -0
  57. data/release.sh +7 -0
  58. metadata +212 -0
@@ -0,0 +1,16 @@
1
+ ru:
2
+ enjoy:
3
+ gallery: Галерея
4
+
5
+ mongoid: &mongoid
6
+ models:
7
+ enjoy/gallery/gallery: Фотогалерея
8
+ enjoy/gallery/image: Фото в фотогалерее
9
+ enjoy/gallery/embedded_image: Фото в фотогалерее
10
+
11
+ attributes:
12
+ enjoy/gallery/gallery:
13
+ enjoy/gallery/image:
14
+ gallery: Фотогалерея
15
+ gallery_id: Фотогалерея
16
+ enjoy/gallery/embedded_image:
@@ -0,0 +1,41 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'enjoy/gallery/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "enjoy_cms_gallery"
8
+ spec.version = Enjoy::Gallery::VERSION
9
+ spec.authors = ["Alexander Kiseliev"]
10
+ spec.email = ["dev@enjoycreate.ru"]
11
+
12
+ spec.description = %q{enjoy_cms_gallery}
13
+ spec.summary = %q{enjoy_cms_gallery}
14
+ spec.homepage = 'https://github.com/enjoycreative/enjoy_cms_gallery'
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
18
+ # delete this section to allow pushing this gem to any host.
19
+ # if spec.respond_to?(:metadata)
20
+ # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
21
+ # else
22
+ # raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
23
+ # end
24
+
25
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
+ spec.bindir = "exe"
27
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ["lib"]
29
+
30
+ spec.add_development_dependency "bundler", "~> 1.10"
31
+ spec.add_development_dependency "rake", "~> 10.0"
32
+
33
+ spec.add_dependency 'enjoy_cms', "~> 0.4.0.beta3"
34
+
35
+ spec.add_dependency "paperclip"
36
+ spec.add_dependency 'glebtv-mongoid-paperclip'
37
+ spec.add_dependency 'ack_rails_admin_jcrop'
38
+
39
+ spec.add_dependency "image_optim"
40
+ spec.add_dependency "paperclip-optimizer"
41
+ end
@@ -0,0 +1,38 @@
1
+ module Enjoy::Gallery
2
+ module Admin
3
+ module EmbeddedImage
4
+ def self.config(fields = {})
5
+ jcrop_proc = Proc.new do
6
+ jcrop_options :image_jcrop_options
7
+ end
8
+
9
+ if fields
10
+ if fields.is_a?(Hash)
11
+ fields.reverse_merge!({image: [:jcrop, jcrop_proc]})
12
+ else
13
+ finded = false
14
+ fields.each { |g|
15
+ finded = !!g[:fields][:image] unless finded
16
+ }
17
+ unless finded
18
+ fields << {
19
+ name: :image,
20
+ fields: {
21
+ image: [:jcrop, jcrop_proc]
22
+ }
23
+ }
24
+ end
25
+ end
26
+ end
27
+
28
+ if block_given?
29
+ Enjoy::Admin::EmbeddedElement.config(nil, fields) do |config|
30
+ yield config
31
+ end
32
+ else
33
+ Enjoy::Admin::EmbeddedElement.config(nil, fields)
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,56 @@
1
+ module Enjoy::Gallery
2
+ module Admin
3
+ module Gallery
4
+ def self.config(nav_label = nil, fields = {})
5
+ Proc.new {
6
+ navigation_label(nav_label || I18n.t('enjoy.gallery'))
7
+ field :enabled, :toggle do
8
+ searchable false
9
+ end
10
+
11
+ field :name, :string do
12
+ searchable true
13
+ end
14
+ group :URL do
15
+ active false
16
+ field :slugs, :enum do
17
+ searchable true
18
+ enum_method do
19
+ :slugs
20
+ end
21
+ visible do
22
+ bindings[:view].current_user.admin?
23
+ end
24
+ multiple do
25
+ true
26
+ end
27
+ end
28
+ field :text_slug
29
+ end
30
+
31
+ field :image, :jcrop do
32
+ jcrop_options :image_jcrop_options
33
+ end
34
+
35
+ # field :gallery_objects do
36
+ # read_only true
37
+ # end
38
+
39
+ if defined?(RailsAdminMultipleFileUpload)
40
+ multiple_file_upload(
41
+ {
42
+ fields: [:gallery_images]
43
+ }
44
+ )
45
+ end
46
+
47
+ Enjoy::RailsAdminGroupPatch::enjoy_cms_group(self, fields)
48
+
49
+ if block_given?
50
+ yield self
51
+ end
52
+ }
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,33 @@
1
+ module Enjoy::Gallery
2
+ module Admin
3
+ module Image
4
+ def self.config(nav_label = nil, without_gallery = false, fields = {})
5
+ Proc.new {
6
+ navigation_label(nav_label || I18n.t('enjoy.gallery'))
7
+ field :enabled, :toggle do
8
+ searchable false
9
+ end
10
+ unless without_gallery
11
+ field :gallery do
12
+ searchable :name
13
+ end
14
+ end
15
+ field :name, :string do
16
+ searchable true
17
+ end
18
+ field :image, :jcrop do
19
+ jcrop_options :image_jcrop_options
20
+ end
21
+
22
+ nested_set({max_depth: 1, scopes: []})
23
+
24
+ Enjoy::RailsAdminGroupPatch::enjoy_cms_group(self, fields)
25
+
26
+ if block_given?
27
+ yield self
28
+ end
29
+ }
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,4 @@
1
+ module Enjoy::Gallery
2
+ module Admin
3
+ end
4
+ end
@@ -0,0 +1,21 @@
1
+ module Enjoy::Gallery
2
+ def self.configuration
3
+ @configuration ||= Configuration.new
4
+ end
5
+ def self.config
6
+ @configuration ||= Configuration.new
7
+ end
8
+
9
+ def self.configure
10
+ yield configuration
11
+ end
12
+
13
+ class Configuration
14
+
15
+ attr_accessor :localize
16
+
17
+ def initialize
18
+ @localize = Enjoy.config.localize
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,5 @@
1
+ module Enjoy::Gallery
2
+ class Engine < ::Rails::Engine
3
+ # isolate_namespace Enjoy::Gallery
4
+ end
5
+ end
@@ -0,0 +1,19 @@
1
+ module Enjoy::Gallery
2
+ module Models
3
+ module ActiveRecord
4
+ module Gallery
5
+ extend ActiveSupport::Concern
6
+
7
+ included do
8
+ has_paper_trail
9
+ validates_lengths_from_database
10
+ if Enjoy::Gallery.config.localize
11
+ translates :name
12
+ end
13
+
14
+ scope :sorted, -> { order(lft: :asc) }
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,21 @@
1
+ module Enjoy::Gallery
2
+ module Models
3
+ module ActiveRecord
4
+ module Image
5
+ extend ActiveSupport::Concern
6
+
7
+ included do
8
+ # belongs_to :enjoy_gallery_imagable, polymorphic: true
9
+
10
+ has_paper_trail
11
+ validates_lengths_from_database
12
+ if Enjoy::Gallery.config.localize
13
+ translates :name
14
+ end
15
+
16
+ scope :sorted, -> { order(lft: :asc) }
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,26 @@
1
+ module Enjoy::Gallery
2
+ module Models
3
+ module EmbeddedImage
4
+ if Enjoy::Gallery.mongoid?
5
+ extend ActiveSupport::Concern
6
+ include Enjoy::Gallery::Paperclipable
7
+
8
+ include Enjoy::Gallery.orm_specific('EmbeddedImage')
9
+
10
+ included do
11
+ enjoy_cms_attached_file(:image,
12
+ styles: lambda { |attachment| attachment.instance.image_styles }
13
+ )
14
+ end
15
+
16
+ def image_jcrop_options
17
+ {}
18
+ end
19
+
20
+ def image_styles
21
+ {}
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,36 @@
1
+ module Enjoy::Gallery
2
+ module Models
3
+ module Gallery
4
+ extend ActiveSupport::Concern
5
+ include Enjoy::Model
6
+ include ManualSlug
7
+ include Enjoy::Enableable
8
+ include Enjoy::Gallery::Paperclipable
9
+
10
+ include Enjoy::Gallery.orm_specific('Gallery')
11
+
12
+ included do
13
+ manual_slug :name
14
+
15
+ has_many :gallery_images, class_name: "Enjoy::Gallery::Image"
16
+ alias :images :gallery_images
17
+
18
+ acts_as_nested_set
19
+
20
+ enjoy_cms_attached_file(:image,
21
+ styles: lambda { |attachment| attachment.instance.image_styles }
22
+ )
23
+
24
+ # has_many :connected_objects, as: :enjoy_gallerable
25
+ end
26
+
27
+ def image_jcrop_options
28
+ {}
29
+ end
30
+
31
+ def image_styles
32
+ {}
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,30 @@
1
+ module Enjoy::Gallery
2
+ module Models
3
+ module Image
4
+ extend ActiveSupport::Concern
5
+ include Enjoy::Model
6
+ include Enjoy::Enableable
7
+ include Enjoy::Gallery::Paperclipable
8
+
9
+ include Enjoy::Gallery.orm_specific('Image')
10
+
11
+ included do
12
+ belongs_to :gallery, class_name: "Enjoy::Gallery::Gallery"
13
+
14
+ acts_as_nested_set
15
+
16
+ enjoy_cms_attached_file(:image,
17
+ styles: lambda { |attachment| attachment.instance.image_styles }
18
+ )
19
+ end
20
+
21
+ def image_jcrop_options
22
+ {}
23
+ end
24
+
25
+ def image_styles
26
+ {}
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,12 @@
1
+ module Enjoy::Gallery
2
+ module Models
3
+ module Mongoid
4
+ module EmbeddedImage
5
+ extend ActiveSupport::Concern
6
+
7
+ included do
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,19 @@
1
+ module Enjoy::Gallery
2
+ module Models
3
+ module Mongoid
4
+ module Gallery
5
+ extend ActiveSupport::Concern
6
+
7
+ included do
8
+ if defined?(RailsAdminComments)
9
+ include RailsAdminComments::Commentable
10
+ end
11
+ field :name, type: String, localize: Enjoy::Gallery.configuration.localize
12
+
13
+ scope :sorted, -> { order_by([:lft, :asc]) }
14
+ end
15
+
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,18 @@
1
+ module Enjoy::Gallery
2
+ module Models
3
+ module Mongoid
4
+ module Image
5
+ extend ActiveSupport::Concern
6
+
7
+ included do
8
+ if defined?(RailsAdminComments)
9
+ include RailsAdminComments::Commentable
10
+ end
11
+ field :name, type: String, localize: Enjoy::Gallery.configuration.localize
12
+
13
+ scope :sorted, -> { order_by([:lft, :asc]) }
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,5 @@
1
+ module Enjoy
2
+ module Gallery
3
+ VERSION = "0.4.0.beta1"
4
+ end
5
+ end
@@ -0,0 +1,68 @@
1
+ unless defined?(Enjoy) && Enjoy.respond_to?(:orm) && [:active_record, :mongoid].include?(Enjoy.orm)
2
+ puts "please use enjoy_cms_mongoid or enjoy_cms_activerecord"
3
+ puts "also: please use enjoy_cms_news_mongoid or enjoy_cms_news_activerecord and not enjoy_cms_news directly"
4
+ exit 1
5
+ end
6
+
7
+ require "enjoy/gallery/version"
8
+
9
+ # require 'enjoy_cms'
10
+
11
+ if Enjoy.mongoid?
12
+ require 'glebtv-mongoid-paperclip'
13
+ elsif Enjoy.active_record?
14
+ require 'paperclip'
15
+ end
16
+ require "image_optim"
17
+ require "paperclip-optimizer"
18
+
19
+ require "ack_rails_admin_jcrop"
20
+
21
+ require 'enjoy/gallery/configuration'
22
+ require 'enjoy/gallery/engine'
23
+
24
+
25
+ module Enjoy::Gallery
26
+ class << self
27
+ def orm
28
+ Enjoy.orm
29
+ end
30
+ def mongoid?
31
+ Enjoy::Gallery.orm == :mongoid
32
+ end
33
+ def active_record?
34
+ Enjoy::Gallery.orm == :active_record
35
+ end
36
+ def model_namespace
37
+ "Enjoy::Gallery::Models::#{Enjoy::Gallery.orm.to_s.camelize}"
38
+ end
39
+ def orm_specific(name)
40
+ "#{model_namespace}::#{name}".constantize
41
+ end
42
+ end
43
+
44
+ autoload :Admin, 'enjoy/gallery/admin'
45
+ module Admin
46
+ autoload :Gallery, 'enjoy/gallery/admin/gallery'
47
+ autoload :Image, 'enjoy/gallery/admin/image'
48
+ autoload :EmbeddedImage, 'enjoy/gallery/admin/embedded_image'
49
+ end
50
+
51
+ module Models
52
+ autoload :Gallery, 'enjoy/gallery/models/gallery'
53
+ autoload :Image, 'enjoy/gallery/models/image'
54
+ autoload :EmbeddedImage, 'enjoy/gallery/models/embedded_image'
55
+
56
+ module Mongoid
57
+ autoload :Gallery, 'enjoy/gallery/models/mongoid/gallery'
58
+ autoload :Image, 'enjoy/gallery/models/mongoid/image'
59
+ autoload :EmbeddedImage, 'enjoy/gallery/models/mongoid/embedded_image'
60
+ end
61
+
62
+ module ActiveRecord
63
+ autoload :Gallery, 'enjoy/gallery/models/active_record/gallery'
64
+ autoload :Image, 'enjoy/gallery/models/active_record/image'
65
+ end
66
+ end
67
+
68
+ end
@@ -0,0 +1,13 @@
1
+ require 'rails/generators'
2
+
3
+ module Enjoy::Gallery
4
+ class ConfigGenerator < Rails::Generators::Base
5
+ source_root File.expand_path('../templates', __FILE__)
6
+
7
+ desc 'Enjoy::Gallery Config generator'
8
+ def config
9
+ template 'enjoy_gallery.erb', "config/initializers/enjoy_gallery.rb"
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1,4 @@
1
+ Enjoy::Gallery.configure do |config|
2
+ ##### defaults #####
3
+ # config.localize = Enjoy.config.localize
4
+ end
@@ -0,0 +1,18 @@
1
+ require 'rails/generators'
2
+ require 'rails/generators/active_record'
3
+
4
+ module Enjoy::Gallery
5
+ class MigrationGenerator < Rails::Generators::Base
6
+ include ActiveRecord::Generators::Migration
7
+ source_root File.expand_path('../templates/migrations', __FILE__)
8
+
9
+ desc 'Enjoy Gallery migration generator'
10
+ def migration
11
+ if Enjoy.active_record?
12
+ %w(gallery).each do |table_name|
13
+ migration_template "migration_#{table_name}.rb", "db/migrate/enjoy_gallery_create_#{table_name}.rb"
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,51 @@
1
+ class EnjoyGalleryCreateGallery < ActiveRecord::Migration
2
+ def change
3
+ ########### c #################
4
+ create_table :enjoy_gallery_gallery_images do |t|
5
+ t.integer :gallery_id
6
+ t.integer :enjoy_gallery_imagable_id
7
+ t.string :enjoy_gallery_imagable_type
8
+
9
+ t.boolean :enabled, default: true, null: false
10
+
11
+ if Enjoy::Gallery.config.localize
12
+ t.column :name_translations, 'hstore', default: {}
13
+ else
14
+ t.string :name, null: false
15
+ end
16
+
17
+ t.attachment :image
18
+ t.timestamps
19
+ end
20
+
21
+ add_index :enjoy_gallery_gallery_images, [:enabled]
22
+ add_index :enjoy_gallery_gallery_images, [:gallery_id]
23
+ add_index :enjoy_gallery_gallery_images, [:enjoy_gallery_imagable_id, :enjoy_gallery_imagable_type]
24
+
25
+
26
+
27
+ ########### Galleries #################
28
+ create_table :enjoy_gallery_gallery do |t|
29
+ t.boolean :enabled, default: true, null: false
30
+
31
+ if Enjoy::Gallery.config.localize
32
+ t.column :name_translations, 'hstore', default: {}
33
+ else
34
+ t.string :name, null: false
35
+ end
36
+
37
+ t.integer :parent_id
38
+ t.integer :lft
39
+ t.integer :rgt
40
+ t.integer :depth
41
+
42
+ t.string :slug, null: false
43
+ t.attachment :image
44
+ t.timestamps
45
+ end
46
+
47
+ add_index :enjoy_gallery_galleries, :slug, unique: true
48
+ add_index :enjoy_gallery_galleries, [:enabled, :lft]
49
+
50
+ end
51
+ end
@@ -0,0 +1,48 @@
1
+ require 'rails/generators'
2
+
3
+ module Enjoy::Gallery::Models
4
+ class EmbeddedImageGenerator < Rails::Generators::Base
5
+ source_root File.expand_path('../templates', __FILE__)
6
+ argument :class_name, type: :string
7
+ argument :parent_class_name, type: :string
8
+
9
+ desc 'Enjoy::Gallery EmbeddedImage Model generator'
10
+ def embedded_image
11
+ template 'embedded_image.erb', "app/models/#{file_name}.rb"
12
+ end
13
+
14
+ private
15
+ def capitalized_class_name
16
+ class_name.capitalize
17
+ end
18
+
19
+ def camelcased_class_name
20
+ class_name.camelcase
21
+ end
22
+
23
+ def file_name
24
+ underscored_class_name
25
+ end
26
+
27
+ def underscored_class_name
28
+ camelcased_class_name.underscore
29
+ end
30
+
31
+ def underscored_pluralized_class_name
32
+ underscored_class_name.pluralize
33
+ end
34
+
35
+
36
+ def underscored_parent_class_name
37
+ parent_class_name.underscore
38
+ end
39
+
40
+ def camelcased_parent_class_name
41
+ parent_class_name.camelcase
42
+ end
43
+
44
+ def parent_class_name
45
+ parent_class_name_arg.blank? ? "SetParentClassForEmbeddedImage" : parent_class_name_arg
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,43 @@
1
+ require 'rails/generators'
2
+
3
+ module Enjoy::Gallery::Models
4
+ class ImageGenerator < Rails::Generators::Base
5
+ source_root File.expand_path('../templates', __FILE__)
6
+ argument :class_name, type: :string
7
+ argument :gallery_class_name_arg, type: :string, default: ""
8
+
9
+ desc 'Enjoy::Gallery Image Model generator'
10
+ def image
11
+ template 'image.erb', "app/models/#{file_name}.rb"
12
+ end
13
+
14
+ private
15
+ def capitalized_class_name
16
+ class_name.capitalize
17
+ end
18
+
19
+ def camelcased_class_name
20
+ class_name.camelcase
21
+ end
22
+
23
+ def file_name
24
+ underscored_class_name
25
+ end
26
+
27
+ def underscored_class_name
28
+ camelcased_class_name.underscore
29
+ end
30
+
31
+ def underscored_pluralized_class_name
32
+ underscored_class_name.pluralize
33
+ end
34
+
35
+ def camelcased_gallery_class_name
36
+ gallery_class_name.camelcase
37
+ end
38
+
39
+ def gallery_class_name
40
+ gallery_class_name_arg.blank? ? camelcased_class_name.sub(/Image$/i, "") : gallery_class_name_arg
41
+ end
42
+ end
43
+ end