bit_player 0.2.3 → 0.2.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d68dd88d9e378f7ca5a9df8552d3018b1443bcf
4
- data.tar.gz: 15bb3a0260e18c2cc825babfc1c4f0c6864e404a
3
+ metadata.gz: 89302c4dac14c35f125bc588872ab07789873039
4
+ data.tar.gz: 47a8877e298438ebcea005d98f8fd222be78c655
5
5
  SHA512:
6
- metadata.gz: e077056c818a91376466c6bd42978c0e52df678f4c59d8ffad5e55fad6e9f763709e60a02e609360e46e5c3d3c945b20fb4379623bdea881e67490d97f5b705c
7
- data.tar.gz: fc559f3841a905a44929d82c5238bbd9d2c1fac45484a51994deaba4b55f55db2ccca6d044b27b082a6ac00dbcc32cc0e7a40fa81bd607269372dc0f35a9e637
6
+ metadata.gz: dedcb769358ecbb53a478688dd0fba652a8a6d2cd802deed87925b627d23d6b3f30ce6af8d2b9e5dd905eee6283fe6902fd6cf012a41a4c32318fd208038fffd
7
+ data.tar.gz: 946d025635d0dc4664971a22cf8eec125650c59f056b31318d8970fd1d6c5c2bfe5a23d52f79148fc5ec55ed0446ed91dcf7ff6ab8e72ea96913a7427d4aa8ad
@@ -12,6 +12,8 @@ module BitPlayer
12
12
  validates :position, numericality: { greater_than_or_equal_to: 1 }
13
13
  validates :position, uniqueness: { scope: :bit_player_slideshow_id }
14
14
 
15
+ before_destroy :push_to_be_deleted_slide_to_end
16
+
15
17
  def self.update_positions(ids)
16
18
  transaction do
17
19
  connection.execute "SET CONSTRAINTS bit_player_slide_position DEFERRED"
@@ -32,5 +34,15 @@ module BitPlayer
32
34
  space_after_headers: true
33
35
  ).render(body).html_safe
34
36
  end
37
+
38
+ protected
39
+
40
+ def push_to_be_deleted_slide_to_end
41
+ slide_ids = slideshow.slide_ids
42
+ slide_ids.delete(id)
43
+ slide_ids.push(id)
44
+ slideshow.slides.update_positions(slide_ids)
45
+ end
46
+
35
47
  end
36
48
  end
@@ -1,3 +1,3 @@
1
1
  module BitPlayer
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bit_player
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Carty-Fickes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-25 00:00:00.000000000 Z
11
+ date: 2014-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -131,8 +131,6 @@ files:
131
131
  - spec/dummy/config/locales/en.yml
132
132
  - spec/dummy/config/routes.rb
133
133
  - spec/dummy/db/schema.rb
134
- - spec/dummy/log/development.log
135
- - spec/dummy/log/test.log
136
134
  - spec/dummy/public/404.html
137
135
  - spec/dummy/public/422.html
138
136
  - spec/dummy/public/500.html
@@ -197,8 +195,6 @@ test_files:
197
195
  - spec/dummy/config/routes.rb
198
196
  - spec/dummy/config.ru
199
197
  - spec/dummy/db/schema.rb
200
- - spec/dummy/log/development.log
201
- - spec/dummy/log/test.log
202
198
  - spec/dummy/public/404.html
203
199
  - spec/dummy/public/422.html
204
200
  - spec/dummy/public/500.html
@@ -1,92 +0,0 @@
1
-  (11.6ms) CREATE TABLE "schema_migrations" ("version" character varying(255) NOT NULL) 
2
-  (4.4ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
3
- ActiveRecord::SchemaMigration Load (0.6ms) SELECT "schema_migrations".* FROM "schema_migrations"
4
- Migrating to CreateBitPlayerContentModules (20140305200438)
5
-  (0.3ms) BEGIN
6
-  (12.0ms) CREATE TABLE "bit_player_content_modules" ("id" serial primary key, "title" character varying(255) NOT NULL, "context" character varying(255) NOT NULL, "position" integer DEFAULT 1 NOT NULL, "created_at" timestamp, "updated_at" timestamp) 
7
- SQL (3.7ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20140305200438"]]
8
-  (0.6ms) COMMIT
9
- Migrating to CreateBitPlayerContentProviders (20140305201300)
10
-  (0.4ms) BEGIN
11
-  (6.2ms) CREATE TABLE "bit_player_content_providers" ("id" serial primary key, "type" character varying(255) NOT NULL, "source_content_type" character varying(255), "source_content_id" integer, "bit_player_content_module_id" integer NOT NULL, "position" integer DEFAULT 1 NOT NULL, "created_at" timestamp, "updated_at" timestamp) 
12
-  (1.3ms) CREATE INDEX "content_module_index" ON "bit_player_content_providers" ("bit_player_content_module_id")
13
-  (9.0ms)  ALTER TABLE bit_player_content_providers
14
- ADD CONSTRAINT fk_content_providers_modules
15
- FOREIGN KEY (bit_player_content_module_id)
16
- REFERENCES bit_player_content_modules(id)
17
- 
18
- SQL (1.7ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20140305201300"]]
19
-  (1.3ms) COMMIT
20
- Migrating to CreateBitPlayerParticipantStatuses (20140305232705)
21
-  (0.8ms) BEGIN
22
-  (5.3ms) CREATE TABLE "bit_player_participant_statuses" ("id" serial primary key, "context" character varying(255), "module_position" integer, "provider_position" integer, "content_position" integer, "participant_id" integer NOT NULL, "created_at" timestamp, "updated_at" timestamp) 
23
-  (1.6ms) CREATE INDEX "index_participant_statuses_on_participant_id" ON "bit_player_participant_statuses" ("participant_id")
24
- SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20140305232705"]]
25
-  (0.5ms) COMMIT
26
- Migrating to CreateBitPlayerSlideshows (20140305232706)
27
-  (0.3ms) BEGIN
28
-  (3.6ms) CREATE TABLE "bit_player_slideshows" ("id" serial primary key, "title" character varying(255) NOT NULL, "created_at" timestamp, "updated_at" timestamp)
29
- SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20140305232706"]]
30
-  (0.5ms) COMMIT
31
- Migrating to CreateBitPlayerSlides (20140305234327)
32
-  (0.3ms) BEGIN
33
-  (5.5ms) CREATE TABLE "bit_player_slides" ("id" serial primary key, "title" character varying(255), "body" text NOT NULL, "position" integer DEFAULT 1 NOT NULL, "bit_player_slideshow_id" integer NOT NULL, "type" character varying(255), "options" text, "is_title_visible" boolean DEFAULT 't' NOT NULL, "created_at" timestamp, "updated_at" timestamp)
34
-  (1.4ms) CREATE INDEX "index_bit_player_slides_on_bit_player_slideshow_id" ON "bit_player_slides" ("bit_player_slideshow_id")
35
-  (2.9ms) ALTER TABLE bit_player_slides
36
- ADD CONSTRAINT fk_slides_slideshows
37
- FOREIGN KEY (bit_player_slideshow_id)
38
- REFERENCES bit_player_slideshows(id)
39
-
40
-  (1.8ms)  ALTER TABLE bit_player_slides
41
- ADD CONSTRAINT bit_player_slide_position UNIQUE (bit_player_slideshow_id, position)
42
- DEFERRABLE INITIALLY IMMEDIATE
43
- 
44
- SQL (0.5ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20140305234327"]]
45
-  (0.6ms) COMMIT
46
- Migrating to CreateBitPlayerTools (20140402224913)
47
-  (0.5ms) BEGIN
48
-  (4.3ms) CREATE TABLE "bit_player_tools" ("id" serial primary key, "title" character varying(255) NOT NULL, "position" integer, "is_home" boolean DEFAULT 'f' NOT NULL, "created_at" timestamp, "updated_at" timestamp) 
49
-  (1.2ms) CREATE UNIQUE INDEX "index_bit_player_tools_on_title" ON "bit_player_tools" ("title")
50
-  (1.9ms) CREATE UNIQUE INDEX "index_bit_player_tools_on_position" ON "bit_player_tools" ("position")
51
- SQL (0.4ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20140402224913"]]
52
-  (0.7ms) COMMIT
53
- Migrating to ChangeModuleContextToTool (20140402225703)
54
-  (0.5ms) BEGIN
55
-  (0.9ms) ALTER TABLE "bit_player_content_modules" ADD COLUMN "bit_player_tool_id" integer
56
- BitPlayer::ContentModule Load (0.6ms) SELECT "bit_player_content_modules".* FROM "bit_player_content_modules"
57
-  (0.6ms) ALTER TABLE "bit_player_content_modules" ALTER "bit_player_tool_id" SET NOT NULL
58
-  (1.0ms) ALTER TABLE "bit_player_content_modules" DROP "context"
59
-  (2.7ms)  ALTER TABLE bit_player_content_modules
60
- ADD CONSTRAINT fk_content_modules_tools
61
- FOREIGN KEY (bit_player_tool_id)
62
- REFERENCES bit_player_tools(id)
63
- 
64
- SQL (0.5ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20140402225703"]]
65
-  (0.5ms) COMMIT
66
- ActiveRecord::SchemaMigration Load (0.5ms) SELECT "schema_migrations".* FROM "schema_migrations"
67
-  (122.4ms) DROP DATABASE IF EXISTS "dummy_test"
68
-  (253.8ms) CREATE DATABASE "dummy_test" ENCODING = 'unicode'
69
- SQL (3.3ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"
70
-  (8.3ms) CREATE TABLE "bit_player_content_modules" ("id" serial primary key, "title" character varying(255) NOT NULL, "position" integer DEFAULT 1 NOT NULL, "created_at" timestamp, "updated_at" timestamp, "bit_player_tool_id" integer NOT NULL)
71
-  (6.0ms) CREATE TABLE "bit_player_content_providers" ("id" serial primary key, "type" character varying(255) NOT NULL, "source_content_type" character varying(255), "source_content_id" integer, "bit_player_content_module_id" integer NOT NULL, "position" integer DEFAULT 1 NOT NULL, "created_at" timestamp, "updated_at" timestamp) 
72
-  (1.5ms) CREATE INDEX "content_module_index" ON "bit_player_content_providers" USING btree ("bit_player_content_module_id")
73
-  (3.8ms) CREATE TABLE "bit_player_participant_statuses" ("id" serial primary key, "context" character varying(255), "module_position" integer, "provider_position" integer, "content_position" integer, "participant_id" integer NOT NULL, "created_at" timestamp, "updated_at" timestamp) 
74
-  (2.6ms) CREATE INDEX "index_participant_statuses_on_participant_id" ON "bit_player_participant_statuses" USING btree ("participant_id")
75
-  (6.6ms) CREATE TABLE "bit_player_slides" ("id" serial primary key, "title" character varying(255), "body" text NOT NULL, "position" integer DEFAULT 1 NOT NULL, "bit_player_slideshow_id" integer NOT NULL, "type" character varying(255), "options" text, "is_title_visible" boolean DEFAULT 't' NOT NULL, "created_at" timestamp, "updated_at" timestamp) 
76
-  (1.7ms) CREATE UNIQUE INDEX "bit_player_slide_position" ON "bit_player_slides" USING btree ("bit_player_slideshow_id", "position")
77
-  (1.4ms) CREATE INDEX "index_bit_player_slides_on_bit_player_slideshow_id" ON "bit_player_slides" USING btree ("bit_player_slideshow_id")
78
-  (3.6ms) CREATE TABLE "bit_player_slideshows" ("id" serial primary key, "title" character varying(255) NOT NULL, "created_at" timestamp, "updated_at" timestamp)
79
-  (4.0ms) CREATE TABLE "bit_player_tools" ("id" serial primary key, "title" character varying(255) NOT NULL, "position" integer, "is_home" boolean DEFAULT 'f' NOT NULL, "created_at" timestamp, "updated_at" timestamp) 
80
-  (1.4ms) CREATE UNIQUE INDEX "index_bit_player_tools_on_position" ON "bit_player_tools" USING btree ("position")
81
-  (1.7ms) CREATE UNIQUE INDEX "index_bit_player_tools_on_title" ON "bit_player_tools" USING btree ("title")
82
-  (1.6ms) CREATE TABLE "schema_migrations" ("version" character varying(255) NOT NULL)
83
-  (1.5ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
84
-  (0.5ms) SELECT version FROM "schema_migrations"
85
-  (0.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20140402225703')
86
-  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20140305200438')
87
-  (0.4ms) INSERT INTO "schema_migrations" (version) VALUES ('20140305201300')
88
-  (0.4ms) INSERT INTO "schema_migrations" (version) VALUES ('20140305232705')
89
-  (0.4ms) INSERT INTO "schema_migrations" (version) VALUES ('20140305232706')
90
-  (0.4ms) INSERT INTO "schema_migrations" (version) VALUES ('20140305234327')
91
-  (0.5ms) INSERT INTO "schema_migrations" (version) VALUES ('20140402224913')
92
- ActiveRecord::SchemaMigration Load (0.4ms) SELECT "schema_migrations".* FROM "schema_migrations"