aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/admin_public_body_headings_controller.rb7
-rw-r--r--app/views/admin_general/index.html.erb3
-rw-r--r--app/views/admin_public_body_categories/_heading_list.html.erb9
-rw-r--r--app/views/admin_public_body_categories/edit.html.erb49
-rw-r--r--app/views/admin_public_body_categories/new.html.erb14
-rw-r--r--app/views/admin_public_body_headings/edit.html.erb53
-rw-r--r--app/views/admin_public_body_headings/new.html.erb14
7 files changed, 77 insertions, 72 deletions
diff --git a/app/controllers/admin_public_body_headings_controller.rb b/app/controllers/admin_public_body_headings_controller.rb
index 84e5cbf35..e893e760d 100644
--- a/app/controllers/admin_public_body_headings_controller.rb
+++ b/app/controllers/admin_public_body_headings_controller.rb
@@ -56,13 +56,6 @@ class AdminPublicBodyHeadingsController < AdminController
@locale = self.locale_from_params()
I18n.with_locale(@locale) do
heading = PublicBodyHeading.find(params[:id])
-
- if heading.public_body_categories.count > 0
- flash[:notice] = "There are categories associated with this heading, so can't destroy it"
- redirect_to edit_admin_heading_url(heading)
- return
- end
-
heading.destroy
flash[:notice] = "Category heading was successfully destroyed."
redirect_to admin_categories_url
diff --git a/app/views/admin_general/index.html.erb b/app/views/admin_general/index.html.erb
index a1f2e1d2d..ba9396ceb 100644
--- a/app/views/admin_general/index.html.erb
+++ b/app/views/admin_general/index.html.erb
@@ -202,8 +202,11 @@
<div id="update-authorities" class="accordion-body collapse">
<% for @change_request in @body_update_requests %>
<%= render :partial => 'change_request_summary' %>
+ <%= form_tag admin_change_request_update_path(@change_request), :class => "form form-horizontal" do %>
+ <%= submit_tag 'Close', :class => "btn btn-danger" %>
<%= link_to("Close and respond", admin_change_request_edit_path(@change_request), :class => 'btn') %>
<%= link_to("Make update", admin_body_edit_path(@change_request.public_body, :change_request_id => @change_request.id), :class => 'btn btn-primary') %>
+ <% end %>
<% end %>
</div>
</div>
diff --git a/app/views/admin_public_body_categories/_heading_list.html.erb b/app/views/admin_public_body_categories/_heading_list.html.erb
index 4bd8bdc90..f92f0c9b0 100644
--- a/app/views/admin_public_body_categories/_heading_list.html.erb
+++ b/app/views/admin_public_body_categories/_heading_list.html.erb
@@ -1,9 +1,12 @@
<div class="accordion" id="category_list">
- <% for heading in category_headings %>
- <div class="accordion-group" data-id="headings_<%=heading.id%>">
+ <% category_headings.each do |heading| %>
+ <div class="accordion-group" data-id="headings_<%= heading.id %>">
<div class="accordion-heading accordion-toggle row">
<span class="item-title span6">
- <a href="#heading_<%=heading.id%>_categories" data-toggle="collapse" data-parent="#categories" ><%= chevron_right %></a>
+ <a href="#heading_<%= heading.id %>_categories" data-toggle="collapse" data-parent="#categories">
+ <span class="badge"><%= heading.public_body_categories.size %></span>
+ <%= chevron_right %>
+ </a>
<strong><%= link_to(heading.name, edit_admin_heading_path(heading), :title => "view full details") %></strong>
</span>
</div>
diff --git a/app/views/admin_public_body_categories/edit.html.erb b/app/views/admin_public_body_categories/edit.html.erb
index 95988d688..f83d0768d 100644
--- a/app/views/admin_public_body_categories/edit.html.erb
+++ b/app/views/admin_public_body_categories/edit.html.erb
@@ -1,30 +1,35 @@
-<h1><%=@title%></h1>
+<h1><%= @title %></h1>
<div class="row">
- <div class="span8">
- <div id="public_body_category_form">
- <%= form_for @category, :url => admin_category_path(@category), :html => { :class => "form form-horizontal" } do |f| %>
- <%= render :partial => 'form', :locals => {:f => f} %>
- <div class="form-actions">
- <%= f.submit 'Save', :accesskey => 's', :class => "btn btn-success" %></p>
- </div>
- <% end %>
- </div>
-</div>
+ <div class="span8">
+ <div id="public_body_category_form">
+ <%= form_for @category, :url => admin_category_path(@category), :html => { :class => "form form-horizontal" } do |f| %>
+ <%= render :partial => 'form', :locals => { :f => f } %>
-<div class="row">
- <div class="span8 well">
- <%= link_to 'List all', admin_categories_path, :class => "btn" %>
+ <div class="form-actions">
+ <%= f.submit 'Save', :accesskey => 's', :class => "btn btn-success" %>
+ <%= link_to 'List all', admin_categories_path, :class => "btn" %>
+ </div>
+ <% end %>
+ </div>
</div>
</div>
-<% if @tagged_public_bodies.empty? %>
- <div class="row">
- <div class="span8">
- <%= form_tag(admin_category_path(@category), :method => 'delete', :class => "form form-inline") do %>
- <%= hidden_field_tag(:public_body_id, { :value => @category.id } ) %>
- <%= submit_tag "Destroy #{@category.title}", :title => @category.title, :class => "btn btn-danger" %> (this is permanent!)
- <% end %>
+<hr />
+
+<div class="row">
+ <div class="span12">
+ <div class="well">
+ <%= form_for @category, :url => admin_category_path(@category), :method => 'delete', :class => "form form-inline" do |f| %>
+ <%= f.submit "Destroy #{ @category.title }",
+ :title => @category.title,
+ :class => "btn btn-danger",
+ :confirm => 'Are you sure?' %>
+ <span class="help-block">
+ Destroying a category does not destroy the public authorities
+ associated with the category.
+ </span>
+ <% end %>
</div>
</div>
-<% end %>
+</div>
diff --git a/app/views/admin_public_body_categories/new.html.erb b/app/views/admin_public_body_categories/new.html.erb
index 8b1b1103f..ed9f06d7c 100644
--- a/app/views/admin_public_body_categories/new.html.erb
+++ b/app/views/admin_public_body_categories/new.html.erb
@@ -1,21 +1,17 @@
<% @title = 'New category' %>
-<h1><%=@title%></h1>
+<h1><%= @title %></h1>
<div class="row">
<div class="span8">
<div id="public_category_form">
- <%= form_for @category, :url => admin_categories_path, :html => {:class => "form form-horizontal"} do |f| %>
- <%= render :partial => 'form', :locals => {:f => f} %>
+ <%= form_for @category, :url => admin_categories_path, :html => { :class => "form form-horizontal" } do |f| %>
+ <%= render :partial => 'form', :locals => { :f => f } %>
<div class="form-actions">
<%= f.submit "Create", :class => "btn btn-primary" %>
+ <%= link_to 'List all', admin_categories_path, :class => "btn" %>
</div>
- <% end %>
- <div class="row">
- <div class="span8 well">
- <%= link_to 'List all', admin_categories_path, :class => "btn" %>
- </div>
- </div>
+ <% end %>
</div>
</div>
</div>
diff --git a/app/views/admin_public_body_headings/edit.html.erb b/app/views/admin_public_body_headings/edit.html.erb
index eff89285a..d4bc02562 100644
--- a/app/views/admin_public_body_headings/edit.html.erb
+++ b/app/views/admin_public_body_headings/edit.html.erb
@@ -1,30 +1,39 @@
-<h1><%=@title%></h1>
+<h1><%= @title %></h1>
<div class="row">
- <div class="span8">
- <div id="public_body_heading_form">
- <%= form_for @heading, :url => admin_heading_path(@heading), :html => { :class => "form form-horizontal" } do |f| %>
- <%= render :partial => 'form', :locals => {:f => f} %>
- <div class="form-actions">
- <%= f.submit 'Save', :accesskey => 's', :class => "btn btn-success" %></p>
- </div>
- <% end %>
- </div>
-</div>
+ <div class="span8">
+ <div id="public_body_heading_form">
+ <%= form_for @heading, :url => admin_heading_path(@heading), :html => { :class => "form form-horizontal" } do |f| %>
+ <%= render :partial => 'form', :locals => { :f => f } %>
-<div class="row">
- <div class="span8 well">
- <%= link_to 'List all', admin_categories_path, :class => "btn" %>
- </div>
+ <div class="form-actions">
+ <%= f.submit 'Save', :accesskey => 's', :class => "btn btn-success" %>
+ <%= link_to 'List all', admin_categories_path, :class => "btn" %>
+ </div>
+ <% end %>
+ </div>
+ </div>
</div>
-<% if @heading.public_body_categories.empty? %>
- <div class="row">
- <div class="span8">
- <%= form_tag(admin_heading_path(@heading), :method => 'delete', :class => "form form-inline") do %>
- <%= hidden_field_tag(:public_body_heading_id, { :value => @heading.id } ) %>
- <%= submit_tag "Destroy #{@heading.name}", :name => @heading.name, :class => "btn btn-danger" %> (this is permanent!)
+<hr />
+
+<div class="row">
+ <div class="span12">
+ <div class="well">
+ <%= form_for @heading, :url => admin_heading_path(@heading), :method => 'delete', :class => "form form-inline" do |f| %>
+ <%= f.submit "Destroy #{ @heading.name }",
+ :name => @heading.name,
+ :class => "btn btn-danger",
+ :confirm => 'Are you sure?' %>
+ <span class="help-block">
+ <ul>
+ <li>Destroying a category heading only destroys the heading itself.</li>
+ <li>Child categories assigned to another heading remain assigned to the other heading.</li>
+ <li>Child categories with no other heading become "Categories with no heading".</li>
+ <li>Public authorities remain assigned to the categories.</li>
+ </ul>
+ </span>
<% end %>
</div>
</div>
-<% end %>
+</div>
diff --git a/app/views/admin_public_body_headings/new.html.erb b/app/views/admin_public_body_headings/new.html.erb
index 91d5d4a9d..c6fe514b0 100644
--- a/app/views/admin_public_body_headings/new.html.erb
+++ b/app/views/admin_public_body_headings/new.html.erb
@@ -1,21 +1,17 @@
<% @title = 'New category heading' %>
-<h1><%=@title%></h1>
+<h1><%= @title %></h1>
<div class="row">
<div class="span8">
<div id="public_heading_form">
- <%= form_for @heading, :url => admin_headings_path, :html => {:class => "form form-horizontal"} do |f| %>
- <%= render :partial => 'form', :locals => {:f => f} %>
+ <%= form_for @heading, :url => admin_headings_path, :html => { :class => "form form-horizontal" } do |f| %>
+ <%= render :partial => 'form', :locals => { :f => f } %>
<div class="form-actions">
<%= f.submit "Create", :class => "btn btn-primary" %>
+ <%= link_to 'List all', admin_categories_path, :class => "btn" %>
</div>
- <% end %>
- <div class="row">
- <div class="span8 well">
- <%= link_to 'List all', admin_categories_path, :class => "btn" %>
- </div>
- </div>
+ <% end %>
</div>
</div>
</div>