tramway-landing 1.1.3.1 → 1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/forms/tramway/landing/block_form.rb +4 -2
- data/app/models/tramway/landing/block.rb +4 -1
- data/app/views/tramway/landing/blocks/block_types/_link.html.haml +9 -0
- data/config/locales/models.yml +3 -0
- data/lib/tramway/landing/generates/install_generator.rb +2 -0
- data/lib/tramway/landing/generates/templates/add_link_object_id_to_tramway_landing_blocks.rb +5 -0
- data/lib/tramway/landing/generates/templates/add_link_object_type_to_tramway_landing_blocks.rb +5 -0
- data/lib/tramway/landing/version.rb +1 -1
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d515000601a6fbf5765462de251923e05efcf9d2b66c55d087d39c1f40cddd9
|
4
|
+
data.tar.gz: 0b9661262483cd06592d77555fce0b48a5b25ad69ac1d8fa4b73420c77758537
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 568c7bae60fc18a99dd7211d4932398b5a73f65308f7a83e1414f5389df2c325f7f5721b6aa4aa109cd024b444dba2ed5a80e71228b26123bdd87fe6969785d4
|
7
|
+
data.tar.gz: c3aa28335296e92eff35d9b6530f3982c8138e6dd4970daae82540c26a73974ef2461ec2f9ea4dad7a590e626ef70cfdec46bc53f6489608c7f846df4043b230
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class Tramway::Landing::BlockForm < ::Tramway::Core::ApplicationForm
|
2
|
-
properties :title, :background, :view_state, :block_type, :position, :navbar_link, :anchor, :description
|
2
|
+
properties :title, :background, :view_state, :block_type, :position, :navbar_link, :anchor, :description, :link_object_type, :link_object_id
|
3
3
|
|
4
4
|
def initialize(object)
|
5
5
|
form_object = super object
|
@@ -9,7 +9,9 @@ class Tramway::Landing::BlockForm < ::Tramway::Core::ApplicationForm
|
|
9
9
|
block_type: :default,
|
10
10
|
navbar_link: :default,
|
11
11
|
anchor: :string,
|
12
|
-
description: :default
|
12
|
+
description: :default,
|
13
|
+
link_object_type: :default,
|
14
|
+
link_object_id: :numeric
|
13
15
|
form_object
|
14
16
|
end
|
15
17
|
end
|
@@ -1,6 +1,9 @@
|
|
1
1
|
class Tramway::Landing::Block < ::Tramway::Landing::ApplicationRecord
|
2
|
-
|
2
|
+
belongs_to :link_object, polymorphic: true
|
3
|
+
|
4
|
+
enumerize :block_type, in: [ :header, :footer, :page, :cards, :features, :contacts, :news, :link ]
|
3
5
|
enumerize :navbar_link, in: [ :exist, :not_exist ], default: :not_exist
|
6
|
+
enumerize :link_object_type, in: [ 'Tramway::SportSchool::Document' ]
|
4
7
|
|
5
8
|
mount_uploader :background, PhotoUploader
|
6
9
|
|
@@ -0,0 +1,9 @@
|
|
1
|
+
.row{ id: block.anchor }
|
2
|
+
.col-md-7
|
3
|
+
- decorated_link_object = "#{block.link_object_type.camelize}Decorator".constantize.new(block.link_object)
|
4
|
+
= link_to decorated_link_object.link do
|
5
|
+
= fa_icon :download
|
6
|
+
= decorated_link_object.name
|
7
|
+
.col-md-5
|
8
|
+
%p
|
9
|
+
= block.description
|
data/config/locales/models.yml
CHANGED
@@ -12,6 +12,8 @@ ru:
|
|
12
12
|
navbar_link: Ссылка в навигационной панели
|
13
13
|
anchor: Якорь (ссылка в строке URL)
|
14
14
|
description: Описание
|
15
|
+
link_object_type: Тип объекта, на который делается ссылка
|
16
|
+
link_object_id: ID объекта, на который делается ссылка
|
15
17
|
cases:
|
16
18
|
tramway/landing/block:
|
17
19
|
plural: Блоки
|
@@ -26,6 +28,7 @@ ru:
|
|
26
28
|
features: "Список возможностей (выделяет возможности): Программируется"
|
27
29
|
contacts: Блок с контактами
|
28
30
|
news: Блок новостей
|
31
|
+
link: Ссылка на объект
|
29
32
|
navbar_link:
|
30
33
|
exist: Присутствует
|
31
34
|
not_exist: Отсутствует
|
@@ -16,6 +16,8 @@ module Tramway::Landing::Generators
|
|
16
16
|
migration_template 'add_navbar_link_to_tramway_landing_blocks.rb', 'db/migrate/add_navbar_link_to_tramway_landing_blocks.rb'
|
17
17
|
migration_template 'add_anchor_to_tramway_landing_blocks.rb', 'db/migrate/add_anchor_to_tramway_landing_blocks.rb'
|
18
18
|
migration_template 'add_description_to_tramway_landing_blocks.rb', 'db/migrate/add_description_to_tramway_landing_blocks.rb'
|
19
|
+
migration_template 'add_link_object_id_to_tramway_landing_blocks.rb', 'db/migrate/add_link_object_id_to_tramway_landing_blocks.rb'
|
20
|
+
migration_template 'add_link_object_type_to_tramway_landing_blocks.rb', 'db/migrate/add_link_object_type_to_tramway_landing_blocks.rb'
|
19
21
|
end
|
20
22
|
end
|
21
23
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tramway-landing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: '1.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Kalashnikov
|
@@ -46,6 +46,7 @@ files:
|
|
46
46
|
- app/views/tramway/landing/blocks/block_types/_features.html.haml
|
47
47
|
- app/views/tramway/landing/blocks/block_types/_footer.html.haml
|
48
48
|
- app/views/tramway/landing/blocks/block_types/_header.html.haml
|
49
|
+
- app/views/tramway/landing/blocks/block_types/_link.html.haml
|
49
50
|
- app/views/tramway/landing/blocks/block_types/_page.html.haml
|
50
51
|
- config/initializers/assets.rb
|
51
52
|
- config/initializers/tramway.rb
|
@@ -58,6 +59,8 @@ files:
|
|
58
59
|
- lib/tramway/landing/generates/install_generator.rb
|
59
60
|
- lib/tramway/landing/generates/templates/add_anchor_to_tramway_landing_blocks.rb
|
60
61
|
- lib/tramway/landing/generates/templates/add_description_to_tramway_landing_blocks.rb
|
62
|
+
- lib/tramway/landing/generates/templates/add_link_object_id_to_tramway_landing_blocks.rb
|
63
|
+
- lib/tramway/landing/generates/templates/add_link_object_type_to_tramway_landing_blocks.rb
|
61
64
|
- lib/tramway/landing/generates/templates/add_navbar_link_to_tramway_landing_blocks.rb
|
62
65
|
- lib/tramway/landing/generates/templates/create_tramway_landing_blocks.rb
|
63
66
|
- lib/tramway/landing/version.rb
|