diff options
Diffstat (limited to 'app/views')
32 files changed, 439 insertions, 137 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/_admin_navbar.html.erb b/app/views/admin_general/_admin_navbar.html.erb index 5cc740f70..14fc06092 100644 --- a/app/views/admin_general/_admin_navbar.html.erb +++ b/app/views/admin_general/_admin_navbar.html.erb @@ -10,6 +10,7 @@ <li><%= link_to 'Stats', admin_stats_path %></li> <li><%= link_to 'Debug', admin_debug_path %></li> <li><%= link_to 'Authorities', admin_body_list_path %></li> + <li><%= link_to 'Categories', admin_categories_path %></li> <li><%= link_to 'Requests', admin_request_list_path %></li> <li><%= link_to 'Users', admin_user_list_path %></li> <li><%= link_to 'Tracks', admin_track_list_path %></li> diff --git a/app/views/admin_general/index.html.erb b/app/views/admin_general/index.html.erb index f29258162..ba9396ceb 100644 --- a/app/views/admin_general/index.html.erb +++ b/app/views/admin_general/index.html.erb @@ -183,8 +183,12 @@ <div id="new-authorities" class="accordion-body collapse"> <% for @change_request in @new_body_requests %> <%= render :partial => 'change_request_summary'%> - <%= link_to("Close and respond", admin_change_request_edit_path(@change_request), :class => 'btn') %> - <%= link_to("Add authority", admin_body_new_path(:change_request_id => @change_request.id), :class => 'btn btn-primary') %> + <%= 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("Add authority", admin_body_new_path(:change_request_id => @change_request.id), :class => 'btn btn-primary') %> + <% end %> + <% end %> </div> </div> @@ -198,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/_tag_help.html.erb b/app/views/admin_public_body/_tag_help.html.erb index b64e65877..5d6990400 100644 --- a/app/views/admin_public_body/_tag_help.html.erb +++ b/app/views/admin_public_body/_tag_help.html.erb @@ -1,6 +1,6 @@ <h2>List of tags</h2> <% first_row = true %> -<% for row in PublicBodyCategories::get().with_headings() %> +<% for row in PublicBodyCategory.get().with_headings() %> <% if row.instance_of?(Array) %> <% if row[0] != 'other' %> <strong><%= row[0] %></strong>=<%= row[1] %> diff --git a/app/views/admin_public_body/import_csv.html.erb b/app/views/admin_public_body/import_csv.html.erb index d15ef1791..4b14226d1 100644 --- a/app/views/admin_public_body/import_csv.html.erb +++ b/app/views/admin_public_body/import_csv.html.erb @@ -51,19 +51,11 @@ Another One,another@example.com,Otro organismo,a_tag </pre> <p><strong>Supported fields:</strong> - <ul> - <li> - <code>name</code> (i18n) - <strong>Existing records cannot be renamed</strong> - </li> - <li><code>short_name</code> (i18n)</li> - <li><code>request_email</code> (i18n)</li> - <li><code>notes</code> (i18n)</li> - <li><code>publication_scheme</code> (i18n)</li> - <li><code>disclosure_log</code> (i18n)</li> - <li><code>home_page</code></li> - <li><code>tag_string</code> (tags separated by spaces)</li> - </ul> + <ul> + <% PublicBody.csv_import_fields.each do |field, notes| %> + <li><code><%= field %></code> <%= sanitize(notes) %></li> + <% end %> + </ul> </p> <p><strong>Note:</strong> Choose <strong>dry run</strong> to test, without @@ -84,7 +76,7 @@ Another One,another@example.com,Otro organismo,a_tag <hr> <p>Standard tags: - <% for category, description in PublicBodyCategories::get().by_tag() %> + <% for category, description in PublicBodyCategory.get().by_tag() %> <% if category != "other" %> <strong><%= category %></strong>=<%= description %>; <% end %> diff --git a/app/views/admin_public_body_categories/_category_list_item.html.erb b/app/views/admin_public_body_categories/_category_list_item.html.erb new file mode 100644 index 000000000..056ab6148 --- /dev/null +++ b/app/views/admin_public_body_categories/_category_list_item.html.erb @@ -0,0 +1,5 @@ +<div class="category-list-item" <% if heading %> data-id="categories_<%= category.id %>"<% end %>> + <%= link_to(category.title, edit_admin_category_path(category), :title => "view full details") %> +</div> + + diff --git a/app/views/admin_public_body_categories/_form.html.erb b/app/views/admin_public_body_categories/_form.html.erb new file mode 100644 index 000000000..1f033ac9b --- /dev/null +++ b/app/views/admin_public_body_categories/_form.html.erb @@ -0,0 +1,73 @@ +<%= error_messages_for 'category' %> + +<!--[form:public_body_category]--> + +<div id="div-locales"> + <ul class="locales nav nav-tabs"> + <% I18n.available_locales.each_with_index do |locale, i| %> + <li><a href="#div-locale-<%=locale.to_s%>" data-toggle="tab" ><%=locale_name(locale.to_s) || "Default locale"%></a></li> + <% end %> + </ul> + <div class="tab-content"> +<% + I18n.available_locales.each do |locale| + if locale==I18n.default_locale # The default locale is submitted as part of the bigger object... + prefix = 'public_body_category' + object = @category + else # ...but additional locales go "on the side" + prefix = "public_body_category[translated_versions][]" + object = @category.new_record? ? + PublicBodyCategory::Translation.new : + @category.find_translation_by_locale(locale.to_s) || PublicBodyCategory::Translation.new + end +%> + <%= fields_for prefix, object do |t| %> + <div class="tab-pane" id="div-locale-<%=locale.to_s%>"> + <div class="control-group"> + <%= t.hidden_field :locale, :value => locale.to_s %> + <label for="<%= form_tag_id(t.object_name, :title, locale) %>" class="control-label">Title</label> + <div class="controls"> + <%= t.text_field :title, :id => form_tag_id(t.object_name, :title, locale), :class => "span4" %> + </div> + </div> + <div class="control-group"> + <label for="<%= form_tag_id(t.object_name, :description, locale) %>" class="control-label">Description</label> + <div class="controls"> + <%= t.text_field :description, :id => form_tag_id(t.object_name, :description, locale), :class => "span4" %> + </div> + </div> + </div> + <% + end +end +%> + </div> +</div> + +<h3>Common Fields</h3> + +<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"> + <% PublicBodyHeading.all.each do |heading| %> + <div class="span3"> + <%= check_box_tag "headings[heading_#{heading.id}]", heading.id, heading_is_selected?(heading) %> <label for="headings_heading_<%= heading.id %>" class="control-label"><%= heading.name %></label> + </div> + <% end %> +</div> +<!--[eoform:public_body_category]--> diff --git a/app/views/admin_public_body_categories/_heading_list.html.erb b/app/views/admin_public_body_categories/_heading_list.html.erb new file mode 100644 index 000000000..f92f0c9b0 --- /dev/null +++ b/app/views/admin_public_body_categories/_heading_list.html.erb @@ -0,0 +1,29 @@ +<div class="accordion" id="category_list"> + <% 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"> + <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> + + <div id="heading_<%= heading.id %>_categories" class="accordion-body collapse row "> + <div class="well"> + <div class="span12" id="heading_<%= heading.id %>_category_list" class="category-list"> + <% heading.public_body_categories.each do |category| %> + <%= render :partial => 'category_list_item', :locals => { :category => category, :heading => heading } %> + <% end %> + </div> + + <div class="form-actions save-panel"> + <%= link_to "Save", '#', :class => "btn btn-primary disabled save-order", "data-heading-id" => heading.id, "data-list-id" => "#heading_#{heading.id}_category_list", 'data-endpoint' => reorder_categories_admin_heading_path(heading) %><p class="save-notice" data-unsaved-text="There are unsaved changes to the order of categories." data-success-text="Changes saved." data-error-text="There was an error saving your changes: ">Drag and drop to change the order of categories.</p> + </div> + </div> + </div> + </div> + <% end %> +</div> diff --git a/app/views/admin_public_body_categories/edit.html.erb b/app/views/admin_public_body_categories/edit.html.erb new file mode 100644 index 000000000..f83d0768d --- /dev/null +++ b/app/views/admin_public_body_categories/edit.html.erb @@ -0,0 +1,35 @@ +<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" %> + <%= link_to 'List all', admin_categories_path, :class => "btn" %> + </div> + <% end %> + </div> + </div> +</div> + +<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> +</div> diff --git a/app/views/admin_public_body_categories/index.html.erb b/app/views/admin_public_body_categories/index.html.erb new file mode 100644 index 000000000..62ec4623d --- /dev/null +++ b/app/views/admin_public_body_categories/index.html.erb @@ -0,0 +1,28 @@ +<% @title = 'Listing public authority categories' %> + +<h1><%=@title%></h1> + +<div class="btn-toolbar"> + <div class="btn-group"> + <%= link_to 'New category', new_admin_category_path, :class => "btn btn-primary" %> + </div> + <div class="btn-group"> + <%= link_to 'New category heading', new_admin_heading_path, :class => "btn" %> + </div> +</div> + +<h2>All category headings</h2> +<div> +<%= render :partial => 'heading_list', :locals => { :category_headings => @category_headings, :table_name => 'exact' } %> + +<% if @without_heading.count > 0 %> + + <h3>Categories with no heading</h3> + + <% @without_heading.each do |category| %> + <%= render :partial => 'category_list_item', :locals => { :category => category, :heading => nil } %> + <% end %> +<% end %> +<div class="form-actions save-panel"> +<%= link_to "Save", '#', :class => "btn btn-primary disabled save-order", "data-list-id" => '#category_list', 'data-endpoint' => reorder_admin_headings_path %><p class="save-notice" data-unsaved-text="There are unsaved changes to the order of category headings." data-success-text="Changes saved." data-error-text="There was an error saving your changes: ">Drag and drop to change the order of category headings.</p> +</div> diff --git a/app/views/admin_public_body_categories/new.html.erb b/app/views/admin_public_body_categories/new.html.erb new file mode 100644 index 000000000..ed9f06d7c --- /dev/null +++ b/app/views/admin_public_body_categories/new.html.erb @@ -0,0 +1,17 @@ +<% @title = 'New category' %> + +<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 } %> + + <div class="form-actions"> + <%= f.submit "Create", :class => "btn btn-primary" %> + <%= link_to 'List all', admin_categories_path, :class => "btn" %> + </div> + <% end %> + </div> + </div> +</div> diff --git a/app/views/admin_public_body_headings/_form.html.erb b/app/views/admin_public_body_headings/_form.html.erb new file mode 100644 index 000000000..d4e914ca1 --- /dev/null +++ b/app/views/admin_public_body_headings/_form.html.erb @@ -0,0 +1,41 @@ +<%= error_messages_for 'heading' %> + +<!--[form:public_body_heading]--> + +<div id="div-locales"> + <ul class="locales nav nav-tabs"> + <% I18n.available_locales.each_with_index do |locale, i| %> + <li><a href="#div-locale-<%=locale.to_s%>" data-toggle="tab" ><%=locale_name(locale.to_s) || "Default locale"%></a></li> + <% end %> + </ul> + <div class="tab-content"> +<% + for locale in I18n.available_locales do + if locale==I18n.default_locale # The default locale is submitted as part of the bigger object... + prefix = 'public_body_heading' + object = @heading + else # ...but additional locales go "on the side" + prefix = "public_body_heading[translated_versions][]" + object = @heading.new_record? ? + PublicBodyHeading::Translation.new : + @heading.find_translation_by_locale(locale.to_s) || PublicBodyHeading::Translation.new + end +%> + <%= fields_for prefix, object do |t| %> + <div class="tab-pane" id="div-locale-<%=locale.to_s%>"> + <div class="control-group"> + <%= t.hidden_field :locale, :value => locale.to_s %> + <label for="<%= form_tag_id(t.object_name, :name, locale) %>" class="control-label">Name</label> + <div class="controls"> + <%= t.text_field :name, :id => form_tag_id(t.object_name, :name, locale), :class => "span4" %> + </div> + </div> + </div> + <% + end +end +%> + </div> +</div> + +<!--[eoform:public_body_heading]--> diff --git a/app/views/admin_public_body_headings/edit.html.erb b/app/views/admin_public_body_headings/edit.html.erb new file mode 100644 index 000000000..d4bc02562 --- /dev/null +++ b/app/views/admin_public_body_headings/edit.html.erb @@ -0,0 +1,39 @@ +<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" %> + <%= link_to 'List all', admin_categories_path, :class => "btn" %> + </div> + <% end %> + </div> + </div> +</div> + +<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> +</div> diff --git a/app/views/admin_public_body_headings/new.html.erb b/app/views/admin_public_body_headings/new.html.erb new file mode 100644 index 000000000..c6fe514b0 --- /dev/null +++ b/app/views/admin_public_body_headings/new.html.erb @@ -0,0 +1,17 @@ +<% @title = 'New category heading' %> + +<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 } %> + + <div class="form-actions"> + <%= f.submit "Create", :class => "btn btn-primary" %> + <%= link_to 'List all', admin_categories_path, :class => "btn" %> + </div> + <% end %> + </div> + </div> +</div> diff --git a/app/views/admin_request/_incoming_message_actions.html.erb b/app/views/admin_request/_incoming_message_actions.html.erb index dd50eb047..22effcce5 100644 --- a/app/views/admin_request/_incoming_message_actions.html.erb +++ b/app/views/admin_request/_incoming_message_actions.html.erb @@ -25,7 +25,7 @@ <div class="control-group"> <label class="control-label">Mark <code>To:</code> address as spam</label> <div class="controls"> - <%= link_to 'Spam Addresses', spam_addresses_path %> + <%= link_to 'Spam Addresses', admin_spam_addresses_path %> </div> </div> diff --git a/app/views/admin_spam_addresses/index.html.erb b/app/views/admin_spam_addresses/index.html.erb index 9846bc017..7a11f70e1 100644 --- a/app/views/admin_spam_addresses/index.html.erb +++ b/app/views/admin_spam_addresses/index.html.erb @@ -16,7 +16,7 @@ <div class="row"> <div class="span12"> - <%= form_for(@spam_address, :html => { :class => 'form-inline' }) do |f| -%> + <%= form_for(@spam_address, :url => admin_spam_addresses_path, :html => { :class => 'form-inline' }) do |f| -%> <%= error_messages_for @spam_address %> <%= f.text_field :email, :class => 'input-xxlarge', :placeholder => 'Enter email' %> <%= f.submit 'Add Spam Address', :class => 'btn btn-warning' %> @@ -39,7 +39,7 @@ <% @spam_addresses.each do |spam| %> <tr> <td><%= spam.email %></td> - <td><%= link_to 'Remove', spam, + <td><%= link_to 'Remove', admin_spam_address_path(spam), :method => :delete, :confirm => 'This is permanent! Are you sure?', :class => 'btn btn-mini btn-danger' %></td> diff --git a/app/views/general/exception_caught.html.erb b/app/views/general/exception_caught.html.erb index 8d78e2e92..21223dc1e 100644 --- a/app/views/general/exception_caught.html.erb +++ b/app/views/general/exception_caught.html.erb @@ -12,13 +12,10 @@ <%= submit_tag _("Search") %> <% end %> </li> - </ul> + </ul> <% else %> <h1><%= _("Sorry, there was a problem processing this page") %></h1> <p><%= _('You have found a bug. Please <a href="{{contact_url}}">contact us</a> to tell us about the problem', :contact_url => help_contact_path) %></p> <% end %> - <h2><%= _('Technical details') %></h2> - <p><strong><%= h(@exception_class ? @exception_class : _("Unknown")) %></strong></p> - <p><strong><%= h(@exception_message) %></strong></p> </div> diff --git a/app/views/health_checks/index.html.erb b/app/views/health_checks/index.html.erb new file mode 100644 index 000000000..67b1050a9 --- /dev/null +++ b/app/views/health_checks/index.html.erb @@ -0,0 +1,12 @@ +<h1>Health Checks</h1> + +<div class="checks"> + <% @health_checks.each do |check| %> + <div class="check"> + <ul> + <li>Message: <%= check_status(check) %></li> + <li>OK? <%= check.ok? %></li> + </ul> + </div> + <% end %> +</div> diff --git a/app/views/public_body/_more_info.html.erb b/app/views/public_body/_more_info.html.erb new file mode 100644 index 000000000..8f0e448b6 --- /dev/null +++ b/app/views/public_body/_more_info.html.erb @@ -0,0 +1,17 @@ +<h2><%= _('More about this authority')%></h2> + +<% if !public_body.calculated_home_page.nil? %> + <%= link_to _('Home page of authority'), public_body.calculated_home_page %><br> +<% end %> + +<% if !public_body.publication_scheme.empty? %> + <%= link_to _('Publication scheme'), public_body.publication_scheme %><br> +<% end %> + +<% unless public_body.disclosure_log.empty? %> + <%= link_to _('Disclosure log'), public_body.disclosure_log %><br> +<% end %> + +<%= link_to _('View FOI email address'), view_public_body_email_path(public_body.url_name) %><br> + +<%= link_to _("Ask us to update FOI email"), new_change_request_path(:body => public_body.url_name) %><br> 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/public_body/list.html.erb b/app/views/public_body/list.html.erb index ce24daaf9..0750c7655 100644 --- a/app/views/public_body/list.html.erb +++ b/app/views/public_body/list.html.erb @@ -7,7 +7,7 @@ </li> </ul> <% first_row = true %> - <% for row in PublicBodyCategories::get().with_headings() %> + <% for row in PublicBodyCategory.get().with_headings() %> <% if row.instance_of?(Array) %> <li> <%= link_to_unless (@tag == row[0]), row[1], list_public_bodies_path(:tag => row[0]) %> diff --git a/app/views/public_body/show.html.erb b/app/views/public_body/show.html.erb index 9352747ea..011aea535 100644 --- a/app/views/public_body/show.html.erb +++ b/app/views/public_body/show.html.erb @@ -12,27 +12,7 @@ </p> <%= render :partial => 'track/tracking_links', :locals => { :track_thing => @track_thing, :own_request => false, :location => 'sidebar' } %> - <h2><%= _('More about this authority')%></h2> - <% if !@public_body.calculated_home_page.nil? %> - <%= link_to _('Home page of authority'), @public_body.calculated_home_page %><br> - <% end %> - <% if !@public_body.publication_scheme.empty? %> - <%= link_to _('Publication scheme'), @public_body.publication_scheme %><br> - <% end %> - <% unless @public_body.disclosure_log.empty? %> - <%= link_to _('Disclosure log'), @public_body.disclosure_log %><br> - <% end %> - <% if @public_body.has_tag?("charity") %> - <% for tag_value in @public_body.get_tag_values("charity") %> - <% if tag_value.match(/^SC/) %> - <%= link_to _('Charity registration'), "http://www.oscr.org.uk/CharityIndexDetails.aspx?id=" + tag_value %><br> - <% else %> - <%= link_to _('Charity registration'), "http://www.charity-commission.gov.uk/SHOWCHARITY/RegisterOfCharities/CharityFramework.aspx?RegisteredCharityNumber=" + tag_value %><br> - <% end %> - <% end %> - <% end %> - <%= link_to _('View FOI email address'), view_public_body_email_path(@public_body.url_name) %><br> - <%= link_to _("Ask us to update FOI email"), new_change_request_path(:body => @public_body.url_name) %><br> + <%= render :partial => 'more_info', :locals => { :public_body => @public_body } %> </div> <div id="header_left"> 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> diff --git a/app/views/user/_signin.html.erb b/app/views/user/_signin.html.erb index afc55d249..864951733 100644 --- a/app/views/user/_signin.html.erb +++ b/app/views/user/_signin.html.erb @@ -14,7 +14,7 @@ <p> <label class="form_label" for="user_signin_password"><%= _('Password:')%></label> - <%= password_field 'user_signin', 'password', { :size => 15, :tabindex => 20 } %> + <%= password_field 'user_signin', 'password', { :size => 15, :tabindex => 20, :autocomplete => 'off' } %> </p> <p class="form_note"> diff --git a/app/views/user/show.html.erb b/app/views/user/show.html.erb index 7ae577565..b23f74326 100644 --- a/app/views/user/show.html.erb +++ b/app/views/user/show.html.erb @@ -121,6 +121,9 @@ <%= form_tag(show_user_url, :method => "get", :id=>"search_form") do %> <div> <%= text_field_tag(:user_query, params[:user_query], {:title => "type your search term here" }) %> + <%= select_tag :request_latest_status, + options_from_collection_for_select(@request_states, 'value', 'text', params[:request_latest_status]), + :prompt => _('Filter by Request Status (optional)') %> <% if @is_you %> <%= submit_tag(_("Search your contributions")) %> <% else %> diff --git a/app/views/user/signchangeemail.html.erb b/app/views/user/signchangeemail.html.erb index 7308179f4..a99bcb785 100644 --- a/app/views/user/signchangeemail.html.erb +++ b/app/views/user/signchangeemail.html.erb @@ -23,7 +23,7 @@ <p> <label class="form_label" for="signchangeemail_password"> <%= _('Your password:')%></label> - <%= password_field 'signchangeemail', 'password', { :size => 15 } %> + <%= password_field 'signchangeemail', 'password', { :size => 15, :autocomplete => 'off' } %> </p> <p class="form_note"> diff --git a/app/views/user/signchangepassword.html.erb b/app/views/user/signchangepassword.html.erb index 51bcb466d..60f5d2c62 100644 --- a/app/views/user/signchangepassword.html.erb +++ b/app/views/user/signchangepassword.html.erb @@ -13,12 +13,12 @@ <p> <label class="form_label" for="user_password"><%= _('New password:')%></label> - <%= password_field 'user', 'password', { :size => 15 } %> + <%= password_field 'user', 'password', { :size => 15, :autocomplete => 'off' } %> </p> <p> <label class="form_label" for="user_password_confirmation"><%= _('New password: (again)')%></label> - <%= password_field 'user', 'password_confirmation', { :size => 15 } %> + <%= password_field 'user', 'password_confirmation', { :size => 15, :autocomplete => 'off' } %> </p> <div class="form_button"> |