sofa_gallery 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +4 -2
- data/Gemfile.lock +67 -61
- data/VERSION +1 -1
- 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/carousel.js +44 -0
- data/app/assets/javascripts/sofa_gallery/thumbnails.js +85 -0
- data/app/assets/stylesheets/sofa_gallery/admin.css +13 -0
- data/app/assets/stylesheets/sofa_gallery/application.css +0 -1
- data/app/assets/stylesheets/sofa_gallery/carousel.css +186 -0
- data/app/assets/stylesheets/sofa_gallery/tango/credits.txt +1 -0
- data/app/assets/stylesheets/sofa_gallery/tango/next-horizontal.png +0 -0
- data/app/assets/stylesheets/sofa_gallery/tango/next-vertical.png +0 -0
- data/app/assets/stylesheets/sofa_gallery/tango/prev-horizontal.png +0 -0
- data/app/assets/stylesheets/sofa_gallery/tango/prev-vertical.png +0 -0
- data/app/assets/stylesheets/sofa_gallery/thumbnails.css.scss +182 -0
- data/app/controllers/application_controller.rb +1 -0
- data/app/controllers/sofa_gallery/admin/base_controller.rb +3 -0
- data/app/controllers/{gallery_admin → sofa_gallery/admin}/galleries_controller.rb +4 -4
- data/app/controllers/{gallery_admin → sofa_gallery/admin}/photos_controller.rb +6 -6
- data/app/controllers/sofa_gallery/galleries_controller.rb +9 -0
- data/app/helpers/sofa_gallery_helper.rb +11 -1
- data/app/models/{sofa → sofa_gallery}/gallery.rb +2 -2
- data/app/models/{sofa → sofa_gallery}/photo.rb +18 -9
- data/app/views/layouts/gallery_admin/application.html.erb +2 -2
- data/app/views/sofa_gallery/_carousel.html.erb +17 -0
- data/app/views/sofa_gallery/_thumbnails.html.erb +19 -0
- data/app/views/sofa_gallery/admin/_html_head.html.erb +1 -0
- data/app/views/sofa_gallery/admin/_navigation.html.erb +5 -0
- data/app/views/sofa_gallery/admin/galleries/_form.html.erb +17 -0
- data/app/views/sofa_gallery/admin/galleries/edit.html.erb +5 -0
- data/app/views/sofa_gallery/admin/galleries/index.html.erb +48 -0
- data/app/views/sofa_gallery/admin/galleries/new.html.erb +5 -0
- data/app/views/sofa_gallery/admin/photos/_form.html.erb +16 -0
- data/app/views/sofa_gallery/admin/photos/crop.html.erb +64 -0
- data/app/views/sofa_gallery/admin/photos/edit.html.erb +5 -0
- data/app/views/{gallery_admin → sofa_gallery/admin}/photos/index.html.erb +4 -4
- data/app/views/sofa_gallery/admin/photos/new.html.erb +5 -0
- data/app/views/sofa_gallery/galleries/show.html.erb +1 -0
- data/config/routes.rb +12 -7
- data/db/migrate/01_create_sofa_gallery.rb +15 -12
- data/lib/paperclip_processors/cropper.rb +16 -3
- data/lib/sofa_gallery/configuration.rb +4 -4
- data/lib/sofa_gallery/engine.rb +2 -1
- data/sofa_gallery.gemspec +89 -30
- data/test/fixtures/files/default2.jpg +0 -0
- data/test/fixtures/{sofa → sofa_gallery}/galleries.yml +4 -2
- data/test/fixtures/{sofa → sofa_gallery}/photos.yml +0 -0
- data/test/functional/admin/galleries_controller_test.rb +87 -0
- data/test/functional/admin/photos_controller_test.rb +177 -0
- data/test/functional/galleries_controller_test.rb +8 -78
- data/test/test_helper.rb +4 -1
- data/test/unit/configuration_test.rb +1 -1
- data/test/unit/gallery_test.rb +6 -6
- data/test/unit/photo_test.rb +5 -5
- metadata +150 -79
- data/app/assets/javascripts/sofa_gallery/jquery.js +0 -18
- data/app/assets/javascripts/sofa_gallery/jquery_ui.js +0 -248
- data/app/assets/javascripts/sofa_gallery/rails.js +0 -315
- data/app/controllers/gallery_admin/base_controller.rb +0 -3
- data/app/views/gallery_admin/_navigation.html.erb +0 -1
- data/app/views/gallery_admin/galleries/_form.html.erb +0 -11
- data/app/views/gallery_admin/galleries/edit.html.erb +0 -5
- data/app/views/gallery_admin/galleries/index.html.erb +0 -28
- data/app/views/gallery_admin/galleries/new.html.erb +0 -5
- data/app/views/gallery_admin/photos/_form.html.erb +0 -13
- data/app/views/gallery_admin/photos/crop.html.erb +0 -32
- data/app/views/gallery_admin/photos/edit.html.erb +0 -5
- data/app/views/gallery_admin/photos/new.html.erb +0 -5
- data/test/functional/photos_controller_test.rb +0 -123
@@ -0,0 +1,48 @@
|
|
1
|
+
<%= link_to 'Add new gallery', new_sofa_gallery_admin_gallery_path, :class => 'big button' %>
|
2
|
+
|
3
|
+
<h1>Galleries</h1>
|
4
|
+
|
5
|
+
<table class='formatted'>
|
6
|
+
<tr>
|
7
|
+
<th>
|
8
|
+
Name
|
9
|
+
</th>
|
10
|
+
<th>
|
11
|
+
Preview
|
12
|
+
</th>
|
13
|
+
<th>
|
14
|
+
URL
|
15
|
+
</th>
|
16
|
+
<th>
|
17
|
+
Embed Code
|
18
|
+
</th>
|
19
|
+
<th>
|
20
|
+
Actions
|
21
|
+
</th>
|
22
|
+
</tr>
|
23
|
+
<% @galleries.each do |gallery| %>
|
24
|
+
<tr>
|
25
|
+
<td>
|
26
|
+
<div class='title'>
|
27
|
+
<%= link_to gallery.title, sofa_gallery_admin_gallery_photos_path(gallery) %>
|
28
|
+
</div>
|
29
|
+
</td>
|
30
|
+
<td class='main'>
|
31
|
+
<% gallery.photos.limit(4).each do |photo| %>
|
32
|
+
<%= image_tag(photo.image.url(:admin_thumb)) %>
|
33
|
+
<% end %>
|
34
|
+
</td>
|
35
|
+
<td>
|
36
|
+
<%= link_to sofa_gallery_gallery_path(gallery), sofa_gallery_gallery_path(gallery), :target => '_blank' %>
|
37
|
+
</td>
|
38
|
+
<td>
|
39
|
+
{{ cms:helper:render_gallery:<%= gallery.slug %> }}
|
40
|
+
</td>
|
41
|
+
<td class='action_links'>
|
42
|
+
<%= link_to 'Show Photos', sofa_gallery_admin_gallery_photos_path(gallery) %>
|
43
|
+
<%= link_to 'Edit', edit_sofa_gallery_admin_gallery_path(gallery) %>
|
44
|
+
<%= link_to 'Delete', sofa_gallery_admin_gallery_path(gallery), :method => :delete, :confirm => 'Are you sure?' %>
|
45
|
+
</td>
|
46
|
+
</tr>
|
47
|
+
<% end %>
|
48
|
+
</table>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<%= form.text_field :title, :id => (@photo.new_record?? 'slugify' : nil) %>
|
2
|
+
<%= form.text_field :slug, :id => 'slug' %>
|
3
|
+
<% if @photo.image? %>
|
4
|
+
<%= form.simple_field 'Current Image' do %>
|
5
|
+
<%= image_tag(@photo.image.url(:thumb)) %>
|
6
|
+
<br/>
|
7
|
+
<%= link_to 'Crop Image', crop_sofa_gallery_admin_gallery_photo_path(@gallery, @photo) %>
|
8
|
+
<% end %>
|
9
|
+
<% end %>
|
10
|
+
<%= form.file_field :image %>
|
11
|
+
<%= form.text_area :description %>
|
12
|
+
<%= form.simple_field nil, nil, :class => 'submit_element' do %>
|
13
|
+
<%= link_to "Cancel", sofa_gallery_admin_gallery_photos_path(@photo.gallery), :id => 'cancel_btn' %>
|
14
|
+
<span>or</span>
|
15
|
+
<%= form.submit "Save", :disable_builder => true%>
|
16
|
+
<% end %>
|
@@ -0,0 +1,64 @@
|
|
1
|
+
<% content_for :head do %>
|
2
|
+
<%= stylesheet_link_tag 'sofa_gallery/jquery.jcrop.css' %>
|
3
|
+
<%= javascript_include_tag 'sofa_gallery/jquery.jcrop.js' %>
|
4
|
+
<script type="text/javascript" charset="utf-8">
|
5
|
+
$(function(){
|
6
|
+
$('#crop_full').Jcrop({
|
7
|
+
onChange: update_full_crop,
|
8
|
+
onSelect: update_full_crop,
|
9
|
+
aspectRatio: <%= @photo.gallery.force_ratio_full?? (@photo.gallery.full_width.to_f / @photo.gallery.full_height) : 'null' %>
|
10
|
+
});
|
11
|
+
|
12
|
+
$('#crop_thumb').Jcrop({
|
13
|
+
onChange: update_thumb_crop,
|
14
|
+
onSelect: update_thumb_crop,
|
15
|
+
aspectRatio: <%= @photo.gallery.force_ratio_thumb?? (@photo.gallery.thumb_width.to_f / @photo.gallery.thumb_height) : 'null' %>
|
16
|
+
});
|
17
|
+
});
|
18
|
+
|
19
|
+
|
20
|
+
function update_full_crop(coords) {
|
21
|
+
var ratio = <%= @photo.image_geometry(:original).width %> / <%= @photo.image_geometry(:admin_full).width %>;
|
22
|
+
$('#full_crop_x').val(coords.x * ratio);
|
23
|
+
$('#full_crop_y').val(coords.y * ratio);
|
24
|
+
$('#full_crop_w').val(coords.w * ratio);
|
25
|
+
$('#full_crop_h').val(coords.h * ratio);
|
26
|
+
}
|
27
|
+
|
28
|
+
function update_thumb_crop(coords) {
|
29
|
+
var ratio = <%= @photo.image_geometry(:original).width %> / <%= @photo.image_geometry(:admin_full).width %>;
|
30
|
+
$('#thumb_crop_x').val(coords.x * ratio);
|
31
|
+
$('#thumb_crop_y').val(coords.y * ratio);
|
32
|
+
$('#thumb_crop_w').val(coords.w * ratio);
|
33
|
+
$('#thumb_crop_h').val(coords.h * ratio);
|
34
|
+
}
|
35
|
+
</script>
|
36
|
+
<% end %>
|
37
|
+
|
38
|
+
<h1> Crop Photo </h1>
|
39
|
+
|
40
|
+
<%= sofa_gallery_form_for @photo, :as => :photo, :url => { :action => :update } do |form| %>
|
41
|
+
|
42
|
+
<% if @photo.gallery.force_ratio_full? %>
|
43
|
+
<%= form.simple_field 'Full Size' do %>
|
44
|
+
<%= image_tag @photo.image.url(:admin_full), :id => 'crop_full' %>
|
45
|
+
<% end %>
|
46
|
+
<% end %>
|
47
|
+
<br />
|
48
|
+
<% if @photo.gallery.force_ratio_thumb? %>
|
49
|
+
<%= form.simple_field 'Thumbnail' do %>
|
50
|
+
<%= image_tag @photo.image.url(:admin_full), :id => 'crop_thumb' %>
|
51
|
+
<% end %>
|
52
|
+
<% end %>
|
53
|
+
|
54
|
+
|
55
|
+
<% [:full_crop_x, :full_crop_y, :full_crop_w, :full_crop_h].each do |attr| %>
|
56
|
+
<%= form.hidden_field attr, :id => attr %>
|
57
|
+
<% end %>
|
58
|
+
|
59
|
+
<% [:thumb_crop_x, :thumb_crop_y, :thumb_crop_w, :thumb_crop_h].each do |attr| %>
|
60
|
+
<%= form.hidden_field attr, :id => attr %>
|
61
|
+
<% end %>
|
62
|
+
|
63
|
+
<%= form.submit 'Crop' %>
|
64
|
+
<% end %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= link_to 'Add new photo',
|
1
|
+
<%= link_to 'Add new photo', new_sofa_gallery_admin_gallery_photo_path(@gallery), :class => 'big button' %>
|
2
2
|
|
3
3
|
<h1>Photos in <%=@gallery.title%></h1>
|
4
4
|
|
@@ -14,9 +14,9 @@
|
|
14
14
|
<div class='sublabel'><%= photo.slug %></div>
|
15
15
|
</td>
|
16
16
|
<td class='action_links'>
|
17
|
-
<%= link_to 'Crop',
|
18
|
-
<%= link_to 'Edit',
|
19
|
-
<%= link_to 'Delete',
|
17
|
+
<%= link_to 'Crop', crop_sofa_gallery_admin_gallery_photo_path(@gallery, photo) %>
|
18
|
+
<%= link_to 'Edit', edit_sofa_gallery_admin_gallery_photo_path(@gallery, photo) %>
|
19
|
+
<%= link_to 'Delete', sofa_gallery_admin_gallery_photo_path(@gallery, photo), :method => :delete, :confirm => 'Are you sure?' %>
|
20
20
|
</td>
|
21
21
|
</tr>
|
22
22
|
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render :partial => 'sofa_gallery/thumbnails' %>
|
data/config/routes.rb
CHANGED
@@ -1,12 +1,17 @@
|
|
1
1
|
Rails.application.routes.draw do
|
2
2
|
|
3
|
-
namespace :
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
namespace :sofa_gallery, :path => '' do
|
4
|
+
|
5
|
+
resources :galleries, :only => :show
|
6
|
+
|
7
|
+
namespace :admin, :path => SofaGallery.config.admin_route_prefix do
|
8
|
+
resources :galleries do
|
9
|
+
resources :photos do
|
10
|
+
put :reorder, :on => :collection
|
11
|
+
get :crop, :on => :member
|
12
|
+
end
|
8
13
|
end
|
9
|
-
end
|
10
|
-
end
|
14
|
+
end unless SofaGallery.config.admin_route_prefix.blank?
|
15
|
+
end
|
11
16
|
|
12
17
|
end
|
@@ -1,19 +1,22 @@
|
|
1
1
|
class CreateSofaGallery < ActiveRecord::Migration
|
2
2
|
def self.up
|
3
|
-
create_table :
|
3
|
+
create_table :sofa_gallery_galleries do |t|
|
4
4
|
t.string :title
|
5
5
|
t.string :slug
|
6
6
|
t.text :description
|
7
|
-
t.integer :
|
8
|
-
t.integer :
|
9
|
-
t.integer :
|
10
|
-
t.integer :
|
11
|
-
t.boolean :
|
7
|
+
t.integer :gallery_width, :null => false, :default => 640
|
8
|
+
t.integer :full_width, :null => false, :default => 600
|
9
|
+
t.integer :full_width, :null => false, :default => 600
|
10
|
+
t.integer :full_height, :null => false, :default => 450
|
11
|
+
t.boolean :force_ratio_full, :null => false, :default => false
|
12
|
+
t.integer :thumb_width, :null => false, :default => 150
|
13
|
+
t.integer :thumb_height, :null => false, :default => 150
|
14
|
+
t.boolean :force_ratio_thumb, :null => false, :default => true
|
12
15
|
t.timestamps
|
13
16
|
end
|
14
|
-
add_index :
|
17
|
+
add_index :sofa_gallery_galleries, :slug
|
15
18
|
|
16
|
-
create_table :
|
19
|
+
create_table :sofa_gallery_photos do |t|
|
17
20
|
t.integer :gallery_id
|
18
21
|
t.string :title
|
19
22
|
t.string :slug
|
@@ -24,12 +27,12 @@ class CreateSofaGallery < ActiveRecord::Migration
|
|
24
27
|
t.integer :position, :null => false, :default => 0
|
25
28
|
t.timestamps
|
26
29
|
end
|
27
|
-
add_index :
|
28
|
-
add_index :
|
30
|
+
add_index :sofa_gallery_photos, [ :gallery_id, :position ]
|
31
|
+
add_index :sofa_gallery_photos, :slug
|
29
32
|
end
|
30
33
|
|
31
34
|
def self.down
|
32
|
-
drop_table :
|
33
|
-
drop_table :
|
35
|
+
drop_table :sofa_gallery_photos
|
36
|
+
drop_table :sofa_gallery_galleries
|
34
37
|
end
|
35
38
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
module Paperclip
|
2
|
+
|
2
3
|
class Cropper < Thumbnail
|
3
4
|
def transformation_command
|
4
5
|
if crop_command
|
@@ -7,12 +8,24 @@ module Paperclip
|
|
7
8
|
super
|
8
9
|
end
|
9
10
|
end
|
10
|
-
|
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
|
11
23
|
def crop_command
|
12
24
|
target = @attachment.instance
|
13
|
-
if target.
|
14
|
-
["-crop", "#{target.
|
25
|
+
if target.cropping_full?
|
26
|
+
["-crop", "#{target.full_crop_w}x#{target.full_crop_h}+#{target.full_crop_x}+#{target.full_crop_y}"]
|
15
27
|
end
|
16
28
|
end
|
17
29
|
end
|
30
|
+
|
18
31
|
end
|
@@ -16,10 +16,10 @@ module SofaGallery
|
|
16
16
|
|
17
17
|
# Configuration defaults
|
18
18
|
def initialize
|
19
|
-
@
|
20
|
-
@admin_route_prefix
|
21
|
-
@admin_controller
|
22
|
-
@form_builder
|
19
|
+
@upload_options = { }
|
20
|
+
@admin_route_prefix = 'admin'
|
21
|
+
@admin_controller = 'ApplicationController'
|
22
|
+
@form_builder = 'SofaGallery::FormBuilder'
|
23
23
|
end
|
24
24
|
|
25
25
|
end
|
data/lib/sofa_gallery/engine.rb
CHANGED
@@ -14,7 +14,8 @@ module CmsGallery
|
|
14
14
|
conf.form_builder = 'ComfortableMexicanSofa::FormBuilder'
|
15
15
|
end
|
16
16
|
# applying nav elements
|
17
|
-
ComfortableMexicanSofa::ViewHooks.add(:navigation, '/
|
17
|
+
ComfortableMexicanSofa::ViewHooks.add(:navigation, '/sofa_gallery/admin/navigation')
|
18
|
+
ComfortableMexicanSofa::ViewHooks.add(:html_head, '/sofa_gallery/admin/html_head')
|
18
19
|
end
|
19
20
|
end
|
20
21
|
end
|
data/sofa_gallery.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{sofa_gallery}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Oleg Khabarov", "Stephen McLeod", "The Working Group Inc."]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-09-20}
|
13
13
|
s.description = %q{}
|
14
14
|
s.email = %q{stephen@theworkinggroup.ca}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -25,32 +25,83 @@ Gem::Specification.new do |s|
|
|
25
25
|
"Rakefile",
|
26
26
|
"VERSION",
|
27
27
|
"app/assets/images/sofa_gallery/jcrop.gif",
|
28
|
+
"app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/btnNext.png",
|
29
|
+
"app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/btnPrevious.png",
|
30
|
+
"app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/contentPattern.png",
|
31
|
+
"app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/default_thumbnail.gif",
|
32
|
+
"app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/loader.gif",
|
33
|
+
"app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/sprite.png",
|
34
|
+
"app/assets/images/sofa_gallery/prettyPhoto/dark_square/btnNext.png",
|
35
|
+
"app/assets/images/sofa_gallery/prettyPhoto/dark_square/btnPrevious.png",
|
36
|
+
"app/assets/images/sofa_gallery/prettyPhoto/dark_square/contentPattern.png",
|
37
|
+
"app/assets/images/sofa_gallery/prettyPhoto/dark_square/default_thumbnail.gif",
|
38
|
+
"app/assets/images/sofa_gallery/prettyPhoto/dark_square/loader.gif",
|
39
|
+
"app/assets/images/sofa_gallery/prettyPhoto/dark_square/sprite.png",
|
40
|
+
"app/assets/images/sofa_gallery/prettyPhoto/default/default_thumb.png",
|
41
|
+
"app/assets/images/sofa_gallery/prettyPhoto/default/loader.gif",
|
42
|
+
"app/assets/images/sofa_gallery/prettyPhoto/default/sprite.png",
|
43
|
+
"app/assets/images/sofa_gallery/prettyPhoto/default/sprite_next.png",
|
44
|
+
"app/assets/images/sofa_gallery/prettyPhoto/default/sprite_prev.png",
|
45
|
+
"app/assets/images/sofa_gallery/prettyPhoto/default/sprite_x.png",
|
46
|
+
"app/assets/images/sofa_gallery/prettyPhoto/default/sprite_y.png",
|
47
|
+
"app/assets/images/sofa_gallery/prettyPhoto/facebook/btnNext.png",
|
48
|
+
"app/assets/images/sofa_gallery/prettyPhoto/facebook/btnPrevious.png",
|
49
|
+
"app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternBottom.png",
|
50
|
+
"app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternLeft.png",
|
51
|
+
"app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternRight.png",
|
52
|
+
"app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternTop.png",
|
53
|
+
"app/assets/images/sofa_gallery/prettyPhoto/facebook/default_thumbnail.gif",
|
54
|
+
"app/assets/images/sofa_gallery/prettyPhoto/facebook/loader.gif",
|
55
|
+
"app/assets/images/sofa_gallery/prettyPhoto/facebook/sprite.png",
|
56
|
+
"app/assets/images/sofa_gallery/prettyPhoto/light_rounded/btnNext.png",
|
57
|
+
"app/assets/images/sofa_gallery/prettyPhoto/light_rounded/btnPrevious.png",
|
58
|
+
"app/assets/images/sofa_gallery/prettyPhoto/light_rounded/default_thumbnail.gif",
|
59
|
+
"app/assets/images/sofa_gallery/prettyPhoto/light_rounded/loader.gif",
|
60
|
+
"app/assets/images/sofa_gallery/prettyPhoto/light_rounded/sprite.png",
|
61
|
+
"app/assets/images/sofa_gallery/prettyPhoto/light_square/btnNext.png",
|
62
|
+
"app/assets/images/sofa_gallery/prettyPhoto/light_square/btnPrevious.png",
|
63
|
+
"app/assets/images/sofa_gallery/prettyPhoto/light_square/default_thumbnail.gif",
|
64
|
+
"app/assets/images/sofa_gallery/prettyPhoto/light_square/loader.gif",
|
65
|
+
"app/assets/images/sofa_gallery/prettyPhoto/light_square/sprite.png",
|
66
|
+
"app/assets/javascripts/sofa_gallery/admin.js",
|
28
67
|
"app/assets/javascripts/sofa_gallery/application.js",
|
68
|
+
"app/assets/javascripts/sofa_gallery/carousel.js",
|
29
69
|
"app/assets/javascripts/sofa_gallery/jquery.jcrop.js",
|
30
|
-
"app/assets/javascripts/sofa_gallery/
|
31
|
-
"app/assets/
|
32
|
-
"app/assets/javascripts/sofa_gallery/rails.js",
|
70
|
+
"app/assets/javascripts/sofa_gallery/thumbnails.js",
|
71
|
+
"app/assets/stylesheets/sofa_gallery/admin.css",
|
33
72
|
"app/assets/stylesheets/sofa_gallery/application.css",
|
73
|
+
"app/assets/stylesheets/sofa_gallery/carousel.css",
|
34
74
|
"app/assets/stylesheets/sofa_gallery/jquery.jcrop.css",
|
35
75
|
"app/assets/stylesheets/sofa_gallery/reset.css",
|
76
|
+
"app/assets/stylesheets/sofa_gallery/tango/credits.txt",
|
77
|
+
"app/assets/stylesheets/sofa_gallery/tango/next-horizontal.png",
|
78
|
+
"app/assets/stylesheets/sofa_gallery/tango/next-vertical.png",
|
79
|
+
"app/assets/stylesheets/sofa_gallery/tango/prev-horizontal.png",
|
80
|
+
"app/assets/stylesheets/sofa_gallery/tango/prev-vertical.png",
|
81
|
+
"app/assets/stylesheets/sofa_gallery/thumbnails.css.scss",
|
36
82
|
"app/controllers/application_controller.rb",
|
37
|
-
"app/controllers/
|
38
|
-
"app/controllers/
|
39
|
-
"app/controllers/
|
83
|
+
"app/controllers/sofa_gallery/admin/base_controller.rb",
|
84
|
+
"app/controllers/sofa_gallery/admin/galleries_controller.rb",
|
85
|
+
"app/controllers/sofa_gallery/admin/photos_controller.rb",
|
86
|
+
"app/controllers/sofa_gallery/galleries_controller.rb",
|
40
87
|
"app/helpers/sofa_gallery_helper.rb",
|
41
|
-
"app/models/
|
42
|
-
"app/models/
|
43
|
-
"app/views/gallery_admin/_navigation.html.erb",
|
44
|
-
"app/views/gallery_admin/galleries/_form.html.erb",
|
45
|
-
"app/views/gallery_admin/galleries/edit.html.erb",
|
46
|
-
"app/views/gallery_admin/galleries/index.html.erb",
|
47
|
-
"app/views/gallery_admin/galleries/new.html.erb",
|
48
|
-
"app/views/gallery_admin/photos/_form.html.erb",
|
49
|
-
"app/views/gallery_admin/photos/crop.html.erb",
|
50
|
-
"app/views/gallery_admin/photos/edit.html.erb",
|
51
|
-
"app/views/gallery_admin/photos/index.html.erb",
|
52
|
-
"app/views/gallery_admin/photos/new.html.erb",
|
88
|
+
"app/models/sofa_gallery/gallery.rb",
|
89
|
+
"app/models/sofa_gallery/photo.rb",
|
53
90
|
"app/views/layouts/gallery_admin/application.html.erb",
|
91
|
+
"app/views/sofa_gallery/_carousel.html.erb",
|
92
|
+
"app/views/sofa_gallery/_thumbnails.html.erb",
|
93
|
+
"app/views/sofa_gallery/admin/_html_head.html.erb",
|
94
|
+
"app/views/sofa_gallery/admin/_navigation.html.erb",
|
95
|
+
"app/views/sofa_gallery/admin/galleries/_form.html.erb",
|
96
|
+
"app/views/sofa_gallery/admin/galleries/edit.html.erb",
|
97
|
+
"app/views/sofa_gallery/admin/galleries/index.html.erb",
|
98
|
+
"app/views/sofa_gallery/admin/galleries/new.html.erb",
|
99
|
+
"app/views/sofa_gallery/admin/photos/_form.html.erb",
|
100
|
+
"app/views/sofa_gallery/admin/photos/crop.html.erb",
|
101
|
+
"app/views/sofa_gallery/admin/photos/edit.html.erb",
|
102
|
+
"app/views/sofa_gallery/admin/photos/index.html.erb",
|
103
|
+
"app/views/sofa_gallery/admin/photos/new.html.erb",
|
104
|
+
"app/views/sofa_gallery/galleries/show.html.erb",
|
54
105
|
"config.ru",
|
55
106
|
"config/application.rb",
|
56
107
|
"config/boot.rb",
|
@@ -74,10 +125,12 @@ Gem::Specification.new do |s|
|
|
74
125
|
"sofa_gallery.gemspec",
|
75
126
|
"test/fixtures/files/default.jpg",
|
76
127
|
"test/fixtures/files/default.txt",
|
77
|
-
"test/fixtures/
|
78
|
-
"test/fixtures/
|
128
|
+
"test/fixtures/files/default2.jpg",
|
129
|
+
"test/fixtures/sofa_gallery/galleries.yml",
|
130
|
+
"test/fixtures/sofa_gallery/photos.yml",
|
131
|
+
"test/functional/admin/galleries_controller_test.rb",
|
132
|
+
"test/functional/admin/photos_controller_test.rb",
|
79
133
|
"test/functional/galleries_controller_test.rb",
|
80
|
-
"test/functional/photos_controller_test.rb",
|
81
134
|
"test/test_helper.rb",
|
82
135
|
"test/unit/configuration_test.rb",
|
83
136
|
"test/unit/gallery_test.rb",
|
@@ -86,26 +139,32 @@ Gem::Specification.new do |s|
|
|
86
139
|
s.homepage = %q{http://github.com/twg/sofa-gallery}
|
87
140
|
s.licenses = ["MIT"]
|
88
141
|
s.require_paths = ["lib"]
|
89
|
-
s.rubygems_version = %q{1.
|
142
|
+
s.rubygems_version = %q{1.6.2}
|
90
143
|
s.summary = %q{SofaGallery is an image gallery engine for Rails 3.1 apps (and ComfortableMexicanSofa)}
|
91
144
|
|
92
145
|
if s.respond_to? :specification_version then
|
93
146
|
s.specification_version = 3
|
94
147
|
|
95
148
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
96
|
-
s.add_runtime_dependency(%q<rails>, [">= 3.1.0
|
97
|
-
s.add_runtime_dependency(%q<paperclip>, [">=
|
149
|
+
s.add_runtime_dependency(%q<rails>, [">= 3.1.0"])
|
150
|
+
s.add_runtime_dependency(%q<paperclip>, [">= 2.3.14"])
|
151
|
+
s.add_runtime_dependency(%q<jquery-rails>, ["= 1.0.14"])
|
152
|
+
s.add_runtime_dependency(%q<sass-rails>, [">= 0"])
|
98
153
|
s.add_development_dependency(%q<sqlite3>, [">= 0"])
|
99
154
|
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
100
155
|
else
|
101
|
-
s.add_dependency(%q<rails>, [">= 3.1.0
|
102
|
-
s.add_dependency(%q<paperclip>, [">=
|
156
|
+
s.add_dependency(%q<rails>, [">= 3.1.0"])
|
157
|
+
s.add_dependency(%q<paperclip>, [">= 2.3.14"])
|
158
|
+
s.add_dependency(%q<jquery-rails>, ["= 1.0.14"])
|
159
|
+
s.add_dependency(%q<sass-rails>, [">= 0"])
|
103
160
|
s.add_dependency(%q<sqlite3>, [">= 0"])
|
104
161
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
105
162
|
end
|
106
163
|
else
|
107
|
-
s.add_dependency(%q<rails>, [">= 3.1.0
|
108
|
-
s.add_dependency(%q<paperclip>, [">=
|
164
|
+
s.add_dependency(%q<rails>, [">= 3.1.0"])
|
165
|
+
s.add_dependency(%q<paperclip>, [">= 2.3.14"])
|
166
|
+
s.add_dependency(%q<jquery-rails>, ["= 1.0.14"])
|
167
|
+
s.add_dependency(%q<sass-rails>, [">= 0"])
|
109
168
|
s.add_dependency(%q<sqlite3>, [">= 0"])
|
110
169
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
111
170
|
end
|
Binary file
|
@@ -2,9 +2,11 @@ default:
|
|
2
2
|
title: Default Gallery
|
3
3
|
slug: default-gallery
|
4
4
|
description: Gallery Description
|
5
|
+
gallery_width: 640
|
5
6
|
full_width: 800
|
6
7
|
full_height: 600
|
7
|
-
|
8
|
+
force_ratio_full: false
|
9
|
+
thumb_width: 150
|
8
10
|
thumb_height: 150
|
9
|
-
|
11
|
+
force_ratio_thumb: true
|
10
12
|
|
File without changes
|
@@ -0,0 +1,87 @@
|
|
1
|
+
require File.expand_path('../../test_helper', File.dirname(__FILE__))
|
2
|
+
|
3
|
+
class SofaGallery::Admin::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/galleries']"
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_creation
|
20
|
+
assert_difference 'SofaGallery::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 'SofaGallery::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 = sofa_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/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 = sofa_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 = sofa_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 'SofaGallery::Gallery.count', -1 do
|
81
|
+
delete :destroy, :id => sofa_gallery_galleries(:default)
|
82
|
+
end
|
83
|
+
assert_equal 'Gallery deleted', flash[:notice]
|
84
|
+
assert_redirected_to :action => :index
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|