diff --git a/app/views/crops/show.html.haml b/app/views/crops/show.html.haml index cdaedc917..e3364fa15 100644 --- a/app/views/crops/show.html.haml +++ b/app/views/crops/show.html.haml @@ -1,27 +1,27 @@ - content_for :title, @crop.system_name -.container-fluid - .row-fluid - .span9 - %h2 Who's growing this? - - @crop.plantings.each do |p| - = render :partial => "plantings/thumbnail", :locals => { :planting => p, :title => 'owner' } +.row + .span9 + %p + =link_to "Plant this", new_planting_path(:crop_id => @crop.id), :class => 'btn btn-primary' + %h2 Who's growing this? + - @crop.plantings.each do |p| + = render :partial => "plantings/thumbnail", :locals => { :planting => p, :title => 'owner' } - .span3 - %h4 Scientific names: - %ul - - @crop.scientific_names.each do |sn| - %li= sn.scientific_name - %h4 More information: - %ul - %li= link_to 'Wikipedia (English)', @crop.en_wikipedia_url + .span3 + %h4 Scientific names: + %ul + - @crop.scientific_names.each do |sn| + %li= sn.scientific_name + %h4 More information: + %ul + %li= link_to 'Wikipedia (English)', @crop.en_wikipedia_url - - if can? :edit, @crop or can? :destroy, @crop - %p - - if can? :edit, @crop - = link_to 'Edit', edit_crop_path(@crop), { :class => 'btn btn-mini' } - - if can? :destroy, @crop - = link_to 'Destroy', @crop, method: :delete, data: { confirm: 'Are you sure?' }, :class => 'btn btn-mini' + - if can? :edit, @crop or can? :destroy, @crop + %h4 Crop wrangling: %p - =link_to "Plant this", new_planting_path(:crop_id => @crop.id), :class => 'btn btn-primary' + - if can? :edit, @crop + = link_to 'Edit', edit_crop_path(@crop), { :class => 'btn btn-mini' } + - if can? :destroy, @crop + = link_to 'Delete', @crop, method: :delete, data: { confirm: 'Are you sure?' }, :class => 'btn btn-mini' diff --git a/app/views/devise/registrations/edit.html.haml b/app/views/devise/registrations/edit.html.haml index b1de31e94..6899d4986 100644 --- a/app/views/devise/registrations/edit.html.haml +++ b/app/views/devise/registrations/edit.html.haml @@ -43,6 +43,6 @@ .controls= f.password_field :password_confirmation .form-actions - = f.submit "Update", :class => 'btn btn-primary' + = f.submit "Save", :class => 'btn btn-primary' =f.hidden_field(:tos_agreement, :value => true) diff --git a/app/views/forums/index.html.haml b/app/views/forums/index.html.haml index 5dec93f14..160238709 100644 --- a/app/views/forums/index.html.haml +++ b/app/views/forums/index.html.haml @@ -7,6 +7,6 @@ | =link_to "Visit forum", forum | - =link_to "Post", new_post_path(:forum_id => forum.id), :class => 'btn btn-mini' + =link_to "Post", new_post_path(:forum_id => forum.id) =render :partial => "posts/summary", :locals => { :posts => forum.posts, :howmany => 4 } diff --git a/app/views/forums/show.html.haml b/app/views/forums/show.html.haml index c2e70090b..262ec737a 100644 --- a/app/views/forums/show.html.haml +++ b/app/views/forums/show.html.haml @@ -2,13 +2,14 @@ %p#notice= notice -%p - :markdown - #{ strip_tags(@forum.description) } -%p +%p.forum-meta This forum is run by = link_to @forum.owner, @forum.owner +%div + :markdown + #{ strip_tags(@forum.description) } + - if can? :edit, @forum =link_to "Edit", edit_forum_path(@forum), :class => 'btn btn-mini' diff --git a/app/views/gardens/index.html.haml b/app/views/gardens/index.html.haml index 58759cca2..a020b9a8e 100644 --- a/app/views/gardens/index.html.haml +++ b/app/views/gardens/index.html.haml @@ -1,5 +1,8 @@ %h1 Listing gardens +- if can? :create, Garden + %p= link_to 'New Garden', new_garden_path, :class => 'btn btn-primary' + %table %tr %th Name @@ -7,17 +10,14 @@ %th Slug %th %th - %th - @gardens.each do |garden| %tr - %td= garden.name + %td= link_to garden.name, garden %td= garden.owner %td= garden.slug - %td= link_to 'Show', garden - %td= link_to 'Edit', edit_garden_path(garden), :class => 'btn btn-mini' - %td= link_to 'Destroy', garden, method: :delete, data: { confirm: 'Are you sure?' }, :class => 'btn btn-mini' + - if can? :edit, garden + %td= link_to 'Edit', edit_garden_path(garden), :class => 'btn btn-mini' + - if can? :destroy, garden + %td= link_to 'Delete', garden, method: :delete, data: { confirm: 'Are you sure?' }, :class => 'btn btn-mini' -%br - -= link_to 'New Garden', new_garden_path, :class => 'btn btn-primary' diff --git a/app/views/home/_blurb.html.haml b/app/views/home/_blurb.html.haml index 32efe4b93..9a07fe558 100644 --- a/app/views/home/_blurb.html.haml +++ b/app/views/home/_blurb.html.haml @@ -3,4 +3,4 @@ %p #{Growstuff::Application.config.site_name} is a community of food gardeners working together to build an open source platform to track, share, and discuss edible gardens and sustainable lifestyles. You can join us right now and be part of growing our website, from seed to harvest. We welcome you regardless of your experience, and invite you to be part of our development process. -%p= link_to 'Learn more', 'http://wiki.growstuff.org/', :class => 'btn btn-primary' +%p= link_to 'Learn more', 'http://wiki.growstuff.org/', :class => 'btn btn-primary btn-large' diff --git a/app/views/home/index.html.haml b/app/views/home/index.html.haml index 4c01a274f..8b2e9f96c 100644 --- a/app/views/home/index.html.haml +++ b/app/views/home/index.html.haml @@ -26,7 +26,7 @@ %li= link_to g.name, g - if can? :create, Garden %li - %small= link_to 'Add a garden', new_garden_path, :class => 'btn btn-mini' + %small= link_to 'Add', new_garden_path, :class => 'btn btn-mini' .span4 - if current_member.has_role?(:admin) diff --git a/app/views/members/show.html.haml b/app/views/members/show.html.haml index f344cfb25..be8a993e9 100644 --- a/app/views/members/show.html.haml +++ b/app/views/members/show.html.haml @@ -28,7 +28,7 @@ - first_garden = false = link_to g.name, "#garden#{g.id}", 'data-toggle' => 'tab' - if current_member == @member - %li= link_to 'New Garden', '#garden_new', 'data-toggle' => 'tab', :class => 'btn btn-primary' + %li= link_to 'New Garden', '#garden_new', 'data-toggle' => 'tab' .tab-content - first_garden = true - @member.gardens.each do |g| diff --git a/app/views/notifications/show.html.haml b/app/views/notifications/show.html.haml index 7d117f6bc..f9a1870ed 100644 --- a/app/views/notifications/show.html.haml +++ b/app/views/notifications/show.html.haml @@ -15,4 +15,4 @@ #{ strip_tags(@notification.body) } %p - =link_to 'Delete notification', @notification, method: :delete, data: { confirm: 'Are you sure?' }, :class => 'btn btn-mini' + =link_to 'Delete', @notification, method: :delete, data: { confirm: 'Are you sure?' }, :class => 'btn btn-mini' diff --git a/app/views/plantings/_form.html.haml b/app/views/plantings/_form.html.haml index 93e8b59a3..b4086e962 100644 --- a/app/views/plantings/_form.html.haml +++ b/app/views/plantings/_form.html.haml @@ -25,4 +25,4 @@ .controls= f.text_area :description, :rows => 6 .form-actions - = f.submit 'Save planting', :class => 'btn btn-primary' + = f.submit 'Save', :class => 'btn btn-primary' diff --git a/app/views/plantings/_thumbnail.html.haml b/app/views/plantings/_thumbnail.html.haml index f1dbef067..e5338ccd8 100644 --- a/app/views/plantings/_thumbnail.html.haml +++ b/app/views/plantings/_thumbnail.html.haml @@ -27,6 +27,6 @@ - if can? :edit, planting or can? :destroy, planting %p - if can? :edit, planting - =link_to 'Edit planting', edit_planting_path(planting), :class => 'btn btn-mini' + =link_to 'Edit', edit_planting_path(planting), :class => 'btn btn-mini' - if can? :destroy, planting - =link_to 'Destory planting', planting, method: :delete, data: { confirm: 'Are you sure?' }, :class => 'btn btn-mini' + =link_to 'Delete', planting, method: :delete, data: { confirm: 'Are you sure?' }, :class => 'btn btn-mini' diff --git a/app/views/plantings/show.html.haml b/app/views/plantings/show.html.haml index 5aeb12fa6..77b59f59f 100644 --- a/app/views/plantings/show.html.haml +++ b/app/views/plantings/show.html.haml @@ -5,9 +5,6 @@ %p %b Planted: = @planting.planted_at ? @planting.planted_at.to_s(:date) : "not specified" - - if can? :edit, @planting - %small - = link_to 'Edit', edit_planting_path(@planting), :class => 'btn btn-mini' %p %b Where: =link_to "#{@planting.owner}'s", @planting.owner @@ -17,15 +14,22 @@ %p %b Quantity: = @planting.quantity != 0 ? @planting.quantity : "not specified" + + - if can? :edit, @planting or can? :destroy, @planting + %p - if can? :edit, @planting - %small - = link_to 'Edit', edit_planting_path(@planting), :class => 'btn btn-mini' + =link_to 'Edit', edit_planting_path(@planting), :class => 'btn btn-mini' + - if can? :destroy, @planting + =link_to 'Delete', @planting, method: :delete, data: { confirm: 'Are you sure?' }, :class => 'btn btn-mini' + .span6 .well %h3 = link_to @planting.crop, @planting.crop - - if can? :create, Planting + - if can? :edit, @planting = link_to 'Plant another', new_planting_path, :class => 'btn btn-primary' + - elsif can? :create, Planting + = link_to 'Plant this', new_planting_path, :class => 'btn btn-primary' %p %b Scientific name: diff --git a/app/views/posts/_single.html.haml b/app/views/posts/_single.html.haml index c1070c7b9..5dd0ebd20 100644 --- a/app/views/posts/_single.html.haml +++ b/app/views/posts/_single.html.haml @@ -30,6 +30,6 @@ %li= link_to "Reply", new_comment_path(:post_id => post.id) %li= link_to "Permalink", post -if can? :edit, post - %li= link_to "Edit", edit_post_path(post), :class => 'btn btn-mini' + %li= link_to "Edit", edit_post_path(post) diff --git a/app/views/roles/index.html.haml b/app/views/roles/index.html.haml index 37e32b060..1583f3ab2 100644 --- a/app/views/roles/index.html.haml +++ b/app/views/roles/index.html.haml @@ -1,5 +1,8 @@ %h1 Listing roles +- if can? :create, Role + %p= link_to 'New Role', new_role_path, :class => 'btn btn-primary' + %table %tr %th Name @@ -10,12 +13,9 @@ - @roles.each do |role| %tr - %td= role.name + %td= link_to role.name, role %td= role.description - %td= link_to 'Show', role - %td= link_to 'Edit', edit_role_path(role), :class => 'btn btn-mini' - %td= link_to 'Destroy', role, method: :delete, data: { confirm: 'Are you sure?' }, :class => 'btn btn-mini' - -%br - -= link_to 'New Role', new_role_path, :class => 'btn btn-primary' + - if can? :edit, role + %td= link_to 'Edit', edit_role_path(role), :class => 'btn btn-mini' + - if can? :destroy, role + %td= link_to 'Delete', role, method: :delete, data: { confirm: 'Are you sure?' }, :class => 'btn btn-mini' diff --git a/app/views/scientific_names/index.html.haml b/app/views/scientific_names/index.html.haml index 7b799575f..df688fe7e 100644 --- a/app/views/scientific_names/index.html.haml +++ b/app/views/scientific_names/index.html.haml @@ -1,16 +1,18 @@ %h1 Listing scientific_names +- if can? :create, ScientificName + %p= link_to 'New Scientific name', new_scientific_name_path, :class => 'btn btn-primary' + %table %tr %th Scientific name %th Crop %th %th - %th - @scientific_names.each do |scientific_name| %tr - %td= scientific_name.scientific_name + %td= link_to scientific_name.scientific_name, scientific_name %td= scientific_name.crop_id %td= link_to 'Show', scientific_name %td @@ -18,9 +20,4 @@ = link_to 'Edit', edit_scientific_name_path(scientific_name), :class => 'btn btn-mini' %td - if can? :destroy, scientific_name - = link_to 'Destroy', scientific_name, method: :delete, data: { confirm: 'Are you sure?' }, :class => 'btn btn-mini' - -%br - -- if can? :create, ScientificName - = link_to 'New Scientific name', new_scientific_name_path, :class => 'btn btn-primary' + = link_to 'Delete', scientific_name, method: :delete, data: { confirm: 'Are you sure?' }, :class => 'btn btn-mini' diff --git a/spec/views/notifications/show.html.haml_spec.rb b/spec/views/notifications/show.html.haml_spec.rb index 7893986af..26251395b 100644 --- a/spec/views/notifications/show.html.haml_spec.rb +++ b/spec/views/notifications/show.html.haml_spec.rb @@ -15,7 +15,7 @@ describe "notifications/show" do end it "includes a delete button" do - assert_select "a", "Delete notification" + assert_select "a", "Delete" end end diff --git a/spec/views/roles/index.html.haml_spec.rb b/spec/views/roles/index.html.haml_spec.rb index 508f29017..3c62e0986 100644 --- a/spec/views/roles/index.html.haml_spec.rb +++ b/spec/views/roles/index.html.haml_spec.rb @@ -2,6 +2,7 @@ require 'spec_helper' describe "roles/index" do before(:each) do + controller.stub(:current_user) { nil } assign(:roles, [ stub_model(Role, :name => "Name", diff --git a/spec/views/scientific_names/index.html.haml_spec.rb b/spec/views/scientific_names/index.html.haml_spec.rb index 3fffc28e2..fff8874f5 100644 --- a/spec/views/scientific_names/index.html.haml_spec.rb +++ b/spec/views/scientific_names/index.html.haml_spec.rb @@ -18,7 +18,7 @@ describe "scientific_names/index" do it "doesn't show edit/destroy links" do render rendered.should_not contain "Edit" - rendered.should_not contain "Destroy" + rendered.should_not contain "Delete" end context "logged in and crop wrangler" do @@ -31,7 +31,7 @@ describe "scientific_names/index" do it "shows edit/destroy links" do render rendered.should contain "Edit" - rendered.should contain "Destroy" + rendered.should contain "Delete" end end end