breeze_cms 1.0.2 → 1.1.0

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 (52) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/breeze/card_preview/big_card.png +0 -0
  3. data/app/assets/images/breeze/card_preview/card_image_wide.png +0 -0
  4. data/app/assets/images/breeze/card_preview/faq_item.jpg +0 -0
  5. data/app/assets/images/breeze/section_preview/section_faq.jpg +0 -0
  6. data/app/assets/images/breeze/section_preview/section_half_slider.jpg +0 -0
  7. data/app/assets/stylesheets/breeze/breeze.css +301 -188
  8. data/app/assets/stylesheets/breeze/breeze.email.css +158 -39
  9. data/app/controllers/breeze/images_controller.rb +15 -2
  10. data/app/controllers/breeze/pages_controller.rb +9 -3
  11. data/app/controllers/breeze/sections_controller.rb +1 -1
  12. data/app/controllers/breeze/translations_controller.rb +9 -2
  13. data/app/helpers/breeze/images_helper.rb +11 -5
  14. data/app/helpers/breeze/options_helper.rb +1 -1
  15. data/app/helpers/breeze/view_helper.rb +32 -1
  16. data/app/models/breeze/active_yaml.rb +1 -0
  17. data/app/models/breeze/page.rb +6 -0
  18. data/app/models/breeze/section.rb +10 -0
  19. data/app/models/breeze/shared_base.rb +1 -1
  20. data/app/models/breeze/translation.rb +15 -1
  21. data/app/models/breeze/view_base.rb +17 -3
  22. data/app/views/breeze/images/_editor.haml +22 -22
  23. data/app/views/breeze/images/index.haml +6 -4
  24. data/app/views/breeze/images/show.haml +9 -4
  25. data/app/views/breeze/pages/index.haml +5 -1
  26. data/app/views/breeze/pages/show.haml +52 -62
  27. data/app/views/breeze/translations/_row.haml +8 -0
  28. data/app/views/breeze/translations/show.haml +4 -4
  29. data/app/views/breeze/view/_form_section.haml +12 -10
  30. data/app/views/breeze/view/_section_faq.haml +32 -0
  31. data/app/views/breeze/view/_section_full_image.haml +1 -1
  32. data/app/views/breeze/view/_section_full_up.haml +4 -3
  33. data/app/views/breeze/view/_section_half_image.haml +1 -1
  34. data/app/views/breeze/view/_section_half_slider.haml +69 -0
  35. data/app/views/breeze/view/_section_large_image.haml +1 -1
  36. data/app/views/breeze/view/_section_slider.haml +38 -16
  37. data/app/views/breeze/view/_section_small_image.haml +1 -1
  38. data/app/views/breeze/view/cards/_big_card.haml +10 -0
  39. data/app/views/breeze/view/cards/_card_image_wide.haml +10 -0
  40. data/app/views/breeze/view/cards/_faq_item.haml +9 -0
  41. data/app/views/breeze/view/cards/_form_field.haml +4 -4
  42. data/app/views/layouts/breeze/_header.haml +1 -1
  43. data/config/breeze/card_styles.yml +84 -31
  44. data/config/breeze/option_definitions.yml +9 -2
  45. data/config/breeze/page_styles.yml +1 -0
  46. data/config/breeze/section_styles.yml +54 -0
  47. data/config/initializers/deepl.rb +5 -0
  48. data/config/routes.rb +5 -2
  49. data/lib/breeze/engine.rb +1 -1
  50. data/lib/breeze/version.rb +1 -1
  51. data/lib/breeze.rb +3 -1
  52. metadata +39 -11
@@ -24,6 +24,12 @@ module Breeze
24
24
  sum
25
25
  end
26
26
 
27
+ def translate(editor)
28
+ Breeze.language_strings.each do |lang|
29
+ sections.each{ |s | s.translate(lang, editor) }
30
+ end
31
+ end
32
+
27
33
  def sections
28
34
  Section.find_all(:page_id, id).sort_by{|obj| obj.index }
29
35
  end
@@ -32,6 +32,11 @@ module Breeze
32
32
  sum
33
33
  end
34
34
 
35
+ def translate(lang , editor)
36
+ super
37
+ cards.each{ |s | s.translate(lang, editor) }
38
+ end
39
+
35
40
  def cards
36
41
  Card.find_all(:section_id, id).sort_by{|obj| obj.index }
37
42
  end
@@ -51,6 +56,7 @@ module Breeze
51
56
  def set_template(new_template)
52
57
  self.template = new_template
53
58
  new_style = template_style
59
+ add_default_options
54
60
  if(new_style.has_cards?)
55
61
  if card_template.blank?
56
62
  self.card_template = CardStyle.first.template
@@ -58,6 +64,10 @@ module Breeze
58
64
  end
59
65
  end
60
66
 
67
+ def set_card_template(new_template)
68
+ self.card_template = new_template
69
+ end
70
+
61
71
  def allowed_fields
62
72
  super + [:page_id]
63
73
  end
@@ -14,7 +14,7 @@ module Breeze
14
14
  breeze_path = Breeze::Engine.root.join("config")
15
15
  breeze_res = YAML.load(File.read(File.join(breeze_path , fullname )))
16
16
 
17
- res + breeze_res
17
+ breeze_res + res
18
18
  end
19
19
  end
20
20
  end
@@ -37,6 +37,11 @@ module Breeze
37
37
  return object.header
38
38
  end
39
39
 
40
+ def is_manual?
41
+ return false unless data = object.data[language]
42
+ data[:manual] || false
43
+ end
44
+
40
45
  def get_text
41
46
  return "" unless data = object.data[language]
42
47
  data[:text] || ""
@@ -70,17 +75,26 @@ module Breeze
70
75
  object.data[language][:updated_at]
71
76
  end
72
77
 
73
- def update(hash , editor)
78
+ def update(hash , editor , manual )
74
79
  return unless hash
75
80
  set_text(hash[:text]) if hash.has_key?(:text)
76
81
  set_header(hash[:header]) if hash.has_key?(:header)
82
+ object.data[language] = {} unless object.data[language]
77
83
  object.data[language][:updated_by] = editor
78
84
  object.data[language][:updated_at] = Time.now
85
+ object.data[language][:manual] = manual
79
86
 
80
87
  ChangeSet.current.add(self.class.name , "#{language}:#{object.change_name}", editor)
81
88
  object.class.save_all
82
89
  end
83
90
 
91
+ def auto_translate(editor)
92
+ translated = { text: DeepL.translate(self.object.text, 'EN', self.language).text,
93
+ header: DeepL.translate(self.object.header, 'EN', self.language).text
94
+ }
95
+ self.update(translated, editor , false)
96
+ end
97
+
84
98
  # find according to id, ie class_num
85
99
  def self.find(id)
86
100
  clazz , lang , num = id.split("-")
@@ -23,10 +23,10 @@ module Breeze
23
23
  end
24
24
 
25
25
  def last_update_for(elements)
26
- last = Time.now
26
+ last = Time.now - 5.years
27
27
  last_section = nil
28
28
  elements.each do |section|
29
- if( section.updated_at < last )
29
+ if( section.updated_at > last )
30
30
  last = section.updated_at
31
31
  last_section = section
32
32
  end
@@ -58,13 +58,14 @@ module Breeze
58
58
  year = value[:year] || Time.new.year
59
59
  value = Time.new( year.to_i , value[:month] , value[:day]).to_date
60
60
  end
61
- safe_options[option] = value
61
+ safe_options[option] = value.to_s
62
62
  end
63
63
 
64
64
  def add_default_options( definitions = nil )
65
65
  definitions = option_definitions if definitions.nil?
66
66
  definitions.each do |option|
67
67
  next unless option.default
68
+ next unless option(option.name).blank?
68
69
  set_option( option.name , option.default)
