tramway-landing 3.1.0.3 → 3.1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +58 -7
- data/app/decorators/tramway/landing/block_decorator.rb +7 -8
- data/app/decorators/tramway/landing/navbar/link_decorator.rb +2 -0
- data/app/forms/admin/tramway/landing/form_form.rb +6 -4
- data/app/helpers/tramway/landing/application_helper.rb +18 -2
- data/app/models/tramway/landing/block.rb +1 -1
- data/app/models/tramway/landing/form.rb +2 -0
- data/app/uploaders/tramway/landing/photo_versions.rb +0 -2
- data/app/views/layouts/tramway/landing/application.html.haml +1 -1
- data/app/views/tramway/landing/blocks/block_types/_footer.html.haml +2 -2
- data/app/views/tramway/landing/blocks/block_types/_header.html.haml +1 -1
- data/app/views/tramway/landing/templates/_full_page.html.haml +1 -1
- data/config/locales/ru.models.yml +9 -1
- data/lib/tramway/landing/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc9815cf619ada642aa9d5f68b7c322f74ae2541c18ff105c8b100b7a603b65b
|
4
|
+
data.tar.gz: 809f5a0d8f1bd62dbe6c7a092c4f988f32f875784a8ba85a08f08ad16b967bce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7acfeb6e279f8f11708287c50fbef4ec82a9f6e38217d88de00f47db94dccb083245c992f8bb42560c5f2c096da3d973c5878aadadbca0ec61d40e48cebb97ba
|
7
|
+
data.tar.gz: 853f6e6a4eaf19d77a9128d7185d2e502d41df33bb5558f21995e40bc0d8897434741feb8a3b6d9b6eb32f072b0711af8f39d986022251182390e4fdae70796c
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
## English
|
2
|
+
|
1
3
|
# Tramway::Landing
|
2
4
|
It uses [Material Design Bootstrap](https://mdbootstrap.com/) by default
|
3
5
|
|
@@ -47,12 +49,45 @@ Tramway::Admin.set_available_models ::Tramway::Landing::Block, project: #{projec
|
|
47
49
|
Tramway::Admin.navbar_structure ::Tramway::Landing::Block
|
48
50
|
```
|
49
51
|
|
50
|
-
#### 4.
|
51
|
-
|
52
|
-
|
53
|
-
|
52
|
+
#### 4. Add `PhotoVersions` to middleware (will be removed soon)
|
53
|
+
|
54
|
+
*lib/middleware/tramway/landing_middleware.rb*
|
55
|
+
```ruby
|
56
|
+
module Tramway
|
57
|
+
class LandingMiddleware
|
58
|
+
def initialize(app)
|
59
|
+
@app = app
|
60
|
+
end
|
61
|
+
|
62
|
+
def call(env)
|
63
|
+
PhotoUploader.include Tramway::Landing::PhotoVersions
|
64
|
+
|
65
|
+
@app.call(env)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
```
|
54
70
|
|
55
|
-
|
71
|
+
*confing/initializers/application.rb*
|
72
|
+
```ruby
|
73
|
+
...
|
74
|
+
require_relative '../lib/middleware/tramway/landing_middleware'
|
75
|
+
...
|
76
|
+
|
77
|
+
module YourApplication
|
78
|
+
class Application < Rails::Application
|
79
|
+
config.middleware.use = ::Tramway::LandingMiddleware
|
80
|
+
end
|
81
|
+
end
|
82
|
+
```
|
83
|
+
|
84
|
+
|
85
|
+
#### 5. Run server `rails s`
|
86
|
+
#### 6. Open `localhost:3000/admin`
|
87
|
+
#### 7. Click on `Blocks`, add new block with type `Header`
|
88
|
+
#### 8. Click `Show` in the block menu
|
89
|
+
|
90
|
+
#### 9. Then create your main page controller `rails g controller web/welcome`
|
56
91
|
|
57
92
|
*app/controllers/web/welcome_controller.rb*
|
58
93
|
```ruby
|
@@ -73,7 +108,7 @@ class Web::WelcomeController < ApplicationController
|
|
73
108
|
end
|
74
109
|
```
|
75
110
|
|
76
|
-
####
|
111
|
+
#### 10. Add new controller to the routes
|
77
112
|
|
78
113
|
*config/routes.rb*
|
79
114
|
```ruby
|
@@ -82,7 +117,7 @@ root to: 'web/welcome#index'
|
|
82
117
|
# ...
|
83
118
|
```
|
84
119
|
|
85
|
-
####
|
120
|
+
#### 11. Add view for the new landing
|
86
121
|
|
87
122
|
*app/views/web/welcome/index.html.haml*
|
88
123
|
```haml
|
@@ -202,3 +237,19 @@ Contribution directions go here.
|
|
202
237
|
|
203
238
|
## License
|
204
239
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
240
|
+
|
241
|
+
## Русский
|
242
|
+
|
243
|
+
Инструкцию по созданию блоков, Вы можете посмотреть здесь
|
244
|
+
|
245
|
+
* [Начальный (Header)](https://github.com/ulmic/tramway-dev/blob/develop/tramway-landing/docs/header/main.md#%D1%80%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9)
|
246
|
+
* Начальный блок с формой (Header)
|
247
|
+
* [Подвал (Footer)](https://github.com/ulmic/tramway-dev/blob/develop/tramway-landing/docs/footer/main.md#%D1%80%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9)
|
248
|
+
* [Свободный блок (картинка+текст)](https://github.com/ulmic/tramway-dev/blob/develop/tramway-landing/docs/block_with_text_and_image/main.md)
|
249
|
+
* [Свободный блок с кнопкой (картинка + текст + кнопка)](https://github.com/ulmic/tramway-dev/blob/develop/tramway-landing/docs/block_with_text_image_and_button/main.md)
|
250
|
+
* [Карточки (выводит опредеделенный набор карточек)-программируется](https://github.com/ulmic/tramway-dev/blob/develop/tramway-landing/docs/cards/main.md)
|
251
|
+
* [Список возможностей-программируется](https://github.com/ulmic/tramway-dev/blob/develop/tramway-landing/docs/features/main.md)
|
252
|
+
* [Блок с контактами](https://github.com/ulmic/tramway-dev/blob/develop/tramway-landing/docs/contacts/main.md#%D1%80%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9)
|
253
|
+
* Представление
|
254
|
+
* [Просто текст](https://github.com/ulmic/tramway-dev/blob/develop/tramway-landing/docs/just_text/main.md)
|
255
|
+
* Ссылка на объект
|
@@ -9,23 +9,22 @@ class Tramway::Landing::BlockDecorator < ::Tramway::Core::ApplicationDecorator
|
|
9
9
|
def list_attributes
|
10
10
|
%i[page_title position view_state block_type]
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
def show_associations
|
14
|
-
[
|
14
|
+
[:forms]
|
15
15
|
end
|
16
16
|
|
17
17
|
delegate :human_view_state_event_name, to: :model_class
|
18
18
|
end
|
19
19
|
|
20
20
|
decorate_association :forms
|
21
|
+
decorate_association :page
|
21
22
|
|
22
23
|
delegate_attributes :position, :title, :background, :anchor, :description, :view_name
|
23
24
|
|
24
25
|
def public_path
|
25
26
|
if object.published?
|
26
|
-
if object.page.slug.present?
|
27
|
-
Tramway::Page::Engine.routes.url_helpers.page_path slug: object.page.slug
|
28
|
-
end
|
27
|
+
Tramway::Page::Engine.routes.url_helpers.page_path slug: object.page.slug if object.page.slug.present?
|
29
28
|
else
|
30
29
|
Tramway::Page::Engine.routes.url_helpers.preview_path id: object.page.id
|
31
30
|
end
|
@@ -57,9 +56,9 @@ class Tramway::Landing::BlockDecorator < ::Tramway::Core::ApplicationDecorator
|
|
57
56
|
end
|
58
57
|
|
59
58
|
def button
|
60
|
-
if object.button.present? && object.button['
|
61
|
-
content_tag :a, href: object.button['
|
62
|
-
object.button['
|
59
|
+
if object.button.present? && object.button['button_title'].present? && object.button['button_link'].present?
|
60
|
+
content_tag :a, href: object.button['button_link'], target: '_blank', class: 'btn btn-primary' do
|
61
|
+
object.button['button_title']
|
63
62
|
end
|
64
63
|
end
|
65
64
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Admin::Tramway::Landing::FormForm < Tramway::Core::ApplicationForm
|
2
4
|
association :block
|
3
5
|
|
@@ -6,10 +8,10 @@ class Admin::Tramway::Landing::FormForm < Tramway::Core::ApplicationForm
|
|
6
8
|
def initialize(object)
|
7
9
|
super(object).tap do
|
8
10
|
form_properties block: :association,
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
title: :string,
|
12
|
+
url: :string,
|
13
|
+
form_name: :default,
|
14
|
+
position: :integer
|
13
15
|
end
|
14
16
|
end
|
15
17
|
end
|
@@ -7,10 +7,26 @@ module Tramway
|
|
7
7
|
include Tramway::Profiles::LinksHelper if defined?(::Tramway::Profiles)
|
8
8
|
|
9
9
|
def actual_forms(forms)
|
10
|
-
forms = forms.
|
11
|
-
forms = forms.
|
10
|
+
forms = forms.reject { |f| f.form_name == 'user_sign_up' } if @signed_in
|
11
|
+
forms = forms.reject { |f| f.form_name == 'user_sign_in' } if @signed_in
|
12
12
|
forms
|
13
13
|
end
|
14
|
+
|
15
|
+
def block_title(block)
|
16
|
+
if block.page.page_type.main?
|
17
|
+
content_for?(:application_name) && content_for(:application_name).present? ? content_for(:application_name) : @application.public_name
|
18
|
+
else
|
19
|
+
block.page.title
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def block_tagline(block)
|
24
|
+
if block.page.page_type.main?
|
25
|
+
content_for?(:application_tagline) && content_for(:application_tagline).present? ? content_for(:application_tagline) : @application.tagline
|
26
|
+
else
|
27
|
+
raw block.page.body
|
28
|
+
end
|
29
|
+
end
|
14
30
|
end
|
15
31
|
end
|
16
32
|
end
|
@@ -8,7 +8,7 @@ class Tramway::Landing::Block < ::Tramway::Landing::ApplicationRecord
|
|
8
8
|
enumerize :navbar_link, in: %i[exist not_exist], default: :not_exist
|
9
9
|
enumerize :link_object_type, in: ['Tramway::SportSchool::Document', 'Tramway::Page::Page']
|
10
10
|
|
11
|
-
|
11
|
+
uploader :background, :photo, extensions: %i[jpg jpeg gif png]
|
12
12
|
|
13
13
|
state_machine :view_state, initial: :published do
|
14
14
|
state :published
|
@@ -14,7 +14,7 @@
|
|
14
14
|
= favicon_link_tag @application.favicon
|
15
15
|
- ::Tramway::Landing.head_content.each do |content|
|
16
16
|
- self.instance_exec &content
|
17
|
-
%body
|
17
|
+
%body{ class: @application.name }
|
18
18
|
= stylesheet_link_tag 'https://cdnjs.cloudflare.com/ajax/libs/mdbootstrap/4.4.5/css/mdb.min.css'
|
19
19
|
= javascript_include_tag 'https://cdnjs.cloudflare.com/ajax/libs/mdbootstrap/4.4.5/js/mdb.js'
|
20
20
|
= javascript_include_tag 'https://cdn.rawgit.com/CezarLuiz0/anchor.js/master/dist/anchor.min.js'
|
@@ -1,4 +1,4 @@
|
|
1
1
|
= javascript_include_tag 'tramway/landing/smooth-scroll'
|
2
|
-
= render 'tramway/landing/templates/full_page', block: OpenStruct.new(title:
|
2
|
+
= render 'tramway/landing/templates/full_page', block: OpenStruct.new(title: block_title(block), tagline: block_tagline(block), background: block.background), buttons: @links&.select { |link| !link.is_a? Hash }
|
3
3
|
%script
|
4
4
|
var scroll = new SmoothScroll('a[href*="#"]');
|
@@ -2,7 +2,7 @@
|
|
2
2
|
#intro.view.hm-black-strong{ style: "background-image: url('#{block.background.url}')" }
|
3
3
|
.container-fluid.full-bg-img.d-flex.align-items-center.justify-content-center
|
4
4
|
.row.d-flex.justify-content-center
|
5
|
-
.col-md-
|
5
|
+
.col-md-12.text-center
|
6
6
|
%h2.display-3.font-bold.white-text.mb-2
|
7
7
|
= block.title
|
8
8
|
%hr.hr-light
|
@@ -18,7 +18,11 @@ ru:
|
|
18
18
|
button_title: Наименование кнопки (только для Типа блока "Свободный блок с кнопкой")
|
19
19
|
button_link: Ссылка кнопки (только для Типа блока "Свободный блок с кнопкой")
|
20
20
|
view_name: Название вьюхи
|
21
|
-
button: Наименование кнопки
|
21
|
+
button: Наименование кнопки
|
22
|
+
page: Страница
|
23
|
+
form_url: Ссылка на форму (используется только для блока "Начальный блок с формой"
|
24
|
+
page_id: Страница
|
25
|
+
values: Значение
|
22
26
|
tramway/landing/form:
|
23
27
|
title: Название формы
|
24
28
|
form_name: Класс формы
|
@@ -33,6 +37,7 @@ ru:
|
|
33
37
|
tramway/landing/block:
|
34
38
|
block_type:
|
35
39
|
header: Начальный (Header)
|
40
|
+
header_with_form: Начальный блок с формой (Header)
|
36
41
|
footer: Подвал (Footer)
|
37
42
|
page: Свободный блок (картинка + текст)
|
38
43
|
page_with_button: Свободный блок с кнопкой (картинка + текст + кнопка)
|
@@ -47,3 +52,6 @@ ru:
|
|
47
52
|
navbar_link:
|
48
53
|
exist: Присутствует
|
49
54
|
not_exist: Отсутствует
|
55
|
+
errors:
|
56
|
+
messages:
|
57
|
+
extension_whitelist_error: неверный формата, расширение файла должно быть jpg, jpeg, gif или png.
|
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: 3.1.
|
4
|
+
version: 3.1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- moshinaan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Landing Engine for your Rails projects
|
14
14
|
email:
|