tramway-landing 2.1.0.2 → 2.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: c2f3daf91591008a05a391601f2f18fa07e86c758c8cafb84d1699ccd3877c43
4
- data.tar.gz: 149d13483c04b34a79ceb5243f17c7ba77de3acd6c552a8ccae058aa259d9c06
3
+ metadata.gz: 927598e0e4c4c014682f59b806a22588d1f45b446a3775f3dc35f18e3bb53448
4
+ data.tar.gz: 716e8d4401ef1f828d440ea9cc86efc026dd71b873289015aa12e6e505f25735
5
5
  SHA512:
6
- metadata.gz: 9f9473a730b0da9169057cbf0347b1588c2caad913816095fbc8d603915cc4ea2190b717cd2797649401b65d5d8fd98d83b3e60a349d965cde954f4cb5e22873
7
- data.tar.gz: 0e8d5aa9cb2ca9a3397a7888bc27f4766e5215fc5be2c67132a5310a616841b5b6c6947744914a030fe7ade7c002eb680a8b3eb03e1c9270e5347fb242a1471f
6
+ metadata.gz: e07c453830803a47b2708ba7df65c6b5d8bc2764a0ed144182cf7924753cecaf32300e6f0131c967db72ff2fe01998f597939ca60091e9dfff9f043ecbd95ac1
7
+ data.tar.gz: 29acc785378bfdab88365599c4af475440fbb286347cd5ae3fcf31d43ee8a51d25eac2b05bbb6c6334eaf05968d0a3fc3b70d0a12ecaa539099579dbe12f37ae
@@ -0,0 +1,40 @@
1
+ html, body, header, .view {
2
+ height: 100%;
3
+ }
4
+
5
+ @media (max-width: 740px) {
6
+ html, body, header, .view {
7
+ height: 1000px;
8
+ }
9
+ }
10
+
11
+ @media (min-width: 800px) and (max-width: 850px) {
12
+ html, body, header, .view {
13
+ height: 650px;
14
+ }
15
+ }
16
+ @media (min-width: 800px) and (max-width: 850px) {
17
+ .navbar:not(.top-nav-collapse) {
18
+ background: #1C2331!important;
19
+ }
20
+ }
21
+ /* Navbar animation */
22
+ .navbar {
23
+ background-color: rgba(0, 0, 0, 0.3);
24
+ }
25
+
26
+ .top-nav-collapse {
27
+ background-color: #1C2331;
28
+ }
29
+
30
+ /* Adding color to the Navbar on mobile */
31
+ @media only screen and (max-width: 768px) {
32
+ .navbar {
33
+ background-color: #1C2331;
34
+ }
35
+ }
36
+
37
+ /* Footer color for sake of consistency with Navbar */
38
+ .page-footer {
39
+ background-color: #1C2331;
40
+ }
@@ -27,6 +27,10 @@ class Tramway::Landing::BlockDecorator < ::Tramway::Core::ApplicationDecorator
27
27
  "##{object.anchor}"
28
28
  end
29
29
 
30
+ def form_url
31
+ object.values['form_url']
32
+ end
33
+
30
34
  def view_state_button_color(event)
31
35
  case event
32
36
  when :publish
@@ -2,7 +2,7 @@
2
2
 
3
3
  class Admin::Tramway::Landing::BlockForm < ::Tramway::Core::ExtendedApplicationForm
4
4
  properties :title, :background, :view_state_event, :block_type, :position, :navbar_link, :anchor, :description,
5
- :link_object_type, :link_object_id, :button_title, :button_link, :view_name
5
+ :link_object_type, :link_object_id, :button_title, :button_link, :view_name, :form_url
6
6
 
7
7
  def initialize(object = nil)
8
8
  super(object).tap do
@@ -20,7 +20,8 @@ class Admin::Tramway::Landing::BlockForm < ::Tramway::Core::ExtendedApplicationF
20
20
  description: :ckeditor,
21
21
  button_title: :string,
22
22
  button_link: :string,
23
- view_name: :string
23
+ view_name: :string,
24
+ form_url: :string
24
25
  end
25
26
  end
26
27
 
@@ -45,4 +46,10 @@ class Admin::Tramway::Landing::BlockForm < ::Tramway::Core::ExtendedApplicationF
45
46
  model.button[:link] = value
46
47
  model.save
47
48
  end
49
+
50
+ def form_url=(value)
51
+ model.values ||= {}
52
+ model.values.merge! form_url: value
53
+ model.save
54
+ end
48
55
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Tramway::Landing::Block < ::Tramway::Landing::ApplicationRecord
4
- enumerize :block_type, in: %i[header footer page cards features contacts link page_with_button just_text view]
4
+ enumerize :block_type, in: %i[header header_with_form footer page cards features contacts link page_with_button just_text view]
5
5
  enumerize :navbar_link, in: %i[exist not_exist], default: :not_exist
6
6
  enumerize :link_object_type, in: ['Tramway::SportSchool::Document', 'Tramway::Page::Page']
7
7
 
@@ -28,4 +28,12 @@ class Tramway::Landing::Block < ::Tramway::Landing::ApplicationRecord
28
28
  def link_object
29
29
  link_object_type.constantize.find link_object_id
30
30
  end
31
+
32
+ def header?
33
+ block_type.in? [ 'header', 'header_with_form']
34
+ end
35
+
36
+ def footer?
37
+ block_type.footer?
38
+ end
31
39
  end
@@ -0,0 +1,17 @@
1
+ %nav.navbar.navbar-expand-lg.navbar-dark.indigo.scrolling-navbar.fixed-top
2
+ = link_to 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
+ = fa_icon :bars
5
+ .collapse.navbar-collapse#navbarSupportedContent
6
+ - if @links&.any?
7
+ %ul.navbar-nav.mr-auto
8
+ - @links.each do |link|
9
+ - if link.is_a? Hash
10
+ .nav-item.dropdown
11
+ %a.nav-link.dropdown-toggle{ id: "dropdown_menu_button_#{link.keys.first}", aria: { expanded: :false, haspopup: :true }, data: { toggle: :dropdown } }
12
+ = t(".#{link.keys.first}")
13
+ .dropdown-menu.dropdown-primary{ aria: { labelledby: "dropdown_menu_button_#{link.keys.first}" } }
14
+ - link.values.first.each do |menu_item|
15
+ = link_to menu_item.title, menu_item.link, class: 'dropdown-item'
16
+ - else
17
+ = menu_item link.title, link.link
@@ -16,21 +16,24 @@
16
16
  = stylesheet_link_tag 'https://cdnjs.cloudflare.com/ajax/libs/mdbootstrap/4.4.5/css/mdb.min.css'
17
17
  = javascript_include_tag 'https://cdnjs.cloudflare.com/ajax/libs/mdbootstrap/4.4.5/js/mdb.js'
18
18
  = javascript_include_tag 'https://cdn.rawgit.com/CezarLuiz0/anchor.js/master/dist/anchor.min.js'
19
+ = render 'layouts/tramway/landing/navbar'
19
20
  - if @blocks&.any?
20
- - headers = @blocks.select { |block| block.model.block_type&.header? }
21
- - footers = @blocks.select { |block| block.model.block_type&.footer? }
21
+ - headers = @blocks.select { |block| block.model.header? }
22
+ - footers = @blocks.select { |block| block.model.footer? }
22
23
  - other_blocks = @blocks - headers - footers
23
- - if headers.first.present?
24
- = render "tramway/landing/blocks/block_types/header", block: headers.first
25
-
24
+ - header_block = headers.first
25
+ - if header_block.present?
26
+ = render "tramway/landing/blocks/block_types/#{header_block.model.block_type.underscore}", block: header_block
26
27
  %main.mt-5
27
- .container
28
- - other_blocks.each_with_index do |block, index|
29
- = render "tramway/landing/blocks/block_types/#{block.model.block_type}", block: block
30
- - if index < other_blocks.count - 1
31
- %hr
32
- .container-fluid
33
- = yield
28
+ - if other_blocks.any?
29
+ .container
30
+ - other_blocks.each_with_index do |block, index|
31
+ = render "tramway/landing/blocks/block_types/#{block.model.block_type}", block: block
32
+ - if index < other_blocks.count - 1
33
+ %hr
34
+ - if block_given?
35
+ .container-fluid
36
+ = yield
34
37
 
35
38
  - footers = @blocks.select { |block| block.model.block_type&.footer? }
36
39
  - if footers.first.present?
@@ -1,22 +1,4 @@
1
1
  = javascript_include_tag 'tramway/landing/smooth-scroll'
2
- - content_for(:navbar) do
3
- %nav.navbar.navbar-expand-lg.navbar-dark.indigo.scrolling-navbar.fixed-top
4
- = link_to yield(:application_name), '#', class: 'navbar-brand'
5
- %button.navbar-toggler{ type: :button, data: { toggle: :collapse, target: '#navbarSupportedContent' }, aria: { controls: 'navbarSupportedContent', expanded: 'false', label: 'Toggle navigation' } }
6
- = fa_icon :bars
7
- .collapse.navbar-collapse#navbarSupportedContent
8
- - if @links&.any?
9
- %ul.navbar-nav.mr-auto
10
- - @links.each do |link|
11
- - if link.is_a? Hash
12
- .nav-item.dropdown
13
- %a.nav-link.dropdown-toggle{ id: "dropdown_menu_button_#{link.keys.first}", aria: { expanded: :false, haspopup: :true }, data: { toggle: :dropdown } }
14
- = t(".#{link.keys.first}")
15
- .dropdown-menu.dropdown-primary{ aria: { labelledby: "dropdown_menu_button_#{link.keys.first}" } }
16
- - link.values.first.each do |menu_item|
17
- = link_to menu_item.title, menu_item.link, class: 'dropdown-item'
18
- - else
19
- = menu_item link.title, link.link
20
2
  = render 'tramway/landing/blocks/templates/full_page', block: OpenStruct.new(title: yield(:application_name), tagline: yield(:application_tagline), background: block.background), buttons: @links&.select { |link| !link.is_a? Hash }
21
3
  %script
22
4
  var scroll = new SmoothScroll('a[href*="#"]');
@@ -0,0 +1,33 @@
1
+ .view.full-page-intro{ style: "background-image: url('#{block.background.url}'); background-repeat: no-repeat; background-size: cover;" }
2
+ .mask.rgba-black-light.d-flex.justify-content-center.align-items-center
3
+ .container
4
+ .row.wow.fadeIn
5
+ .col-md-6.mb-4.white-text.text-center.text-md-left
6
+ %h1.display-4.font-weight-bold
7
+ = @application.public_name
8
+ %hr.hr-light
9
+ %p
10
+ %strong
11
+ = @application.tagline
12
+ %p.mb-4.d-none.d-md-block
13
+ %strong
14
+ = @application.short_description
15
+ .col-md-6.col-xl-5.mb-4
16
+ - if params[:flash] == 'success'
17
+ = render 'tramway/landing/templates/alert', alert_type: :success do
18
+ Sign up successful!
19
+ - if params[:flash] == 'error'
20
+ = render 'tramway/landing/templates/alert', alert_type: :danger do
21
+ There is some errors
22
+ .card
23
+ .card-body
24
+ = simple_form_for @header_with_form, url: block.form_url, method: :post, input_html: { class: 'form-vertical' } do |f|
25
+ %h3.dark-grey-text.text-center
26
+ %strong
27
+ = block.title
28
+ %hr
29
+ = hidden_field_tag :model, 'User'
30
+ = hidden_field_tag :redirect, request.path
31
+ - @header_with_form.properties.each do |property|
32
+ = render 'tramway/core/shared/input', property: property[0], object: :record, type: property[1], form: f, destination: :landing, record: @header_with_form, value: (params[:record].present? ? params[:record][property[0]] : '')
33
+ = f.button :submit, @header_with_form.submit_message
@@ -0,0 +1,14 @@
1
+ .alert{ role: :alert, class: "alert-#{alert_type}" }
2
+ - if defined? title
3
+ %h4.alert-heading
4
+ = title
5
+ - if defined? short_description
6
+ %p
7
+ = short_description
8
+ %hr/
9
+ %p.mb-0
10
+ = yield
11
+ = render 'tramway/landing/templates/alerts/close_button'
12
+ - else
13
+ = yield
14
+ = render 'tramway/landing/templates/alerts/close_button'
@@ -0,0 +1,2 @@
1
+ %button.close{ aria: { label: 'Close' }, data: { dismiss: :alert }, type: :button }
2
+ %span{ aria: { hidden: :true } } ×
@@ -23,6 +23,7 @@ module Tramway::Landing::Generators
23
23
  add_link_object_type_to_tramway_landing_blocks
24
24
  add_button_to_tramway_landing_blocks
25
25
  add_view_name_to_tramway_landing_blocks
