diff --git a/app/assets/stylesheets/entries.scss b/app/assets/stylesheets/entries.scss index f26f25b4..66af6351 100644 --- a/app/assets/stylesheets/entries.scss +++ b/app/assets/stylesheets/entries.scss @@ -102,6 +102,11 @@ a.s-delete { } } +.delete-entry-action { + margin-top: 15px; + text-align: center; +} + .s-unsubscribe { -webkit-appearance: none; background: none; diff --git a/app/views/entries/edit.html.haml b/app/views/entries/edit.html.haml index 58ada6bd..f062a66f 100644 --- a/app/views/entries/edit.html.haml +++ b/app/views/entries/edit.html.haml @@ -15,9 +15,6 @@ -if @entry.inspiration.present? .float-left.s-edit-entry{rel: "popover", title: "#{@entry.inspiration.inspired_by}", data: { content: "#{@entry.inspiration.body.html_safe}" }} %i.fa.fa-lightbulb-o - .float-right.s-edit-entry{rel: "tooltip", title: "Delete this entry"} - = link_to entry_path(@entry), class: "s-delete", method: :delete, data: { confirm: 'Are you sure you want to delete this entry? There is no undo.' } do - %i.fa.fa-trash %h2= @entry.date_format_short %h3 %span @@ -61,6 +58,9 @@ %div = f.submit "Update Entry", class: "form-control btn btn-primary" + .delete-entry-action + = link_to "Delete Entry", entry_path(@entry), class: "s-delete", method: :delete, data: { confirm: 'Are you sure you want to delete this entry? There is no undo.' } + :javascript var summer_note = $('#entry_entry'); summer_note.summernote({ diff --git a/spec/features/entries_spec.rb b/spec/features/entries_spec.rb index 5696897f..b6ef9941 100644 --- a/spec/features/entries_spec.rb +++ b/spec/features/entries_spec.rb @@ -141,4 +141,16 @@ end end + describe 'edit' do + it 'shows a clear delete link below the update button' do + sign_in paid_user + visit edit_entry_url(paid_entry) + + delete_link = page.find('form + .delete-entry-action a.s-delete', text: 'Delete Entry') + expect(delete_link['data-method']).to eq('delete') + expect(delete_link['data-confirm']).to eq('Are you sure you want to delete this entry? There is no undo.') + expect(page).not_to have_css('.s-entry-date .fa-trash') + end + end + end