-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
Copy path_header.html.erb
222 lines (185 loc) · 10.3 KB
/
_header.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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
<% cache('feature_anniversary-banner', skip_digest: true) do %>
<%= feature('anniversary-banner') %>
<% end %>
<!-- facilitate space for multi-line header -->
<% if !current_user %>
<%= stylesheet_link_tag "I18n" %>
<% end %>
<% if @node && @node.body %>
<p class="facebook-summary" style="display:none;">
<%= raw strip_tags(sanitize(RDiscount.new(@node.body).to_html)).truncate(100) %>
</p>
<% end %>
<p class="facebook-summary" style="display:none;"><%= t('layout._header.summary') %></p>
<!-- facebook needs this apparently -->
<div id="fb-root"></div>
<nav id="header" class="navbar navbar-inverse navbar-fixed-top" style="margin-bottom:20px;">
<div class="container">
<!-- ||| menu, displayed for mobile: -->
<div class="navbar-header">
<a class="navbar-brand" id="brand" href="/<%= "home" if current_user %>">Public Lab</a>
<a class="navbar-brand brand-compact" id="brand-compact" href="/<%= "home" if current_user %>">PL</a>
<% if current_user %><a class="navbar-brand home-icon visible-xs" href="/"><i class="fa fa-home fa fa-white"></i></a><% end %>
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#header-navbar-collapse">
<span class="fa fa-white fa-bars"></span>
</button>
</div>
<div class="collapse navbar-collapse" id="header-navbar-collapse">
<ul class="nav navbar-nav navbar-left">
<% if current_user %><li><a rel="tooltip" title="<%= t('layout._header.your_dashboard') %>" data-placement="bottom" href="/dashboard"><i class="fa fa-home fa fa-white"></i></a></li><% end %>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
Get Involved <b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li><a href="/events">Attend an event</a></li>
<li><a href="/chat">Chat online</a></li>
<li><a href="/questions">Ask a question</a></li>
<li><a href="/tags">Find a topic you care about</a></li>
<li><a href="/requests">Respond to a request</a></li>
<li><a href="/dashboard">Browse recent research</a></li>
<li><a href="/methods">Discover methods</a></li>
<li><a href="/kits">Contribute a kit</a></li>
<% if !current_user %>
<li><a href="/signup">Create an account</a></li>
<% end %>
<li><a href="/post">Post your work</a></li>
<li class="hidden-lg hidden-xl"><a href="/donate">Donate</a></li>
</ul>
</li>
</ul>
<form id="searchform" class="navbar-form navbar-left" role="search" autocomplete="off">
<div class="form-group">
<input tabindex="1" id="searchform_input" type="text" class="form-control search-query typeahead" qryType="all" placeholder="<%= t('layout._header.search') %>" required/>
</div>
<button type="submit" class="btn btn-primary" style="background:#444;border-color:#222;"><i class="fa fa-search"></i></button>
</form>
<ul class="nav navbar-nav">
<li class="dropdown hidden-xs hidden-sm">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
<%= t('layout._header.about.about_title') %> <b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li><a href="/wiki/stories"><%= t('layout._header.about.stories') %></a></li>
<li><a href="/blog"><%= t('layout._header.about.blog') %></a></li>
<li><a href="/about"><%= t('layout._header.about.about_public_lab') %></a></li>
<li class="divider"></li>
<li><a href="/wiki/plots-staff"><%= t('layout._header.about.team') %></a></li>
<li><a href="/wiki/organizers"><%= t('layout._header.about.organizers') %></a></li>
<li><a href="/wiki/board"><%= t('layout._header.about.board') %></a></li>
<li><a href="/wiki/how-we-are-funded"><%= t('layout._header.about.fund') %></a></li>
<li class="divider"></li>
<li><a href="/media"><%= t('layout._header.about.press_and_media') %></a></li>
<li><a href="/wiki/contact"><%= t('layout._header.about.contact') %></a></li>
<li class="hidden-lg hidden-xl"><a href="//store.publiclab.org"><%= t('layout._header.store') %></a></li>
</ul>
</li>
<li class="nav-button-wrapper hidden-xs hidden-sm hidden-md">
<a class="btn btn-sm btn-default nav-button-store" href="//store.publiclab.org"><%= t('layout._header.store') %></a>
</li>
</ul>
<div id="chat" class="chat-popover" data-placement="bottom" style="display:none;">
<a style="margin-right:4px;" class="pull-right btn btn-sm" href="https://chat.publiclab.org" target="_blank"><%= t('layout._header.chatroom.pop_out') %></a>
<p class="popover-title"><%= t('layout._header.chatroom.chatroom_title') %></p>
</div>
<% unless current_user %><a rel="tooltip" title="<%= t('layout._header.become_part_community') %>" data-placement="bottom" style="margin-left:14px;" href="/signup" class="btn btn-primary navbar-btn navbar-right hidden-xs"><%= t('layout._header.join') %></a><% end %>
<div class="nav-button-wrapper hidden-xs hidden-sm hidden-md navbar-right">
<a class="btn btn-sm nav-button-donate" href="/donate"><%= t('layout._header.donate') %></a>
</div>
<% unless params[:action] == "register" || params[:action] == "signup" %>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a id="chat-button" style="cursor: pointer;">
<i class="fa fa-white fa fa-comments"></i>
</a>
</li>
<li class="dropdown">
<% if current_user %>
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-user fa fa-white"></i>
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li class="dropdown-header"><%= current_user.username %><% if current_user.role === 'moderator' || current_user.role === 'admin'%>: <%= current_user.role %><% end %></li>
<% if params[:action] == "dashboard" %>
<li><a href="/home">Home</a></li>
<% else %>
<li><a href="/dashboard"><%= t('layout._header.dashboard') %></a></li>
<% end %>
<li><a href="/profile/<%= current_user.username %>"><%= t('layout._header.profile') %></a></li>
<li><a href="/profile/edit"><%= t('layout._header.edit_profile') %></a></li>
<li class="divider"></li>
<li><a href="/subscriptions"><%= t('layout._header.subscriptions') %></a></li>
<li><a href="/profile/<%= current_user.username %>/likes"><%= t('layout._header.notes_liked') %></a></li>
<li class="divider"></li>
<% if current_user.role == 'admin' %>
<li><a href="/useremail">Email search</a></li>
<li><a href="/wiki/locked">Locked pages</a></li>
<li><a href="/spam">Spam moderation</a></li>
<li><a href="/people">Contributors</a></li>
<li class="divider"></li>
<% end %>
<li><%= link_to t('layout._header.logout'), logout_path %></li>
<li><a href="/logoutRemotely">Logout from all devices</a></li>
</ul>
<% else %>
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-user fa fa-white"></i>
<%= t('layout._header.login.login_title') %> <b class="caret"></b>
</a>
<ul id="login-dropdown" class="dropdown-menu" style="width:240px;">
<li style="padding:6px;">
<%= form_for :user_session, :as => :user_session, :url => { :controller => "user_sessions", :action => "create" }, :html => {:class => "form"} do |f| %>
<div class="form-group">
<label for="username"><%= t('layout._header.login.username') %></label>
<%= f.text_field :username, { tabindex: 1, class: 'form-control', id: 'username-login' } %>
</div>
<div class="form-group">
<label for="password"><%= t('layout._header.login.password') %></label>
<%= f.password_field :password, { tabindex: 2, class: 'form-control', id: 'password-login' } %>
</div>
<input type="hidden" name="return_to" value="<%= params[:return_to] || request.path %>" />
<div class="checkbox">
<label>
<%= f.check_box :remember_me %> <%= t('layout._header.login.remember_me') %>
</label>
</div>
<p>
<button class="btn btn-primary" type="submit" tabindex="3"><%= t('layout._header.login.login_title') %></button>
<a class="btn btn-default" href="/signup" tabindex="4"><%= t('layout._header.login.sign_up') %></a>
</p>
<p><a href="/reset/"><%= t('layout._header.login.reset_password') %></a></p>
<% if Rails.env == "production"%>
<h5>Log In with</h5>
<div class="loginbutton" >
<a href="/auth/google_oauth2" id="connect-google"><span class="btn btn-default"><i class="fa fa-google" style="font-size:20px;color:red"></i></span></div></a>
</div>
<% end %>
<% end %>
</li>
</ul>
<% end %>
</li>
</ul>
<% end %>
</div>
</div>
</nav>
<div class="body-container container">
<div class="visible-print">
<% if params[:controller] == "notes" %><h1>Public Lab <small><%= t('layout._header.research_note') %></small></h1><% end %>
<% if params[:controller] == "wiki" %><h1>Public Lab <small><%= t('layout._header.wiki_doc') %></small></h1><% end %>
<hr />
</div>
<script>
$('#chat-button').click(function(e){
e.stopPropagation() ;
});
$('body').click(function(){
var c = $('#chat') ;
if($('#chat').is(':visible') == true)
c.hide() ;
});
</script>
<%= render :partial => "layouts/alerts" %>
</div>