diff --git a/app/views/albums/_thumbnails.html.erb b/app/views/albums/_thumbnails.html.erb new file mode 100644 index 0000000..16456bb --- /dev/null +++ b/app/views/albums/_thumbnails.html.erb @@ -0,0 +1,33 @@ + + +
+ <% album_pictures.order('date_taken').each do |picture| %> +
+
+ <% if ((can? :edit, picture) && (picture.user_id == current_user.id || current_user.role?(:admin) )) %> + <%= link_to(edit_picture_path(picture, :album_id => album.id, :imageable_id => album.id, :imageable_type => 'Album'), + class: "button-sm") do %> + + <% end %> + <% end %> + <% if ((can? :destroy, picture) && (album.user_id == current_user.id || current_user.role?(:admin) )) %> + <%= link_to(picture, class: "button-sm-danger", + :data => { :confirm => "Are you sure you want to delete #{picture.name}?" }, :method => :delete) do %> + + <% end %> + <% end %> + <%= link_to(picture_path(picture)) do %> + <%= picture.name %> + <% end %> +
+

<%= picture.description %>

+
<%= picture.date_taken %>
+
+
+
+ <% end %> +
diff --git a/app/views/albums/show.html.erb b/app/views/albums/show.html.erb index c42f651..af36a37 100644 --- a/app/views/albums/show.html.erb +++ b/app/views/albums/show.html.erb @@ -31,38 +31,7 @@ <% if params["view"] == 'carousel' %> <%= render partial: 'carousel', locals: { album_pictures: @album_pictures } %> <% else %> - -
- <% @album_pictures.order('date_taken').each do |picture| %> -
-
- <% if ((can? :edit, picture) && (picture.user_id == current_user.id || current_user.role?(:admin) )) %> - <%= link_to(edit_picture_path(picture, :album_id => @album.id, :imageable_id => @album.id, :imageable_type => 'Album'), - class: "button-sm") do %> - - <% end %> - <% end %> - <% if ((can? :destroy, picture) && (@album.user_id == current_user.id || current_user.role?(:admin) )) %> - <%= link_to(picture, class: "button-sm-danger", - :data => { :confirm => "Are you sure you want to delete #{picture.name}?" }, :method => :delete) do %> - - <% end %> - <% end %> - <%= link_to(picture_path(picture)) do %> - <%= picture.name %> - <% end %> -
-

<%= picture.description %>

-
<%= picture.date_taken %>
-
-
-
- <% end %> -
+ <%= render partial: 'thumbnails', locals: { album_pictures: @album_pictures, album: @album } %> <% end %>