tramway-landing 1.1.3.1 → 1.2

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: d585d8617d8ba48440a0d584291a8de5955e697a99694171c3443f00d475c219
4
- data.tar.gz: a7f0f89676041bc4d83f0dd99b1e329282e0d58b11dcc9c2ef8d796daeca592b
3
+ metadata.gz: 0d515000601a6fbf5765462de251923e05efcf9d2b66c55d087d39c1f40cddd9
4
+ data.tar.gz: 0b9661262483cd06592d77555fce0b48a5b25ad69ac1d8fa4b73420c77758537
5
5
  SHA512:
6
- metadata.gz: cddd27cf802f23914b6145c91d366747115e2e6ffa93ac6375aabc7930d6c335edd4cb8413b90dc4fc29e4d8e5994c9098b5a90feee8a14523b32b43006557b3
7
- data.tar.gz: afae0737e44856838f2c79b8acd768f557a5f776605a55e941e082dc6b558b984dafc4192efe44b68e66965de0f8c52dc166dca06bd894686998a51ae1512952
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
- enumerize :block_type, in: [ :header, :footer, :page, :cards, :features, :contacts, :news ]
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
@@ -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
@@ -0,0 +1,5 @@
1
+ class AddLinkObjectIdToTramwayLandingBlocks < ActiveRecord::Migration[5.1]
2
+ def change
3
+ add_column :tramway_landing_blocks, :link_object_id, :integer
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddLinkObjectTypeToTramwayLandingBlocks < ActiveRecord::Migration[5.1]
2
+ def change
3
+ add_column :tramway_landing_blocks, :link_object_type, :text
4
+ end
5
+ end
@@ -1,5 +1,5 @@
1
1
  module Tramway
2
2
  module Landing
3
- VERSION = '1.1.3.1'
3
+ VERSION = '1.2'
4
4
  end
5
5
  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.1.3.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