tramway-page 1.4 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a1965d93d821932f6bfd8722be71212d2eecad82f8b7d10a23a35f92f214065c
4
- data.tar.gz: 41a9bbe1bb5742dd464239e05a0141db8104844db9dfb912fff715846a73cca9
3
+ metadata.gz: d1cbea56bbf0d6591b925fe452014620ff8b7d86455513594c6b8f05bce3979e
4
+ data.tar.gz: 6d211b20569f271b391f895adad6989d14913eccafc56ec1abd5e9e2d922cdf6
5
5
  SHA512:
6
- metadata.gz: 077a64fe57736ce4211b1d862f51efe5aa13be68c51780775f06ee029cdeab71bf8e9452626d4586e15aa8c2671e0764dfe5ba92cd4685e9fa3354dcf3929253
7
- data.tar.gz: 84470d8efb6e415e9cc2baf9824206274405786edc36a974d9a1a73fd2f612880e8c7035739c83f65d61c196dde4c5f1e754bbd75854fbe12cb0bfab10250a8b
6
+ metadata.gz: d8b2e229afc065d945fe9ca9e47e87345b4c34e54a2ed09096db1b99004dff7bb40f33b815b52c052900362d692fe69e78d8f7d8cd557440cc62033aa45d24f6
7
+ data.tar.gz: 41d82c1b5a68039374ef17b5752fad5ce51d03d9a5949f32282ece73a1f50e716abc6eb6ff5d68a1dbc68cf70df66888f4abace63fc9e1b8d6a8868741f90c53
@@ -5,6 +5,12 @@ class ::Tramway::Page::PagesController < ::Tramway::Page::ApplicationController
5
5
 
6
6
  def show
7
7
  @page = ::Tramway::Page::Page.find_by slug: params[:slug]
8
- @blocks = ::Tramway::Landing::BlockDecorator.decorate ::Tramway::Landing::Block.active.where('values @> ?', { page: @page.id.to_s }.to_json)
8
+ @blocks = @page.blocks.active.map do |block|
9
+ if block.block_type.header_with_form? && block.form_url.present?
10
+ # FIXME in future
11
+ @header_with_form = block.form_to_render.new(Tramway::Auth.authenticable_models.first.new)
12
+ end
13
+ ::Tramway::Landing::BlockDecorator.decorate block
14
+ end
9
15
  end
10
16
  end
@@ -5,10 +5,16 @@ class Tramway::Page::PageDecorator < ::Tramway::Core::ApplicationDecorator
5
5
  def collections
6
6
  [:all]
7
7
  end
8
+
9
+ def show_associations
10
+ [ :blocks ]
11
+ end
8
12
  end
9
13
 
10
14
  delegate :title, to: :object
11
15
 
16
+ decorate_association :blocks, state_machines: [ :view_state ]
17
+
12
18
  def lead
13
19
  object.body.first 200
14
20
  end
@@ -9,7 +9,7 @@ class Admin::Tramway::Page::PageForm < ::Tramway::Core::ApplicationForm
9
9
  page_type: {
10
10
  type: :default,
11
11
  input_options: {
12
- hint: "Body and View fields will be ignored in Landing page type. You will configurate it with Blocks"
12
+ hint: "View field will be ignored in Landing page type. You will configurate it with Blocks"
13
13
  }
14
14
  },
15
15
  body: :ckeditor,
@@ -1,7 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Tramway::Page::Page < ::Tramway::Core::ApplicationRecord
4
- enumerize :page_type, in: [ :custom, :landing ], default: :custom
4
+ has_many :blocks, class_name: 'Tramway::Landing::Block'
5
+
6
+ enumerize :page_type, in: [ :main, :other ], default: :other
5
7
 
6
8
  scope :landings, -> { where page_type: :landing }
7
9
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Tramway
4
4
  module Page
5
- VERSION = '1.4'
5
+ VERSION = '1.4.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tramway-page
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.4'
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Kalashnikov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-02 00:00:00.000000000 Z
11
+ date: 2020-04-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Description of Tramway::Page.
14
14
  email: