tb_photos 1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +15 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.markdown +75 -0
  4. data/Rakefile +28 -0
  5. data/app/assets/images/spud/photos/buttons/cog_16x16.png +0 -0
  6. data/app/assets/images/spud/photos/buttons/x_16x16.png +0 -0
  7. data/app/assets/images/spud/photos/photo_albums_thumb.png +0 -0
  8. data/app/assets/images/spud/photos/photo_albums_thumb@2x.png +0 -0
  9. data/app/assets/javascripts/spud/admin/photos.js +356 -0
  10. data/app/assets/stylesheets/spud/admin/photos.css +128 -0
  11. data/app/controllers/photo_albums_controller.rb +54 -0
  12. data/app/controllers/photo_galleries_controller.rb +17 -0
  13. data/app/controllers/spud/admin/photo_albums_controller.rb +64 -0
  14. data/app/controllers/spud/admin/photo_galleries_controller.rb +53 -0
  15. data/app/controllers/spud/admin/photos_controller.rb +93 -0
  16. data/app/helpers/photo_albums_helper.rb +2 -0
  17. data/app/helpers/photo_galleries_helper.rb +2 -0
  18. data/app/helpers/spud/admin/photo_albums_helper.rb +2 -0
  19. data/app/helpers/spud/admin/photo_galleries_helper.rb +2 -0
  20. data/app/helpers/spud/admin/photos_helper.rb +7 -0
  21. data/app/models/spud_photo.rb +29 -0
  22. data/app/models/spud_photo_album.rb +49 -0
  23. data/app/models/spud_photo_albums_photo.rb +5 -0
  24. data/app/models/spud_photo_galleries_album.rb +5 -0
  25. data/app/models/spud_photo_gallery.rb +36 -0
  26. data/app/models/spud_photo_sweeper.rb +39 -0
  27. data/app/views/layouts/spud/admin/spud_photos.html.erb +8 -0
  28. data/app/views/photo_albums/index.html.erb +24 -0
  29. data/app/views/photo_albums/show.html.erb +27 -0
  30. data/app/views/photo_galleries/index.html.erb +18 -0
  31. data/app/views/spud/admin/photo_albums/_album.html.erb +10 -0
  32. data/app/views/spud/admin/photo_albums/_form.html.erb +36 -0
  33. data/app/views/spud/admin/photo_albums/destroy.js.erb +1 -0
  34. data/app/views/spud/admin/photo_albums/edit.html.erb +1 -0
  35. data/app/views/spud/admin/photo_albums/index.html.erb +9 -0
  36. data/app/views/spud/admin/photo_albums/new.html.erb +1 -0
  37. data/app/views/spud/admin/photo_galleries/_form.html.erb +39 -0
  38. data/app/views/spud/admin/photo_galleries/destroy.js.erb +1 -0
  39. data/app/views/spud/admin/photo_galleries/edit.html.erb +1 -0
  40. data/app/views/spud/admin/photo_galleries/index.html.erb +17 -0
  41. data/app/views/spud/admin/photo_galleries/new.html.erb +1 -0
  42. data/app/views/spud/admin/photos/_form.html.erb +41 -0
  43. data/app/views/spud/admin/photos/_photo.html.erb +13 -0
  44. data/app/views/spud/admin/photos/destroy.js.erb +1 -0
  45. data/app/views/spud/admin/photos/edit.html.erb +1 -0
  46. data/app/views/spud/admin/photos/index.html.erb +3 -0
  47. data/app/views/spud/admin/photos/new.html.erb +1 -0
  48. data/app/views/spud/admin/photos/show.js.erb +5 -0
  49. data/config/routes.rb +24 -0
  50. data/db/migrate/20120228232120_create_spud_photos.rb +13 -0
  51. data/db/migrate/20120228232329_create_spud_photo_albums.rb +15 -0
  52. data/db/migrate/20120228232344_create_spud_photo_galleries.rb +15 -0
  53. data/db/migrate/20120405042046_upgrade_photo_relationships.rb +8 -0
  54. data/db/migrate/20121127210314_rename_order_to_sort_order.rb +6 -0
  55. data/lib/generators/spud/photos/views_generator.rb +14 -0
  56. data/lib/spud_photos/configuration.rb +21 -0
  57. data/lib/spud_photos/engine.rb +37 -0
  58. data/lib/spud_photos/version.rb +5 -0
  59. data/lib/tasks/spud_photos_tasks.rake +4 -0
  60. data/lib/tb_photos.rb +6 -0
  61. metadata +258 -0
@@ -0,0 +1,17 @@
1
+ class PhotoGalleriesController < ApplicationController
2
+
3
+ respond_to :html, :json, :xml
4
+ layout Spud::Photos.base_layout
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
+ def index
13
+ @photo_galleries = SpudPhotoGallery.order('created_at desc').includes(:albums)
14
+ respond_with @photo_galleries
15
+ end
16
+
17
+ end
@@ -0,0 +1,64 @@
1
+ class Spud::Admin::PhotoAlbumsController < Spud::Admin::ApplicationController
2
+
3
+ before_filter :get_album, :only => [:show, :edit, :update, :destroy, :library]
4
+ add_breadcrumb 'Photo Albums', :spud_admin_photo_albums_path
5
+ respond_to :html, :json, :xml
6
+ layout 'spud/admin/spud_photos'
7
+ cache_sweeper :spud_photo_sweeper, :only => [:create, :update, :destroy]
8
+
9
+ def index
10
+ @photo_albums = SpudPhotoAlbum.all
11
+ respond_with @photo_albums
12
+ end
13
+
14
+ def show
15
+ respond_with @photo_album
16
+ end
17
+
18
+ def new
19
+ @photo_album = SpudPhotoAlbum.new
20
+ respond_with @photo_album
21
+ end
22
+
23
+ def create
24
+ @photo_album = SpudPhotoAlbum.new(params[:spud_photo_album])
25
+ if @photo_album.save
26
+ set_photo_order
27
+ end
28
+ respond_with @photo_album, :location => spud_admin_photo_albums_path
29
+ end
30
+
31
+ def edit
32
+ respond_with @photo_album
33
+ end
34
+
35
+ def update
36
+ @photo_album.update_attributes(params[:spud_photo_album])
37
+ if @photo_album.save
38
+ set_photo_order
39
+ flash[:notice] = 'SpudPhotoAlbum updated successfully'
40
+ end
41
+ respond_with @photo_album, :location => spud_admin_photo_albums_path
42
+ end
43
+
44
+ def destroy
45
+ flash[:notice] = 'SpudPhotoAlbum deleted successfully' if @photo_album.destroy
46
+ respond_with @photo_album, :location => spud_admin_photo_albums_path
47
+ end
48
+
49
+ def get_album
50
+ @photo_album = SpudPhotoAlbum.find(params[:id])
51
+ end
52
+
53
+ private
54
+
55
+ def set_photo_order
56
+ order_ids = params[:spud_photo_album][:photo_ids] || []
57
+ @photo_album.spud_photo_albums_photos.each do |obj|
58
+ logger.debug "##### ID: #{obj.spud_photo_id.to_s}"
59
+ index = order_ids.index(obj.spud_photo_id.to_s)
60
+ obj.update_attribute(:sort_order, index)
61
+ end
62
+ end
63
+
64
+ end
@@ -0,0 +1,53 @@
1
+ class Spud::Admin::PhotoGalleriesController < Spud::Admin::ApplicationController
2
+
3
+ before_filter :get_gallery, :only => [:show, :edit, :update, :destroy]
4
+ before_filter :get_albums, :only => [:new, :create, :edit, :update]
5
+ add_breadcrumb 'Photo Galleries', :spud_admin_photo_galleries_path
6
+ respond_to :html, :json, :xml
7
+ layout 'spud/admin/spud_photos'
8
+ cache_sweeper :spud_photo_sweeper, :only => [:create, :update, :destroy]
9
+
10
+ def index
11
+ @photo_galleries = SpudPhotoGallery.all
12
+ respond_with @photo_galleries
13
+ end
14
+
15
+ def show
16
+ respond_with @photo_gallery
17
+ end
18
+
19
+ def new
20
+ @photo_gallery = SpudPhotoGallery.new
21
+ respond_with @photo_gallery
22
+ end
23
+
24
+ def create
25
+ @photo_gallery = SpudPhotoGallery.new(params[:spud_photo_gallery])
26
+ flash[:notice] = 'SpudPhotoGallery created successfully' if @photo_gallery.save
27
+ respond_with @photo_gallery, :location => spud_admin_photo_galleries_path
28
+ end
29
+
30
+ def edit
31
+ respond_with @photo_gallery
32
+ end
33
+
34
+ def update
35
+ @photo_gallery.update_attributes(params[:spud_photo_gallery])
36
+ flash[:notice] = 'SpudPhotoGallery updated successfully' if @photo_gallery.save
37
+ respond_with @photo_gallery, :location => spud_admin_photo_galleries_path
38
+ end
39
+
40
+ def destroy
41
+ flash[:notice] = 'SpudPhotoGallery deleted successfully' if @photo_gallery.destroy
42
+ respond_with @photo_gallery, :location => spud_admin_photo_galleries_path
43
+ end
44
+
45
+ def get_gallery
46
+ @photo_gallery = SpudPhotoGallery.find(params[:id])
47
+ end
48
+
49
+ def get_albums
50
+ @photo_albums = SpudPhotoAlbum.all
51
+ end
52
+
53
+ end
@@ -0,0 +1,93 @@
1
+ class Spud::Admin::PhotosController < Spud::Admin::ApplicationController
2
+
3
+ include RespondsToParent
4
+
5
+ before_filter :get_photo, :only => [:show, :edit, :update, :destroy]
6
+ respond_to :html, :json, :xml, :js
7
+ layout false
8
+ cache_sweeper :spud_photo_sweeper, :only => [:create, :update, :destroy]
9
+
10
+ def index
11
+ @photos = SpudPhoto.all
12
+ respond_with @photos
13
+ end
14
+
15
+ def show
16
+ respond_with @photo
17
+ end
18
+
19
+ def new
20
+ @photo = SpudPhoto.new
21
+ respond_with @photo do |format|
22
+ format.js { render 'new', :layout => false }
23
+ end
24
+ end
25
+
26
+ def create
27
+ @photo = SpudPhoto.new(params[:spud_photo])
28
+ if @photo.save
29
+ success = true
30
+ flash[:notice] = 'SpudPhoto created successfully'
31
+ end
32
+ if request.xhr?
33
+ render json_for_photo(success)
34
+ else
35
+ respond_to_parent do
36
+ render 'show.js'
37
+ end
38
+ end
39
+ end
40
+
41
+ def edit
42
+ respond_with @photo do |format|
43
+ format.js { render 'edit', :layout => false }
44
+ end
45
+ end
46
+
47
+ def update
48
+ @photo.update_attributes(params[:spud_photo])
49
+ if @photo.save
50
+ success = true
51
+ flash[:notice] = 'SpudPhoto updated successfully'
52
+ end
53
+ if request.xhr?
54
+ render json_for_photo(success)
55
+ else
56
+ respond_to_parent do
57
+ render 'show.js'
58
+ end
59
+ end
60
+ end
61
+
62
+ def destroy
63
+ flash[:notice] = 'SpudPhoto deleted successfully' if @photo.destroy
64
+ respond_with @photo, :location => spud_admin_photos_path
65
+ end
66
+
67
+ def mass_destroy
68
+ @photos = SpudPhoto.where(:id => params[:spud_photo_ids])
69
+ flash[:notice] = 'Photos deleted successfully' if @photos.destroy_all
70
+ respond_with @photos, :location => spud_admin_photos_path
71
+ end
72
+
73
+ private
74
+
75
+ def get_photo
76
+ @photo = SpudPhoto.find(params[:id])
77
+ end
78
+
79
+ def json_for_photo(success)
80
+ if success
81
+ return {:status => 200, :json => {
82
+ :id => @photo.id,
83
+ :html => render_to_string(:partial => 'photo', :locals => {:photo => @photo}, :layout => nil)
84
+ }}
85
+ else
86
+ return {:status => 422, :json => {
87
+ :id => 0,
88
+ :html => render_to_string(:partial => 'form', :layout => nil)
89
+ }}
90
+ end
91
+ end
92
+
93
+ end
@@ -0,0 +1,2 @@
1
+ module PhotoAlbumsHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module PhotoGalleriesHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module Spud::Admin::PhotoAlbumsHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module Spud::Admin::PhotoGalleriesHelper
2
+ end
@@ -0,0 +1,7 @@
1
+ module Spud::Admin::PhotosHelper
2
+
3
+ def photo_is_selected
4
+ return (@photo_album && @photo_album.photo_ids.include?(photo.id))
5
+ end
6
+
7
+ end
@@ -0,0 +1,29 @@
1
+ class SpudPhoto < ActiveRecord::Base
2
+
3
+ attr_accessible :title, :caption, :photo
4
+
5
+ has_many :spud_photo_albums_photos, :dependent => :destroy
6
+ has_many :albums,
7
+ :through => :spud_photo_albums_photos,
8
+ :source => :spud_photo_album
9
+
10
+ has_attached_file :photo,
11
+ :styles => lambda { |attachment| attachment.instance.dynamic_styles },
12
+ :convert_options => Spud::Photos.config.convert_options,
13
+ :storage => Spud::Photos.paperclip_storage,
14
+ :s3_credentials => Spud::Photos.s3_credentials,
15
+ :url => Spud::Photos.storage_url,
16
+ :path => Spud::Photos.storage_path
17
+
18
+ validates_attachment_presence :photo
19
+
20
+ def dynamic_styles
21
+ compress = '-strip -density 72x72'
22
+ admin_styles = {
23
+ :spud_admin_small => {:geometry => '125x125#', :convert_options => compress},
24
+ :spud_admin_medium => {:geometry => '300x200', :convert_options => compress}
25
+ }
26
+ return admin_styles.merge(Spud::Photos.config.photo_styles)
27
+ end
28
+
29
+ end
@@ -0,0 +1,49 @@
1
+ class SpudPhotoAlbum < ActiveRecord::Base
2
+
3
+ attr_accessible :title, :url_name, :photos, :photo_ids
4
+
5
+ has_many :spud_photo_albums_photos, :dependent => :destroy
6
+ has_many :photos,
7
+ :through => :spud_photo_albums_photos,
8
+ :source => :spud_photo,
9
+ :order => 'spud_photo_albums_photos.sort_order asc'
10
+
11
+ has_many :spud_photo_galleries_albums
12
+ has_many :galleries,
13
+ :through => :spud_photo_galleries_albums,
14
+ :source => :spud_photo_gallery
15
+
16
+ validates_presence_of :title, :url_name
17
+ validates_uniqueness_of :title, :url_name
18
+ before_validation :set_url_name
19
+ after_save :update_photo_order
20
+
21
+ def top_photo_url(style)
22
+ unless photos.empty?
23
+ return photos.first.photo.url(style)
24
+ end
25
+ end
26
+
27
+ def photos_available
28
+ if photo_ids.any?
29
+ return SpudPhoto.where('id not in (?)', photo_ids)
30
+ else
31
+ return SpudPhoto.all
32
+ end
33
+ end
34
+
35
+ private
36
+
37
+ def set_url_name
38
+ self.url_name = self.title.parameterize
39
+ end
40
+
41
+ def update_photo_order
42
+ # order = 0
43
+ # self.photos.each do |p|
44
+ # p.update_attribute(:order, order)
45
+ # order += 1
46
+ # end
47
+ end
48
+
49
+ end
@@ -0,0 +1,5 @@
1
+ class SpudPhotoAlbumsPhoto < ActiveRecord::Base
2
+ attr_accessible :spud_photo_id, :spud_photo_album_id, :sort_order
3
+ belongs_to :spud_photo
4
+ belongs_to :spud_photo_album
5
+ end
@@ -0,0 +1,5 @@
1
+ class SpudPhotoGalleriesAlbum < ActiveRecord::Base
2
+ attr_accessible :spud_photo_album_id, :spud_photo_gallery_id, :sort_order
3
+ belongs_to :spud_photo_album
4
+ belongs_to :spud_photo_gallery
5
+ end
@@ -0,0 +1,36 @@
1
+ class SpudPhotoGallery < ActiveRecord::Base
2
+
3
+ attr_accessible :title, :url_name, :albums, :album_ids
4
+
5
+ has_many :spud_photo_galleries_albums, :dependent => :destroy
6
+ has_many :albums,
7
+ :through => :spud_photo_galleries_albums,
8
+ :source => :spud_photo_album
9
+
10
+ validates_presence_of :title, :url_name
11
+ validates_uniqueness_of :title, :url_name
12
+ before_validation :set_url_name
13
+
14
+ def top_photo_url(style)
15
+ unless albums.empty?
16
+ return albums.first.top_photo_url(style)
17
+ end
18
+ end
19
+
20
+ def albums_available
21
+ if album_ids.any?
22
+ return SpudPhotoAlbum.where('id not in (?)', album_ids)
23
+ else
24
+ return SpudPhotoAlbum.all
25
+ end
26
+ end
27
+
28
+ private
29
+
30
+ def set_url_name
31
+ if self.title
32
+ self.url_name = self.title.parameterize
33
+ end
34
+ end
35
+
36
+ end
@@ -0,0 +1,39 @@
1
+ class SpudPhotoSweeper < ActionController::Caching::Sweeper
2
+
3
+ observe :spud_photo, :spud_photo_album, :spud_photo_gallery
4
+
5
+ def after_create(record)
6
+ expire_cache_for(record)
7
+ end
8
+
9
+ def before_update(record)
10
+ expire_cache_for(record)
11
+ end
12
+
13
+ def after_destroy(record)
14
+ expire_cache_for(record)
15
+ end
16
+
17
+ private
18
+
19
+ def expire_cache_for(record)
20
+ if Spud::Photos.config.enable_full_page_caching
21
+ cache_path = File.join(ActionController::Base.page_cache_directory, Spud::Photos.config.base_path)
22
+ if File.directory?(cache_path)
23
+ FileUtils.rm_rf(cache_path)
24
+ end
25
+ if Spud::Photos.config.galleries_enabled
26
+ expire_page photo_galleries_path
27
+ else
28
+ expire_page photo_albums_path
29
+ end
30
+
31
+ if !Spud::Photos.config.page_caches_to_sweep.blank?
32
+ Spud::Photos.config.page_caches_to_sweep.each do |route|
33
+ expire_page(route)
34
+ end
35
+ end
36
+ end
37
+ end
38
+
39
+ end
@@ -0,0 +1,8 @@
1
+ <%= content_for :head do %>
2
+ <%= javascript_include_tag "spud/admin/photos" %>
3
+ <%= stylesheet_link_tag 'spud/admin/photos' %>
4
+ <script type="text/javascript">
5
+ $(document).ready(Spud.Admin.Photos.init);
6
+ </script>
7
+ <% end %>
8
+ <%= render :template => 'layouts/spud/admin/detail' %>
@@ -0,0 +1,24 @@
1
+ <% content_for :title do %>
2
+ <%= (@photo_gallery ? @photo_gallery.title : 'Photo Albums') %> | <%= Spud::Core.site_name %>
3
+ <% end %>
4
+
5
+ <% content_for :head do %>
6
+
7
+ <% end %>
8
+
9
+ <h2><%= (@photo_gallery ? "Photo Gallery: #{@photo_gallery.title}" : 'Photo Albums') %></h2>
10
+
11
+ <% if Spud::Photos.galleries_enabled %>
12
+ <p><%= link_to 'Back to Galleries', photo_galleries_path %></p>
13
+ <% end %>
14
+
15
+ <div id="spud_photo_albums">
16
+ <% @photo_albums.each do |album| %>
17
+ <div class="spud_photo_album_thumbnail">
18
+ <h3>
19
+ <%= link_to album.title, (@photo_gallery ? photo_gallery_photo_album_path(@photo_gallery.url_name, album.url_name) : photo_album_path(album.url_name)) %>
20
+ </h3>
21
+ <%= image_tag album.top_photo_url(:medium), :title => album.title %>
22
+ </div>
23
+ <% end %>
24
+ </div>
@@ -0,0 +1,27 @@
1
+ <% content_for :title do %>
2
+ <%= @photo_album.title %> | <%= Spud::Core.site_name %>
3
+ <% end %>
4
+
5
+ <% content_for :head do %>
6
+
7
+ <% end %>
8
+
9
+ <h2>Photo Album: <%= @photo_album.title %></h2>
10
+
11
+ <% if @photo_gallery %>
12
+ <% if @photo_gallery.albums.count == 1 %>
13
+ <p><%= link_to 'Back to Galleries', photo_galleries_path %>
14
+ <% else %>
15
+ <p><%= link_to 'Back to Gallery', photo_gallery_photo_albums_path(@photo_gallery.url_name) %>
16
+ <% end %>
17
+ <% else %>
18
+ <p><%= link_to 'Back to Albums', photo_albums_path %>
19
+ <% end %>
20
+
21
+ <div id="spud_photo_galleries">
22
+ <% @photo_album.photos.each do |photo| %>
23
+ <div class="spud_photo_album_thumbnail">
24
+ <%= link_to image_tag(photo.photo.url(:small), :alt => photo.caption, :title => photo.title), photo.photo.url(:large) %>
25
+ </div>
26
+ <% end %>
27
+ </div>
@@ -0,0 +1,18 @@
1
+ <% content_for :title do %>
2
+ Photo Galleries | <%= Spud::Core.site_name %>
3
+ <% end %>
4
+
5
+ <% content_for :head do %>
6
+
7
+ <% end %>
8
+
9
+ <h2>Photo Galleries</h2>
10
+
11
+ <div id="spud_photo_galleries">
12
+ <% @photo_galleries.each do |gallery| %>
13
+ <div class="spud_photo_gallery_thumbnail">
14
+ <h3><%= link_to gallery.title, (gallery.albums.length == 1 ? photo_gallery_photo_album_path(gallery.url_name, gallery.albums.first.url_name) : 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
+ </div>
@@ -0,0 +1,10 @@
1
+ <div id="spud_admin_photo_album_<%= album.id %>" class="spud_admin_photo_ui_thumb" style="background-image:url('<%= album.top_photo_url(:spud_admin_small) %>')">
2
+ <h5><%= album.title %></h5>
3
+ <div style="display:none;">
4
+ <%= hidden_field_tag 'spud_photo_gallery[album_ids][]', album.id %>
5
+ </div>
6
+ <div class="spud_admin_photo_ui_thumb_controls">
7
+ <%= link_to 'Edit', edit_spud_admin_photo_album_path(album), :class => 'spud_admin_photos_btn_edit' %>
8
+ <%= link_to 'Delete', spud_admin_photo_album_path(album), :method => :delete, :class => 'spud_admin_photos_btn_delete', :remote => true, :confirm => 'Are you sure?' %>
9
+ </div>
10
+ </div>
@@ -0,0 +1,36 @@
1
+ <%= form_for @photo_album, :url => path, :html => {:class => 'form-horizontal', :id => 'spud_admin_photo_album_form'} do |f| %>
2
+
3
+ <%= error_messages_for(f.object) %>
4
+
5
+ <fieldset>
6
+ <legend>Photo Album Info</legend>
7
+ <div class="control-group">
8
+ <%= f.label :title, :class => "control-label" %>
9
+ <div class="controls">
10
+ <%= f.text_field :title %>
11
+ </div>
12
+ </div>
13
+ </fieldset>
14
+
15
+ <fieldset class="spud_admin_photos_album_fieldset">
16
+ <legend>Selected Photos</legend>
17
+ <div id="spud_admin_photo_album_actions" class="control-group">
18
+ <%= link_to "Photo Library", spud_admin_photos_path, :class => "btn btn-primary", :id => 'spud_admin_photo_album_action_library' %>
19
+ <%= link_to "Upload Photo", new_spud_admin_photo_path, :class => "btn btn-success", :id => 'spud_admin_photo_album_action_upload' %>
20
+ </div>
21
+ <div id="spud_admin_photo_upload_queue">
22
+ <p>Drag and drop photos here to upload</p>
23
+ <h5 id="spud_admin_photo_upload_queue_label">Queued Uploads: <span>0</span></h5>
24
+ <div id="spud_admin_photo_upload_queue_bars"></div>
25
+ </div>
26
+ <div id="spud_admin_photos_selected" class="control-group spud_admin_photo_ui_thumbs spud_admin_photo_ui_thumbs_sortable">
27
+ <%= render :partial => '/spud/admin/photos/photo', :collection => @photo_album.photos %>
28
+ </div>
29
+ </fieldset>
30
+
31
+ <div class="form-actions" style="clear:both">
32
+ <%= f.submit "Save Photo Album", :class=>"btn btn-primary form-btn", "data-loading-text" => "Saving..." %>
33
+ or <%=link_to "cancel", request.referer, :class => "btn" %>
34
+ </div>
35
+
36
+ <% end %>
@@ -0,0 +1 @@
1
+ Spud.Admin.Photos.markPhotoAlbumAsDeleted(<%= @photo_album.id %>);
@@ -0,0 +1 @@
1
+ <%= render :partial => 'form', :locals => {:path => spud_admin_photo_album_path(@photo_album)} %>
@@ -0,0 +1,9 @@
1
+ <%= content_for :data_controls do %>
2
+ <%= link_to "New Photo Album", new_spud_admin_photo_album_path, :class => "btn btn-primary", :title => "New Photo Album" %>
3
+ <% end %>
4
+
5
+ <%= content_for :detail do %>
6
+ <div id="spud_admin_photo_galleries" class="spud_admin_photo_ui_thumbs">
7
+ <%= render :partial => 'album', :collection => @photo_albums %>
8
+ <div>
9
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= render :partial => 'form', :locals => {:path => spud_admin_photo_albums_path} %>
@@ -0,0 +1,39 @@
1
+ <%= form_for @photo_gallery, :url => path, :html => {:class => 'form-horizontal', :id => 'spud_admin_photo_gallery_form'} do |f| %>
2
+
3
+ <%= error_messages_for(f.object) %>
4
+
5
+ <fieldset>
6
+ <legend>Gallery Info</legend>
7
+ <div class="control-group">
8
+ <%= f.label :title, :class => "control-label" %>
9
+ <div class="controls">
10
+ <%= f.text_field :title %>
11
+ </div>
12
+ </div>
13
+ </fieldset>
14
+
15
+ <!-- if no albums are selected below, this ensures we send an empty album_ids array -->
16
+ <%= hidden_field_tag 'spud_photo_gallery[album_ids][]' %>
17
+
18
+ <fieldset>
19
+ <legend>Select Albums</legend>
20
+ <div id="spud_admin_photo_albums_selected" class="spud_admin_photos_selection_left">
21
+ <h4>Selected:</h4>
22
+ <div class="spud_admin_photo_ui_thumbs spud_admin_photo_ui_thumbs_sortable">
23
+ <%= render :partial => '/spud/admin/photo_albums/album', :collection => @photo_gallery.albums %>
24
+ </div>
25
+ </div>
26
+ <div id="spud_admin_photo_albums_available" class="spud_admin_photos_selection_right">
27
+ <h4>Available:</h4>
28
+ <div class="spud_admin_photo_ui_thumbs spud_admin_photo_ui_thumbs_sortable">
29
+ <%= render :partial => '/spud/admin/photo_albums/album', :collection => @photo_gallery.albums_available %>
30
+ </div>
31
+ </div>
32
+ </fieldset>
33
+
34
+ <div class="form-actions">
35
+ <%= f.submit "Save Photo Gallery", :class=>"btn btn-primary form-btn", "data-loading-text" => "Saving..." %>
36
+ or <%= link_to "cancel", request.referer, :class => "btn" %>
37
+ </div>
38
+
39
+ <% end %>
@@ -0,0 +1 @@
1
+ Spud.Admin.Photos.markPhotoGalleryAsDeleted(<%= @photo_gallery.id %>);
@@ -0,0 +1 @@
1
+ <%= render :partial => 'form', :locals => {:path => spud_admin_photo_gallery_path(@photo_gallery)} %>
@@ -0,0 +1,17 @@
1
+ <%= content_for :data_controls do %>
2
+ <%= link_to "New Photo Gallery", new_spud_admin_photo_gallery_path, :class => "btn btn-primary", :title => "New Photo Gallery" %>
3
+ <% end %>
4
+
5
+ <%= content_for :detail do %>
6
+ <div id="spud_admin_photo_galleries" class="spud_admin_photo_ui_thumbs">
7
+ <% @photo_galleries.each do |gallery| %>
8
+ <div id="spud_admin_photo_gallery_<%= gallery.id %>" class="spud_admin_photo_ui_thumb" style="background-image:url('<%= gallery.top_photo_url(:spud_admin_small) %>')">
9
+ <h5><%= gallery.title %></h5>
10
+ <div class="spud_admin_photo_ui_thumb_controls">
11
+ <%= link_to 'Edit', edit_spud_admin_photo_gallery_path(gallery), :class => 'spud_admin_photos_btn_edit' %>
12
+ <%= link_to 'Delete', spud_admin_photo_gallery_path(gallery), :method => :delete, :class => 'spud_admin_photos_btn_delete', :remote => true, :confirm => 'Are you sure?' %>
13
+ </div>
14
+ </div>
15
+ <% end %>
16
+ <div>
17
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= render :partial => 'form', :locals => {:path => spud_admin_photo_galleries_path} %>