69
70
  end
70
71
  end
@@ -90,6 +91,14 @@ module Breeze
90
91
  set_option(option.name, options[option.name])
91
92
  end
92
93
  end
94
+ def update_present_options( options )
95
+ return unless options
96
+ option_definitions.each do |option|
97
+ next unless options.has_key?(option.name)
98
+ set_option(option.name, options[option.name])
99
+ end
100
+ end
101
+
93
102
  #other may be nil
94
103
  def swap_index_with(other)
95
104
  return unless other
@@ -106,6 +115,11 @@ module Breeze
106
115
  Image.find_by_name(self.image_name)
107
116
  end
108
117
 
118
+ def translate(lang , editor)
119
+ trans = get_translation(lang)
120
+ trans.auto_translate(editor) if trans.is_old?
121
+ end
122
+
109
123
  def get_translation(lang)
110
124
  Translation.new( self , lang)
111
125
  end
@@ -1,27 +1,26 @@
1
- %script{:src => "https://cdn.jsdelivr.net/npm/vue@2.7.14/dist/vue.js"}
1
+ %script{:src => "https://cdn.jsdelivr.net/npm/vue@2.7.16/dist/vue.js"}
2
2
 
3
3
  %section.image
4
4
  .flex.justify-between.mx-20
5
5
  .flex.justify-between
6
6
  %div.justify-self-start.ml-20.mr-10
7
- %b Presets
8
- 600
9
- %input{ name: :pre, type: "radio", value: "600", "v-on:input": "handle_preset($event)" }/
10
- 800
11
- %input{ name: :pre, type: "radio", value: "800", "v-on:input": "handle_preset($event)" }/
12
- 1800
13
- %input{ name: :pre, type: "radio", value: "1800", "v-on:input": "handle_preset($event)" }/
14
- %br
15
7
  %b Scale {{scaled_x}} x {{scaled_y}}
8
+ %select.ml-4.mb-2.form-control{ "v-on:input": "handle_preset($event)" }
9
+ %option{ } Select a preset
10
+ %option{ value: "600", "v-on:input": "handle_preset($event)" } Card 600
11
+ %option{ value: "800", "v-on:input": "handle_preset($event)" } Half 800
12
+ %option{ value: "1200", "v-on:input": "handle_preset($event)" } 2/3 1200
13
+ %option{ value: "1800", "v-on:input": "handle_preset($event)" } Full 1800
14
+
16
15
  %br/
17
16
  %input{":min": 20 , ":max": 100 , ":step": 0.1 , :type => "range",
18
17
  "v-bind:value": "scale" , "v-on:input" => "handle_scale($event)"}/
19
18
 
20
19
  = form_tag( breeze.image_scale_path(image_id: image.id) ) do
21
20
  %input{ hidden: true , id: :scale_id , name: :scale , "v-bind:value": "scale" }
22
- %button.my-3.button.change Scale {{scale}} %
21
+ %button.button.change Scale {{scale}} %
23
22
 
24
- %div.mt-2
23
+ %div
25
24
  %b.pr-2 Ratio
26
25
  %br/
27
26
  %em {{ratio}} : 1
@@ -31,9 +30,9 @@
31
30
  %input{ hidden: true , id: :height_id , name: :size_y , "v-bind:value": "size_y" }
32
31
  %input{ hidden: true , id: :off_x_id , name: :off_x , "v-bind:value": "off_x" }
33
32
  %input{ hidden: true , id: :off_y_id , name: :off_y , "v-bind:value": "off_y" }
34
- %button.my-3.button.change Crop
33
+ %button.button.change Crop
35
34
 
36
- %div.mt-2.ml-32
35
+ %div.ml-32
37
36
  %b.pr-2 Fix ratio to
38
37
  %select{ "@change": "set_ratio"}
39
38
  %option{value: "0" } Any Ratio
@@ -44,11 +43,6 @@
44
43
 
45
44
  .flex.justify-between.mb-5
46
45
  %div.ml-20
47
- %b Y Offset {{off_y}}
48
- %br/
49
- %input.horizontal{":min": 0 , ":max": "#{image.height}", ":step": 1 , :type => "range",
50
- "v-bind:value": "off_y" , "v-on:input" => "handle_off_y($event)"}
51
- %div
52
46
  %b X Offset {{off_x}}
53
47
  %br/
54
48
  %input{":min": 0 , ":max": "#{image.width}", ":step": 1 , :type => "range",
@@ -58,16 +52,21 @@
58
52
  %br/
59
53
  %input{":min": 0 , ":max": "#{image.width}", ":step": 1 , :type => "range",
60
54
  "v-bind:value": "size_x" , "v-on:input" => "handle_size_x($event)"}
61
- %div.mr-20
55
+ %div
62
56
  %b Y Size {{size_y.toFixed(0)}}
63
57
  %br
64
58
  %input.horizontal{":min": 0 , ":max": "#{image.height}", ":step": 1 , :type => "range",
65
59
  "v-bind:value": "size_y" , "v-on:input" => "handle_size_y($event)"}
60
+ %div.mr-20
61
+ %b Y Offset {{off_y}}
62
+ %br/
63
+ %input.horizontal{":min": 0 , ":max": "#{image.height}", ":step": 1 , :type => "range",
64
+ "v-bind:value": "off_y" , "v-on:input" => "handle_off_y($event)"}
66
65
 
67
66
  .flex.justify-center
68
- .image-container.overflow-hidden.relative{ "v-bind:style": "{height: scaled_y + 'px' , width: scaled_x + 'px'} " }
69
- = image_tag(image.asset_name , class: "")
70
- .absolute.bg-transparent.border-4.border-black{ "v-bind:style": "{height: size_y + 'px' , width: size_x + 'px' , top: off_y + 'px', left: off_x + 'px' }" }
67
+ .image-container.overflow-hidden.relative{ "v-bind:style": "{height: (scaled_y/global_scale) + 'px' , width: (scaled_x/global_scale) + 'px'} " }
68
+ = image_tag(image.asset_name , class: "" , width: (@image.width / @global_scale).to_i , height: (@image.height/@global_scale).to_i)
69
+ .absolute.bg-transparent.border-4.border-black{ "v-bind:style": "{height: (size_y/global_scale).toFixed() + 'px' , width: (size_x/global_scale).toFixed() + 'px' , top: (off_y/global_scale).toFixed() + 'px', left: (off_x/global_scale).toFixed() + 'px' }" }
71
70
 
72
71
  :ruby2js
73
72
  class Images < Vue
@@ -76,6 +75,7 @@
76
75
  @image_data = #{@image_data.to_json.html_safe}
77
76
  @off_x = 0
78
77
  @off_y = 0
78
+ @global_scale = "#{@global_scale}"
79
79
  @scale = 100
80
80
  @size_x = @image_data[:width]
81
81
  @size_y = @image_data[:height]
@@ -1,4 +1,4 @@
1
- %script{:src => "https://cdn.jsdelivr.net/npm/vue@2.7.14/dist/vue.js"}
1
+ %script{:src => "https://cdn.jsdelivr.net/npm/vue@2.7.16/dist/vue.js"}
2
2
 
3
3
  .mx-6.md:mx-12.mx-20.flex.h-16.items-center.gap-16.justify-between
4
4
  .flex.gap-20
@@ -7,8 +7,10 @@
7
7
 
8
8
  = link_to(breeze.new_image_path(new_link_params) ) do
9
9
  .button.action New Image
10
- = link_to(breeze.images_path(unused: true) ) do
11
- .button.action Show unused Images
10
+ = link_to(breeze.images_path(unused: false) ) do
11
+ .button.bg-cyan-100 Show used
12
+ = link_to(breeze.images_path(unused: true) ) do
13
+ .button.bg-orange-100 Show unused
12
14
 
13
15
  .images
14
16
  .flex.justify-center.gap-4
@@ -45,7 +47,7 @@
45
47
  %strong.inline-block.rounded.bg-orange-50.px-3.py-1.text-md.font-medium
46
48
  {{image.updated_at}}
47
49
  %strong.rounded.h-10.bg-orange-50.px-5.py-2.font-medium
48
- {{image.tags}}
50
+ {{image.type}}
49
51
 
50
52
  .hidden.list
51
53
  -@images.each do |image|
@@ -1,11 +1,13 @@
1
- %script{:src => "https://cdn.jsdelivr.net/npm/vue@2.7.14/dist/vue.js"}
1
+ %script{:src => "https://cdn.jsdelivr.net/npm/vue@2.7.16/dist/vue.js"}
2
2
 
3
3
  .mx-6.md:mx-12.mx-20.flex.h-16.items-center.gap-16
4
4
  .text-xl.font-bold.text-gray-900
5
5
  Image: #{@image.name}
6
-
6
+ = @global_scale
7
7
  = form_tag( breeze.image_copy_path(@image.id) , method: :post) do
8
- %button.mx-40.button.change Copy
8
+ %button.mx-10.button.change Copy
9
+ %button.mx-10.button.change
10
+ = link_to "Download" , asset_path( @image.asset_name ) , download: :file
9
11
 
10
12
  .grid.grid-cols-3.gap-10
11
13
  %p
@@ -25,7 +27,10 @@
25
27
  %p.align-center Not used
26
28
  = form_tag( breeze.image_path(@image.id) , {method: :delete } ) do
27
29
  %button.button.remove{type: :submit} Delete
28
-
30
+ .py-2.px-4.bg-orange-100.rounded-md
31
+ - if(@global_scale > 1)
32
+ Downscaled by
33
+ = @global_scale
29
34
 
30
35
  .flex.m-20
31
36
  .left.flex.gap-2.mt-3
@@ -23,7 +23,11 @@
23
23
  %td.whitespace-nowrap.px-4.py-2.text-gray-700
24
24
  = page.sections.length
25
25
  %td.whitespace-nowrap.px-4.py-2.text-gray-700
26
- = link_to page.missing_translations , breeze.translation_path(page.id)
26
+ .flex.justify-between
27
+ = link_to page.missing_translations , breeze.translation_path(page.id)
28
+ = form_tag( breeze.page_translate_path(page_id: page.id)) do
29
+ %button.ml-2.rounded.bg-amber-100.px-3.text-xs.font-medium.text-amber-700{:class => "py-1.5"}
30
+ Auto
27
31
  %td.whitespace-nowrap.px-4.py-2.text-gray-700
28
32
  =page.updated_by
29
33
  - s = page.sections_update
@@ -1,83 +1,73 @@
1
1
  - @page.sections.each do |section|
2
2
  = render_section( section )
3
3
 
4
- .mx-6.md:mx-12.mx-20.flex.h-16.items-center.gap-16
4
+ .grid.grid-cols-4.mx-20.md:mx-12.gap-8.mt-8
5
5
  .text-xl.font-bold.text-gray-900
6
6
  = @page.type.capitalize
7
7
  = ":"
8
- .text-xl.font-bold.text-gray-900
9
8
  =@page.name
10
- %strong.rounded.bg-green-100.px-4.py-2.text-lg.font-medium.text-green-700{:class => "py-1.5"}
11
- = link_to 'Section details', breeze.page_sections_path(@page.id)
9
+ -unless @page.redirects.blank?
10
+ .mt-4
11
+ Page redirects from
12
+ = @page.redirects
13
+ %div
14
+ %button.button.change
15
+ = link_to 'Section details', breeze.page_sections_path(@page.id)
12
16
 
13
17
  = form_tag( breeze.section_new_path(@page.id), method: :post ) do
14
- %button.button.change.mr-3{type: :submit} New Section
18
+ %button.button.action{type: :submit} New Section
15
19
 
16
20
  .text-xl
17
21
  Edited
18
22
  = distance_of_time_in_words_to_now(@page.updated_at)
19
23
  ago
20
- .flex.gap-4.justify-center.m-20
21
- .grid.grid-cols-5
22
- .text.font-bold Section
23
- .text.font-bold Cards
24
- .text.font-bold Translations
25
- .text.font-bold Updated
26
- .text.font-bold Actions
27
- - @page.sections.each do |section |
28
- .span
29
- =link_to( breeze.section_path(section.id)) do
30
- #{section.index} : #{section.header}
31
- .text
32
- =link_to breeze.section_cards_path(section.id) do
33
- #{section.cards.length} Cards
34
- .text
35
- = link_to breeze.translation_path(@page.id) do
36
- %button.button.action
37
- =section.missing_translations
38
- missing
39
- .text
40
- = updated_by(section)
41
- .flex
42
- = form_tag( breeze.section_new_path(@page.id), method: :post ) do
43
- %button.button.change.mr-3{type: :submit} New
44
- = link_to breeze.section_path(section.id) do
45
- %button.button.action Edit
46
- .p-2
47
- =link_to(breeze.section_move_path(section.id , dir: :down)) do
48
- %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"}
49
- %path{:d => "M15.75 17.25L12 21m0 0l-3.75-3.75M12 21V3", "stroke-linecap" => "round", "stroke-linejoin" => "round"}
50
- .p-2
51
- =link_to(breeze.section_move_path(section.id , dir: :up)) do
52
- %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"}
53
- %path{:d => "M8.25 6.75L12 3m0 0l3.75 3.75M12 3v18", "stroke-linecap" => "round", "stroke-linejoin" => "round"}
54
24
 
55
- .flex.flex-col
56
- .basis-80
57
- = form_tag( breeze.page_path(@page.id) , {method: :patch , class: "mx-auto mt-8 mb-0 max-w space-y-4" } ) do
58
- %label.block
59
- %h4.text-lg.font-bold Name
60
- = text_field_tag( :name , @page.name, class: "w-full rounded-lg border-gray-200 p-4 pr-12 text-sm shadow-sm")
61
- %button.button.change.mt-4{type: :submit} Update name
25
+ = form_tag( breeze.page_path(@page.id) , {method: :patch , class: "mx-auto mt-8 mb-0 max-w space-y-4" } ) do
26
+ %h4.text-lg.font-bold Name
27
+ = text_field_tag( :name , @page.name, class: "w-full rounded-lg border-gray-200 p-4 text-sm shadow-sm")
28
+ %button.button.change.mt-4{type: :submit} Update name
62
29
 
63
- -unless @page.redirects.blank?
64
- .mt-4
65
- Page redirects from
66
- = @page.redirects
30
+ - @page.option_definitions.each do |option|
31
+ = form_tag( breeze.page_path(@page.id) , {method: :patch , class: "mx-auto mt-8 mb-0 max-w space-y-4" } ) do
32
+ =render "/breeze/sections/option_form_#{option.type}" , section: @page , option: option
33
+ %button.button.change.mt-4{type: :submit} Update #{option.name.camelcase}
67
34
 
68
- .relative.block.delete_page.mt-8
69
- = form_tag( breeze.page_path(@page.id) , {method: :delete } ) do
70
- %button.button.remove{type: :submit} Delete Page
35
+ = form_tag( breeze.page_path(@page.id) , {method: :delete } ) do
36
+ %button.button.mt-40.ml-10.remove{type: :submit} Delete Page
71
37
 
72
- .basis-80.grow.options
73
- %h3.mt-4.text-lg.font-bold Options
74
- = form_tag( breeze.page_path(@page.id) , {method: :patch , class: "mx-auto mt-8 mb-0 max-w space-y-4" } ) do
75
- - @page.option_definitions.each do |option|
76
- =render "/breeze/sections/option_form_#{option.type}" , section: @page , option: option
77
- -if @page.option_definitions.empty?
78
- %p No options
79
- -else
80
- %button.button.change.mt-4{type: :submit} Update Options
38
+ .grid.grid-cols-5.gap-8.m-20
39
+ .text.font-bold Section
40
+ .text.font-bold Actions
41
+ .text.font-bold Translations
42
+ .text.font-bold Cards
43
+ .text.font-bold Updated
44
+ - @page.sections.each do |section |
45
+ .span
46
+ =link_to( breeze.section_path(section.id)) do
47
+ #{section.index} : #{section.header}
48
+ .flex
49
+ = form_tag( breeze.section_new_path(@page.id), method: :post ) do
50
+ %button.button.change.mr-3{type: :submit} New
51
+ = link_to breeze.section_path(section.id) do
52
+ %button.button.action Edit
53
+ .p-2
54
+ =link_to(breeze.section_move_path(section.id , dir: :down)) do
55
+ %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"}
56
+ %path{:d => "M15.75 17.25L12 21m0 0l-3.75-3.75M12 21V3", "stroke-linecap" => "round", "stroke-linejoin" => "round"}
57
+ .p-2
58
+ =link_to(breeze.section_move_path(section.id , dir: :up)) do
59
+ %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"}
60
+ %path{:d => "M8.25 6.75L12 3m0 0l3.75 3.75M12 3v18", "stroke-linecap" => "round", "stroke-linejoin" => "round"}
61
+ .text
62
+ = link_to breeze.translation_path(@page.id) do
63
+ %button.button.action
64
+ =section.missing_translations
65
+ missing
66
+ .text
67
+ =link_to breeze.section_cards_path(section.id) do
68
+ #{section.cards.length} Cards
69
+ .text
70
+ = updated_by(section)
81
71
 
82
72
  :javascript
83
73
  var sections = #{ render( partial: "sections" , formats: :json).html_safe }
@@ -5,14 +5,22 @@
5
5
  %button{onclick: "button_ok(event)" , id: "#{trans.id}_idbutton"}
6
6
  = trans.object.index_name
7
7
  = trans.language
8
+ - if trans.is_manual?
9
+ .bg-orange-500.py-1.px-2.rounded-md
10
+ manual
8
11
  .grow
9
12
  .text{id: "#{trans.id}_headerfield" , onclick: "text_to_form(event)"}
10
13
  = trans.header
14
+ = form_tag( breeze.translation_auto_path(translation_id: trans.id)) do
15
+ %button.button.change.mt-4
16
+ Auto
11
17
  .grow
12
18
  .text{id: "#{trans.id}_textfield" , onclick: "text_to_form(event)" }
13
19
  = trans.text
14
20
  .hidden.form{id: "#{trans.id}_form"}
21
+ = trans.object.header
15
22
  %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}
