breeze_cms 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +24 -0
- data/Rakefile +6 -0
- data/app/assets/config/breeze_manifest.js +2 -0
- data/app/assets/images/breeze/breeze_logo.png +0 -0
- data/app/assets/images/breeze/card_preview/card_feature_box.png +0 -0
- data/app/assets/images/breeze/card_preview/card_feature_normal.png +0 -0
- data/app/assets/images/breeze/card_preview/card_full_image.png +0 -0
- data/app/assets/images/breeze/card_preview/card_gap_square.png +0 -0
- data/app/assets/images/breeze/card_preview/card_large_image.png +0 -0
- data/app/assets/images/breeze/card_preview/card_normal_round.png +0 -0
- data/app/assets/images/breeze/card_preview/card_normal_square.png +0 -0
- data/app/assets/images/breeze/card_preview/card_wide_square.png +0 -0
- data/app/assets/images/breeze/card_preview/form_field.png +0 -0
- data/app/assets/images/breeze/home.jpg +0 -0
- data/app/assets/images/breeze/section_preview/blog_header.png +0 -0
- data/app/assets/images/breeze/section_preview/form_section.png +0 -0
- data/app/assets/images/breeze/section_preview/section_cards.png +0 -0
- data/app/assets/images/breeze/section_preview/section_feature.png +0 -0
- data/app/assets/images/breeze/section_preview/section_full_image.png +0 -0
- data/app/assets/images/breeze/section_preview/section_full_up.png +0 -0
- data/app/assets/images/breeze/section_preview/section_half_image.png +0 -0
- data/app/assets/images/breeze/section_preview/section_large_image.png +0 -0
- data/app/assets/images/breeze/section_preview/section_news.png +0 -0
- data/app/assets/images/breeze/section_preview/section_slider.png +0 -0
- data/app/assets/images/breeze/section_preview/section_small_image.png +0 -0
- data/app/assets/images/breeze/section_preview/section_spacer.png +0 -0
- data/app/assets/images/breeze/section_preview/section_text.png +0 -0
- data/app/assets/javascript/breeze_application.js.rb +101 -0
- data/app/assets/javascript/marked.js +6 -0
- data/app/assets/stylesheets/breeze/breeze.css +3633 -0
- data/app/assets/stylesheets/breeze/breeze.email.css +1344 -0
- data/app/assets/stylesheets/breeze.tailwind.css +2 -0
- data/app/assets/stylesheets/breeze_tailwind_styles.css +21 -0
- data/app/assets/stylesheets/tailwind_base.css +3 -0
- data/app/controllers/breeze/application_controller.rb +4 -0
- data/app/controllers/breeze/breeze_controller.rb +16 -0
- data/app/controllers/breeze/cards_controller.rb +58 -0
- data/app/controllers/breeze/changes_controller.rb +45 -0
- data/app/controllers/breeze/form_controller.rb +67 -0
- data/app/controllers/breeze/images_controller.rb +100 -0
- data/app/controllers/breeze/pages_controller.rb +66 -0
- data/app/controllers/breeze/sections_controller.rb +96 -0
- data/app/controllers/breeze/styles_controller.rb +11 -0
- data/app/controllers/breeze/translations_controller.rb +56 -0
- data/app/controllers/breeze/view_controller.rb +10 -0
- data/app/helpers/breeze/breeze_helper.rb +54 -0
- data/app/helpers/breeze/cards_helper.rb +11 -0
- data/app/helpers/breeze/changes_helper.rb +29 -0
- data/app/helpers/breeze/form_helper.rb +5 -0
- data/app/helpers/breeze/images_helper.rb +57 -0
- data/app/helpers/breeze/options_helper.rb +120 -0
- data/app/helpers/breeze/pages_helper.rb +5 -0
- data/app/helpers/breeze/sections_helper.rb +14 -0
- data/app/helpers/breeze/styles_helper.rb +4 -0
- data/app/helpers/breeze/translations_helper.rb +14 -0
- data/app/helpers/breeze/view_helper.rb +74 -0
- data/app/jobs/breeze/application_job.rb +4 -0
- data/app/mailers/breeze/application_mailer.rb +6 -0
- data/app/models/breeze/active_base.rb +34 -0
- data/app/models/breeze/active_yaml.rb +143 -0
- data/app/models/breeze/card.rb +90 -0
- data/app/models/breeze/card_style.rb +12 -0
- data/app/models/breeze/change_set.rb +58 -0
- data/app/models/breeze/image.rb +104 -0
- data/app/models/breeze/option_definition.rb +43 -0
- data/app/models/breeze/page.rb +97 -0
- data/app/models/breeze/page_style.rb +12 -0
- data/app/models/breeze/section.rb +137 -0
- data/app/models/breeze/section_style.rb +17 -0
- data/app/models/breeze/shared_base.rb +20 -0
- data/app/models/breeze/style.rb +17 -0
- data/app/models/breeze/translation.rb +83 -0
- data/app/models/breeze/view_base.rb +134 -0
- data/app/views/breeze/cards/index.haml +84 -0
- data/app/views/breeze/changes/index.haml +52 -0
- data/app/views/breeze/form/_editor.haml +33 -0
- data/app/views/breeze/form/form.haml +8 -0
- data/app/views/breeze/images/_editor.haml +144 -0
- data/app/views/breeze/images/index.haml +83 -0
- data/app/views/breeze/images/new.haml +12 -0
- data/app/views/breeze/images/show.haml +60 -0
- data/app/views/breeze/pages/_sections.rabl +4 -0
- data/app/views/breeze/pages/index.haml +49 -0
- data/app/views/breeze/pages/show.haml +85 -0
- data/app/views/breeze/sections/_option_form_date.haml +4 -0
- data/app/views/breeze/sections/_option_form_select.haml +4 -0
- data/app/views/breeze/sections/_option_form_text.haml +4 -0
- data/app/views/breeze/sections/_overlay.haml +33 -0
- data/app/views/breeze/sections/_section.rabl +5 -0
- data/app/views/breeze/sections/_sections_pagination.haml +29 -0
- data/app/views/breeze/sections/index.haml +88 -0
- data/app/views/breeze/sections/new.haml +12 -0
- data/app/views/breeze/sections/select_card_template.haml +13 -0
- data/app/views/breeze/sections/select_template.haml +15 -0
- data/app/views/breeze/sections/show.haml +91 -0
- data/app/views/breeze/styles/_options.haml +9 -0
- data/app/views/breeze/styles/index.haml +84 -0
- data/app/views/breeze/translations/_row.haml +29 -0
- data/app/views/breeze/translations/show.haml +79 -0
- data/app/views/breeze/view/_blog_header.haml +13 -0
- data/app/views/breeze/view/_form_section.haml +21 -0
- data/app/views/breeze/view/_section_cards.haml +17 -0
- data/app/views/breeze/view/_section_feature.haml +13 -0
- data/app/views/breeze/view/_section_full_image.haml +10 -0
- data/app/views/breeze/view/_section_full_up.haml +11 -0
- data/app/views/breeze/view/_section_half_image.haml +13 -0
- data/app/views/breeze/view/_section_large_image.haml +13 -0
- data/app/views/breeze/view/_section_news.haml +16 -0
- data/app/views/breeze/view/_section_slider.haml +51 -0
- data/app/views/breeze/view/_section_small_image.haml +11 -0
- data/app/views/breeze/view/_section_spacer.haml +1 -0
- data/app/views/breeze/view/_section_text.haml +17 -0
- data/app/views/breeze/view/cards/_card_feature_box.haml +13 -0
- data/app/views/breeze/view/cards/_card_feature_normal.haml +7 -0
- data/app/views/breeze/view/cards/_card_full_image.haml +10 -0
- data/app/views/breeze/view/cards/_card_gap_square.haml +11 -0
- data/app/views/breeze/view/cards/_card_large_image.haml +6 -0
- data/app/views/breeze/view/cards/_card_normal_round.haml +8 -0
- data/app/views/breeze/view/cards/_card_normal_square.haml +9 -0
- data/app/views/breeze/view/cards/_card_wide_square.haml +8 -0
- data/app/views/breeze/view/cards/_form_field.haml +8 -0
- data/app/views/breeze/view/elements/_button.haml +4 -0
- data/app/views/breeze/view/page.haml +2 -0
- data/app/views/layouts/breeze/_header.haml +37 -0
- data/app/views/layouts/breeze/_messages.haml +28 -0
- data/app/views/layouts/breeze/application.haml +20 -0
- data/app/views/layouts/mailer.html.haml +8 -0
- data/app/views/layouts/mailer.text.erb +1 -0
- data/config/breeze/card_styles.yml +129 -0
- data/config/breeze/option_definitions.yml +129 -0
- data/config/breeze/page_styles.yml +12 -0
- data/config/breeze/section_styles.yml +199 -0
- data/config/initializers/breeze.rb +13 -0
- data/config/initializers/rabl.rb +31 -0
- data/config/initializers/simple_form.rb +212 -0
- data/config/routes.rb +40 -0
- data/config/tailwind.config.js +17 -0
- data/config/tailwind.email.js +14 -0
- data/lib/breeze/engine.rb +97 -0
- data/lib/breeze/shared_helper.rb +44 -0
- data/lib/breeze/version.rb +3 -0
- data/lib/breeze.rb +104 -0
- data/lib/generators/breeze/install/install_generator.rb +19 -0
- data/lib/generators/breeze/install/templates/empty.yml +1 -0
- data/lib/generators/breeze/install/templates/initializer.rb +70 -0
- data/lib/generators/breeze/update/update_generator.rb +11 -0
- data/lib/tasks/condense.rake +60 -0
- data/lib/tasks/consistency.rake +84 -0
- metadata +371 -0
@@ -0,0 +1,199 @@
|
|
1
|
+
---
|
2
|
+
- :template: section_cards
|
3
|
+
:header: Section with Cards, 2-6 columns
|
4
|
+
:text: A header with text and column layout. Columns have a little gap, so
|
5
|
+
background color comes through. 2 - 6 columns. Cards freely choosable
|
6
|
+
:cards: true
|
7
|
+
:fields:
|
8
|
+
- header
|
9
|
+
- text
|
10
|
+
:options:
|
11
|
+
- background
|
12
|
+
- columns
|
13
|
+
- subheader
|
14
|
+
- text_color
|
15
|
+
- text_align
|
16
|
+
- :template: section_slider
|
17
|
+
:header: Slider with optional header with text
|
18
|
+
:text: Slider slides any (number) of cards. Columns means how many
|
19
|
+
slides are visible on desktop.
|
20
|
+
Optional header text on top of the slider (like the section with header/text)
|
21
|
+
:cards: true
|
22
|
+
:fields:
|
23
|
+
- header
|
24
|
+
- text
|
25
|
+
:options:
|
26
|
+
- slider_columns
|
27
|
+
- background
|
28
|
+
- text_color
|
29
|
+
- margin
|
30
|
+
- subheader
|
31
|
+
- text_align
|
32
|
+
- item_align
|
33
|
+
- button_link
|
34
|
+
- button_text
|
35
|
+
- :template: section_feature
|
36
|
+
:header: Feature section with 2 column,
|
37
|
+
:text: A split header with two column layout on the right.
|
38
|
+
Cards can be choosen freely but columns should be choosen to fit.
|
39
|
+
Look very much depends on card style and column number.
|
40
|
+
:cards: true
|
41
|
+
:fields:
|
42
|
+
- header
|
43
|
+
- text
|
44
|
+
:options:
|
45
|
+
- background
|
46
|
+
- columns
|
47
|
+
- subheader
|
48
|
+
- text_color
|
49
|
+
- text_align
|
50
|
+
- :template: section_full_up
|
51
|
+
:header: Centered Header with text
|
52
|
+
:text: Full width header with centered headline and optional text
|
53
|
+
:fields:
|
54
|
+
- header
|
55
|
+
- text
|
56
|
+
:options:
|
57
|
+
- background
|
58
|
+
- text_color
|
59
|
+
- margin
|
60
|
+
- subheader
|
61
|
+
- text_align
|
62
|
+
- item_align
|
63
|
+
- button_link
|
64
|
+
- button_text
|
65
|
+
- :template: section_news
|
66
|
+
:header: Showing latest news
|
67
|
+
:text: Always the latest available news section
|
68
|
+
:fields:
|
69
|
+
- header
|
70
|
+
- text
|
71
|
+
:options:
|
72
|
+
- background
|
73
|
+
- text_color
|
74
|
+
- text_align
|
75
|
+
- item_align
|
76
|
+
- :template: section_text
|
77
|
+
:header: Newspaper style section for longer passages of text.
|
78
|
+
:text: Text may be markdown. The section may have one image than
|
79
|
+
can be embedded into the text by writing IMAGE (in caps)
|
80
|
+
where the image should be inserted. Not more than 200 words
|
81
|
+
or 1000 characters are best.
|
82
|
+
Image size depends on columms, 3 column should be 600 wide and 300
|
83
|
+
to 600 high.
|
84
|
+
:fields:
|
85
|
+
- header
|
86
|
+
- text
|
87
|
+
:options:
|
88
|
+
- text_columns
|
89
|
+
- background
|
90
|
+
- text_color
|
91
|
+
- margin
|
92
|
+
- subheader
|
93
|
+
- text_align
|
94
|
+
- button_link
|
95
|
+
- button_text
|
96
|
+
- :template: section_half_image
|
97
|
+
:header: Split section with image left or right
|
98
|
+
:text: Image on one side, header and text on the other.
|
99
|
+
Order depends on order option. Optional button.
|
100
|
+
Image aspect ratio can be choosen and determines layout.
|
101
|
+
Wide image, narrow look. Square image big look. No portraits.
|
102
|
+
:fields:
|
103
|
+
- header
|
104
|
+
- text
|
105
|
+
:options:
|
106
|
+
- order
|
107
|
+
- background
|
108
|
+
- text_color
|
109
|
+
- subheader
|
110
|
+
- text_align
|
111
|
+
- button_link
|
112
|
+
- button_text
|
113
|
+
- :template: section_full_image
|
114
|
+
:header: Full image header with adjustable text
|
115
|
+
:text: Large picture background with Header and text on top.
|
116
|
+
Adjustable text text alignment (left, center, right).
|
117
|
+
Text may be slightly shaded for readability,
|
118
|
+
text color can be changed too.
|
119
|
+
Image should be 1600 wide and can be between 400 and 900 for
|
120
|
+
different looks
|
121
|
+
:fields:
|
122
|
+
- header
|
123
|
+
- text
|
124
|
+
:options:
|
125
|
+
- fixed
|
126
|
+
- text_color
|
127
|
+
- text_align
|
128
|
+
- item_align
|
129
|
+
- image_align
|
130
|
+
- shade_color
|
131
|
+
- button_link
|
132
|
+
- button_text
|
133
|
+
- :template: section_large_image
|
134
|
+
:header: Two third image header with adjustable text
|
135
|
+
:text: Large picture background with Header and text offset.
|
136
|
+
Adjustable text alignment (left, center, right).
|
137
|
+
Image size determines the look or layout. Images should be 1200 wide
|
138
|
+
and 300 - 600 high.
|
139
|
+
:fields:
|
140
|
+
- header
|
141
|
+
- text
|
142
|
+
:options:
|
143
|
+
- subheader
|
144
|
+
- margin
|
145
|
+
- order
|
146
|
+
- text_color
|
147
|
+
- text_align
|
148
|
+
- background
|
149
|
+
- button_link
|
150
|
+
- button_text
|
151
|
+
- :template: section_small_image
|
152
|
+
:header: One third image header with larger text area text
|
153
|
+
:text: Smaller picture with Header and text offset that use more space.
|
154
|
+
Adjustable text alignment (left, center, right).
|
155
|
+
Text section may have background color.
|
156
|
+
Text color can be changed too
|
157
|
+
:fields:
|
158
|
+
- header
|
159
|
+
- text
|
160
|
+
:options:
|
161
|
+
- subheader
|
162
|
+
- margin
|
163
|
+
- order
|
164
|
+
- text_color
|
165
|
+
- text_align
|
166
|
+
- background
|
167
|
+
- button_link
|
168
|
+
- button_text
|
169
|
+
- :template: section_spacer
|
170
|
+
:header: Spacer
|
171
|
+
:text: Just for extra padding
|
172
|
+
:fields:
|
173
|
+
- :template: form_section
|
174
|
+
:header: Contact or other form
|
175
|
+
:text: Flexible form, with input fields as "cards". Only choose form_field
|
176
|
+
as contained in the form.
|
177
|
+
:cards: true
|
178
|
+
:fields:
|
179
|
+
- header
|
180
|
+
- text
|
181
|
+
:options:
|
182
|
+
- ok_message
|
183
|
+
- handler
|
184
|
+
- background
|
185
|
+
- text_color
|
186
|
+
- :template: blog_header
|
187
|
+
:header: Start of blog, with image left or right
|
188
|
+
:text: Image on one side, header and text on the other.
|
189
|
+
Order depends on order option. Date is subheader.
|
190
|
+
Extra text possible under both text and picture, as markdown.
|
191
|
+
Image should be 600 wide and 400-900 high, depending on text.
|
192
|
+
:fields:
|
193
|
+
- header
|
194
|
+
- text
|
195
|
+
:options:
|
196
|
+
- order
|
197
|
+
- text_columns
|
198
|
+
- background
|
199
|
+
- text_color
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require "breeze"
|
2
|
+
|
3
|
+
# directory inside /app/assets/images where YOUR images are kept
|
4
|
+
# if you change this and add own styles, you will still need a breeze directory
|
5
|
+
# for the previews (card_preview and section_preview)
|
6
|
+
Breeze.images_dir = "breeze"
|
7
|
+
|
8
|
+
# directory where data and styles are kept
|
9
|
+
# Notice that the data is ALWAYS inside a breeze directory,
|
10
|
+
# so in the default case Rails.root/breeze/*.yml
|
11
|
+
Breeze.data_dir = "."
|
12
|
+
|
13
|
+
Breeze.languages = ""
|
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
Rabl.configure do |config|
|
3
|
+
# objvioulsy non defaults
|
4
|
+
config.include_json_root = false
|
5
|
+
config.include_child_root = false
|
6
|
+
|
7
|
+
# Commented as these are defaults
|
8
|
+
# config.cache_all_output = false
|
9
|
+
# config.cache_sources = Rails.env != 'development' # Defaults to false
|
10
|
+
# config.cache_engine = Rabl::CacheEngine.new # Defaults to Rails cache
|
11
|
+
# config.perform_caching = false
|
12
|
+
# config.escape_all_output = false
|
13
|
+
# config.json_engine = nil # Class with #dump class method (defaults JSON)
|
14
|
+
# config.msgpack_engine = nil # Defaults to ::MessagePack
|
15
|
+
# config.bson_engine = nil # Defaults to ::BSON
|
16
|
+
# config.plist_engine = nil # Defaults to ::Plist::Emit
|
17
|
+
# config.include_msgpack_root = true
|
18
|
+
# config.include_bson_root = true
|
19
|
+
# config.include_plist_root = true
|
20
|
+
# config.include_xml_root = false
|
21
|
+
# config.include_child_root = true
|
22
|
+
# config.enable_json_callbacks = false
|
23
|
+
# config.xml_options = { :dasherize => true, :skip_types => false }
|
24
|
+
# config.view_paths = []
|
25
|
+
# config.raise_on_missing_attribute = true # Defaults to false
|
26
|
+
# config.replace_nil_values_with_empty_strings = true # Defaults to false
|
27
|
+
# config.replace_empty_string_values_with_nil_values = true # Defaults to false
|
28
|
+
# config.exclude_nil_values = true # Defaults to false
|
29
|
+
# config.exclude_empty_values_in_collections = true # Defaults to false
|
30
|
+
# config.camelize_keys = :upper # Defaults to false
|
31
|
+
end
|
@@ -0,0 +1,212 @@
|
|
1
|
+
require "simple_form"
|
2
|
+
|
3
|
+
# frozen_string_literal: true
|
4
|
+
#
|
5
|
+
# Uncomment this and change the path if necessary to include your own
|
6
|
+
# components.
|
7
|
+
# See https://github.com/heartcombo/simple_form#custom-components to know
|
8
|
+
# more about custom components.
|
9
|
+
# Dir[Rails.root.join('lib/components/**/*.rb')].each { |f| require f }
|
10
|
+
#
|
11
|
+
# Use this setup block to configure all options available in SimpleForm.
|
12
|
+
SimpleForm.setup do |config|
|
13
|
+
# Wrappers are used by the form builder to generate a
|
14
|
+
# complete input. You can remove any component from the
|
15
|
+
# wrapper, change the order or even add your own to the
|
16
|
+
# stack. The options given below are used to wrap the
|
17
|
+
# whole input.
|
18
|
+
|
19
|
+
config.wrappers :default, tag: 'div', class: 'mt-4', error_class: '', valid_class: '' do |b|
|
20
|
+
b.use :html5
|
21
|
+
b.use :placeholder
|
22
|
+
b.optional :maxlength
|
23
|
+
b.optional :minlength
|
24
|
+
b.optional :pattern
|
25
|
+
b.optional :min_max
|
26
|
+
b.optional :readonly
|
27
|
+
|
28
|
+
b.use :label, class: "block text-sm font-medium text-gray-700"
|
29
|
+
b.use :input,
|
30
|
+
class: 'appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm',
|
31
|
+
error_class: 'block w-full pr-10 border-red-300 text-red-900 placeholder-red-300 focus:outline-none focus:ring-red-500 focus:border-red-500 sm:text-sm rounded-md'
|
32
|
+
b.use :full_error, wrap_with: { tag: 'p', class: 'mt-2 text-sm text-red-600' }
|
33
|
+
b.use :hint, wrap_with: { tag: :p, class: "mt-2 text-sm text-gray-500" }
|
34
|
+
end
|
35
|
+
|
36
|
+
config.wrappers :prepend_string, tag: 'div', class: '', error_class: '', valid_class: '' do |b|
|
37
|
+
b.use :html5
|
38
|
+
b.use :placeholder
|
39
|
+
b.optional :maxlength
|
40
|
+
b.optional :minlength
|
41
|
+
b.optional :pattern
|
42
|
+
b.optional :min_max
|
43
|
+
b.optional :readonly
|
44
|
+
|
45
|
+
b.use :label, class: "block text-sm font-medium text-gray-700"
|
46
|
+
|
47
|
+
b.wrapper tag: 'div', class: 'mt-1 flex rounded-md shadow-sm' do |d|
|
48
|
+
d.use :prepend
|
49
|
+
d.use :input,
|
50
|
+
class: "flex-1 min-w-0 block w-full px-3 py-2 rounded-none rounded-r-md focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm border-gray-300",
|
51
|
+
error_class: "flex-1 min-w-0 block w-full px-3 py-2 rounded-none rounded-r-md focus:ring-red-500 focus:border-red-500 sm:text-sm border-red-300 text-red-900 placeholder-red-300"
|
52
|
+
end
|
53
|
+
b.use :full_error, wrap_with: { tag: "p", class: "mt-2 text-sm text-red-600" }
|
54
|
+
b.use :hint, wrap_with: { tag: :p, class: "mt-2 text-sm text-gray-500" }
|
55
|
+
end
|
56
|
+
|
57
|
+
config.wrappers :append_string, tag: 'div', class: '', error_class: '', valid_class: '' do |b|
|
58
|
+
b.use :html5
|
59
|
+
b.use :placeholder
|
60
|
+
b.optional :maxlength
|
61
|
+
b.optional :minlength
|
62
|
+
b.optional :pattern
|
63
|
+
b.optional :min_max
|
64
|
+
b.optional :readonly
|
65
|
+
|
66
|
+
b.use :label, class: "block text-sm font-medium text-gray-700"
|
67
|
+
|
68
|
+
b.wrapper tag: 'div', class: 'mt-1 flex rounded-md shadow-sm' do |d|
|
69
|
+
d.use :input,
|
70
|
+
class: "flex-1 min-w-0 block w-full px-3 py-2 rounded-none rounded-l-md focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm border-gray-300",
|
71
|
+
error_class: "flex-1 min-w-0 block w-full px-3 py-2 rounded-none rounded-l-md focus:ring-red-500 focus:border-red-500 sm:text-sm border-red-300 text-red-900 placeholder-red-300"
|
72
|
+
d.use :append
|
73
|
+
end
|
74
|
+
b.use :full_error, wrap_with: { tag: "p", class: "mt-2 text-sm text-red-600" }
|
75
|
+
b.use :hint, wrap_with: { tag: :p, class: "mt-2 text-sm text-gray-500" }
|
76
|
+
end
|
77
|
+
|
78
|
+
config.wrappers :corner_hint, tag: :div do |b|
|
79
|
+
b.use :html5
|
80
|
+
b.use :placeholder
|
81
|
+
b.optional :maxlength
|
82
|
+
b.optional :minlength
|
83
|
+
b.optional :pattern
|
84
|
+
b.optional :min_max
|
85
|
+
b.optional :readonly
|
86
|
+
|
87
|
+
b.wrapper tag: :div, class: "flex justify-between", error_class: nil, valid_class: nil do |c|
|
88
|
+
c.use :label, class: "block text-sm font-medium text-gray-700"
|
89
|
+
c.use :hint, wrap_with: { tag: :span, class: "text-sm text-gray-500" }
|
90
|
+
end
|
91
|
+
|
92
|
+
b.use :input,
|
93
|
+
class: "appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm",
|
94
|
+
error_class: "block w-full pr-10 border-red-300 text-red-900 placeholder-red-300 focus:outline-none focus:ring-red-500 focus:border-red-500 sm:text-sm rounded-md"
|
95
|
+
b.use :full_error, wrap_with: { tag: "p", class: "mt-2 text-sm text-red-600" }
|
96
|
+
end
|
97
|
+
|
98
|
+
# The default wrapper to be used by the FormBuilder.
|
99
|
+
config.default_wrapper = :default
|
100
|
+
|
101
|
+
# Define the way to render check boxes / radio buttons with labels.
|
102
|
+
# Defaults to :nested for bootstrap config.
|
103
|
+
# inline: input + label
|
104
|
+
# nested: label > input
|
105
|
+
config.boolean_style = :nested
|
106
|
+
|
107
|
+
# Default class for buttons
|
108
|
+
config.button_class = nil
|
109
|
+
|
110
|
+
# Method used to tidy up errors. Specify any Rails Array method.
|
111
|
+
# :first lists the first message for each field.
|
112
|
+
# Use :to_sentence to list all errors for each field.
|
113
|
+
# config.error_method = :first
|
114
|
+
|
115
|
+
# Default tag used for error notification helper.
|
116
|
+
config.error_notification_tag = :div
|
117
|
+
|
118
|
+
# CSS class to add for error notification helper.
|
119
|
+
config.error_notification_class = ''
|
120
|
+
|
121
|
+
# Series of attempts to detect a default label method for collection.
|
122
|
+
# config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
|
123
|
+
|
124
|
+
# Series of attempts to detect a default value method for collection.
|
125
|
+
# config.collection_value_methods = [ :id, :to_s ]
|
126
|
+
|
127
|
+
# You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
|
128
|
+
# config.collection_wrapper_tag = nil
|
129
|
+
|
130
|
+
# You can define the class to use on all collection wrappers. Defaulting to none.
|
131
|
+
# config.collection_wrapper_class = nil
|
132
|
+
|
133
|
+
# You can wrap each item in a collection of radio/check boxes with a tag,
|
134
|
+
# defaulting to :span.
|
135
|
+
# config.item_wrapper_tag = :span
|
136
|
+
|
137
|
+
# You can define a class to use in all item wrappers. Defaulting to none.
|
138
|
+
# config.item_wrapper_class = nil
|
139
|
+
|
140
|
+
# How the label text should be generated altogether with the required text.
|
141
|
+
config.label_text = lambda { |label, required, explicit_label| "#{label}" }
|
142
|
+
|
143
|
+
# You can define the class to use on all labels. Default is nil.
|
144
|
+
# config.label_class = nil
|
145
|
+
|
146
|
+
# You can define the default class to be used on forms. Can be overriden
|
147
|
+
# with `html: { :class }`. Defaulting to none.
|
148
|
+
config.default_form_class = nil
|
149
|
+
config.form_class = nil
|
150
|
+
|
151
|
+
# You can define which elements should obtain additional classes
|
152
|
+
config.generate_additional_classes_for = []
|
153
|
+
|
154
|
+
# Whether attributes are required by default (or not). Default is true.
|
155
|
+
# config.required_by_default = true
|
156
|
+
|
157
|
+
# Tell browsers whether to use the native HTML5 validations (novalidate form option).
|
158
|
+
# These validations are enabled in SimpleForm's internal config but disabled by default
|
159
|
+
# in this configuration, which is recommended due to some quirks from different browsers.
|
160
|
+
# To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
|
161
|
+
# change this configuration to true.
|
162
|
+
config.browser_validations = false
|
163
|
+
|
164
|
+
# Custom mappings for input types. This should be a hash containing a regexp
|
165
|
+
# to match as key, and the input type that will be used when the field name
|
166
|
+
# matches the regexp as value.
|
167
|
+
# config.input_mappings = { /count/ => :integer }
|
168
|
+
|
169
|
+
# Custom wrappers for input types. This should be a hash containing an input
|
170
|
+
# type as key and the wrapper that will be used for all inputs with specified type.
|
171
|
+
config.wrapper_mappings = {
|
172
|
+
string: :default,
|
173
|
+
prepend_string: :prepend_string,
|
174
|
+
append_string: :append_string,
|
175
|
+
}
|
176
|
+
|
177
|
+
# Namespaces where SimpleForm should look for custom input classes that
|
178
|
+
# override default inputs.
|
179
|
+
# config.custom_inputs_namespaces << "CustomInputs"
|
180
|
+
|
181
|
+
# Default priority for time_zone inputs.
|
182
|
+
# config.time_zone_priority = nil
|
183
|
+
|
184
|
+
# Default priority for country inputs.
|
185
|
+
# config.country_priority = nil
|
186
|
+
|
187
|
+
# When false, do not use translations for labels.
|
188
|
+
# config.translate_labels = true
|
189
|
+
|
190
|
+
# Automatically discover new inputs in Rails' autoload path.
|
191
|
+
# config.inputs_discovery = true
|
192
|
+
|
193
|
+
# Cache SimpleForm inputs discovery
|
194
|
+
# config.cache_discovery = !Rails.env.development?
|
195
|
+
|
196
|
+
# Default class for inputs
|
197
|
+
# config.input_class = nil
|
198
|
+
|
199
|
+
# Define the default class of the input wrapper of the boolean input.
|
200
|
+
config.boolean_label_class = 'checkbox'
|
201
|
+
|
202
|
+
# Defines if the default input wrapper class should be included in radio
|
203
|
+
# collection wrappers.
|
204
|
+
# config.include_default_input_wrapper_class = true
|
205
|
+
|
206
|
+
# Defines which i18n scope will be used in Simple Form.
|
207
|
+
# config.i18n_scope = 'simple_form'
|
208
|
+
|
209
|
+
# Defines validation classes to the input_field. By default it's nil.
|
210
|
+
# config.input_field_valid_class = 'is-valid'
|
211
|
+
# config.input_field_error_class = 'is-invalid'
|
212
|
+
end
|
data/config/routes.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
Breeze::Engine.routes.draw do
|
2
|
+
|
3
|
+
get 'changes/index'
|
4
|
+
post 'changes/commit'
|
5
|
+
post 'changes/reset'
|
6
|
+
get "styles/index"
|
7
|
+
|
8
|
+
post 'form/sendit'
|
9
|
+
|
10
|
+
|
11
|
+
resources :pages , except: [:edit , :new] , shallow: true do
|
12
|
+
resources :sections , except: [:new] do
|
13
|
+
post :new #new is post because it already create the section
|
14
|
+
get :set_image
|
15
|
+
|
16
|
+
get :set_template ## ** wanted the selection to be a click,
|
17
|
+
post :select_template ## so getting to the selection is by form
|
18
|
+
## so that the old rule of form means change sort of holds
|
19
|
+
get :select_template # only for redirect, should be "private" **
|
20
|
+
|
21
|
+
get :set_card_template #same comments as above
|
22
|
+
post :select_card_template
|
23
|
+
get :sselect_card_template
|
24
|
+
|
25
|
+
get :move
|
26
|
+
resources :cards , except: [:new] do
|
27
|
+
post :new # new is post as card is created immediately
|
28
|
+
get :set_image
|
29
|
+
get :move
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
resources :images do
|
34
|
+
post :copy
|
35
|
+
post :crop
|
36
|
+
post :scale
|
37
|
+
end
|
38
|
+
|
39
|
+
resources :translations
|
40
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
const defaultTheme = require('tailwindcss/defaultTheme')
|
2
|
+
|
3
|
+
module.exports = {
|
4
|
+
content: [
|
5
|
+
'./public/*.html',
|
6
|
+
'./app/**/*.rb',
|
7
|
+
'./lib/**/*.rb',
|
8
|
+
'./config/initializers/breeze.rb' ,
|
9
|
+
'./app/javascript/**/*.js',
|
10
|
+
'./app/views/**/*.{erb,haml,html,slim}'
|
11
|
+
],
|
12
|
+
plugins: [
|
13
|
+
require('@tailwindcss/forms'),
|
14
|
+
require('@tailwindcss/aspect-ratio'),
|
15
|
+
require('@tailwindcss/typography'),
|
16
|
+
]
|
17
|
+
}
|
@@ -0,0 +1,97 @@
|
|
1
|
+
require "ruby2js"
|
2
|
+
require "ruby2js/es2015"
|
3
|
+
require "ruby2js/filter/functions"
|
4
|
+
require "ruby2js/haml"
|
5
|
+
require "ruby2js/filter/vue"
|
6
|
+
require "breeze/shared_helper"
|
7
|
+
require "simple_form"
|
8
|
+
require "simple_form_tailwind_css"
|
9
|
+
require "haml-rails"
|
10
|
+
require "opal-rails"
|
11
|
+
require "opal-jquery"
|
12
|
+
require "jquery-rails"
|
13
|
+
require 'sprockets/railtie'
|
14
|
+
require "tailwindcss-rails"
|
15
|
+
require "rabl"
|
16
|
+
|
17
|
+
module Breeze
|
18
|
+
class Engine < ::Rails::Engine
|
19
|
+
isolate_namespace Breeze
|
20
|
+
config.breeze = Breeze
|
21
|
+
|
22
|
+
initializer "breeze.assets.precompile" do |app|
|
23
|
+
app.config.assets.precompile += %w( breeze/breeze.css breeze/breeze.email.css
|
24
|
+
breeze/home breeze/breeze_logo breeze_application.js)
|
25
|
+
add_image_assets(app.config , "section_preview")
|
26
|
+
add_image_assets(app.config , "card_preview")
|
27
|
+
end
|
28
|
+
|
29
|
+
initializer "after_initialize" do |app|
|
30
|
+
ActiveSupport::Reloader.to_prepare do
|
31
|
+
[Translation, Section, Card, Page, Image, PageStyle,
|
32
|
+
SectionStyle, CardStyle, OptionDefinition].each do |clazz|
|
33
|
+
clazz.reload
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
def add_image_assets(config , sub_dir )
|
40
|
+
dir = Dir.new(Engine.root.join("app/assets/images/breeze/" , sub_dir))
|
41
|
+
dir.children.each do |file|
|
42
|
+
kid = "breeze/" + sub_dir + "/" + file
|
43
|
+
config.assets.precompile << kid
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
module ActionDispatch::Routing
|
50
|
+
class Mapper
|
51
|
+
|
52
|
+
# breeze_routes will draw neccessary routes and possibly mount engine
|
53
|
+
# This includes:
|
54
|
+
# post /form for form processing
|
55
|
+
# get /news/:id for any news posts
|
56
|
+
# get /:id for any pages
|
57
|
+
# get /:lang/:id for every language and page
|
58
|
+
# redirects from any renamed page
|
59
|
+
# root to /index unless options[:root] == false
|
60
|
+
# mount the engine (make editing possible) unless production
|
61
|
+
# or oprions[:production] == true (not recommended)
|
62
|
+
def breeze_routes options = {}
|
63
|
+
Rails.application.routes.draw do
|
64
|
+
begin
|
65
|
+
if options[:root]
|
66
|
+
root "breeze/view#page" , id: 'index'
|
67
|
+
end
|
68
|
+
Breeze.language_strings.each do |lang|
|
69
|
+
get "/#{lang}/:id" , to: "breeze/view#page" , lang: lang , id: :id
|
70
|
+
get "/#{lang}" , to: "breeze/view#page" , lang: lang , id: 'index'
|
71
|
+
end
|
72
|
+
|
73
|
+
Breeze::Page.all.each do |page|
|
74
|
+
next unless page.redirects
|
75
|
+
page.redirects.split.each do |old|
|
76
|
+
next if old == page.name
|
77
|
+
get "/#{old}" => redirect("/#{page.name}")
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
post "/form" , to: "breeze/form#post" , as: :post_form
|
82
|
+
get "/news/:id" , to: "breeze/view#page" , id: :id , as: :view_blog
|
83
|
+
get ":id" , to: "breeze/view#page" , id: :id , as: :view_page
|
84
|
+
|
85
|
+
engine_path = options[:path] || "/breeze"
|
86
|
+
if ! Rails.env.production? or options[:production].present?
|
87
|
+
mount Breeze::Engine => engine_path
|
88
|
+
end
|
89
|
+
|
90
|
+
rescue => e
|
91
|
+
puts e.backtrace
|
92
|
+
raise e
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require "redcarpet"
|
2
|
+
|
3
|
+
module Breeze
|
4
|
+
module SharedHelper
|
5
|
+
|
6
|
+
def renderer
|
7
|
+
options = {hard_wrap: true , autolink: true, no_intra_emphasis: true ,
|
8
|
+
safe_links_only: true, no_styles: true , fenced_code_blocks: true,
|
9
|
+
link_attributes: { target: '_blank' }}
|
10
|
+
html = Redcarpet::Render::HTML.new(options)
|
11
|
+
Redcarpet::Markdown.new(html, options)
|
12
|
+
end
|
13
|
+
|
14
|
+
def prose_classes
|
15
|
+
classes = "prose md:prose-lg lg:prose-xl max-w-none "
|
16
|
+
classes += "prose-headings:text-inherit "
|
17
|
+
{ class: classes }
|
18
|
+
end
|
19
|
+
|
20
|
+
def markdown_image(section, lang = "")
|
21
|
+
return "" unless section.text
|
22
|
+
down = self.renderer.render(section.text_text(lang))
|
23
|
+
image = image_for(section)
|
24
|
+
down.gsub("IMAGE" , image).html_safe
|
25
|
+
end
|
26
|
+
|
27
|
+
def markdown(text , lang = "")
|
28
|
+
text = text.text_text(lang) unless text.is_a?(String)
|
29
|
+
return "" if text.blank?
|
30
|
+
self.renderer.render(text).html_safe
|
31
|
+
end
|
32
|
+
|
33
|
+
def rows( text )
|
34
|
+
return 5 if text.blank?
|
35
|
+
text = text.text unless text.is_a?(String)
|
36
|
+
return 5 if text.blank?
|
37
|
+
rows = (text.length / 50).to_i
|
38
|
+
rows += text.count("\n")
|
39
|
+
return 5 if rows < 5
|
40
|
+
rows
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|