tramway-page 1.5.3.4 → 1.5.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/tramway/page/pages_controller.rb +0 -1
- data/app/decorators/tramway/page/page_decorator.rb +14 -0
- data/app/models/tramway/page/page.rb +4 -4
- data/app/views/tramway/page/shared/_main_page_view.html.haml +4 -0
- data/config/initializers/tramway.rb +0 -17
- data/config/locales/ru.state_machines.yml +9 -10
- data/lib/tramway/page/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f54e0871574115ad5619fb16a4b4648f38379861dd54dcddc86e33de23cc8e83
|
4
|
+
data.tar.gz: 1d75e72402c883bd118dc421ede02f224ac44f5a1c997b1f16c4a2692f852b3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 573e634a9584aff6f053d71ebe10f6f2142b727bc0adcac13036d1d88153449bb9ca9fbabf184cfe51256022a70052e72c9468d95b96488122be71f95b5585e7
|
7
|
+
data.tar.gz: 7f9f6a54822873972bda19e0a1d8e8039f086c901d5f2e86bce957f6a50f676bd7edf72e02c692be31f5b86f25f23616a2cd5204d2308be1e7daca7a0e5c64c6
|
@@ -4,7 +4,6 @@ class ::Tramway::Page::PagesController < ::Tramway::Page::ApplicationController
|
|
4
4
|
layout 'tramway/landing/application'
|
5
5
|
|
6
6
|
def show
|
7
|
-
@application = ::Tramway::Core.application_object # FIXME need to be in the Tramway::Core::ApplicationController
|
8
7
|
@page = ::Tramway::Page::Page.published.find_by slug: params[:slug]
|
9
8
|
@blocks = @page.blocks.published.active.map do |block|
|
10
9
|
if block.block_type.header_with_form? && block.form_url.present?
|
@@ -9,9 +9,23 @@ class Tramway::Page::PageDecorator < ::Tramway::Core::ApplicationDecorator
|
|
9
9
|
def show_associations
|
10
10
|
[:blocks]
|
11
11
|
end
|
12
|
+
|
12
13
|
delegate :human_view_state_event_name, to: :model_class
|
13
14
|
end
|
14
15
|
|
16
|
+
def additional_buttons
|
17
|
+
{
|
18
|
+
show: [
|
19
|
+
{
|
20
|
+
url: Tramway::Page::Engine.routes.url_helpers.preview_path(id: object.id),
|
21
|
+
method: :get,
|
22
|
+
text: 'Preview',
|
23
|
+
color: :primary
|
24
|
+
}
|
25
|
+
]
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
15
29
|
delegate_attributes :title, :page_type, :body
|
16
30
|
|
17
31
|
decorate_association :blocks, state_machines: [:view_state]
|
@@ -8,16 +8,16 @@ class Tramway::Page::Page < ::Tramway::Core::ApplicationRecord
|
|
8
8
|
scope :landings, -> { where page_type: :landing }
|
9
9
|
scope :published, -> { where view_state: :published }
|
10
10
|
|
11
|
-
|
12
|
-
state :unpublished
|
11
|
+
aasm :view_state, column: :view_state do
|
12
|
+
state :unpublished, initial: true
|
13
13
|
state :published
|
14
14
|
|
15
15
|
event :publish do
|
16
|
-
|
16
|
+
transitions from: :unpublished, to: :published
|
17
17
|
end
|
18
18
|
|
19
19
|
event :hide do
|
20
|
-
|
20
|
+
transitions from: :published, to: :unpublished
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -1,20 +1,3 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
::Tramway::Admin.set_available_models(::Tramway::Page::Page, project: :page)
|
4
|
-
::Tramway::Admin.set_additional_buttons(
|
5
|
-
{
|
6
|
-
::Tramway::Page::Page => {
|
7
|
-
show: [
|
8
|
-
lambda { |record|
|
9
|
-
{
|
10
|
-
url: Tramway::Page::Engine.routes.url_helpers.preview_path(id: record.id),
|
11
|
-
method: :get,
|
12
|
-
text: 'Preview',
|
13
|
-
color: :primary
|
14
|
-
}
|
15
|
-
}
|
16
|
-
]
|
17
|
-
}
|
18
|
-
},
|
19
|
-
project: :subberz
|
20
|
-
)
|
@@ -1,11 +1,10 @@
|
|
1
1
|
ru:
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
hide: Скрыть с сайта
|
2
|
+
state_machines:
|
3
|
+
tramway/page/page:
|
4
|
+
view_state:
|
5
|
+
states:
|
6
|
+
published: Видена
|
7
|
+
unpublished: Скрыта
|
8
|
+
events:
|
9
|
+
publish: Показать на сайте
|
10
|
+
hide: Скрыть с сайта
|
data/lib/tramway/page/version.rb
CHANGED
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.5.
|
4
|
+
version: 1.5.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Kalashnikov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Description of Tramway::Page.
|
14
14
|
email:
|
@@ -68,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0'
|
70
70
|
requirements: []
|
71
|
-
rubygems_version: 3.1.
|
71
|
+
rubygems_version: 3.1.4
|
72
72
|
signing_key:
|
73
73
|
specification_version: 4
|
74
74
|
summary: Summary of Tramway::Page.
|