beef-slides 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +5 -0
- data/LICENSE +20 -0
- data/README.rdoc +7 -0
- data/Rakefile +56 -0
- data/VERSION +1 -0
- data/app/controllers/admin/slides_controller.rb +105 -0
- data/app/controllers/slides_controller.rb +9 -0
- data/app/helpers/slides_helper.rb +6 -0
- data/app/models/slide.rb +36 -0
- data/app/views/admin/slides/index.html.erb +51 -0
- data/app/views/admin/slides/show.html.erb +37 -0
- data/app/views/slides/index.html.erb +32 -0
- data/config/routes.rb +6 -0
- data/generators/slides_migration/slides_migration_generator.rb +11 -0
- data/generators/slides_migration/templates/migration.rb +24 -0
- data/lib/slides.rb +0 -0
- data/public/javascripts/swfobject.js +5 -0
- data/test/slides_test.rb +7 -0
- data/test/test_helper.rb +10 -0
- metadata +74 -0
data/.document
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Daniel Craig
|
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.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "slides"
|
8
|
+
gem.summary = %Q{Slide show generation}
|
9
|
+
gem.email = "daniel@wearebeef.co.uk"
|
10
|
+
gem.homepage = "http://github.com/dougle/slides"
|
11
|
+
gem.authors = ["Daniel Craig"]
|
12
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
13
|
+
end
|
14
|
+
|
15
|
+
rescue LoadError
|
16
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
17
|
+
end
|
18
|
+
|
19
|
+
require 'rake/testtask'
|
20
|
+
Rake::TestTask.new(:test) do |test|
|
21
|
+
test.libs << 'lib' << 'test'
|
22
|
+
test.pattern = 'test/**/*_test.rb'
|
23
|
+
test.verbose = true
|
24
|
+
end
|
25
|
+
|
26
|
+
begin
|
27
|
+
require 'rcov/rcovtask'
|
28
|
+
Rcov::RcovTask.new do |test|
|
29
|
+
test.libs << 'test'
|
30
|
+
test.pattern = 'test/**/*_test.rb'
|
31
|
+
test.verbose = true
|
32
|
+
end
|
33
|
+
rescue LoadError
|
34
|
+
task :rcov do
|
35
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
task :default => :test
|
41
|
+
|
42
|
+
require 'rake/rdoctask'
|
43
|
+
Rake::RDocTask.new do |rdoc|
|
44
|
+
if File.exist?('VERSION.yml')
|
45
|
+
config = YAML.load(File.read('VERSION.yml'))
|
46
|
+
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
47
|
+
else
|
48
|
+
version = ""
|
49
|
+
end
|
50
|
+
|
51
|
+
rdoc.rdoc_dir = 'rdoc'
|
52
|
+
rdoc.title = "slides #{version}"
|
53
|
+
rdoc.rdoc_files.include('README*')
|
54
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
55
|
+
end
|
56
|
+
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -0,0 +1,105 @@
|
|
1
|
+
class Admin::SlidesController < Admin::BaseController
|
2
|
+
sortable_attributes :position, :title, :published_at, :published_to
|
3
|
+
|
4
|
+
# GET /slides
|
5
|
+
# GET /slides.xml
|
6
|
+
def index
|
7
|
+
@slides = Slide.paginate :page => params[:page], :order => sort_order
|
8
|
+
|
9
|
+
respond_to do |format|
|
10
|
+
format.html # index.html.erb
|
11
|
+
format.xml { render :xml => @slides }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# GET /slides/1
|
16
|
+
# GET /slides/1.xml
|
17
|
+
def show
|
18
|
+
@slide = Slide.find(params[:id])
|
19
|
+
|
20
|
+
respond_to do |format|
|
21
|
+
format.html # show.html.erb
|
22
|
+
format.xml { render :xml => @slide }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# GET /slides/new
|
27
|
+
# GET /slides/new.xml
|
28
|
+
def new
|
29
|
+
@slide = Slide.new
|
30
|
+
|
31
|
+
respond_to do |format|
|
32
|
+
format.html { render :action => "show" }
|
33
|
+
format.xml { render :xml => @slide }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# POST /slides
|
38
|
+
# POST /slides.xml
|
39
|
+
def create
|
40
|
+
@slide = Slide.new(params[:slide])
|
41
|
+
|
42
|
+
respond_to do |format|
|
43
|
+
if @slide.save
|
44
|
+
flash[:notice] = 'Slide was successfully created.'
|
45
|
+
format.html { redirect_to(admin_slides_url) }
|
46
|
+
format.xml { render :xml => @slide, :status => :created, :location => @slide }
|
47
|
+
else
|
48
|
+
format.html { render :action => "show" }
|
49
|
+
format.xml { render :xml => @slide.errors, :status => :unprocessable_entity }
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# PUT /slides/1
|
55
|
+
# PUT /slides/1.xml
|
56
|
+
def update
|
57
|
+
@slide = Slide.find(params[:id])
|
58
|
+
|
59
|
+
respond_to do |format|
|
60
|
+
if @slide.update_attributes(params[:slide])
|
61
|
+
flash[:notice] = 'Slide was successfully updated.'
|
62
|
+
format.html { redirect_to(admin_slides_url) }
|
63
|
+
format.xml { head :ok }
|
64
|
+
else
|
65
|
+
format.html { render :action => "show" }
|
66
|
+
format.xml { render :xml => @slide.errors, :status => :unprocessable_entity }
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# DELETE /slides/1
|
72
|
+
# DELETE /slides/1.xml
|
73
|
+
def destroy
|
74
|
+
@slide = Slide.find(params[:id])
|
75
|
+
@slide.destroy
|
76
|
+
|
77
|
+
respond_to do |format|
|
78
|
+
format.html { redirect_to(admin_slides_url) }
|
79
|
+
format.xml { head :ok }
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
|
84
|
+
def move_up
|
85
|
+
@slide = Slide.find(params[:id])
|
86
|
+
@slide.move_higher
|
87
|
+
@slide.save
|
88
|
+
|
89
|
+
respond_to do |format|
|
90
|
+
format.html { redirect_to :back }
|
91
|
+
format.xml { render :xml => @slide }
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def move_down
|
96
|
+
@slide = Slide.find(params[:id])
|
97
|
+
@slide.move_lower
|
98
|
+
@slide.save
|
99
|
+
|
100
|
+
respond_to do |format|
|
101
|
+
format.html { redirect_to :back }
|
102
|
+
format.xml { render :xml => @slide }
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
module SlidesHelper
|
2
|
+
|
3
|
+
def create_banner(flash, dom_id, width, height, bgcolour = "ffffff", interval=10)
|
4
|
+
"<script type=\"text/javascript\" src=\"/javascripts/swfobject.js\"></script>\n<script type=\"text/javascript\">$(document).ready(function(){ if(swfobject) swfobject.embedSWF(\"#{flash}\", \"#{dom_id}\", \"#{width}\", \"#{height}\", \"9.0.0\", null, null, {menu: \"false\", bgcolor: \"\##{bgcolour}\"}, {interval:\"#{interval}\"}); }</script>"
|
5
|
+
end
|
6
|
+
end
|
data/app/models/slide.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
class Slide < ActiveRecord::Base
|
2
|
+
acts_as_publishable
|
3
|
+
acts_as_list :insert_position => :top
|
4
|
+
has_attachment :storage => :file_system, #Should be changed to S3 for production
|
5
|
+
:path_prefix => 'public/assets/slides', #Should be changed to S3 for production
|
6
|
+
:max_size => 5.megabytes,
|
7
|
+
:content_type => :image,
|
8
|
+
:resize_to => '750x422!'
|
9
|
+
|
10
|
+
validates_presence_of :size, :content_type, :if => :has_file?
|
11
|
+
validate :attachment_attributes_valid?, :if => :has_file?
|
12
|
+
|
13
|
+
|
14
|
+
attr_accessible :title, :date, :link, :strapline, :publish, :hide, :uploaded_data
|
15
|
+
|
16
|
+
# after_save :reindex
|
17
|
+
|
18
|
+
def to_json(options = {})
|
19
|
+
options.reverse_merge! :methods => :public_filename, :only => [:title, :strapline, :link, :date]
|
20
|
+
super options
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
def reindex
|
25
|
+
if self.created_at == self.updated_at #i.e. a new record
|
26
|
+
Slide.all(:order => 'popsition ASC, created_at DESC', :conditions => ['id != ', self.id]).each_with_index do |slide, index|
|
27
|
+
slide.update_attribute(:position, index)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def has_file?
|
33
|
+
filename != 'no_file'
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
<h1>Listing slides</h1>
|
2
|
+
|
3
|
+
<ul class="choices">
|
4
|
+
<li><%= link_to 'New slide', new_admin_slide_path %></li>
|
5
|
+
</ul>
|
6
|
+
|
7
|
+
<table>
|
8
|
+
<thead>
|
9
|
+
<tr>
|
10
|
+
<%= sortable_table_header :name => "Position", :sort => "position" %>
|
11
|
+
<th>Image</th>
|
12
|
+
<%= sortable_table_header :name => "Title", :sort => "title" %>
|
13
|
+
<td>Status</td>
|
14
|
+
<%= sortable_table_header :name => "Published At", :sort => "published_at" %>
|
15
|
+
<%= sortable_table_header :name => "Published To", :sort => "published_to" %>
|
16
|
+
<th>Actions</th>
|
17
|
+
</tr>
|
18
|
+
</thead>
|
19
|
+
|
20
|
+
<tbody>
|
21
|
+
<% @slides.each do |slide| %>
|
22
|
+
<tr>
|
23
|
+
<th><%=h (slide.position || 0) + 1 %></th>
|
24
|
+
<td><%= image_tag slide.public_filename, :width => 100 unless slide.filename == 'no_file' %></td>
|
25
|
+
<td><%=h slide.title %></td>
|
26
|
+
<td><%= content_status(slide) %></td>
|
27
|
+
<td><%=h slide.published_at.strftime('%d %b') unless slide.published_at.blank? %></td>
|
28
|
+
<td><%=h slide.published_to.strftime('%d %b') unless slide.published_to.blank? %></td>
|
29
|
+
<td>
|
30
|
+
<%= link_to 'Move Up', move_up_admin_slide_path(slide), :class => 'move-up' unless slide.position == 0 %>
|
31
|
+
<%= link_to 'Move Down', move_down_admin_slide_path(slide), :class => 'move-down' unless slide.position == @slides.length-1 %>
|
32
|
+
<%= link_to 'Edit', [:admin, slide], :class => 'edit' %>
|
33
|
+
<%= link_to 'Destroy', [:admin, slide], :confirm => 'Are you sure?', :method => :delete, :class => 'delete' %>
|
34
|
+
</td>
|
35
|
+
</tr>
|
36
|
+
<% end %>
|
37
|
+
<tbody>
|
38
|
+
|
39
|
+
<tfoot>
|
40
|
+
<tr>
|
41
|
+
<%= sortable_table_header :name => "Position", :sort => "position" %>
|
42
|
+
<th>Image</th>
|
43
|
+
<%= sortable_table_header :name => "Title", :sort => "title" %>
|
44
|
+
<td>Status</td>
|
45
|
+
<%= sortable_table_header :name => "Published At", :sort => "published_at" %>
|
46
|
+
<%= sortable_table_header :name => "Published To", :sort => "published_to" %>
|
47
|
+
<th>Actions</th>
|
48
|
+
</tr>
|
49
|
+
</tfoot>
|
50
|
+
|
51
|
+
</table>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<h1>Editing slide</h1>
|
2
|
+
|
3
|
+
<% form_for([:admin, @slide], :html => { :multipart => true}) do |f| %>
|
4
|
+
<%= f.error_messages %>
|
5
|
+
|
6
|
+
<p>
|
7
|
+
<%= f.label :title %><br />
|
8
|
+
<%= f.text_field :title %>
|
9
|
+
</p>
|
10
|
+
<p>
|
11
|
+
<%= f.label :strapline %><br />
|
12
|
+
<%= f.text_field :strapline %>
|
13
|
+
</p>
|
14
|
+
<p>
|
15
|
+
<%= f.label :link %><br />
|
16
|
+
<%= f.text_field :link %>
|
17
|
+
</p>
|
18
|
+
<p>
|
19
|
+
<%= f.label :uploaded_data, "Image" %><br />
|
20
|
+
<%= f.file_field :uploaded_data %>
|
21
|
+
</p>
|
22
|
+
<div class="module">
|
23
|
+
|
24
|
+
<%= publish_select(f) %>
|
25
|
+
|
26
|
+
<p class="submission">
|
27
|
+
<%= f.submit 'Publish', :name => 'slide[publish]' %>
|
28
|
+
<%= f.submit 'Save as draft', :name => 'slide[hide]' %>
|
29
|
+
or <%= link_to 'Cancel', admin_slides_path %>
|
30
|
+
</p>
|
31
|
+
</div>
|
32
|
+
<% end %>
|
33
|
+
|
34
|
+
<% content_for :sub_content do %>
|
35
|
+
<h2>Current Image</h2>
|
36
|
+
<%= image_tag @slide.public_filename(), :width => '100%' %>
|
37
|
+
<% end unless @slide.new_record? or @slide.filename == 'no_file' %>
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<h1>Listing slides</h1>
|
2
|
+
|
3
|
+
<table>
|
4
|
+
<tr>
|
5
|
+
<th>Title</th>
|
6
|
+
<th>Strapline</th>
|
7
|
+
<th>Date</th>
|
8
|
+
<th>Link</th>
|
9
|
+
<th>Position</th>
|
10
|
+
<th>Published at</th>
|
11
|
+
<th>Published to</th>
|
12
|
+
</tr>
|
13
|
+
|
14
|
+
<% @slides.each do |slide| %>
|
15
|
+
<tr>
|
16
|
+
<td><%=h slide.title %></td>
|
17
|
+
<td><%=h slide.strapline %></td>
|
18
|
+
<td><%=h slide.date %></td>
|
19
|
+
<td><%=h slide.link %></td>
|
20
|
+
<td><%=h slide.position %></td>
|
21
|
+
<td><%=h slide.published_at %></td>
|
22
|
+
<td><%=h slide.published_to %></td>
|
23
|
+
<td><%= link_to 'Show', slide %></td>
|
24
|
+
<td><%= link_to 'Edit', edit_slide_path(slide) %></td>
|
25
|
+
<td><%= link_to 'Destroy', slide, :confirm => 'Are you sure?', :method => :delete %></td>
|
26
|
+
</tr>
|
27
|
+
<% end %>
|
28
|
+
</table>
|
29
|
+
|
30
|
+
<br />
|
31
|
+
|
32
|
+
<%= link_to 'New slide', new_slide_path %>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
class CreateSlides < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :slides do |t|
|
4
|
+
t.string :title
|
5
|
+
t.string :strapline
|
6
|
+
t.string :link
|
7
|
+
t.integer :position, :default => 0
|
8
|
+
t.datetime :published_at
|
9
|
+
t.datetime :published_to
|
10
|
+
|
11
|
+
t.string :filename, :default => 'no_file'
|
12
|
+
t.string :content_type
|
13
|
+
t.integer :size, :height, :width
|
14
|
+
t.references :parent
|
15
|
+
t.string :thumbnail
|
16
|
+
|
17
|
+
t.timestamps
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.down
|
22
|
+
drop_table :slides
|
23
|
+
end
|
24
|
+
end
|
data/lib/slides.rb
ADDED
File without changes
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/* SWFObject v2.1 <http://code.google.com/p/swfobject/>
|
2
|
+
Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis
|
3
|
+
This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
|
4
|
+
*/
|
5
|
+
var swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return }f(H);if(h.ie&&h.win){try{K.write("<script id=__ie_ondomload defer=true src=//:><\/script>");J=C("__ie_ondomload");if(J){I(J,"onreadystatechange",S)}}catch(q){}}if(h.webkit&&typeof K.readyState!=b){Z=setInterval(function(){if(/loaded|complete/.test(K.readyState)){E()}},10)}if(typeof K.addEventListener!=b){K.addEventListener("DOMContentLoaded",E,null)}R(E)}();function S(){if(J.readyState=="complete"){J.parentNode.removeChild(J);E()}}function E(){if(e){return }if(h.ie&&h.win){var v=a("span");try{var u=K.getElementsByTagName("body")[0].appendChild(v);u.parentNode.removeChild(u)}catch(w){return }}e=true;if(Z){clearInterval(Z);Z=null}var q=o.length;for(var r=0;r<q;r++){o[r]()}}function f(q){if(e){q()}else{o[o.length]=q}}function R(r){if(typeof j.addEventListener!=b){j.addEventListener("load",r,false)}else{if(typeof K.addEventListener!=b){K.addEventListener("load",r,false)}else{if(typeof j.attachEvent!=b){I(j,"onload",r)}else{if(typeof j.onload=="function"){var q=j.onload;j.onload=function(){q();r()}}else{j.onload=r}}}}}function H(){var t=N.length;for(var q=0;q<t;q++){var u=N[q].id;if(h.pv[0]>0){var r=C(u);if(r){N[q].width=r.getAttribute("width")?r.getAttribute("width"):"0";N[q].height=r.getAttribute("height")?r.getAttribute("height"):"0";if(c(N[q].swfVersion)){if(h.webkit&&h.webkit<312){Y(r)}W(u,true)}else{if(N[q].expressInstall&&!A&&c("6.0.65")&&(h.win||h.mac)){k(N[q])}else{O(r)}}}}else{W(u,true)}}}function Y(t){var q=t.getElementsByTagName(Q)[0];if(q){var w=a("embed"),y=q.attributes;if(y){var v=y.length;for(var u=0;u<v;u++){if(y[u].nodeName=="DATA"){w.setAttribute("src",y[u].nodeValue)}else{w.setAttribute(y[u].nodeName,y[u].nodeValue)}}}var x=q.childNodes;if(x){var z=x.length;for(var r=0;r<z;r++){if(x[r].nodeType==1&&x[r].nodeName=="PARAM"){w.setAttribute(x[r].getAttribute("name"),x[r].getAttribute("value"))}}}t.parentNode.replaceChild(w,t)}}function k(w){A=true;var u=C(w.id);if(u){if(w.altContentId){var y=C(w.altContentId);if(y){M=y;l=w.altContentId}}else{M=G(u)}if(!(/%$/.test(w.width))&&parseInt(w.width,10)<310){w.width="310"}if(!(/%$/.test(w.height))&&parseInt(w.height,10)<137){w.height="137"}K.title=K.title.slice(0,47)+" - Flash Player Installation";var z=h.ie&&h.win?"ActiveX":"PlugIn",q=K.title,r="MMredirectURL="+j.location+"&MMplayerType="+z+"&MMdoctitle="+q,x=w.id;if(h.ie&&h.win&&u.readyState!=4){var t=a("div");x+="SWFObjectNew";t.setAttribute("id",x);u.parentNode.insertBefore(t,u);u.style.display="none";var v=function(){u.parentNode.removeChild(u)};I(j,"onload",v)}U({data:w.expressInstall,id:m,width:w.width,height:w.height},{flashvars:r},x)}}function O(t){if(h.ie&&h.win&&t.readyState!=4){var r=a("div");t.parentNode.insertBefore(r,t);r.parentNode.replaceChild(G(t),r);t.style.display="none";var q=function(){t.parentNode.removeChild(t)};I(j,"onload",q)}else{t.parentNode.replaceChild(G(t),t)}}function G(v){var u=a("div");if(h.win&&h.ie){u.innerHTML=v.innerHTML}else{var r=v.getElementsByTagName(Q)[0];if(r){var w=r.childNodes;if(w){var q=w.length;for(var t=0;t<q;t++){if(!(w[t].nodeType==1&&w[t].nodeName=="PARAM")&&!(w[t].nodeType==8)){u.appendChild(w[t].cloneNode(true))}}}}}return u}function U(AG,AE,t){var q,v=C(t);if(v){if(typeof AG.id==b){AG.id=t}if(h.ie&&h.win){var AF="";for(var AB in AG){if(AG[AB]!=Object.prototype[AB]){if(AB.toLowerCase()=="data"){AE.movie=AG[AB]}else{if(AB.toLowerCase()=="styleclass"){AF+=' class="'+AG[AB]+'"'}else{if(AB.toLowerCase()!="classid"){AF+=" "+AB+'="'+AG[AB]+'"'}}}}}var AD="";for(var AA in AE){if(AE[AA]!=Object.prototype[AA]){AD+='<param name="'+AA+'" value="'+AE[AA]+'" />'}}v.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AF+">"+AD+"</object>";i[i.length]=AG.id;q=C(AG.id)}else{if(h.webkit&&h.webkit<312){var AC=a("embed");AC.setAttribute("type",P);for(var z in AG){if(AG[z]!=Object.prototype[z]){if(z.toLowerCase()=="data"){AC.setAttribute("src",AG[z])}else{if(z.toLowerCase()=="styleclass"){AC.setAttribute("class",AG[z])}else{if(z.toLowerCase()!="classid"){AC.setAttribute(z,AG[z])}}}}}for(var y in AE){if(AE[y]!=Object.prototype[y]){if(y.toLowerCase()!="movie"){AC.setAttribute(y,AE[y])}}}v.parentNode.replaceChild(AC,v);q=AC}else{var u=a(Q);u.setAttribute("type",P);for(var x in AG){if(AG[x]!=Object.prototype[x]){if(x.toLowerCase()=="styleclass"){u.setAttribute("class",AG[x])}else{if(x.toLowerCase()!="classid"){u.setAttribute(x,AG[x])}}}}for(var w in AE){if(AE[w]!=Object.prototype[w]&&w.toLowerCase()!="movie"){F(u,w,AE[w])}}v.parentNode.replaceChild(u,v);q=u}}}return q}function F(t,q,r){var u=a("param");u.setAttribute("name",q);u.setAttribute("value",r);t.appendChild(u)}function X(r){var q=C(r);if(q&&(q.nodeName=="OBJECT"||q.nodeName=="EMBED")){if(h.ie&&h.win){if(q.readyState==4){B(r)}else{j.attachEvent("onload",function(){B(r)})}}else{q.parentNode.removeChild(q)}}}function B(t){var r=C(t);if(r){for(var q in r){if(typeof r[q]=="function"){r[q]=null}}r.parentNode.removeChild(r)}}function C(t){var q=null;try{q=K.getElementById(t)}catch(r){}return q}function a(q){return K.createElement(q)}function I(t,q,r){t.attachEvent(q,r);d[d.length]=[t,q,r]}function c(t){var r=h.pv,q=t.split(".");q[0]=parseInt(q[0],10);q[1]=parseInt(q[1],10)||0;q[2]=parseInt(q[2],10)||0;return(r[0]>q[0]||(r[0]==q[0]&&r[1]>q[1])||(r[0]==q[0]&&r[1]==q[1]&&r[2]>=q[2]))?true:false}function V(v,r){if(h.ie&&h.mac){return }var u=K.getElementsByTagName("head")[0],t=a("style");t.setAttribute("type","text/css");t.setAttribute("media","screen");if(!(h.ie&&h.win)&&typeof K.createTextNode!=b){t.appendChild(K.createTextNode(v+" {"+r+"}"))}u.appendChild(t);if(h.ie&&h.win&&typeof K.styleSheets!=b&&K.styleSheets.length>0){var q=K.styleSheets[K.styleSheets.length-1];if(typeof q.addRule==Q){q.addRule(v,r)}}}function W(t,q){var r=q?"visible":"hidden";if(e&&C(t)){C(t).style.visibility=r}else{V("#"+t,"visibility:"+r)}}function g(s){var r=/[\\\"<>\.;]/;var q=r.exec(s)!=null;return q?encodeURIComponent(s):s}var D=function(){if(h.ie&&h.win){window.attachEvent("onunload",function(){var w=d.length;for(var v=0;v<w;v++){d[v][0].detachEvent(d[v][1],d[v][2])}var t=i.length;for(var u=0;u<t;u++){X(i[u])}for(var r in h){h[r]=null}h=null;for(var q in swfobject){swfobject[q]=null}swfobject=null})}}();return{registerObject:function(u,q,t){if(!h.w3cdom||!u||!q){return }var r={};r.id=u;r.swfVersion=q;r.expressInstall=t?t:false;N[N.length]=r;W(u,false)},getObjectById:function(v){var q=null;if(h.w3cdom){var t=C(v);if(t){var u=t.getElementsByTagName(Q)[0];if(!u||(u&&typeof t.SetVariable!=b)){q=t}else{if(typeof u.SetVariable!=b){q=u}}}}return q},embedSWF:function(x,AE,AB,AD,q,w,r,z,AC){if(!h.w3cdom||!x||!AE||!AB||!AD||!q){return }AB+="";AD+="";if(c(q)){W(AE,false);var AA={};if(AC&&typeof AC===Q){for(var v in AC){if(AC[v]!=Object.prototype[v]){AA[v]=AC[v]}}}AA.data=x;AA.width=AB;AA.height=AD;var y={};if(z&&typeof z===Q){for(var u in z){if(z[u]!=Object.prototype[u]){y[u]=z[u]}}}if(r&&typeof r===Q){for(var t in r){if(r[t]!=Object.prototype[t]){if(typeof y.flashvars!=b){y.flashvars+="&"+t+"="+r[t]}else{y.flashvars=t+"="+r[t]}}}}f(function(){U(AA,y,AE);if(AA.id==AE){W(AE,true)}})}else{if(w&&!A&&c("6.0.65")&&(h.win||h.mac)){A=true;W(AE,false);f(function(){var AF={};AF.id=AF.altContentId=AE;AF.width=AB;AF.height=AD;AF.expressInstall=w;k(AF)})}}},getFlashPlayerVersion:function(){return{major:h.pv[0],minor:h.pv[1],release:h.pv[2]}},hasFlashPlayerVersion:c,createSWF:function(t,r,q){if(h.w3cdom){return U(t,r,q)}else{return undefined}},removeSWF:function(q){if(h.w3cdom){X(q)}},createCSS:function(r,q){if(h.w3cdom){V(r,q)}},addDomLoadEvent:f,addLoadEvent:R,getQueryParamValue:function(v){var u=K.location.search||K.location.hash;if(v==null){return g(u)}if(u){var t=u.substring(1).split("&");for(var r=0;r<t.length;r++){if(t[r].substring(0,t[r].indexOf("="))==v){return g(t[r].substring((t[r].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(A&&M){var q=C(m);if(q){q.parentNode.replaceChild(M,q);if(l){W(l,true);if(h.ie&&h.win){M.style.display="block"}}M=null;l=null;A=false}}}}}();
|
data/test/slides_test.rb
ADDED
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: beef-slides
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Daniel Craig
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-07-08 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description:
|
17
|
+
email: daniel@wearebeef.co.uk
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- LICENSE
|
24
|
+
- README.rdoc
|
25
|
+
files:
|
26
|
+
- .document
|
27
|
+
- .gitignore
|
28
|
+
- LICENSE
|
29
|
+
- README.rdoc
|
30
|
+
- Rakefile
|
31
|
+
- VERSION
|
32
|
+
- app/controllers/admin/slides_controller.rb
|
33
|
+
- app/controllers/slides_controller.rb
|
34
|
+
- app/helpers/slides_helper.rb
|
35
|
+
- app/models/slide.rb
|
36
|
+
- app/views/admin/slides/index.html.erb
|
37
|
+
- app/views/admin/slides/show.html.erb
|
38
|
+
- app/views/slides/index.html.erb
|
39
|
+
- config/routes.rb
|
40
|
+
- generators/slides_migration/slides_migration_generator.rb
|
41
|
+
- generators/slides_migration/templates/migration.rb
|
42
|
+
- lib/slides.rb
|
43
|
+
- public/javascripts/swfobject.js
|
44
|
+
- test/slides_test.rb
|
45
|
+
- test/test_helper.rb
|
46
|
+
has_rdoc: false
|
47
|
+
homepage: http://github.com/dougle/slides
|
48
|
+
post_install_message:
|
49
|
+
rdoc_options:
|
50
|
+
- --charset=UTF-8
|
51
|
+
require_paths:
|
52
|
+
- lib
|
53
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: "0"
|
58
|
+
version:
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: "0"
|
64
|
+
version:
|
65
|
+
requirements: []
|
66
|
+
|
67
|
+
rubyforge_project:
|
68
|
+
rubygems_version: 1.2.0
|
69
|
+
signing_key:
|
70
|
+
specification_version: 3
|
71
|
+
summary: Slide show generation
|
72
|
+
test_files:
|
73
|
+
- test/slides_test.rb
|
74
|
+
- test/test_helper.rb
|