tramway-landing 3.1.1.11 → 3.3

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: 259d9429acccbee8e412ba037adf4381c0e4c172db64825b8fce1cc3d2b3656e
4
- data.tar.gz: 18dfc48764721a6e6ce2758ccc3890998694d947fdbbbd81f0cda564b329b446
3
+ metadata.gz: a7c9610e7ca9a06693e66b7d02d8085dcf88c2ec1e4d3f0e2822d80406165e17
4
+ data.tar.gz: fd346a2b77c95906b9cee5a40df1d053806cfc94c6eff6d344aec1646c9e25fd
5
5
  SHA512:
6
- metadata.gz: 1f651258e6e670687fa85e0d43d3d951a4f2f8a857394f907823e60926fbcf957e6213d3488a6b68ced67a0e3ea0a42385f4aa0a25bc235b0eb4a124a5366459
7
- data.tar.gz: 7253ae02f50de70c4e0eef25a29022432af5ebd66eef3223e3e59cd650d3a8aa30d0227ab5cd718f5e31a81364aaa0ac8adb31492e869f7ad92cbed00d8dd93a
6
+ metadata.gz: bbbdb675f71c7b04d040e9e7dc78a707247916d0076b646bdacdb12c948e19b9f5f69a303a53032c4c79b5bde2de0b586e48acf23bdcae9018afc174fd41d827
7
+ data.tar.gz: e7ee9cfed8732ebbd60ea3df48a612d3e9405ebedfcc794a09697651d9dd7750cfcd61153befc78432e23b81cc707d1fc4e598084e8a6801656f770a30f3749b
@@ -13,8 +13,6 @@ class Tramway::Landing::BlockDecorator < ::Tramway::Core::ApplicationDecorator
13
13
  def show_associations
14
14
  [:forms]
15
15
  end
16
-
17
- delegate :human_view_state_event_name, to: :model_class
18
16
  end
19
17
 
20
18
  decorate_association :forms
@@ -39,7 +37,7 @@ class Tramway::Landing::BlockDecorator < ::Tramway::Core::ApplicationDecorator
39
37
  end
40
38
 
41
39
  def view_state
42
- object.human_view_state_name
40
+ object.view_state
43
41
  end
44
42
 
45
43
  def link
@@ -0,0 +1,3 @@
1
+ class Tramway::Landing::ToolDecorator < Tramway::Core::ApplicationDecorator
2
+ delegate_attributes :title, :account_id
3
+ end
@@ -0,0 +1,10 @@
1
+ class Admin::Tramway::Landing::ToolForm < Tramway::Core::ApplicationForm
2
+ properties :title, :account_id
3
+
4
+ def initialize(object)
5
+ super(object).tap do
6
+ form_properties title: :default,
7
+ account_id: :string
8
+ end
9
+ end
10
+ end
@@ -10,16 +10,16 @@ class Tramway::Landing::Block < ::Tramway::Landing::ApplicationRecord
10
10
 
11
11
  uploader :background, :photo, extensions: %i[jpg jpeg gif png]
12
12
 
13
- state_machine :view_state, initial: :published do
14
- state :published
13
+ aasm :view_state do
14
+ state :published, initial: true
15
15
  state :hidden
16
16
 
17
17
  event :publish do
18
- transition hidden: :published
18
+ transitions from: :hidden, to: :published
19
19
  end
20
20
 
21
21
  event :hide do
22
- transition published: :hidden
22
+ transitions from: :published, to: :hidden
23
23
  end
24
24
  end
25
25
 
@@ -0,0 +1,7 @@
1
+ class Tramway::Landing::Tool < Tramway::Core::ApplicationRecord
2
+ enumerize :title, in: [ :google_tag_manager, :google_analytics, :yandex_direct ]
3
+
4
+ def with_body_fragment?
5
+ title.google_tag_manager?
6
+ end
7
+ end
@@ -0,0 +1,15 @@
1
+ = render 'layouts/tramway/landing/meta'
2
+ %title
3
+ = yield(:title).present? ? yield(:title) : @application.title
4
+ = stylesheet_link_tag 'tramway/landing/application', media: 'all'
5
+ = javascript_include_tag 'tramway/landing/application'
6
+ = javascript_include_tag 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js', integrity: 'sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl', crossorigin: 'anonymous'
7
+ = javascript_include_tag 'https://code.jquery.com/jquery-3.2.1.slim.min.js', integrity: 'sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN', crossorigin: 'anonymous'
8
+ = javascript_include_tag 'https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js', integrity: 'sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q', crossorigin: 'anonymous'
9
+ = csrf_meta_tags
10
+ - if @application&.favicon.present?
11
+ = favicon_link_tag @application.favicon
12
+ - ::Tramway::Landing.head_content.each do |content|
13
+ - self.instance_exec &content
14
+ - @tools.each do |tool|
15
+ = render "layouts/tramway/landing/tools/#{tool.title}_head", account_id: tool.account_id
@@ -1,5 +1,5 @@
1
1
  %meta{ content: 'text/html; charset=UTF-8', http: { equiv: 'Content-Type' } }
2
2
  %meta{ content: "width=device-width, initial-scale=1, maximum-scale=0.8", name: "viewport" }
3
- - main_image = @application.main_image.present? ? "/#{@application.main_image}" : yield(:main_image)
3
+ - main_image = @application&.main_image.present? ? "/#{@application.main_image}" : yield(:main_image)
4
4
  %meta{ property: 'vk:image', content: main_image }
5
5
  %meta{ property: 'og:image', content: main_image }
@@ -1,16 +1,17 @@
1
- %nav.navbar.navbar-expand-lg.navbar-dark.indigo.scrolling-navbar.fixed-top
2
- = link_to @application.public_name || yield(:application_name), '/', class: 'navbar-brand'
3
- %button.navbar-toggler{ type: :button, data: { toggle: :collapse, target: '#navbarSupportedContent' }, aria: { controls: 'navbarSupportedContent', expanded: 'false', label: 'Toggle navigation' } }
4
- - if @links&.any?
5
- = fa_icon :bars
6
- .collapse.navbar-collapse#navbarSupportedContent
7
- - left_links = @links.is_a?(Hash) ? @links[:left] : @links
8
- - if left_links&.any?
9
- %ul.navbar-nav.mr-auto
10
- - left_links.each do |link|
11
- = render 'layouts/tramway/landing/navbar/link', link: link
12
- - right_links = @links.is_a?(Hash) ? @links.dig(:right) : []
13
- - if right_links&.any?
14
- %ul.navbar-nav.ml-auto
15
- - right_links.each do |link|
16
- = render 'layouts/tramway/landing/navbar/link', link: link
1
+ - if Tramway::Landing.navbar_for(@application_engine || @application&.name)
2
+ %nav.navbar.navbar-expand-lg.navbar-dark.indigo.scrolling-navbar.fixed-top
3
+ = link_to @application&.public_name || yield(:application_name), '/', class: 'navbar-brand'
4
+ %button.navbar-toggler{ type: :button, data: { toggle: :collapse, target: '#navbarSupportedContent' }, aria: { controls: 'navbarSupportedContent', expanded: 'false', label: 'Toggle navigation' } }
5
+ - if @links&.any?
6
+ = fa_icon :bars
7
+ .collapse.navbar-collapse#navbarSupportedContent
8
+ - left_links = @links.is_a?(Hash) ? @links[:left] : @links
9
+ - if left_links&.any?
10
+ %ul.navbar-nav.mr-auto
11
+ - left_links.each do |link|
12
+ = render 'layouts/tramway/landing/navbar/link', link: link
13
+ - right_links = @links.is_a?(Hash) ? @links.dig(:right) : []
14
+ - if right_links&.any?
15
+ %ul.navbar-nav.ml-auto
16
+ - right_links.each do |link|
17
+ = render 'layouts/tramway/landing/navbar/link', link: link
@@ -1,20 +1,11 @@
1
1
  !!!
2
2
  %html
3
3
  %head
4
- = render 'layouts/tramway/landing/meta'
5
- %title
6
- = yield(:title).present? ? yield(:title) : @application.title
7
- = stylesheet_link_tag 'tramway/landing/application', media: 'all'
8
- = javascript_include_tag 'tramway/landing/application'
9
- = javascript_include_tag 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js', integrity: 'sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl', crossorigin: 'anonymous'
10
- = javascript_include_tag 'https://code.jquery.com/jquery-3.2.1.slim.min.js', integrity: 'sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN', crossorigin: 'anonymous'
11
- = javascript_include_tag 'https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js', integrity: 'sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q', crossorigin: 'anonymous'
12
- = csrf_meta_tags
13
- - if @application.favicon.present?
14
- = favicon_link_tag @application.favicon
15
- - ::Tramway::Landing.head_content.each do |content|
16
- - self.instance_exec &content
17
- %body{ class: @application.name }
4
+ = render 'layouts/tramway/landing/head'
5
+ %body{ class: @application&.name }
6
+ - @tools.each do |tool|
7
+ - if tool.with_body_fragment?
8
+ = render "layouts/tramway/landing/tools/#{tool.title}_body", account_id: tool.account_id
18
9
  = stylesheet_link_tag 'https://cdnjs.cloudflare.com/ajax/libs/mdbootstrap/4.4.5/css/mdb.min.css'
