beef-slides 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/app/controllers/admin/slides_controller.rb +1 -1
- data/app/controllers/slides_controller.rb +1 -1
- data/app/helpers/slides_helper.rb +1 -1
- data/app/models/slide.rb +4 -7
- data/slides.gemspec +56 -0
- metadata +3 -3
- data/app/views/slides/index.html.erb +0 -32
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
@@ -4,7 +4,7 @@ class Admin::SlidesController < Admin::BaseController
|
|
4
4
|
# GET /slides
|
5
5
|
# GET /slides.xml
|
6
6
|
def index
|
7
|
-
@slides = Slide.paginate :page => params[:page], :order => sort_order
|
7
|
+
@slides = Slide.paginate :page => params[:page], :order => sort_order(:default => 'asc')
|
8
8
|
|
9
9
|
respond_to do |format|
|
10
10
|
format.html # index.html.erb
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module SlidesHelper
|
2
2
|
|
3
3
|
def create_banner(flash, dom_id, width, height, bgcolour = "ffffff", interval=10)
|
4
|
-
"<script type=\"text/javascript\"
|
4
|
+
"<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
5
|
end
|
6
6
|
end
|
data/app/models/slide.rb
CHANGED
@@ -4,16 +4,14 @@ class Slide < ActiveRecord::Base
|
|
4
4
|
has_attachment :storage => :file_system, #Should be changed to S3 for production
|
5
5
|
:path_prefix => 'public/assets/slides', #Should be changed to S3 for production
|
6
6
|
:max_size => 5.megabytes,
|
7
|
-
:content_type => :image
|
8
|
-
:resize_to => '750x422!'
|
7
|
+
:content_type => :image
|
9
8
|
|
10
9
|
validates_presence_of :size, :content_type, :if => :has_file?
|
11
10
|
validate :attachment_attributes_valid?, :if => :has_file?
|
12
|
-
|
13
|
-
|
11
|
+
|
14
12
|
attr_accessible :title, :date, :link, :strapline, :publish, :hide, :uploaded_data
|
15
13
|
|
16
|
-
|
14
|
+
default_scope :order => 'position ASC'
|
17
15
|
|
18
16
|
def to_json(options = {})
|
19
17
|
options.reverse_merge! :methods => :public_filename, :only => [:title, :strapline, :link, :date]
|
@@ -23,7 +21,7 @@ class Slide < ActiveRecord::Base
|
|
23
21
|
private
|
24
22
|
def reindex
|
25
23
|
if self.created_at == self.updated_at #i.e. a new record
|
26
|
-
Slide.all(:order => '
|
24
|
+
Slide.all(:order => 'position ASC, created_at DESC', :conditions => ['id != ', self.id]).each_with_index do |slide, index|
|
27
25
|
slide.update_attribute(:position, index)
|
28
26
|
end
|
29
27
|
end
|
@@ -32,5 +30,4 @@ private
|
|
32
30
|
def has_file?
|
33
31
|
filename != 'no_file'
|
34
32
|
end
|
35
|
-
|
36
33
|
end
|
data/slides.gemspec
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{slides}
|
5
|
+
s.version = "0.1.1"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Daniel Craig"]
|
9
|
+
s.date = %q{2009-07-14}
|
10
|
+
s.email = %q{daniel@wearebeef.co.uk}
|
11
|
+
s.extra_rdoc_files = [
|
12
|
+
"LICENSE",
|
13
|
+
"README.rdoc"
|
14
|
+
]
|
15
|
+
s.files = [
|
16
|
+
".document",
|
17
|
+
".gitignore",
|
18
|
+
"LICENSE",
|
19
|
+
"README.rdoc",
|
20
|
+
"Rakefile",
|
21
|
+
"VERSION",
|
22
|
+
"app/controllers/admin/slides_controller.rb",
|
23
|
+
"app/controllers/slides_controller.rb",
|
24
|
+
"app/helpers/slides_helper.rb",
|
25
|
+
"app/models/slide.rb",
|
26
|
+
"app/views/admin/slides/index.html.erb",
|
27
|
+
"app/views/admin/slides/show.html.erb",
|
28
|
+
"config/routes.rb",
|
29
|
+
"generators/slides_migration/slides_migration_generator.rb",
|
30
|
+
"generators/slides_migration/templates/migration.rb",
|
31
|
+
"lib/slides.rb",
|
32
|
+
"public/javascripts/swfobject.js",
|
33
|
+
"slides.gemspec",
|
34
|
+
"test/slides_test.rb",
|
35
|
+
"test/test_helper.rb"
|
36
|
+
]
|
37
|
+
s.homepage = %q{http://github.com/dougle/slides}
|
38
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
39
|
+
s.require_paths = ["lib"]
|
40
|
+
s.rubygems_version = %q{1.3.3}
|
41
|
+
s.summary = %q{Slide show generation}
|
42
|
+
s.test_files = [
|
43
|
+
"test/slides_test.rb",
|
44
|
+
"test/test_helper.rb"
|
45
|
+
]
|
46
|
+
|
47
|
+
if s.respond_to? :specification_version then
|
48
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
49
|
+
s.specification_version = 3
|
50
|
+
|
51
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
52
|
+
else
|
53
|
+
end
|
54
|
+
else
|
55
|
+
end
|
56
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beef-slides
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Craig
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-07-
|
12
|
+
date: 2009-07-14 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -35,12 +35,12 @@ files:
|
|
35
35
|
- app/models/slide.rb
|
36
36
|
- app/views/admin/slides/index.html.erb
|
37
37
|
- app/views/admin/slides/show.html.erb
|
38
|
-
- app/views/slides/index.html.erb
|
39
38
|
- config/routes.rb
|
40
39
|
- generators/slides_migration/slides_migration_generator.rb
|
41
40
|
- generators/slides_migration/templates/migration.rb
|
42
41
|
- lib/slides.rb
|
43
42
|
- public/javascripts/swfobject.js
|
43
|
+
- slides.gemspec
|
44
44
|
- test/slides_test.rb
|
45
45
|
- test/test_helper.rb
|
46
46
|
has_rdoc: false
|
@@ -1,32 +0,0 @@
|
|
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 %>
|