tramway-landing 1.8 → 1.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +84 -8
- data/Rakefile +3 -5
- data/app/controllers/tramway/landing/application_controller.rb +2 -0
- data/app/decorators/tramway/landing/block_decorator.rb +5 -3
- data/app/decorators/tramway/landing/block_types/cards_decorator.rb +2 -0
- data/app/decorators/tramway/landing/block_types/features_decorator.rb +3 -1
- data/app/decorators/tramway/landing/link_decorator.rb +2 -0
- data/app/decorators/tramway/landing/navbar_decorator.rb +2 -0
- data/app/forms/tramway/landing/block_form.rb +12 -13
- data/app/helpers/tramway/landing/application_helper.rb +2 -0
- data/app/jobs/tramway/landing/application_job.rb +2 -0
- data/app/mailers/tramway/landing/application_mailer.rb +2 -0
- data/app/models/tramway/landing/application_record.rb +2 -0
- data/app/models/tramway/landing/block.rb +16 -14
- data/app/uploaders/tramway/landing/photo_versions.rb +2 -0
- data/config/initializers/assets.rb +4 -2
- data/config/initializers/tramway.rb +2 -0
- data/config/locales/models.yml +4 -3
- data/config/routes.rb +2 -0
- data/lib/tasks/tramway/landing_tasks.rake +2 -0
- data/lib/tramway/landing/engine.rb +2 -0
- data/lib/tramway/landing/generates/install_generator.rb +12 -10
- data/lib/tramway/landing/generates/templates/add_anchor_to_tramway_landing_blocks.rb +2 -0
- data/lib/tramway/landing/generates/templates/add_button_to_tramway_landing_blocks.rb +2 -0
- data/lib/tramway/landing/generates/templates/add_description_to_tramway_landing_blocks.rb +2 -0
- data/lib/tramway/landing/generates/templates/add_link_object_id_to_tramway_landing_blocks.rb +2 -0
- data/lib/tramway/landing/generates/templates/add_link_object_type_to_tramway_landing_blocks.rb +2 -0
- data/lib/tramway/landing/generates/templates/add_navbar_link_to_tramway_landing_blocks.rb +2 -0
- data/lib/tramway/landing/generates/templates/add_view_name_to_tramway_landing_blocks.rb +2 -0
- data/lib/tramway/landing/generates/templates/create_tramway_landing_blocks.rb +2 -0
- data/lib/tramway/landing/version.rb +3 -1
- data/lib/tramway/landing.rb +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df3212d34d48f9939cf2ec801429d8fe85b00f09dac5e8216e307dc998704941
|
4
|
+
data.tar.gz: cc2367afc4f7ad7829c7fd8202a33acd297e7cfaefd558c9ae8c6ef639d0ad91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ae5bbaaa6cb943b25cf37e96b468012c9c8405040f1bedb31f4ad0b32c96b3ebf573e62136a4fbea19faf5fb9a0309b000d2845e51ad1d39b3ec1e62229e446
|
7
|
+
data.tar.gz: 2ebbb863f7ffbdd5698d9d2b12130544cb0a73d5a77a16458a09e2088c6ae5644fa6611de2462f8b030917528094151d6b61391aeb42da82e840d7999cca7c57
|
data/README.md
CHANGED
@@ -1,8 +1,25 @@
|
|
1
1
|
# Tramway::Landing
|
2
2
|
Short description and motivation.
|
3
3
|
|
4
|
-
##
|
5
|
-
|
4
|
+
## Description
|
5
|
+
|
6
|
+
Tramway-landing provides several types of blocks for main page.
|
7
|
+
|
8
|
+
List of blocks:
|
9
|
+
|
10
|
+
* Header
|
11
|
+
* Footer
|
12
|
+
* Block with text and image
|
13
|
+
* Block with text, image and button
|
14
|
+
* Cards
|
15
|
+
* Features list
|
16
|
+
* Contacts
|
17
|
+
* News
|
18
|
+
* Block with text and button
|
19
|
+
* View
|
20
|
+
* Just text
|
21
|
+
|
22
|
+
All block's previews you can see at the bottom of this Readme
|
6
23
|
|
7
24
|
## Installation
|
8
25
|
Add this line to your application's Gemfile:
|
@@ -11,16 +28,75 @@ Add this line to your application's Gemfile:
|
|
11
28
|
gem 'tramway-landing'
|
12
29
|
```
|
13
30
|
|
14
|
-
|
15
|
-
|
16
|
-
|
31
|
+
Then run:
|
32
|
+
|
33
|
+
```shell
|
34
|
+
rails g tramway:landing:install
|
35
|
+
rails db:migrate
|
36
|
+
```
|
37
|
+
|
38
|
+
*config/initializers/tramway.rb*
|
39
|
+
```ruby
|
40
|
+
Tramway::Admin.set_available_models ::Tramway::Landing::Block, project: #{project_name_which_you_use_in_the_application}
|
41
|
+
```
|
42
|
+
|
43
|
+
Run server `rails s`
|
44
|
+
Open `localhost:3000/admin`
|
45
|
+
Click on `Block`, add new block with type `Header`
|
46
|
+
Click `Show` in the block menu
|
47
|
+
|
48
|
+
Then create your main page controller `rails g controller web/welcome`
|
49
|
+
|
50
|
+
*app/controllers/web/welcome_controller.rb*
|
51
|
+
```ruby
|
52
|
+
class Web::WelcomeController < ApplicationController
|
53
|
+
def index
|
54
|
+
@blocks = ::Tramway::Landing::BlockDecorator.decorate ::Tramway::Landing::Block.on_main_page
|
55
|
+
end
|
56
|
+
end
|
17
57
|
```
|
18
58
|
|
19
|
-
|
20
|
-
```
|
21
|
-
|
59
|
+
*config/routes.rb*
|
60
|
+
```ruby
|
61
|
+
# ...
|
62
|
+
root to: 'web/welcome#index'
|
63
|
+
# ...
|
22
64
|
```
|
23
65
|
|
66
|
+
*app/views/web/welcome/index.html.haml*
|
67
|
+
```haml
|
68
|
+
= content_for :head_content do
|
69
|
+
-# your content for <head>
|
70
|
+
|
71
|
+
= content_for :title do
|
72
|
+
-# your content for <title>
|
73
|
+
|
74
|
+
= content_for :application_tagline do
|
75
|
+
-# tagline in the header type block
|
76
|
+
|
77
|
+
= content_for :address do
|
78
|
+
-# main address info
|
79
|
+
|
80
|
+
= content_for :phone do
|
81
|
+
-# main phone info
|
82
|
+
|
83
|
+
= content_for :footer_links do
|
84
|
+
-# list of footer links
|
85
|
+
|
86
|
+
= content_for :footer_logo do
|
87
|
+
-# list of footer logos
|
88
|
+
|
89
|
+
= content_for :latitude do
|
90
|
+
-# latitude for contacts block type map
|
91
|
+
|
92
|
+
= content_for :longtitude do
|
93
|
+
-# longtitude for contacts block type map
|
94
|
+
|
95
|
+
-# everything you want on the main page
|
96
|
+
```
|
97
|
+
|
98
|
+
Then all your showing blocks will be on the main page.
|
99
|
+
|
24
100
|
## Contributing
|
25
101
|
Contribution directions go here.
|
26
102
|
|
data/Rakefile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
begin
|
2
4
|
require 'bundler/setup'
|
3
5
|
rescue LoadError
|
@@ -14,14 +16,11 @@ RDoc::Task.new(:rdoc) do |rdoc|
|
|
14
16
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
17
|
end
|
16
18
|
|
17
|
-
APP_RAKEFILE = File.expand_path(
|
19
|
+
APP_RAKEFILE = File.expand_path('test/dummy/Rakefile', __dir__)
|
18
20
|
load 'rails/tasks/engine.rake'
|
19
21
|
|
20
|
-
|
21
22
|
load 'rails/tasks/statistics.rake'
|
22
23
|
|
23
|
-
|
24
|
-
|
25
24
|
require 'bundler/gem_tasks'
|
26
25
|
|
27
26
|
require 'rake/testtask'
|
@@ -32,5 +31,4 @@ Rake::TestTask.new(:test) do |t|
|
|
32
31
|
t.verbose = false
|
33
32
|
end
|
34
33
|
|
35
|
-
|
36
34
|
task default: :test
|
@@ -1,11 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Tramway::Landing::BlockDecorator < ::Tramway::Core::ApplicationDecorator
|
2
4
|
class << self
|
3
5
|
def collections
|
4
|
-
[
|
6
|
+
[:all]
|
5
7
|
end
|
6
8
|
|
7
9
|
def list_attributes
|
8
|
-
[
|
10
|
+
%i[position view_state block_type]
|
9
11
|
end
|
10
12
|
|
11
13
|
delegate :human_view_state_event_name, to: :model_class
|
@@ -18,7 +20,7 @@ class Tramway::Landing::BlockDecorator < ::Tramway::Core::ApplicationDecorator
|
|
18
20
|
delegate :description, to: :object
|
19
21
|
delegate :anchor, to: :object
|
20
22
|
delegate :view_name, to: :object
|
21
|
-
|
23
|
+
|
22
24
|
def block_type
|
23
25
|
object.block_type_text
|
24
26
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Tramway::Landing::BlockTypes::FeaturesDecorator < ::Tramway::Core::ApplicationDecorator
|
2
4
|
def icon; end
|
3
5
|
|
@@ -18,7 +20,7 @@ class Tramway::Landing::BlockTypes::FeaturesDecorator < ::Tramway::Core::Applica
|
|
18
20
|
"##{anchor}"
|
19
21
|
else
|
20
22
|
if external_link.present?
|
21
|
-
if external_link.match?(
|
23
|
+
if external_link.match?(%r{^https?://})
|
22
24
|
external_link
|
23
25
|
else
|
24
26
|
"http://#{external_link}"
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Tramway::Landing::BlockForm < ::Tramway::Core::ExtendedApplicationForm
|
2
4
|
properties :title,
|
3
5
|
:background,
|
@@ -16,28 +18,25 @@ class Tramway::Landing::BlockForm < ::Tramway::Core::ExtendedApplicationForm
|
|
16
18
|
def initialize(object = nil)
|
17
19
|
super(object).tap do
|
18
20
|
form_properties title: :string,
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
button_title: :string,
|
28
|
-
button_link: :string,
|
29
|
-
view_name: :string
|
21
|
+
background: :file,
|
22
|
+
position: :numeric,
|
23
|
+
block_type: :default,
|
24
|
+
navbar_link: :default,
|
25
|
+
anchor: :string,
|
26
|
+
description: :ckeditor,
|
27
|
+
button_title: :string,
|
28
|
+
button_link: :string
|
30
29
|
end
|
31
30
|
end
|
32
31
|
|
33
32
|
def button_title
|
34
33
|
model.button ||= {}
|
35
|
-
model.button['title'] ||
|
34
|
+
model.button['title'] || ''
|
36
35
|
end
|
37
36
|
|
38
37
|
def button_link
|
39
38
|
model.button ||= {}
|
40
|
-
model.button['link'] ||
|
39
|
+
model.button['link'] || ''
|
41
40
|
end
|
42
41
|
|
43
42
|
def button_title=(value)
|
@@ -1,19 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Tramway::Landing::Block < ::Tramway::Landing::ApplicationRecord
|
2
|
-
enumerize :block_type, in: [
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
4
|
+
enumerize :block_type, in: %i[
|
5
|
+
header
|
6
|
+
footer
|
7
|
+
page
|
8
|
+
cards
|
9
|
+
features
|
10
|
+
contacts
|
11
|
+
news
|
12
|
+
link
|
13
|
+
page_with_button
|
14
|
+
just_text
|
15
|
+
view
|
14
16
|
]
|
15
|
-
enumerize :navbar_link, in: [
|
16
|
-
enumerize :link_object_type, in: [
|
17
|
+
enumerize :navbar_link, in: %i[exist not_exist], default: :not_exist
|
18
|
+
enumerize :link_object_type, in: ['Tramway::SportSchool::Document', 'Tramway::Page::Page']
|
17
19
|
|
18
20
|
mount_uploader :background, PhotoUploader
|
19
21
|
|
@@ -1,2 +1,4 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Rails.application.config.assets.precompile += %w[tramway/landing/footer.js]
|
4
|
+
Rails.application.config.assets.precompile += %w[tramway/landing/smooth-scroll.js]
|
data/config/locales/models.yml
CHANGED
@@ -5,7 +5,7 @@ ru:
|
|
5
5
|
attributes:
|
6
6
|
tramway/landing/block:
|
7
7
|
title: Название
|
8
|
-
background: Изображение
|
8
|
+
background: Изображение
|
9
9
|
position: Позиция на странице
|
10
10
|
block_type: Тип блока
|
11
11
|
view_state: Видимость на сайте
|
@@ -14,8 +14,8 @@ ru:
|
|
14
14
|
description: Описание
|
15
15
|
link_object_type: Тип объекта, на который делается ссылка
|
16
16
|
link_object_id: ID объекта, на который делается ссылка
|
17
|
-
button_title: Наименование кнопки
|
18
|
-
button_link: Ссылка кнопки
|
17
|
+
button_title: Наименование кнопки (только для Типа блока "Свободный блок с кнопкой")
|
18
|
+
button_link: Ссылка кнопки (только для Типа блока "Свободный блок с кнопкой")
|
19
19
|
view_name: Название вьюхи
|
20
20
|
cases:
|
21
21
|
tramway/landing/block:
|
@@ -35,6 +35,7 @@ ru:
|
|
35
35
|
link: Ссылка на объект
|
36
36
|
just_text_with_button: Просто текст
|
37
37
|
view: Вьюха (программируется)
|
38
|
+
just_text: Просто текст
|
38
39
|
navbar_link:
|
39
40
|
exist: Присутствует
|
40
41
|
not_exist: Отсутствует
|
data/config/routes.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rails/generators'
|
2
4
|
require 'tramway/core/generators/install_generator'
|
3
5
|
|
4
6
|
module Tramway::Landing::Generators
|
5
7
|
class InstallGenerator < ::Tramway::Core::Generators::InstallGenerator
|
6
8
|
include Rails::Generators::Migration
|
7
|
-
source_root File.expand_path('
|
9
|
+
source_root File.expand_path('templates', __dir__)
|
8
10
|
|
9
11
|
def self.next_migration_number(path)
|
10
12
|
next_migration_number = current_migration_number(path) + 1
|
@@ -12,15 +14,15 @@ module Tramway::Landing::Generators
|
|
12
14
|
end
|
13
15
|
|
14
16
|
def copy_migrations
|
15
|
-
migrations = [
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
17
|
+
migrations = %i[
|
18
|
+
create_tramway_landing_blocks
|
19
|
+
add_navbar_link_to_tramway_landing_blocks
|
20
|
+
add_anchor_to_tramway_landing_blocks
|
21
|
+
add_description_to_tramway_landing_blocks
|
22
|
+
add_link_object_id_to_tramway_landing_blocks
|
23
|
+
add_link_object_type_to_tramway_landing_blocks
|
24
|
+
add_button_to_tramway_landing_blocks
|
25
|
+
add_view_name_to_tramway_landing_blocks
|
24
26
|
]
|
25
27
|
|
26
28
|
migrations.each do |migration|
|
data/lib/tramway/landing.rb
CHANGED
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:
|
4
|
+
version: 1.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Kalashnikov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Landing Engine for your Rails projects
|
14
14
|
email:
|