tb_photos 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/app/assets/javascripts/admin/photos/photos.js +3 -0
- data/app/assets/stylesheets/admin/photos/application.css.scss +2 -0
- data/app/controllers/admin/photo_albums_controller.rb +9 -6
- data/app/controllers/admin/photo_galleries_controller.rb +9 -4
- data/app/controllers/admin/photos_controller.rb +8 -5
- data/app/controllers/photo_albums_controller.rb +0 -6
- data/app/controllers/photo_galleries_controller.rb +1 -7
- data/app/models/spud_photo.rb +0 -2
- data/app/models/spud_photo_album.rb +4 -6
- data/app/models/spud_photo_albums_photo.rb +2 -3
- data/app/models/spud_photo_galleries_album.rb +2 -3
- data/app/models/spud_photo_gallery.rb +1 -3
- data/app/views/admin/photo_albums/_album.html.erb +1 -1
- data/app/views/photo_albums/index.html.erb +13 -13
- data/app/views/photo_albums/show.html.erb +13 -17
- data/app/views/photo_galleries/index.html.erb +13 -11
- data/config/routes.rb +1 -1
- data/lib/spud_photos/configuration.rb +1 -1
- data/lib/spud_photos/engine.rb +0 -1
- data/lib/spud_photos/version.rb +1 -1
- data/spec/dummy/README.rdoc +261 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config/application.rb +57 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +15 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +67 -0
- data/spec/dummy/config/environments/test.rb +36 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +8 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/spec_helper.rb +40 -0
- metadata +91 -34
- data/app/models/spud_photo_sweeper.rb +0 -39
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
ODhmMzcwN2ZiN2U2OGM0NzZhZGJiZjRkZWI4ODI4YWY3ZjA3N2FjODgyM2Fi
|
10
|
-
ODNkY2RmODY3MjU4ZWMyY2I5NjM0ZWEzYWM4YzM2YzJkNWM4ZDY5MzZjZGYw
|
11
|
-
OGEwMWVlOGZkZDMyZTY5YjEyNjc0OGVjM2FhMmMxM2ExNGViYzI=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
YzdkODgyOWY4Yzk5ZGI5MjY1MDJlYWYwNGVlODQzMzk2YjZkYTg1OGQyN2Rh
|
14
|
-
N2I4Y2EwMjMwODVkNjRmNDE3MWFjN2IwZjU5N2M2MTMzYzlmMGNlMjMzMTZk
|
15
|
-
MDQ3OGMxN2JhMGQ2ZGNhNjM0NGIzODA3NDk1NTQ4YzkwM2U5NDE=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ae0e6a31cb45e6caa79125487e2ae8ac6c8ef670
|
4
|
+
data.tar.gz: b28cb9982545758d4450e626bc29db55e0fea247
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 309fdd963c7f4db518ef446f4061366880702c3956377bb30ade294e979030ae4cfe558fcd6cb0ea5d1e6ce7f2871eccb169825c907e68ebb631dcd60258d8a6
|
7
|
+
data.tar.gz: b0ab591e05cd3a54f5bb7318a812909d6298136e33a758e39405358058d6c2f5fa202a01bd99ad859cef60cc5c02fafefd1bf39786b109b84018ca815ee97f21
|
@@ -391,6 +391,9 @@
|
|
391
391
|
var fd = new FormData();
|
392
392
|
fd.append('spud_photo[photo]', file);
|
393
393
|
|
394
|
+
var csrf = $('meta[name=csrf-token]').prop('content');
|
395
|
+
fd.append('authenticity_token', csrf);
|
396
|
+
|
394
397
|
// create a progress bar
|
395
398
|
var progressBar = self.progressBarForUpload(file.name);
|
396
399
|
$('#spud_admin_photo_upload_queue_bars').prepend(progressBar);
|
@@ -3,7 +3,6 @@ class Admin::PhotoAlbumsController < Admin::ApplicationController
|
|
3
3
|
before_filter :get_album, :only => [:show, :edit, :update, :destroy, :library]
|
4
4
|
add_breadcrumb 'Photo Albums', :admin_photo_albums_path
|
5
5
|
layout 'admin/spud_photos'
|
6
|
-
cache_sweeper :spud_photo_sweeper, :only => [:create, :update, :destroy]
|
7
6
|
|
8
7
|
def index
|
9
8
|
@photo_albums = SpudPhotoAlbum.all
|
@@ -20,7 +19,7 @@ class Admin::PhotoAlbumsController < Admin::ApplicationController
|
|
20
19
|
end
|
21
20
|
|
22
21
|
def create
|
23
|
-
@photo_album = SpudPhotoAlbum.new(
|
22
|
+
@photo_album = SpudPhotoAlbum.new(photo_album_params)
|
24
23
|
if @photo_album.save
|
25
24
|
set_photo_order
|
26
25
|
end
|
@@ -32,7 +31,7 @@ class Admin::PhotoAlbumsController < Admin::ApplicationController
|
|
32
31
|
end
|
33
32
|
|
34
33
|
def update
|
35
|
-
@photo_album.update_attributes(
|
34
|
+
@photo_album.update_attributes(photo_album_params)
|
36
35
|
if @photo_album.save
|
37
36
|
set_photo_order
|
38
37
|
flash[:notice] = 'SpudPhotoAlbum updated successfully'
|
@@ -49,15 +48,19 @@ class Admin::PhotoAlbumsController < Admin::ApplicationController
|
|
49
48
|
@photo_album = SpudPhotoAlbum.find(params[:id])
|
50
49
|
end
|
51
50
|
|
52
|
-
|
51
|
+
private
|
53
52
|
|
54
53
|
def set_photo_order
|
55
54
|
order_ids = params[:spud_photo_album][:photo_ids] || []
|
56
55
|
@photo_album.spud_photo_albums_photos.each do |obj|
|
57
|
-
logger.debug "##### ID: #{obj.spud_photo_id.to_s}"
|
56
|
+
#logger.debug "##### ID: #{obj.spud_photo_id.to_s}"
|
58
57
|
index = order_ids.index(obj.spud_photo_id.to_s)
|
59
58
|
obj.update_attribute(:sort_order, index)
|
60
59
|
end
|
61
60
|
end
|
62
61
|
|
63
|
-
|
62
|
+
def photo_album_params
|
63
|
+
params.require(:spud_photo_album).permit(:title, :url_name, :photo_ids => [])
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
@@ -4,7 +4,6 @@ class Admin::PhotoGalleriesController < Admin::ApplicationController
|
|
4
4
|
before_filter :get_albums, :only => [:new, :create, :edit, :update]
|
5
5
|
add_breadcrumb 'Photo Galleries', :admin_photo_galleries_path
|
6
6
|
layout 'admin/spud_photos'
|
7
|
-
cache_sweeper :spud_photo_sweeper, :only => [:create, :update, :destroy]
|
8
7
|
|
9
8
|
def index
|
10
9
|
@photo_galleries = SpudPhotoGallery.all
|
@@ -21,7 +20,7 @@ class Admin::PhotoGalleriesController < Admin::ApplicationController
|
|
21
20
|
end
|
22
21
|
|
23
22
|
def create
|
24
|
-
@photo_gallery = SpudPhotoGallery.new(
|
23
|
+
@photo_gallery = SpudPhotoGallery.new(photo_gallery_params)
|
25
24
|
flash[:notice] = 'SpudPhotoGallery created successfully' if @photo_gallery.save
|
26
25
|
respond_with @photo_gallery, :location => admin_photo_galleries_path
|
27
26
|
end
|
@@ -31,7 +30,7 @@ class Admin::PhotoGalleriesController < Admin::ApplicationController
|
|
31
30
|
end
|
32
31
|
|
33
32
|
def update
|
34
|
-
@photo_gallery.update_attributes(
|
33
|
+
@photo_gallery.update_attributes(photo_gallery_params)
|
35
34
|
flash[:notice] = 'SpudPhotoGallery updated successfully' if @photo_gallery.save
|
36
35
|
respond_with @photo_gallery, :location => admin_photo_galleries_path
|
37
36
|
end
|
@@ -41,6 +40,8 @@ class Admin::PhotoGalleriesController < Admin::ApplicationController
|
|
41
40
|
respond_with @photo_gallery, :location => admin_photo_galleries_path
|
42
41
|
end
|
43
42
|
|
43
|
+
private
|
44
|
+
|
44
45
|
def get_gallery
|
45
46
|
@photo_gallery = SpudPhotoGallery.find(params[:id])
|
46
47
|
end
|
@@ -49,4 +50,8 @@ class Admin::PhotoGalleriesController < Admin::ApplicationController
|
|
49
50
|
@photo_albums = SpudPhotoAlbum.all
|
50
51
|
end
|
51
52
|
|
52
|
-
|
53
|
+
def photo_gallery_params
|
54
|
+
params.require(:spud_photo_gallery).permit(:title, :url_name, :album_ids => [])
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
@@ -4,7 +4,6 @@ class Admin::PhotosController < Admin::ApplicationController
|
|
4
4
|
|
5
5
|
before_filter :get_photo, :only => [:show, :edit, :update, :destroy]
|
6
6
|
layout false
|
7
|
-
cache_sweeper :spud_photo_sweeper, :only => [:create, :update, :destroy]
|
8
7
|
|
9
8
|
def index
|
10
9
|
@photos = SpudPhoto.all
|
@@ -23,7 +22,7 @@ class Admin::PhotosController < Admin::ApplicationController
|
|
23
22
|
end
|
24
23
|
|
25
24
|
def create
|
26
|
-
@photo = SpudPhoto.new(
|
25
|
+
@photo = SpudPhoto.new(photo_params)
|
27
26
|
if @photo.save
|
28
27
|
success = true
|
29
28
|
flash[:notice] = 'SpudPhoto created successfully'
|
@@ -44,7 +43,7 @@ class Admin::PhotosController < Admin::ApplicationController
|
|
44
43
|
end
|
45
44
|
|
46
45
|
def update
|
47
|
-
@photo.update_attributes(
|
46
|
+
@photo.update_attributes(photo_params)
|
48
47
|
if @photo.save
|
49
48
|
success = true
|
50
49
|
flash[:notice] = 'SpudPhoto updated successfully'
|
@@ -69,7 +68,7 @@ class Admin::PhotosController < Admin::ApplicationController
|
|
69
68
|
respond_with @photos, :location => admin_photos_path
|
70
69
|
end
|
71
70
|
|
72
|
-
|
71
|
+
private
|
73
72
|
|
74
73
|
def get_photo
|
75
74
|
@photo = SpudPhoto.find(params[:id])
|
@@ -89,4 +88,8 @@ class Admin::PhotosController < Admin::ApplicationController
|
|
89
88
|
end
|
90
89
|
end
|
91
90
|
|
92
|
-
|
91
|
+
def photo_params
|
92
|
+
params.require(:spud_photo).permit(:title, :caption, :photo)
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
@@ -7,12 +7,6 @@ class PhotoAlbumsController < ApplicationController
|
|
7
7
|
before_filter :get_gallery
|
8
8
|
end
|
9
9
|
|
10
|
-
after_filter :only => [:show, :index] do |c|
|
11
|
-
if Spud::Photos.enable_full_page_caching
|
12
|
-
c.cache_page(nil, nil, false)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
10
|
def index
|
17
11
|
if @photo_gallery
|
18
12
|
@photo_albums = @photo_gallery.albums.order('created_at desc')
|
@@ -3,14 +3,8 @@ class PhotoGalleriesController < ApplicationController
|
|
3
3
|
respond_to :html, :json, :xml
|
4
4
|
layout Spud::Photos.base_layout
|
5
5
|
|
6
|
-
after_filter :only => [:index] do |c|
|
7
|
-
if Spud::Photos.enable_full_page_caching
|
8
|
-
c.cache_page(nil, nil, false)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
6
|
def index
|
13
|
-
@photo_galleries = SpudPhotoGallery.order('created_at desc')
|
7
|
+
@photo_galleries = SpudPhotoGallery.order('created_at desc')
|
14
8
|
respond_with @photo_galleries
|
15
9
|
end
|
16
10
|
|
data/app/models/spud_photo.rb
CHANGED
@@ -1,12 +1,10 @@
|
|
1
1
|
class SpudPhotoAlbum < ActiveRecord::Base
|
2
2
|
|
3
|
-
attr_accessible :title, :url_name, :photos, :photo_ids
|
4
|
-
|
5
3
|
has_many :spud_photo_albums_photos, :dependent => :destroy
|
6
|
-
has_many :photos,
|
4
|
+
has_many :photos,
|
5
|
+
->{ order('spud_photo_albums_photos.sort_order asc') },
|
7
6
|
:through => :spud_photo_albums_photos,
|
8
|
-
:source => :spud_photo
|
9
|
-
:order => 'spud_photo_albums_photos.sort_order asc'
|
7
|
+
:source => :spud_photo
|
10
8
|
|
11
9
|
has_many :spud_photo_galleries_albums
|
12
10
|
has_many :galleries,
|
@@ -32,7 +30,7 @@ class SpudPhotoAlbum < ActiveRecord::Base
|
|
32
30
|
end
|
33
31
|
end
|
34
32
|
|
35
|
-
|
33
|
+
private
|
36
34
|
|
37
35
|
def set_url_name
|
38
36
|
self.url_name = self.title.parameterize
|
@@ -1,7 +1,5 @@
|
|
1
1
|
class SpudPhotoGallery < ActiveRecord::Base
|
2
2
|
|
3
|
-
attr_accessible :title, :url_name, :albums, :album_ids
|
4
|
-
|
5
3
|
has_many :spud_photo_galleries_albums, :dependent => :destroy
|
6
4
|
has_many :albums,
|
7
5
|
:through => :spud_photo_galleries_albums,
|
@@ -33,4 +31,4 @@ class SpudPhotoGallery < ActiveRecord::Base
|
|
33
31
|
end
|
34
32
|
end
|
35
33
|
|
36
|
-
end
|
34
|
+
end
|
@@ -5,6 +5,6 @@
|
|
5
5
|
</div>
|
6
6
|
<div class="spud_admin_photo_ui_thumb_controls">
|
7
7
|
<%= link_to 'Edit', edit_admin_photo_album_path(album), :class => 'spud_admin_photos_btn_edit' %>
|
8
|
-
<%= link_to 'Delete', admin_photo_album_path(album), :method => :delete, :class => 'spud_admin_photos_btn_delete', :remote => true, :confirm => 'Are you sure?' %>
|
8
|
+
<%= link_to 'Delete', admin_photo_album_path(album), :method => :delete, :class => 'spud_admin_photos_btn_delete', :remote => true, :data => {:confirm => 'Are you sure?'} %>
|
9
9
|
</div>
|
10
10
|
</div>
|
@@ -1,6 +1,4 @@
|
|
1
|
-
<%
|
2
|
-
<%= (@photo_gallery ? @photo_gallery.title : 'Photo Albums') %> | <%= Spud::Core.site_name %>
|
3
|
-
<% end %>
|
1
|
+
<% @page_title = @photo_gallery ? @photo_gallery.title : 'Photo Albums' %>
|
4
2
|
|
5
3
|
<% content_for :head do %>
|
6
4
|
|
@@ -12,13 +10,15 @@
|
|
12
10
|
<p><%= link_to 'Back to Galleries', photo_galleries_path %></p>
|
13
11
|
<% end %>
|
14
12
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
<
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
13
|
+
<% cache([@photo_gallery, @photo_albums]) do %>
|
14
|
+
<div id="spud_photo_albums">
|
15
|
+
<% @photo_albums.each do |album| %>
|
16
|
+
<div class="spud_photo_album_thumbnail">
|
17
|
+
<h3>
|
18
|
+
<%= link_to album.title, (@photo_gallery ? photo_gallery_photo_album_path(@photo_gallery.url_name, album.url_name) : photo_album_path(album.url_name)) %>
|
19
|
+
</h3>
|
20
|
+
<%= image_tag album.top_photo_url(:medium), :title => album.title %>
|
21
|
+
</div>
|
22
|
+
<% end %>
|
23
|
+
</div>
|
24
|
+
<% end %>
|
@@ -1,6 +1,4 @@
|
|
1
|
-
<%
|
2
|
-
<%= @photo_album.title %> | <%= Spud::Core.site_name %>
|
3
|
-
<% end %>
|
1
|
+
<% @page_title = @photo_album.title %>
|
4
2
|
|
5
3
|
<% content_for :head do %>
|
6
4
|
|
@@ -8,20 +6,18 @@
|
|
8
6
|
|
9
7
|
<h2>Photo Album: <%= @photo_album.title %></h2>
|
10
8
|
|
11
|
-
<%
|
12
|
-
<% if @photo_gallery
|
13
|
-
<p><%= link_to 'Back to
|
9
|
+
<% cache(@photo_album) do %>
|
10
|
+
<% if @photo_gallery %>
|
11
|
+
<p><%= link_to 'Back to Albums', photo_gallery_photo_albums_path(@photo_gallery.url_name) %>
|
14
12
|
<% else %>
|
15
|
-
<p><%= link_to 'Back to
|
13
|
+
<p><%= link_to 'Back to Albums', photo_albums_path %>
|
16
14
|
<% end %>
|
17
|
-
<% else %>
|
18
|
-
<p><%= link_to 'Back to Albums', photo_albums_path %>
|
19
|
-
<% end %>
|
20
15
|
|
21
|
-
<div id="spud_photo_galleries">
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
</div>
|
16
|
+
<div id="spud_photo_galleries">
|
17
|
+
<% @photo_album.photos.each do |photo| %>
|
18
|
+
<div class="spud_photo_album_thumbnail">
|
19
|
+
<%= link_to image_tag(photo.photo.url(:small), :alt => photo.caption, :title => photo.title), photo.photo.url(:large) %>
|
20
|
+
</div>
|
21
|
+
<% end %>
|
22
|
+
</div>
|
23
|
+
<% end %>
|
@@ -1,6 +1,4 @@
|
|
1
|
-
<%
|
2
|
-
Photo Galleries | <%= Spud::Core.site_name %>
|
3
|
-
<% end %>
|
1
|
+
<% @page_title = 'Photo Galleries' %>
|
4
2
|
|
5
3
|
<% content_for :head do %>
|
6
4
|
|
@@ -8,11 +6,15 @@
|
|
8
6
|
|
9
7
|
<h2>Photo Galleries</h2>
|
10
8
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
</div>
|
9
|
+
<% cache(@photo_galleries) do %>
|
10
|
+
<div id="spud_photo_galleries">
|
11
|
+
<% @photo_galleries.each do |gallery| %>
|
12
|
+
<% cache(gallery) do %>
|
13
|
+
<div class="spud_photo_gallery_thumbnail">
|
14
|
+
<h3><%= link_to gallery.title, photo_gallery_photo_albums_path(gallery.url_name) %></h3>
|
15
|
+
<%= image_tag gallery.top_photo_url(:medium), :title => gallery.title %>
|
16
|
+
</div>
|
17
|
+
<% end %>
|
18
|
+
<% end %>
|
19
|
+
</div>
|
20
|
+
<% end %>
|
data/config/routes.rb
CHANGED
@@ -23,6 +23,6 @@ module Spud
|
|
23
23
|
self.storage_url = "/system/spud_photos/:id/:style/:basename.:extension"
|
24
24
|
self.enable_full_page_caching = false
|
25
25
|
self.page_caches_to_sweep = []
|
26
|
-
self.max_image_upload_size =
|
26
|
+
self.max_image_upload_size = 5.megabytes
|
27
27
|
end
|
28
28
|
end
|
data/lib/spud_photos/engine.rb
CHANGED
@@ -6,7 +6,6 @@ module Spud
|
|
6
6
|
class Engine < Rails::Engine
|
7
7
|
engine_name :tb_photos
|
8
8
|
initializer :assets_photos do |config|
|
9
|
-
Rails.application.config.assets.precompile += ["admin/photos/application*"]
|
10
9
|
Spud::Core.append_admin_javascripts("admin/photos/application")
|
11
10
|
Spud::Core.append_admin_stylesheets("admin/photos/application")
|
12
11
|
end
|
data/lib/spud_photos/version.rb
CHANGED