tramway-landing 2.2.2.1 → 2.2.3

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: 5d274ed464699dd86651509ed97542e65a67cb859abf6490ce2bff27a89712da
4
- data.tar.gz: 40af83c558e9e5dd732a39ed0b5fc47e360a255b089312ad2fb950753dbbe29d
3
+ metadata.gz: 1d63028e269a1417dc70a9245fb5d898b3670a8ad0c62c48f1d76a9674f9ec43
4
+ data.tar.gz: f61e1ef1a39bd3cdd053f83522e1bd98232798ceb03c95a6ba1926f1fde80a82
5
5
  SHA512:
6
- metadata.gz: 2a9dcd96fb521367b355aa1f73c33d004a7ebc24b2ab8c481f58dab5945381b64cc7cc093320501a67ec7792933d3f6f15f171fe82bc33b49fdc75e25472455a
7
- data.tar.gz: 6255e55b99e512824a67f7e663d44682599b84ca1a973e410b39ef59a10e41ee783144cafdc334f4a612613568d44ab2ef8134539c16149e86203b782a1dca89
6
+ metadata.gz: d4e86f26f412353fa6ba17190b8fa973b7d3fcda3fb4b0e3b2474e38c7bf0fc37dbcb3becbf8f4fcd7ef0dbb9e59705690a8b933246c6de5c87e6fd73f82ac5e
7
+ data.tar.gz: 70d3e7c847fc74247f3553d251a30fadfc2d2e07d5b6157060796200078c725ba9bf1e0c302cf83be0f14e10e38ed135975a93e9730c5c7b837d4380df4d1cb8
@@ -2,7 +2,7 @@
2
2
 
3
3
  class Admin::Tramway::Landing::BlockForm < ::Tramway::Core::ExtendedApplicationForm
4
4
  properties :title, :background, :view_state_event, :block_type, :position, :navbar_link, :anchor, :description,
5
- :link_object_type, :link_object_id, :button_title, :button_link, :view_name, :form_url
5
+ :link_object_type, :link_object_id, :button_title, :button_link, :view_name, :form_url, :page
6
6
 
7
7
  def initialize(object = nil)
8
8
  super(object).tap do
@@ -21,7 +21,16 @@ class Admin::Tramway::Landing::BlockForm < ::Tramway::Core::ExtendedApplicationF
21
21
  button_title: :string,
22
22
  button_link: :string,
23
23
  view_name: :string,
24
- form_url: :string
24
+ form_url: :string,
25
+ page: {
26
+ type: :select,
27
+ input_options: {
28
+ hint: I18n.t('hints.tramway.landing.block.page'),
29
+ collection: Tramway::Page::Page.landings.active.reduce({}) do |hash, page|
30
+ hash.merge! page.title => page.id
31
+ end
32
+ }
33
+ }
25
34
  end
26
35
  end
27
36
 
@@ -52,4 +61,18 @@ class Admin::Tramway::Landing::BlockForm < ::Tramway::Core::ExtendedApplicationF
52
61
  model.values.merge! form_url: value
53
62
  model.save
54
63
  end
64
+
65
+ def form_url
66
+ model.values&.dig 'form_url'
67
+ end
68
+
69
+ def page=(value)
70
+ model.values ||= {}
71
+ model.values.merge! page: value
72
+ model.save
73
+ end
74
+
75
+ def page
76
+ model.values&.dig 'page'
77
+ end
55
78
  end
@@ -20,7 +20,12 @@ class Tramway::Landing::Block < ::Tramway::Landing::ApplicationRecord
20
20
  end
21
21
  end
22
22
 
23
- scope :on_main_page, -> { active.where(view_state: :published).order :position }
23
+ store_accessor :values, :page
24
+ store_accessor :values, :form_url
25
+
26
+ scope :on_main_page, -> do
27
+ active.where(view_state: :published).where("(values -> 'page') IS NOT NULL").order :position
28
+ end
24
29
  scope :with_navbar_link, -> { where navbar_link: :exist }
25
30
  scope :header, -> { on_main_page.where(block_type: :header).first }
26
31
  scope :footer, -> { on_main_page.where(block_type: :footer).first }
@@ -1,5 +1,5 @@
1
1
  %nav.navbar.navbar-expand-lg.navbar-dark.indigo.scrolling-navbar.fixed-top
2
- = link_to yield(:application_name), '#', class: 'navbar-brand'
2
+ = link_to @application.public_name || yield(:application_name), '#', class: 'navbar-brand'
3
3
  - if @links&.any?
4
4
  %button.navbar-toggler{ type: :button, data: { toggle: :collapse, target: '#navbarSupportedContent' }, aria: { controls: 'navbarSupportedContent', expanded: 'false', label: 'Toggle navigation' } }
5
5
  = fa_icon :bars
@@ -4,3 +4,4 @@ en:
4
4
  landing:
5
5
  block:
6
6
  position: "Busy positions. Block type 'Header' should be always the first. Block type 'Footer' should be always the last"
7
+ page: "Leave it empty, if you want this block on a main page"
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Tramway
4
4
  module Landing
5
- VERSION = '2.2.2.1'
5
+ VERSION = '2.2.3'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tramway-landing
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2.1
4
+ version: 2.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - moshinaan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-30 00:00:00.000000000 Z
11
+ date: 2020-04-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Landing Engine for your Rails projects
14
14
  email: