PageRenderTime 27ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/app/views/layouts/default.html.haml

https://github.com/churchio/onebody
HAML | 194 lines | 193 code | 0 blank | 1 comment | 0 complexity | 4d9eefdd9d1ecf6d31adcf9653676cdd MD5 | raw file
Possible License(s): AGPL-3.0
  1. !!!
  2. %html
  3. %head
  4. %meta{ charset: 'UTF-8' }
  5. %title
  6. = setting(:name, :site)
  7. - if @title.present?
  8. == | #{@title.gsub(/<.+?>/, '').html_safe}
  9. %meta{ content: 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no', name: 'viewport' }
  10. = yield(:meta)
  11. = stylesheet_link_tag 'application'
  12. = stylesheet_link_tag 'print', media: 'print'
  13. = yield(:css)
  14. = csrf_meta_tags
  15. = render partial: 'layouts/favicons'
  16. %link{ href: "//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,300italic,400italic,600italic|Abel", rel: "stylesheet" }
  17. /[if lt IE 9]
  18. <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
  19. <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
  20. = yield(:head)
  21. :javascript
  22. // prevent js links from firing before the rest of the js is loaded
  23. window.event_queue = [];
  24. document.addEventListener('click', function(e) {
  25. if (e.target.getAttribute('href') == '#' || e.target.getAttribute('data-toggle') == 'tab') {
  26. e.preventDefault();
  27. event_queue.push(e);
  28. }
  29. }, false);
  30. %body{ class: setting(:appearance, :theme), data: { 'datepicker-format' => datepicker_format } }
  31. / header logo: style can be found in header.less
  32. %header.main-header
  33. = link_to setting(:name, :site), root_path, class: 'logo'
  34. / Header Navbar: style can be found in header.less
  35. %nav.navbar.navbar-static-top{ role: "navigation" }
  36. / Sidebar toggle button
  37. %a.sidebar-toggle{ 'data-toggle' => 'offcanvas', href: '#', role: 'button' }
  38. %span.sr-only Toggle navigation
  39. .navbar-custom-menu
  40. = render 'layouts/navbar_right'
  41. %h3.site-name
  42. = link_to setting(:name, :community), root_path
  43. .wrapper.row-offcanvas.row-offcanvas-left
  44. / Left side column. contains the logo and sidebar
  45. %aside.main-sidebar
  46. / sidebar: style can be found in sidebar.less
  47. %section.sidebar
  48. / Sidebar user panel
  49. - if @logged_in
  50. .user-panel
  51. .pull-left.image
  52. = link_to @logged_in do
  53. = avatar_tag @logged_in, class: 'img-circle'
  54. .pull-left.info
  55. %p
  56. = t('nav.hello', person: link_to(@logged_in.first_name, @logged_in)).html_safe
  57. %a{href: "#"}
  58. %i.fa.fa-circle.text-success
  59. -# TODO
  60. Online
  61. / search form
  62. %form.sidebar-form{ action: '/search', method: 'get' }
  63. .input-group
  64. = text_field_tag 'name', @search.try(:name), placeholder: t('search.form.name'), class: 'form-control'
  65. %span.input-group-btn
  66. %button#search-btn.btn.btn-flat{ name: 'seach', type: 'submit' }
  67. %i.fa.fa-search
  68. / /.search form
  69. / sidebar menu: : style can be found in sidebar.less
  70. %ul.sidebar-menu
  71. %li{ class: tab_selected?(:home) ? 'active' : '' }
  72. = link_to root_path do
  73. %i.fa.fa-home
  74. %span= t('nav.home')
  75. = new_stream_activity_badge(@logged_in)
  76. %li{ class: tab_selected?(:profile) ? 'active' : '' }
  77. = link_to @person || @logged_in do
  78. %i.fa.fa-user
  79. %span= t('nav.profile')
  80. %i.fa.pull-right{ class: tab_expanded?(:profile) ? 'fa-angle-down' : 'fa-angle-left' }
  81. - if tab_expanded?(:profile)
  82. %ul.treeview-menu.visible
  83. %li
  84. = link_to edit_person_path(@person) do
  85. = icon 'fa fa-pencil'
  86. = t('nav.profile_sub.edit')
  87. %li
  88. = link_to edit_person_account_path(@person) do
  89. = icon 'fa fa-key'
  90. = t('nav.profile_sub.password')
  91. - if setting(:features, :groups)
  92. %li
  93. = link_to edit_person_path(@person, email: true) do
  94. = icon 'fa fa-envelope'
  95. = t('nav.profile_sub.email')
  96. %li
  97. = link_to edit_person_privacy_path(@person) do
  98. = icon 'fa fa-lock'
  99. = t('nav.profile_sub.privacy')
  100. %li
  101. = link_to @family do
  102. = icon 'fa fa-group'
  103. = t('nav.profile_sub.family')
  104. - if @logged_in.admin?(:edit_profiles)
  105. %li
  106. = link_to person_relationships_path(@person) do
  107. = icon 'fa fa-link'
  108. = t('nav.profile_sub.relationships')
  109. - CustomFieldTab.all.each do |tab|
  110. %li
  111. = link_to edit_person_path(@person, anchor: "tab-fields-#{tab.id}") do
  112. = icon 'fa fa-bars'
  113. = tab.name
  114. - if setting(:features, :groups)
  115. %li{ class: tab_selected?(:groups) ? 'active' : '' }
  116. = link_to groups_path do
  117. %i.fa.fa-group
  118. %span= t('nav.groups')
  119. = new_group_badge
  120. %i.fa.pull-right{ class: tab_expanded?(:groups) ? 'fa-angle-down' : 'fa-angle-left' }
  121. - if tab_expanded?(:groups)
  122. %ul.treeview-menu.visible
  123. - if @group.persisted?
  124. %li
  125. = link_to edit_group_path(@group) do
  126. = icon 'fa fa-pencil'
  127. = t('nav.groups_sub.edit')
  128. %li
  129. = link_to new_group_path do
  130. = icon 'fa fa-plus'
  131. = t('nav.groups_sub.new')
  132. %li{ class: tab_selected?(:directory) ? 'active' : '' }
  133. = link_to search_path do
  134. %i.fa.fa-archive
  135. %span= t('nav.directory')
  136. %i.fa.pull-right{ class: tab_expanded?(:directory) ? 'fa-angle-down' : 'fa-angle-left' }
  137. - if tab_expanded?(:directory)
  138. %ul.treeview-menu.visible
  139. - if setting(:features, :business_directory)
  140. %li
  141. = link_to search_path(business: true) do
  142. = icon 'fa fa-briefcase'
  143. = t('nav.directory_sub.business')
  144. %li
  145. = link_to new_printable_directory_path do
  146. = icon 'fa fa-print'
  147. = t('nav.directory_sub.printed')
  148. %li
  149. = link_to search_path(advanced: true) do
  150. = icon 'fa fa-search'
  151. = t('nav.directory_sub.advanced')
  152. - if @logged_in.can_create?(Family)
  153. %li
  154. = link_to new_person_path do
  155. = icon 'fa fa-plus'
  156. = t('nav.directory_sub.new_person')
  157. - if setting(:features, :documents)
  158. %li{ class: tab_selected?(:documents) ? 'active' : '' }
  159. = link_to documents_path do
  160. %i.fa.fa-file
  161. %span= t('nav.documents')
  162. - if @logged_in.incomplete_tasks_count > 0
  163. %li{ class: tab_selected?(:tasks) ? 'active' : '' }
  164. = link_to tasks_path do
  165. %i.fa.fa-check-square
  166. %span= t('nav.tasks')
  167. = assigned_tasks_badge
  168. - if @logged_in.admin?
  169. %li{ class: tab_selected?(:admin) ? 'active' : '' }
  170. = link_to admin_path do
  171. %i.fa.fa-cogs
  172. %span= t('nav.admin')
  173. = yield(:sidebar)
  174. / /.sidebar
  175. / Right side column. Contains the navbar and content of the page
  176. %aside.right-side
  177. - if header = yield(:header).presence
  178. = header
  179. - else
  180. %section.content-header
  181. = breadcrumbs
  182. %h1
  183. = @title || raw('&nbsp;')
  184. - if sub_title = yield(:sub_title).presence
  185. %small= sub_title
  186. %section.content
  187. = flash_messages
  188. = yield
  189. %footer.main-footer
  190. = render partial: 'layouts/footer_links'
  191. = javascript_include_tag 'application'
  192. = javascript_pack_tag 'application'
  193. = yield(:js)
  194. = analytics_js