diff options
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/admin/timeline.rhtml | 2 | ||||
-rw-r--r-- | app/views/admin_request/show.rhtml | 24 | ||||
-rw-r--r-- | app/views/comment/_comment_form.rhtml | 11 | ||||
-rw-r--r-- | app/views/comment/new.rhtml | 7 | ||||
-rw-r--r-- | app/views/comment/preview.rhtml | 24 | ||||
-rw-r--r-- | app/views/general/search.rhtml | 2 | ||||
-rw-r--r-- | app/views/request/_correspondence.rhtml | 12 | ||||
-rw-r--r-- | app/views/request/_request_listing_via_event.rhtml | 4 | ||||
-rw-r--r-- | app/views/request/show.rhtml | 6 | ||||
-rw-r--r-- | app/views/track_mailer/event_digest.rhtml | 5 |
10 files changed, 89 insertions, 8 deletions
diff --git a/app/views/admin/timeline.rhtml b/app/views/admin/timeline.rhtml index d7680b994..f24d0be4b 100644 --- a/app/views/admin/timeline.rhtml +++ b/app/views/admin/timeline.rhtml @@ -62,6 +62,8 @@ had the request resent to <%=h event.params[:email]%> at <%=h event.info_request.public_body.name %>. <% elsif event.event_type == 'followup_sent' %> had a follow up message sent to <%=h event.info_request.public_body.name %>. + <% elsif event.event_type == 'comment' %> + had an annotation posted by <%=h event.comment.user.name %>. <% else %> had '<%=event.event_type%>' done to it, parameters <%=h event.params_yaml%>. <% end %> diff --git a/app/views/admin_request/show.rhtml b/app/views/admin_request/show.rhtml index 91b0646a4..d5356dd10 100644 --- a/app/views/admin_request/show.rhtml +++ b/app/views/admin_request/show.rhtml @@ -109,3 +109,27 @@ <% end %> </table> +<h2>Comments</h2> + +<table> + <tr> + <th>Id</th> + <th>Posted by</th> + <% for column in Comment.content_columns %> + <th><%= column.human_name %></th> + <% end %> + <!--<th>Actions</th>--> + </tr> + +<% for comment in @info_request.comments.find(:all, :order => 'created_at') %> + <tr class="<%= cycle('odd', 'even') %>"> + <td><%=h comment.id %></td> + <td><%= user_admin_link(comment.user) %></td> + <% for column in Comment.content_columns.map { |c| c.name } %> + <td><%=h comment.send(column) %></td> + <% end %> + </tr> +<% end %> +</table> + + diff --git a/app/views/comment/_comment_form.rhtml b/app/views/comment/_comment_form.rhtml index d1ce0a61a..9b2f251cb 100644 --- a/app/views/comment/_comment_form.rhtml +++ b/app/views/comment/_comment_form.rhtml @@ -1,6 +1,10 @@ -<% form_for(:comment, @comment) do |o| %> +<% form_for(:comment, @comment, :url => { :controller => "comment", :action => "new", :type => "request" }, :html => { :id => 'comment_form' } ) do |f| %> <p> - <%= o.text_area :body, :rows => 10, :cols => 55 %> + <%= f.text_area :body, :rows => 10, :cols => 55 %> + </p> + + <p> + <script type="text/javascript">document.write('<input name="doSpell" type="button" value="Check spelling" onClick="openSpellChecker(document.getElementById(\'comment_form\').body);"/> (optional)')</script> </p> <p> @@ -9,7 +13,8 @@ <p> <%= hidden_field_tag 'submitted_comment', 1 %> - <%= submit_tag "Add public annotation" %> + <%= hidden_field_tag 'preview', 1 %> + <%= submit_tag "Preview your annotation" %> </p> <% end %> diff --git a/app/views/comment/new.rhtml b/app/views/comment/new.rhtml new file mode 100644 index 000000000..22e260c1b --- /dev/null +++ b/app/views/comment/new.rhtml @@ -0,0 +1,7 @@ +<% @title = "Make an annotation on '" + h(@info_request.title) + "'" %> + +<%= foi_error_messages_for :comment %> + +<h1>Add an annotation</h1> + +<%= render :partial => 'comment/comment_form', :locals => { } %> diff --git a/app/views/comment/preview.rhtml b/app/views/comment/preview.rhtml new file mode 100644 index 000000000..39f99e889 --- /dev/null +++ b/app/views/comment/preview.rhtml @@ -0,0 +1,24 @@ +<% @title = "Preview new annotation on '" + h(@info_request.title) + "'" %> + +<% form_for(:comment, @comment, :html => { :id => 'preview_form' }, :url => { :controller => "comment", :action => "new", :type => "request" } ) do |f| %> + + <h1>Now preview your annotation</h1> + + <p class="comment_in_request"> + <%= @comment.get_body_for_html_display %> + <%= f.hidden_field(:body) %> + </p> + + <p> + Your name and annotation will appear in <strong>search engines</strong>. + + <p> + <%= hidden_field_tag(:submitted_comment, 1) %> + <%= hidden_field_tag(:preview, 0 ) %> + <%= submit_tag "Re-edit this annotation", :name => 'reedit' %> + <%= submit_tag "Post annotation", :name => 'submit' %> + </p> + +<% end %> + + diff --git a/app/views/general/search.rhtml b/app/views/general/search.rhtml index 01a52fe99..6ecebcdf1 100644 --- a/app/views/general/search.rhtml +++ b/app/views/general/search.rhtml @@ -89,7 +89,7 @@ <li>Enter words that you want to find separated by spaces, e.g. <strong>climbing lane</strong></li> <li>Use OR (in capital letters) where you don't mind which word, e.g. <strong>commons OR lords</strong> <li>Use quotes when you want to find an exact phrase, e.g. <strong>"Liverpool City Council"</strong> - <li><strong>variety:</strong> with value sent, followup_sent, response, authority or user to select type of thing to search for. + <li><strong>variety:</strong> with value sent, followup_sent, response, comment, authority or user to select type of thing to search for. <li>Type <strong>status:</strong> to select based on the status or historical status of the request, see table below. <li><strong>requested_from:home_office</strong> to restrict to requests from the <%= link_to "Home Office", show_public_body_url(:url_name => 'home_office') %>, typing the name as in the URL. <li><strong>requested_by:julian_todd</strong> to restrict to requests made by <%= link_to "Julian Todd", show_user_url(:url_name => 'julian_todd') %>, typing the name as in the URL. diff --git a/app/views/request/_correspondence.rhtml b/app/views/request/_correspondence.rhtml index c15d34b6f..cb58756bf 100644 --- a/app/views/request/_correspondence.rhtml +++ b/app/views/request/_correspondence.rhtml @@ -68,6 +68,18 @@ elsif info_request_event.event_type == 'sent' || info_request_event.event_type = to <%= public_body_link(@info_request.public_body) %> again<% if @info_request.get_previous_email_sent_to(info_request_event) != info_request_event.params[:email] %>, using a new contact address<% end %>. </p> </div> +<% elsif info_request_event.event_type == 'comment' + comment = info_request_event.comment +%> + <div class="comment_in_request" id="comment-<%=comment.id.to_s%>"> + <p class=""> + On <%= simple_date(info_request_event.created_at) %>, + <%= user_link(comment.user) %> added an annotation: + </p> + <p> + "<%= comment.get_body_for_html_display %>" + </p> + </div> <% end diff --git a/app/views/request/_request_listing_via_event.rhtml b/app/views/request/_request_listing_via_event.rhtml index fae19bcfa..fd30a5dc9 100644 --- a/app/views/request/_request_listing_via_event.rhtml +++ b/app/views/request/_request_listing_via_event.rhtml @@ -8,6 +8,8 @@ end %> <%= link_to highlight_words(info_request.title, @highlight_words), incoming_message_url(event.incoming_message) %> <% elsif not event.outgoing_message.nil? and event.event_type == 'followup_sent' %> <%= link_to highlight_words(info_request.title, @highlight_words), outgoing_message_url(event.outgoing_message) %> + <% elsif not event.comment.nil? %> + <%= link_to highlight_words(info_request.title, @highlight_words), comment_url(event.comment) %> <% else %> <%= link_to highlight_words(info_request.title, @highlight_words), request_url(info_request) %> <% end %> @@ -36,6 +38,8 @@ end %> <% end %> by <%= public_body_link(info_request.public_body) %> to <%= user_link(info_request.user) %> + <% elsif event.event_type == 'comment' %> + Annotation by <%= user_link(event.comment.user) %> <% else %> <% raise "unknown event type indexed " + event.event_type %> <% end %> diff --git a/app/views/request/show.rhtml b/app/views/request/show.rhtml index e5ac5b008..e10550022 100644 --- a/app/views/request/show.rhtml +++ b/app/views/request/show.rhtml @@ -99,7 +99,6 @@ <% end %> <!-- - <div id="comment_form"> <h2>Add an annotation</h2> @@ -125,7 +124,7 @@ <% if [ 'successful', 'partially_successful' ].include?(@info_request.described_state) %> <li> <strong>Summarise</strong> the content of any information returned. </li> <li> Say how you've <strong>used the information</strong>, with links if possible. </li> - <li> <strong>Thank</strong> the local authority or <%=h @info_request.user.name %>. </li> + <li> <strong>Thank</strong> the public authority or <%=h @info_request.user.name %>. </li> <% end %> <% if [ 'partially_successful' ].include?(@info_request.described_state) %> <li> Suggest how the requester can find the <strong>rest of the information</strong>. </li> @@ -148,7 +147,8 @@ </ul> <%= render :partial => 'comment/comment_form', :locals => { } %> - </div> --> + </div> + --> </div> diff --git a/app/views/track_mailer/event_digest.rhtml b/app/views/track_mailer/event_digest.rhtml index 83ce6d516..a6b4a2729 100644 --- a/app/views/track_mailer/event_digest.rhtml +++ b/app/views/track_mailer/event_digest.rhtml @@ -24,8 +24,11 @@ main_text += event.info_request.user.name + " sent a follow up message to " + event.info_request.public_body.name elsif event.event_type == 'sent' # this is unlikely to happen in real life, but happens in the test code - url = main_url(request_url(event.info_request))+"#outgoing-"+event.outgoing_message.id.to_s + url = main_url(outgoing_message_url(event.outgoing_message)) main_text += event.info_request.user.name + " sent a request to " + event.info_request.public_body.name + elsif event.event_type == 'comment' + url = main_url(comment_url(event.comment)) + main_text += event.comment.user.name + " added an annotation" else raise "unknown type in event_digest " + event.event_type end |