23
+ = trans.object.text
16
24
  %textarea.mt-2.w-full.rounded-lg.border-gray-200.align-top.shadow-sm.sm:text-sm{ cols: 100 ,
17
25
  id: "#{trans.id}_text" , rows: rows(trans.text) }
18
26
  = trans.text
@@ -1,13 +1,13 @@
1
1
  .mx-6.md:mx-12.mx-20.flex.h-16.items-center.gap-16
2
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) )
3
+ - if previous = @page.previous_page
4
+ = link_to( "<< previous (#{previous&.name})" , breeze.translation_path(id: previous&.id) )
5
5
  .text-xl.font-bold.text-gray-900
6
6
  Page
7
7
  = @page.name
8
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) )
9
+ - if next_page = @page.next_page
10
+ = link_to( "(#{next_page.name}) next >> " , breeze.translation_path(id: next_page.id) )
11
11
 
12
12
  -Breeze.language_strings.each do |lang|
13
13
  -@page.sections.each do |section|
@@ -1,11 +1,13 @@
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%]"}
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
+ -unless( section.text_text(current_lang).blank?)
7
+ .section_text.mt-4.text-lg.pt-10{ prose_classes }
8
+ = markdown(section,current_lang)
9
+ .flex.items-center.justify-start.mx-10.md:mx-20.mb-20
10
+ .mx-auto.w-full.max-w-4xl{class: "max-w-[90%]"}
9
11
  = form_tag( main_app.post_form_path , {class: "mt-10" }) do
