This repository has been archived by the owner on Feb 23, 2023. It is now read-only.
forked from measuredvoice/ringsail
-
Notifications
You must be signed in to change notification settings - Fork 41
/
browse.html.erb
134 lines (109 loc) · 4.31 KB
/
browse.html.erb
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<div class="page-header">
<h2><%= @page_title %></h2>
</div>
<div class="row">
<div class="span11">
<% if @agency %>
<h5>Social Media Accounts Managed by the <%= @agency.name %></h5>
<% else %>
<!-- <h4>Social Media Accounts Managed by the U.S. Federal Government</h4> -->
<% end %>
<% if @agency && @outlets.empty? %>
<div class="no_results">
<p class="label label-warning">No Registered Social Media Accounts</p>
<p>No one has registered any social media accounts managed by the <%= @agency.name %>.</p>
<p>If you know of any social media accounts managed by the <%= @agency.name %> and have a .gov or .mil email address, you can add them to the Social Media Registry.
<p>Enter your email address and phone number below and we will send you a link to add them.</p>
</div>
<%= form_tag({:controller => "howto_tokens", :action => "create"}) do %>
<fieldset>
<label for="email">Email:</label>
<%= text_field_tag('email', '', :class => "span5") %>
<label for="phone">Phone:</label>
<%= text_field_tag('phone', '', :class => "span5") %><br>
<input type="submit" class="btn" value="Submit">
</fieldset>
</form>
<hr>
<% end %>
<% elsif @agency %>
<% if flash[:alert] %>
<p class="span10 alert alert-warning">
<%= flash[:alert] %>
</p>
<% elsif flash[:notice] %>
<p class="span10 alert">
<strong><%= flash[:shortnotice] %></strong> <%= flash[:notice] %>
</p>
<% end %>
<%= paginate @outlets, :param_name => :page_number %>
<table class="table">
<thead>
<tr>
<th>Account URL</th>
<th>Managing Organization</th>
<th>Tags</th>
<th>Last Updated</th>
<% if current_token %>
<th>Actions</th>
<% end %>
</tr>
</thead>
<tbody>
<% @outlets.each do |outlet| %>
<tr>
<td><a href="<%= outlet.service_url %>" target="_blank"><%= outlet.service_url %></a></td>
<td>
<% if outlet.info_url.present? %>
<a href="<%= outlet.info_url %>"><%= outlet.organization %></a>
<% else %>
<%= outlet.organization %>
<% end %>
</td>
<td><%= outlet.tags.join(', ') %></td>
<td><%= outlet.updated_at.to_s(:human) %></td>
<% if current_token %>
<td><a class="btn" href="<%= howto_add_outlet_path :service_url => outlet.service_url, :auth_token => current_token.token %>" target="_blank">Edit</a></td>
<% end %>
</tr>
<% end %>
</tbody>
</table>
<%= paginate @outlets, :param_name => :page_number %>
<% unless current_token %>
<div>
<p>If you have a .gov or .mil email address, you can make changes to these listings. Enter your email address and phone number below and we will send you a link to edit them.</p>
<%= form_tag({:controller => "howto_tokens", :action => "create"}) do %>
<div class="clearfix">
<label for="email">Email:</label>
<div class="input">
<%= text_field_tag('email', '', :class => "span5") %>
</div>
</div>
<div class="clearfix">
<label for="phone">Phone:</label>
<div class="input">
<%= text_field_tag('phone', '', :class => "span5") %>
</div>
</div>
<%= hidden_field_tag('goto', 'browse') %>
<%= hidden_field_tag('agency_id', params[:agency_id]) %>
<div class="actions">
<input type="submit" class="btn" value="Submit">
</div>
<% end %> <!-- form -->
</div>
<hr>
<% end %> <%# end unless current_token %>
<% end %> <%# end if @agency %>
<form action="" method="GET" >
<fieldset>
<label for="agency_id">Select an<%= @agency ? 'other' : '' %> agency to see its social media accounts:</label>
<%= select_tag "agency_id", options_from_collection_for_select(@agencies, "shortname", "name_with_count", [params[:agency_id]]), :class => "span8", :tabindex => "1" %>
<% if current_token %>
<%= hidden_field_tag 'auth_token', current_token.token %>
<% end %>
<button class="btn" type="submit">Look Up Social Media Accounts</button>
</fieldset>
</div>
</div>