|
3 | 3 | <% sticky_header = user_preference('sticky_header', community: false) == 'true' %> |
4 | 4 |
|
5 | 5 | <script> |
6 | | -const toggleSearchFocus = () => { |
7 | | - const $input = $('#search'); |
| 6 | + const toggleSearchFocus = () => { |
| 7 | + const $input = $('#search'); |
8 | 8 |
|
9 | | - if ($input.is(':focus')) { |
10 | | - $input.blur(); |
11 | | - } |
12 | | - else { |
13 | | - $input.focus(); |
14 | | - } |
15 | | -}; |
| 9 | + if ($input.is(':focus')) { |
| 10 | + $input.blur(); |
| 11 | + } |
| 12 | + else { |
| 13 | + $input.focus(); |
| 14 | + } |
| 15 | + }; |
16 | 16 |
|
17 | | -$(() => { |
18 | | - $('a[data-header-slide="#search-slide"]').on('click', toggleSearchFocus); |
19 | | -}); |
| 17 | + $(() => { |
| 18 | + $('a[data-header-slide="#search-slide"]').on('click', toggleSearchFocus); |
| 19 | + }); |
20 | 20 | </script> |
21 | 21 |
|
22 | 22 | <header class="header is-small has-margin-0<%=' is-dark' if SiteSetting['SiteHeaderIsDark'] %><%= ' sticky' if sticky_header %>"> |
@@ -96,40 +96,36 @@ $(() => { |
96 | 96 | data-header-slide="#communities-slide" |
97 | 97 | title="Show Communities" |
98 | 98 | > |
99 | | - <i class="far fa-fw fa-caret-square-down"></i> |
| 99 | + <i class="far fa-fw fa-caret-square-down"></i> |
100 | 100 | </a> |
101 | | - <% unless user_signed_in? %> |
102 | | - <div class="header--item"> |
| 101 | + <div class="header--item"> |
| 102 | + <% if user_signed_in? %> |
| 103 | + <%= render 'users/sessions/sign_out' %> |
| 104 | + <% else %> |
103 | 105 | <% if devise_sign_in_enabled? %> |
104 | 106 | <%= link_to 'Sign Up', new_user_registration_path, class: 'button is-muted is-filled' %> |
105 | 107 | <%= link_to 'Sign In', new_user_session_path, class: 'button is-muted is-outlined' %> |
106 | 108 | <% end %> |
107 | 109 | <% if sso_sign_in_enabled? %> |
108 | 110 | <%= link_to 'SSO Sign In', new_saml_user_session_path, class: 'button is-muted is-outlined' %> |
109 | 111 | <% end %> |
110 | | - </div> |
111 | | - <% end %> |
| 112 | + |
| 113 | + <% end %> |
| 114 | + </div> |
112 | 115 | <% unless @community.is_fake %> |
113 | 116 | <a class="header--item is-mobile-menu is-complex" aria-label="Menu" href="#" data-header-slide="#js-mobile-menu"> |
114 | | - <span class="header--menu-bars"> |
115 | | - <span></span> |
116 | | - <span></span> |
117 | | - <span></span> |
118 | | - </span> |
| 117 | + <span class="header--menu-bars"> |
| 118 | + <span></span> |
| 119 | + <span></span> |
| 120 | + <span></span> |
| 121 | + </span> |
119 | 122 | </a> |
120 | 123 | <% end %> |
121 | 124 | </nav> |
122 | 125 | </div> |
123 | 126 | </header> |
124 | 127 |
|
125 | 128 | <div class="header-slide" id="communities-slide"> |
126 | | - <% if user_signed_in? %> |
127 | | - <% if devise_sign_in_enabled? %> |
128 | | - <%= link_to 'Sign Out', destroy_user_session_path, method: :delete, class: 'button is-muted has-float-right', role: 'button' %> |
129 | | - <% else %> |
130 | | - <%= link_to 'Sign Out', destroy_saml_user_session_path, method: :delete, class: 'button is-muted has-float-right', role: 'button' %> |
131 | | - <% end %> |
132 | | - <% end %> |
133 | 129 | <h3 class="h-m-t-1">Communities</h3> |
134 | 130 | <div class="community-header-list"> |
135 | 131 | <% logo_paths = SiteSetting.all_communities('SiteLogoPath') %> |
@@ -173,165 +169,164 @@ $(() => { |
173 | 169 | </div> |
174 | 170 | <div class="grid--cell is-6 is-12-sm"> |
175 | 171 | <span>created:<1w</span> <span class="has-color-tertiary-600">created < 1 week ago</span> |
176 | | - </div> |
177 | | - <div class="grid--cell is-6 is-12-sm"> |
178 | | - <span>post_type:xxxx</span> <span class="has-color-tertiary-600">type of post</span> |
179 | | - </div> |
180 | | - </div> |
| 172 | + </div> |
| 173 | + <div class="grid--cell is-6 is-12-sm"> |
| 174 | + <span>post_type:xxxx</span> <span class="has-color-tertiary-600">type of post</span> |
| 175 | + </div> |
| 176 | + </div> |
181 | 177 |
|
182 | | - <%= form_tag search_path, method: :get, role: 'search' do %> |
183 | | - <div class="grid is-nowrap"> |
184 | | - <%= search_field_tag :search, params[:search], class: 'form-element' %> |
185 | | - <div class="h-m-1"> |
186 | | - <%= button_tag type: :submit, class: 'button is-filled is-outlined', name: nil do %> |
187 | | - <i class="fa fa-search"></i> |
| 178 | + <%= form_tag search_path, method: :get, role: 'search' do %> |
| 179 | + <div class="grid is-nowrap"> |
| 180 | + <%= search_field_tag :search, params[:search], class: 'form-element' %> |
| 181 | + <div class="h-m-1"> |
| 182 | + <%= button_tag type: :submit, class: 'button is-filled is-outlined', name: nil do %> |
| 183 | + <i class="fa fa-search"></i> |
| 184 | + <% end %> |
| 185 | + </div> |
| 186 | + </div> |
188 | 187 | <% end %> |
| 188 | + <div class="has-padding-top-2 has-padding-right-1 has-float-right"> |
| 189 | + <a href="<%= help_path('search') %>">Search help</a> |
| 190 | + </div> |
189 | 191 | </div> |
190 | | - </div> |
191 | | - <% end %> |
192 | | - <div class="has-padding-top-2 has-padding-right-1 has-float-right"> |
193 | | - <a href="<%= help_path('search') %>">Search help</a> |
194 | | - </div> |
195 | | -</div> |
196 | 192 |
|
197 | | -<div class="header-slide inbox h-p-0" id="js-inbox"> |
198 | | - <div class="h-p-2 h-bg-tertiary-050 h-fw-bold">Notifications</div> |
199 | | - <div class="h-p-2 h-bg-tertiary-050 h-fw-bold"> |
200 | | - <a class="no-unread js-read-all-notifs" href="#"><i class="fas fa-envelope-open"></i> Mark all as read</a> |
201 | | - <a href="/users/me/notifications" class="button is-muted is-small">See all your notifications »</a> |
202 | | - </div> |
203 | | - <div class="inbox--container h-p-2"></div> |
204 | | -</div> |
205 | | -<% unless @community.is_fake %> |
206 | | -<div class="header-slide mobile-menu" id="js-mobile-menu"> |
207 | | - <div class="menu"> |
208 | | - <%= link_to 'Users', users_path, class: 'menu--item' %> |
209 | | - <%= link_to 'Search', search_path, class: 'menu--item' %> |
| 193 | + <div class="header-slide inbox h-p-0" id="js-inbox"> |
| 194 | + <div class="h-p-2 h-bg-tertiary-050 h-fw-bold">Notifications</div> |
| 195 | + <div class="h-p-2 h-bg-tertiary-050 h-fw-bold"> |
| 196 | + <a class="no-unread js-read-all-notifs" href="#"><i class="fas fa-envelope-open"></i> Mark all as read</a> |
| 197 | + <a href="/users/me/notifications" class="button is-muted is-small">See all your notifications »</a> |
| 198 | + </div> |
| 199 | + <div class="inbox--container h-p-2"></div> |
| 200 | + </div> |
| 201 | + <% unless @community.is_fake %> |
| 202 | + <div class="header-slide mobile-menu" id="js-mobile-menu"> |
| 203 | + <div class="menu"> |
| 204 | + <%= link_to 'Users', users_path, class: 'menu--item' %> |
| 205 | + <%= link_to 'Search', search_path, class: 'menu--item' %> |
210 | 206 |
|
211 | | - <div class='header-slide--separator'></div> |
| 207 | + <div class='header-slide--separator'></div> |
212 | 208 |
|
213 | | - <%= link_to 'Help', help_center_path, class: 'menu--item' %> |
| 209 | + <%= link_to 'Help', help_center_path, class: 'menu--item' %> |
214 | 210 |
|
215 | | - <%= link_to 'Dashboard', dashboard_path, class: 'menu--item' %> |
| 211 | + <%= link_to 'Dashboard', dashboard_path, class: 'menu--item' %> |
216 | 212 |
|
217 | | - <% if user_signed_in? %> |
218 | | - <% if current_user.at_least_moderator? %> |
219 | | - <%= link_to (@open_flags > 0) ? flag_queue_path : moderator_path, class: 'menu--item' do %> |
220 | | - Mod |
221 | | - <% if @open_flags > 0 %> |
222 | | - <span class="badge is-status"><%= @open_flags %></span> |
223 | | - <% end %> |
| 213 | + <% if user_signed_in? %> |
| 214 | + <% if current_user.at_least_moderator? %> |
| 215 | + <%= link_to (@open_flags > 0) ? flag_queue_path : moderator_path, class: 'menu--item' do %> |
| 216 | + Mod |
| 217 | + <% if @open_flags > 0 %> |
| 218 | + <span class="badge is-status"><%= @open_flags %></span> |
| 219 | + <% end %> |
| 220 | + <% end %> |
| 221 | + <% end %> |
| 222 | + <% if devise_sign_in_enabled? %> |
| 223 | + <%= link_to 'Sign Out', destroy_user_session_path, method: :delete, class: 'menu--item', role: 'button' %> |
| 224 | + <% else %> |
| 225 | + <%= link_to 'Sign Out', destroy_saml_user_session_path, method: :delete, class: 'menu--item', role: 'button' %> |
| 226 | + <% end %> |
| 227 | + <% else %> |
| 228 | + <% if sso_sign_in_enabled? %> |
| 229 | + <%= link_to 'SSO Sign In', new_saml_user_session_path, class: 'menu--item' %> |
| 230 | + <% end %> |
| 231 | + <% if devise_sign_in_enabled? %> |
| 232 | + <%= link_to 'Sign In', new_user_session_path, class: 'menu--item' %> |
| 233 | + <%= link_to 'Sign Up', new_user_registration_path, class: 'menu--item' %> |
| 234 | + <% end %> |
| 235 | + <% end %> |
| 236 | + </div> |
| 237 | + </div> |
224 | 238 | <% end %> |
225 | | - <% end %> |
226 | | - <% if devise_sign_in_enabled? %> |
227 | | - <%= link_to 'Sign Out', destroy_user_session_path, method: :delete, class: 'menu--item', role: 'button' %> |
228 | | - <% else %> |
229 | | - <%= link_to 'Sign Out', destroy_saml_user_session_path, method: :delete, class: 'menu--item', role: 'button' %> |
230 | | - <% end %> |
231 | | - <% else %> |
232 | | - <% if sso_sign_in_enabled? %> |
233 | | - <%= link_to 'SSO Sign In', new_saml_user_session_path, class: 'menu--item' %> |
234 | | - <% end %> |
235 | | - <% if devise_sign_in_enabled? %> |
236 | | - <%= link_to 'Sign In', new_user_session_path, class: 'menu--item' %> |
237 | | - <%= link_to 'Sign Up', new_user_registration_path, class: 'menu--item' %> |
238 | | - <% end %> |
239 | | - <% end %> |
240 | | - </div> |
241 | | -</div> |
242 | | -<% end %> |
243 | 239 |
|
244 | | - |
245 | | -<% unless @community.is_fake %> |
246 | | - <% if expandable? %> |
247 | | - <% current_cat = current_category %> |
248 | | - <% header_class = current_cat.color_code.present? ? current_cat.color_code : SiteSetting['SiteCategoryHeaderDefaultColor'] %> |
249 | | - <% else %> |
250 | | - <% header_class = SiteSetting['SiteCategoryHeaderDefaultColor'] %> |
251 | | - <% end %> |
252 | | - <header class="category-header is-<%= header_class %>"> |
253 | | - <div class="category-header--tabs"> |
254 | | - <div class="container category-header--tabs-container"> |
255 | | - <% @header_categories.each do |cat| %> |
256 | | - <% next unless (current_user&.trust_level || 0) >= (cat.min_view_trust_level || -1) %> |
257 | | - <%= link_to category_path(cat), class: "category-header--tab #{active?(cat) ? 'is-active' : ''}" do %> |
258 | | - <%= cat.name %> |
259 | | - <% if user_signed_in? && cat.new_posts_for?(current_user) %> |
260 | | - <span class="badge is-status" title="unread activity in category"></span> |
261 | | - <% end %> |
| 240 | + <% unless @community.is_fake %> |
| 241 | + <% if expandable? %> |
| 242 | + <% current_cat = current_category %> |
| 243 | + <% header_class = current_cat.color_code.present? ? current_cat.color_code : SiteSetting['SiteCategoryHeaderDefaultColor'] %> |
| 244 | + <% else %> |
| 245 | + <% header_class = SiteSetting['SiteCategoryHeaderDefaultColor'] %> |
262 | 246 | <% end %> |
263 | | - <% end %> |
264 | | - </div> |
265 | | - </div> |
266 | | - <% if expandable? %> |
267 | | - <div class="container category-header--container"> |
268 | | - <% if (current_cat&.min_view_trust_level || -1) > 0 %> |
269 | | - <i class="fas fa-lock-open h-m-r-2" title="The access to this category is restricted, but you are exempt."></i> |
270 | | - <% end %> |
271 | | - <div class="category-header--name"> |
272 | | - <%= current_cat.name %> |
273 | | - </div> |
274 | | - <div class="category-header--nav"> |
275 | | - <%= link_to 'Posts', category_path(current_cat), |
| 247 | + <header class="category-header is-<%= header_class %>"> |
| 248 | + <div class="category-header--tabs"> |
| 249 | + <div class="container category-header--tabs-container"> |
| 250 | + <% @header_categories.each do |cat| %> |
| 251 | + <% next unless (current_user&.trust_level || 0) >= (cat.min_view_trust_level || -1) %> |
| 252 | + <%= link_to category_path(cat), class: "category-header--tab #{active?(cat) ? 'is-active' : ''}" do %> |
| 253 | + <%= cat.name %> |
| 254 | + <% if user_signed_in? && cat.new_posts_for?(current_user) %> |
| 255 | + <span class="badge is-status" title="unread activity in category"></span> |
| 256 | + <% end %> |
| 257 | + <% end %> |
| 258 | + <% end %> |
| 259 | + </div> |
| 260 | + </div> |
| 261 | + <% if expandable? %> |
| 262 | + <div class="container category-header--container"> |
| 263 | + <% if (current_cat&.min_view_trust_level || -1) > 0 %> |
| 264 | + <i class="fas fa-lock-open h-m-r-2" title="The access to this category is restricted, but you are exempt."></i> |
| 265 | + <% end %> |
| 266 | + <div class="category-header--name"> |
| 267 | + <%= current_cat.name %> |
| 268 | + </div> |
| 269 | + <div class="category-header--nav"> |
| 270 | + <%= link_to 'Posts', category_path(current_cat), |
276 | 271 | class: "category-header--nav-item #{active?(current_cat) && !['tags', 'suggested_edit'].include?(controller_name) ? 'is-active' : ''}" %> |
277 | | - <%= link_to 'Tags', category_tags_path(current_cat), |
| 272 | + <%= link_to 'Tags', category_tags_path(current_cat), |
278 | 273 | class: "category-header--nav-item #{active?(current_cat) && controller_name == 'tags' ? 'is-active' : ''}" %> |
279 | | - <%= link_to suggested_edits_queue_path(current_cat), |
| 274 | + <%= link_to suggested_edits_queue_path(current_cat), |
280 | 275 | class: "category-header--nav-item #{active?(current_cat) && controller_name == 'suggested_edit' ? 'is-active' : ''}" do %> |
281 | | - Edits |
282 | | - <% if pending_suggestions? && check_your_privilege('edit_posts') %> |
283 | | - <span class="badge is-status" title="Suggested edits pending"></span> |
284 | | - <% end %> |
285 | | - <% end %> |
286 | | - <div class="category-header--nav-separator"></div> |
287 | | - <% button_text = current_cat.button_text.present? ? current_cat.button_text : 'Create Post' %> |
288 | | - <% if current_cat&.top_level_post_types.any? || admin? %> |
289 | | - <%= link_to category_post_types_path(current_cat.id), |
| 276 | + Edits |
| 277 | + <% if pending_suggestions? && check_your_privilege('edit_posts') %> |
| 278 | + <span class="badge is-status" title="Suggested edits pending"></span> |
| 279 | + <% end %> |
| 280 | + <% end %> |
| 281 | + <div class="category-header--nav-separator"></div> |
| 282 | + <% button_text = current_cat.button_text.present? ? current_cat.button_text : 'Create Post' %> |
| 283 | + <% if current_cat&.top_level_post_types.any? || admin? %> |
| 284 | + <%= link_to category_post_types_path(current_cat.id), |
290 | 285 | class: "category-header--nav-item is-button" do %> |
291 | | - <%= button_text %> |
292 | | - <% end %> |
293 | | - <% else %> |
294 | | - <%= button_tag button_text, class: "button is-muted is-outlined", |
| 286 | + <%= button_text %> |
| 287 | + <% end %> |
| 288 | + <% else %> |
| 289 | + <%= button_tag button_text, class: "button is-muted is-outlined", |
295 | 290 | disabled: true, |
296 | 291 | title: "The category doesn't have any allowed post types" %> |
297 | | - <% end %> |
298 | | - </div> |
299 | | - </div> |
300 | | - <% end %> |
301 | | - </header> |
302 | | -<% end %> |
| 292 | + <% end %> |
| 293 | + </div> |
| 294 | + </div> |
| 295 | + <% end %> |
| 296 | + </header> |
| 297 | + <% end %> |
303 | 298 |
|
304 | | -<% if Rails.env.development? %> |
305 | | - <div class="notice is-danger is-banner has-padding-2 notice__dev-mode has-color-red-900"> |
306 | | - <div class="container"> |
307 | | - <p>This site is in development mode!</p> |
308 | | - </div> |
309 | | - </div> |
310 | | -<% end %> |
| 299 | + <% if Rails.env.development? %> |
| 300 | + <div class="notice is-danger is-banner has-padding-2 notice__dev-mode has-color-red-900"> |
| 301 | + <div class="container"> |
| 302 | + <p>This site is in development mode!</p> |
| 303 | + </div> |
| 304 | + </div> |
| 305 | + <% end %> |
311 | 306 |
|
312 | | -<% if read_only? %> |
313 | | - <div class="notice is-warning is-filled is-banner has-padding-2 has-color-yellow-900 has-font-size-caption"> |
314 | | - <div class="container"> |
315 | | - <p>This site is in read-only mode.</p> |
316 | | - </div> |
317 | | - </div> |
318 | | -<% end %> |
| 307 | + <% if read_only? %> |
| 308 | + <div class="notice is-warning is-filled is-banner has-padding-2 has-color-yellow-900 has-font-size-caption"> |
| 309 | + <div class="container"> |
| 310 | + <p>This site is in read-only mode.</p> |
| 311 | + </div> |
| 312 | + </div> |
| 313 | + <% end %> |
319 | 314 |
|
320 | | -<% if user_signed_in? && session[:impersonator_id].present? %> |
321 | | - <div class="notice is-info is-banner is-filled has-padding-2"> |
322 | | - <div class="container"> |
323 | | - <p class="has-font-size-caption"> |
324 | | - You are impersonating <%= current_user.username %>. |
325 | | - <%= link_to 'Stop impersonating', stop_impersonating_path, class: 'is-underlined' %> |
326 | | - </p> |
327 | | - </div> |
328 | | - </div> |
329 | | -<% end %> |
| 315 | + <% if user_signed_in? && session[:impersonator_id].present? %> |
| 316 | + <div class="notice is-info is-banner is-filled has-padding-2"> |
| 317 | + <div class="container"> |
| 318 | + <p class="has-font-size-caption"> |
| 319 | + You are impersonating <%= current_user.username %>. |
| 320 | + <%= link_to 'Stop impersonating', stop_impersonating_path, class: 'is-underlined' %> |
| 321 | + </p> |
| 322 | + </div> |
| 323 | + </div> |
| 324 | + <% end %> |
330 | 325 |
|
331 | | -<% if RequestContext.redis.exists? 'banner_text' %> |
332 | | - <div class="notice is-filled <%= RequestContext.redis.get('banner_class') || 'is-warning' %> has-padding-2 is-banner"> |
333 | | - <div class="container"> |
334 | | - <%= RequestContext.redis.get 'banner_text' %> |
335 | | - </div> |
336 | | - </div> |
337 | | -<% end %> |
| 326 | + <% if RequestContext.redis.exists? 'banner_text' %> |
| 327 | + <div class="notice is-filled <%= RequestContext.redis.get('banner_class') || 'is-warning' %> has-padding-2 is-banner"> |
| 328 | + <div class="container"> |
| 329 | + <%= RequestContext.redis.get 'banner_text' %> |
| 330 | + </div> |
| 331 | + </div> |
| 332 | + <% end %> |
0 commit comments