diff --git a/app/views/seeds/_form.html.haml b/app/views/seeds/_form.html.haml index 77b4a6998..b7cb3ea36 100644 --- a/app/views/seeds/_form.html.haml +++ b/app/views/seeds/_form.html.haml @@ -1,79 +1,82 @@ = required_field_help_text -= form_for(@seed, :html => {:class => "form-horizontal", :role => "form"}) do |f| += form_for(@seed, html: { class: "form-horizontal", role: "form" }) do |f| - if @seed.errors.any? #error_explanation - %h2= "#{pluralize(@seed.errors.size, "error")} prohibited this seed from being saved:" + %h2 + = pluralize(@seed.errors.size, "error") + prohibited this seed from being saved: %ul - @seed.errors.full_messages.each do |msg| %li= msg .form-group.required - = f.label :crop, 'Crop:', :class => 'control-label col-md-2' + = f.label :crop, 'Crop:', class: 'control-label col-md-2' .col-md-8 - = auto_suggest @seed, :crop, :class => 'form-control', :default => @crop + = auto_suggest @seed, :crop, class: 'form-control', default: @crop %span.help-inline Can't find what you're looking for? = link_to "Request new crops.", new_crop_path .form-group - = f.label :quantity, 'Quantity:', :class => 'control-label col-md-2' + = f.label :quantity, 'Quantity:', class: 'control-label col-md-2' .col-md-2 - = f.number_field :quantity, :class => 'form-control' - = render :partial => 'shared/form_optional' + = f.number_field :quantity, class: 'form-control' + = render partial: 'shared/form_optional' .form-group - = f.label :plant_before, 'Plant before:', :class => 'control-label col-md-2' + = f.label :plant_before, 'Plant before:', class: 'control-label col-md-2' .col-md-2 - = f.text_field :plant_before, :class => 'add-datepicker form-control', :value => @seed.plant_before ? @seed.plant_before.to_s(:ymd) : '' - = render :partial => 'shared/form_optional' + = f.text_field :plant_before, class: 'add-datepicker form-control', + value: @seed.plant_before ? @seed.plant_before.to_s(:ymd) : '' + = render partial: 'shared/form_optional' .form-group - = f.label :days_until_maturity_min, 'Days until maturity:', :class => 'control-label col-md-2' + = f.label :days_until_maturity_min, 'Days until maturity:', class: 'control-label col-md-2' %fieldset .col-md-2 - = f.number_field :days_until_maturity_min, :class => 'form-control' - = render :partial => 'shared/form_optional' + = f.number_field :days_until_maturity_min, class: 'form-control' + = render partial: 'shared/form_optional' .col-md-1 - = f.label :days_until_maturity_max, 'to', :class => 'control-label' + = f.label :days_until_maturity_max, 'to', class: 'control-label' .col-md-2 - = f.number_field :days_until_maturity_max, :class => 'form-control' - = render :partial => 'shared/form_optional' + = f.number_field :days_until_maturity_max, class: 'form-control' + = render partial: 'shared/form_optional' .col-md-1 - = f.label :dummy, 'days', :class => 'control-label' + = f.label :dummy, 'days', class: 'control-label' .form-group.required - = f.label :organic, 'Organic?', :class => 'control-label col-md-2' + = f.label :organic, 'Organic?', class: 'control-label col-md-2' .col-md-8 - = f.select(:organic, Seed::ORGANIC_VALUES, {}, :class => 'form-control', :default => 'unknown') + = f.select(:organic, Seed::ORGANIC_VALUES, {}, class: 'form-control', default: 'unknown') .form-group.required - = f.label :gmo, 'GMO?', :class => 'control-label col-md-2' + = f.label :gmo, 'GMO?', class: 'control-label col-md-2' .col-md-8 - = f.select(:gmo, Seed::GMO_VALUES, {}, :class => 'form-control', :default => 'unknown') + = f.select(:gmo, Seed::GMO_VALUES, {}, class: 'form-control', default: 'unknown') .form-group.required - = f.label :heirloom, 'Heirloom?', :class => 'control-label col-md-2' + = f.label :heirloom, 'Heirloom?', class: 'control-label col-md-2' .col-md-8 - = f.select(:heirloom, Seed::HEIRLOOM_VALUES, {}, :class => 'form-control', :default => 'unknown') + = f.select(:heirloom, Seed::HEIRLOOM_VALUES, {}, class: 'form-control', default: 'unknown') .form-group - = f.label :description, 'Description:', :class => 'control-label col-md-2' + = f.label :description, 'Description:', class: 'control-label col-md-2' .col-md-8 - = f.text_area :description, :rows => 6, :class => 'form-control' - = render :partial => 'shared/form_optional' + = f.text_area :description, rows: 6, class: 'form-control' + = render partial: 'shared/form_optional' .form-group .col-md-offset-2.col-md-8 %span.help-block - = t('.trade_help', :site_name => ENV['GROWSTUFF_SITE_NAME']) + = t('.trade_help', site_name: ENV['GROWSTUFF_SITE_NAME']) .form-group.required - = f.label :tradable_to, 'Will trade:', :class => 'control-label col-md-2' + = f.label :tradable_to, 'Will trade:', class: 'control-label col-md-2' .col-md-8 - = f.select(:tradable_to, Seed::TRADABLE_TO_VALUES, {}, :class => 'form-control') + = f.select(:tradable_to, Seed::TRADABLE_TO_VALUES, {}, class: 'form-control') %span.help_inline - if current_member.location.blank? Don't forget to - =succeed "." do - =link_to "set your location", edit_member_registration_path + = succeed "." do + = link_to "set your location", edit_member_registration_path - else from - =succeed "." do + = succeed "." do = link_to current_member.location, place_path(current_member.location) - =link_to "Change your location.", edit_member_registration_path + = link_to "Change your location.", edit_member_registration_path .form-group .form-actions.col-md-offset-2.col-md-8 - = f.submit 'Save', :class => 'btn btn-primary' + = f.submit 'Save', class: 'btn btn-primary' diff --git a/app/views/seeds/_thumbnail.html.haml b/app/views/seeds/_thumbnail.html.haml index 90743d46a..a48bb13b0 100644 --- a/app/views/seeds/_thumbnail.html.haml +++ b/app/views/seeds/_thumbnail.html.haml @@ -3,12 +3,13 @@ %h3.panel-title = link_to "#{seed.owner.login_name}'s seed", seed - if can? :edit, seed - %a.pull-right{:href => edit_seed_path(seed), :role => "button", :id => "edit_seed_glyphicon"} - %span.glyphicon.glyphicon-pencil{:title => "Edit"} + %a.pull-right{ href: edit_seed_path(seed), role: "button", id: "edit_seed_glyphicon" } + %span.glyphicon.glyphicon-pencil{ title: "Edit" } .panel-body .row .col-md-4 - = link_to image_tag((seed.crop.default_photo ? seed.crop.default_photo.thumbnail_url : 'placeholder_150.png'), :alt => seed.crop.name, :class => 'img'), seed.crop + = link_to image_tag((seed.crop.default_photo ? seed.crop.default_photo.thumbnail_url : 'placeholder_150.png'), + alt: seed.crop.name, class: 'img'), seed.crop .col-md-8 %dl.dl-horizontal %dt Crop : diff --git a/app/views/seeds/index.html.haml b/app/views/seeds/index.html.haml index 800ff9ff9..2887b69e1 100644 --- a/app/views/seeds/index.html.haml +++ b/app/views/seeds/index.html.haml @@ -11,35 +11,36 @@ - if @owner %p - if @owner == current_member - = link_to 'Add seeds', new_seed_path, :class => 'btn btn-primary' - = link_to "View everyone's seeds", seeds_path, :class => 'btn btn-default' + = link_to 'Add seeds', new_seed_path, class: 'btn btn-primary' + = link_to "View everyone's seeds", seeds_path, class: 'btn btn-default' - else # everyone's seeds - = link_to 'Add seeds', new_seed_path, :class => 'btn btn-primary' + = link_to 'Add seeds', new_seed_path, class: 'btn btn-primary' - if current_member - = link_to 'View your seeds', seeds_by_owner_path(:owner => current_member.slug), :class => 'btn btn-default' + = link_to 'View your seeds', seeds_by_owner_path(owner: current_member.slug), class: 'btn btn-default' - else - = render :partial => 'shared/signin_signup', :locals => { :to => 'add seeds to your stash' } + = render partial: 'shared/signin_signup', locals: { to: 'add seeds to your stash' } -%div.pagination +.pagination = page_entries_info @seeds = will_paginate @seeds + .row - - if @seeds.size > 0 + - unless @seeds.empty? - @seeds.each do |seed| .col-md-6 - =render :partial => 'seeds/thumbnail', :locals => {:seed => seed} + = render partial: 'seeds/thumbnail', locals: { seed: seed } -%div.pagination +.pagination = page_entries_info @seeds = will_paginate @seeds %ul.list-inline %li The data on this page is available in the following formats: - if @owner - %li= link_to "CSV", seeds_by_owner_path(@owner, :format => 'csv') - %li= link_to "JSON", seeds_by_owner_path(@owner, :format => 'json') - %li= link_to "RSS", seeds_by_owner_path(@owner, :format => 'rss') + %li= link_to "CSV", seeds_by_owner_path(@owner, format: 'csv') + %li= link_to "JSON", seeds_by_owner_path(@owner, format: 'json') + %li= link_to "RSS", seeds_by_owner_path(@owner, format: 'rss') - else - %li= link_to "CSV", seeds_path(:format => 'csv') - %li= link_to "JSON", seeds_path(:format => 'json') - %li= link_to "RSS", seeds_path(:format => 'rss') + %li= link_to "CSV", seeds_path(format: 'csv') + %li= link_to "JSON", seeds_path(format: 'json') + %li= link_to "RSS", seeds_path(format: 'rss') diff --git a/app/views/seeds/index.rss.haml b/app/views/seeds/index.rss.haml index c35bc0d74..36d542706 100644 --- a/app/views/seeds/index.rss.haml +++ b/app/views/seeds/index.rss.haml @@ -1,13 +1,13 @@ -%rss{:version => 2.0} +%rss{ version: 2.0 } %channel %title - Recent seeds from #{ @owner ? @owner : 'all members' } (#{ENV['GROWSTUFF_SITE_NAME']}) + Recent seeds from #{@owner ? @owner : 'all members'} (#{ENV['GROWSTUFF_SITE_NAME']}) %link= seeds_url - @seeds.each do |seed| %item %title #{seed.owner}'s #{seed.crop} seeds - %pubDate= seed.created_at.to_s(:rfc822) + %pubdate= seed.created_at.to_s(:rfc822) %description :escaped

