aboutsummaryrefslogtreecommitdiffstats
path: root/app/views
diff options
context:
space:
mode:
Diffstat (limited to 'app/views')
-rw-r--r--app/views/request/list.rhtml17
-rw-r--r--app/views/request/show.rhtml32
-rw-r--r--app/views/track/_tracking_people_and_link.rhtml43
3 files changed, 48 insertions, 44 deletions
diff --git a/app/views/request/list.rhtml b/app/views/request/list.rhtml
index 6688dedb1..aac9f57a6 100644
--- a/app/views/request/list.rhtml
+++ b/app/views/request/list.rhtml
@@ -1,9 +1,5 @@
-<% if @existing_track %>
-<p>You are already being told about any new requests (<%= link_to "alter your subscriptions", user_url(@user) %>).</p>
-<% elsif @view.nil? %>
-<p><%= link_to "Be told about any new requests", track_new_requests_url() %>
-(by email or RSS feed <img src="/images/feed-14.png" alt="" class="rss">)
-</p>
+<% if @track_thing %>
+ <%= render :partial => 'track/tracking_people_and_link', :locals => { :track_thing => @track_thing, :own_request => false, :list_people => false } %>
<% end %>
<h1><%=@title%></h1>
@@ -22,11 +18,6 @@
<%= will_paginate WillPaginate::Collection.new(@page, @per_page, @search_hits) %>
-<% if @existing_track %>
-<p>You are already being told about any new requests. (<%= link_to "alter your subscriptions", user_url(@user) %>).</p>
-<% elsif @view.nil? %>
-<p><%= link_to "Be told about any new requests", track_new_requests_url() %>
-(by email or RSS feed <img src="/images/feed-14.png" alt="" class="rss">)
-</p>
+<% if @track_thing %>
+ <%= render :partial => 'track/tracking_people_and_link', :locals => { :track_thing => @track_thing, :own_request => false, :list_people => false } %>
<% end %>
-
diff --git a/app/views/request/show.rhtml b/app/views/request/show.rhtml
index a13a129b5..a994df6cd 100644
--- a/app/views/request/show.rhtml
+++ b/app/views/request/show.rhtml
@@ -8,37 +8,7 @@
<div id="request_sidebar">
<h2>People tracking this request</h2>
- <% if @info_request.track_things.size > 0 %>
- <ul>
- <% for track_thing in @info_request.track_things %>
- <li><%=user_link(track_thing.tracking_user)%></li>
- <% end %>
- </ul>
- <p>
- <% if @existing_track %>
- You are already tracking this request
- (<%= link_to "alter your subscriptions", user_url(@user) %>).
- <% else %>
- <% if @info_request.user == @user %>
- <p>You will be emailed when there are updates to your own request.</p>
- <p>You may also <%= link_to "get an RSS feed", track_request_url(:url_title => @info_request.url_title) %>
- <img src="/images/feed-14.png" alt="" class="rss"></p>
- <% else %>
- <%= link_to "Track updates to this request", track_request_url(:url_title => @info_request.url_title) %>
- (by email or RSS feed <img src="/images/feed-14.png" alt="" class="rss">)
- <% end %>
- <% end %>
- </p>
- <% else %>
- <% if @info_request.user == @user %>
- <p>You will be emailed when there are updates to your own request.</p>
- <p>You may also get an <%= link_to 'RSS feed', track_request_url(:url_title => @info_request.url_title) %>
- <img src="/images/feed-14.png" alt="" class="rss"></p>
- <% else %>
- <p>Be the first to <%= link_to "track updates to this request", track_request_url(:url_title => @info_request.url_title) %>
- (by email or RSS feed <img src="/images/feed-14.png" alt="" class="rss">)</p>
- <% end %>
- <% end %>
+ <%= render :partial => 'track/tracking_people_and_link', :locals => { :track_thing => @track_thing, :own_request => @info_request.user == @user, :list_people => true } %>
<h2>Act on this request</h2>
<p>
diff --git a/app/views/track/_tracking_people_and_link.rhtml b/app/views/track/_tracking_people_and_link.rhtml
new file mode 100644
index 000000000..fbbda245a
--- /dev/null
+++ b/app/views/track/_tracking_people_and_link.rhtml
@@ -0,0 +1,43 @@
+<%
+ existing_track = TrackThing.find_by_existing_track(@user, track_thing.track_query)
+ if list_people
+ tracking_people = TrackThing.find_tracking_people(track_thing.track_query)
+ end
+%>
+
+<% if not list_people %>
+ <p><%= link_to track_thing.params[:verb_on_page], do_track_url(track_thing) %>
+ (by email or RSS feed <img src="/images/feed-14.png" alt="" class="rss">)</p>
+<% elsif tracking_people.size > 0 %>
+ <ul>
+ <% for u in tracking_people %>
+ <li><%=user_link(u)%></li>
+ <% end %>
+ </ul>
+ <p>
+ <% if existing_track %>
+ You are already <%= track_thing.params[:verb_on_page_already] %>
+ (<%= link_to "alter your subscriptions", user_url(@user) %>).
+ <% else %>
+ <% if own_request %>
+ <p>You will be emailed when there are updates to your own request.</p>
+ <p>You may also <%= link_to "get an RSS feed", do_track_url(track_thing) %>
+ <img src="/images/feed-14.png" alt="" class="rss"></p>
+ <% else %>
+ <%= link_to track_thing.params[:verb_on_page], do_track_url(track_thing) %>
+ (by email or RSS feed <img src="/images/feed-14.png" alt="" class="rss">)
+ <% end %>
+ <% end %>
+ </p>
+<% else %>
+ <% if own_request %>
+ <p>You will be emailed when there are updates to your own request.</p>
+ <p>You may also get an <%= link_to 'RSS feed', do_track_url(track_thing) %>
+ <img src="/images/feed-14.png" alt="" class="rss"></p>
+ <% else %>
+ <p>Be the first to <%= link_to track_thing.params[:verb_on_page].downcase, do_track_url(track_thing) %>
+ (by email or RSS feed <img src="/images/feed-14.png" alt="" class="rss">)</p>
+ <% end %>
+<% end %>
+
+