Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/assets/stylesheets/entries.scss
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ a.s-delete {
}
}

.delete-entry-action {
margin-top: 15px;
text-align: center;
}

.s-unsubscribe {
-webkit-appearance: none;
background: none;
Expand Down
6 changes: 3 additions & 3 deletions app/views/entries/edit.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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({
Expand Down
12 changes: 12 additions & 0 deletions spec/features/entries_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading