breeze_cms 0.9.5

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.
Files changed (151) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +24 -0
  4. data/Rakefile +6 -0
  5. data/app/assets/config/breeze_manifest.js +2 -0
  6. data/app/assets/images/breeze/breeze_logo.png +0 -0
  7. data/app/assets/images/breeze/card_preview/card_feature_box.png +0 -0
  8. data/app/assets/images/breeze/card_preview/card_feature_normal.png +0 -0
  9. data/app/assets/images/breeze/card_preview/card_full_image.png +0 -0
  10. data/app/assets/images/breeze/card_preview/card_gap_square.png +0 -0
  11. data/app/assets/images/breeze/card_preview/card_large_image.png +0 -0
  12. data/app/assets/images/breeze/card_preview/card_normal_round.png +0 -0
  13. data/app/assets/images/breeze/card_preview/card_normal_square.png +0 -0
  14. data/app/assets/images/breeze/card_preview/card_wide_square.png +0 -0
  15. data/app/assets/images/breeze/card_preview/form_field.png +0 -0
  16. data/app/assets/images/breeze/home.jpg +0 -0
  17. data/app/assets/images/breeze/section_preview/blog_header.png +0 -0
  18. data/app/assets/images/breeze/section_preview/form_section.png +0 -0
  19. data/app/assets/images/breeze/section_preview/section_cards.png +0 -0
  20. data/app/assets/images/breeze/section_preview/section_feature.png +0 -0
  21. data/app/assets/images/breeze/section_preview/section_full_image.png +0 -0
  22. data/app/assets/images/breeze/section_preview/section_full_up.png +0 -0
  23. data/app/assets/images/breeze/section_preview/section_half_image.png +0 -0
  24. data/app/assets/images/breeze/section_preview/section_large_image.png +0 -0
  25. data/app/assets/images/breeze/section_preview/section_news.png +0 -0
  26. data/app/assets/images/breeze/section_preview/section_slider.png +0 -0
  27. data/app/assets/images/breeze/section_preview/section_small_image.png +0 -0
  28. data/app/assets/images/breeze/section_preview/section_spacer.png +0 -0
  29. data/app/assets/images/breeze/section_preview/section_text.png +0 -0
  30. data/app/assets/javascript/breeze_application.js.rb +101 -0
  31. data/app/assets/javascript/marked.js +6 -0
  32. data/app/assets/stylesheets/breeze/breeze.css +3633 -0
  33. data/app/assets/stylesheets/breeze/breeze.email.css +1344 -0
  34. data/app/assets/stylesheets/breeze.tailwind.css +2 -0
  35. data/app/assets/stylesheets/breeze_tailwind_styles.css +21 -0
  36. data/app/assets/stylesheets/tailwind_base.css +3 -0
  37. data/app/controllers/breeze/application_controller.rb +4 -0
  38. data/app/controllers/breeze/breeze_controller.rb +16 -0
  39. data/app/controllers/breeze/cards_controller.rb +58 -0
  40. data/app/controllers/breeze/changes_controller.rb +45 -0
  41. data/app/controllers/breeze/form_controller.rb +67 -0
  42. data/app/controllers/breeze/images_controller.rb +100 -0
  43. data/app/controllers/breeze/pages_controller.rb +66 -0
  44. data/app/controllers/breeze/sections_controller.rb +96 -0
  45. data/app/controllers/breeze/styles_controller.rb +11 -0
  46. data/app/controllers/breeze/translations_controller.rb +56 -0
  47. data/app/controllers/breeze/view_controller.rb +10 -0
  48. data/app/helpers/breeze/breeze_helper.rb +54 -0
  49. data/app/helpers/breeze/cards_helper.rb +11 -0
  50. data/app/helpers/breeze/changes_helper.rb +29 -0
  51. data/app/helpers/breeze/form_helper.rb +5 -0
  52. data/app/helpers/breeze/images_helper.rb +57 -0
  53. data/app/helpers/breeze/options_helper.rb +120 -0
  54. data/app/helpers/breeze/pages_helper.rb +5 -0
  55. data/app/helpers/breeze/sections_helper.rb +14 -0
  56. data/app/helpers/breeze/styles_helper.rb +4 -0
  57. data/app/helpers/breeze/translations_helper.rb +14 -0
  58. data/app/helpers/breeze/view_helper.rb +74 -0
  59. data/app/jobs/breeze/application_job.rb +4 -0
  60. data/app/mailers/breeze/application_mailer.rb +6 -0
  61. data/app/models/breeze/active_base.rb +34 -0
  62. data/app/models/breeze/active_yaml.rb +143 -0
  63. data/app/models/breeze/card.rb +90 -0
  64. data/app/models/breeze/card_style.rb +12 -0
  65. data/app/models/breeze/change_set.rb +58 -0
  66. data/app/models/breeze/image.rb +104 -0
  67. data/app/models/breeze/option_definition.rb +43 -0
  68. data/app/models/breeze/page.rb +97 -0
  69. data/app/models/breeze/page_style.rb +12 -0
  70. data/app/models/breeze/section.rb +137 -0
  71. data/app/models/breeze/section_style.rb +17 -0
  72. data/app/models/breeze/shared_base.rb +20 -0
  73. data/app/models/breeze/style.rb +17 -0
  74. data/app/models/breeze/translation.rb +83 -0
  75. data/app/models/breeze/view_base.rb +134 -0
  76. data/app/views/breeze/cards/index.haml +84 -0
  77. data/app/views/breeze/changes/index.haml +52 -0
  78. data/app/views/breeze/form/_editor.haml +33 -0
  79. data/app/views/breeze/form/form.haml +8 -0
  80. data/app/views/breeze/images/_editor.haml +144 -0
  81. data/app/views/breeze/images/index.haml +83 -0
  82. data/app/views/breeze/images/new.haml +12 -0
  83. data/app/views/breeze/images/show.haml +60 -0
  84. data/app/views/breeze/pages/_sections.rabl +4 -0
  85. data/app/views/breeze/pages/index.haml +49 -0
  86. data/app/views/breeze/pages/show.haml +85 -0
  87. data/app/views/breeze/sections/_option_form_date.haml +4 -0
  88. data/app/views/breeze/sections/_option_form_select.haml +4 -0
  89. data/app/views/breeze/sections/_option_form_text.haml +4 -0
  90. data/app/views/breeze/sections/_overlay.haml +33 -0
  91. data/app/views/breeze/sections/_section.rabl +5 -0
  92. data/app/views/breeze/sections/_sections_pagination.haml +29 -0
  93. data/app/views/breeze/sections/index.haml +88 -0
  94. data/app/views/breeze/sections/new.haml +12 -0
  95. data/app/views/breeze/sections/select_card_template.haml +13 -0
  96. data/app/views/breeze/sections/select_template.haml +15 -0
  97. data/app/views/breeze/sections/show.haml +91 -0
  98. data/app/views/breeze/styles/_options.haml +9 -0
  99. data/app/views/breeze/styles/index.haml +84 -0
  100. data/app/views/breeze/translations/_row.haml +29 -0
  101. data/app/views/breeze/translations/show.haml +79 -0
  102. data/app/views/breeze/view/_blog_header.haml +13 -0
  103. data/app/views/breeze/view/_form_section.haml +21 -0
  104. data/app/views/breeze/view/_section_cards.haml +17 -0
  105. data/app/views/breeze/view/_section_feature.haml +13 -0
  106. data/app/views/breeze/view/_section_full_image.haml +10 -0
  107. data/app/views/breeze/view/_section_full_up.haml +11 -0
  108. data/app/views/breeze/view/_section_half_image.haml +13 -0
  109. data/app/views/breeze/view/_section_large_image.haml +13 -0
  110. data/app/views/breeze/view/_section_news.haml +16 -0
  111. data/app/views/breeze/view/_section_slider.haml +51 -0
  112. data/app/views/breeze/view/_section_small_image.haml +11 -0
  113. data/app/views/breeze/view/_section_spacer.haml +1 -0
  114. data/app/views/breeze/view/_section_text.haml +17 -0
  115. data/app/views/breeze/view/cards/_card_feature_box.haml +13 -0
  116. data/app/views/breeze/view/cards/_card_feature_normal.haml +7 -0
  117. data/app/views/breeze/view/cards/_card_full_image.haml +10 -0
  118. data/app/views/breeze/view/cards/_card_gap_square.haml +11 -0
  119. data/app/views/breeze/view/cards/_card_large_image.haml +6 -0
  120. data/app/views/breeze/view/cards/_card_normal_round.haml +8 -0
  121. data/app/views/breeze/view/cards/_card_normal_square.haml +9 -0
  122. data/app/views/breeze/view/cards/_card_wide_square.haml +8 -0
  123. data/app/views/breeze/view/cards/_form_field.haml +8 -0
  124. data/app/views/breeze/view/elements/_button.haml +4 -0
  125. data/app/views/breeze/view/page.haml +2 -0
  126. data/app/views/layouts/breeze/_header.haml +37 -0
  127. data/app/views/layouts/breeze/_messages.haml +28 -0
  128. data/app/views/layouts/breeze/application.haml +20 -0
  129. data/app/views/layouts/mailer.html.haml +8 -0
  130. data/app/views/layouts/mailer.text.erb +1 -0
  131. data/config/breeze/card_styles.yml +129 -0
  132. data/config/breeze/option_definitions.yml +129 -0
  133. data/config/breeze/page_styles.yml +12 -0
  134. data/config/breeze/section_styles.yml +199 -0
  135. data/config/initializers/breeze.rb +13 -0
  136. data/config/initializers/rabl.rb +31 -0
  137. data/config/initializers/simple_form.rb +212 -0
  138. data/config/routes.rb +40 -0
  139. data/config/tailwind.config.js +17 -0
  140. data/config/tailwind.email.js +14 -0
  141. data/lib/breeze/engine.rb +97 -0
  142. data/lib/breeze/shared_helper.rb +44 -0
  143. data/lib/breeze/version.rb +3 -0
  144. data/lib/breeze.rb +104 -0
  145. data/lib/generators/breeze/install/install_generator.rb +19 -0
  146. data/lib/generators/breeze/install/templates/empty.yml +1 -0
  147. data/lib/generators/breeze/install/templates/initializer.rb +70 -0
  148. data/lib/generators/breeze/update/update_generator.rb +11 -0
  149. data/lib/tasks/condense.rake +60 -0
  150. data/lib/tasks/consistency.rake +84 -0
  151. metadata +371 -0
