Class: SharedCell
- Inherits:
-
Cell::Rails
- Object
- Cell::Rails
- SharedCell
- Defined in:
- app/cells/shared_cell.rb
Instance Method Summary collapse
- #check_auth(args = {}) ⇒ Object
- #footer_info(_args = {}) ⇒ Object
- #footer_links(_args = {}) ⇒ Object
-
#footer_menu(_args = {}) ⇒ Object
cache :footer_links, :expires_in => 4.hours cache :features, :expires_in => 1.day.
- #footer_services(_args = {}) ⇒ Object
- #locale_menu(_args = {}) ⇒ Object
- #menu(args = {}) ⇒ Object
- #phones(args = {}) ⇒ Object
- #promo(_args = {}) ⇒ Object
- #submenu(_args = {}) ⇒ Object
Instance Method Details
#check_auth(args = {}) ⇒ Object
110 111 112 113 114 115 116 117 118 119 |
# File 'app/cells/shared_cell.rb', line 110 def check_auth(args = {}) @account = args[:account] @will_cached = args[:will_cached] @initialize_hash = if @will_cached { ng_init: 'load_account()' } else { ng_init: "preload_account(#{@account.public_params.to_json if @account})" } end render end |
#footer_info(_args = {}) ⇒ Object
64 65 66 67 |
# File 'app/cells/shared_cell.rb', line 64 def (_args = {}) @structures = Structure.with_position(PositionType.bottom).visible.sorted render unless @structures.empty? end |
#footer_links(_args = {}) ⇒ Object
74 75 76 77 |
# File 'app/cells/shared_cell.rb', line 74 def (_args = {}) @structures = Structure.with_position(PositionType.).visible.sorted render unless @structures.empty? end |
#footer_menu(_args = {}) ⇒ Object
cache :footer_links, :expires_in => 4.hours cache :features, :expires_in => 1.day
43 44 45 46 |
# File 'app/cells/shared_cell.rb', line 43 def (_args = {}) @structures = Structure.with_position(PositionType.).visible.sorted render end |
#footer_services(_args = {}) ⇒ Object
79 80 81 82 83 |
# File 'app/cells/shared_cell.rb', line 79 def (_args = {}) servises_root = Structure.with_type(StructureType.services).visible.first @structures = servises_root.children.preload(:children) render unless @structures.empty? end |
#locale_menu(_args = {}) ⇒ Object
69 70 71 72 |
# File 'app/cells/shared_cell.rb', line 69 def (_args = {}) @locales = I18n.available_locales render unless I18n.available_locales.size <= 1 end |
#menu(args = {}) ⇒ Object
53 54 55 56 57 58 59 60 61 62 |
# File 'app/cells/shared_cell.rb', line 53 def (args = {}) @structures = Structure.with_position(PositionType.).visible.sorted @max_size = args[:max_size] || 5 if @max_size.present? && @structures.size > @max_size @others_title = args[:others_title] || I18n.t(:more, scope: [:menu]) @others = @structures.offset(@max_size - 1) @structures = @structures.limit(@max_size - 1) end render unless @structures.empty? end |
#phones(args = {}) ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'app/cells/shared_cell.rb', line 85 def phones(args = {}) @phones = CountryPhone.localized_first @phone = @phones.first @phone_class = (args[:phone_class] || 'phone') if @phone if args[:type] && lookup_context.exists?("shared/phones_#{args[:type]}") render view: "phones_#{args[:type]}" else render end end end |
#promo(_args = {}) ⇒ Object
100 101 102 103 104 105 106 107 108 |
# File 'app/cells/shared_cell.rb', line 100 def promo(_args = {}) # @structure = Structure.find_by(slug: 'additional-promo-text') @default = ContentStorageType.promo_text_default.storage # return unless @structure && show_promo? @title = @default.title @first = @default.content! @second = ContentStorageType..content! render unless @first.blank? || @second.blank? end |
#submenu(_args = {}) ⇒ Object
48 49 50 51 |
# File 'app/cells/shared_cell.rb', line 48 def (_args = {}) @structures = Structure.with_position(PositionType.bottom).visible.sorted render unless @structures.empty? end |