aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/user/show.rhtml
blob: 99a7a53258dbb4b3931f2a6e54eee95e7734e295 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<% @title = h(@display_user.name) + (@is_you ? " (you)" : "") %>

<% if (@same_name_users.size >= 1) %>
    <p>This is <strong>just one person</strong> who uses this site and has this name, you may
    mean a different one:
    <% for @same_name_user in @same_name_users %>
        <%= user_link(@same_name_user) %>
    <% end %> 
<% end%>

<div id="request_sidebar">
    <h2>People tracking this person</h2>
    <%= render :partial => 'track/tracking_people_and_link', :locals => { :track_thing => @track_thing, :own_request => false, :list_people => true } %>
</div> 

<div class="single_user" id="user-<%=@display_user.id.to_s%>">
    <h1><%=@title%></h1>
    <p class="subtitle">Joined WhatDoTheyKnow on <%= simple_date(@display_user.created_at) %></p>

    <p>
        <%= link_to "Send message to " + h(@display_user.name), contact_user_url(:id => @display_user.id) %>
        <% if @is_you %>
            (just to see how it works)
            <br><%= link_to "Change your password", signchange_url() %>
        <% else %>
        <% end %>
    </p>

    <% if not @display_user.track_things.empty? %>
        <h2>
        <%= @is_you ? 'You are' : 'This person is' %> tracking
        <%=pluralize(@display_user.track_things.size, "thing") %>
        </h2>

        <ul>
        <% for track_thing in @display_user.track_things %>
            <li>
                <% if @is_you %>
                    <% form_tag :controller => 'track', :action => 'update', :track_id => track_thing.id do %>
                        <%= track_thing.params[:list_description] %> by
                        <!-- (<%= link_to "view latest updates", :controller => 'general', :action => 'search', :query => track_thing.track_query %>) -->
                        <%= select 'track_thing', "track_medium", { "Email daily" => "email_daily", "RSS feed" => "feed", "Cancel updates" => "delete"}, { :selected => track_thing.track_medium } %>
                        <%= submit_tag "Update" %>
                        <!-- <% if track_thing.track_medium == 'feed' %>
                            (<%= link_to "Feed", :controller => 'track', :action => 'atom_feed', :track_id => track_thing.id %>
                            <img src="/images/feed-14.png" alt="" class="rss">)
                        <% end %> -->
                    <% end %>
                <% else %>
                    <%= track_thing.params[:list_description] %>
                <% end %>
            </li>
        <% end %>
        </ul>
        <% if not @is_you %>
        <p>If you are <%=h @display_user.name %>, <%= link_to "sign in", signin_url(:r => request.request_uri) %> to alter these settings.</p>
        <% end %>
    <% end %>

    <% if @display_user.info_requests.empty? %>
        <h2>Freedom of Information requests made by <%= @is_you ? 'you' : 'this person' %></h2>
        <p><%= @is_you ? 'You have' : 'This person has' %>
        made no Freedom of Information requests using this site.</p>

    <% else %>
        <h2>
        <%= @is_you ? 'You have' : 'This person has' %>
        made <%=pluralize(@display_user.info_requests.size, "Freedom of Information request") %>
        </h2>

        <%= render :partial => 'request/request_listing', :locals => { :info_requests => @display_user.info_requests } %>
    <% end %>
</div>