19
10
  = javascript_include_tag 'https://cdnjs.cloudflare.com/ajax/libs/mdbootstrap/4.4.5/js/mdb.js'
20
11
  = javascript_include_tag 'https://cdn.rawgit.com/CezarLuiz0/anchor.js/master/dist/anchor.min.js'
@@ -1,7 +1,7 @@
1
1
  - if link.is_a? Hash
2
2
  .nav-item.dropdown
3
3
  %a.nav-link.dropdown-toggle.scrollable{id: "dropdown_menu_button_#{link.keys.first}", aria: { expanded: :false, haspopup: :true }, data: { toggle: :dropdown } }
4
- = link.keys.first
4
+ = t("navbar.links.#{link.keys.first}")
5
5
  .dropdown-menu.dropdown-primary.scrollable{ aria: { labelledby: "dropdown_menu_button_#{link.keys.first}" } }
6
6
  - link.values.first.each do |menu_item|
7
7
  = link_to menu_item.title, menu_item.link, class: 'dropdown-item'
@@ -0,0 +1,4 @@
1
+ / Google Tag Manager (noscript)
2
+ %noscript
3
+ %iframe{height: "0", src: "https://www.googletagmanager.com/ns.html?id=#{account_id}", style: "display:none;visibility:hidden", width: "0"}
4
+ / End Google Tag Manager (noscript)
@@ -0,0 +1,8 @@
1
+ / Google Tag Manager
2
+ :javascript
3
+ (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
4
+ new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
5
+ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
6
+ 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
7
+ })(window,document,'script','dataLayer','#{account_id}');
8
+ / End Google Tag Manager
@@ -2,6 +2,7 @@ ru:
2
2
  activerecord:
3
3
  models:
4
4
  tramway/landing/block: Блок
5
+ tramway/landing/tool: Инструмент
5
6
  attributes:
6
7
  tramway/landing/block:
7
8
  name: Название
@@ -26,6 +27,9 @@ ru:
26
27
  tramway/landing/form:
27
28
  title: Название формы
28
29
  form_name: Класс формы
30
+ tramway/landing/tool:
31
+ title: Выберите сервис
32
+ account_id: ID в системе
29
33
  cases:
30
34
  tramway/landing/block:
31
35
  plural: Блоки
@@ -33,6 +37,9 @@ ru:
33
37
  tramway/landing/form:
34
38
  plural: Публичные формы
35
39
  genitive: публичную форму
40
+ tramway/landing/tool:
41
+ plural: Инструменты
42
+ genitive: инструмент
36
43
  enumerize:
37
44
  tramway/landing/block:
38
45
  block_type:
@@ -54,4 +61,4 @@ ru:
54
61
  not_exist: Отсутствует
55
62
  errors:
56
63
  messages:
57
- extension_whitelist_error: неверный формата, расширение файла должно быть jpg, jpeg, gif или png.
64
+ extension_whitelist_error: неверный формата, расширение файла должно быть jpg, jpeg, gif или png.
@@ -14,6 +14,15 @@ module Tramway
14
14
  def head_content
15
15
  (defined?(@@head_content) && @@head_content) || []
16
16
  end
17
+
18
+ def set_navbar(bool, project:)
19
+ @@navbars ||= {}
20
+ @@navbars.merge! project => bool
21
+ end
22
+
23
+ def navbar_for(project)
24
+ @@navbars.with_indifferent_access[project]
25
+ end
17
26
  end
18
27
  end
19
28
  end
@@ -26,6 +26,7 @@ module Tramway::Landing::Generators
26
26
  add_values_to_tramway_landing_blocks
27
27
  add_page_id_to_tramway_landing_blocks
28
28
  create_tramway_landing_forms
29
+ create_tramway_landing_tools
29
30
  ]
30
31
 
31
32
  migrations.each do |migration|
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CreateTramwayLandingTools < ActiveRecord::Migration[5.1]
4
+ def change
5
+ create_table :tramway_landing_tools do |t|
6
+ t.text :title
7
+ t.text :account_id
8
+ t.jsonb :options
9
+ t.text :state, default: :active
10
+
11
+ t.timestamps
12
+ end
13
+ end
14
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Tramway
4
4
  module Landing
5
- VERSION = '3.1.1.11'
5
+ VERSION = '3.3'
6
6
  end
7
7
  end
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.1.11
4
+ version: '3.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - moshinaan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-19 00:00:00.000000000 Z
11
+ date: 2021-02-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Landing Engine for your Rails projects
14
14
  email:
@@ -38,20 +38,25 @@ files:
38
38
  - app/decorators/tramway/landing/form_decorator.rb
39
39
  - app/decorators/tramway/landing/navbar/link_decorator.rb
40
40
  - app/decorators/tramway/landing/navbar_decorator.rb
41
+ - app/decorators/tramway/landing/tool_decorator.rb
41
42
  - app/forms/admin/tramway/landing/block_form.rb
42
43
  - app/forms/admin/tramway/landing/form_form.rb
44
+ - app/forms/admin/tramway/landing/tool_form.rb
43
45
  - app/helpers/tramway/landing/application_helper.rb
44
46
  - app/jobs/tramway/landing/application_job.rb
45
47
  - app/mailers/tramway/landing/application_mailer.rb
46
48
  - app/models/tramway/landing/application_record.rb
47
49
  - app/models/tramway/landing/block.rb
48
50
  - app/models/tramway/landing/form.rb
51
+ - app/models/tramway/landing/tool.rb
49
52
  - app/uploaders/tramway/landing/photo_versions.rb
53
+ - app/views/layouts/tramway/landing/_head.html.haml
50
54
  - app/views/layouts/tramway/landing/_meta.html.haml
51
55
  - app/views/layouts/tramway/landing/_navbar.html.haml
52
- - app/views/layouts/tramway/landing/_yandex_metrika.html.haml
53
56
  - app/views/layouts/tramway/landing/application.html.haml
54
57
  - app/views/layouts/tramway/landing/navbar/_link.html.haml
58
+ - app/views/layouts/tramway/landing/tools/_google_tag_manager_body.html.haml
59
+ - app/views/layouts/tramway/landing/tools/_google_tag_manager_head.html.haml
55
60
  - app/views/tramway/landing/blocks/block_types/_cards.html.haml
56
61
  - app/views/tramway/landing/blocks/block_types/_contacts.html.haml
57
62
  - app/views/tramway/landing/blocks/block_types/_features.html.haml
@@ -94,6 +99,7 @@ files:
94
99
  - lib/tramway/landing/generates/templates/add_view_name_to_tramway_landing_blocks.rb
95
100
  - lib/tramway/landing/generates/templates/create_tramway_landing_blocks.rb
96
101
  - lib/tramway/landing/generates/templates/create_tramway_landing_forms.rb
102
+ - lib/tramway/landing/generates/templates/create_tramway_landing_tools.rb
97
103
  - lib/tramway/landing/version.rb
98
104
  homepage: https://github.com/kalashnikovisme/tramway-landing
99
105
  licenses:
@@ -1,30 +0,0 @@
1
- / Yandex.Metrika counter
2
- :javascript
3
- (function (d, w, c) {
4
- (w[c] = w[c] || []).push(function() {
5
- try {
6
- w.yaCounter49054148 = new Ya.Metrika({
7
- id:49054148,
8
- clickmap:true,
9
- trackLinks:true,
10
- accurateTrackBounce:true,
11
- webvisor:true
12
- });
13
- } catch(e) { }
14
- });
15
-
16
- var n = d.getElementsByTagName("script")[0],
17
- s = d.createElement("script"),
18
- f = function () { n.parentNode.insertBefore(s, n); };
19
- s.type = "text/javascript";
20
- s.async = true;
21
- s.src = "https://mc.yandex.ru/metrika/watch.js";
22
-
23
- if (w.opera == "[object Opera]") {
24
- d.addEventListener("DOMContentLoaded", f, false);
25
- } else { f(); }
26
- })(document, window, "yandex_metrika_callbacks");
27
- %noscript
28
- %div
29
- %img{alt: "", src: "https://mc.yandex.ru/watch/49054148", style: "position:absolute; left:-9999px;"}/
30
- / /Yandex.Metrika counter