Class: CompositeCell
- Inherits:
-
Cell::Rails
- Object
- Cell::Rails
- CompositeCell
- Defined in:
- app/cells/composite_cell.rb
Constant Summary collapse
- SPECIFIC_CELLS =
[ :welcome_slider, :welcome_why_choose_us, :welcome_calculator, :welcome_our_services, :welcome_our_achivements, :welcome_customers_testimonials, :company_cooperate, :company_testimonials, :company_recent_posts, :company_location, :company_values, :landing_testimonials ].freeze
Instance Method Summary collapse
- #company_cooperate(args = {}) ⇒ Object
- #company_location(args = {}) ⇒ Object
- #company_recent_posts(args = {}) ⇒ Object
- #company_testimonials(args = {}) ⇒ Object
- #company_values(args = {}) ⇒ Object
- #full(args = {}) ⇒ Object
- #landing_testimonials(args = {}) ⇒ Object
- #page(view = nil, args = {}) ⇒ Object
- #posts_block(args = {}) ⇒ Object
- #welcome_calculator(args = {}) ⇒ Object
- #welcome_customers_testimonials(args = {}) ⇒ Object
- #welcome_our_achivements(args = {}) ⇒ Object
- #welcome_our_services(args = {}) ⇒ Object
- #welcome_slider(args = {}) ⇒ Object
- #welcome_why_choose_us(args = {}) ⇒ Object
Instance Method Details
#company_cooperate(args = {}) ⇒ Object
105 106 107 108 109 |
# File 'app/cells/composite_cell.rb', line 105 def company_cooperate(args = {}) extract_args! args @companies = CooperateCompany.sorted.limit(10) render if @companies.present? end |
#company_location(args = {}) ⇒ Object
111 112 113 114 115 |
# File 'app/cells/composite_cell.rb', line 111 def company_location(args = {}) extract_args! args @locations = CompanyLocation.includes(:phones).limit(3) render if @locations.present? end |
#company_recent_posts(args = {}) ⇒ Object
131 132 133 134 135 |
# File 'app/cells/composite_cell.rb', line 131 def company_recent_posts(args = {}) extract_args! args @posts = Post.past.limit(3) render unless @posts.empty? end |
#company_testimonials(args = {}) ⇒ Object
117 118 119 120 121 122 123 |
# File 'app/cells/composite_cell.rb', line 117 def company_testimonials(args = {}) # extract_args! args # @testimonials = Testimonial.visible.local.past # @testimonials = @testimonials.by_structure(@root.id) unless @root.blank? # render unless @testimonials.blank? welcome_customers_testimonials(args) end |
#company_values(args = {}) ⇒ Object
125 126 127 128 129 |
# File 'app/cells/composite_cell.rb', line 125 def company_values(args = {}) extract_args! args @children = @structure.children if @structure render if @structure end |
#full(args = {}) ⇒ Object
56 57 58 59 60 |
# File 'app/cells/composite_cell.rb', line 56 def full(args = {}) extract_args! args @parts = @structure ? @structure.children : [] render unless @parts.empty? end |
#landing_testimonials(args = {}) ⇒ Object
101 102 103 |
# File 'app/cells/composite_cell.rb', line 101 def landing_testimonials(args = {}) welcome_customers_testimonials args end |
#page(view = nil, args = {}) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'app/cells/composite_cell.rb', line 41 def page(view = nil, args = {}) if view.is_a? Hash args = view view = nil end extract_args! args view ||= args[:view] if view && lookup_context.exists?("composite/#{view}") then render view: view.to_s elsif @structure && lookup_context.exists?("composite/#{@structure.try(:slug)}") render view: @structure.slug.to_s else render end end |
#posts_block(args = {}) ⇒ Object
137 138 139 140 141 142 |
# File 'app/cells/composite_cell.rb', line 137 def posts_block(args = {}) extract_args! args @title = args[:title] if args[:title].present? @posts = args[:posts] render unless @posts.empty? end |
#welcome_calculator(args = {}) ⇒ Object
74 75 76 77 78 79 |
# File 'app/cells/composite_cell.rb', line 74 def welcome_calculator(args = {}) extract_args! args # TODO # make this shit render end |
#welcome_customers_testimonials(args = {}) ⇒ Object
94 95 96 97 98 99 |
# File 'app/cells/composite_cell.rb', line 94 def welcome_customers_testimonials(args = {}) extract_args! args @testimonials = Testimonial.visible.local.past @testimonials = @testimonials.by_structure(@root.id) if @root.present? render if @testimonials.present? end |
#welcome_our_achivements(args = {}) ⇒ Object
88 89 90 91 92 |
# File 'app/cells/composite_cell.rb', line 88 def welcome_our_achivements(args = {}) extract_args! args @children = @structure.children if @structure render if @structure end |
#welcome_our_services(args = {}) ⇒ Object
81 82 83 84 85 86 |
# File 'app/cells/composite_cell.rb', line 81 def welcome_our_services(args = {}) extract_args! args @services_r = Structure.with_type(StructureType.services).first @services = @services_r.descendants.visible.shown_on_main.includes(:service_info).limit(4) if @services_r render end |
#welcome_slider(args = {}) ⇒ Object
62 63 64 65 66 |
# File 'app/cells/composite_cell.rb', line 62 def (args = {}) extract_args! args @children = @structure.children if @structure render end |
#welcome_why_choose_us(args = {}) ⇒ Object
68 69 70 71 72 |
# File 'app/cells/composite_cell.rb', line 68 def welcome_why_choose_us(args = {}) extract_args! args @children = @structure.children if @structure render if @structure end |