polyblock 0.2.0 → 0.2.1

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: cc493c480918f3bf39bfa91106dbacd7716c32c2
4
- data.tar.gz: 29c4405b765ca837e7c290df192e32bfa3383d5b
3
+ metadata.gz: 64f4b2c5eb999676b3e136bcac43dde5ea22fa2d
4
+ data.tar.gz: 45dd681084b86ea05ebca40dbdcc4029d2520b36
5
5
  SHA512:
6
- metadata.gz: aa72c1af9cbfb75b49e498574a71836a7a4d58f9d83e26abf6e197bebbf2f00912da1e2c87e941f0c15a122734d49f19a6afd937bf98c4fd5303612c7fceb24d
7
- data.tar.gz: 39c2e15125ce75e7f47df26bad9848ad80dfd6d98fd3629e0a07a9440692b330fb3d3ca863c790da51fec72ae4e4de7772b7d12715a28c3cc7aca46b2995cff2
6
+ metadata.gz: d5e367d5e00d4b1ec2947fad012d53b4c94d1f0d0b099f2d47ba6a0db2de45f680e84853252d4170e9f0c68e3528b32988bf05bd381e3b94d7092ed23ca840c7
7
+ data.tar.gz: 11a3805c74cab423527f57126e0e1d2a33afc0510630db404698b648ef8cb38ee640d2b0657377ad7748542d47c1011c2ef08dcb25f61cc8d33392795aa5ca95
@@ -11,6 +11,7 @@ $ ->
11
11
  # Find switches
12
12
  pb_switch = $('.polyblock-switch')
13
13
  has_switch = pb_switch.is('*')
14
+ switch_list = []
14
15
 
15
16
  # Clone each block and instanciate CKeditor on the original
16
17
  blockclones = {}
@@ -25,12 +26,17 @@ $ ->
25
26
  id = $(@).attr('id')
26
27
  blockclones[id] = $(@).clone()
27
28
  unless _.contains(_.keys(CKEDITOR.instances),id)
28
- if has_switch
29
- pb_switch.on "change", ->
30
- if $(@).hasClass("active") then instanciateCKEditor(id)
31
- else window.location.reload()
29
+ if has_switch then switch_list.push(id)
32
30
  else instanciateCKEditor(id)
33
31
 
32
+ if has_switch
33
+ pb_switch.click (e)->
34
+ e.preventDefault()
35
+ if $(@).hasClass("active") then window.location.reload()
36
+ else
37
+ instanciateCKEditor(id) for id in switch_list
38
+ $(@).addClass("active")
39
+
34
40
  # Wait for changes
35
41
  verbose = false
36
42
  changeChecker = null
@@ -0,0 +1,25 @@
1
+ require 'rails/generators/migration'
2
+
3
+ module Polyblock
4
+ module Generators
5
+ class InstallGenerator < ::Rails::Generators::Base
6
+ include Rails::Generators::Migration
7
+ source_root File.expand_path('../templates', __FILE__)
8
+ desc "Create a migration to add the Polyblock::Block model to your project."
9
+
10
+ def self.next_migration_number(path)
11
+ unless @prev_migration_nr
12
+ @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
13
+ else
14
+ @prev_migration_nr += 1
15
+ end
16
+ @prev_migration_nr.to_s
17
+ end
18
+
19
+ def copy_migrations
20
+ migration_template "ckeditor_migration.rb", "db/migrate/create_ckeditor_assets.rb"
21
+ migration_template "polyblock_migration.rb", "db/migrate/create_polyblock_blocks.rb"
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,26 @@
1
+ class CreateCkeditorAssets < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :ckeditor_assets do |t|
4
+ t.string :data_file_name, :null => false
5
+ t.string :data_content_type
6
+ t.integer :data_file_size
7
+
8
+ t.integer :assetable_id
9
+ t.string :assetable_type, :limit => 30
10
+ t.string :type, :limit => 30
11
+
12
+ # Uncomment it to save images dimensions, if your need it
13
+ t.integer :width
14
+ t.integer :height
15
+
16
+ t.timestamps
17
+ end
18
+
19
+ add_index "ckeditor_assets", ["assetable_type", "type", "assetable_id"], :name => "idx_ckeditor_assetable_type"
20
+ add_index "ckeditor_assets", ["assetable_type", "assetable_id"], :name => "idx_ckeditor_assetable"
21
+ end
22
+
23
+ def self.down
24
+ drop_table :ckeditor_assets
25
+ end
26
+ end
@@ -0,0 +1,12 @@
1
+ class CreatePolyblockBlocks < ActiveRecord::Migration
2
+ def change
3
+ create_table :polyblock_blocks do |t|
4
+ t.string :name
5
+ t.text :content
6
+ t.integer :contentable_id
7
+ t.string :contentable_type
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -1,3 +1,3 @@
1
1
  module Polyblock
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -0,0 +1,26 @@
1
+ class CreateCkeditorAssets < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :ckeditor_assets do |t|
4
+ t.string :data_file_name, :null => false
5
+ t.string :data_content_type
6
+ t.integer :data_file_size
7
+
8
+ t.integer :assetable_id
9
+ t.string :assetable_type, :limit => 30
10
+ t.string :type, :limit => 30
11
+
12
+ # Uncomment it to save images dimensions, if your need it
13
+ t.integer :width
14
+ t.integer :height
15
+
16
+ t.timestamps
17
+ end
18
+
19
+ add_index "ckeditor_assets", ["assetable_type", "type", "assetable_id"], :name => "idx_ckeditor_assetable_type"
20
+ add_index "ckeditor_assets", ["assetable_type", "assetable_id"], :name => "idx_ckeditor_assetable"
21
+ end
22
+
23
+ def self.down
24
+ drop_table :ckeditor_assets
25
+ end
26
+ end
@@ -0,0 +1,12 @@
1
+ class CreatePolyblockBlocks < ActiveRecord::Migration
2
+ def change
3
+ create_table :polyblock_blocks do |t|
4
+ t.string :name
5
+ t.text :content
6
+ t.integer :contentable_id
7
+ t.string :contentable_type
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20131221213025) do
14
+ ActiveRecord::Schema.define(version: 20140107201540) do
15
15
 
