bit_player 0.0.4
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 +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +3 -0
- data/Rakefile +21 -0
- data/app/assets/javascripts/bit_player/application.js +13 -0
- data/app/assets/stylesheets/bit_player/application.css +13 -0
- data/app/controllers/bit_player/application_controller.rb +4 -0
- data/app/helpers/bit_player/application_helper.rb +4 -0
- data/app/models/bit_player/content_module.rb +25 -0
- data/app/models/bit_player/content_provider.rb +18 -0
- data/app/models/bit_player/content_providers/null.rb +15 -0
- data/app/models/bit_player/content_providers/slideshow_provider.rb +28 -0
- data/app/models/bit_player/navigator.rb +87 -0
- data/app/models/bit_player/participant_status.rb +27 -0
- data/app/models/bit_player/slide.rb +27 -0
- data/app/models/bit_player/slideshow.rb +15 -0
- data/app/models/bit_player/video_slide.rb +5 -0
- data/app/views/layouts/bit_player/application.html.erb +14 -0
- data/config/routes.rb +2 -0
- data/db/migrate/20140305200438_create_bit_player_content_modules.rb +11 -0
- data/db/migrate/20140305201300_create_bit_player_content_providers.rb +33 -0
- data/db/migrate/20140305232705_create_bit_player_participant_statuses.rb +15 -0
- data/db/migrate/20140305232705_create_bit_player_slideshows.rb +9 -0
- data/db/migrate/20140305234327_create_bit_player_slides.rb +48 -0
- data/lib/bit_player/engine.rb +11 -0
- data/lib/bit_player/version.rb +3 -0
- data/lib/bit_player.rb +4 -0
- data/lib/tasks/bit_player_tasks.rake +4 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config/application.rb +28 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +60 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +29 -0
- data/spec/dummy/config/environments/production.rb +80 -0
- data/spec/dummy/config/environments/test.rb +36 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +12 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/migrate/20140305231316_create_bit_player_content_modules.bit_player.rb +12 -0
- data/spec/dummy/db/migrate/20140305231317_create_bit_player_content_providers.bit_player.rb +34 -0
- data/spec/dummy/db/migrate/20140305233110_create_bit_player_participant_statuses.bit_player.rb +16 -0
- data/spec/dummy/db/migrate/20140305234757_create_bit_player_slideshows.bit_player.rb +10 -0
- data/spec/dummy/db/migrate/20140306000537_create_bit_player_slides.bit_player.rb +49 -0
- data/spec/dummy/db/schema.rb +72 -0
- data/spec/dummy/log/test.log +3 -0
- data/spec/dummy/public/404.html +58 -0
- data/spec/dummy/public/422.html +58 -0
- data/spec/dummy/public/500.html +57 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/models/bit_player/navigator_spec.rb +12 -0
- data/spec/spec_helper.rb +16 -0
- metadata +192 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: cafd479833b6cbf10375e4d797b3f85adf4320f9
|
|
4
|
+
data.tar.gz: 6bf786f887d42567cce629c182dcd403f3930921
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: f8cf53c56f1109216b54846a8e778948ca700116a2b0e1dfdfbb7820dd5160b8dd0b7f534fcaaee98c71689bbcea4b18d83a158d842383f853790ca1150d5267
|
|
7
|
+
data.tar.gz: 25be89df2f4ef0233fa529f1dd04a950850c39a522dbd0edbc15c75892a1f2ab7a564067e9eb1316c43afb71aee70c7ade764bb930c593c12ab16afe2154c9b6
|
data/MIT-LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright 2014 YOURNAME
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
data/Rakefile
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
begin
|
|
2
|
+
require 'bundler/setup'
|
|
3
|
+
rescue LoadError
|
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
require 'rdoc/task'
|
|
8
|
+
|
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
|
11
|
+
rdoc.title = 'BitPlayer'
|
|
12
|
+
rdoc.options << '--line-numbers'
|
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
Bundler::GemHelper.install_tasks
|
|
21
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
|
2
|
+
// listed below.
|
|
3
|
+
//
|
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
|
6
|
+
//
|
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
8
|
+
// compiled file.
|
|
9
|
+
//
|
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
|
11
|
+
// about supported directives.
|
|
12
|
+
//
|
|
13
|
+
//= require_tree .
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
|
3
|
+
* listed below.
|
|
4
|
+
*
|
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
|
7
|
+
*
|
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
|
10
|
+
*
|
|
11
|
+
*= require_self
|
|
12
|
+
*= require_tree .
|
|
13
|
+
*/
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module BitPlayer
|
|
2
|
+
class ContentModule < ActiveRecord::Base
|
|
3
|
+
has_many :content_providers,
|
|
4
|
+
class_name: 'BitPlayer::ContentProvider',
|
|
5
|
+
foreign_key: :bit_player_content_module_id,
|
|
6
|
+
inverse_of: :content_module
|
|
7
|
+
|
|
8
|
+
validates :title, :context, :position, presence: true
|
|
9
|
+
validates_numericality_of :position, greater_than_or_equal_to: 1
|
|
10
|
+
validates_uniqueness_of :position, scope: :context
|
|
11
|
+
|
|
12
|
+
#def providers
|
|
13
|
+
# ContentProvider.where(bit_player_content_module_id: id).order(:position)
|
|
14
|
+
#end
|
|
15
|
+
|
|
16
|
+
def provider(position)
|
|
17
|
+
content_providers.where(position: position).first ||
|
|
18
|
+
BitPlayer::ContentProviders::Null.new(self)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def provider_exists?(position)
|
|
22
|
+
content_providers.exists?(position: position)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module BitPlayer
|
|
2
|
+
class ContentProvider < ActiveRecord::Base
|
|
3
|
+
belongs_to :content_module,
|
|
4
|
+
class_name: 'BitPlayer::ContentModule',
|
|
5
|
+
foreign_key: :bit_player_content_module_id,
|
|
6
|
+
inverse_of: :content_providers
|
|
7
|
+
belongs_to :source_content, polymorphic: true
|
|
8
|
+
|
|
9
|
+
validates :content_module, :position, presence: true
|
|
10
|
+
validates_numericality_of :position, greater_than_or_equal_to: 1
|
|
11
|
+
|
|
12
|
+
delegate :context, to: :content_module, prefix: false
|
|
13
|
+
|
|
14
|
+
def exists?(position)
|
|
15
|
+
false
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module BitPlayer
|
|
2
|
+
class ContentProviders::Null
|
|
3
|
+
def initialize(content_module)
|
|
4
|
+
@content_module = content_module
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def render_current(options)
|
|
8
|
+
"Content Module #{ @content_module.title }: Oops, did you expect a content provider here?"
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def show_nav_link?
|
|
12
|
+
true
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module BitPlayer
|
|
2
|
+
class ContentProviders::SlideshowProvider < ContentProvider
|
|
3
|
+
def slideshow
|
|
4
|
+
source_content
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def render_current(options)
|
|
8
|
+
options.view_context.render(
|
|
9
|
+
template: 'slides/show',
|
|
10
|
+
locals: {
|
|
11
|
+
slide: slide(options.position)
|
|
12
|
+
}
|
|
13
|
+
)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def slide(position)
|
|
17
|
+
slideshow.slides.where(position: position).first || BitPlayer::Slide.new(body: 'no slides')
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def exists?(position)
|
|
21
|
+
slideshow.slides.exists?(position: position)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def show_nav_link?
|
|
25
|
+
true
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
module BitPlayer
|
|
2
|
+
class Navigator
|
|
3
|
+
RenderOptions = Struct.new(:view_context, :app_context, :position, :participant)
|
|
4
|
+
|
|
5
|
+
def initialize(participant)
|
|
6
|
+
@participant = participant
|
|
7
|
+
@status = participant.navigation_status
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def context
|
|
11
|
+
@status.context
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def module_position
|
|
15
|
+
@status.module_position
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def provider_position
|
|
19
|
+
@status.provider_position
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def content_position
|
|
23
|
+
@status.content_position
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def render_current_content(view_context)
|
|
27
|
+
options = RenderOptions.new(view_context, context, content_position, @participant)
|
|
28
|
+
|
|
29
|
+
current_content_provider.render_current(options)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def show_nav_link?
|
|
33
|
+
current_content_provider.show_nav_link?
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def current_content_provider
|
|
37
|
+
current_module.provider(provider_position)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def fetch_next_content
|
|
41
|
+
if current_content_provider.exists?(content_position + 1)
|
|
42
|
+
@status.increment_content_position
|
|
43
|
+
elsif current_module.provider_exists?(provider_position + 1)
|
|
44
|
+
@status.increment_provider_position
|
|
45
|
+
else
|
|
46
|
+
initialize_context(context)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def initialize_context(context)
|
|
51
|
+
@status.initialize_context(context)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def initialize_location(options)
|
|
55
|
+
content_module = ContentModule.find(options[:module_id])
|
|
56
|
+
@status.context = content_module.context
|
|
57
|
+
@status.module_position = content_module.position
|
|
58
|
+
if options[:provider_id]
|
|
59
|
+
@status.provider_position = content_module.content_providers.find(options[:provider_id]).position
|
|
60
|
+
else
|
|
61
|
+
@status.provider_position = 1
|
|
62
|
+
end
|
|
63
|
+
@status.content_position = [options[:content_position].to_i, 1].max
|
|
64
|
+
@status.save
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def current_module
|
|
68
|
+
@current_module ||= nil
|
|
69
|
+
|
|
70
|
+
module_attrs = { context: context, position: module_position }
|
|
71
|
+
|
|
72
|
+
if current_module_stale?
|
|
73
|
+
@current_module = ContentModule.where(module_attrs).first
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
@current_module ||= ContentModule.new(module_attrs)
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
private
|
|
80
|
+
|
|
81
|
+
def current_module_stale?
|
|
82
|
+
@current_module.nil? ||
|
|
83
|
+
(@current_module.context != context ||
|
|
84
|
+
@current_module.position != module_position)
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module BitPlayer
|
|
2
|
+
class ParticipantStatus < ActiveRecord::Base
|
|
3
|
+
belongs_to :participant
|
|
4
|
+
|
|
5
|
+
def initialize_context(name)
|
|
6
|
+
self.context = name
|
|
7
|
+
self.module_position = 1
|
|
8
|
+
self.provider_position = 1
|
|
9
|
+
self.content_position = 1
|
|
10
|
+
|
|
11
|
+
save
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def increment_content_position
|
|
15
|
+
self.content_position += 1
|
|
16
|
+
|
|
17
|
+
save
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def increment_provider_position
|
|
21
|
+
self.provider_position += 1
|
|
22
|
+
self.content_position = 1
|
|
23
|
+
|
|
24
|
+
save
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module BitPlayer
|
|
2
|
+
class Slide < ActiveRecord::Base
|
|
3
|
+
belongs_to :slideshow,
|
|
4
|
+
class_name: 'BitPlayer::Slideshow',
|
|
5
|
+
foreign_key: :bit_player_slideshow_id,
|
|
6
|
+
inverse_of: :slides
|
|
7
|
+
|
|
8
|
+
validates :title, :body, :position, presence: true
|
|
9
|
+
validates_numericality_of :position, greater_than_or_equal_to: 1
|
|
10
|
+
validates_uniqueness_of :position, scope: :bit_player_slideshow_id
|
|
11
|
+
|
|
12
|
+
def render_body
|
|
13
|
+
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, space_after_headers: true)
|
|
14
|
+
|
|
15
|
+
markdown.render(body).html_safe
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def self.update_positions(ids)
|
|
19
|
+
transaction do
|
|
20
|
+
connection.execute "SET CONSTRAINTS slide_position DEFERRED"
|
|
21
|
+
ids.each_with_index do |id, index|
|
|
22
|
+
where(id: id).update_all(position: index + 1)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module BitPlayer
|
|
2
|
+
class Slideshow < ActiveRecord::Base
|
|
3
|
+
has_many :slides,
|
|
4
|
+
-> { order 'position' },
|
|
5
|
+
class_name: 'BitPlayer::Slide',
|
|
6
|
+
foreign_key: :bit_player_slideshow_id,
|
|
7
|
+
dependent: :destroy,
|
|
8
|
+
inverse_of: :slideshow
|
|
9
|
+
has_one :bit_player_content_provider, as: :source_content, inverse_of: :source_content
|
|
10
|
+
|
|
11
|
+
validates :title, presence: true
|
|
12
|
+
|
|
13
|
+
accepts_nested_attributes_for :slides
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>BitPlayer</title>
|
|
5
|
+
<%= stylesheet_link_tag "bit_player/application", media: "all" %>
|
|
6
|
+
<%= javascript_include_tag "bit_player/application" %>
|
|
7
|
+
<%= csrf_meta_tags %>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
|
|
11
|
+
<%= yield %>
|
|
12
|
+
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|
data/config/routes.rb
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
class CreateBitPlayerContentModules < ActiveRecord::Migration
|
|
2
|
+
def change
|
|
3
|
+
create_table :bit_player_content_modules do |t|
|
|
4
|
+
t.string :title, null: false
|
|
5
|
+
t.string :context, null: false
|
|
6
|
+
t.integer :position, null: false, default: 1
|
|
7
|
+
|
|
8
|
+
t.timestamps
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
class CreateBitPlayerContentProviders < ActiveRecord::Migration
|
|
2
|
+
def change
|
|
3
|
+
create_table :bit_player_content_providers do |t|
|
|
4
|
+
t.string :type, null: false
|
|
5
|
+
t.string :source_content_type
|
|
6
|
+
t.integer :source_content_id
|
|
7
|
+
t.references :bit_player_content_module, null: false
|
|
8
|
+
t.integer :position, null: false, default: 1
|
|
9
|
+
|
|
10
|
+
t.timestamps
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
add_index :bit_player_content_providers, :bit_player_content_module_id, name: 'content_module_index'
|
|
14
|
+
|
|
15
|
+
reversible do |dir|
|
|
16
|
+
dir.up do
|
|
17
|
+
execute <<-SQL
|
|
18
|
+
ALTER TABLE bit_player_content_providers
|
|
19
|
+
ADD CONSTRAINT fk_content_providers_modules
|
|
20
|
+
FOREIGN KEY (bit_player_content_module_id)
|
|
21
|
+
REFERENCES bit_player_content_modules(id)
|
|
22
|
+
SQL
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
dir.down do
|
|
26
|
+
execute <<-SQL
|
|
27
|
+
ALTER TABLE bit_player_content_providers
|
|
28
|
+
DROP CONSTRAINT fk_content_providers_modules
|
|
29
|
+
SQL
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
class CreateBitPlayerParticipantStatuses < ActiveRecord::Migration
|
|
2
|
+
def change
|
|
3
|
+
create_table :bit_player_participant_statuses do |t|
|
|
4
|
+
t.string :context
|
|
5
|
+
t.integer :module_position
|
|
6
|
+
t.integer :provider_position
|
|
7
|
+
t.integer :content_position
|
|
8
|
+
t.integer :participant_id, null: false
|
|
9
|
+
|
|
10
|
+
t.timestamps
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
add_index :bit_player_participant_statuses, :participant_id, name: :index_participant_statuses_on_participant_id
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
class CreateBitPlayerSlides < ActiveRecord::Migration
|
|
2
|
+
def change
|
|
3
|
+
create_table :bit_player_slides do |t|
|
|
4
|
+
t.string :title
|
|
5
|
+
t.text :body, null: false
|
|
6
|
+
t.integer :position, null: false, default: 1
|
|
7
|
+
t.references :bit_player_slideshow, index: true, null: false
|
|
8
|
+
t.string :type
|
|
9
|
+
t.text :options
|
|
10
|
+
t.boolean :is_title_visible, null: false, default: true
|
|
11
|
+
|
|
12
|
+
t.timestamps
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
add_index :bit_player_slides, [:position, :bit_player_slideshow_id]
|
|
16
|
+
|
|
17
|
+
reversible do |dir|
|
|
18
|
+
dir.up do
|
|
19
|
+
execute <<-SQL
|
|
20
|
+
ALTER TABLE bit_player_slides
|
|
21
|
+
ADD CONSTRAINT fk_slides_slideshows
|
|
22
|
+
FOREIGN KEY (bit_player_slideshow_id)
|
|
23
|
+
REFERENCES bit_player_slideshows(id)
|
|
24
|
+
SQL
|
|
25
|
+
|
|
26
|
+
# make this constraint deferrable so that slide orders can be
|
|
27
|
+
# updated
|
|
28
|
+
execute <<-SQL
|
|
29
|
+
ALTER TABLE bit_player_slides
|
|
30
|
+
ADD CONSTRAINT slide_position UNIQUE (bit_player_slideshow_id, position)
|
|
31
|
+
DEFERRABLE INITIALLY IMMEDIATE
|
|
32
|
+
SQL
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
dir.down do
|
|
36
|
+
execute <<-SQL
|
|
37
|
+
ALTER TABLE bit_player_slides
|
|
38
|
+
DROP CONSTRAINT fk_slides_slideshows
|
|
39
|
+
SQL
|
|
40
|
+
|
|
41
|
+
execute <<-SQL
|
|
42
|
+
ALTER TABLE bit_player_slides
|
|
43
|
+
DROP CONSTRAINT IF EXISTS slide_position
|
|
44
|
+
SQL
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
data/lib/bit_player.rb
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
== README
|
|
2
|
+
|
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
|
4
|
+
application up and running.
|
|
5
|
+
|
|
6
|
+
Things you may want to cover:
|
|
7
|
+
|
|
8
|
+
* Ruby version
|
|
9
|
+
|
|
10
|
+
* System dependencies
|
|
11
|
+
|
|
12
|
+
* Configuration
|
|
13
|
+
|
|
14
|
+
* Database creation
|
|
15
|
+
|
|
16
|
+
* Database initialization
|
|
17
|
+
|
|
18
|
+
* How to run the test suite
|
|
19
|
+
|
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
|
21
|
+
|
|
22
|
+
* Deployment instructions
|
|
23
|
+
|
|
24
|
+
* ...
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
|
28
|
+
<tt>rake doc:app</tt>.
|
data/spec/dummy/Rakefile
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
|
2
|
+
// listed below.
|
|
3
|
+
//
|
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
|
6
|
+
//
|
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
8
|
+
// compiled file.
|
|
9
|
+
//
|
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
|
11
|
+
// about supported directives.
|
|
12
|
+
//
|
|
13
|
+
//= require_tree .
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
|
3
|
+
* listed below.
|
|
4
|
+
*
|
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
|
7
|
+
*
|
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
|
10
|
+
*
|
|
11
|
+
*= require_self
|
|
12
|
+
*= require_tree .
|
|
13
|
+
*/
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Dummy</title>
|
|
5
|
+
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
|
|
6
|
+
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
|
|
7
|
+
<%= csrf_meta_tags %>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
|
|
11
|
+
<%= yield %>
|
|
12
|
+
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|
data/spec/dummy/bin/rake
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
|
2
|
+
|
|
3
|
+
# Pick the frameworks you want:
|
|
4
|
+
require "active_record/railtie"
|
|
5
|
+
require "action_controller/railtie"
|
|
6
|
+
require "action_mailer/railtie"
|
|
7
|
+
require "sprockets/railtie"
|
|
8
|
+
# require "rails/test_unit/railtie"
|
|
9
|
+
|
|
10
|
+
Bundler.require(*Rails.groups)
|
|
11
|
+
require "bit_player"
|
|
12
|
+
|
|
13
|
+
module Dummy
|
|
14
|
+
class Application < Rails::Application
|
|
15
|
+
# Settings in config/environments/* take precedence over those specified here.
|
|
16
|
+
# Application configuration should go into files in config/initializers
|
|
17
|
+
# -- all .rb files in that directory are automatically loaded.
|
|
18
|
+
|
|
19
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
|
20
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
|
21
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
|
22
|
+
|
|
23
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
|
24
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
|
25
|
+
# config.i18n.default_locale = :de
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|