sibu 0.8.1 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +20 -20
  3. data/README.md +38 -38
  4. data/Rakefile +36 -36
  5. data/app/assets/config/sibu_manifest.js +2 -2
  6. data/app/assets/fonts/sibu/Sibu.eot +0 -0
  7. data/app/assets/fonts/sibu/Sibu.svg +13 -13
  8. data/app/assets/fonts/sibu/Sibu.ttf +0 -0
  9. data/app/assets/fonts/sibu/Sibu.woff +0 -0
  10. data/app/assets/javascripts/cropper/cropper.js +3694 -3694
  11. data/app/assets/javascripts/quill/quill.js +11401 -11401
  12. data/app/assets/javascripts/sibu/common.js +6 -6
  13. data/app/assets/javascripts/sibu/sibu.js.erb +156 -155
  14. data/app/assets/javascripts/tabs/van11y-accessible-tab-panel-aria.js +465 -465
  15. data/app/assets/stylesheets/cropper/cropper.css +304 -304
  16. data/app/assets/stylesheets/quill/quill.snow.css +945 -945
  17. data/app/assets/stylesheets/sibu/defaults.scss +317 -336
  18. data/app/assets/stylesheets/sibu/icons.scss +40 -40
  19. data/app/assets/stylesheets/sibu/sibu.css +131 -131
  20. data/app/controllers/sibu/application_controller.rb +14 -14
  21. data/app/controllers/sibu/documents_controller.rb +35 -35
  22. data/app/controllers/sibu/images_controller.rb +78 -78
  23. data/app/controllers/sibu/pages_controller.rb +197 -197
  24. data/app/controllers/sibu/sites_controller.rb +81 -81
  25. data/app/helpers/sibu/application_helper.rb +11 -11
  26. data/app/helpers/sibu/documents_helper.rb +4 -4
  27. data/app/helpers/sibu/images_helper.rb +4 -4
  28. data/app/helpers/sibu/pages_helper.rb +217 -194
  29. data/app/helpers/sibu/sites_helper.rb +23 -23
  30. data/app/jobs/sibu/application_job.rb +4 -4
  31. data/app/mailers/sibu/application_mailer.rb +6 -6
  32. data/app/models/concerns/sibu/document_uploader.rb +8 -8
  33. data/app/models/concerns/sibu/image_uploader.rb +31 -31
  34. data/app/models/concerns/sibu/sections_concern.rb +134 -134
  35. data/app/models/concerns/sibu/style_uploader.rb +1 -1
  36. data/app/models/concerns/sibu/user_concern.rb +9 -8
  37. data/app/models/sibu/application_record.rb +5 -5
  38. data/app/models/sibu/document.rb +16 -16
  39. data/app/models/sibu/dynamic_style.rb +76 -76
  40. data/app/models/sibu/image.rb +10 -19
  41. data/app/models/sibu/page.rb +66 -66
  42. data/app/models/sibu/site.rb +97 -97
  43. data/app/models/sibu/site_template.rb +22 -22
  44. data/app/views/layouts/sibu/application.html.erb +23 -23
  45. data/app/views/layouts/sibu/edit_content.html.erb +262 -262
  46. data/app/views/layouts/sibu/site.html.erb +45 -45
  47. data/app/views/sibu/documents/_form.html.erb +14 -14
  48. data/app/views/sibu/documents/index.html.erb +37 -37
  49. data/app/views/sibu/documents/new.html.erb +12 -12
  50. data/app/views/sibu/images/_edit_form.html.erb +23 -23
  51. data/app/views/sibu/images/_form.html.erb +34 -34
  52. data/app/views/sibu/images/edit.js.erb +2 -2
  53. data/app/views/sibu/images/index.html.erb +31 -13
  54. data/app/views/sibu/images/new.html.erb +12 -12
  55. data/app/views/sibu/images/show.html.erb +2 -2
  56. data/app/views/sibu/pages/_code_edit_panel.html.erb +17 -17
  57. data/app/views/sibu/pages/_element_actions.html.erb +4 -4
  58. data/app/views/sibu/pages/_error_panel.html.erb +4 -4
  59. data/app/views/sibu/pages/_form.html.erb +62 -62
  60. data/app/views/sibu/pages/_group_edit_panel.html.erb +3 -3
  61. data/app/views/sibu/pages/_link_edit_panel.html.erb +50 -50
  62. data/app/views/sibu/pages/_map_edit_panel.html.erb +27 -27
  63. data/app/views/sibu/pages/_media_edit_panel.html.erb +63 -46
  64. data/app/views/sibu/pages/_new_section_panel.html.erb +43 -43
  65. data/app/views/sibu/pages/_paragraph_edit_panel.html.erb +18 -18
  66. data/app/views/sibu/pages/_text_edit_panel.html.erb +19 -19
  67. data/app/views/sibu/pages/child_element.js.erb +6 -6
  68. data/app/views/sibu/pages/clone_element.js.erb +6 -6
  69. data/app/views/sibu/pages/create_section.js.erb +6 -6
  70. data/app/views/sibu/pages/delete_element.js.erb +6 -6
  71. data/app/views/sibu/pages/delete_section.js.erb +6 -6
  72. data/app/views/sibu/pages/destroy.html.erb +2 -2
  73. data/app/views/sibu/pages/edit.html.erb +8 -8
  74. data/app/views/sibu/pages/edit_content.html.erb +3 -3
  75. data/app/views/sibu/pages/edit_element.js.erb +105 -100
  76. data/app/views/sibu/pages/edit_section.js.erb +7 -7
  77. data/app/views/sibu/pages/index.html.erb +40 -40
  78. data/app/views/sibu/pages/new.html.erb +8 -8
  79. data/app/views/sibu/pages/new_section.js.erb +19 -19
  80. data/app/views/sibu/pages/show.html.erb +3 -3
  81. data/app/views/sibu/pages/update.html.erb +2 -2
  82. data/app/views/sibu/pages/update_element.js.erb +5 -5
  83. data/app/views/sibu/pages/update_section.js.erb +5 -5
  84. data/app/views/sibu/sites/_form.html.erb +125 -125
  85. data/app/views/sibu/sites/destroy.html.erb +2 -2
  86. data/app/views/sibu/sites/edit.html.erb +9 -9
  87. data/app/views/sibu/sites/edit_styles.html.erb +8 -8
  88. data/app/views/sibu/sites/index.html.erb +41 -41
  89. data/app/views/sibu/sites/new.html.erb +18 -18
  90. data/app/views/sibu/sites/update.html.erb +2 -2
  91. data/config/initializers/constants.rb +2 -2
  92. data/config/initializers/shrine.rb +18 -18
  93. data/config/routes.rb +30 -30
  94. data/config/tinymce.yml +5 -5
  95. data/db/migrate/20180124095041_create_sibu_sites.rb +12 -12
  96. data/db/migrate/20180124095213_create_sibu_pages.rb +15 -15
  97. data/db/migrate/20180124145030_create_sibu_site_templates.rb +10 -10
  98. data/db/migrate/20180125231638_add_user_id_to_sites.rb +5 -5
  99. data/db/migrate/20180126114522_rename_url_to_path_in_pages.rb +5 -5
  100. data/db/migrate/20180126114628_add_domain_to_sites.rb +5 -5
  101. data/db/migrate/20180127211533_create_sibu_images.rb +11 -11
  102. data/db/migrate/20180208082317_rename_images_user_id_to_site_id.rb +5 -5
  103. data/db/migrate/20180208125024_rename_image_data_column.rb +5 -5
  104. data/db/migrate/20180210181644_add_defaults_to_site_templates.rb +6 -6
  105. data/db/migrate/20180214134653_add_fields_to_sites.rb +5 -5
  106. data/db/migrate/20180227151519_add_default_templates_to_site_templates.rb +5 -5
  107. data/db/migrate/20180301121902_add_style_data_to_sites.rb +5 -5
  108. data/db/migrate/20180301152101_add_default_styles_to_templates.rb +5 -5
  109. data/db/migrate/20180321144021_move_images_to_user_level.rb +7 -7
  110. data/db/migrate/20180321170310_add_version_to_sibu_sites.rb +7 -7
  111. data/db/migrate/20180405095448_create_sibu_documents.rb +10 -10
  112. data/db/migrate/20190110204854_add_custom_data_to_sibu_pages.rb +5 -5
  113. data/lib/sibu.rb +4 -4
  114. data/lib/sibu/engine.rb +19 -19
  115. data/lib/sibu/utils.rb +14 -14
  116. data/lib/sibu/version.rb +3 -3
  117. data/lib/tasks/sibu_tasks.rake +4 -4
  118. metadata +7 -7
@@ -1,5 +1,5 @@
1
- <div id="element_actions">
2
- <button id="clone_elt" onclick="cloneElement('<%= @entity_type %>', '<%= @section_id %>', '<%= @element_id %>')">Dupliquer</button>
3
- <button id="duplicate_elt" onclick="deleteElement('<%= @entity_type %>', '<%= @section_id %>', '<%= @element_id %>')">Supprimer</button>
4
- <button id="child_elt" onclick="addChildElement('<%= @entity_type %>', '<%= @section_id %>', '<%= @element_id %>')">Ajouter un sous-menu</button>
1
+ <div id="element_actions">
2
+ <button id="clone_elt" onclick="cloneElement('<%= @entity_type %>', '<%= @section_id %>', '<%= @element_id %>')">Dupliquer</button>
3
+ <button id="duplicate_elt" onclick="deleteElement('<%= @entity_type %>', '<%= @section_id %>', '<%= @element_id %>')">Supprimer</button>
4
+ <button id="child_elt" onclick="addChildElement('<%= @entity_type %>', '<%= @section_id %>', '<%= @element_id %>')">Ajouter un sous-menu</button>
5
5
  </div>
@@ -1,4 +1,4 @@
1
- <div class="sibu_edit_form">
2
- <p>Une erreur s'est produite lors de l'édition de cet élément.</p>
3
- <%= link_to 'Annuler', '#', onclick: 'cancelEdit(); return false;' %>
4
- </div>
1
+ <div class="sibu_edit_form">
2
+ <p>Une erreur s'est produite lors de l'édition de cet élément.</p>
3
+ <%= link_to 'Annuler', '#', onclick: 'cancelEdit(); return false;' %>
4
+ </div>
@@ -1,63 +1,63 @@
1
- <%= form_for([@site, @page]) do |f| %>
2
- <div class="sibu_field">
3
- <%= f.label :name, 'Nom de la page' %>
4
- <div>
5
- <%= f.text_field :name, placeholder: "Ex: Accueil, contact..." %>
6
- <small>Libellé utilisé dans l'outil d'administration (non utilisé dans le site)</small>
7
- </div>
8
- </div>
9
- <div class="sibu_field">
10
- <%= f.label :path, "Chemin d'accès" %>
11
- <div>
12
- <%= f.text_field :path, placeholder: "Laisser vide pour le générer automatiquement" %>
13
- <small>L'adresse (ou URL) de la page, utilisée par les navigateurs web pour y accéder</small>
14
- </div>
15
- </div>
16
- <div class="sibu_field">
17
- <%= f.label :is_home, "Page d'accueil" %>
18
- <div>
19
- <%= f.check_box :is_home, {}, 'true', 'false' %><span>Cocher pour faire de cette page la page d'accueil.</span>
20
- <small>Le chemin d'accès de la page d'accueil sera automatiquement mis à jour.</small>
21
- </div>
22
- </div>
23
- <div class="sibu_field">
24
- <%= f.label :title, 'Titre' %>
25
- <div>
26
- <%= f.text_field :title, placeholder: "Maximum 80 caractères", maxlength: 80 %>
27
- <small>Le titre sera affiché dans les résultats des moteurs de recherche et dans les onglets des navigateurs</small>
28
- </div>
29
- </div>
30
- <div class="sibu_field">
31
- <%= f.label :description, 'Description' %>
32
- <div>
33
- <%= f.text_area :description, placeholder: "Maximum 300 caractères", maxlength: 300 %>
34
- <small>La description est affichée dans les résultats des moteurs de recherche</small>
35
- </div>
36
- </div>
37
- <div class="sibu_field">
38
- <%= f.label :keywords, 'Mots-clé' %>
39
- <div>
40
- <%= f.text_area :keywords, placeholder: "Mots-clé utilisés dans votre site" %>
41
- <small>Une liste de mots-clé décrivant le contenu de votre site (optionnelle)</small>
42
- </div>
43
- </div>
44
- <div class="sibu_field">
45
- <%= f.label :header_code, "Code d'entête personnalisé" %>
46
- <div>
47
- <%= f.text_area :header_code, placeholder: "Code JS ou CSS (avec les balises <script> ou <style>)", rows: 6 %>
48
- <small>Ce code javascript ou CSS sera inséré dans l'entête du site pour cette page uniquement</small>
49
- </div>
50
- </div>
51
- <div class="sibu_field">
52
- <%= f.label :footer_code, 'Code de pied de page personnalisé' %>
53
- <div>
54
- <%= f.text_area :footer_code, placeholder: "Code JS ou CSS (avec les balises <script> ou <style>)", rows: 6 %>
55
- <small>Ce code javascript ou CSS sera inséré juste avant la balide fermante &lt;/body&gt; pour cette page uniquement</small>
56
- </div>
57
- </div>
58
- <%= f.hidden_field :site_id %>
59
- <div class="sibu_actions">
60
- <%= f.submit 'Valider' %>
61
- <%= link_to 'Annuler', :back %>
62
- </div>
1
+ <%= form_for([@site, @page]) do |f| %>
2
+ <div class="sibu_field">
3
+ <%= f.label :name, 'Nom de la page' %>
4
+ <div>
5
+ <%= f.text_field :name, placeholder: "Ex: Accueil, contact..." %>
6
+ <small>Libellé utilisé dans l'outil d'administration (non utilisé dans le site)</small>
7
+ </div>
8
+ </div>
9
+ <div class="sibu_field">
10
+ <%= f.label :path, "Chemin d'accès" %>
11
+ <div>
12
+ <%= f.text_field :path, placeholder: "Laisser vide pour le générer automatiquement" %>
13
+ <small>L'adresse (ou URL) de la page, utilisée par les navigateurs web pour y accéder</small>
14
+ </div>
15
+ </div>
16
+ <div class="sibu_field">
17
+ <%= f.label :is_home, "Page d'accueil" %>
18
+ <div>
19
+ <%= f.check_box :is_home, {}, 'true', 'false' %><span>Cocher pour faire de cette page la page d'accueil.</span>
20
+ <small>Le chemin d'accès de la page d'accueil sera automatiquement mis à jour.</small>
21
+ </div>
22
+ </div>
23
+ <div class="sibu_field">
24
+ <%= f.label :title, 'Titre' %>
25
+ <div>
26
+ <%= f.text_field :title, placeholder: "Maximum 80 caractères", maxlength: 80 %>
27
+ <small>Le titre sera affiché dans les résultats des moteurs de recherche et dans les onglets des navigateurs</small>
28
+ </div>
29
+ </div>
30
+ <div class="sibu_field">
31
+ <%= f.label :description, 'Description' %>
32
+ <div>
33
+ <%= f.text_area :description, placeholder: "Maximum 300 caractères", maxlength: 300 %>
34
+ <small>La description est affichée dans les résultats des moteurs de recherche</small>
35
+ </div>
36
+ </div>
37
+ <div class="sibu_field">
38
+ <%= f.label :keywords, 'Mots-clé' %>
39
+ <div>
40
+ <%= f.text_area :keywords, placeholder: "Mots-clé utilisés dans votre site" %>
41
+ <small>Une liste de mots-clé décrivant le contenu de votre site (optionnelle)</small>
42
+ </div>
43
+ </div>
44
+ <div class="sibu_field">
45
+ <%= f.label :header_code, "Code d'entête personnalisé" %>
46
+ <div>
47
+ <%= f.text_area :header_code, placeholder: "Code JS ou CSS (avec les balises <script> ou <style>)", rows: 6 %>
48
+ <small>Ce code javascript ou CSS sera inséré dans l'entête du site pour cette page uniquement</small>
49
+ </div>
50
+ </div>
51
+ <div class="sibu_field">
52
+ <%= f.label :footer_code, 'Code de pied de page personnalisé' %>
53
+ <div>
54
+ <%= f.text_area :footer_code, placeholder: "Code JS ou CSS (avec les balises <script> ou <style>)", rows: 6 %>
55
+ <small>Ce code javascript ou CSS sera inséré juste avant la balide fermante &lt;/body&gt; pour cette page uniquement</small>
56
+ </div>
57
+ </div>
58
+ <%= f.hidden_field :site_id %>
59
+ <div class="sibu_actions">
60
+ <%= f.submit 'Valider' %>
61
+ <%= link_to 'Annuler', :back %>
62
+ </div>
63
63
  <% end %>
@@ -1,3 +1,3 @@
1
- <h2>Modifier le groupe</h2>
2
- <div id="edit_msg"></div>
3
- <%= render 'element_actions' %>
1
+ <h2>Modifier le groupe</h2>
2
+ <div id="edit_msg"></div>
3
+ <%= render 'element_actions' %>
@@ -1,50 +1,50 @@
1
- <h2>Modifier le lien</h2>
2
- <div id="edit_msg"></div>
3
- <%= render 'element_actions' %>
4
- <div class="sibu_edit_form">
5
- <%= form_tag(update_element_site_page_path(@site.id, @page.id), method: :patch, remote: true) do |f| %>
6
- <% current_type = link_type(@element["value"]) %>
7
- <div class="sibu_field">
8
- <%= label_tag 'element[text]', 'Libellé' %>
9
- <%= text_field_tag 'element[text]', @element["text"] %>
10
- </div>
11
- <div id="link_internal" class="sibu_field link_mode">
12
- <%= radio_button_tag :mode, 'internal', current_type == 'internal', class: 'radio' %>
13
- <%= label_tag 'mode_internal', 'Lien vers une page du site' %>
14
- <%= select_tag 'element[value]', available_links, prompt: 'Sélectionnez une page', disabled: current_type != 'internal' %>
15
- <%= hidden_field_tag 'element[target]', '_self', disabled: current_type != 'internal' %>
16
- </div>
17
- <div id="link_external" class="sibu_field link_mode">
18
- <%= radio_button_tag :mode, 'external', current_type == 'external', class: 'radio' %>
19
- <%= label_tag 'mode_external', 'Lien personnalisé' %>
20
- <%= text_field_tag 'element[value]', (@element["value"] if current_type == 'external'), placeholder: 'Ex : http://www.un-site.com', disabled: current_type != 'external' %>
21
- <%= hidden_field_tag 'element[target]', '_blank', disabled: current_type != 'external' %>
22
- </div>
23
- <div id="link_email" class="sibu_field link_mode">
24
- <%= radio_button_tag :mode, 'email', current_type == 'email', class: 'radio' %>
25
- <%= label_tag 'mode_external', 'Lien vers un Email' %>
26
- <%= text_field_tag 'element[value]', (@element["value"] if current_type == 'email'), placeholder: 'Ex : email@exemple.fr', disabled: current_type != 'email' %>
27
- <%= hidden_field_tag 'element[target]', '_blank', disabled: current_type != 'email' %>
28
- </div>
29
- <div id="link_document" class="sibu_field link_mode">
30
- <%= radio_button_tag :mode, 'document', current_type == 'document', class: 'radio' %>
31
- <%= label_tag 'mode_document', 'Lien vers un document' %>
32
- <%= select_tag 'element[value]', available_docs, prompt: 'Sélectionnez un document', disabled: current_type != 'document' %>
33
- <%= hidden_field_tag 'element[target]', '_blank', disabled: current_type != 'document' %>
34
- </div>
35
- <%= hidden_field_tag 'element[id]', @element["id"] %>
36
- <!-- Note : to be tested on multiple nested elements -->
37
- <% (@element["elements"] || []).each do |e| %>
38
- <% e.each_pair do |k, v| %>
39
- <%= hidden_field_tag("element[elements][][#{k}]", v) unless v.blank? %>
40
- <% end %>
41
- <% end %>
42
- <%= hidden_field_tag :element_id, @element_id %>
43
- <%= hidden_field_tag :section_id, @section_id %>
44
- <%= hidden_field_tag :entity, @entity_type %>
45
- <div class="sibu_actions">
46
- <%= submit_tag 'Valider' %>
47
- <%= link_to 'Annuler', '#', onclick: 'cancelEdit(); return false;' %>
48
- </div>
49
- <% end %>
50
- </div>
1
+ <h2>Modifier le lien</h2>
2
+ <div id="edit_msg"></div>
3
+ <%= render 'element_actions' %>
4
+ <div class="sibu_edit_form">
5
+ <%= form_tag(update_element_site_page_path(@site.id, @page.id), method: :patch, remote: true) do |f| %>
6
+ <% current_type = link_type(@element["value"]) %>
7
+ <div class="sibu_field">
8
+ <%= label_tag 'element[text]', 'Libellé' %>
9
+ <%= text_field_tag 'element[text]', @element["text"] %>
10
+ </div>
11
+ <div id="link_internal" class="sibu_field link_mode">
12
+ <%= radio_button_tag :mode, 'internal', current_type == 'internal', class: 'radio' %>
13
+ <%= label_tag 'mode_internal', 'Lien vers une page du site' %>
14
+ <%= select_tag 'element[value]', available_links, prompt: 'Sélectionnez une page', disabled: current_type != 'internal' %>
15
+ <%= hidden_field_tag 'element[target]', '_self', disabled: current_type != 'internal' %>
16
+ </div>
17
+ <div id="link_external" class="sibu_field link_mode">
18
+ <%= radio_button_tag :mode, 'external', current_type == 'external', class: 'radio' %>
19
+ <%= label_tag 'mode_external', 'Lien personnalisé' %>
20
+ <%= text_field_tag 'element[value]', (@element["value"] if current_type == 'external'), placeholder: 'Ex : http://www.un-site.com', disabled: current_type != 'external' %>
21
+ <%= hidden_field_tag 'element[target]', '_blank', disabled: current_type != 'external' %>
22
+ </div>
23
+ <div id="link_email" class="sibu_field link_mode">
24
+ <%= radio_button_tag :mode, 'email', current_type == 'email', class: 'radio' %>
25
+ <%= label_tag 'mode_external', 'Lien vers un Email' %>
26
+ <%= text_field_tag 'element[value]', (@element["value"] if current_type == 'email'), placeholder: 'Ex : email@exemple.fr', disabled: current_type != 'email' %>
27
+ <%= hidden_field_tag 'element[target]', '_blank', disabled: current_type != 'email' %>
28
+ </div>
29
+ <div id="link_document" class="sibu_field link_mode">
30
+ <%= radio_button_tag :mode, 'document', current_type == 'document', class: 'radio' %>
31
+ <%= label_tag 'mode_document', 'Lien vers un document' %>
32
+ <%= select_tag 'element[value]', available_docs, prompt: 'Sélectionnez un document', disabled: current_type != 'document' %>
33
+ <%= hidden_field_tag 'element[target]', '_blank', disabled: current_type != 'document' %>
34
+ </div>
35
+ <%= hidden_field_tag 'element[id]', @element["id"] %>
36
+ <!-- Note : to be tested on multiple nested elements -->
37
+ <% (@element["elements"] || []).each do |e| %>
38
+ <% e.each_pair do |k, v| %>
39
+ <%= hidden_field_tag("element[elements][][#{k}]", v) unless v.blank? %>
40
+ <% end %>
41
+ <% end %>
42
+ <%= hidden_field_tag :element_id, @element_id %>
43
+ <%= hidden_field_tag :section_id, @section_id %>
44
+ <%= hidden_field_tag :entity, @entity_type %>
45
+ <div class="sibu_actions">
46
+ <%= submit_tag 'Valider' %>
47
+ <%= link_to 'Annuler', '#', onclick: 'cancelEdit(); return false;' %>
48
+ </div>
49
+ <% end %>
50
+ </div>
@@ -1,27 +1,27 @@
1
- <h2>Modifier la carte</h2>
2
- <div id="edit_msg"></div>
3
- <div class="sibu_edit_form">
4
- <%= form_tag(update_element_site_page_path(@site.id, @page.id), method: :patch, remote: true) do |f| %>
5
- <div class="sibu_field">
6
- <%= label_tag 'element[data-lat]', 'Latitude' %>
7
- <%= text_field_tag 'element[data-lat]', @element["data-lat"] %>
8
- </div>
9
- <div class="sibu_field">
10
- <%= label_tag 'element[data-lng]', 'Longitude' %>
11
- <%= text_field_tag 'element[data-lng]', @element["data-lng"] %>
12
- </div>
13
- <div class="sibu_field">
14
- <%= label_tag 'element[data-title]', 'Libellé' %>
15
- <%= text_field_tag 'element[data-title]', @element["data-title"] %>
16
- </div>
17
- <%= hidden_field_tag 'element[id]', @element["id"] %>
18
- <%= hidden_field_tag :element_id, @element_id %>
19
- <%= hidden_field_tag :section_id, @section_id %>
20
- <%= hidden_field_tag :entity, @entity_type %>
21
- <%= hidden_field_tag :refresh, true %>
22
- <div class="sibu_actions">
23
- <%= submit_tag 'Valider' %>
24
- <%= link_to 'Annuler', '#', onclick: 'cancelEdit(); return false;' %>
25
- </div>
26
- <% end %>
27
- </div>
1
+ <h2>Modifier la carte</h2>
2
+ <div id="edit_msg"></div>
3
+ <div class="sibu_edit_form">
4
+ <%= form_tag(update_element_site_page_path(@site.id, @page.id), method: :patch, remote: true) do |f| %>
5
+ <div class="sibu_field">
6
+ <%= label_tag 'element[data-lat]', 'Latitude' %>
7
+ <%= text_field_tag 'element[data-lat]', @element["data-lat"] %>
8
+ </div>
9
+ <div class="sibu_field">
10
+ <%= label_tag 'element[data-lng]', 'Longitude' %>
11
+ <%= text_field_tag 'element[data-lng]', @element["data-lng"] %>
12
+ </div>
13
+ <div class="sibu_field">
14
+ <%= label_tag 'element[data-title]', 'Libellé' %>
15
+ <%= text_field_tag 'element[data-title]', @element["data-title"] %>
16
+ </div>
17
+ <%= hidden_field_tag 'element[id]', @element["id"] %>
18
+ <%= hidden_field_tag :element_id, @element_id %>
19
+ <%= hidden_field_tag :section_id, @section_id %>
20
+ <%= hidden_field_tag :entity, @entity_type %>
21
+ <%= hidden_field_tag :refresh, true %>
22
+ <div class="sibu_actions">
23
+ <%= submit_tag 'Valider' %>
24
+ <%= link_to 'Annuler', '#', onclick: 'cancelEdit(); return false;' %>
25
+ </div>
26
+ <% end %>
27
+ </div>
@@ -1,47 +1,64 @@
1
- <h2>Modifier l'image</h2>
2
- <div id="edit_msg"></div>
3
- <%= render 'element_actions' %>
4
- <div class="sibu_edit_form">
5
- <%= form_tag(update_element_site_page_path(@site.id, @page.id), method: :patch, remote: true) do |f| %>
6
- <div class="sibu_image_selection">
7
- <div class="sibu_select_images sibu_field">
8
- <p>Sélectionnez ou <%= link_to 'téléchargez', new_image_path(page_id: @page.id, section_id: @section_id, entity_type: @entity_type,
9
- element_id: @element_id, img_id: @element["id"], size: @size) %> une image</p>
10
- <% site_images.each_with_index do |image, i| %>
11
- <div class="sibu_image" data-img-id="<%= image.id %>">
12
- <% if i == 0 %><span>Aucune image</span><% end %>
13
- <%= image_tag image.file_url(:small), class: (@element["src"] == image.file_url(@size) ? 'selected' : ''),
14
- data: {src: image.file_url(@size), alt: image.alt} %>
15
- </div>
16
- <% end %>
17
- </div>
18
- <div class="sibu_selected_image">
19
- <% if @element["src"] == DEFAULT_IMG || @element["src"].blank? %>
20
- <p>Veuillez sélectionner une image.</p>
21
- <% end %>
22
- <div class="sibu_custom_center" style="display: <%= (@element["src"] == DEFAULT_IMG || @element["src"].blank?) ? 'none' : 'block' %>">
23
- <%= check_box_tag('custom_center', true, (!@element["class"].blank? && @element["class"].include?('posx')), id: 'custom_center', class: 'checkbox') %>
24
- <%= label_tag 'custom_center', "Recentrer l'image" %>
25
- </div>
26
- <div class="sibu_center">
27
- <%= image_tag(@element["src"]) unless @element["src"] == DEFAULT_IMG || @element["src"].blank? %>
28
- <div id="sibu_center_pos" style="display: none;">✕</div>
29
- </div>
30
- <div class="sibu_field" style="display: <%= (@element["src"] == DEFAULT_IMG || @element["src"].blank?) ? 'none' : 'block' %>">
31
- <%= label_tag 'element[alt]', 'Légende / texte alternatif' %>
32
- <%= text_field_tag 'element[alt]', @element["alt"] %>
33
- </div>
34
- </div>
35
- </div>
36
- <%= hidden_field_tag 'element[id]', @element["id"] %>
37
- <%= hidden_field_tag 'element[src]', @element["src"] %>
38
- <%= hidden_field_tag 'element[class]', @element["class"] %>
39
- <%= hidden_field_tag :element_id, @element_id %>
40
- <%= hidden_field_tag :section_id, @section_id %>
41
- <%= hidden_field_tag :entity, @entity_type %>
42
- <div class="sibu_actions">
43
- <%= submit_tag 'Valider' %>
44
- <%= link_to 'Annuler', '#', onclick: 'cancelEdit(); return false;' %>
45
- </div>
46
- <% end %>
1
+ <h2>Modifier l'image</h2>
2
+ <div id="edit_msg"></div>
3
+ <%= render 'element_actions' %>
4
+ <div class="sibu_edit_form">
5
+ <%= form_tag(update_element_site_page_path(@site.id, @page.id), method: :patch, remote: true) do |f| %>
6
+ <div class="sibu_image_selection">
7
+ <div class="sibu_select_images sibu_field">
8
+ <p>Sélectionnez ou <%= link_to 'téléchargez', new_image_path(page_id: @page.id, section_id: @section_id, entity_type: @entity_type,
9
+ element_id: @element_id, img_id: @element["id"], size: @size) %> une image</p>
10
+ <table class="sibu_images">
11
+ <thead>
12
+ <tr>
13
+ <th>Aperçu</th>
14
+ <th>Descriptif</th>
15
+ <th>Crédits</th>
16
+ </tr>
17
+ </thead>
18
+ <tbody>
19
+ <% site_images.each do |image| %>
20
+ <tr>
21
+ <td>
22
+ <span class="sibu_image" data-img-id="<%= image.id %>">
23
+ <%= image_tag image.file_url(:small), class: (@element["src"] == image.file_url(@size) ? 'selected' : ''),
24
+ data: {src: image.file_url(@size), alt: image.alt} %>
25
+ </span>
26
+ </td>
27
+ <td><%= image.alt %></td>
28
+ <td><%= image.credits %></td>
29
+ </tr>
30
+ <% end %>
31
+ </tbody>
32
+ </table>
33
+ </div>
34
+ <div class="sibu_selected_image">
35
+ <% if @element["src"] == DEFAULT_IMG || @element["src"].blank? %>
36
+ <p>Veuillez sélectionner une image.</p>
37
+ <% end %>
38
+ <div class="sibu_custom_center" style="display: <%= (@element["src"] == DEFAULT_IMG || @element["src"].blank?) ? 'none' : 'block' %>">
39
+ <%= check_box_tag('custom_center', true, (!@element["class"].blank? && @element["class"].include?('posx')), id: 'custom_center', class: 'checkbox') %>
40
+ <%= label_tag 'custom_center', "Recentrer l'image" %>
41
+ </div>
42
+ <div class="sibu_center">
43
+ <%= image_tag(@element["src"]) unless @element["src"] == DEFAULT_IMG || @element["src"].blank? %>
44
+ <div id="sibu_center_pos" style="display: none;">✕</div>
45
+ <div id="sibu_center_desc" style="display: none;"><em>Cliquez sur l'image pour la recentrer sur un point donné (à utiliser lorsque l'image est tronquée car la zone d'affichage est trop petite).</em></div>
46
+ </div>
47
+ <div class="sibu_field" style="display: <%= (@element["src"] == DEFAULT_IMG || @element["src"].blank?) ? 'none' : 'block' %>">
48
+ <%= label_tag 'element[alt]', 'Légende / texte alternatif' %>
49
+ <%= text_field_tag 'element[alt]', @element["alt"] %>
50
+ </div>
51
+ </div>
52
+ </div>
53
+ <%= hidden_field_tag 'element[id]', @element["id"] %>
54
+ <%= hidden_field_tag 'element[src]', @element["src"] %>
55
+ <%= hidden_field_tag 'element[class]', @element["class"] %>
56
+ <%= hidden_field_tag :element_id, @element_id %>
57
+ <%= hidden_field_tag :section_id, @section_id %>
58
+ <%= hidden_field_tag :entity, @entity_type %>
59
+ <div class="sibu_actions">
60
+ <%= submit_tag 'Valider' %>
61
+ <%= link_to 'Annuler', '#', onclick: 'cancelEdit(); return false;' %>
62
+ </div>
63
+ <% end %>
47
64
  </div>
@@ -1,43 +1,43 @@
1
- <div class="sibu_panel sibu_view">
2
- <h2>Choix du type de section</h2>
3
- <div id="edit_msg"></div>
4
- </div>
5
- <div>
6
- <div class="sibu_sections sibu_site_content">
7
- <div id="<%= "#{@site.site_template.reference}_sections" %>" class="sibu_sections_tabs">
8
- <% sections_by_category = sections_templates.group_by {|st| st['category']} %>
9
- <div class="js-tabs">
10
- <ul class="js-tablist" data-existing-hx="h3">
11
- <% sections_by_category.keys.each do |cat| %>
12
- <li class="js-tablist__item">
13
- <a href="#<%= cat %>" class="js-tablist__link" data-selected="1"><%= t "sibu.section.category.#{cat}" %></a>
14
- </li>
15
- <% end %>
16
- </ul>
17
- <% sections_by_category.each_pair do |cat, sections| %>
18
- <div id="<%= cat %>" class="js-tabcontent">
19
- <h3 style="display: none;"><%= t "sibu.section.category.#{cat}" %></h3>
20
- <% sections.each do |st| %>
21
- <div data-sb-template="<%= st["template"] %>" data-sb-category="<%= st["category"] %>">
22
- <%= render "shared/#{@site.section_template(st)}", sec: st %>
23
- </div>
24
- <% end %>
25
- </div>
26
- <% end %>
27
- </div>
28
- </div>
29
- </div>
30
- <%= form_tag(create_section_site_page_path(@site.id, @page.id), method: :post, remote: true) do |f| %>
31
- <%= hidden_field_tag 'section[template]', '' %>
32
- <%= hidden_field_tag 'section[category]', '' %>
33
- <%= hidden_field_tag :section_id, @section_id %>
34
- <%= hidden_field_tag :after, @after%>
35
- <%= hidden_field_tag :entity, @entity_type %>
36
- <div class="sibu_panel sibu_view">
37
- <div class="sibu_actions">
38
- <%= submit_tag 'Valider' %>
39
- <%= link_to 'Annuler', '#', onclick: 'cancelSectionsEdit(); return false;' %>
40
- </div>
41
- </div>
42
- <% end %>
43
- </div>
1
+ <div class="sibu_panel sibu_view">
2
+ <h2>Choix du type de section</h2>
3
+ <div id="edit_msg"></div>
4
+ </div>
5
+ <div>
6
+ <div class="sibu_sections sibu_site_content">
7
+ <div id="<%= "#{@site.site_template.reference}_sections" %>" class="sibu_sections_tabs">
8
+ <% sections_by_category = sections_templates.group_by {|st| st['category']} %>
9
+ <div class="js-tabs">
10
+ <ul class="js-tablist" data-existing-hx="h3">
11
+ <% sections_by_category.keys.each do |cat| %>
12
+ <li class="js-tablist__item">
13
+ <a href="#<%= cat %>" class="js-tablist__link" data-selected="1"><%= t "sibu.section.category.#{cat}" %></a>
14
+ </li>
15
+ <% end %>
16
+ </ul>
17
+ <% sections_by_category.each_pair do |cat, sections| %>
18
+ <div id="<%= cat %>" class="js-tabcontent">
19
+ <h3 style="display: none;"><%= t "sibu.section.category.#{cat}" %></h3>
20
+ <% sections.each do |st| %>
21
+ <div data-sb-template="<%= st["template"] %>" data-sb-category="<%= st["category"] %>">
22
+ <%= render "shared/#{@site.section_template(st)}", sec: st %>
23
+ </div>
24
+ <% end %>
25
+ </div>
26
+ <% end %>
27
+ </div>
28
+ </div>
29
+ </div>
30
+ <%= form_tag(create_section_site_page_path(@site.id, @page.id), method: :post, remote: true) do |f| %>
31
+ <%= hidden_field_tag 'section[template]', '' %>
32
+ <%= hidden_field_tag 'section[category]', '' %>
33
+ <%= hidden_field_tag :section_id, @section_id %>
34
+ <%= hidden_field_tag :after, @after%>
35
+ <%= hidden_field_tag :entity, @entity_type %>
36
+ <div class="sibu_panel sibu_view">
37
+ <div class="sibu_actions">
38
+ <%= submit_tag 'Valider' %>
39
+ <%= link_to 'Annuler', '#', onclick: 'cancelSectionsEdit(); return false;' %>
40
+ </div>
41
+ </div>
42
+ <% end %>
43
+ </div>