tramway-landing 3.2.0.2 → 3.3.0.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: 3f1d39d83c76954bd7017c0fe486c14abfe80196382dd09e7ea98bf5e876ca3c
4
- data.tar.gz: 643f56984b540a39fa2ef99e7860bbd2512b5e8867af569ec9af87dd24cb2361
3
+ metadata.gz: ed853ff752e57dc01a921f370c1af89bfe8f16e4d520fc3c03bfe55f8275b7d7
4
+ data.tar.gz: 5ddeffa8711e094ccbcb55968ebcb229d5dabce160cd666e0a702dfe44fe0ca8
5
5
  SHA512:
6
- metadata.gz: 51dca16a03148c007a512241d62f9b1c287d79269ccd1c1130b657b15dcf1c11b1e539b25f7967f78daf5dabbcbae335650880c8de15409d37031281531b0d43
7
- data.tar.gz: 20a42a2c6c5e04fb034a5bc65449cbdf5b460157afb03c9657802c20e9495099c22ffb9a4423ca818af5e27eb44777dc5a3788b8b1f499a6d921dd9a37fdcb88
6
+ metadata.gz: 66d54653e8d6ee9bd37270db23ce18de5b46da8ef3f83afbd688323e7a346ea98be0c80e42f270abb5b97ffc421a1c67b0221eb9849d144706498d444f1895fb
7
+ data.tar.gz: 187678afe2ba64f8c5f38126040f5096655d370b856bd94fd1fd7a24814c056403e4a320044f2f30e0b070b4178cffa9ecdf93086e232e6741c8619614b9fada
data/README.md CHANGED
@@ -232,6 +232,52 @@ How create blocks you can find here
232
232
  * [Just text](https://github.com/ulmic/tramway-dev/blob/develop/tramway-landing/docs/just_text/main.md)
233
233
  * Link to object
234
234
 
235
+ ## Tools
236
+
237
+ ### Google Tag Manager, Google Analytics, Yandex Metrika
238
+
239
+ #### 1. Add landing tools to the initializer
240
+
241
+ *config/initializers/tramway.rb*
242
+ ```ruby
243
+ Tramway::Admin.set_available_models(
244
+ ::Tramway::Landing::Block,
245
+ ::Tramway::Landing::Tool,
246
+ project: #{project_name_which_you_use_in_the_application}
247
+ )
248
+
249
+ Tramway::Admin.navbar_structure(
250
+ ::Tramway::Landing::Block,
251
+ ::Tramway::Landing::Tool
252
+ )
253
+ ```
254
+
255
+ #### 2. Click on `Tools`, create new tool with type `[Google Tag Manager, Google Analytics, Yandex Metrika]` and add account_id for your profile in this tool.
256
+
257
+ #### 3. Add to `WelcomeController` query to get `@tools`
258
+
259
+ *app/controllers/web/welcome_controller.rb*
260
+ ```ruby
261
+ class Web::WelcomeController < ApplicationController
262
+ before_action :application
263
+
264
+ layout 'tramway/landing/application'
265
+
266
+ def index
267
+ @blocks = ::Tramway::Landing::BlockDecorator.decorate ::Tramway::Landing::Block.on_main_page
268
+ @tools = ::Tramway::Landing::Tool.active
269
+ end
270
+
271
+ private
272
+
273
+ def application
274
+ @application = ::Tramway::Core.application_object
275
+ end
276
+ end
277
+ ```
278
+
279
+ And now all we need to integrate tool to your web page will be integrated automatically. **Enjoy!**
280
+
235
281
  ## Contributing
236
282
  Contribution directions go here.
237
283
 
@@ -8,4 +8,8 @@ class Tramway::Landing::Navbar::LinkDecorator < Tramway::Core::ApplicationDecora
8
8
  def link
9
9
  object[:link]
10
10
  end
11
+
12
+ def icon
13
+ object[:icon]
14
+ end
11
15
  end
@@ -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
@@ -5,6 +5,7 @@ module Tramway
5
5
  module ApplicationHelper
6
6
  include Tramway::Admin::RussianCasesHelper
7
7
  include Tramway::Profiles::LinksHelper if defined?(::Tramway::Profiles)
8
+ include ::FontAwesome5::Rails::IconHelper
8
9
 
9
10
  def actual_forms(forms)
10
11
  forms = forms.reject { |f| f.form_name == 'user_sign_up' } if @signed_in
@@ -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,6 +1,6 @@
1
- - if Tramway::Landing.navbar_for(@application_engine || @application.name)
1
+ - if Tramway::Landing.navbar_for(@application_engine || @application&.name)
2
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'
3
+ = link_to @application&.public_name || yield(:application_name), '/', class: 'navbar-brand'
4
4
  %button.navbar-toggler{ type: :button, data: { toggle: :collapse, target: '#navbarSupportedContent' }, aria: { controls: 'navbarSupportedContent', expanded: 'false', label: 'Toggle navigation' } }
5
5
  - if @links&.any?
6
6
  = fa_icon :bars
@@ -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'
@@ -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.
@@ -3,13 +3,12 @@ ru:
3
3
  tramway/landing/block:
4
4
  published: Опубликованные
5
5
  hidden: Скрытые
6
- activerecord:
7
- state_machines:
8
- tramway/landing/block:
9
- view_state:
10
- states:
11
- published: Виден
12
- hidden: Скрытый
13
- events:
14
- publish: Показать на сайте
15
- hide: Скрыть с сайта
6
+ state_machines:
7
+ tramway/landing/block:
8
+ view_state:
9
+ states:
10
+ published: Виден
11
+ hidden: Скрытый
12
+ events:
13
+ publish: Показать на сайте
14
+ hide: Скрыть с сайта
@@ -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.2.0.2'
5
+ VERSION = '3.3.0.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.2.0.2
4
+ version: 3.3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - moshinaan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-04 00:00:00.000000000 Z
11
+ date: 2021-04-15 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:
@@ -114,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
120
  - !ruby/object:Gem::Version
115
121
  version: '0'
116
122
  requirements: []
117
- rubygems_version: 3.1.2
123
+ rubygems_version: 3.1.4
118
124
  signing_key:
119
125
  specification_version: 4
120
126
  summary: Landing Engine for your Rails projects
@@ -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