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 +4 -4
- data/app/controllers/sibu/pages_controller.rb +15 -2
- data/app/views/layouts/sibu/edit_content.html.erb +15 -0
- data/app/views/sibu/pages/edit_section.js.erb +7 -0
- data/app/views/sibu/pages/update_section.js.erb +6 -0
- data/config/routes.rb +1 -0
- data/lib/sibu/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d33c05a8f28003ffbba1f9179108d5450235fa8
|
4
|
+
data.tar.gz: 57a4403853373b807840969d1f6f6ff1ab45647c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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, :
|
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, :
|
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();
|
data/config/routes.rb
CHANGED
@@ -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
|
data/lib/sibu/version.rb
CHANGED
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.
|
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
|