tramway-landing 3.1.0.4 → 3.1.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 848e46b999c43e6b0676bee3686da04f3ddfcda22b43fe3d790ce940068e2378
4
- data.tar.gz: 30bf6c2c2b47b98fcea363232788e84f5e07b0c79f6314da0cc125f1e564b67f
3
+ metadata.gz: 41dc80ce521db8c83b528ddcd0d52d510104a9a4310e3f10c0ab63ba544f8f86
4
+ data.tar.gz: 3978872729e584e6c38d616679cb5c5cd18307a0d26e34fafcec460b3ed3e599
5
5
  SHA512:
6
- metadata.gz: 75a1806b94151a21e1054aa122880744972166d744bf96e062d0a3890f33262a9699c6a98c9a0821925e2789f36a5dbe8e2060e96a2cdac9c5ce4fea18504dde
7
- data.tar.gz: ae3a63381cf2848da74cf8eabb563f4409f813dc68e86209a07d73b8d7d4c99d7a5cfe14c771addc3a70a9ee41261b3677dd4da783dda557119eb8fcfb72cd86
6
+ metadata.gz: 1105c2f9aee1db673c8587c9a91535d5826ab48b5b37ea1f0500b05fa01548b4a1668e791da19aa0642e8de9d100293c219ba70a7b4193c8224dd194985fc837
7
+ data.tar.gz: a7ec480ba9729455ef83f97e57278132b6529340a8b7613f35c3a03e78ded8822b1f0a4892024f111d086567d9b18a07fc2b9a36ca502a93b7a1d8708ac1f0cd
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. Run server `rails s`
51
- #### 5. Open `localhost:3000/admin`
52
- #### 6. Click on `Blocks`, add new block with type `Header`
53
- #### 7. Click `Show` in the block menu
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
- #### 8. Then create your main page controller `rails g controller web/welcome`
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
- #### 9. Add new controller to the routes
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
- #### 10. Add view for the new landing
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
- [ :forms ]
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['title'].present? && object.button['link'].present?
61
- content_tag :a, href: object.button['link'], target: '_blank', class: 'btn btn-primary' do
62
- object.button['title']
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 Tramway::Landing::Navbar::LinkDecorator < Tramway::Core::ApplicationDecorator
2
4
  def title
3
5
  object[:title]
@@ -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
- title: :string,
10
- url: :string,
11
- form_name: :default,
12
- position: :integer
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.select { |f| f.form_name != 'user_sign_up' } if @signed_in
11
- forms = forms.select { |f| f.form_name != 'user_sign_in' } if @signed_in
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
- mount_uploader :background, PhotoUploader
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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Tramway::Landing::Form < ApplicationRecord
2
4
  belongs_to :block, class_name: 'Tramway::Landing::Block'
3
5
 
@@ -17,5 +17,3 @@ module Tramway::Landing::PhotoVersions
17
17
  end
18
18
  end
19
19
  end
20
-
21
- PhotoUploader.include Tramway::Landing::PhotoVersions
@@ -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'
@@ -4,9 +4,9 @@
4
4
  .row
5
5
  .col-md-6
6
6
  %h5.title
7
- = @application.title
7
+ = block_title(block)
8
8
  %p
9
- = @application.tagline
9
+ = block_tagline(block)
10
10
  .logo_collage.effect-parent
11
11
  = yield :footer_logos
12
12
  .col-md-6
@@ -1,4 +1,4 @@
1
1
  = javascript_include_tag 'tramway/landing/smooth-scroll'
2
- = render 'tramway/landing/templates/full_page', block: OpenStruct.new(title: yield(:application_name).present? ? yield(:application_name) : @application.public_name, tagline: yield(:application_tagline).present? ? yield(:application_tagline) : @application.tagline, background: block.background), buttons: @links&.select { |link| !link.is_a? Hash }
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-10.text-center
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
@@ -52,3 +52,6 @@ ru:
52
52
  navbar_link:
53
53
  exist: Присутствует
54
54
  not_exist: Отсутствует
55
+ errors:
56
+ messages:
57
+ extension_whitelist_error: неверный формата, расширение файла должно быть jpg, jpeg, gif или png.
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Tramway
4
4
  module Landing
5
- VERSION = '3.1.0.4'
5
+ VERSION = '3.1.1.2'
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.0.4
4
+ version: 3.1.1.2
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-07 00:00:00.000000000 Z
11
+ date: 2020-06-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Landing Engine for your Rails projects
14
14
  email: