comfy_gallery 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.travis.yml +2 -0
- data/Gemfile +10 -0
- data/LICENSE +20 -0
- data/README.md +29 -0
- data/Rakefile +21 -0
- data/VERSION +1 -0
- data/app/assets/images/sofa_gallery/jcrop.gif +0 -0
- data/app/assets/images/sofa_gallery/orbit/bullets.jpg +0 -0
- data/app/assets/images/sofa_gallery/orbit/left-arrow.png +0 -0
- data/app/assets/images/sofa_gallery/orbit/loading.gif +0 -0
- data/app/assets/images/sofa_gallery/orbit/mask-black.png +0 -0
- data/app/assets/images/sofa_gallery/orbit/pause-black.png +0 -0
- data/app/assets/images/sofa_gallery/orbit/right-arrow.png +0 -0
- data/app/assets/images/sofa_gallery/orbit/rotator-black.png +0 -0
- data/app/assets/images/sofa_gallery/orbit/timer-black.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/btnNext.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/btnPrevious.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/contentPattern.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/default_thumbnail.gif +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/loader.gif +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/sprite.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_square/btnNext.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_square/btnPrevious.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_square/contentPattern.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_square/default_thumbnail.gif +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_square/loader.gif +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_square/sprite.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/default/default_thumb.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/default/loader.gif +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/default/sprite.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/default/sprite_next.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/default/sprite_prev.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/default/sprite_x.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/default/sprite_y.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/facebook/btnNext.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/facebook/btnPrevious.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternBottom.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternLeft.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternRight.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternTop.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/facebook/default_thumbnail.gif +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/facebook/loader.gif +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/facebook/sprite.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/light_rounded/btnNext.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/light_rounded/btnPrevious.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/light_rounded/default_thumbnail.gif +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/light_rounded/loader.gif +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/light_rounded/sprite.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/light_square/btnNext.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/light_square/btnPrevious.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/light_square/default_thumbnail.gif +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/light_square/loader.gif +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/light_square/sprite.png +0 -0
- data/app/assets/javascripts/sofa_gallery/admin.js +72 -0
- data/app/assets/javascripts/sofa_gallery/application.js +15 -0
- data/app/assets/javascripts/sofa_gallery/jquery.jcrop.js +246 -0
- data/app/assets/javascripts/sofa_gallery/jquery.orbit-1.2.3.min.js +17 -0
- data/app/assets/javascripts/sofa_gallery/thumbnails.js +85 -0
- data/app/assets/stylesheets/comfy_gallery/admin.css +57 -0
- data/app/assets/stylesheets/comfy_gallery/application.css +67 -0
- data/app/assets/stylesheets/comfy_gallery/carousel.css.erb +208 -0
- data/app/assets/stylesheets/comfy_gallery/gallery_list.css +18 -0
- data/app/assets/stylesheets/comfy_gallery/jquery.jcrop.css +32 -0
- data/app/assets/stylesheets/comfy_gallery/reset.css +1 -0
- data/app/assets/stylesheets/comfy_gallery/thumbnails.css.erb +181 -0
- data/app/controllers/admin/gallery/base_controller.rb +3 -0
- data/app/controllers/admin/gallery/galleries_controller.rb +63 -0
- data/app/controllers/admin/gallery/photos_controller.rb +96 -0
- data/app/controllers/application_controller.rb +7 -0
- data/app/controllers/gallery/galleries_controller.rb +15 -0
- data/app/helpers/gallery/application_helper.rb +30 -0
- data/app/models/gallery/gallery.rb +19 -0
- data/app/models/gallery/photo.rb +78 -0
- data/app/views/admin/gallery/_html_head.html.erb +1 -0
- data/app/views/admin/gallery/_navigation.html.erb +5 -0
- data/app/views/admin/gallery/galleries/_form.html.erb +18 -0
- data/app/views/admin/gallery/galleries/edit.html.erb +5 -0
- data/app/views/admin/gallery/galleries/index.html.erb +40 -0
- data/app/views/admin/gallery/galleries/new.html.erb +5 -0
- data/app/views/admin/gallery/photos/_form.html.erb +16 -0
- data/app/views/admin/gallery/photos/crop.html.erb +64 -0
- data/app/views/admin/gallery/photos/edit.html.erb +5 -0
- data/app/views/admin/gallery/photos/index.html.erb +24 -0
- data/app/views/admin/gallery/photos/new.html.erb +5 -0
- data/app/views/gallery/_carousel.html.erb +31 -0
- data/app/views/gallery/_list_galleries.html.erb +26 -0
- data/app/views/gallery/_thumbnails.html.erb +26 -0
- data/app/views/gallery/galleries/index.html.erb +1 -0
- data/app/views/gallery/galleries/show.html.erb +7 -0
- data/app/views/layouts/gallery/application.html.erb +16 -0
- data/comfy_gallery.gemspec +177 -0
- data/config/application.rb +51 -0
- data/config/boot.rb +13 -0
- data/config/database.yml +16 -0
- data/config/environment.rb +5 -0
- data/config/environments/development.rb +25 -0
- data/config/environments/production.rb +52 -0
- data/config/environments/test.rb +39 -0
- data/config/initializers/comfy_gallery.rb +15 -0
- data/config/initializers/paperclip.rb +3 -0
- data/config/routes.rb +17 -0
- data/config.ru +4 -0
- data/db/migrate/01_create_comfy_gallery.rb +36 -0
- data/lib/comfy_gallery/configuration.rb +26 -0
- data/lib/comfy_gallery/engine.rb +22 -0
- data/lib/comfy_gallery/form_builder.rb +50 -0
- data/lib/comfy_gallery.rb +23 -0
- data/lib/generators/README +10 -0
- data/lib/generators/comfy_gallery_generator.rb +33 -0
- data/lib/paperclip_processors/cropper.rb +31 -0
- data/lib/tasks/comfy_gallery.rake +4 -0
- data/script/rails +6 -0
- data/sofa_gallery.gemspec +175 -0
- data/test/fixtures/files/default.jpg +0 -0
- data/test/fixtures/files/default.txt +1 -0
- data/test/fixtures/files/default2.jpg +0 -0
- data/test/fixtures/gallery/galleries.yml +11 -0
- data/test/fixtures/gallery/photos.yml +9 -0
- data/test/functional/admin/gallery/galleries_controller_test.rb +87 -0
- data/test/functional/admin/gallery/photos_controller_test.rb +234 -0
- data/test/functional/gallery/galleries_controller_test.rb +24 -0
- data/test/test_helper.rb +39 -0
- data/test/unit/configuration_test.rb +18 -0
- data/test/unit/gallery_test.rb +33 -0
- data/test/unit/photo_test.rb +33 -0
- metadata +233 -0
@@ -0,0 +1,36 @@
|
|
1
|
+
class CreateComfyGallery < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :gallery_galleries do |t|
|
4
|
+
t.string :title
|
5
|
+
t.string :slug
|
6
|
+
t.text :description
|
7
|
+
t.integer :full_width, :null => false, :default => 640
|
8
|
+
t.integer :full_height, :null => false, :default => 480
|
9
|
+
t.boolean :force_ratio_full, :null => false, :default => false
|
10
|
+
t.integer :thumb_width, :null => false, :default => 150
|
11
|
+
t.integer :thumb_height, :null => false, :default => 150
|
12
|
+
t.boolean :force_ratio_thumb, :null => false, :default => true
|
13
|
+
t.timestamps
|
14
|
+
end
|
15
|
+
add_index :gallery_galleries, :slug
|
16
|
+
|
17
|
+
create_table :gallery_photos do |t|
|
18
|
+
t.integer :gallery_id
|
19
|
+
t.string :title
|
20
|
+
t.string :slug
|
21
|
+
t.text :description
|
22
|
+
t.string :image_file_name
|
23
|
+
t.string :image_content_type
|
24
|
+
t.integer :image_file_size
|
25
|
+
t.integer :position, :null => false, :default => 0
|
26
|
+
t.timestamps
|
27
|
+
end
|
28
|
+
add_index :gallery_photos, [ :gallery_id, :position ]
|
29
|
+
add_index :gallery_photos, :slug
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.down
|
33
|
+
drop_table :gallery_photos
|
34
|
+
drop_table :gallery_galleries
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module ComfyGallery
|
2
|
+
class Configuration
|
3
|
+
|
4
|
+
# Paperclip upload settings for photos
|
5
|
+
attr_accessor :upload_options
|
6
|
+
|
7
|
+
# Default url to access admin area is http://yourhost/cms-admin/
|
8
|
+
# You can change 'cms-admin' to 'admin', for example.
|
9
|
+
attr_accessor :admin_route_prefix
|
10
|
+
|
11
|
+
# Controller that should be used for admin area
|
12
|
+
attr_accessor :admin_controller
|
13
|
+
|
14
|
+
# Form builder
|
15
|
+
attr_accessor :form_builder
|
16
|
+
|
17
|
+
# Configuration defaults
|
18
|
+
def initialize
|
19
|
+
@upload_options = { }
|
20
|
+
@admin_route_prefix = 'admin'
|
21
|
+
@admin_controller = 'ApplicationController'
|
22
|
+
@form_builder = 'ComfyGallery::FormBuilder'
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'comfy_gallery'
|
2
|
+
require 'rails'
|
3
|
+
require 'paperclip'
|
4
|
+
|
5
|
+
module ComfyGallery
|
6
|
+
class Engine < Rails::Engine
|
7
|
+
initializer 'comfy_gallery.helper' do |app|
|
8
|
+
if defined?(ComfortableMexicanSofa)
|
9
|
+
# applying configuraion
|
10
|
+
ComfyGallery.configure do |conf|
|
11
|
+
conf.admin_route_prefix = ComfortableMexicanSofa.config.admin_route_prefix
|
12
|
+
conf.upload_options = ComfortableMexicanSofa.config.upload_file_options
|
13
|
+
conf.admin_controller = 'CmsAdmin::BaseController'
|
14
|
+
conf.form_builder = 'ComfortableMexicanSofa::FormBuilder'
|
15
|
+
end
|
16
|
+
# applying nav elements
|
17
|
+
ComfortableMexicanSofa::ViewHooks.add(:navigation, '/admin/gallery/navigation')
|
18
|
+
ComfortableMexicanSofa::ViewHooks.add(:html_head, '/admin/gallery/html_head')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
class ComfyGallery::FormBuilder < ActionView::Helpers::FormBuilder
|
2
|
+
|
3
|
+
helpers = field_helpers -
|
4
|
+
%w(hidden_field fields_for) +
|
5
|
+
%w(select)
|
6
|
+
|
7
|
+
helpers.each do |name|
|
8
|
+
class_eval %Q^
|
9
|
+
def #{name}(field, *args)
|
10
|
+
options = args.extract_options!
|
11
|
+
args << options
|
12
|
+
return super if options.delete(:disable_builder)
|
13
|
+
default_field('#{name}', field, options){ super }
|
14
|
+
end
|
15
|
+
^
|
16
|
+
end
|
17
|
+
|
18
|
+
def default_field(type, field, options = {}, &block)
|
19
|
+
errors = if object.respond_to?(:errors) && object.errors[field].present?
|
20
|
+
"<div class='errors'>#{[object.errors[field]].flatten.first}</div>"
|
21
|
+
end
|
22
|
+
if desc = options.delete(:desc)
|
23
|
+
desc = "<div class='desc'>#{desc}</div>"
|
24
|
+
end
|
25
|
+
%(
|
26
|
+
<div class='form_element #{type}_element #{'errors' if errors}'>
|
27
|
+
<div class='label'>#{label_for(field, options)}</div>
|
28
|
+
<div class='value'>#{yield}</div>
|
29
|
+
#{desc}
|
30
|
+
#{errors}
|
31
|
+
</div>
|
32
|
+
).html_safe
|
33
|
+
end
|
34
|
+
|
35
|
+
def label_for(field, options)
|
36
|
+
label = options.delete(:label) || field.to_s.titleize.capitalize
|
37
|
+
"<label for=\"#{object_name}_#{field}\">#{label}</label>".html_safe
|
38
|
+
end
|
39
|
+
|
40
|
+
def simple_field(label = nil, content = nil, options = {}, &block)
|
41
|
+
content ||= @template.capture(&block) if block_given?
|
42
|
+
%(
|
43
|
+
<div class='form_element #{options.delete(:class)}'>
|
44
|
+
<div class='label'>#{label}</div>
|
45
|
+
<div class='value'>#{content}</div>
|
46
|
+
</div>
|
47
|
+
).html_safe
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Loading engine only if this is not a standalone installation
|
2
|
+
unless defined? ComfyGallery::Application
|
3
|
+
require File.expand_path('comfy_gallery/engine', File.dirname(__FILE__))
|
4
|
+
end
|
5
|
+
|
6
|
+
require File.expand_path('comfy_gallery/configuration', File.dirname(__FILE__))
|
7
|
+
require File.expand_path('comfy_gallery/form_builder', File.dirname(__FILE__))
|
8
|
+
require File.expand_path('paperclip_processors/cropper', File.dirname(__FILE__))
|
9
|
+
|
10
|
+
module ComfyGallery
|
11
|
+
class << self
|
12
|
+
|
13
|
+
def configure
|
14
|
+
yield configuration
|
15
|
+
end
|
16
|
+
|
17
|
+
def configuration
|
18
|
+
@configuration ||= Configuration.new
|
19
|
+
end
|
20
|
+
alias :config :configuration
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
____ __ ____ _ _
|
2
|
+
/ ___|___ _ __ ___ / _|_ _ / ___| __ _| | | ___ _ __ _ _
|
3
|
+
| | / _ \| '_ ` _ \| |_| | | | | _ / _` | | |/ _ \ '__| | | |
|
4
|
+
| |__| (_) | | | | | | _| |_| | |_| | (_| | | | __/ | | |_| |
|
5
|
+
\____\___/|_| |_| |_|_| \__, |\____|\__,_|_|_|\___|_| \__, |
|
6
|
+
|___/ |___/
|
7
|
+
|
8
|
+
Hey! Everything is almost done. Please don't forget to
|
9
|
+
|
10
|
+
* run migrations -> `rake db:migrate`
|
@@ -0,0 +1,33 @@
|
|
1
|
+
class ComfyGalleryGenerator < Rails::Generators::Base
|
2
|
+
|
3
|
+
require 'rails/generators/active_record'
|
4
|
+
include Rails::Generators::Migration
|
5
|
+
include Thor::Actions
|
6
|
+
|
7
|
+
source_root File.expand_path('../../..', __FILE__)
|
8
|
+
|
9
|
+
def generate_migration
|
10
|
+
destination = File.expand_path('db/migrate/01_create_comfy_gallery.rb', self.destination_root)
|
11
|
+
migration_dir = File.dirname(destination)
|
12
|
+
destination = self.class.migration_exists?(migration_dir, 'create_comfy_gallery')
|
13
|
+
|
14
|
+
if destination
|
15
|
+
puts "\e[0m\e[31mFound existing create_comfy_gallery.rb migration. Remove it if you want to regenerate.\e[0m"
|
16
|
+
else
|
17
|
+
migration_template 'db/migrate/01_create_comfy_gallery.rb', 'db/migrate/create_comfy_gallery.rb'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def generate_initialization
|
22
|
+
copy_file 'config/initializers/comfy_gallery.rb', 'config/initializers/comfy_gallery.rb'
|
23
|
+
end
|
24
|
+
|
25
|
+
def show_readme
|
26
|
+
readme 'lib/generators/README'
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.next_migration_number(dirname)
|
30
|
+
ActiveRecord::Generators::Base.next_migration_number(dirname)
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Paperclip
|
2
|
+
|
3
|
+
class Cropper < Thumbnail
|
4
|
+
def transformation_command
|
5
|
+
if crop_command
|
6
|
+
crop_command + super.join(' ').sub(/ -crop \S+/, '').split(' ')
|
7
|
+
else
|
8
|
+
super
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class ThumbCropper < Cropper
|
14
|
+
def crop_command
|
15
|
+
target = @attachment.instance
|
16
|
+
if target.cropping_thumb?
|
17
|
+
["-crop", "#{target.thumb_crop_w}x#{target.thumb_crop_h}+#{target.thumb_crop_x}+#{target.thumb_crop_y}"]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class FullCropper < Cropper
|
23
|
+
def crop_command
|
24
|
+
target = @attachment.instance
|
25
|
+
if target.cropping_full?
|
26
|
+
["-crop", "#{target.full_crop_w}x#{target.full_crop_h}+#{target.full_crop_x}+#{target.full_crop_y}"]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
data/script/rails
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
+
require File.expand_path('../../config/boot', __FILE__)
|
6
|
+
require 'rails/commands'
|
@@ -0,0 +1,175 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "sofa_gallery"
|
8
|
+
s.version = "0.0.6"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Oleg Khabarov", "Stephen McLeod", "The Working Group Inc."]
|
12
|
+
s.date = "2011-10-11"
|
13
|
+
s.description = ""
|
14
|
+
s.email = "stephen@theworkinggroup.ca"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.md"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".travis.yml",
|
22
|
+
"Gemfile",
|
23
|
+
"LICENSE",
|
24
|
+
"README.md",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"app/assets/images/sofa_gallery/jcrop.gif",
|
28
|
+
"app/assets/images/sofa_gallery/orbit/bullets.jpg",
|
29
|
+
"app/assets/images/sofa_gallery/orbit/left-arrow.png",
|
30
|
+
"app/assets/images/sofa_gallery/orbit/loading.gif",
|
31
|
+
"app/assets/images/sofa_gallery/orbit/mask-black.png",
|
32
|
+
"app/assets/images/sofa_gallery/orbit/pause-black.png",
|
33
|
+
"app/assets/images/sofa_gallery/orbit/right-arrow.png",
|
34
|
+
"app/assets/images/sofa_gallery/orbit/rotator-black.png",
|
35
|
+
"app/assets/images/sofa_gallery/orbit/timer-black.png",
|
36
|
+
"app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/btnNext.png",
|
37
|
+
"app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/btnPrevious.png",
|
38
|
+
"app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/contentPattern.png",
|
39
|
+
"app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/default_thumbnail.gif",
|
40
|
+
"app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/loader.gif",
|
41
|
+
"app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/sprite.png",
|
42
|
+
"app/assets/images/sofa_gallery/prettyPhoto/dark_square/btnNext.png",
|
43
|
+
"app/assets/images/sofa_gallery/prettyPhoto/dark_square/btnPrevious.png",
|
44
|
+
"app/assets/images/sofa_gallery/prettyPhoto/dark_square/contentPattern.png",
|
45
|
+
"app/assets/images/sofa_gallery/prettyPhoto/dark_square/default_thumbnail.gif",
|
46
|
+
"app/assets/images/sofa_gallery/prettyPhoto/dark_square/loader.gif",
|
47
|
+
"app/assets/images/sofa_gallery/prettyPhoto/dark_square/sprite.png",
|
48
|
+
"app/assets/images/sofa_gallery/prettyPhoto/default/default_thumb.png",
|
49
|
+
"app/assets/images/sofa_gallery/prettyPhoto/default/loader.gif",
|
50
|
+
"app/assets/images/sofa_gallery/prettyPhoto/default/sprite.png",
|
51
|
+
"app/assets/images/sofa_gallery/prettyPhoto/default/sprite_next.png",
|
52
|
+
"app/assets/images/sofa_gallery/prettyPhoto/default/sprite_prev.png",
|
53
|
+
"app/assets/images/sofa_gallery/prettyPhoto/default/sprite_x.png",
|
54
|
+
"app/assets/images/sofa_gallery/prettyPhoto/default/sprite_y.png",
|
55
|
+
"app/assets/images/sofa_gallery/prettyPhoto/facebook/btnNext.png",
|
56
|
+
"app/assets/images/sofa_gallery/prettyPhoto/facebook/btnPrevious.png",
|
57
|
+
"app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternBottom.png",
|
58
|
+
"app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternLeft.png",
|
59
|
+
"app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternRight.png",
|
60
|
+
"app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternTop.png",
|
61
|
+
"app/assets/images/sofa_gallery/prettyPhoto/facebook/default_thumbnail.gif",
|
62
|
+
"app/assets/images/sofa_gallery/prettyPhoto/facebook/loader.gif",
|
63
|
+
"app/assets/images/sofa_gallery/prettyPhoto/facebook/sprite.png",
|
64
|
+
"app/assets/images/sofa_gallery/prettyPhoto/light_rounded/btnNext.png",
|
65
|
+
"app/assets/images/sofa_gallery/prettyPhoto/light_rounded/btnPrevious.png",
|
66
|
+
"app/assets/images/sofa_gallery/prettyPhoto/light_rounded/default_thumbnail.gif",
|
67
|
+
"app/assets/images/sofa_gallery/prettyPhoto/light_rounded/loader.gif",
|
68
|
+
"app/assets/images/sofa_gallery/prettyPhoto/light_rounded/sprite.png",
|
69
|
+
"app/assets/images/sofa_gallery/prettyPhoto/light_square/btnNext.png",
|
70
|
+
"app/assets/images/sofa_gallery/prettyPhoto/light_square/btnPrevious.png",
|
71
|
+
"app/assets/images/sofa_gallery/prettyPhoto/light_square/default_thumbnail.gif",
|
72
|
+
"app/assets/images/sofa_gallery/prettyPhoto/light_square/loader.gif",
|
73
|
+
"app/assets/images/sofa_gallery/prettyPhoto/light_square/sprite.png",
|
74
|
+
"app/assets/javascripts/sofa_gallery/admin.js",
|
75
|
+
"app/assets/javascripts/sofa_gallery/application.js",
|
76
|
+
"app/assets/javascripts/sofa_gallery/jquery.jcrop.js",
|
77
|
+
"app/assets/javascripts/sofa_gallery/jquery.orbit-1.2.3.min.js",
|
78
|
+
"app/assets/javascripts/sofa_gallery/thumbnails.js",
|
79
|
+
"app/assets/stylesheets/sofa_gallery/admin.css",
|
80
|
+
"app/assets/stylesheets/sofa_gallery/application.css",
|
81
|
+
"app/assets/stylesheets/sofa_gallery/carousel.css.erb",
|
82
|
+
"app/assets/stylesheets/sofa_gallery/gallery_list.css",
|
83
|
+
"app/assets/stylesheets/sofa_gallery/jquery.jcrop.css",
|
84
|
+
"app/assets/stylesheets/sofa_gallery/reset.css",
|
85
|
+
"app/assets/stylesheets/sofa_gallery/thumbnails.css.erb",
|
86
|
+
"app/controllers/application_controller.rb",
|
87
|
+
"app/controllers/sofa_gallery/admin/base_controller.rb",
|
88
|
+
"app/controllers/sofa_gallery/admin/galleries_controller.rb",
|
89
|
+
"app/controllers/sofa_gallery/admin/photos_controller.rb",
|
90
|
+
"app/controllers/sofa_gallery/galleries_controller.rb",
|
91
|
+
"app/helpers/sofa_gallery_helper.rb",
|
92
|
+
"app/models/sofa_gallery/gallery.rb",
|
93
|
+
"app/models/sofa_gallery/photo.rb",
|
94
|
+
"app/views/layouts/gallery_admin/application.html.erb",
|
95
|
+
"app/views/sofa_gallery/_carousel.html.erb",
|
96
|
+
"app/views/sofa_gallery/_list_galleries.html.erb",
|
97
|
+
"app/views/sofa_gallery/_thumbnails.html.erb",
|
98
|
+
"app/views/sofa_gallery/admin/_html_head.html.erb",
|
99
|
+
"app/views/sofa_gallery/admin/_navigation.html.erb",
|
100
|
+
"app/views/sofa_gallery/admin/galleries/_form.html.erb",
|
101
|
+
"app/views/sofa_gallery/admin/galleries/edit.html.erb",
|
102
|
+
"app/views/sofa_gallery/admin/galleries/index.html.erb",
|
103
|
+
"app/views/sofa_gallery/admin/galleries/new.html.erb",
|
104
|
+
"app/views/sofa_gallery/admin/photos/_form.html.erb",
|
105
|
+
"app/views/sofa_gallery/admin/photos/crop.html.erb",
|
106
|
+
"app/views/sofa_gallery/admin/photos/edit.html.erb",
|
107
|
+
"app/views/sofa_gallery/admin/photos/index.html.erb",
|
108
|
+
"app/views/sofa_gallery/admin/photos/new.html.erb",
|
109
|
+
"app/views/sofa_gallery/galleries/index.html.erb",
|
110
|
+
"app/views/sofa_gallery/galleries/show.html.erb",
|
111
|
+
"config.ru",
|
112
|
+
"config/application.rb",
|
113
|
+
"config/boot.rb",
|
114
|
+
"config/database.yml",
|
115
|
+
"config/environment.rb",
|
116
|
+
"config/environments/development.rb",
|
117
|
+
"config/environments/production.rb",
|
118
|
+
"config/environments/test.rb",
|
119
|
+
"config/initializers/paperclip.rb",
|
120
|
+
"config/initializers/sofa_gallery.rb",
|
121
|
+
"config/routes.rb",
|
122
|
+
"db/migrate/01_create_sofa_gallery.rb",
|
123
|
+
"lib/generators/README",
|
124
|
+
"lib/generators/sofa_gallery_generator.rb",
|
125
|
+
"lib/paperclip_processors/cropper.rb",
|
126
|
+
"lib/sofa_gallery.rb",
|
127
|
+
"lib/sofa_gallery/configuration.rb",
|
128
|
+
"lib/sofa_gallery/engine.rb",
|
129
|
+
"lib/sofa_gallery/form_builder.rb",
|
130
|
+
"script/rails",
|
131
|
+
"sofa_gallery.gemspec",
|
132
|
+
"test/fixtures/files/default.jpg",
|
133
|
+
"test/fixtures/files/default.txt",
|
134
|
+
"test/fixtures/files/default2.jpg",
|
135
|
+
"test/fixtures/sofa_gallery/galleries.yml",
|
136
|
+
"test/fixtures/sofa_gallery/photos.yml",
|
137
|
+
"test/functional/admin/galleries_controller_test.rb",
|
138
|
+
"test/functional/admin/photos_controller_test.rb",
|
139
|
+
"test/functional/galleries_controller_test.rb",
|
140
|
+
"test/test_helper.rb",
|
141
|
+
"test/unit/configuration_test.rb",
|
142
|
+
"test/unit/gallery_test.rb",
|
143
|
+
"test/unit/photo_test.rb"
|
144
|
+
]
|
145
|
+
s.homepage = "http://github.com/twg/sofa-gallery"
|
146
|
+
s.licenses = ["MIT"]
|
147
|
+
s.require_paths = ["lib"]
|
148
|
+
s.rubygems_version = "1.8.10"
|
149
|
+
s.summary = "SofaGallery is an image gallery engine for Rails 3.1 apps (and ComfortableMexicanSofa)"
|
150
|
+
|
151
|
+
if s.respond_to? :specification_version then
|
152
|
+
s.specification_version = 3
|
153
|
+
|
154
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
155
|
+
s.add_runtime_dependency(%q<rails>, [">= 3.1.0"])
|
156
|
+
s.add_runtime_dependency(%q<paperclip>, ["~> 2.3.0"])
|
157
|
+
s.add_runtime_dependency(%q<jquery-rails>, [">= 1.0.14"])
|
158
|
+
s.add_development_dependency(%q<sqlite3>, [">= 0"])
|
159
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
160
|
+
else
|
161
|
+
s.add_dependency(%q<rails>, [">= 3.1.0"])
|
162
|
+
s.add_dependency(%q<paperclip>, ["~> 2.3.0"])
|
163
|
+
s.add_dependency(%q<jquery-rails>, [">= 1.0.14"])
|
164
|
+
s.add_dependency(%q<sqlite3>, [">= 0"])
|
165
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
166
|
+
end
|
167
|
+
else
|
168
|
+
s.add_dependency(%q<rails>, [">= 3.1.0"])
|
169
|
+
s.add_dependency(%q<paperclip>, ["~> 2.3.0"])
|
170
|
+
s.add_dependency(%q<jquery-rails>, [">= 1.0.14"])
|
171
|
+
s.add_dependency(%q<sqlite3>, [">= 0"])
|
172
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
text file
|
Binary file
|
@@ -0,0 +1,87 @@
|
|
1
|
+
require File.expand_path('../../../test_helper', File.dirname(__FILE__))
|
2
|
+
|
3
|
+
class Admin::Gallery::GalleriesControllerTest < ActionController::TestCase
|
4
|
+
|
5
|
+
def test_get_index
|
6
|
+
get :index
|
7
|
+
assert_response :success
|
8
|
+
assert_template 'index'
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_get_new
|
12
|
+
get :new
|
13
|
+
assert_response :success
|
14
|
+
assert_template 'new'
|
15
|
+
assert assigns(:gallery)
|
16
|
+
assert_select "form[action='/admin/gallery/galleries']"
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_creation
|
20
|
+
assert_difference 'Gallery::Gallery.count', 1 do
|
21
|
+
post :create, :gallery => {
|
22
|
+
:title => 'Test Gallery',
|
23
|
+
:slug => 'test-gallery',
|
24
|
+
:description => 'Test Description'
|
25
|
+
}
|
26
|
+
end
|
27
|
+
assert_equal 'Gallery created', flash[:notice]
|
28
|
+
assert_redirected_to :action => :index
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_creation_failure
|
32
|
+
assert_no_difference 'Gallery::Gallery.count' do
|
33
|
+
post :create, :gallery => { }
|
34
|
+
end
|
35
|
+
assert_response :success
|
36
|
+
assert_template 'new'
|
37
|
+
assert_equal 'Failed to create Gallery', flash[:error]
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_get_edit
|
41
|
+
gallery = gallery_galleries(:default)
|
42
|
+
get :edit, :id => gallery
|
43
|
+
assert_response :success
|
44
|
+
assert_template 'edit'
|
45
|
+
assert assigns(:gallery)
|
46
|
+
assert_select "form[action='/admin/gallery/galleries/#{gallery.id}']"
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_get_edit_failure
|
50
|
+
get :edit, :id => 'invalid'
|
51
|
+
assert_response :redirect
|
52
|
+
assert_redirected_to :action => :index
|
53
|
+
assert_equal 'Gallery not found', flash[:error]
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_update
|
57
|
+
gallery = gallery_galleries(:default)
|
58
|
+
put :update, :id => gallery, :gallery => {
|
59
|
+
:title => 'New Title'
|
60
|
+
}
|
61
|
+
gallery.reload
|
62
|
+
assert_equal 'New Title', gallery.title
|
63
|
+
assert_equal 'Gallery updated', flash[:notice]
|
64
|
+
assert_redirected_to :action => :index
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_update_failure
|
68
|
+
gallery = gallery_galleries(:default)
|
69
|
+
put :update, :id => gallery, :gallery => {
|
70
|
+
:title => ''
|
71
|
+
}
|
72
|
+
assert_response :success
|
73
|
+
assert_template 'edit'
|
74
|
+
assert_equal 'Failed to update Gallery', flash[:error]
|
75
|
+
gallery.reload
|
76
|
+
assert_not_equal '', gallery.title
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_destroy
|
80
|
+
assert_difference 'Gallery::Gallery.count', -1 do
|
81
|
+
delete :destroy, :id => gallery_galleries(:default)
|
82
|
+
end
|
83
|
+
assert_equal 'Gallery deleted', flash[:notice]
|
84
|
+
assert_redirected_to :action => :index
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|