Haml clean up for photos

This commit is contained in:
Brenda Wallace
2017-02-07 17:35:14 +13:00
committed by Shiny
parent 17e88778c8
commit 2c3d1848d5
4 changed files with 24 additions and 18 deletions

View File

@@ -1,5 +1,5 @@
.thumbnail.photo-thumbnail
= link_to image_tag(photo.thumbnail_url, :alt => photo.title, :class => 'img img-responsive'), photo
= link_to image_tag(photo.thumbnail_url, alt: photo.title, class: 'img img-responsive'), photo
.text
%p
= link_to photo.title, photo

View File

@@ -2,21 +2,21 @@
%p Most recent photos added to #{ENV['GROWSTUFF_SITE_NAME']}.
%div.pagination
.pagination
= page_entries_info @photos
= will_paginate @photos
.row
- @photos.each do |p|
.col-md-2.six-across
.thumbnail(style='height: 220px')
= link_to image_tag(p.thumbnail_url, :alt => p.title, :class => 'img'), p
.thumbnail{ style: 'height: 220px' }
= link_to image_tag(p.thumbnail_url, alt: p.title, class: 'img'), p
%p
= link_to p.title, p
by
= link_to p.owner, p.owner
%div.pagination
.pagination
= page_entries_info @photos
= will_paginate @photos

View File

@@ -7,32 +7,34 @@
= link_to @flickr_auth.name, "http://flickr.com/photos/#{@flickr_auth.uid}"
Please select a photo from your recent uploads.
- if @sets and @current_set
- if @sets && @current_set
%h2= @sets.key(@current_set)
- if @sets and @sets.size > 0
- if @sets && !@sets.empty?
%p
= form_tag(new_photo_path, :method => :get, :class => 'form-inline') do
= label_tag :set, "Choose a photo album:", :class => 'control-label'
= select_tag :set, options_for_select(@sets, @current_set), :class => 'input-large'
= form_tag(new_photo_path, method: :get, class: 'form-inline') do
= label_tag :set, "Choose a photo album:", class: 'control-label'
= select_tag :set, options_for_select(@sets, @current_set), class: 'input-large'
= hidden_field_tag :type, @type
= hidden_field_tag :id, @id
= submit_tag "Search", :class => 'btn btn-primary'
= submit_tag "Search", class: 'btn btn-primary'
%div.pagination
.pagination
= page_entries_info @photos
= will_paginate @photos
.row
- @photos.each do |p|
.col-md-2.six-across
.thumbnail(style='height: 220px')
= link_to image_tag(FlickRaw.url_q(p), :alt => '', :class => 'img'), photos_path(:photo => { :flickr_photo_id => p.id }, :type => @type, :id => @id), :method => :post
.thumbnail{ style: 'height: 220px' }
= link_to image_tag(FlickRaw.url_q(p), alt: '', class: 'img'),
photos_path(photo: { flickr_photo_id: p.id }, type: @type, id: @id),
method: :post
%p
=p.title
= p.title
- else
.alert
You must
=link_to "connect your account to Flickr", '/auth/flickr'
= link_to "connect your account to Flickr", '/auth/flickr'
to add photos.

View File

@@ -23,7 +23,11 @@
= link_to "View on Flickr", @photo.link_url
- if can? :destroy, @photo
%p= link_to 'Delete Photo', @photo, method: :delete, data: { confirm: 'Are you sure?' }, :class => 'btn btn-default btn-xs'
%p= link_to 'Delete Photo',
@photo,
method: :delete,
data: { confirm: 'Are you sure?' },
class: 'btn btn-default btn-xs'
.col-md-6
- unless @photo.plantings.empty? && @photo.harvests.empty? && @photo.gardens.empty? && @photo.seeds.empty?
@@ -40,5 +44,5 @@
.row
.col-md-12
%p= image_tag(@photo.fullsize_url, :alt => @photo.title, :class => 'img')
%p= image_tag(@photo.fullsize_url, alt: @photo.title, class: 'img')