Merge pull request #5 from Skud/buttons

various tweaks based on comments on phazel's work
This commit is contained in:
Courtney Hazel
2013-03-20 19:02:47 -07:00
18 changed files with 71 additions and 68 deletions

View File

@@ -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'

View File

@@ -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)

View File

@@ -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 }

View File

@@ -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'

View File

@@ -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'

View File

@@ -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'

View File

@@ -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)

View File

@@ -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|

View File

@@ -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'

View File

@@ -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'

View File

@@ -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'

View File

@@ -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:

View File

@@ -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)

View File

@@ -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'

View File

@@ -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'

View File

@@ -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

View File

@@ -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",

View File

@@ -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