diff options
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/admin_censor_rule/_form.html.erb | 2 | ||||
-rw-r--r-- | app/views/admin_censor_rule/_show.html.erb | 14 | ||||
-rw-r--r-- | app/views/admin_censor_rule/new.html.erb | 6 | ||||
-rw-r--r-- | app/views/admin_general/index.html.erb | 3 | ||||
-rw-r--r-- | app/views/admin_general/stats.html.erb | 5 | ||||
-rw-r--r-- | app/views/admin_public_body_categories/_form.html.erb | 25 | ||||
-rw-r--r-- | app/views/admin_public_body_categories/_heading_list.html.erb | 9 | ||||
-rw-r--r-- | app/views/admin_public_body_categories/edit.html.erb | 49 | ||||
-rw-r--r-- | app/views/admin_public_body_categories/new.html.erb | 14 | ||||
-rw-r--r-- | app/views/admin_public_body_headings/edit.html.erb | 53 | ||||
-rw-r--r-- | app/views/admin_public_body_headings/new.html.erb | 14 | ||||
-rw-r--r-- | app/views/public_body/_search_ahead.html.erb | 4 | ||||
-rw-r--r-- | app/views/request/_search_ahead.html.erb | 30 | ||||
-rw-r--r-- | app/views/request/new.html.erb | 32 | ||||
-rw-r--r-- | app/views/request/select_authority.html.erb | 90 |
15 files changed, 189 insertions, 161 deletions
diff --git a/app/views/admin_censor_rule/_form.html.erb b/app/views/admin_censor_rule/_form.html.erb index 5035238d6..3f602d2e4 100644 --- a/app/views/admin_censor_rule/_form.html.erb +++ b/app/views/admin_censor_rule/_form.html.erb @@ -4,11 +4,9 @@ <%=_("Applies to")%> <% unless info_request.nil? %> <%= request_both_links(info_request) %> - <%= hidden_field 'censor_rule', 'info_request_id', { :value => info_request.id } %> <% end %> <% unless user.nil? %> <%= user_both_links(user) %> - <%= hidden_field 'censor_rule', 'user_id', { :value => user.id } %> <% end %> </div> diff --git a/app/views/admin_censor_rule/_show.html.erb b/app/views/admin_censor_rule/_show.html.erb index 0d4cece93..46904b3b9 100644 --- a/app/views/admin_censor_rule/_show.html.erb +++ b/app/views/admin_censor_rule/_show.html.erb @@ -1,18 +1,17 @@ - <% if censor_rules.size > 0 %> <table class="table table-condensed"> <tr> <th>Id</th> - <% for column in CensorRule.content_columns %> + <% CensorRule.content_columns.each do |column| %> <th><%= column.human_name %></th> <% end %> <th>Actions</th> </tr> - <% for censor_rule in censor_rules %> + <% censor_rules.each do |censor_rule| %> <tr class="<%= cycle('odd', 'even') %>"> <td><%=h censor_rule.id %></td> - <% for column in CensorRule.content_columns.map { |c| c.name } %> + <% CensorRule.content_columns.map { |c| c.name }.each do |column| %> <td><%=h censor_rule.send(column) %></td> <% end %> <td> @@ -26,10 +25,11 @@ <% end %> <% if defined? info_request %> - <%= link_to "New censor rule (for this request only)", admin_rule_new_path(:info_request_id => info_request.id), :class => "btn btn-info" %> + <%= link_to "New censor rule", new_admin_info_request_censor_rule_path(info_request), :class => "btn btn-info" %> + <span class="label label-info">for this request only</span> <% end %> <% if defined? user %> - <%= link_to "New censor rule", admin_rule_new_path(:user_id => user.id), :class => "btn btn-info" %> <span class="label label-info">for all requests by this user</span> + <%= link_to "New censor rule", new_admin_user_censor_rule_path(user), :class => "btn btn-info" %> + <span class="label label-info">for all requests by this user</span> <% end %> - diff --git a/app/views/admin_censor_rule/new.html.erb b/app/views/admin_censor_rule/new.html.erb index 77d22990c..26b3212be 100644 --- a/app/views/admin_censor_rule/new.html.erb +++ b/app/views/admin_censor_rule/new.html.erb @@ -1,11 +1,11 @@ <% @title = _('New censor rule') %> -<h1><%=@title%></h1> +<h1><%= @title %></h1> -<%= form_tag admin_rule_create_path, :class => "form form-horizontal" do %> +<%= form_for @censor_rule, :url => @form_url, :class => "form form-horizontal" do %> <%= render :partial => 'form', :locals => { :info_request => @info_request, :user => @censor_user } %> + <div class="form-actions"> <%= submit_tag "Create", :class => "btn btn-primary" %> </div> <% end %> - 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_general/stats.html.erb b/app/views/admin_general/stats.html.erb index 27dc25ee0..03268cc14 100644 --- a/app/views/admin_general/stats.html.erb +++ b/app/views/admin_general/stats.html.erb @@ -53,8 +53,3 @@ </div> </div> </div> -<div class="row"> - <div class="span12"> - <h2>Web analytics</h2> - </div> -</div> diff --git a/app/views/admin_public_body_categories/_form.html.erb b/app/views/admin_public_body_categories/_form.html.erb index b0778d371..1f033ac9b 100644 --- a/app/views/admin_public_body_categories/_form.html.erb +++ b/app/views/admin_public_body_categories/_form.html.erb @@ -44,16 +44,23 @@ end </div> </div> -<% if PublicBody.find_by_tag(@category.category_tag).count == 0 or @category.errors.messages.keys.include?(:category_tag) %> - <h3>Common Fields</h3> +<h3>Common Fields</h3> - <div class="control-group"> - <label for="public_body_category_category_tag" class="control-label">Category tag</label> - <div class="controls"> - <%= f.text_field :category_tag, :class => "span4" %> - </div> - </div> -<% end %> +<div class="control-group"> + <label for="public_body_category_category_tag" class="control-label">Category tag</label> + <div class="controls"> + <% if PublicBody.find_by_tag(@category.category_tag).count == 0 or + @category.errors.messages.keys.include?(:category_tag) %> + <%= f.text_field :category_tag, :class => "span4" %> + <% else %> + <%= f.text_field :category_tag, :class => "span4", :disabled => true %> + <span class="help-block"> + This Category already has authorities assigned to it so the tags + cannot be modified. + </span> + <% end %> + </div> +</div> <h3>Headings</h3> <div class="control-group"> 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> diff --git a/app/views/public_body/_search_ahead.html.erb b/app/views/public_body/_search_ahead.html.erb index 2de638034..b5632bccd 100644 --- a/app/views/public_body/_search_ahead.html.erb +++ b/app/views/public_body/_search_ahead.html.erb @@ -2,9 +2,6 @@ <% if !@xapian_requests.nil? %> <% if @xapian_requests.results.size > 0 %> <h3><%= _('Top search results:') %></h3> - <p> - <%= _('Select one to see more information about the authority.')%> - </p> <% else %> <h3><%= _('No results found.') %></h3> <% end %> @@ -14,5 +11,4 @@ <% end %> </div> <%= will_paginate WillPaginate::Collection.new(@page, @per_page, @xapian_requests.matches_estimated), :params => {:controller=>"request", :action => "select_authority"} %> - <p><%= raw(_('<a href="{{browse_url}}">Browse all</a> or <a href="{{add_url}}">ask us to add one</a>.', :browse_url => list_public_bodies_default_path.html_safe, :add_url => (help_requesting_path + '#missing_body').html_safe)) %></p> <% end %> diff --git a/app/views/request/_search_ahead.html.erb b/app/views/request/_search_ahead.html.erb index 1e65a5458..4fbe06ebc 100644 --- a/app/views/request/_search_ahead.html.erb +++ b/app/views/request/_search_ahead.html.erb @@ -1,14 +1,20 @@ -<div id="request_search_ahead_results"> - <% if !@xapian_requests.nil? %> - <% if @xapian_requests.results.size > 0 %> +<% unless @xapian_requests.nil? %> + <div id="request_search_ahead_results"> + <% if @xapian_requests.results.any? %> + <span class="close-button">X</span> <h3><%= _("Possibly related requests:") %></h3> - <% end %> - <% for result in @xapian_requests.results %> - <%= render :partial => 'request/request_listing_short_via_event', :locals => { :event => result[:model], :info_request => result[:model].info_request } %> - <% end %> - <p> - <a id="body-site-search-link"><%= _("Or search in their website for this information.") %></a> - </p> - <% end %> -</div> + <% @xapian_requests.results.each do |result| %> + <%= render :partial => 'request/request_listing_short_via_event', + :locals => { :event => result[:model], + :info_request => result[:model].info_request } %> + <% end %> + + <p> + <a id="body-site-search-link"> + <%= _("Search in their website for this information →") %> + </a> + </p> + <% end %> + </div> +<% end %> diff --git a/app/views/request/new.html.erb b/app/views/request/new.html.erb index 7f1332464..51224129e 100644 --- a/app/views/request/new.html.erb +++ b/app/views/request/new.html.erb @@ -1,19 +1,33 @@ <% unless @batch %> <script type="text/javascript"> $(document).ready(function(){ - // Avoid triggering too often (on each keystroke) by using the debounce jQuery plugin: + // Avoid triggering too often (on each keystroke) by using the + // debounce jQuery plugin: // http://benalman.com/projects/jquery-throttle-debounce-plugin/ $("#typeahead_search").keypress($.debounce( 300, function() { - $("#typeahead_response").load("<%=search_ahead_url%>?q="+encodeURI(this.value), function() { - // When following links in typeahead results, open new tab/window - $("#typeahead_response a").attr("target","_blank"); - - // Update the public body site search link - $("#body-site-search-link").attr("href", "http://www.google.com/#q="+encodeURI($("#typeahead_search").val())+ - "+site:<%= @info_request.public_body.calculated_home_page %>"); + if ( $('#request_search_ahead_results').text().trim().length > 0) { + $('#typeahead_response').slideUp('fast'); + } + + $("#typeahead_response").load("<%= search_ahead_url %>?q="+encodeURI(this.value)+ + "&requested_from=<%= @info_request.public_body.url_name %>"+ + "&per_page=3", function() { + + if ( $('#request_search_ahead_results').text().trim().length > 0) { + $('#typeahead_response').hide().slideDown('fast'); + + // When following links in typeahead results, open new + // tab/window + $("#typeahead_response a").attr("target","_blank"); + + // Update the public body site search link + $("#body-site-search-link").attr("href", "http://www.google.com/#q="+encodeURI($("#typeahead_search").val())+ + "+site:<%= @info_request.public_body.calculated_home_page %>"); + + $('.close-button').click(function() { $(this).parent().hide() }); + } }); })); - }); </script> <% end %> diff --git a/app/views/request/select_authority.html.erb b/app/views/request/select_authority.html.erb index ed072cf64..134648264 100644 --- a/app/views/request/select_authority.html.erb +++ b/app/views/request/select_authority.html.erb @@ -1,60 +1,60 @@ <script type="text/javascript"> - $(document).ready(function(){ - $("#authority_preview").hide(); - - // Avoid triggering too often (on each keystroke) by using the debounce jQuery plugin: + $(document).ready(function() { + // Avoid triggering too often (on each keystroke) by using the debounce + // jQuery plugin: // http://benalman.com/projects/jquery-throttle-debounce-plugin/ $("#query").keypress($.debounce( 300, function() { // Do a type ahead search and display results - $("#typeahead_response").load("<%=search_ahead_bodies_url%>?query="+encodeURI(this.value), function() { - $("#authority_preview").hide(); // Hide the preview, since results have changed - - }); + $("#typeahead_response").load("<%= search_ahead_bodies_url %>?query="+encodeURI(this.value)); })); - // We're using the existing body list: we intercept the clicks on the titles to - // display a preview on the right hand side of the screen - $("#typeahead_response .head a").live('click', function() { - $("#authority_preview").load(this.href+" #public_body_show", function() { - $("#authority_preview").show(); - $(window).scrollTop($("#banner").height()); - $("#authority_preview #header_right").hide(); - location.hash = '#header_left'; - }); - return false; - }); }); </script> <% @title = _("Select the authority to write to") %> - <h1 style="clear: left"><%= _('1. Select an authority') %></h1> - - <div id="authority_selection"> - <%= form_tag({:controller => "request", :action => "select_authority"}, {:id => "search_form", :method => "get"}) do %> - <div> - <p> - <%= _('First, type in the <strong>name of the UK public authority</strong> you\'d - like information from. <strong>By law, they have to respond</strong> - (<a href="{{url}}">why?</a>).', :url => (help_about_path + "#whybother_them").html_safe) %> - </p> - <%= text_field_tag 'query', params[:query], { :size => 30, :title => "type your search term here" } %> - <%= hidden_field_tag 'bodies', 1 %> - <%= submit_tag _('Search') %> - </div> - <% if AlaveteliConfiguration.allow_batch_requests && @user && @user.can_make_batch_requests? %> - <div id="batch_request_link"> - <p> - <%= _('Or make a <a href="{{url}}">batch request</a> to <strong>multiple authorities</strong> at once.', :url => select_authorities_path) %> - </p> - </div> - <% end %> +<h1 style="clear: left"><%= _('1. Select an authority') %></h1> + +<div id="authority_selection"> + <%= form_tag select_authority_path, { :id => 'search_form', :method => 'get' } do %> + <div> + <p> + <%= _(%Q(First, type in the <strong>name of the UK public authority</strong> you'd + like information from. <strong>By law, they have to respond</strong> + (<a href="{{url}}">why?</a>).), :url => (help_about_path(:anchor => 'whybother_them')).html_safe) %> + </p> + + <%= text_field_tag :query, + params[:query], + { :size => 30, + :title => _('type your search term here'), + :placeholder => _('e.g. Ministry of Defence') } %> + <%= hidden_field_tag :bodies, 1 %> + <%= submit_tag _('Search') %> + </div> + + <% if AlaveteliConfiguration.allow_batch_requests && @user && @user.can_make_batch_requests? %> + <div id="batch_request_link"> + <p> + <%= _('Or make a <a href="{{url}}">batch request</a> to <strong>multiple authorities</strong> at once.', + :url => select_authorities_path) %> + </p> + </div> <% end %> + <% end %> - <div id="typeahead_response"> - <%= render :partial => 'public_body/search_ahead' %> - </div> + <div id="typeahead_response"> + <%= render :partial => 'public_body/search_ahead' %> </div> - <div id="authority_preview"> - </div> +</div> + +<div id="select_authority_help"> + <p class="info"><%= _("Can't find the one you want?") %></p> + <p class="actions"> + <%= raw _('<a href="{{browse_url}}">Browse all</a> or <a href="{{add_url}}">ask us to add one</a>.', + :browse_url => list_public_bodies_default_path.html_safe, + :add_url => help_requesting_path(:anchor => 'missing_body') + ).html_safe %> + </p> +</div> |