2010-11-05 15:45:05 -07:00
|
|
|
!!! 5
|
|
|
|
%html
|
|
|
|
%head
|
Move closet-hangers-update form from partial to JS
We lose no-JS support, which I kinda miss, but caching is gonna be more
important down the line. Delete form moves next, then we cache.
CSRF token changes: it looks like, by setting a data attribute in AJAX, I
was overwriting the CSRF token. I don't remember it working that way, but
now we use beforeSend to add the X-CSRF-Token header instead, which is nicer,
anyway. The issue might've been something else, but this worked :/
The CSS was also not showing the loading ellipsis properly. I think that's a
dev-only issue in how live assets are being served versus static assets, but
may as well add UTF-8 charset directives everywhere, anyway.
2013-06-22 15:27:00 -07:00
|
|
|
%meta{charset: 'utf-8'}
|
2010-11-06 08:52:58 -07:00
|
|
|
%title
|
|
|
|
- if content_for? :title
|
|
|
|
= yield :title
|
2011-05-13 05:21:42 -07:00
|
|
|
|
|
2011-05-21 19:58:48 -07:00
|
|
|
- if content_for? :title_category
|
|
|
|
= yield :title_category
|
|
|
|
- else
|
2012-12-29 22:46:36 -08:00
|
|
|
#{t 'app_name'}: #{t '.title_tagline'}
|
2013-12-26 09:44:03 -08:00
|
|
|
%link{href: image_path('favicon.png'), rel: 'icon'}
|
2011-07-15 22:09:04 -07:00
|
|
|
= yield :stylesheets
|
2013-03-05 18:08:57 -08:00
|
|
|
= stylesheet_link_tag "application"
|
2024-03-10 18:47:33 -07:00
|
|
|
= render 'analytics'
|
2011-05-20 16:29:04 -07:00
|
|
|
= yield :meta
|
2012-07-29 13:45:12 -07:00
|
|
|
= open_graph_tags
|
2010-11-10 13:59:54 -08:00
|
|
|
= csrf_meta_tag
|
2024-01-29 04:21:19 -08:00
|
|
|
= impress_2020_meta_tags
|
2010-11-11 10:43:22 -08:00
|
|
|
= signed_in_meta_tag
|
2014-01-18 19:54:11 -08:00
|
|
|
- if user_signed_in?
|
|
|
|
= current_user_id_meta_tag
|
2024-03-13 21:26:22 -07:00
|
|
|
= javascript_include_tag 'application', defer: true
|
|
|
|
= yield :javascripts
|
Add Turbo to speed up the app, and set up for missing UJS features
Oh right, we don't have Rails UJS going on anymore, which is what
handled the confirmation prompts for deleting lists. Turbo is the more
standard modern solution to that, and should speed up certain
pageloads, so let's do it!
Here I install the `turbo-rails` gem, then run `rails turbo:install` to
install the `@hotwired/turbo-rails` npm package. Then I move
`application.js` that's run all on pages but the outfit editor into our
section of JS that gets run through the bundler, and add Turbo to it.
I had to fix a couple tricky things:
1. The outfit editor page doesn't play nice with being swapped into the
document, so I make it require a full page reload instead.
2. Prefetching the Sign In link can cause the wrong `return_to` address
to be written to the `session`. (It's a GET request that does, ever
so slightly, take its own actions, oops!) As a simple hacky answer,
we disallow prefetching on that link.
Haven't fixed up the UJS stuff for confirm prompts to use Turbo yet,
that's next!
2024-03-13 13:43:48 -07:00
|
|
|
= yield :head
|
2010-11-05 15:45:05 -07:00
|
|
|
%body{:class => body_class}
|
|
|
|
#container
|
2011-07-09 08:45:30 -07:00
|
|
|
= yield :before_title
|
2024-03-10 18:47:33 -07:00
|
|
|
= render 'announcement'
|
2011-05-13 05:20:29 -07:00
|
|
|
- if content_for?(:title) && show_title_header?
|
2010-11-06 08:52:58 -07:00
|
|
|
%h1#title= yield :title
|
2010-11-05 15:45:05 -07:00
|
|
|
= yield :before_flashes
|
|
|
|
= flashes
|
|
|
|
|
|
|
|
- if content_for? :content
|
|
|
|
= yield(:content)
|
|
|
|
- else
|
|
|
|
= yield
|
2011-03-23 15:23:01 -07:00
|
|
|
|
2010-11-30 13:52:38 -08:00
|
|
|
- if home_link?
|
2010-11-05 15:45:05 -07:00
|
|
|
%a#home-link{:href => root_path}
|
2012-12-29 22:46:36 -08:00
|
|
|
%span= t 'app_name'
|
2010-11-05 15:45:05 -07:00
|
|
|
|
|
|
|
#userbar
|
|
|
|
- if user_signed_in?
|
2010-11-06 15:12:42 -07:00
|
|
|
%span
|
2012-12-29 22:46:36 -08:00
|
|
|
= t '.userbar.greeting', :user_name => current_user.name
|
|
|
|
= userbar_contributions_summary(current_user)
|
|
|
|
= link_to t('.userbar.items'), user_closet_hangers_path(current_user), :id => 'userbar-items-link'
|
|
|
|
= link_to t('.userbar.outfits'), current_user_outfits_path
|
2024-04-08 04:02:54 -07:00
|
|
|
= link_to t('.userbar.settings'), edit_auth_user_path
|
2023-08-06 18:24:23 -07:00
|
|
|
= button_to t('.userbar.logout'), destroy_auth_user_session_path, method: :delete,
|
|
|
|
params: {return_to: request.fullpath}
|
2010-11-05 15:45:05 -07:00
|
|
|
- else
|
Add Turbo to speed up the app, and set up for missing UJS features
Oh right, we don't have Rails UJS going on anymore, which is what
handled the confirmation prompts for deleting lists. Turbo is the more
standard modern solution to that, and should speed up certain
pageloads, so let's do it!
Here I install the `turbo-rails` gem, then run `rails turbo:install` to
install the `@hotwired/turbo-rails` npm package. Then I move
`application.js` that's run all on pages but the outfit editor into our
section of JS that gets run through the bundler, and add Turbo to it.
I had to fix a couple tricky things:
1. The outfit editor page doesn't play nice with being swapped into the
document, so I make it require a full page reload instead.
2. Prefetching the Sign In link can cause the wrong `return_to` address
to be written to the `session`. (It's a GET request that does, ever
so slightly, take its own actions, oops!) As a simple hacky answer,
we disallow prefetching on that link.
Haven't fixed up the UJS stuff for confirm prompts to use Turbo yet,
that's next!
2024-03-13 13:43:48 -07:00
|
|
|
= link_to auth_user_sign_in_path_with_return_to,
|
|
|
|
id: 'userbar-log-in', "data-turbo-prefetch": false do
|
2012-12-29 22:46:36 -08:00
|
|
|
%span= t('.userbar.login')
|
2010-11-05 15:45:05 -07:00
|
|
|
|
|
|
|
#footer
|
2013-01-11 09:46:14 -08:00
|
|
|
= form_tag choose_locale_path, :id => 'locale-form' do
|
|
|
|
= hidden_field_tag 'return_to', request.fullpath
|
|
|
|
= select_tag 'locale', options_for_select(locale_options, locale)
|
2014-04-02 20:15:15 -07:00
|
|
|
%noscript= submit_tag 'Go'
|
2013-01-11 09:46:14 -08:00
|
|
|
|
2010-11-05 15:45:05 -07:00
|
|
|
%ul
|
2024-02-29 11:24:21 -08:00
|
|
|
%li= link_to t('.footer.source_code'), 'https://code.openneo.net/OpenNeo/impress'
|
2024-02-29 11:22:12 -08:00
|
|
|
%li.terms{"data-updated-recently": terms_updated_recently }
|
|
|
|
= link_to t('.footer.terms', date: terms_updated_timestamp),
|
|
|
|
terms_path
|
2013-01-11 09:46:14 -08:00
|
|
|
|
2010-11-05 15:45:05 -07:00
|
|
|
%div
|
2012-12-29 22:46:36 -08:00
|
|
|
#{t('.footer.contact')}:
|
2010-11-05 15:45:05 -07:00
|
|
|
%ul
|
2012-12-29 22:46:36 -08:00
|
|
|
%li= mail_to contact_email, t('.footer.email')
|
2013-01-11 09:46:14 -08:00
|
|
|
|
2012-12-29 22:46:36 -08:00
|
|
|
%p= t '.footer.copyright', :year => Date.today.year
|
2011-03-23 15:23:01 -07:00
|
|
|
|
2024-03-13 21:26:22 -07:00
|
|
|
-# For scripts that expect to get to just execute once every time the page
|
|
|
|
-# loads. For future JS, it would be advisable to write it such that it's
|
|
|
|
-# okay for Turbo to run it once at the start of the page, then listen to
|
|
|
|
-# `turbo:load` events or use inline scripts to actually _do_ things.
|
|
|
|
= yield :javascripts_body
|