@@ -0,0 +1,33 @@
1
+ :javascript
2
+ var authenticity_token = "#{form_authenticity_token}"
3
+
4
+ :opal
5
+ Document.ready? do
6
+ init_section
7
+ end
8
+
9
+ :css
10
+ #overlay {
11
+ position: fixed;
12
+ display: none;
13
+ width: 100%;
14
+ height: 100%;
15
+ top: 0;
16
+ left: 0;
17
+ right: 0;
18
+ bottom: 0;
19
+ background-color: rgba(0,0,0,0.5);
20
+ z-index: 2;
21
+ cursor: pointer;
22
+ }
23
+
24
+ #text {
25
+ position: absolute;
26
+ }
27
+ #overlay
28
+ #text.text-gray-800
29
+ %input.header.mt-1.w-full.rounded-md.border-gray-200.bg-white.shadow-sm{ id: "_header", type: "text" , value: "trans.header"}
30
+ %textarea.textarea.mt-2.w-full.rounded-lg.border-gray-200.align-top.shadow-sm.sm:text-sm{ cols: 100 , rows: 10 }
31
+
32
+ %button#hidden_button.button.change.mt-4{type: :submit }
33
+ Update Texts
@@ -0,0 +1,5 @@
1
+ object @section
2
+ attributes :id , :text , :header
3
+ child :cards , object_root: false do
4
+ attributes :id , :text , :header
5
+ end
@@ -0,0 +1,29 @@
1
+ .text-xl.font-bold.text-gray-900
2
+ = section.page.type.capitalize
3
+ \:
4
+ = link_to section.page.name, breeze.page_sections_path(section.page.id), class: "underline text-3xl ml-3"
5
+ .text-xl.font-bold.text-gray-900
6
+ %span
7
+ Section
8
+ \:
9
+ = link_to section.header, section_path(section), class: "underline text-3xl ml-3"
10
+
11
+ .inline-flex.items-center.justify-center.gap-3
12
+ - if section.previous_section
13
+ =link_to breeze.section_path(section.previous_section.id) , class: "inline-flex h-8 w-8 items-center justify-center rounded border border-gray-100 hover:bg-sky-100" do
14
+ %span.sr-only Next Section
15
+ %svg.h-3.w-3{:fill => "currentColor", :viewbox => "0 0 20 20", :xmlns => "http://www.w3.org/2000/svg"}
16
+ %path{"clip-rule" => "evenodd", :d => "M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z", "fill-rule" => "evenodd"}
17
+ - else
18
+ .inline-flex.h-8.w-8.items-center.justify-center.rounded.border.border-gray-100
19
+ %p.text-xs
20
+ = section.index
21
+ %span{:class => "mx-0.25"} /
22
+ = section.page.sections.length
23
+ - if section.next_section
24
+ =link_to breeze.section_path(section.next_section.id), class: "inline-flex h-8 w-8 items-center justify-center rounded border border-gray-100 hover:bg-sky-100" do
25
+ %span.sr-only Next Section
26
+ %svg.h-3.w-3{:fill => "currentColor", :viewbox => "0 0 20 20", :xmlns => "http://www.w3.org/2000/svg"}
27
+ %path{"clip-rule" => "evenodd", :d => "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z", "fill-rule" => "evenodd"}
28
+ - else
29
+ .inline-flex.h-8.w-8.items-center.justify-center.rounded.border.border-gray-100
@@ -0,0 +1,88 @@
1
+ .mx-6.md:mx-12.mx-20.flex.h-16.items-center.gap-16.mb-10
2
+ .text-xl.font-bold.text-gray-900
3
+ = @page.type.capitalize
4
+ = link_to @page.name , breeze.page_path(@page)
5
+ .text-xl.text-gray-900
6
+ =link_to "View live" , "/#{@page.name}" , target: @page.name
7
+ = form_tag( breeze.section_new_path(@page.id), method: :post ) do
8
+ %button.button.change.mr-3{type: :submit} New Section
9
+
10
+ -@page.sections.each do |section |
11
+ .flex.gap-10.mt-2.pt-4.pb-2.border-2.bg-neutral-50.border-slate-400{ id: "section_#{section.id}"}
12
+ .basis-72.ml-20
13
+ %h3.text-lg.font-bold Section #{section.index} : #{section.header}
14
+ .flex.flex-wrap.gap-3
15
+ = link_to breeze.section_path(section.id) do
16
+ %button.button.action Edit
17
+ = form_tag( breeze.section_new_path(@page.id , template: section.template), method: :post ) do
18
+ %button.button.change.mr-3{type: :submit} Copy
19
+ .p-2
20
+ =link_to(breeze.section_move_path(section.id , dir: :down)) do
21
+ %svg.w-6.h-6{:fill => "none", :stroke => "currentColor", "stroke-width" => "1.5", :viewbox => "0 0 24 24", :xmlns => "http://www.w3.org/2000/svg"}
22
+ %path{:d => "M15.75 17.25L12 21m0 0l-3.75-3.75M12 21V3", "stroke-linecap" => "round", "stroke-linejoin" => "round"}
23
+ .p-2
24
+ =link_to(breeze.section_move_path(section.id , dir: :up)) do
25
+ %svg.w-6.h-6{:fill => "none", :stroke => "currentColor", "stroke-width" => "1.5", :viewbox => "0 0 24 24", :xmlns => "http://www.w3.org/2000/svg"}
26
+ %path{:d => "M8.25 6.75L12 3m0 0l3.75 3.75M12 3v18", "stroke-linecap" => "round", "stroke-linejoin" => "round"}
27
+ .basis-full.mt-3
28
+ Updated at:
29
+ = distance_of_time_in_words_to_now(section.updated_at)
30
+ .basis-full.mb-3
31
+ Updated by:
32
+ = updated_by(section)
33
+ - if section.has_cards?
34
+ - if card = section.cards_update
35
+ .basis-full
36
+ Cards updated at:
37
+ = distance_of_time_in_words_to_now(card.updated_at)
38
+ .basis-full.mb-3
39
+ Cards updated by:
40
+ = card.updated_by
41
+ .basis-full.mb-3
42
+ = form_tag( breeze.section_path(section.id) , {method: :delete } ) do
43
+ %button.button.remove{type: :submit} Delete
44
+
45
+ .basis-72
46
+ .flow.flow-cols
47
+ %h3.text-lg.font-bold.border-bottom-2 Style
48
+ %p= section.template_style.header
49
+ = section_preview(section , class: "object-contain")
50
+ = form_tag( breeze.section_select_template_path(section.id), method: :post ) do
51
+ %button.button.action.mt-3{type: :submit} Change Section Style
52
+
53
+ .basis-52.grow
54
+ %h3.my-4.text-lg.font-bold Header
55
+ %p= section.header
56
+ %h3.mt-4.text-lg.font-bold Text
57
+ %p= section.text[0..100] + " ..." if section.text
58
+ .basis-72
59
+ - if section.has_cards?
60
+ %h3.text-lg.font-bold #{section.cards.length} Cards
61
+ =link_to breeze.section_cards_path(section.id) do
62
+ =card_preview(section , class: "object-contain")
63
+ - else
64
+ = link_to(breeze.images_path(section_id: section.id)) do
65
+ -if section.image
66
+ %h3.text-lg.font-bold Image #{section.image.name}
67
+ .flex.align-center.justify-between.mb-4
68
+ .text-lg.font-bold.mt-2.mx-2
69
+ = section.image.size.to_s + "k"
70
+ %strong.inline-block.rounded.bg-gray-200.px-3.py-1.text-md.font-medium
71
+ = section.image.aspect_ratio
72
+ = image_for( section , "h-40 mb-1")
73
+ -else
74
+ %h3.mt-y.text-lg.font-bold No Image
75
+ .basis-96
76
+ %h3.text-lg.font-bold Options
77
+ .grid.grid-cols-2.gap-3.mx-10
78
+ - section.safe_options.each do|name , value|
79
+ -unless value.blank?
80
+ .font-bold.mt-1= name.camelcase
81
+ .font-xl= value
82
+ .grid.grid-cols-2.gap-2.m-8
83
+ .relative.block
84
+ = form_tag( breeze.section_new_path(@page.id), method: :post ) do
85
+ %button.button.change.mr-3{type: :submit} New Section
86
+ .relative.block.delete_page
87
+ = form_tag( breeze.page_path(@page.id) , {method: :delete } ) do
88
+ %button.button.remove{type: :submit} Delete Page
@@ -0,0 +1,12 @@
1
+ .mx-6.md:mx-12.mx-20.flex.h-16.items-center.gap-16
2
+ .text-xl.font-bold.text-gray-900
3
+ Changes
4
+ .text-xl.text-gray-900
5
+ Branch
6
+ = @git.current_branch
7
+
8
+ %h1 New breeze_section
9
+
10
+ = render 'form'
11
+
12
+ = link_to 'Back', breeze.sections_path
@@ -0,0 +1,13 @@
1
+ .mx-6.md:mx-12.mx-20.flex.h-16.items-center.gap-16
2
+ .text-xl.font-bold.text-gray-900
3
+ Page #{link_to @section.page.name, breeze.page_sections_path(@section.page.id), class: "underline"}
4
+ .text-xl.text-gray-900
5
+ Select Card Style for Section #{@section.index} - #{@section.header}
6
+
7
+ .grid.grid-cols-4.gap-6.m-8
8
+ - @cards.each do |style|
9
+ .flex.flex-col.border.border-gray-300.rounded-lg.p-2.bg-neutral-50
10
+ = link_to( breeze.section_set_card_template_path( card_template: style.template )) do
11
+ .font-bold.text-lg.text-center.pb-4= style.header
12
+ =image_tag(style.card_preview , class: "w-full object-contain")
13
+ .text-left.pt-4.bg-gray-50= style.text
@@ -0,0 +1,15 @@
1
+ .mx-6.md:mx-12.mx-20.flex.h-16.items-center.gap-16
2
+ .text-xl.font-bold.text-gray-900
3
+ Page #{link_to @section.page.name, breeze.page_sections_path(@section.page.id), class: "underline"}
4
+ .text-4xl.font-bold.text-gray-900
5
+ Select Style
6
+ .text-xl.text-gray-900
7
+ for Section #{@section.index} - #{@section.header}
8
+
9
+ .grid.grid-cols-4.gap-6.my-10.mx-6.md:mx-12.mx-20
10
+ - @sections.each do |style|
11
+ .flex.flex-col.border.border-gray-300.rounded-lg.p-2.bg-neutral-50
12
+ = link_to( breeze.section_set_template_path( template: style.template )) do
13
+ .font-bold.text-lg.text-center.pb-4= style.header
14
+ =image_tag(style.section_preview , class: "w-full object-contain")
15
+ .text-left.pt-4.bg-gray-50= style.text
@@ -0,0 +1,91 @@
1
+ .mx-6.md:mx-12.mx-20.flex.h-16.items-center.gap-16.w-full
2
+ = render "sections_pagination" , section: @section
3
+ = form_tag( breeze.section_new_path(@section.page.id), method: :post ) do
4
+ %button.button.change.mr-3{type: :submit} New Section
5
+
6
+ .xl:mx-auto{class: "max-w-[1920px]"}
7
+ = render_section( @section )
8
+
9
+ .flex.gap-8.my-10.flex-wrap.mx-20
10
+ .basis-80
11
+ %h3.text-lg.font-bold= @section.template_style.header
12
+ = section_preview(@section , class: "w-full object-contain my-4")
13
+ .flex
14
+ = form_tag( breeze.section_select_template_path(@section.id), method: :post ) do
15
+ %button.button.action.mr-3{type: :submit} Change Section Style
16
+ = form_tag( breeze.section_new_path(@section.page.id , template: @section.template), method: :post ) do
17
+ %button.button.change.mr-3{type: :submit} New Section
18
+ .basis-full.mt-3
19
+ Updated at:
20
+ = distance_of_time_in_words_to_now(@section.updated_at)
21
+ .basis-full.mb-3
22
+ Updated by:
23
+ = updated_by(@section)
24
+ = simple_form_for( @section , method: :patch ) do |f|
25
+ = f.input :page_id , label: "move to page" , include_blank: false ,
26
+ collection: Breeze::Page.all.collect{|p| [p.name , p.id]}
27
+ %button.button.change.mt-3{type: :submit} Move
28
+
29
+ .basis-80.image
30
+ = link_to(breeze.images_path(section_id: @section.id)) do
31
+ -if @section.image
32
+ %h3.text-lg.font-bold Image #{@section.image.name}
33
+ .flex.align-center.justify-between.mb-4
34
+ .text-lg.font-bold.mt-2.mx-2
35
+ = @section.image.size.to_s + "k"
36
+ %strong.inline-block.rounded.bg-slate-200.px-3.py-1.text-md.font-medium
37
+ = @section.image.aspect_ratio
38
+ = image_for( @section )
39
+ -else
40
+ %h3.text-lg.font-bold No Image
41
+ .flex
42
+ =link_to breeze.images_path(section_id: @section.id) do
43
+ .button.action.mt-4.mr-3 Change Image
44
+ - if( @section.image )
45
+ =link_to breeze.image_path(@section.image.id) do
46
+ .button.change.mt-4.mr-3 Edit Image
47
+ =link_to breeze.section_set_image_path( @section.id , image: "") do
48
+ .button.remove.mt-4 Remove image
49
+
50
+ .basis-80.grow.content_update
51
+ %label.block
52
+ %h4.text-lg.font-bold Texts
53
+ = simple_form_for( @section , method: :patch) do |f|
54
+ = f.input :header
55
+ = f.input :text , as: :text , input_html: {rows: rows(@section)}
56
+ %button.button.change.mt-4{type: :submit} Update Texts
57
+
58
+ - if( @section.has_cards? )
59
+ .basis-full.h-0
60
+ .basis-96
61
+ .mx-3.text-lg.font-bold Card Style: #{@section.card_template_style.header}
62
+ =card_preview(@section , class: "my-3")
63
+ .flex.py-3
64
+ = form_tag( breeze.section_select_card_template_path(@section.id), method: :post ) do
65
+ %button.button.action.mr-3{type: :submit} Change Card Style
66
+
67
+ .basis-96.grow
68
+ %h3.text-lg.font-bold #{@section.cards.length} Cards
69
+ -@section.cards.each do |card|
70
+ .mt-4.text-md.font-bold= card.header
71
+ .text-sm #{card.text[0..70]} .....
72
+ .flex.mt-3.gap-3
73
+ = link_to breeze.section_cards_path(@section.id) do
74
+ %button.button.action View and Edit Cards
75
+ = form_tag( breeze.card_new_path(@section.id) , method: :post ) do
76
+ %button.button.change.mr-3{type: :submit} New Card
77
+
78
+ .basis-80.grow
79
+ = simple_form_for( @section , method: :patch , class: "mx-auto mb-0 max-w space-y-4") do
80
+ - @section.option_definitions.each do |option|
81
+ .grid.grid-cols-3
82
+ =render "option_form_#{option.type}" , section: @section , option: option
83
+ -if @section.option_definitions.empty?
84
+ %p No options
85
+ -else
86
+ %button.button.change.mt-4{type: :submit} Update Options
87
+
88
+ :javascript
89
+ var sections = [#{ render( partial: "section" , formats: :json).html_safe } ]
90
+
91
+ = render partial: 'overlay'
@@ -0,0 +1,9 @@
1
+ .overflow-hidden.rounded-lg.border.border-gray-100.shadow-sm
2
+ .p-6
3
+ %h3.text-lg.font-medium
4
+ Options
5
+ %p.mt-2.text-sm.leading-relaxed.line-clamp-3
6
+ -style.options_definitions.each do | style |
7
+ %label.block
8
+ .text-lg.font-bold=style.name
9
+ =style.description
@@ -0,0 +1,84 @@
1
+ .mx-6.md:mx-12.mx-20.flex.h-16.items-center.gap-16
2
+ .text-xl.font-bold
3
+ Page styles
4
+ .text-xl.font-bold
5
+ =link_to "Section styles" , "#section_styles"
6
+ .text-xl.font-bold
7
+ =link_to "Card styles" , "#cards_styles"
8
+
9
+ .flex.bg-cyan-100
10
+ .px-4.py-8.mx-auto.text-center
11
+ %h1.text-4xl.font-bold
12
+ Page styles
13
+
14
+ .grid.grid-cols-3.gap-4.m-8
15
+ -@page_styles.each do |style|
16
+ %article.overflow-hidden.rounded-lg.border.border-gray-100.shadow-sm
17
+ .p-6
18
+ %h3.text-lg.font-medium
19
+ =style.type
20
+ %p.mt-2.text-sm
21
+ Shorthand:
22
+ =style.section_template
23
+ .overflow-hidden.rounded-lg.border.border-gray-100.shadow-sm
24
+ .p-6
25
+ -if style.section_template
26
+ = style.section_template
27
+ .w-full.object-contain
28
+ =image_tag(style.section_preview )
29
+ -else style.section_template
30
+ .w-full
31
+ Any Section allowed
32
+ =render "options" , style: style
33
+
34
+ #section_styles.flex.bg-cyan-100
35
+ .px-4.py-8.mx-auto.text-center
36
+ %h1.text-4xl.font-bold
37
+ Section styles
38
+
39
+ .grid.grid-cols-3.gap-4.m-8
40
+ -@section_styles.each do | style|
41
+ .overflow-hidden.rounded-lg.border.border-gray-100.shadow-sm
42
+ .p-6
43
+ %h3.text-lg.font-medium
44
+ =style.header
45
+ %p.mt-2.text-sm.leading-relaxed.line-clamp-3
46
+ = style.text
47
+ %p.mt-2.text-sm
48
+ Shorthand:
49
+ =style.template
50
+ %h3.text-lg.font-medium.mt-4
51
+ Cards
52
+ %p.mt-2.text-sm.leading-relaxed.line-clamp-3
53
+ -if(style.has_cards?)
54
+ Section may include cards. See card styles below
55
+ -else
56
+ Section may not include cards
57
+ .overflow-hidden.rounded-lg.border.border-gray-100.shadow-sm
58
+ .p-6
59
+ .w-full.object-contain.h-72
60
+ =image_tag(style.section_preview )
61
+
62
+ =render "options" , style: style
63
+
64
+ #cards_styles.flex.bg-cyan-100
65
+ .px-4.py-8.mx-auto.text-center
66
+ %h1.text-4xl.font-bold
67
+ Card styles
68
+ .grid.grid-cols-3.gap-4.m-8
69
+ -@cards_styles.each do |style|
70
+ %article.overflow-hidden.rounded-lg.border.border-gray-100.shadow-sm
71
+ .p-6
72
+ %h3.text-lg.font-medium
73
+ =style.header
74
+ %p.mt-2.text-sm.leading-relaxed.line-clamp-3
75
+ = style.text
76
+ %p.mt-2.text-sm
77
+ Shorthand:
78
+ =style.template
79
+ .overflow-hidden.rounded-lg.border.border-gray-100.shadow-sm
80
+ .p-6
81
+ .w-full.object-contain.h-72
82
+ =image_tag(style.card_preview )
83
+
84
+ =render "options" , style: style
@@ -0,0 +1,29 @@
1
+ .flex.gap-10.mt-2.pt-4.bg-neutral-50.mx-10.border-b-2{class: language_bg(trans.language)}
2
+ .basis-10.ml-3
3
+ %h3.text-lg.font-bold.text-center
4
+ = trans.object.index_name
5
+ = trans.language
6
+ .grow
7
+ .text{id: "#{trans.id}_header_text" ,
8
+ onclick: "text_to_form(event)" ,
9
+ class: ("bg-orange-200" if trans.is_old?) }
10
+ = trans.header
11
+ .hidden.form{id: "#{trans.id}_header_form"}
12
+ %input.mt-1.w-full.rounded-md.border-gray-200.bg-white.text-sm.text-gray-800.shadow-sm{ id: "#{trans.id}_header", type: "text" , value: trans.header}
13
+ %button.button.change.mt-4{type: :submit ,
14
+ id: "#{trans.id}_header_button" ,
15
+ onclick: "submit_switch(event)" }
16
+ Update Texts
17
+ .grow
18
+ .text{id: "#{trans.id}_text_text" ,
19
+ onclick: "text_to_form(event)" ,
20
+ class: ("bg-orange-200" if trans.is_old?) }
21
+ = trans.text
22
+ .hidden.form{id: "#{trans.id}_text_form"}
23
+ %textarea.mt-2.w-full.rounded-lg.border-gray-200.align-top.shadow-sm.sm:text-sm{ cols: 100 ,
24
+ id: "#{trans.id}_text" , rows: rows(trans.text) }
25
+ =trans.text
26
+ %button.button.change.mt-4{type: :submit ,
27
+ id: "#{trans.id}_text_button" ,
28
+ onclick: "submit_switch(event)"}
29
+ Update Texts
@@ -0,0 +1,79 @@
1
+ .mx-6.md:mx-12.mx-20.flex.h-16.items-center.gap-16
2
+ .text-xl.font-bold.text-gray-900
3
+ - previous = @page.previous_page
4
+ = link_to( "<< previous (#{previous.name})" , breeze.translation_path(id: previous.id) )
5
+ .text-xl.font-bold.text-gray-900
6
+ Page
7
+ = @page.name
8
+ .text-xl.font-bold.text-gray-900
9
+ - next_page = @page.next_page
10
+ = link_to( "(#{next_page.name}) next >> " , breeze.translation_path(id: next_page.id) )
11
+
12
+ -Breeze.language_strings.each do |lang|
13
+ -@page.sections.each do |section|
14
+ -trans = section.get_translation(lang)
15
+ = render "row" , trans: trans
16
+
17
+ -section.cards.each do |card|
18
+ -trans = card.get_translation(lang)
19
+ = render "row" , trans: trans
20
+
21
+
22
+ :javascript
23
+ // element ids conform to the following namng scheme (trans is tanslation id)
24
+ // trans_type_text is the text div for type (text/header)
25
+ // trans_type_form is the form div for type (gets switched with above)
26
+ // trans_type_button is the button for form for type
27
+ // trans_type is the input/textarea (value is put to trans_type_text)
28
+
29
+ // change visibility id_text /id_form according to param 2/3
30
+ function toggle_vis(id , text_visability , form_visability){
31
+ var text_id = id + "_text";
32
+ var text = document.getElementById(text_id);
33
+ text.style.display = text_visability;
34
+ var form_id = id + "_form";
35
+ var form = document.getElementById(form_id);
36
+ form.style.display = form_visability ;
37
+ return text ;
38
+ }
39
+
40
+
41
+ function form_submit(trans_id , field ){
42
+ var input_id = trans_id + "_" + field
43
+ var input = document.getElementById(input_id);
44
+
45
+ var postObj = {
46
+ authenticity_token: "#{form_authenticity_token}"
47
+ }
48
+ postObj[field] = input.value ;
49
+ const url = "/breeze/translations/" + trans_id
50
+ fetch(url, {
51
+ method: 'put', body: JSON.stringify(postObj),
52
+ headers: { 'Accept': 'application/json', 'Content-Type': 'application/json'}
53
+ }).then((response) => {
54
+ return response.json()
55
+ }).then((res) => {
56
+ console.log(input_id + " updated")
57
+ }).catch((error) => {
58
+ console.log(error)
59
+ })
60
+ var text = toggle_vis( input_id , "block", "none")
61
+ text.innerHTML = input.value ;
62
+ text.classList.remove("bg-orange-200");
63
+ }
64
+
65
+
66
+ function submit_switch(event){
67
+ var input_id = event.target.id; // eg 123_header
68
+ console.log("switch " + input_id)
69
+ var parts = input_id.split("_")
70
+ form_submit( parts[0] , parts[1] );
71
+ }
72
+
73
+
74
+ function text_to_form(event) {
75
+ var text_id = event.target.id; // eg 123_header_text
76
+ console.log("text2form " + text_id)
77
+ var parts = text_id.split("_");
78
+ toggle_vis( parts[0] + "_" + parts[1] , "none" , "block")
79
+ }
@@ -0,0 +1,13 @@
1
+ .flex.justify-center.p-8.flex-col.md:flex-row{options(section , :margin , :background )}
2
+ .flex.items-center.h-40.md:h-60.lg:h-96.w-full.overflow-hidden{order_option(section, "lg:w-1/3")}
3
+ = image_for(section ,"")
4
+ .flex.items-center.w-full.max-w.px-6.mt-6.mx-auto{:class => "lg:w-2/3"}
5
+ .flex-1{text_color_option(section)}
6
+ .text-center
7
+ %h2.text-4xl.font-bold.text-center.mb-2
8
+ = section.header_text(current_lang)
9
+ .font-bold.text-center.mb-4.lg:mb-8
10
+ = date_precision(section.page , "published_date")
11
+ .max-w-full.mt-4.gap-16{ options(section , :text_columns , :prose ) }
12
+ = markdown(section,current_lang)
13
+ = header_list
@@ -0,0 +1,21 @@
1
+ .flex.flex-col.m-5.md:m-12.lg:m-20{ options(section , :background , :text_color)}
2
+ .flex.items-center.justify-center.flex-1
3
+ .max-w-prose.px-4.mt-16.mx-auto.text-center
4
+ %h1.text-4xl.font-medium= section.header_text(current_lang)
5
+ .mt-4.text-lg.pt-10{ prose_classes }
6
+ = markdown(section,current_lang)
7
+ .flex.items-center.justify-start.m-10.md:m-20
8
+ .mx-auto.w-full.max-w-4xl{class: "max-w-[50%]"}
9
+ = form_tag( main_app.post_form_path , {class: "mt-10" }) do
10
+ - challenge = rand(8)
11
+ = hidden_field_tag :section_id , section.id
12
+ = hidden_field_tag :bot_fudder , "#{challenge*2}"
13
+ .md:grid.gap-6.grid-cols-2
14
+ - template = "breeze/view/cards/" + section.card_template
15
+ - section.cards.each do |card|
16
+ = render( template , card: card)
17
+ .grid.gap-6.md:grid-cols-2
18
+ .relative.z-0.mt-10
19
+ %input.peer.block.w-full.appearance-none.border-0.border-b.border-gray-500.bg-transparent.px-0.text-sm.text-gray-900.focus:border-blue-600.focus:outline-none.focus:ring-0{:class => "py-2.5", :name => "challenge", :placeholder => " ", :type => "text"}
20
+ %label.absolute.top-3.-z-10.-translate-y-6.scale-75.transform.text-sm.text-gray-500.duration-300.peer-placeholder-shown:translate-y-0.peer-placeholder-shown:scale-100.peer-focus:left-0.peer-focus:-translate-y-6.peer-focus:scale-75.peer-focus:text-blue-600.peer-focus:dark:text-blue-500{:class => "origin-[0]"}Anti bot question: #{challenge} + #{challenge + 1} is
21
+ %button.mt-10.rounded-md.bg-cyan-700.px-20.py-2.text-white{:type => "submit"} Send
@@ -0,0 +1,17 @@
1
+ %section.m-6.md:m-12.lg:m-20{ options(section , :background , :text_color), id: section.type_id}
2
+ .flex.justify-center
3
+ - unless section.header.blank? and section.text.blank?
4
+ .px-4.py-4.md:py-10.lg:py-16{ options(section , :text_align)}
5
+ - unless section.header.blank?
6
+ %h1.section_header.text-2xl.font-bold.tracking-tight.sm:text-4xl
7
+ = section.header_text(current_lang)
8
+ - if section.has_option?("subheader")
9
+ %h2.text-xl.pt-10.font-bold.tracking-tight.sm:text-2xl
10
+ = section.option("subheader")
11
+ - unless section.text.blank?
12
+ .section_text.text-lg.pt-10{ prose_classes }
13
+ = markdown(section , current_lang)
14
+ - template = "breeze/view/cards/" + section.card_template
15
+ .grid{ column_option(section)}
16
+ - section.cards.each do |card|
17
+ = render( template , card: card)
@@ -0,0 +1,13 @@
1
+ %section.m-5.md:m-12.lg:m-20{ options(section , :background , :text_color), id: section.type_id}
2
+ .grid.grid-cols-1.md:grid-cols-2
3
+ .flex.flex-col.lg:flex-row
4
+ .max-w-xl.pr-16.mx-auto.mb-10
5
+ %h2.section_header.my-4.md:my-10.text-4xl.font-extrabold.leading-none
6
+ = section.header_text(current_lang)
7
+ .section_text.mb-6{ prose_classes }
8
+ = markdown(section,current_lang)
9
+ .flex.items-center
10
+ - template = "breeze/view/cards/" + section.card_template
11
+ .grid{ column_option(section)}
12
+ - section.cards.each do |card|
13
+ = render( template , card: card)
@@ -0,0 +1,10 @@
1
+ %section.overflow-hidden.bg-cover.bg-no-repeat{bg(section , "h-full") , id: section.type_id}
2
+ .px-4.py-24.sm:px-6.lg:px-8
3
+ .flex{ item_align_option( section)}
4
+ .p-8.md:p-12.lg:px-16.lg:py-24{options(section , :shade )}
5
+ .mx-auto.max-w-xl{ options(section , :text_color, :text_align)}
6
+ %h2.section_header.text-2xl.font-bold.md:text-5xl
7
+ = section.header_text(current_lang)
8
+ .section_text.sm:mt-4.text-2xl{ prose_classes }
9
+ = markdown(section,current_lang)
10
+ =view_button(section , "my-2")
@@ -0,0 +1,11 @@
1
+ %section{ options(section , :background , :margin) , id: section.type_id}
2
+ .flex{ options(section , :item_align )}
3
+ .px-4.py-4.md:py-10.lg:py-16.mx-5.md:mx-12.lg:mx-20{options(section , :text_align , :text_color)}
4
+ %h1.section_header.text-2xl.font-bold.tracking-tight.sm:text-4xl
5
+ = section.header_text(current_lang)
6
+ -if section.has_option?("subheader")
7
+ %h4.text-xl.mt-10.md:text-2xl
8
+ = section.option("subheader")
9
+ .section_text.mt-4.text-lg.pt-10{ prose_classes }
10
+ = markdown(section,current_lang)
11
+ =view_button(section , "my-2")
@@ -0,0 +1,13 @@
1
+ %section.overflow-hidden.grid.grid-cols-1.m-5.md:m-12.lg:m-20.md:grid-cols-2{id: section.type_id}
2
+ %div{ order_option(section)}
3
+ = image_for( section , "h-56 w-full object-cover sm:h-full")
4
+ .p-8.md:p-12.lg:px-16.lg:py-24{ background_option(section)}
5
+ .mx-auto.max-w-xl{options(section , :text_align , :text_color)}
6
+ %h2.section_header.text-2xl.font-bold.md:text-4xl
7
+ = section.header_text(current_lang)
8
+ -if section.has_option?("subheader")
9
+ %h4.text-xl.mt-10.md:text-2xl
10
+ = section.option("subheader")
11
+ .section_text.mt-8{ prose_classes }
12
+ = markdown(section,current_lang)
13
+ =view_button(section , "my-2")
@@ -0,0 +1,13 @@
1
+ .flex.justify-center.flex-col.md:flex-row{options(section , :margin , :background ), id: section.type_id}
2
+ .flex.items-center.sm:my-2.lg:my-0.h-40.md:h-60.lg:h-96.w-full.overflow-hidden{order_option(section, "lg:w-2/3")}
3
+ = image_for(section ,"object-cover")
4
+ .flex.items-center.w-full.max-w.px-6.mt-6.mx-auto{:class => "lg:w-1/3"}
5
+ .flex-1{text_color_option(section)}
6
+ .text-center
7
+ %h2.section_header.text-4xl.font-bold.text-center.mb-4.lg:mb-8= section.header_text(current_lang)
8
+ -if section.has_option?("subheader")
9
+ %h4.text-xl.mt-4.lg:mt-8.md:text-2xl
10
+ = section.option("subheader")
11
+ .section_text.mt-3{ prose_classes }
12
+ = markdown(section,current_lang)
13
+ =view_button(section , "my-2")
@@ -0,0 +1,16 @@
1
+ - if blog = last_blog
2
+ %section.border.border-xl.mt-20{ options(section , :background ), id: section.type_id}
3
+ .flex.my-5.mx-6.md:mx-12.mx-20.justify-between.items-center
4
+ .section_header.text-2xl.font-bold.tracking-tight.sm:text-4xl
5
+ = section.header_text(current_lang)
6
+ .text-lg
7
+ = distance_of_time_in_words_to_now last_blog.updated_at
8
+ ago
9
+ %hr.mt-2.border.border-4.border-gray-600
10
+ = render_section( last_blog )
11
+ .flex.justify-between.items-center.border-b-8.border-gray-600
12
+ .ml-20.mb-2.text-lg
13
+ = section.text_text(current_lang)
14
+ .mr-20.mb-2.text-lg
15
+ %a.transition{:class => "hover:text-gray-500/75", :href => main_app.view_blog_path(blog.page.name)}
16
+ Read More . . .