26
+ add_values_to_tramway_landing_blocks
26
27
  ]
27
28
 
28
29
  migrations.each do |migration|
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddValuesToTramwayLandingBlocks < ActiveRecord::Migration[5.1]
4
+ def change
5
+ add_column :tramway_landing_blocks, :values, :jsonb
6
+ end
7
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Tramway
4
4
  module Landing
5
- VERSION = '2.1.0.2'
5
+ VERSION = '2.2'
6
6
  end
7
7
  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: 2.1.0.2
4
+ version: '2.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Kalashnikov
@@ -26,6 +26,7 @@ files:
26
26
  - app/assets/javascripts/tramway/landing/footer.js
27
27
  - app/assets/javascripts/tramway/landing/smooth-scroll.js
28
28
  - app/assets/stylesheets/tramway/landing/application.sass
29
+ - app/assets/stylesheets/tramway/landing/block_types/header_with_form.css.scss
29
30
  - app/assets/stylesheets/tramway/landing/collage.css.sass
30
31
  - app/assets/stylesheets/tramway/landing/justified.css
31
32
  - app/controllers/tramway/landing/application_controller.rb
@@ -44,6 +45,7 @@ files:
44
45
  - app/models/tramway/landing/block.rb
45
46
  - app/uploaders/tramway/landing/photo_versions.rb
46
47
  - app/views/layouts/tramway/landing/_meta.html.haml
48
+ - app/views/layouts/tramway/landing/_navbar.html.haml
47
49
  - app/views/layouts/tramway/landing/_yandex_metrika.html.haml
48
50
  - app/views/layouts/tramway/landing/application.html.haml
49
51
  - app/views/tramway/landing/blocks/block_types/_cards.html.haml
@@ -51,6 +53,7 @@ files:
51
53
  - app/views/tramway/landing/blocks/block_types/_features.html.haml
52
54
  - app/views/tramway/landing/blocks/block_types/_footer.html.haml
53
55
  - app/views/tramway/landing/blocks/block_types/_header.html.haml
56
+ - app/views/tramway/landing/blocks/block_types/_header_with_form.html.haml
54
57
  - app/views/tramway/landing/blocks/block_types/_just_text.html.haml
55
58
  - app/views/tramway/landing/blocks/block_types/_link.html.haml
56
59
  - app/views/tramway/landing/blocks/block_types/_page.html.haml
@@ -58,10 +61,12 @@ files:
58
61
  - app/views/tramway/landing/blocks/block_types/_view.html.haml
59
62
  - app/views/tramway/landing/blocks/block_types/contacts/_with_map.html.haml
60
63
  - app/views/tramway/landing/blocks/block_types/contacts/_without_map.html.haml
61
- - app/views/tramway/landing/blocks/templates/_features_list.html.haml
62
- - app/views/tramway/landing/blocks/templates/_full_page.html.haml
63
- - app/views/tramway/landing/blocks/templates/_section_with_image_and_text.html.haml
64
- - app/views/tramway/landing/blocks/templates/_text.html.haml
64
+ - app/views/tramway/landing/templates/_alert.html.haml
65
+ - app/views/tramway/landing/templates/_features_list.html.haml
66
+ - app/views/tramway/landing/templates/_full_page.html.haml
67
+ - app/views/tramway/landing/templates/_section_with_image_and_text.html.haml
68
+ - app/views/tramway/landing/templates/_text.html.haml
69
+ - app/views/tramway/landing/templates/alerts/_close_button.html.haml
65
70
  - config/initializers/assets.rb
66
71
  - config/initializers/tramway.rb
67
72
  - config/locales/en.forms.yml
@@ -79,6 +84,7 @@ files:
79
84
  - lib/tramway/landing/generates/templates/add_link_object_id_to_tramway_landing_blocks.rb
80
85
  - lib/tramway/landing/generates/templates/add_link_object_type_to_tramway_landing_blocks.rb
81
86
  - lib/tramway/landing/generates/templates/add_navbar_link_to_tramway_landing_blocks.rb
87
+ - lib/tramway/landing/generates/templates/add_values_to_tramway_landing_blocks.rb
82
88
  - lib/tramway/landing/generates/templates/add_view_name_to_tramway_landing_blocks.rb
83
89
  - lib/tramway/landing/generates/templates/create_tramway_landing_blocks.rb
84
90
  - lib/tramway/landing/version.rb