tb_photos 1.0.6 → 1.1.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/admin/photos/photo_albums_thumb.png +0 -0
  3. data/app/assets/javascripts/admin/photos/photos.js +389 -382
  4. data/app/assets/stylesheets/admin/photos/application.css.scss +49 -51
  5. data/app/controllers/admin/photo_albums_controller.rb +3 -3
  6. data/app/controllers/admin/photo_galleries_controller.rb +4 -3
  7. data/app/controllers/admin/photos_controller.rb +12 -1
  8. data/app/controllers/photo_albums_controller.rb +4 -4
  9. data/app/controllers/photo_galleries_controller.rb +1 -1
  10. data/app/models/spud_photo_album.rb +2 -0
  11. data/app/models/spud_photo_gallery.rb +2 -0
  12. data/app/views/admin/photo_albums/_album.html.erb +5 -5
  13. data/app/views/admin/photo_albums/_form.html.erb +32 -23
  14. data/app/views/admin/photo_albums/destroy.js.erb +1 -1
  15. data/app/views/admin/photo_albums/index.html.erb +1 -1
  16. data/app/views/admin/photo_galleries/_album.html.erb +9 -0
  17. data/app/views/admin/photo_galleries/_form.html.erb +21 -21
  18. data/app/views/admin/photo_galleries/index.html.erb +6 -6
  19. data/app/views/admin/photos/_form.html.erb +11 -28
  20. data/app/views/admin/photos/_photo.html.erb +6 -6
  21. data/app/views/admin/photos/index.html.erb +1 -1
  22. data/app/views/layouts/admin/spud_photos.html.erb +1 -1
  23. data/app/views/photo_albums/index.html.erb +2 -2
  24. data/app/views/photo_albums/show.html.erb +2 -2
  25. data/app/views/photo_galleries/index.html.erb +2 -2
  26. data/db/migrate/20140730201754_add_fingerprint_to_spud_photos.rb +6 -0
  27. data/lib/spud_photos/version.rb +1 -1
  28. metadata +6 -7
  29. data/app/assets/images/admin/photos/buttons/cog_16x16.png +0 -0
  30. data/app/assets/images/admin/photos/buttons/x_16x16.png +0 -0
  31. data/app/assets/images/admin/photos/photo_albums_thumb@2x.png +0 -0
@@ -1,15 +1,16 @@
1
1
  //= require_self
2
2
 
3
+ $editor-height: 450px;
4
+
3
5
  // Thumbnails
4
6
  //////////////
