polyblock 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/polyblock/polyblock.js.coffee +10 -4
- data/lib/generators/polyblock/install/install_generator.rb +25 -0
- data/lib/generators/polyblock/install/templates/ckeditor_migration.rb +26 -0
- data/lib/generators/polyblock/install/templates/polyblock_migration.rb +12 -0
- data/lib/polyblock/version.rb +1 -1
- data/test/dummy/db/migrate/20140107201539_create_ckeditor_assets.rb +26 -0
- data/test/dummy/db/migrate/20140107201540_create_polyblock_blocks.rb +12 -0
- data/test/dummy/db/schema.rb +1 -16
- metadata +9 -6
- data/test/dummy/db/migrate/20131221163647_create_ckeditor_assets.rb +0 -26
- data/test/dummy/db/migrate/20131221213025_create_parents.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64f4b2c5eb999676b3e136bcac43dde5ea22fa2d
|
4
|
+
data.tar.gz: 45dd681084b86ea05ebca40dbdcc4029d2520b36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/polyblock/version.rb
CHANGED
@@ -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
|
data/test/dummy/db/schema.rb
CHANGED
@@ -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:
|
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.
|
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-
|
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/
|
244
|
-
- test/dummy/db/migrate/
|
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/
|
1554
|
-
- test/dummy/db/migrate/
|
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
|