tramway-page 1.4.2 → 1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8044630c798d93f0473a02501b3795c4bf5f244db9b2aaf75a9726b1f5dccb6f
4
- data.tar.gz: f1b06cda50f4f5d41a0a8d31e66121dc5ef3c5dc903442d1b06e326a6b373028
3
+ metadata.gz: 9948e96dfbfea49716f38a9aac7279dfbbcd65add33ac110a6e79d04c74565c8
4
+ data.tar.gz: aa2bcc1dec2f02e431a5ca085c1ecdb5b8d2740c483746a7def1239a125e0f2a
5
5
  SHA512:
6
- metadata.gz: 1a99ef5e5bc40771ff8236091a26a35997f25f2f128386b34c6b9b761b71fa1bef6b217dfb8f71d12af1a7f2f9eeb1f63a3012bd236aceab51dc72a619d7b6f7
7
- data.tar.gz: 167a1b076118b6eded880fa66c5faa24f8483133a79bfba05281e9355b08fbf140e593716fbc1b4cdb400942921f2a137bc853f8ae7d50a2584ca3116f281895
6
+ metadata.gz: 32c31c105061b762ba9f871d226234b6a1ef3fd56ee29536e7ea161cec3bdbecb0ea8ce3178195ece82764ea3521ddffe9864c9df05e8ba8108fe2f53563cfa8
7
+ data.tar.gz: 28106f875e2f094a9895e1f47a208d6fcbab59ed44710e613814318d569da97e7759921ca08938029d45c716cbe51c9061c59a7ab82bbee31153c0a94ad3cde7
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ::Tramway::Page::PreviewsController < ::Tramway::Page::ApplicationController
4
+ include Tramway::AuthManagement
5
+ layout 'tramway/landing/application'
6
+
7
+ before_action :authenticate_admin!
8
+
9
+ def show
10
+ @page = ::Tramway::Page::Page.find params[:id]
11
+ @blocks = @page.blocks.active.map do |block|
12
+ if block.block_type.header_with_form? && block.form_url.present?
13
+ # FIXME in future
14
+ @header_with_form = block.form_to_render.new(Tramway::Auth.authenticable_models.first.new, page: @page.id)
15
+ end
16
+ ::Tramway::Landing::BlockDecorator.decorate block
17
+ end
18
+ end
19
+ end
@@ -7,13 +7,13 @@ class Tramway::Page::PageDecorator < ::Tramway::Core::ApplicationDecorator
7
7
  end
8
8
 
9
9
  def show_associations
10
- [ :blocks ]
10
+ [:blocks]
11
11
  end
12
12
  end
13
13
 
14
14
  delegate :title, to: :object
15
15
 
16
- decorate_association :blocks, state_machines: [ :view_state ]
16
+ decorate_association :blocks, state_machines: [:view_state]
17
17
 
18
18
  def lead
19
19
  object.body.first 200
@@ -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: "View field 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,
@@ -3,7 +3,7 @@
3
3
  class Tramway::Page::Page < ::Tramway::Core::ApplicationRecord
4
4
  has_many :blocks, class_name: 'Tramway::Landing::Block'
5
5
 
6
- enumerize :page_type, in: [ :main, :other ], default: :other
6
+ enumerize :page_type, in: %i[main other], default: :other
7
7
 
8
8
  scope :landings, -> { where page_type: :landing }
9
9
  end
@@ -1,6 +1 @@
1
- - if @page.view.present?
2
- = render "tramway/page/pages/views/#{@page.view}"
3
- - else
4
- - content_for :title do
5
- = @page.title
6
- != @page.body
1
+ = render 'tramway/page/shared/main_page_view'
@@ -0,0 +1 @@
1
+ = render 'tramway/page/shared/main_page_view'
@@ -0,0 +1,6 @@
1
+ - if @page.view.present?
2
+ = render "tramway/page/pages/views/#{@page.view}"
3
+ - else
4
+ - content_for :title do
5
+ = @page.title
6
+ != @page.body
data/config/routes.rb CHANGED
@@ -2,4 +2,5 @@
2
2
 
3
3
  Tramway::Page::Engine.routes.draw do
4
4
  get '/:slug' => 'pages#show', as: :page
5
+ resources :previews, only: :show
5
6
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Tramway
4
4
  module Page
5
- VERSION = '1.4.2'
5
+ VERSION = '1.5'
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.2
4
+ version: '1.5'
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-08 00:00:00.000000000 Z
11
+ date: 2020-04-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Description of Tramway::Page.
14
14
  email:
@@ -25,6 +25,7 @@ files:
25
25
  - app/assets/stylesheets/tramway/page/application.css
26
26
  - app/controllers/tramway/page/application_controller.rb
27
27
  - app/controllers/tramway/page/pages_controller.rb
28
+ - app/controllers/tramway/page/previews_controller.rb
28
29
  - app/decorators/tramway/page/page_decorator.rb
29
30
  - app/forms/admin/tramway/page/page_form.rb
30
31
  - app/helpers/tramway/page/application_helper.rb
@@ -33,6 +34,8 @@ files:
33
34
  - app/models/tramway/page/page.rb
34
35
  - app/views/tramway/page/pages/show.html.haml
35
36
  - app/views/tramway/page/pages/views/_article.html.haml
37
+ - app/views/tramway/page/previews/show.html.haml
38
+ - app/views/tramway/page/shared/_main_page_view.html.haml
36
39
  - config/initializers/tramway.rb
37
40
  - config/locales/models.yml
38
41
  - config/routes.rb