diff options
-rw-r--r-- | app/controllers/request_controller.rb | 2 | ||||
-rw-r--r-- | app/views/request/new.rhtml | 17 | ||||
-rw-r--r-- | app/views/request/preview.rhtml | 6 | ||||
-rw-r--r-- | vendor/plugins/has_tag_string/lib/has_tag_string.rb | 6 |
4 files changed, 27 insertions, 4 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index e9475e1b2..734c649dd 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -180,7 +180,7 @@ class RequestController < ApplicationController # First time we get to the page, just display it if params[:submitted_new_request].nil? || params[:reedit] # Read parameters in - public body must be passed in - params[:info_request] = { :public_body_id => params[:public_body_id] } if !params[:info_request] + params[:info_request] = { :public_body_id => params[:public_body_id], :tag_string => params[:tags] } if !params[:info_request] if !params[:info_request][:public_body_id] redirect_to frontpage_url return diff --git a/app/views/request/new.rhtml b/app/views/request/new.rhtml index b48966e2f..1b061fd46 100644 --- a/app/views/request/new.rhtml +++ b/app/views/request/new.rhtml @@ -115,8 +115,8 @@ <%= o.text_area :body, :rows => 20, :cols => 60 %> </p> <% end %> - - <div class="form_button"> + + <div class="form_button"> <script type="text/javascript">document.write('<input name="doSpell" type="button" value="Check spelling" onClick="openSpellChecker(document.getElementById(\'write_form\').body);"/> (optional)')</script> </div> @@ -147,7 +147,18 @@ <%= hidden_field_tag(:preview, 1 ) %> <%= submit_tag "Preview your public request" %> </div> - </div> + + <% if !@info_request.tag_string.empty? %> + <p class="form_note"> + <!-- <label class="form_label" for="info_request_tag_string">Tags:</label> + <%= f.text_field :tag_string, :size => 50 %> --> + + <%= f.hidden_field(:tag_string) %> + <strong>Tags:</strong> <%=h @info_request.tag_string %> + </p> + <% end %> + + </div> <% end %> diff --git a/app/views/request/preview.rhtml b/app/views/request/preview.rhtml index 427d036d9..36e428412 100644 --- a/app/views/request/preview.rhtml +++ b/app/views/request/preview.rhtml @@ -34,12 +34,18 @@ <p> <%= f.hidden_field(:title) %> <%= f.hidden_field(:public_body_id, { :value => @info_request.public_body_id } ) %> + <%= f.hidden_field(:tag_string) %> <%= hidden_field_tag(:submitted_new_request, 1) %> <%= hidden_field_tag(:preview, 0 ) %> <%= submit_tag "Re-edit this request", :name => 'reedit' %> <%= submit_tag "Send public " + h(@info_request.law_used_full) + " request", :name => 'submit' %> </p> + <% if !@info_request.tag_string.empty? %> + <p><strong>Tags:</strong> <%=h @info_request.tag_string %></p> + <% end %> + + <% end %> diff --git a/vendor/plugins/has_tag_string/lib/has_tag_string.rb b/vendor/plugins/has_tag_string/lib/has_tag_string.rb index 365ae4b31..fdcc35a55 100644 --- a/vendor/plugins/has_tag_string/lib/has_tag_string.rb +++ b/vendor/plugins/has_tag_string/lib/has_tag_string.rb @@ -29,6 +29,8 @@ module HasTagString return ret end + # Parses a text version of one single tag, such as "a:b" and returns + # the name and value, with nil for value if there isn't one. def HasTagStringTag.split_tag_into_name_value(tag) sections = tag.split(/:/) name = sections[0] @@ -46,6 +48,10 @@ module HasTagString # Given an input string of tags, sets all tags to that string. # XXX This immediately saves the new tags. def tag_string=(tag_string) + if tag_string.nil? + tag_string = "" + end + tag_string = tag_string.strip # split tags apart tags = tag_string.split(/\s+/).uniq |