Quantity: #{seed.quantity ? seed.quantity : 'unknown' }

@@ -16,8 +16,9 @@

GMO? #{seed.gmo}

Heirloom? #{seed.heirloom}

- if seed.tradable? - :escaped -

Will trade #{seed.tradable_to} from #{seed.owner.location ? seed.owner.location : 'unknown location'}

+ %p + Will trade #{seed.tradable_to} from + = seed.owner.location ? seed.owner.location : 'unknown location' :escaped_markdown #{ strip_tags seed.description } diff --git a/app/views/seeds/show.html.haml b/app/views/seeds/show.html.haml index adbdc0159..3226fb0bb 100644 --- a/app/views/seeds/show.html.haml +++ b/app/views/seeds/show.html.haml @@ -15,7 +15,7 @@ %b Owner: = link_to @seed.owner, @seed.owner — - = link_to "view all #{@seed.owner}'s seeds", seeds_by_owner_path(:owner => @seed.owner.slug) + = link_to "view all #{@seed.owner}'s seeds", seeds_by_owner_path(owner: @seed.owner.slug) %p %b Quantity: = @seed.quantity.blank? ? "not specified" : @seed.quantity @@ -24,7 +24,7 @@ = @seed.plant_before.to_s %p %b Days until maturity: - = render :partial => 'days_until_maturity', :locals => { :seed => @seed } + = render partial: 'days_until_maturity', locals: { seed: @seed } %p %b Organic? = @seed.organic @@ -40,7 +40,7 @@ - if @seed.owner.location.blank? (from unspecified location) - if current_member == @seed.owner - = link_to "Set Location", edit_registration_path(current_member), :class => 'btn btn-default btn-xs' + = link_to "Set Location", edit_registration_path(current_member), class: 'btn btn-default btn-xs' - else (from = succeed ")" do @@ -53,19 +53,22 @@ - if current_member - if @seed.tradable? && current_member != @seed.owner - %p= link_to "Request seeds", new_notification_path(:recipient_id => @seed.owner.id, :subject => "Interested in your #{@seed.crop} seeds"), :class => 'btn btn-primary' + %p= link_to "Request seeds", + new_notification_path(recipient_id: @seed.owner.id, + subject: "Interested in your #{@seed.crop} seeds"), + class: 'btn btn-primary' - else - = render :partial => 'shared/signin_signup', :locals => { :to => 'request seeds' } + = render partial: 'shared/signin_signup', locals: { to: 'request seeds' } - - if can? :edit, @seed or can? :destroy, @seed + - if can?(:edit, @seed) || can?(:destroy, @seed) %p - if can? :edit, @seed - =link_to 'Edit', edit_seed_path(@seed), :class => 'btn btn-default btn-xs' + = link_to 'Edit', edit_seed_path(@seed), class: 'btn btn-default btn-xs' - if can? :destroy, @seed - =link_to 'Delete', @seed, method: :delete, data: { confirm: 'Are you sure?' }, :class => 'btn btn-default btn-xs' + = link_to 'Delete', @seed, method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-default btn-xs' .col-md-6 - = render :partial => "crops/index_card", :locals => { :crop => @seed.crop } + = render partial: "crops/index_card", locals: { crop: @seed.crop } - if @seed.owner.location %p %small @@ -74,4 +77,5 @@ %p %small Or - = link_to "purchase seeds via Ebay", "http://rover.ebay.com/rover/1/705-53470-19255-0/1?icep_ff3=9&pub=5575213277&toolid=10001&campid=5337940151&customid=&icep_uq=#{URI.escape @seed.crop.name}&icep_sellerId=&icep_ex_kw=&icep_sortBy=12&icep_catId=181003&icep_minPrice=&icep_maxPrice=&ipn=psmain&icep_vectorid=229515&kwid=902099&mtid=824&kw=lg", target: "_blank", rel: "noopener noreferrer" \ No newline at end of file + = link_to "purchase seeds via Ebay", + crop_ebay_seeds_url(@seed.crop), target: "_blank", rel: "noopener noreferrer"