5
- .spud_admin_photo_ui_thumbs{
6
- height: 300px;
7
+ .admin-photo-ui-thumbs{
8
+ height: $editor-height;
7
9
  padding: 0;
8
- border: 1px solid #cacaca;
9
- margin: 15px 0;
10
+ border: 1px solid #EAEAEA;
10
11
  overflow-y: scroll;
11
12
  }
12
- .spud_admin_photo_ui_thumb{
13
+ .admin-photo-ui-thumb{
13
14
  width: 125px;
14
15
  height: 125px;
15
16
  float: left;
@@ -29,32 +30,32 @@
29
30
  -webkit-transition-duration: 0.2s;
30
31
  -webkit-transition-timing-function: ease-out;
31
32
  }
32
- .spud_admin_photo_ui_thumb_small{
33
- width: 100px;
34
- height: 100px;
35
- background-size: 100px 100px;
33
+ .admin-photo-ui-thumb-small{
34
+ width: 94px;
35
+ height: 94px;
36
+ background-size: 94px 94px;
36
37
  margin: 12px;
37
38
  }
38
- .spud_admin_photo_ui_thumb:hover{
39
+ .admin-photo-ui-thumb:hover{
39
40
  box-shadow: 0 0 5px black;
40
41
  }
41
- .spud_admin_photo_ui_thumbs_selectable .spud_admin_photo_ui_thumb{
42
+ .admin-photo-ui-thumbs-selectable .admin-photo-ui-thumb{
42
43
  cursor: pointer;
43
44
  }
44
- .spud_admin_photo_ui_thumbs_selectable .spud_admin_photo_ui_thumb_controls{
45
+ .admin-photo-ui-thumbs-selectable .admin-photo-ui-thumb-controls{
45
46
  display: none;
46
47
  }
47
- .spud_admin_photo_ui_thumb_selected{
48
+ .admin-photo-ui-thumb-selected{
48
49
  border: 3px solid #006CCC;
49
50
  margin: 13px;
50
51
  }
51
- .spud_admin_photo_ui_thumb_small.spud_admin_photo_ui_thumb_selected{
52
+ .admin-photo-ui-thumb-small.admin-photo-ui-thumb-selected{
52
53
  margin: 9px;
53
54
  }
54
- .spud_admin_photo_ui_thumbs_sortable .spud_admin_photo_ui_thumb{
55
+ .admin-photo-ui-thumbs-sortable .admin-photo-ui-thumb{
55
56
  cursor: move;
56
57
  }
57
- .spud_admin_photo_ui_thumb h5{
58
+ .admin-photo-ui-thumb h5{
58
59
  font-size: 12px;
59
60
  color: white;
60
61
  text-align: center;
@@ -67,7 +68,7 @@
67
68
  text-overflow: ellipsis;
68
69
  margin: 0;
69
70
  }
70
- .spud_admin_photo_ui_thumb_controls{
71
+ .admin-photo-ui-thumb-controls{
71
72
  position: absolute;
72
73
  bottom: 0;
73
74
  right: 0;
@@ -76,55 +77,52 @@
76
77
  background: rgba(0,0,0,0.5);
77
78
  border-bottom-right-radius: 15px;
78
79
  }
79
- .spud_admin_photos_btn_remove, .spud_admin_photos_btn_delete{
80
- background: image-url('admin/photos/buttons/x_16x16.png');
80
+ .admin-photos-btn-edit, .admin-photos-btn-remove, .admin-photos-btn-delete{
81
+ color: white;
82
+ position: relative;
83
+ top: 1px;
84
+ margin: 0 2px;
81
85
  height: 16px;
82
86
  width: 16px;
83
- text-indent: -7777px;
84
87
  display: inline-block;
85
- margin: 0 4px;
88
+ font: normal 16px/16px 'Glyphicons Halflings';
89
+ -webkit-font-smoothing: antialiased;
90
+ &:hover{
91
+ color: white;
92
+ text-decoration: none;
93
+ }
86
94
  }
87
- .spud_admin_photos_btn_edit{
88
- background: image-url('admin/photos/buttons/cog_16x16.png');
89
- height: 16px;
90
- width: 16px;
91
- text-indent: -7777px;
92
- display: inline-block;
93
- margin: 0 4px;
95
+ .admin-photos-btn-edit:before{
96
+ content: "\e019";
97
+ }
98
+ .admin-photos-btn-remove, .admin-photos-btn-delete{
99
+ &:before{
100
+ content: "\e014";
101
+ }
102
+ }
103
+
104
+ // Album Edit
105
+ ////////////
106
+ .admin-photo-album-column{
107
+ margin-bottom: 20px;
94
108
  }
95
109
 
96
110
  // Upload Queue
97
111
  //////////////
98
- .spud_admin_photo_progress{
112
+ .admin-photo-progress{
99
113
  margin: 10px 0;
100
114
  }
101
- #spud_admin_photo_upload_queue{
115
+ #admin-photo-upload-queue{
102
116
  display: none;
103
117
  background: white;
104
118
  padding: 15px;
105
- margin: 0 0 0 10px;
106
- width: 250px;
107
- height: 270px;
108
- float: right;
109
- border: 1px solid #cacaca;
119
+ height: $editor-height;
120
+ border: 1px solid #EAEAEA;
110
121
  overflow-y: scroll;
111
122
  }
112
-
123
+
113
124
  // Gallery Form
114
125
  //////////////
115
- .spud_admin_photos_selection_left{
116
- width: 520px;
117
- margin-right: 18px;
118
- float: left;
119
- }
120
- .spud_admin_photos_selection_right{
121
- width: 400px;
122
- float: left;
123
- }
124
- .spud_admin_photos_selection_left h4, .spud_admin_photos_selection_right h4{
125
- font-weight: normal;
126
- margin: 15px 0;
127
- }
128
- #spud_admin_photo_gallery_form .spud_admin_photo_ui_thumb_controls{
126
+ .admin-photo-albums-available .admin-photo-ui-thumb-controls{
129
127
  display: none;
130
- }
128
+ }
@@ -3,6 +3,7 @@ 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
+ belongs_to_spud_app :photo_albums
6
7
 
7
8
  def index
8
9
  @photo_albums = SpudPhotoAlbum.all
@@ -34,13 +35,13 @@ class Admin::PhotoAlbumsController < Admin::ApplicationController
34
35
  @photo_album.update_attributes(photo_album_params)
35
36
  if @photo_album.save
36
37
  set_photo_order
37
- flash[:notice] = 'SpudPhotoAlbum updated successfully'
38
+ flash[:notice] = 'Album updated successfully'
38
39
  end
39
40
  respond_with @photo_album, :location => admin_photo_albums_path
40
41
  end
41
42
 
42
43
  def destroy
43
- flash[:notice] = 'SpudPhotoAlbum deleted successfully' if @photo_album.destroy
44
+ flash.now[:notice] = 'Album deleted successfully' if @photo_album.destroy
44
45
  respond_with @photo_album, :location => admin_photo_albums_path
45
46
  end
46
47
 
@@ -53,7 +54,6 @@ private
53
54
  def set_photo_order
54
55
  order_ids = params[:spud_photo_album][:photo_ids] || []
55
56
  @photo_album.spud_photo_albums_photos.each do |obj|
56
- #logger.debug "##### ID: #{obj.spud_photo_id.to_s}"
57
57
  index = order_ids.index(obj.spud_photo_id.to_s)
58
58
  obj.update_attribute(:sort_order, index)
59
59
  end
@@ -4,6 +4,7 @@ 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
+ belongs_to_spud_app :photo_galleries
7
8
 
8
9
  def index
9
10
  @photo_galleries = SpudPhotoGallery.all
@@ -21,7 +22,7 @@ class Admin::PhotoGalleriesController < Admin::ApplicationController
21
22
 
22
23
  def create
23
24
  @photo_gallery = SpudPhotoGallery.new(photo_gallery_params)
24
- flash[:notice] = 'SpudPhotoGallery created successfully' if @photo_gallery.save
25
+ flash[:notice] = 'Gallery created successfully' if @photo_gallery.save
25
26
  respond_with @photo_gallery, :location => admin_photo_galleries_path
26
27
  end
27
28
 
@@ -31,12 +32,12 @@ class Admin::PhotoGalleriesController < Admin::ApplicationController
31
32
 
32
33
  def update
33
34
  @photo_gallery.update_attributes(photo_gallery_params)
34
- flash[:notice] = 'SpudPhotoGallery updated successfully' if @photo_gallery.save
35
+ flash[:notice] = 'Gallery updated successfully' if @photo_gallery.save
35
36
  respond_with @photo_gallery, :location => admin_photo_galleries_path
36
37
  end
37
38
 
38
39
  def destroy
39
- flash[:notice] = 'SpudPhotoGallery deleted successfully' if @photo_gallery.destroy
40
+ flash.now[:notice] = 'Gallery deleted successfully' if @photo_gallery.destroy
40
41
  respond_with @photo_gallery, :location => admin_photo_galleries_path
41
42
  end
42
43
 
@@ -1,6 +1,7 @@
1
1
  class Admin::PhotosController < Admin::ApplicationController
2
2
 
3
3
  include RespondsToParent
4
+ belongs_to_spud_app :photo_albums
4
5
 
5
6
  before_filter :get_photo, :only => [:show, :edit, :update, :destroy]
6
7
  layout false
@@ -22,7 +23,17 @@ class Admin::PhotosController < Admin::ApplicationController
22
23
  end
23
24
 
24
25
  def create
25
- @photo = SpudPhoto.new(photo_params)
26
+ photo_file = photo_params[:photo]
27
+ if photo_file.present?
28
+ fingerprint = Digest::MD5.hexdigest(photo_file.read)
29
+ photo_file.rewind
30
+ @photo = SpudPhoto.where(:photo_fingerprint => fingerprint).first
31
+ end
32
+
33
+ if @photo.blank?
34
+ @photo = SpudPhoto.new(photo_params)
35
+ end
36
+
26
37
  if @photo.save
27
38
  success = true
28
39
  flash[:notice] = 'SpudPhoto created successfully'
@@ -9,15 +9,15 @@ class PhotoAlbumsController < ApplicationController
9
9
 
10
10
  def index
11
11
  if @photo_gallery
12
- @photo_albums = @photo_gallery.albums.order('created_at desc')
12
+ @photo_albums = @photo_gallery.albums.ordered
13
13
  else
14
- @photo_albums = SpudPhotoAlbum.order('created_at desc')
14
+ @photo_albums = SpudPhotoAlbum.ordered
15
15
  end
16
16
  respond_with @photo_albums
17
17
  end
18
18
 
19
19
  def show
20
- @photo_album = SpudPhotoAlbum.where(:url_name => params[:id]).first
20
+ @photo_album = SpudPhotoAlbum.find_by(:url_name => params[:id])
21
21
  if @photo_album.blank?
22
22
  raise Spud::NotFoundError.new(:item => 'photo album')
23
23
  else
@@ -28,7 +28,7 @@ class PhotoAlbumsController < ApplicationController
28
28
  private
29
29
 
30
30
  def get_gallery
31
- @photo_gallery = SpudPhotoGallery.where(:url_name => params[:photo_gallery_id]).first
31
+ @photo_gallery = SpudPhotoGallery.find_by(:url_name => params[:photo_gallery_id])
32
32
  if @photo_gallery.blank?
33
33
  raise Spud::NotFoundError.new(:item => 'photo gallery')
34
34
  end
@@ -4,7 +4,7 @@ class PhotoGalleriesController < ApplicationController
4
4
  layout Spud::Photos.base_layout
5
5
 
6
6
  def index
7
- @photo_galleries = SpudPhotoGallery.order('created_at desc')
7
+ @photo_galleries = SpudPhotoGallery.ordered
8
8
  respond_with @photo_galleries
9
9
  end
10
10
 
@@ -16,6 +16,8 @@ class SpudPhotoAlbum < ActiveRecord::Base
16
16
  before_validation :set_url_name
17
17
  after_save :update_photo_order
18
18
 
19
+ scope :ordered, ->{ order('created_at desc') }
20
+
19
21
  def top_photo_url(style)
20
22
  if photos.length > 0
21
23
  return photos.first.photo.url(style)
@@ -9,6 +9,8 @@ class SpudPhotoGallery < ActiveRecord::Base
9
9
  validates_uniqueness_of :title, :url_name
10
10
  before_validation :set_url_name
11
11
 
12
+ scope :ordered, ->{ order('created_at desc') }
13
+
12
14
  def top_photo_url(style)
13
15
  unless albums.empty?
14
16
  return albums.first.top_photo_url(style)
@@ -1,10 +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) %>')">
1
+ <div id="admin-photo-album-<%= album.id %>" class="admin-photo-ui-thumb" style="background-image:url('<%= album.top_photo_url(:spud_admin_small) %>')">
2
2
  <h5><%= album.title %></h5>
3
3
  <div style="display:none;">
4
4
  <%= hidden_field_tag 'spud_photo_gallery[album_ids][]', album.id %>
5
5
  </div>
6
- <div class="spud_admin_photo_ui_thumb_controls">
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, :data => {:confirm => 'Are you sure?'} %>
6
+ <div class="admin-photo-ui-thumb-controls">
7
+ <%= link_to '', edit_admin_photo_album_path(album), :class => 'admin-photos-btn-edit' %>
8
+ <%= link_to '', admin_photo_album_path(album), :method => :delete, :class => 'admin-photos-btn-delete', :remote => true, :data => {:confirm => 'Are you sure?'} %>
9
9
  </div>
10
- </div>
10
+ </div>
@@ -1,36 +1,45 @@
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) %>
1
+ <%= form_for @photo_album, :url => path, :builder => TbCore::FormBuilder, :html => {:class => 'form-horizontal', :id => 'admin-photo-album-form'} do |f| %>
4
2
 
3
+ <%= tb_form_errors(f.object) %>
4
+
5
5
  <fieldset>
6
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>
7
+ <%= f.tb_text_field :title %>
13
8
  </fieldset>
14
9
 
15
- <fieldset class="spud_admin_photos_album_fieldset">
10
+ <fieldset>
16
11
  <legend>Selected Photos</legend>
17
- <div id="spud_admin_photo_album_actions" class="control-group">
18
- <%= link_to "Photo Library", admin_photos_path, :class => "btn btn-primary", :id => 'spud_admin_photo_album_action_library' %>
19
- <%= link_to "Upload Photo", new_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>
12
+
13
+ <div class="row">
14
+ <div class="col-md-12 admin-photo-album-column">
15
+ <%= link_to "Photo Library", admin_photos_path, :class => "btn btn-sm btn-primary", :id => 'admin-photo-album-action-library' %>
16
+ <%= link_to "Upload Photo", new_admin_photo_path, :class => "btn btn-sm btn-success", :id => 'admin-photo-album-action-upload' %>
17
+ </div>
25
18
  </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 => '/admin/photos/photo', :collection => @photo_album.photos %>
19
+
20
+ <div class="row">
21
+ <div class="col-md-8 admin-photo-album-column">
22
+ <div id="admin-photos-selected" class="control-group admin-photo-ui-thumbs admin-photo-ui-thumbs-sortable">
23
+ <%= render :partial => '/admin/photos/photo', :collection => @photo_album.photos %>
24
+ </div>
25
+ </div>
26
+
27
+ <div class="col-md-4 admin-photo-album-column">
28
+ <div id="admin-photo-upload-queue">
29
+ <p>Drag and drop photos here to upload</p>
30
+ <h5 id="admin-photo-upload-queue_label">Queued Uploads: <span>0</span></h5>
31
+ <div id="admin-photo-upload-queue_bars"></div>
32
+ </div>
33
+ </div>
34
+
28
35
  </div>
29
36
  </fieldset>
30
37
 
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" %>
38
+ <div class="row">
39
+ <div class="col-md-12 admin-photo-album-column">
40
+ <%= f.submit "Save Photo Album", :class=>"btn btn-primary" %>
41
+ <%= link_to "Cancel", request.referer, :class => "btn btn-default" %>
42
+ </div>
34
43
  </div>
35
44
 
36
45
  <% end %>
@@ -1 +1 @@
1
- Spud.Admin.Photos.markPhotoAlbumAsDeleted(<%= @photo_album.id %>);
1
+ spud.admin.photos.markPhotoAlbumAsDeleted(<%= @photo_album.id %>);
@@ -3,7 +3,7 @@
3
3
  <% end %>
4
4
 
5
5
  <%= content_for :detail do %>
6
- <div id="spud_admin_photo_galleries" class="spud_admin_photo_ui_thumbs">
6
+ <div id="admin-photo-galleries" class="admin-photo-ui-thumbs">
7
7
  <%= render :partial => 'album', :collection => @photo_albums %>
8
8
  <div>
9
9
  <% end %>
@@ -0,0 +1,9 @@
1
+ <div id="admin-photo-album-<%= album.id %>" class="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="admin-photo-ui-thumb-controls">
7
+ <%= link_to '', '#', :class => 'admin-photos-btn-delete' %>
8
+ </div>
9
+ </div>
@@ -1,15 +1,10 @@
1
- <%= form_for @photo_gallery, :url => path, :html => {:class => 'form-horizontal', :id => 'spud_admin_photo_gallery_form'} do |f| %>
1
+ <%= form_for @photo_gallery, :url => path, :builder => TbCore::FormBuilder, :html => {:class => 'form-horizontal', :id => 'admin-photo-gallery-form'} do |f| %>
2
2
 
3
- <%= error_messages_for(f.object) %>
3
+ <%= tb_form_errors(f.object) %>
4
4
 
5
5
  <fieldset>
6
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>
7
+ <%= f.tb_text_field :title %>
13
8
  </fieldset>
14
9
 
15
10
  <!-- if no albums are selected below, this ensures we send an empty album_ids array -->
@@ -17,23 +12,28 @@
17
12
 
18
13
  <fieldset>
19
14
  <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 => '/admin/photo_albums/album', :collection => @photo_gallery.albums %>
15
+
16
+ <div class="row">
17
+ <div class="col-md-8 admin-photo-album-column">
18
+ <h4>Selected:</h4>
19
+ <div class="admin-photo-ui-thumbs admin-photo-ui-thumbs-sortable">
20
+ <%= render :partial => 'album', :collection => @photo_gallery.albums %>
21
+ </div>
24
22
  </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 => '/admin/photo_albums/album', :collection => @photo_gallery.albums_available %>
23
+ <div class="col-md-4 admin-photo-album-column">
24
+ <h4>Available:</h4>
25
+ <div class="admin-photo-ui-thumbs admin-photo-ui-thumbs-sortable admin-photo-albums-available">
26
+ <%= render :partial => 'album', :collection => @photo_gallery.albums_available %>
27
+ </div>
30
28
  </div>
31
29
  </div>
32
30
  </fieldset>
33
31
 
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" %>
32
+ <div class="row">
33
+ <div class="col-md-12 admin-photo-album-column">
34
+ <%= f.submit "Save Photo Gallery", :class => "btn btn-primary" %>
35
+ <%= link_to "Cancel", request.referer, :class => "btn btn-default" %>
36
+ </div>
37
37
  </div>
38
38
 
39
- <% end %>
39
+ <% end %>
@@ -3,15 +3,15 @@
3
3
  <% end %>
4
4
 
5
5
  <%= content_for :detail do %>
6
- <div id="spud_admin_photo_galleries" class="spud_admin_photo_ui_thumbs">
6
+ <div id="admin-photo-galleries" class="admin-photo-ui-thumbs">
7
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) %>')">
8
+ <div id="admin-photo-gallery-<%= gallery.id %>" class="admin-photo-ui-thumb" style="background-image:url('<%= gallery.top_photo_url(:spud_admin_small) %>')">
9
9
  <h5><%= gallery.title %></h5>
10
- <div class="spud_admin_photo_ui_thumb_controls">
11
- <%= link_to 'Edit', edit_admin_photo_gallery_path(gallery), :class => 'spud_admin_photos_btn_edit' %>
12
- <%= link_to 'Delete', admin_photo_gallery_path(gallery), :method => :delete, :class => 'spud_admin_photos_btn_delete', :remote => true, :confirm => 'Are you sure?' %>
10
+ <div class="admin-photo-ui-thumb-controls">
11
+ <%= link_to '', edit_admin_photo_gallery_path(gallery), :class => 'admin-photos-btn-edit' %>
12
+ <%= link_to '', admin_photo_gallery_path(gallery), :method => :delete, :class => 'admin-photos-btn-delete', :remote => true, :data => {:confirm => 'Are you sure?'} %>
13
13
  </div>
14
14
  </div>
15
15
  <% end %>
16
16
  <div>
17
- <% end %>
17
+ <% end %>
@@ -1,41 +1,24 @@
1
- <%= form_for @photo, :url => (@photo.new_record? ? admin_photos_path : admin_photo_path(@photo)), :html => {:id => 'spud_admin_photo_form', :target => 'spud_admin_photo_form_target', :class => 'form-horizontal'} do |f| %>
1
+ <%= form_for @photo, :url => (@photo.new_record? ? admin_photos_path : admin_photo_path(@photo)), :builder => TbCore::FormBuilder, :html => {:id => 'admin-photo-form', :target => 'admin-photo-form_target', :class => 'form-horizontal'} do |f| %>
2
2
 
3
- <%=error_messages_for(f.object)%>
3
+ <%= tb_form_errors(f.object) %>
4
4
 
5
5
  <fieldset>
6
6
  <legend>Photo 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
- <div class="control-group">
14
- <%= f.label :caption, :class => "control-label" %>
15
- <div class="controls">
16
- <%= f.text_field :caption %>
17
- </div>
18
- </div>
7
+ <%= f.tb_text_field :title %>
8
+ <%= f.tb_text_field :caption %>
19
9
  </fieldset>
20
10
 
21
11
  <fieldset>
22
12
  <legend id="fileUploadSizeLegend">File Upload</span></legend>
23
- <div class="control-group">
24
- <%= f.label :photo, :class => "control-label" %>
25
- <div class="controls">
26
- <%= f.file_field :photo %>
27
- </div>
28
- </div>
13
+ <span class="help-block admin-photo-form-max-size"></span>
14
+ <%= f.tb_file_field :photo %>
29
15
  <% unless @photo.new_record? %>
30
- <div class="control-group">
31
- <label class="control-label">Current Photo</label>
32
- <div class="controls">
33
- <%= image_tag @photo.photo.url(:spud_admin_medium), :class => 'admin-photo-form-current-photo' %>
34
- </div>
35
- </div>
16
+ <%= f.tb_input_field 'Current Photo' do %>
17
+ <%= image_tag @photo.photo.url(:spud_admin_medium), :class => 'admin-photo-form-current-photo' %>
18
+ <% end %>
36
19
  <% end %>
37
20
  </fieldset>
38
21
 
39
- <iframe id="spud_admin_photo_form_target" name="spud_admin_photo_form_target" style="display:none;"></iframe>
22
+ <iframe id="admin-photo-form_target" name="admin-photo-form_target" style="display:none;"></iframe>
40
23
 
41
- <% end %>
24
+ <% end %>
@@ -1,13 +1,13 @@
1
1
  <%= content_tag :div,
2
2
  :rel => photo.id,
3
- :id => "spud_admin_photo_#{photo.id}",
3
+ :id => "admin-photo-#{photo.id}",
4
4
  :style => "background-image:url('#{photo.photo.url(:spud_admin_small)}')",
5
- :class => "spud_admin_photo_ui_thumb spud_admin_photo_ui_thumb_small spud_admin_photo" do %>
5
+ :class => "admin-photo-ui-thumb admin-photo-ui-thumb-small admin-photo" do %>
6
6
  <div style="display:none;">
7
7
  <%= hidden_field_tag 'spud_photo_album[photo_ids][]', photo.id %>
8
8
  </div>
9
- <div class="spud_admin_photo_ui_thumb_controls">
10
- <%= link_to 'Edit', edit_admin_photo_path(photo), :class => 'spud_admin_photos_btn_edit' %>
11
- <%= link_to 'Delete', '#', :class => 'spud_admin_photos_btn_remove' %>
9
+ <div class="admin-photo-ui-thumb-controls">
10
+ <%= link_to '', edit_admin_photo_path(photo), :class => 'admin-photos-btn-edit' %>
11
+ <%= link_to '', '#', :class => 'admin-photos-btn-remove' %>
12
12
  </div>
13
- <% end %>
13
+ <% end %>
@@ -1,3 +1,3 @@
1
- <div id="spud_admin_photo_library" class="spud_admin_photo_ui_thumbs spud_admin_photo_ui_thumbs_selectable">
1
+ <div id="admin-photo-library" class="admin-photo-ui-thumbs admin-photo-ui-thumbs-selectable">
2
2
  <%= render :partial => 'photo', :collection => @photos %>
3
3
  <div>
@@ -5,4 +5,4 @@
5
5
  spud.admin.photos.max_image_upload_size_bytes = <%= Spud::Photos.max_image_upload_size %>;
6
6
  </script>
7
7
  <% end %>
8
- <%= render :template => 'layouts/admin/detail' %>
8
+ <%= render :template => 'layouts/admin/detail' %>
@@ -11,9 +11,9 @@
11
11
  <% end %>
12
12
 
13
13
  <% cache([@photo_gallery, @photo_albums]) do %>
14
- <div id="spud_photo_albums">
14
+ <div class="photo-albums">
15
15
  <% @photo_albums.each do |album| %>
16
- <div class="spud_photo_album_thumbnail">
16
+ <div class="photo-album-thumbnail">
17
17
  <h3>
18
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
19
  </h3>
@@ -13,9 +13,9 @@
13
13
  <p><%= link_to 'Back to Albums', photo_albums_path %>
14
14
  <% end %>
15
15
 
16
- <div id="spud_photo_galleries">
16
+ <div class="photo-galleries">
17
17
  <% @photo_album.photos.each do |photo| %>
18
- <div class="spud_photo_album_thumbnail">
18
+ <div class="photo-album-thumbnail">
19
19
  <%= link_to image_tag(photo.photo.url(:small), :alt => photo.caption, :title => photo.title), photo.photo.url(:large) %>
20
20
  </div>
21
21
  <% end %>
@@ -7,10 +7,10 @@
7
7
  <h2>Photo Galleries</h2>
8
8
 
9
9
  <% cache(@photo_galleries) do %>
10
- <div id="spud_photo_galleries">
10
+ <div class="photo-galleries">
11
11
  <% @photo_galleries.each do |gallery| %>
12
12
  <% cache(gallery) do %>
13
- <div class="spud_photo_gallery_thumbnail">
13
+ <div class="photo-gallery-thumbnail">
14
14
  <h3><%= link_to gallery.title, photo_gallery_photo_albums_path(gallery.url_name) %></h3>
15
15
  <%= image_tag gallery.top_photo_url(:medium), :title => gallery.title %>
16
16
  </div>
@@ -0,0 +1,6 @@
1
+ class AddFingerprintToSpudPhotos < ActiveRecord::Migration
2
+ def change
3
+ add_column :spud_photos, :photo_fingerprint, :string
4
+ add_index :spud_photos, :photo_fingerprint
5
+ end
6
+ end