Skip to content

Commit a98ae29

Browse files
author
Jessie Keck
committed
Merge pull request #543 from sul-dlss/danger_callout
Separate delete button from settings form. Fixes #513
2 parents 3d12d51 + 7f6b142 commit a98ae29

File tree

4 files changed

+63
-16
lines changed

4 files changed

+63
-16
lines changed

app/assets/stylesheets/spotlight/_exhibit_admin.css.scss

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,21 @@
2727
white-space: nowrap;
2828
}
2929
}
30+
31+
.callout {
32+
margin: 20px 0;
33+
padding: 20px;
34+
border-left: 3px solid #eee;
35+
h4 {
36+
margin-top: 0;
37+
margin-bottom: 5px;
38+
}
39+
}
40+
.callout-danger {
41+
background-color: #fdf7f7;
42+
border-color: #d9534f;
43+
h4 {
44+
color: #d9534f;
45+
}
46+
}
3047
}
Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,31 @@
11
<%= render 'spotlight/shared/curation_sidebar' %>
22
<div id="content" class="col-md-9 exhibit-admin">
3-
<%= administration_page_title %>
4-
<%= bootstrap_form_for @exhibit, url: spotlight.exhibit_path(@exhibit), style: :horizontal do |f| %>
5-
<div class="row col-md-9">
6-
<%= f.text_field :title %>
7-
<%= f.text_field :subtitle %>
8-
<%= f.text_area :description %>
9-
<%= f.form_group(:contact_emails, label: { text: nil, class: nil }, help: nil) do %>
10-
<%= f.fields_for :contact_emails do |contact| %>
11-
<%= render partial: 'contact', locals: {contact: contact} %>
3+
<%= administration_page_title %>
4+
<%= bootstrap_form_for @exhibit, url: spotlight.exhibit_path(@exhibit), style: :horizontal, html: {class: "row"} do |f| %>
5+
<div class="row col-md-9">
6+
<%= f.text_field :title %>
7+
<%= f.text_field :subtitle %>
8+
<%= f.text_area :description %>
9+
<%= f.form_group(:contact_emails, label: { text: nil, class: nil }, help: nil) do %>
10+
<%= f.fields_for :contact_emails do |contact| %>
11+
<%= render partial: 'contact', locals: {contact: contact} %>
12+
<% end %>
13+
<p class="help-block"><%= t(:'.fields.contact_emails.help_block') %></p>
1214
<% end %>
13-
<p class="help-block"><%= t(:'.fields.contact_emails.help_block') %></p>
14-
<% end %>
1515

16-
<div class="form-actions">
17-
<%= delete_link @exhibit, class: 'btn btn-danger' %>
16+
<div class="form-actions">
1817

19-
<div class="primary-actions">
20-
<%= f.submit nil, class: 'btn btn-primary' %>
18+
<div class="primary-actions">
19+
<%= f.submit nil, class: 'btn btn-primary' %>
20+
</div>
2121
</div>
2222
</div>
23+
<% end %>
24+
<div class="callout callout-danger row">
25+
<h4><%= t(:".delete_exhibit") %></h4>
26+
<p class='col-md-9'><%= t(:".delete_exhibit_warning_html", export_link: link_to(t(:'spotlight.exhibits.import.export.download'), spotlight.import_exhibit_path(@exhibit))) %></p>
27+
<div class='col-md-3'>
28+
<%= delete_link @exhibit, class: 'btn btn-default' %>
29+
</div>
2330
</div>
24-
<% end %>
2531
</div>

config/locales/spotlight.en.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,8 @@ en:
215215
fields:
216216
contact_emails:
217217
help_block: Each contact email will receive feedback submissions
218+
delete_exhibit: Delete exhibit
219+
delete_exhibit_warning_html: This action is irreversable. Be sure to back up the exhibit settings and content using the %{export_link} feature before proceeding.
218220
new:
219221
header: Create a new exhibit
220222
import:
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
require 'spec_helper'
2+
3+
module Spotlight
4+
describe "spotlight/exhibits/edit" do
5+
let(:exhibit) { FactoryGirl.create(:exhibit) }
6+
before do
7+
assign(:exhibit, exhibit)
8+
view.stub(current_exhibit: exhibit)
9+
end
10+
11+
it "renders the edit page form" do
12+
render
13+
14+
expect(rendered).to have_selector "form[action=\"#{spotlight.exhibit_path(exhibit)}\"]"
15+
expect(rendered).to have_selector ".callout.callout-danger.row"
16+
expect(rendered).to have_content "This action is irreversable"
17+
expect(rendered).to have_link "Export", href: spotlight.import_exhibit_path(exhibit)
18+
19+
end
20+
end
21+
end
22+

0 commit comments

Comments
 (0)