Commit 24958c80602ad6f0afa06f87c639d70e6986f604
Exists in
master
and in
1 other branch
Merge pull request #358 from zetaben/feature/move_destroy
Move destroy application link from show page to edit page
Showing
3 changed files
with
24 additions
and
1 deletions
Show diff stats
app/views/apps/edit.html.haml
| 1 | 1 | - content_for :title, 'Edit App' |
| 2 | 2 | - content_for :action_bar do |
| 3 | 3 | = link_to_copy_attributes_from_other_app |
| 4 | + = link_to 'destroy application', app_path(@app), :method => :delete, :data => { :confirm => 'Seriously?' }, :class => 'button' | |
| 4 | 5 | = link_to('cancel', app_path(@app), :class => 'button') |
| 5 | 6 | |
| 6 | 7 | = form_for @app do |f| | ... | ... |
app/views/apps/show.html.haml
| ... | ... | @@ -11,7 +11,6 @@ |
| 11 | 11 | - content_for :action_bar do |
| 12 | 12 | - if current_user.admin? |
| 13 | 13 | = link_to 'edit', edit_app_path(@app), :class => 'button' |
| 14 | - = link_to 'destroy', app_path(@app), :method => :delete, :data => { :confirm => 'Seriously?' }, :class => 'button' | |
| 15 | 14 | - if @all_errs |
| 16 | 15 | = link_to 'unresolved errs', app_path(@app), :class => 'button' |
| 17 | 16 | - else | ... | ... |
| ... | ... | @@ -0,0 +1,23 @@ |
| 1 | +require 'spec_helper' | |
| 2 | + | |
| 3 | +describe "apps/edit.html.haml" do | |
| 4 | + before do | |
| 5 | + app = stub_model(App) | |
| 6 | + assign :app, app | |
| 7 | + controller.stub(:current_user) { stub_model(User) } | |
| 8 | + end | |
| 9 | + | |
| 10 | + describe "content_for :action_bar" do | |
| 11 | + def action_bar | |
| 12 | + view.content_for(:action_bar) | |
| 13 | + end | |
| 14 | + | |
| 15 | + it "should confirm the 'destroy' link" do | |
| 16 | + render | |
| 17 | + | |
| 18 | + action_bar.should have_selector('a.button[data-confirm="Seriously?"]') | |
| 19 | + end | |
| 20 | + | |
| 21 | + end | |
| 22 | +end | |
| 23 | + | ... | ... |