polyblock 0.3.7 → 0.3.9
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/polyblock/polyblock.js.coffee +9 -3
- data/app/controllers/polyblock/polyblocks_controller.rb +1 -0
- data/app/helpers/polyblock/application_helper.rb +6 -5
- data/lib/polyblock/version.rb +1 -1
- data/test/dummy/app/views/home/index.html.haml +1 -1
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/log/development.log +5643 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/1926295578648cdc013840b112b4549a +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/54e6936a11d8f5cdf5fa2f48475d2207 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/65a5689d2de3f83bcc1531b0bd7918ce +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/80a9daa2db75d17e5e24d7442ccb41bc +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/98c83dce67cf84818203c6f995f4ba36 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/f1087ef68b351492e06aa6cfd82d0438 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a144f379db0baf032b3ebfee8bd6d9e1efaa3aed
|
4
|
+
data.tar.gz: afd53bafd7a88b3151c9f14bd8f748e5c703a378
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4aa9a039fe6a700224a7b956618881a880585bcd61ab7b2744140519972381f2759d848d7461c41cc909fff82a55c7ddd9cf2133f8d31c41987e322bd1231eb5
|
7
|
+
data.tar.gz: 6f55bf7c4cf47a27611d6342d5c00774d4e7a9677d21370f3566b0b3960d75dc6ec3fb889c0f84d532e2442114a60dc2dfb4a4925b207ccfdb9733672cfae407
|
@@ -17,12 +17,18 @@ $ ->
|
|
17
17
|
# Clone each block and instanciate CKeditor on the original
|
18
18
|
blockclones = {}
|
19
19
|
instanciateCKEditor = (id)->
|
20
|
-
CKEDITOR.inline id,
|
20
|
+
editor = CKEDITOR.inline id,
|
21
21
|
on:
|
22
|
-
|
22
|
+
contentDom: ->
|
23
|
+
editor.document.on 'keydown', (e)->
|
24
|
+
if (e.data.$.ctrlKey or e.data.$.metaKey) and e.data.$.keyCode == 83
|
25
|
+
try e.data.$.preventDefault()
|
26
|
+
saveChanges()
|
27
|
+
false
|
28
|
+
focus: (e)->
|
23
29
|
editorModeOn()
|
24
30
|
startListening(id)
|
25
|
-
blur:(e)-> stopListening()
|
31
|
+
blur: (e)-> stopListening()
|
26
32
|
blocks.each ->
|
27
33
|
id = $(@).attr('id')
|
28
34
|
blockclones[id] = $(@).clone()
|
@@ -10,6 +10,7 @@ module Polyblock
|
|
10
10
|
pb_attrs[:id] = attrs[:id] if attrs.has_key?(:id) and !attrs[:id].blank?
|
11
11
|
pb_attrs[:name] = attrs[:name] if attrs.has_key?(:name) and !attrs[:name].blank?
|
12
12
|
pb = Block.find_or_initialize_by pb_attrs
|
13
|
+
pb.id = nil if Block.find(pb_attrs[:id]).present? and pb.new_record?
|
13
14
|
pb.content = attrs[:content]
|
14
15
|
pb.save!
|
15
16
|
end
|
@@ -3,6 +3,7 @@ module Polyblock
|
|
3
3
|
|
4
4
|
def pb(name, options={})
|
5
5
|
options = {
|
6
|
+
:editable => false,
|
6
7
|
:tag => :div,
|
7
8
|
:tag_options => {},
|
8
9
|
:condensed => false,
|
@@ -20,12 +21,10 @@ module Polyblock
|
|
20
21
|
matches = Polyblock::Block.where :name => name
|
21
22
|
pb_exists = matches.any?
|
22
23
|
pb = pb_exists ? matches.first : Polyblock::Block.new({:name => name})
|
23
|
-
if pb_exists
|
24
|
-
|
24
|
+
pb_id = if pb_exists
|
25
|
+
pb.id
|
25
26
|
else
|
26
|
-
|
27
|
-
nextId += 1 while Polyblock::Block.where(:id => nextId).any?
|
28
|
-
pb_id = nextId
|
27
|
+
Polyblock::Block.any? ? Polyblock::Block.order(:id).last.id + 1 : 1
|
29
28
|
end
|
30
29
|
end
|
31
30
|
|
@@ -38,6 +37,8 @@ module Polyblock
|
|
38
37
|
tag_options = options[:tag_options].deep_merge({:id => "pb-#{pb_id}-#{random_id}", :data => {:pbid => pb_id, :pbname => name}})
|
39
38
|
tag_options[:contenteditable] = if options[:condensed]
|
40
39
|
"false"
|
40
|
+
elsif options[:editable]
|
41
|
+
"true"
|
41
42
|
elsif respond_to?(:can?) && can?(:manage, pb)
|
42
43
|
"true"
|
43
44
|
elsif respond_to?(:user_signed_in?) && user_signed_in?
|
data/lib/polyblock/version.rb
CHANGED
Binary file
|