16
16
  create_table "ckeditor_assets", force: true do |t|
17
17
  t.string "data_file_name", null: false
@@ -29,12 +29,6 @@ ActiveRecord::Schema.define(version: 20131221213025) do
29
29
  add_index "ckeditor_assets", ["assetable_type", "assetable_id"], name: "idx_ckeditor_assetable"
30
30
  add_index "ckeditor_assets", ["assetable_type", "type", "assetable_id"], name: "idx_ckeditor_assetable_type"
31
31
 
32
- create_table "parents", force: true do |t|
33
- t.string "name"
34
- t.datetime "created_at"
35
- t.datetime "updated_at"
36
- end
37
-
38
32
  create_table "polyblock_blocks", force: true do |t|
39
33
  t.string "name"
40
34
  t.text "content"
@@ -44,13 +38,4 @@ ActiveRecord::Schema.define(version: 20131221213025) do
44
38
  t.datetime "updated_at"
45
39
  end
46
40
 
47
- create_table "polyblock_polyblocks", force: true do |t|
48
- t.string "name"
49
- t.text "content"
50
- t.integer "contentable_id"
51
- t.string "contentable_type"
52
- t.datetime "created_at"
53
- t.datetime "updated_at"
54
- end
55
-
56
41
  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.2.0
4
+ version: 0.2.1
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-06 00:00:00.000000000 Z
11
+ date: 2014-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -191,6 +191,9 @@ files:
191
191
  - config/routes.rb
192
192
  - db/migrate/20131201144424_create_ckeditor_assets.rb
193
193
  - db/migrate/20131201194124_create_polyblock_blocks.rb
194
+ - lib/generators/polyblock/install/install_generator.rb
195
+ - lib/generators/polyblock/install/templates/ckeditor_migration.rb
196
+ - lib/generators/polyblock/install/templates/polyblock_migration.rb
194
197
  - lib/polyblock/engine.rb
195
198
  - lib/polyblock/has_polyblock.rb
196
199
  - lib/polyblock/version.rb
@@ -240,8 +243,8 @@ files:
240
243
  - test/dummy/config/routes.rb
241
244
  - test/dummy/config.ru
242
245
  - test/dummy/db/development.sqlite3
243
- - test/dummy/db/migrate/20131221163647_create_ckeditor_assets.rb
244
- - test/dummy/db/migrate/20131221213025_create_parents.rb
246
+ - test/dummy/db/migrate/20140107201539_create_ckeditor_assets.rb
247
+ - test/dummy/db/migrate/20140107201540_create_polyblock_blocks.rb
245
248
  - test/dummy/db/schema.rb
246
249
  - test/dummy/log/development.log
247
250
  - test/dummy/public/404.html
@@ -1550,8 +1553,8 @@ test_files:
1550
1553
  - test/dummy/config/routes.rb
1551
1554
  - test/dummy/config.ru
1552
1555
  - test/dummy/db/development.sqlite3
1553
- - test/dummy/db/migrate/20131221163647_create_ckeditor_assets.rb
1554
- - test/dummy/db/migrate/20131221213025_create_parents.rb
1556
+ - test/dummy/db/migrate/20140107201539_create_ckeditor_assets.rb
1557
+ - test/dummy/db/migrate/20140107201540_create_polyblock_blocks.rb
1555
1558
  - test/dummy/db/schema.rb
1556
1559
  - test/dummy/log/development.log
1557
1560
  - test/dummy/public/404.html
@@ -1,26 +0,0 @@
1
- class CreateCkeditorAssets < ActiveRecord::Migration
2
- def self.up
3
- create_table :ckeditor_assets do |t|
4
- t.string :data_file_name, :null => false
5
- t.string :data_content_type
6
- t.integer :data_file_size
7
-
8
- t.integer :assetable_id
9
- t.string :assetable_type, :limit => 30
10
- t.string :type, :limit => 30
11
-
12
- # Uncomment it to save images dimensions, if your need it
13
- t.integer :width
14
- t.integer :height
15
-
16
- t.timestamps
17
- end
18
-
19
- add_index "ckeditor_assets", ["assetable_type", "type", "assetable_id"], :name => "idx_ckeditor_assetable_type"
20
- add_index "ckeditor_assets", ["assetable_type", "assetable_id"], :name => "idx_ckeditor_assetable"
21
- end
22
-
23
- def self.down
24
- drop_table :ckeditor_assets
25
- end
26
- end
@@ -1,9 +0,0 @@
1
- class CreateParents < ActiveRecord::Migration
2
- def change
3
- create_table :parents do |t|
4
- t.string :name
5
-
6
- t.timestamps
7
- end
8
- end
9
- end