aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfrancis <francis>2008-08-09 00:25:28 +0000
committerfrancis <francis>2008-08-09 00:25:28 +0000
commit5500b18613f39b0bfcff52183bbfe4edf7f933ba (patch)
treec9910c8a9f86fbbb6b1bd9f7f8d223c066b61c0a
parent9fa74a64b2e4a77f292b8f4b648477fc2d4684e3 (diff)
Display RSS link on same line as form for unsubscribe.
-rw-r--r--app/controllers/track_controller.rb32
-rw-r--r--app/models/track_thing.rb4
-rw-r--r--app/views/track/_tracking_links.rhtml4
-rw-r--r--public/stylesheets/main.css6
-rw-r--r--todo.txt1
5 files changed, 29 insertions, 18 deletions
diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb
index bf4e8e138..e78d3959c 100644
--- a/app/controllers/track_controller.rb
+++ b/app/controllers/track_controller.rb
@@ -5,7 +5,7 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: track_controller.rb,v 1.25 2008-08-08 20:48:48 francis Exp $
+# $Id: track_controller.rb,v 1.26 2008-08-09 00:25:28 francis Exp $
class TrackController < ApplicationController
@@ -16,8 +16,9 @@ class TrackController < ApplicationController
return atom_feed_internal if params[:feed] == 'feed'
- ret = self.track_set
- redirect_to request_url(@info_request)
+ if self.track_set
+ redirect_to request_url(@info_request)
+ end
end
# Track all new/successful requests
@@ -34,8 +35,9 @@ class TrackController < ApplicationController
return atom_feed_internal if params[:feed] == 'feed'
- ret = self.track_set
- redirect_to request_list_url(:view => @view)
+ if self.track_set
+ redirect_to request_list_url(:view => @view)
+ end
end
# Track all updates to a particular public body
@@ -45,8 +47,9 @@ class TrackController < ApplicationController
return atom_feed_internal if params[:feed] == 'feed'
- ret = self.track_set
- redirect_to public_body_url(@public_body)
+ if self.track_set
+ redirect_to public_body_url(@public_body)
+ end
end
# Track a user
@@ -56,8 +59,9 @@ class TrackController < ApplicationController
return atom_feed_internal if params[:feed] == 'feed'
- ret = self.track_set
- redirect_to user_url(@track_user)
+ if self.track_set
+ redirect_to user_url(@track_user)
+ end
end
# Track a search term
@@ -68,10 +72,11 @@ class TrackController < ApplicationController
@query = query_array.join("/")
@track_thing = TrackThing.create_track_for_search_query(@query)
- return atom_feed_internal if params[:feed]
+ return atom_feed_internal if params[:feed] == 'feed'
- ret = self.track_set
- redirect_to search_url(@query)
+ if self.track_set
+ redirect_to search_url(@query)
+ end
end
# Generic request tracker - set @track_thing before calling
@@ -80,7 +85,7 @@ class TrackController < ApplicationController
@existing_track = TrackThing.find_by_existing_track(@user, @track_thing)
if @existing_track
flash[:notice] = "You are already being emailed updates about " + @track_thing.params[:list_description]
- return
+ return true
end
end
@@ -93,6 +98,7 @@ class TrackController < ApplicationController
@track_thing.save!
flash[:notice] = "You will now be emailed updates about " + @track_thing.params[:list_description]
+ return true
end
# Atom feed (like RSS) for the track
diff --git a/app/models/track_thing.rb b/app/models/track_thing.rb
index c32974483..e3af8fe16 100644
--- a/app/models/track_thing.rb
+++ b/app/models/track_thing.rb
@@ -21,7 +21,7 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: track_thing.rb,v 1.30 2008-08-08 21:12:49 francis Exp $
+# $Id: track_thing.rb,v 1.31 2008-08-09 00:25:28 francis Exp $
class TrackThing < ActiveRecord::Base
belongs_to :tracking_user, :class_name => 'User'
@@ -191,7 +191,7 @@ class TrackThing < ActiveRecord::Base
:set_title => "How would you like to be updated about new requests and responses matching '" + CGI.escapeHTML(self.track_query) + "'?",
:list_description => "'<a href=\"/search/" + CGI.escapeHTML(self.track_query) + "/newest\">" + CGI.escapeHTML(self.track_query) + "</a>' in new requests/responses", # XXX yeuch, sometimes I just want to call view helpers from the model, sorry! can't work out how
:verb_on_page => "Email me new requests/responses matching '" + CGI.escapeHTML(self.track_query) + "'",
- :verb_on_page_already => "Being emailed about '" + CGI.escapeHTML(self.track_query) + "'",
+ :verb_on_page_already => "You are being emailed about requests matching '" + CGI.escapeHTML(self.track_query) + "'",
# Email
:title_in_email => "Requests or responses matching '" + self.track_query + "'",
:title_in_rss => "Requests or responses matching '" + self.track_query + "'",
diff --git a/app/views/track/_tracking_links.rhtml b/app/views/track/_tracking_links.rhtml
index 7828ca9f3..65f5b5552 100644
--- a/app/views/track/_tracking_links.rhtml
+++ b/app/views/track/_tracking_links.rhtml
@@ -8,13 +8,11 @@
<% if own_request %>
<p>This is your own request, so you will be automatically emailed when new responses arrive.</p>
<% elsif existing_track %>
- <% form_tag :controller => 'track', :action => 'update', :track_id => existing_track.id do %>
- <p>
+ <% form_tag({:controller => 'track', :action => 'update', :track_id => existing_track.id}, :class => "feed_form_" + location) do %>
<%= track_thing.params[:verb_on_page_already] %>
<%= hidden_field_tag 'track_medium', "delete" %>
<%= hidden_field_tag 'r', request.request_uri %>
<%= submit_tag "unsubscribe" %>
- </p>
<% end %>
<% else %>
<div class="feed_link feed_link_<%=location%>">
diff --git a/public/stylesheets/main.css b/public/stylesheets/main.css
index fd1b806bb..527fad33f 100644
--- a/public/stylesheets/main.css
+++ b/public/stylesheets/main.css
@@ -783,10 +783,16 @@ div.feed_link img {
vertical-align: middle;
text-decoration: none;
}
+div.feed_link {
+ color: red;
+}
div.feed_link_main {
display: inline;
}
+form.feed_form_main {
+ display: inline;
+}
/*------------------------------------------------ footer */
diff --git a/todo.txt b/todo.txt
index 185f02c06..e24b82e2c 100644
--- a/todo.txt
+++ b/todo.txt
@@ -1,6 +1,7 @@
RSS move:
Redo styling a bit of action icons so consistent
with writetothem link
+ Get test code working
Add some tests
Spacing at end of search results