diff options
-rw-r--r-- | app/assets/javascripts/new-request.js | 14 | ||||
-rw-r--r-- | app/assets/stylesheets/main.scss | 11 | ||||
-rw-r--r-- | app/controllers/request_controller.rb | 6 | ||||
-rw-r--r-- | app/views/request/new.html.erb | 31 | ||||
-rw-r--r-- | config/application.rb | 1 |
5 files changed, 54 insertions, 9 deletions
diff --git a/app/assets/javascripts/new-request.js b/app/assets/javascripts/new-request.js new file mode 100644 index 000000000..f8f2a0665 --- /dev/null +++ b/app/assets/javascripts/new-request.js @@ -0,0 +1,14 @@ +$(document).ready(function() { + $('.batch_public_body_list').hide(); + var showtext = $('.batch_public_body_toggle').attr('data-showtext'); + var hidetext = $('.batch_public_body_toggle').attr('data-hidetext'); + $('.toggle-message').text(showtext); + $('.batch_public_body_toggle').click(function(){ + $('.batch_public_body_list').toggle(); + if ($('.toggle-message').text() == showtext){ + $('.toggle-message').text(hidetext); + }else{ + $('.toggle-message').text(showtext); + } + }) +}) diff --git a/app/assets/stylesheets/main.scss b/app/assets/stylesheets/main.scss index 2a057dab0..7d004e768 100644 --- a/app/assets/stylesheets/main.scss +++ b/app/assets/stylesheets/main.scss @@ -1722,7 +1722,7 @@ padding-right:50px; margin-bottom:10px; } -div.ff-icon-printfix,.comment_in_request_text img.comment_quote,body.front #other-country-notice,#other-country-notice,#authority_preview .public-body-name-prefix,#authority_preview #list-filter,#authority_preview h2.foi_results,div#show_response_view p.event_actions { +div.ff-icon-printfix,.comment_in_request_text img.comment_quote,body.front #other-country-notice,#other-country-notice,#authority_preview .public-body-name-prefix,#authority_preview #list-filter,#authority_preview h2.foi_results,div#show_response_view p.event_actions, div.batch_public_body_toggle { display:none; } @@ -1813,3 +1813,12 @@ text-decoration:none; #body_selection .body_select { width: 100%; } + +.batch_public_body_list { + margin-left: 110px; +} + +.batch_public_body_toggle { + color: #0000EE; + font-size: 0.9em; +} diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index bcee7d9f8..bef3575cc 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -209,6 +209,12 @@ class RequestController < ApplicationController end @batch = true + + I18n.with_locale(@locale) do + @public_bodies = PublicBody.where({:id => params[:public_body_ids]}). + includes(:translations). + order('public_body_translations.name').all + end if params[:submitted_new_request].nil? || params[:reedit] return render_new_compose(batch=true) end diff --git a/app/views/request/new.html.erb b/app/views/request/new.html.erb index 8534bf0da..631a7cd12 100644 --- a/app/views/request/new.html.erb +++ b/app/views/request/new.html.erb @@ -48,13 +48,27 @@ <div id="request_header"> <div id="request_header_body"> <label class="form_label"><%= _('To:') %></label> - <span id="to_public_body"> - <% if @batch %> - <%= _("Your selected authorities")%> - <% else %> + + <% if @batch %> + <span id="to_public_body"> + <%= _("Your selected authorities") %> + <span class="batch_public_body_toggle" data-hidetext="<%= _("(hide)") %>" data-showtext="<%= _("(show)") %>"><a class="toggle-message"></a></span> + </span> + + <div class="batch_public_body_list"> + <ul> + <% @public_bodies.each do |public_body| %> + <li><%= public_body.name %></li> + <% end %> + </ul> + </div> + + <% else %> + <span id="to_public_body"> <%=h(@info_request.public_body.name)%> - <% end %> - </span> + </span> + <% end %> + <% unless @batch %> <div class="form_item_note"> <% if @info_request.public_body.info_requests.size > 0 %> @@ -175,5 +189,6 @@ </div> <% end %> - - +<% if @batch %> + <%= javascript_include_tag 'new-request.js' %> +<% end %> diff --git a/config/application.rb b/config/application.rb index 91006b669..2356148a1 100644 --- a/config/application.rb +++ b/config/application.rb @@ -98,6 +98,7 @@ module Alaveteli 'excanvas.min.js', 'select-authorities.js', 'jquery_ujs.js', + 'new-request.js', 'fonts.css', 'print.css', 'admin.css', |