sibu 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9eef09b553f04e3afe7993fb6ad105658ac1c75e
4
- data.tar.gz: 863489cd77c8b2d09a2d9bfc404c1062a433a5a0
3
+ metadata.gz: 4d33c05a8f28003ffbba1f9179108d5450235fa8
4
+ data.tar.gz: 57a4403853373b807840969d1f6f6ff1ab45647c
5
5
  SHA512:
6
- metadata.gz: 8b88cb21dfe1e0e34ccf60c4cb1d383ac93f35fe739ef7787c8c4e33daabfcc31d422be33d58cb6dd0738d9bed29fdc6b959fc3b7aae474ea49a64ea69a7ae29
7
- data.tar.gz: 809e4cdb6a9956a31beba6648ba3f5cafae72de4206f0ce043f8c638cc8aacfc7920208e4a0611d5bf42890145c655453bb68b6da38e3e7248450943f1e5dfe9
6
+ metadata.gz: 15b19e747e06fd53033ecf3270f311147cc379191572b7cb6944429c52456f15db018fedd1cb28edf136503368008c34af7984a445b7424c6272f163611d09b3
7
+ data.tar.gz: aa7a981179a9aecd70311ac99e5afea1118dfb65b96f023ef8865e1f05c0b923a154b2bf04eb76bbd491ca490962e780ea328753fd921b4950ac648464e7aae0
@@ -3,10 +3,12 @@ require_dependency "sibu/application_controller"
3
3
  module Sibu
4
4
  class PagesController < ApplicationController
5
5
  before_action :set_page, only: [:edit, :update, :destroy, :duplicate, :edit_element, :update_element, :clone_element,
6
- :delete_element, :child_element, :new_section, :create_section, :delete_section]
6
+ :delete_element, :child_element, :new_section, :create_section, :edit_section,
7
+ :update_section, :delete_section]
7
8
  before_action :set_site, only: [:index, :new]
8
9
  before_action :set_edit_context, only: [:edit_element, :update_element, :clone_element, :delete_element,
9
- :child_element, :new_section, :create_section, :delete_section]
10
+ :child_element, :new_section, :create_section, :edit_section,
11
+ :update_section, :delete_section]
10
12
  before_action :set_online, only: [:show, :edit]
11
13
  skip_before_action Rails.application.config.sibu[:auth_filter], only: [:show]
12
14
 
@@ -137,6 +139,17 @@ module Sibu
137
139
  @created = @entity.create_section(*@section_id.split('|'), params[:after], section_params)
138
140
  end
139
141
 
142
+ def edit_section
143
+ @section = @entity.section(params[:section_id])
144
+ end
145
+
146
+ def update_section
147
+ # {"utf8"=>"✓", "section"=>{"color"=>"#AFCA0B", "filters"=>"school_camps"}, "section_id"=>"cs1536301729", "refresh"=>"true", "commit"=>"Valider", "site_id"=>"3", "id"=>"1392"}
148
+ @entity.section(params[:section_id]).merge!(section_params)
149
+ logger.debug @entity.section(params[:section_id])
150
+ @updated = @entity.save
151
+ end
152
+
140
153
  def delete_section
141
154
  @deleted = @entity.delete_section(*@section_id.split('|'))
142
155
  end
@@ -28,6 +28,9 @@
28
28
  <div class="overlay_bottom"></div>
29
29
  <div class="edit_mode_actions">
30
30
  <p id="edit_section_msg">Modifier la section</p>
31
+ <% if conf[:section_form] %>
32
+ <button id="edit_section" onclick="editSection()">Configurer</button>
33
+ <% end %>
31
34
  <button id="new_section_before" onclick="newSection(false)">Insérer un bloc avant</button>
32
35
  <button id="new_section_after" onclick="newSection(true)">Insérer un bloc après</button>
33
36
  <button id="delete_section" onclick="deleteSection()">Supprimer</button>
@@ -98,6 +101,18 @@
98
101
  })
99
102
  }
100
103
 
104
+ function editSection() {
105
+ var section = $(".sb-editing").first();
106
+ $.ajax({
107
+ url: "<%= edit_section_site_page_path(@site.id, @page.id) %>",
108
+ method: "GET",
109
+ data: {
110
+ section_id: section.data("sb-id"),
111
+ entity: section.data("sb-entity")
112
+ }
113
+ })
114
+ }
115
+
101
116
  function deleteSection() {
102
117
  if (window.confirm("Supprimer la section ?")) {
103
118
  var section = $(".sb-editing").first();
@@ -0,0 +1,7 @@
1
+ var editPanel = $("#edit_panel");
2
+ editPanel.html("");
3
+ editPanel.html("<%= j(render conf[:section_form]) %>");
4
+ editPanel.slideDown("fast", function() {
5
+ sibuCallback("editSection");
6
+ });
7
+ document.body.style.overflow = "hidden";
@@ -0,0 +1,6 @@
1
+ <% if @updated %>
2
+ $("#edit_panel").slideUp();
3
+ refreshAfterEdit(true, '<%= @section_id %>');
4
+ <% else %>
5
+ $("#edit_panel #edit_msg").html("<p class='sibu_alert'>Une erreur s'est produite lors de l'enregistrement.</p>");
6
+ <% end %>
@@ -12,6 +12,7 @@ Sibu::Engine.routes.draw do
12
12
  get :edit_element, on: :member
13
13
  get :edit_section, on: :member
14
14
  patch 'update_element', on: :member
15
+ patch 'update_section', on: :member
15
16
  post 'clone_element', on: :member
16
17
  delete 'delete_element', on: :member
17
18
  post 'child_element', on: :member
@@ -1,3 +1,3 @@
1
1
  module Sibu
2
- VERSION = '0.6.2'
2
+ VERSION = '0.6.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sibu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean-Baptiste Vilain
@@ -190,12 +190,14 @@ files:
190
190
  - app/views/sibu/pages/edit.html.erb
191
191
  - app/views/sibu/pages/edit_content.html.erb
192
192
  - app/views/sibu/pages/edit_element.js.erb
193
+ - app/views/sibu/pages/edit_section.js.erb
193
194
  - app/views/sibu/pages/index.html.erb
194
195
  - app/views/sibu/pages/new.html.erb
195
196
  - app/views/sibu/pages/new_section.js.erb
196
197
  - app/views/sibu/pages/show.html.erb
197
198
  - app/views/sibu/pages/update.html.erb
198
199
  - app/views/sibu/pages/update_element.js.erb
200
+ - app/views/sibu/pages/update_section.js.erb
199
201
  - app/views/sibu/sites/_form.html.erb
200
202
  - app/views/sibu/sites/destroy.html.erb
201
203
  - app/views/sibu/sites/edit.html.erb