polyblock 0.1.8 → 0.2.0

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: bcf7f2596688a81fd5a08c97a237f43be4bb80c5
4
- data.tar.gz: 96adb94234445ca164286b352b9598aeaaa99979
3
+ metadata.gz: cc493c480918f3bf39bfa91106dbacd7716c32c2
4
+ data.tar.gz: 29c4405b765ca837e7c290df192e32bfa3383d5b
5
5
  SHA512:
6
- metadata.gz: 2f60fd4033a0db11301798229cd3966f52afd111c3199c300e2ea2836a7a948fa7ba853a8bcf116cfb66268e47d54d22fce51f5e47d858ed1d205acff4171467
7
- data.tar.gz: 9db39a46d91fb8a87bf545822492916319d1e0f7f497c21e2052b3578630b855584bc14938d6d6e8eb6f1f9a9b42b07a95c294171ccbca574ece4ed567ef443d
6
+ metadata.gz: aa72c1af9cbfb75b49e498574a71836a7a4d58f9d83e26abf6e197bebbf2f00912da1e2c87e941f0c15a122734d49f19a6afd937bf98c4fd5303612c7fceb24d
7
+ data.tar.gz: 39c2e15125ce75e7f47df26bad9848ad80dfd6d98fd3629e0a07a9440692b330fb3d3ca863c790da51fec72ae4e4de7772b7d12715a28c3cc7aca46b2995cff2
@@ -8,21 +8,31 @@ $ ->
8
8
  blocks = $(".polyblock[contenteditable='true']")
9
9
  return unless blocks.length
10
10
 
11
+ # Find switches
12
+ pb_switch = $('.polyblock-switch')
13
+ has_switch = pb_switch.is('*')
14
+
11
15
  # Clone each block and instanciate CKeditor on the original
12
16
  blockclones = {}
17
+ instanciateCKEditor = (id)->
18
+ CKEDITOR.inline id,
19
+ on:
20
+ focus:(e)->
21
+ editorModeOn()
22
+ startListening(id)
23
+ blur:(e)-> stopListening()
13
24
  blocks.each ->
14
25
  id = $(@).attr('id')
15
26
  blockclones[id] = $(@).clone()
16
27
  unless _.contains(_.keys(CKEDITOR.instances),id)
17
- CKEDITOR.inline id,
18
- on:
19
- focus:(e)->
20
- editorModeOn()
21
- startListening(id)
22
- blur:(e)-> stopListening()
28
+ if has_switch
29
+ pb_switch.on "change", ->
30
+ if $(@).hasClass("active") then instanciateCKEditor(id)
31
+ else window.location.reload()
32
+ else instanciateCKEditor(id)
23
33
 
24
34
  # Wait for changes
25
- verbose = true
35
+ verbose = false
26
36
  changeChecker = null
27
37
  indicator = $('.pb-change-indicator')
28
38
  changeText = $('.pb-change-text')
@@ -1,3 +1,3 @@
1
1
  module Polyblock
2
- VERSION = "0.1.8"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polyblock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - MacKinley Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-03 00:00:00.000000000 Z
11
+ date: 2014-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails