sibu 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/sibu/sibu.js.erb +3 -1
- data/app/assets/stylesheets/sibu/sibu.css +21 -0
- data/app/helpers/sibu/pages_helper.rb +4 -2
- data/app/models/concerns/sibu/sections_concern.rb +8 -2
- data/app/models/sibu/site.rb +1 -1
- data/app/views/layouts/sibu/edit_content.html.erb +1 -1
- data/app/views/sibu/pages/_edit_panel.html.erb +1 -3
- data/app/views/sibu/pages/edit_element.js.erb +2 -9
- data/lib/sibu/engine.rb +1 -1
- data/lib/sibu/version.rb +1 -1
- data/lib/sibu.rb +0 -1
- metadata +7 -21
- data/app/assets/stylesheets/sibu/sibu.scss.erb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0759366a72fa83ad3e5c5ed0288d0c9f2f3c180
|
4
|
+
data.tar.gz: d0d7497a1224778cbc8fc771d5e4ee864fab877f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae3b4f04caf0fe037407dd5a37093373a0490c67e0f4c46e4b570a8fc7cb23551fd6d91d9e9a7737af1875ae4ddbac40bac1ba93105ad29fbaf84367790277b4
|
7
|
+
data.tar.gz: b7151b91df5c7ab7c04da668776175c5bc34ab03f7ab0fd486826b0ca9f9a0ec9be2c11914737e52a39855021d445abcb22eace1b831d56a6601e180e92f7d5c
|
@@ -0,0 +1,21 @@
|
|
1
|
+
/*
|
2
|
+
*= require trix
|
3
|
+
*= require_self
|
4
|
+
*/
|
5
|
+
|
6
|
+
sb-edit .sb-edit-active {
|
7
|
+
cursor: pointer;
|
8
|
+
}
|
9
|
+
|
10
|
+
#edit_panel {
|
11
|
+
position: fixed;
|
12
|
+
left: 0;
|
13
|
+
bottom: 0;
|
14
|
+
width: 100%;
|
15
|
+
display: none;
|
16
|
+
z-index: 1000;
|
17
|
+
}
|
18
|
+
|
19
|
+
.trix-button-group--block-tools {
|
20
|
+
display: none !important;
|
21
|
+
}
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module Sibu
|
2
2
|
module PagesHelper
|
3
3
|
include Sibu::Engine.routes.url_helpers
|
4
|
+
include TrixEditorHelper
|
5
|
+
|
4
6
|
|
5
7
|
def link_path(page_id)
|
6
8
|
p = @site.page_by_id(page_id)
|
@@ -34,13 +36,13 @@ module Sibu
|
|
34
36
|
def site_section(id, &block)
|
35
37
|
@sb_entity = @site
|
36
38
|
@sb_section = id
|
37
|
-
capture(self, &block)
|
39
|
+
"<sb-edit data-id='#{id}'>#{capture(self, &block)}</sb-edit>".html_safe
|
38
40
|
end
|
39
41
|
|
40
42
|
def section(id, &block)
|
41
43
|
@sb_entity = @page
|
42
44
|
@sb_section = id
|
43
|
-
capture(self, &block)
|
45
|
+
"<sb-edit data-id='#{id}'>#{capture(self, &block)}</sb-edit>".html_safe
|
44
46
|
end
|
45
47
|
|
46
48
|
def each
|
@@ -42,15 +42,15 @@ module Sibu
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def element(section_id, element_id)
|
45
|
-
elt = section(section_id)[element_id
|
45
|
+
elt = section(section_id).select {|e| e["id"] == element_id}.first
|
46
46
|
elt || {}
|
47
47
|
end
|
48
48
|
|
49
49
|
def update_section(*ids, value)
|
50
50
|
end
|
51
51
|
|
52
|
-
# Note : only 2 levels supported for now
|
53
52
|
def update_element(section_id, value)
|
53
|
+
sanitize_value(value)
|
54
54
|
if self.sections[section_id].any? {|elt| elt["id"] == value["id"]}
|
55
55
|
self.sections[section_id].map! {|elt| elt["id"] == value["id"] ? value : elt}
|
56
56
|
else
|
@@ -58,5 +58,11 @@ module Sibu
|
|
58
58
|
end
|
59
59
|
value if save
|
60
60
|
end
|
61
|
+
|
62
|
+
def sanitize_value(value)
|
63
|
+
unless value["text"].blank?
|
64
|
+
value["text"].gsub!(/<\/?(div|p|ul|li)>/, '')
|
65
|
+
end
|
66
|
+
end
|
61
67
|
end
|
62
68
|
end
|
data/app/models/sibu/site.rb
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
<head>
|
4
4
|
<title><%= conf[:title] %></title>
|
5
5
|
<%= stylesheet_link_tag conf[:stylesheet], media: 'all' %>
|
6
|
-
<%= javascript_include_tag conf[:javascript] %>
|
7
6
|
<%= stylesheet_link_tag 'sibu/sibu', media: 'all' %>
|
7
|
+
<%= javascript_include_tag conf[:javascript] %>
|
8
8
|
<%= javascript_include_tag 'sibu/sibu' %>
|
9
9
|
<% if @site %>
|
10
10
|
<%= stylesheet_link_tag @site.site_template.path, media: "all" %>
|
@@ -2,9 +2,7 @@
|
|
2
2
|
<div id="edit_msg"></div>
|
3
3
|
<div class="sibu_form">
|
4
4
|
<%= form_tag(update_element_site_page_path(@site.id, @page.id), method: :patch, remote: true) do |f| %>
|
5
|
-
|
6
|
-
<%= text_area_tag 'element[text]', '', class: 'tinymce' %>
|
7
|
-
</div>
|
5
|
+
<%= trix_editor_tag 'element[text]', '', input: 'element_text' %>
|
8
6
|
<%= hidden_field_tag 'element[id]', @element_id %>
|
9
7
|
<%= hidden_field_tag :section_id, @section_id %>
|
10
8
|
<%= hidden_field_tag :entity, @entity_type %>
|
@@ -1,12 +1,5 @@
|
|
1
1
|
var editPanel = $("#edit_panel");
|
2
2
|
editPanel.html("<%= j(render 'edit_panel') %>");
|
3
|
-
editPanel.find("
|
3
|
+
var editorElt = editPanel.find("trix-editor")[0];
|
4
|
+
editorElt.editor.loadHTML("<%= raw(@entity.element(@section_id, @element_id)["text"].gsub("\n", "<br/>")) %>");
|
4
5
|
editPanel.slideDown("fast");
|
5
|
-
tinyMCE.remove();
|
6
|
-
tinyMCE.init({
|
7
|
-
selector: 'textarea.tinymce',
|
8
|
-
branding: false,
|
9
|
-
menubar: false,
|
10
|
-
toolbar: 'bold italic underline alignleft aligncenter alignright alignjustify',
|
11
|
-
forced_root_block : false
|
12
|
-
});
|
data/lib/sibu/engine.rb
CHANGED
data/lib/sibu/version.rb
CHANGED
data/lib/sibu.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.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean-Baptiste Vilain
|
@@ -58,42 +58,28 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 4.3
|
61
|
+
version: '4.3'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 4.3
|
68
|
+
version: '4.3'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: trix
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: '0.11'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: tinymce-rails-langs
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :runtime
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
82
|
+
version: '0.11'
|
97
83
|
description: Sibu is an engine for Ruby on Rails that enables creation of static websites
|
98
84
|
in a simple & wysiwyg way.
|
99
85
|
email:
|
@@ -107,7 +93,7 @@ files:
|
|
107
93
|
- Rakefile
|
108
94
|
- app/assets/config/sibu_manifest.js
|
109
95
|
- app/assets/javascripts/sibu/sibu.js.erb
|
110
|
-
- app/assets/stylesheets/sibu/sibu.
|
96
|
+
- app/assets/stylesheets/sibu/sibu.css
|
111
97
|
- app/controllers/sibu/application_controller.rb
|
112
98
|
- app/controllers/sibu/pages_controller.rb
|
113
99
|
- app/controllers/sibu/sites_controller.rb
|