10
12
  - challenge = rand(8)
11
13
  = hidden_field_tag :section_id , section.id
@@ -16,8 +18,8 @@
16
18
  = render( template , card: card)
17
19
  .grid.gap-6.md:grid-cols-2
18
20
  .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]"}
21
+ %input.peer.block.w-full.appearance-none.border-0.border-b.border-gray-500.bg-transparent.px-0.text-gray-900.focus:border-blue-600.focus:outline-none.focus:ring-0{:class => "py-2.5", :name => "challenge", :placeholder => " ", :type => "text"}
22
+ %label.absolute.top-3.-z-10.-translate-y-6.scale-75.transform.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]"}
21
23
  = I18n.t("anti_bot")
22
24
  = challenge
23
25
  +
@@ -0,0 +1,32 @@
1
+ %section.m-6.md:m-12.lg:m-20{ options(section , :background , :text_color ), id: section.type_id}
2
+ .flex.justify-center
3
+ .px-4.py-4.md:py-10.lg:py-16{ options(section , :text_align , :margin)}
4
+ %h1.section_header.text-2xl.font-bold.tracking-tight.sm:text-4xl
5
+ = section.header_text(current_lang)
6
+ - unless section.text.blank?
7
+ .section_text.text-lg.pt-10{ prose_classes }
8
+ = markdown(section , current_lang)
9
+ - template = "breeze/view/cards/" + section.card_template
10
+ .flex.justify-center
11
+ .mt-8.space-y-4.md:mt-16{ options(section , :margin)}
12
+ - section.cards.each do |card|
13
+ = render( template , card: card )
14
+
15
+ :javascript
16
+ var section_id = "question#{section.id}" ;
17
+ // JavaScript to toggle the answers and rotate the arrows
18
+ document.querySelectorAll('[id^="question#{section.id}"]').forEach(function(button, index) {
19
+ button.addEventListener('click', function() {
20
+ var ind = button.id.split("_")[1];
21
+ var answer = document.getElementById('answer#{section.id}_' + ind);
22
+ var arrow = document.getElementById('arrow#{section.id}_' + ind);
23
+
24
+ if (answer.style.display === 'none' || answer.style.display === '') {
25
+ answer.style.display = 'block';
26
+ arrow.style.transform = 'rotate(0deg)';
27
+ } else {
28
+ answer.style.display = 'none';
29
+ arrow.style.transform = 'rotate(-180deg)';
30
+ }
31
+ });
32
+ });
@@ -7,4 +7,4 @@
7
7
  = section.header_text(current_lang)
8
8
  .section_text.sm:mt-4.text-2xl{ prose_classes }
9
9
  = markdown(section,current_lang)
10
- =view_button(section , "my-2")
10
+ =view_button(section , "my-4")
@@ -3,6 +3,7 @@
3
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
4
  %h1.section_header.text-2xl.font-bold.tracking-tight.sm:text-4xl
5
5
  = section.header_text(current_lang)
6
- .section_text.mt-4.text-lg.pt-10{ prose_classes }
7
- = markdown(section,current_lang)
8
- =view_button(section , "my-2")
6
+ -unless( section.text_text(current_lang).blank?)
7
+ .section_text.mt-4.text-lg.pt-10{ prose_classes }
8
+ = markdown(section,current_lang)
9
+ =view_button(section , "my-4")
@@ -7,4 +7,4 @@
7
7
  = section.header_text(current_lang)
8
8
  .section_text.mt-8{ prose_classes }
9
9
  = markdown(section,current_lang)
10
- =view_button(section , "my-2")
10
+ =view_button(section , "my-4")