-
-
Notifications
You must be signed in to change notification settings - Fork 71
/
application.html.haml
165 lines (158 loc) · 11.6 KB
/
application.html.haml
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
!!!
%html
%head
= header_tags
= stylesheet_link_tag 'revised', media: 'all'
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,400italic,300italic,700' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
<!-- TODO: Use yarn -->
<script src="https://kit.fontawesome.com/82eb17360c.js"></script>
= javascript_include_tag 'application_revised'
= javascript_include_tag "i18n"
= javascript_include_tag "translations", skip_pipeline: true
:javascript
window.BikeIndex.translator = (keyspace) => {
return (key, args={}) => I18n.t(`javascript.${keyspace}.${key}`, args);
}
<!--[if IE]>$('body').prepend("<div id='old-browser-warning'><h4>Your browser is out of date!</h4><p>As a result, Bike Index will not function correctly. <a href=\"http://whatbrowser.com\">Learn more here</a>.</p></div>")<![endif]-->
%body{ id: page_id, class: body_class }
%nav.primary-header-nav
.container
%a.primary-logo{ href: user_root_url, class: user_root_bike_search? ? "defaultBikeSearchLink" : "" }
= image_tag "revised/logo.svg", class: "primary-nav", alt: "Bike Index home"
= link_to news_path("bike-index--now-a-nonprofit"), class: "nonprofit-subtitle" do
= t(".the_nonprofit_bike_registry")
- if current_user.present? && passive_organization.present?
%span.current-organization-nav-item
%a#passive_organization_submenu{ href: "#", "aria-haspopup" => "true", "aria-expanded" => "false", data: { toggle: "dropdown" } }
= passive_organization.short_name
%i.fas.fa-chevron-down.caret-down
%ul.current-organization-submenu{ "aria-labelledby" => "#passive_organization_submenu" }
- if passive_organization.ambassador?
%li
= active_link t(".org_dashboard", org_name: passive_organization.short_name), organization_ambassador_dashboard_path(organization_id: passive_organization.to_param), class: "nav-link"
%li
= active_link t(".resources"), resources_organization_ambassador_dashboard_path(organization_id: passive_organization.to_param), class: "nav-link"
%li
= active_link t(".getting_started"), getting_started_organization_ambassador_dashboard_path(organization_id: passive_organization.to_param), class: "nav-link"
%li
= active_link t(".multi_serial_search"), multi_serial_search_organization_bikes_path(organization_id: passive_organization.to_param), class: "nav-link"
%li
= active_link t(".discuss"), "https://discuss.bikeindex.org", class: "nav-link"
- else
- if passive_organization.parent?
%li
= active_link "#{passive_organization.short_name} dashboard", organization_dashboard_index_path(organization_id: passive_organization.to_param), class: "nav-link"
- on_bikes_path = controller_name == "bikes" && action_name == "index" # Because we want to ignore queries and stuff
- on_impound_bikes_path = on_bikes_path && params[:search_impoundedness] == "only_impounded"
%li
= link_to t(".org_bikes", org_name: passive_organization.short_name), organization_bikes_path(organization_id: passive_organization.to_param), class: "nav-link #{(on_bikes_path && !on_impound_bikes_path) ? 'active' : ''}"
- if passive_organization.paid_for?("impound_bikes")
%li
= link_to t(".org_impounded_bikes", org_name: passive_organization.short_name), organization_bikes_path(organization_id: passive_organization.to_param, search_impoundedness: "only_impounded"), class: "nav-link #{on_impound_bikes_path ? 'active' : ''}"
%li
= active_link t(".add_a_bike"), new_organization_bike_path(passive_organization), class: "nav-link"
- if passive_organization.paid_for?("show_partial_registrations")
%li
= active_link t(".incomplete_registrations"), incompletes_organization_bikes_path(passive_organization), class: "nav-link"
- if passive_organization.paid_for?("show_recoveries") # I don't want to show a grayed link for this
%li
= active_link t(".recoveries"), recoveries_organization_bikes_path(passive_organization), class: "nav-link"
- if passive_organization.show_bulk_import?
%li
- bulk_link_name = passive_organization.ascend_imports? ? "Ascend Imports" : "Bulk Imports"
= active_link bulk_link_name, organization_bulk_imports_path(organization_id: passive_organization.to_param), match_controller: true, class: "nav-link"
- if passive_organization.lightspeed_pos?
= active_link t(".lightspeed_integration_panel"), lightspeed_interface_path, class: "nav-link"
- if passive_organization.paid_for?("bike_codes")
%li.divider-nav-item
%li
= active_link t(".registration_stickers"), organization_stickers_path(organization_id: passive_organization.to_param), match_controller: true, class: "nav-link"
- if passive_organization.paid_for?("csv_exports")
%li
= active_link t(".exports"), organization_exports_path(organization_id: passive_organization.to_param), match_controller: true, class: "nav-link"
- if passive_organization.message_kinds.any?
%li.divider-nav-item
- passive_organization.message_kinds.each_with_index do |message_kind, index|
%li
/ (params[:kind] == message_kind ? "active" : "")
- if message_kind == "geolocated_messages"
- link_title = "GeoMessaging"
- else
- link_title = message_kind.gsub("_messages", "").titleize
= active_link link_title, organization_messages_path(organization_id: passive_organization.to_param, kind: message_kind), class: "nav-link"
- if current_user.admin_of?(passive_organization) || current_user.superuser?
%li.divider-nav-item
%li
= active_link t(".users"), organization_users_path(organization_id: passive_organization.to_param), match_controller: true, class: "nav-link"
%li
= active_link t(".org_profile", org_name: passive_organization.short_name), organization_manage_index_path(organization_id: passive_organization.to_param), class: "nav-link"
%li
= active_link t(".org_locations", org_name: passive_organization.short_name), locations_organization_manage_index_path(organization_id: passive_organization.to_param), class: "nav-link"
- if current_user&.superuser?
%li.divider-nav-item
%li
= link_to t(".super_admin_view", org_name: passive_organization.short_name), admin_organization_path(passive_organization)
- else
.center-navbar-signup-link-container
= link_to t(".sign_up"), new_user_url, class: "center-navbar-signup-link signup-link upcase"
%a#menu-opened-backdrop
.hamburgler
%a#primary_nav_hamburgler
☰
%ul.primary-main-menu
%li.primary-nav-item.d-lg-none
= link_to t(".search_bikes"), default_bike_search_path, class: 'nav-link defaultBikeSearchLink', id: 'search_bikes_header_link'
%li.divider-nav-item.d-lg-none
- if current_user_or_unconfirmed_user.present?
%li.primary-nav-item
%a.nav-link.settings-link.primary-nav-link-with-submenu#setting_submenu{ href: "#", "aria-haspopup" => "true", "aria-expanded" => "false", data: { toggle: "dropdown" } }
:plain
<svg id="settings-icon" data-name="Layer 13" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.16 30"><defs><style>.cls-1{fill:none;stroke:#a4a4a4;stroke-miterlimit:10;}</style></defs><title>settings</title><circle class="cls-1" cx="10.68" cy="19.41" r="3.78"/><circle class="cls-1" cx="23.92" cy="6.17" r="1.89"/><path class="cls-1" d="M4900.95,1506.07a8.21,8.21,0,0,0-.18-1.71l2-1.15-2.52-4.37-1.95,1.15a6.91,6.91,0,0,0-2.92-1.72v-2.14h-5v2.14a7.28,7.28,0,0,0-3,1.72l-2-1.15-2.53,4.37,2,1.15a8.15,8.15,0,0,0,0,3.43l-2,1.14,2.52,4.37,2-1.15a7.26,7.26,0,0,0,3,1.72v2.29h5v-2.29a6.93,6.93,0,0,0,2.92-1.72l2,1.15,2.51-4.37-2-1.14A8.28,8.28,0,0,0,4900.95,1506.07Z" transform="translate(-4882.07 -1486.66)"/><path class="cls-1" d="M4910.4,1492.83a4.42,4.42,0,0,0-.12-1l1.25-.72-1.26-2.18-1.21.73a4.53,4.53,0,0,0-1.72-1v-1.45h-2.52v1.45a4.86,4.86,0,0,0-1.81,1l-1.28-.73-1.27,2.18,1.25,0.72a4.27,4.27,0,0,0,0,2l-1.26.72,1.26,2.19,1.3-.73a4.84,4.84,0,0,0,1.81,1v1.45h2.52v-1.45a4.51,4.51,0,0,0,1.72-1l1.23,0.73,1.25-2.19-1.26-.72A4.42,4.42,0,0,0,4910.4,1492.83Z" transform="translate(-4882.07 -1486.66)"/></svg>
%ul.primary-submenu{ 'aria-labelledby' => '#setting_submenu' }
- memberships = current_user_or_unconfirmed_user.memberships.includes(:organization)
- if memberships.any?
- memberships.each do |membership|
- organization = membership.organization
- next unless organization.present?
%li
%a.nav-link{ href: organization_root_path(organization_id: organization.to_param) }
= t(".view_org", org_name: organization.name)
%li.divider-nav-item
%li
= active_link t(".register_a_new_bike"), new_bike_path, class: 'nav-link'
%li
= active_link t(".your_bikes"), user_home_path, class: 'nav-link'
%li
= active_link t(".user_settings", user_email: current_user_or_unconfirmed_user.email), my_account_path, class: 'nav-link'
%li.divider-nav-item
%li
= link_to t(".logout"), goodbye_path, class: 'nav-link'
%li.divider-nav-item
- else
%li.primary-nav-item
= active_link t(".sign_up"), new_user_url, class: 'nav-link signup-link'
%li.primary-nav-item
= active_link t(".log_in"), new_session_url, class: 'nav-link'
%li.primary-nav-item
= active_link t(".help"), help_path, class: 'nav-link'
%li.primary-nav-item
= active_link t(".about"), about_path, class: 'nav-link'
%li.primary-nav-item
= active_link t(".donate"), support_the_index_path, class: 'nav-link'
%li.primary-nav-item
= active_link t(".blog"), news_index_path, class: 'nav-link', match_controller: true
%li.primary-nav-item.d-none.d-lg-block
= active_link t(".search_bikes"), default_bike_search_path, class: 'nav-link defaultBikeSearchLink', match_controller: true
= render 'layouts/revised_messages'
- if current_page_skeleton
= render "/shared/#{current_page_skeleton}"
- else
= yield
-# grab (and remove) the donation modal if it's there
- donation_request = session.delete(:render_donation_request)
= render "/shared/donate_modal", locals: { kind: donation_request } if donation_request.present?
= render 'shared/footer_revised'
:javascript
I18n.defaultLocale = "#{I18n.default_locale}"
I18n.locale = "#{I18n.locale}"