mrunleaded-photo_album 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2008 Scott Chacon
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,18 @@
1
+ Photo Album Generator
2
+ =====================
3
+
4
+ This is a basic photo album generator for Rails 2.0
5
+
6
+ Requires
7
+
8
+ git clone git://github.com/Lipsiasoft/lightbox.git
9
+ http://svn.techno-weenie.net/projects/plugins/attachment_fu/
10
+
11
+
12
+ Installation
13
+ ============
14
+ 1. ./script/plugin install http://svn.techno-weenie.net/projects/plugins/attachment_fu/
15
+ 2. git clone git://github.com/Lipsiasoft/lightbox.git vendor/plugins/lightbox
16
+ 2.1 ruby vendor/plugins/lightbox/install.rb
17
+ 3. ./script/generate photo_album
18
+ 4. rake db:migrate
@@ -0,0 +1,28 @@
1
+ require 'rubygems'
2
+ Gem::manage_gems
3
+ require 'rake/gempackagetask'
4
+
5
+ spec = eval(File.read('photo_album.gemspec'))
6
+
7
+ Rake::GemPackageTask.new(spec) do |pkg|
8
+ pkg.need_tar = true
9
+ end
10
+
11
+ task :default => "pkg/#{spec.name}-#{spec.version}.gem" do
12
+ puts "generated latest version"
13
+ end
14
+
15
+ desc "Regenerate Documentation"
16
+ task :doc do |t|
17
+ system('rdoc lib/ README --main README --inline-source')
18
+ end
19
+
20
+ desc "Upload Docs"
21
+ task :upload_docs do |t|
22
+ system('rsync -rv --delete doc/ git.rubyforge.org:/var/www/gforge-projects/git')
23
+ end
24
+
25
+ desc "Run Unit Tests"
26
+ task :test do |t|
27
+ require File.dirname(__FILE__) + '/tests/all_tests.rb'
28
+ end
data/USAGE ADDED
File without changes
@@ -0,0 +1,10 @@
1
+ spec = Gem::Specification.new do |s|
2
+ s.platform = Gem::Platform::RUBY
3
+ s.name = "photo_album"
4
+ s.version = "0.0.5"
5
+ s.author = "Kevin Thompson"
6
+ s.email = "mrunleaded@gmail.com"
7
+ s.summary = "A simple photo album plugin/generator."
8
+ s.files = ["LICENSE", "photo_album.gemspec", "photo_album_generator.rb", "Rakefile", "README.mkdn", "templates/app/controllers/albums_controller.rb", "templates/app/controllers/photos_controller.rb", "templates/app/helpers/albums_helper.rb", "templates/app/models/album.rb", "templates/app/models/photo.rb", "templates/app/views/albums/_album.html.erb", "templates/app/views/albums/_form.html.erb", "templates/app/views/albums/_photo.html.erb", "templates/app/views/albums/edit.html.erb", "templates/app/views/albums/index.html.erb", "templates/app/views/albums/new.html.erb", "templates/app/views/albums/show.html.erb", "templates/app/views/layouts/albums.html.erb", "templates/INSTALL", "templates/migrate/create_albums.rb", "templates/migrate/create_photos.rb", "templates/public/javascripts/albums.js", "templates/public/stylesheets/albums.css", "templates/public/stylesheets/grid.css", "USAGE"]
9
+ s.has_rdoc = true
10
+ end
@@ -0,0 +1,112 @@
1
+ require 'rails_generator'
2
+ require 'rails_generator/commands'
3
+
4
+ module PhotoAlbum #:nodoc:
5
+ module Generator #:nodoc:
6
+ module Commands #:nodoc:
7
+ module Create
8
+ def resource_has_many_resources(resource, nested_resource)
9
+ resource = resource.to_sym.inspect
10
+ nested_resource = nested_resource.to_sym.inspect
11
+ sentinel = 'ActionController::Routing::Routes.draw do |map|'
12
+
13
+ logger.route "map.resources #{resource}, :has_many => #{nested_resource}"
14
+ unless options[:pretend]
15
+ gsub_file 'config/routes.rb', /(#{Regexp.escape(sentinel)})/mi do |match|
16
+ "#{match}\n map.resources #{resource}, :has_many => #{nested_resource}\n"
17
+ end
18
+ end
19
+ end
20
+ end
21
+
22
+ module Destroy
23
+ def resource_has_many_resources(resource, nested_resource)
24
+ resource = resource.to_sym.inspect
25
+ nested_resource = nested_resource.to_sym.inspect
26
+
27
+ look_for = "\n map.resources #{resource}, :has_many => #{nested_resource}\n"
28
+ logger.route "map.resources #{resource}, :has_many => #{nested_resource}"
29
+ gsub_file 'config/routes.rb', /(#{look_for})/mi, ''
30
+ end
31
+ end
32
+
33
+ module List
34
+ def resource_has_many_resources(resource, nested_resource)
35
+ resource = resource.to_sym.inspect
36
+ nested_resource = nested_resource.to_sym.inspect
37
+
38
+ logger.route "map.resources #{resource}, :has_many => #{nested_resource}"
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+
45
+ Rails::Generator::Commands::Create.send :include, PhotoAlbum::Generator::Commands::Create
46
+ Rails::Generator::Commands::Destroy.send :include, PhotoAlbum::Generator::Commands::Destroy
47
+ Rails::Generator::Commands::List.send :include, PhotoAlbum::Generator::Commands::List
48
+
49
+ class PhotoAlbumGenerator < Rails::Generator::Base
50
+
51
+ def manifest
52
+ record do |m|
53
+ m.class_collisions "AlbumsController", "PhotosController", "Album", "Photo"
54
+
55
+ #controllers
56
+ m.directory "app/controllers"
57
+ m.file "app/controllers/photos_controller.rb", "app/controllers/photos_controller.rb"
58
+ m.file "app/controllers/albums_controller.rb", "app/controllers/albums_controller.rb"
59
+
60
+ #helpers
61
+ m.directory "app/helpers"
62
+ m.file "app/helpers/albums_helper.rb", "app/helpers/albums_helper.rb"
63
+
64
+ #migrations
65
+ m.migration_template "migrate/create_albums.rb", "db/migrate", :migration_file_name => "create_albums"
66
+ m.migration_template "migrate/create_photos.rb", "db/migrate", :migration_file_name => "create_photos"
67
+
68
+ #models
69
+ m.directory "app/models"
70
+ m.file "app/models/album.rb", "app/models/album.rb"
71
+ m.file "app/models/photo.rb", "app/models/photo.rb"
72
+
73
+ #public
74
+ m.file "public/javascripts/albums.js", "public/javascripts/albums.js"
75
+ m.file "public/stylesheets/albums.css", "public/stylesheets/albums.css"
76
+ m.file "public/stylesheets/grid.css", "public/stylesheets/grid.css"
77
+
78
+ #tests
79
+
80
+ #layout
81
+ m.directory "app/views/layouts"
82
+ m.file "app/views/layouts/albums.html.erb", "app/views/layouts/albums.html.erb"
83
+
84
+ #views
85
+ m.directory "app/views/albums"
86
+ m.file "app/views/albums/_album.html.erb", "app/views/albums/_album.html.erb"
87
+ m.file "app/views/albums/_photo.html.erb", "app/views/albums/_photo.html.erb"
88
+ m.file "app/views/albums/_form.html.erb", "app/views/albums/_form.html.erb"
89
+ m.file "app/views/albums/show.html.erb", "app/views/albums/show.html.erb"
90
+ m.file "app/views/albums/index.html.erb", "app/views/albums/index.html.erb"
91
+ m.file "app/views/albums/edit.html.erb", "app/views/albums/edit.html.erb"
92
+ m.file "app/views/albums/new.html.erb", "app/views/albums/new.html.erb"
93
+
94
+ m.resource_has_many_resources "albums", "photos"
95
+
96
+ m.readme "INSTALL"
97
+ end
98
+ end
99
+
100
+ def route_resources(*resources)
101
+ resource_list = resources.map { |r| r.to_sym.inspect }.join(', ')
102
+ sentinel = 'ActionController::Routing::Routes.draw do |map|'
103
+
104
+ logger.route "map.resources #{resource_list}"
105
+ unless options[:pretend]
106
+ gsub_file 'config/routes.rb', /(#{Regexp.escape(sentinel)})/mi do |match|
107
+ "#{match}\n map.resources #{resource_list}\n"
108
+ end
109
+ end
110
+ end
111
+
112
+ end
File without changes
@@ -0,0 +1,85 @@
1
+ class AlbumsController < ApplicationController
2
+ # GET /albums
3
+ # GET /albums.xml
4
+ def index
5
+ @albums = Album.find(:all)
6
+
7
+ respond_to do |format|
8
+ format.html # index.html.erb
9
+ format.xml { render :xml => @albums }
10
+ end
11
+ end
12
+
13
+ # GET /albums/1
14
+ # GET /albums/1.xml
15
+ def show
16
+ @album = Album.find(params[:id])
17
+
18
+ respond_to do |format|
19
+ format.html # show.html.erb
20
+ format.xml { render :xml => @album }
21
+ end
22
+ end
23
+
24
+ # GET /albums/new
25
+ # GET /albums/new.xml
26
+ def new
27
+ @album = Album.new
28
+
29
+ respond_to do |format|
30
+ format.html # new.html.erb
31
+ format.xml { render :xml => @album }
32
+ end
33
+ end
34
+
35
+ # GET /albums/1/edit
36
+ def edit
37
+ @album = Album.find(params[:id])
38
+ end
39
+
40
+ # POST /albums
41
+ # POST /albums.xml
42
+ def create
43
+ @album = Album.new(params[:album])
44
+
45
+ respond_to do |format|
46
+ if @album.save
47
+ flash[:notice] = 'Album was successfully created.'
48
+ format.html { redirect_to(@album) }
49
+ format.xml { render :xml => @album, :status => :created, :location => @album }
50
+ else
51
+ format.html { render :action => "new" }
52
+ format.xml { render :xml => @album.errors, :status => :unprocessable_entity }
53
+ end
54
+ end
55
+ end
56
+
57
+ # PUT /albums/1
58
+ # PUT /albums/1.xml
59
+ def update
60
+ @album = Album.find(params[:id])
61
+
62
+ respond_to do |format|
63
+ if @album.update_attributes(params[:album])
64
+ flash[:notice] = 'Album was successfully updated.'
65
+ format.html { redirect_to(@album) }
66
+ format.xml { head :ok }
67
+ else
68
+ format.html { render :action => "edit" }
69
+ format.xml { render :xml => @album.errors, :status => :unprocessable_entity }
70
+ end
71
+ end
72
+ end
73
+
74
+ # DELETE /albums/1
75
+ # DELETE /albums/1.xml
76
+ def destroy
77
+ @album = Album.find(params[:id])
78
+ @album.destroy
79
+
80
+ respond_to do |format|
81
+ format.html { redirect_to(albums_url) }
82
+ format.xml { head :ok }
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,34 @@
1
+ class PhotosController < ApplicationController
2
+ # POST /photos
3
+ # POST /photos.xml
4
+ def create
5
+ @album = Album.find(params[:album_id])
6
+ @photo = Photo.new(params[:photo])
7
+
8
+ respond_to do |format|
9
+ if @photo.save
10
+ @album.photos << @photo
11
+ flash[:notice] = 'Photo was successfully created.'
12
+ format.html { redirect_to(album_url(@album)) }
13
+ format.xml { render :xml => @photo, :status => :created, :location => @photo }
14
+ else
15
+ flash[:error] = 'Unable to save photo.'
16
+ format.html { redirect_to(album_url(@album)) }
17
+ format.xml { render :xml => @photo.errors, :status => :unprocessable_entity }
18
+ end
19
+ end
20
+ end
21
+
22
+ # DELETE /photos/1
23
+ # DELETE /photos/1.xml
24
+ def destroy
25
+ @album = Album.find(params[:album_id])
26
+ @photo = Photo.find(params[:id])
27
+ @photo.destroy
28
+
29
+ respond_to do |format|
30
+ format.html { redirect_to(album_url(@album)) }
31
+ format.xml { head :ok }
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,39 @@
1
+ module AlbumsHelper
2
+ def album_tag(album, counter, &proc)
3
+ concat("<div class=\"album box span-4 prepend-1 append-1#{" last" if (counter % 4) == 3}\" id=\"album#{album.id}\">", proc.binding)
4
+ concat(
5
+ editable_content(
6
+ :content => {
7
+ :text => album.name,
8
+ :options => {:id => "album_edit_#{album.id}", :class => 'editable-content'}
9
+ },
10
+ :url => album_path(album),
11
+ :ajax => {
12
+ :callback => %Q{function(form, value){ return "_method=put&authenticity_token=#{form_authenticity_token}&album[name]=" + escape(value);}}
13
+ }
14
+ ), proc.binding)
15
+ yield
16
+ concat(javascript_tag("new Album(\"album#{album.id}\");\n"), proc.binding)
17
+ concat("</div>", proc.binding)
18
+ end
19
+
20
+ def editable_content(options)
21
+ options[:content] = { :element => 'div' }.merge(options[:content])
22
+ options[:url] = "" if options[:url].nil?
23
+ options[:ajax] = { :okText => "'Save'", :cancelText => "'Cancel'"}.merge(options[:ajax] || {})
24
+ script = Array.new
25
+ script << "new Ajax.InPlaceEditor("
26
+ script << " '#{options[:content][:options][:id]}',"
27
+ script << " '#{options[:url]}',"
28
+ script << " {"
29
+ script << options[:ajax].map{ |key, value| "#{key.to_s}: #{value}" }.join(", ")
30
+ script << " }"
31
+ script << ")"
32
+
33
+ content_tag(
34
+ options[:content][:element],
35
+ options[:content][:text],
36
+ options[:content][:options]
37
+ ) + javascript_tag( script.join("\n") )
38
+ end
39
+ end
@@ -0,0 +1,4 @@
1
+ class Album < ActiveRecord::Base
2
+ has_many :photos, :dependent => :destroy
3
+
4
+ end
@@ -0,0 +1,15 @@
1
+ class Photo < ActiveRecord::Base
2
+ belongs_to :album
3
+
4
+ has_attachment :content_type => :image,
5
+ :storage => :file_system,
6
+ :max_size => 500.kilobytes,
7
+ :resize_to => '800x600>',
8
+ :thumbnails => {
9
+ :thumb => '100x100>',
10
+ :large => '450x600>',
11
+ :medium => '64x64',
12
+ :small => '48x48'
13
+ }
14
+ validates_as_attachment
15
+ end
@@ -0,0 +1,14 @@
1
+ <% album_tag(album, album_counter) do %>
2
+ <%- if album.photos.length == 0 -%>
3
+ <%= link_to "Add Photos", album_path(album), {:class => "images clear", :title => "Add Photos"} %>
4
+ <%- else -%>
5
+ <%- for photo in album.photos -%>
6
+ <%- if photo == album.photos.first -%>
7
+ <%= link_to image_tag(photo.public_filename(:thumb), {:class => "images", :title => photo.name}), album_path(album) %>
8
+ <%- else -%>
9
+ <%= image_tag(photo.public_filename(:thumb), {:class => "images", :title => photo.name}) %>
10
+ <%- end -%>
11
+ <%- end -%>
12
+ <%- end -%>
13
+ <%= link_to 'Destroy', album, :confirm => 'Are you sure?', :method => :delete %>
14
+ <% end %>
@@ -0,0 +1,4 @@
1
+ <p>
2
+ <b>Name</b><br />
3
+ <%= form.text_field :name %>
4
+ </p>
@@ -0,0 +1,6 @@
1
+ <div class="photo box span-4 prepend-1 append-1<%= " last" if (photo_counter % 4) == 3 %>" id="photo<%= photo.id %>">
2
+ <%= lightbox_image_tag(photo.public_filename(:thumb), photo.public_filename, {:class => "images", :title => photo.name, :rel => "lightbox[photos]"}) %>
3
+ <div>
4
+ <%= link_to "Delete Photo", album_photo_url(photo.album, photo), :confirm => "Are you sure?", :method => :delete %>
5
+ </div>
6
+ </div>
@@ -0,0 +1,14 @@
1
+ <h1>Editing album</h1>
2
+
3
+ <%= error_messages_for :album %>
4
+
5
+ <% form_for(@album) do |f| %>
6
+ <%= render :partial => "form", :object => f %>
7
+
8
+ <p>
9
+ <%= f.submit "Update" %>
10
+ </p>
11
+ <% end %>
12
+
13
+ <%= link_to 'Show', @album %> |
14
+ <%= link_to 'Back', albums_path %>
@@ -0,0 +1,9 @@
1
+ <h1>Listing albums</h1>
2
+
3
+ <div id="albums" class="container">
4
+ <%= render :partial => "album", :collection => @albums %>
5
+ </div>
6
+ <br style="clear:both"/>
7
+ </div>
8
+
9
+ <%= link_to 'New album', new_album_path %>
@@ -0,0 +1,12 @@
1
+ <h1>New album</h1>
2
+
3
+ <%= error_messages_for :album %>
4
+
5
+ <% form_for(@album) do |f| %>
6
+ <%= render :partial => "form", :object => f %>
7
+ <p>
8
+ <%= f.submit "Create" %>
9
+ </p>
10
+ <% end %>
11
+
12
+ <%= link_to 'Back', albums_path %>
@@ -0,0 +1,20 @@
1
+ <h1><%=h @album.name %></h1>
2
+
3
+ <div class="container">
4
+ <%= render :partial => "photo", :collection => @album.photos %>
5
+ </div>
6
+ <hr/>
7
+ <h2>Add an image:</h2>
8
+ <% form_for :photo, @album.photos.build, :url => album_photos_path(@album), :html => {:method => :post, :multipart => true} do |f| -%>
9
+ <p>
10
+ Name: <%= f.text_field :name %>
11
+ </p>
12
+ <p>
13
+ Browse:
14
+ <%= f.file_field :uploaded_data %>
15
+ </p>
16
+ <%= f.submit "Create" %>
17
+ <% end -%>
18
+
19
+ <%= link_to 'Edit', edit_album_path(@album) %> |
20
+ <%= link_to 'Back', albums_path %>
@@ -0,0 +1,22 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
7
+ <title>Albums: <%= controller.action_name %></title>
8
+ <%= javascript_include_tag :defaults %>
9
+ <%= javascript_include_tag "builder" %>
10
+ <%= javascript_include_tag "albums" %>
11
+ <%= stylesheet_link_tag 'lightbox' %>
12
+ <%= stylesheet_link_tag 'albums' %>
13
+ <%= stylesheet_link_tag 'grid' %>
14
+ </head>
15
+ <body>
16
+
17
+ <p style="color: green"><%= flash[:notice] %></p>
18
+
19
+ <%= yield %>
20
+
21
+ </body>
22
+ </html>
@@ -0,0 +1,14 @@
1
+ class CreateAlbums < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :albums do |t|
4
+ t.string :name
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+
10
+ def self.down
11
+ drop_table :albums
12
+ end
13
+
14
+ end
@@ -0,0 +1,19 @@
1
+ class CreatePhotos < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :photos do |t|
4
+ t.string :name
5
+
6
+ t.integer :parent_id, :size, :width, :height
7
+ t.string :content_type, :filename, :thumbnail
8
+
9
+ t.references :album
10
+
11
+ t.timestamps
12
+ end
13
+ end
14
+
15
+ def self.down
16
+ drop_table :photos
17
+ end
18
+
19
+ end
@@ -0,0 +1,29 @@
1
+ var Album = Class.create({
2
+ initialize: function(id){
3
+ this.el = $(id);
4
+ this.images = new Array();
5
+ skip = true;
6
+ this.el.select("img").each(function(i){
7
+ this.images[this.images.length] = {source: i.src, title: i.title};
8
+ if(skip)
9
+ {
10
+ skip = false;
11
+ this.image = i;
12
+ }
13
+ else
14
+ {
15
+ i.remove();
16
+ }
17
+ }.bind(this));
18
+
19
+ Event.observe(this.el, "mousemove", this.mousemove.bindAsEventListener(this));
20
+ },
21
+ mousemove: function(e){
22
+ index = ((e.clientX / this.el.getWidth() * this.images.length)).round() - 1 ;
23
+ if(index <= 0) index = 0;
24
+ if(index >= this.images.length) index = this.images.length - 1;
25
+
26
+ this.image.src = this.images[index].source;
27
+ this.image.title = this.images[index].title;
28
+ }
29
+ });
@@ -0,0 +1,20 @@
1
+ body{
2
+ font: 75% "Lucida Grande", "Trebuchet MS", Verdana, sans-serif;
3
+ }
4
+
5
+ .album, .photo {
6
+ text-align: center;
7
+ width: 100px;
8
+ }
9
+
10
+ .album .editor_field {
11
+ width: 90%;
12
+ }
13
+
14
+ .album img, .photo img{
15
+ border: 0;
16
+ }
17
+ .album a, .album div{
18
+ width: 90%;
19
+ clear: both;
20
+ }
@@ -0,0 +1,217 @@
1
+ /* --------------------------------------------------------------
2
+
3
+ grid.css
4
+ * Sets up an easy-to-use grid of 24 columns.
5
+
6
+ By default, the grid is 950px wide, with 24 columns
7
+ spanning 30px, and a 10px margin between columns.
8
+
9
+ If you need fewer or more columns, namespaces or semantic
10
+ element names, use the compressor script (lib/compress.rb)
11
+
12
+ Note: Changes made in this file will not be applied when
13
+ using the compressor: make changes in lib/blueprint/grid.css.rb
14
+
15
+ -------------------------------------------------------------- */
16
+
17
+ /* A container should group all your columns. */
18
+ .container {
19
+ width: 950px;
20
+ margin: 0 auto;
21
+ }
22
+
23
+ /* Use this class on any div.span / container to see the grid. */
24
+ .showgrid {
25
+ background: url(src/grid.png);
26
+ }
27
+
28
+ /* Body margin for a sensile default look. */
29
+ body {
30
+ margin:1.5em 0;
31
+ }
32
+
33
+
34
+ /* Columns
35
+ -------------------------------------------------------------- */
36
+
37
+ /* Sets up basic grid floating and margin. */
38
+ div.span-1, div.span-2, div.span-3, div.span-4, div.span-5,
39
+ div.span-6, div.span-7, div.span-8, div.span-9, div.span-10,
40
+ div.span-11, div.span-12, div.span-13, div.span-14, div.span-15,
41
+ div.span-16, div.span-17, div.span-18, div.span-19, div.span-20,
42
+ div.span-21, div.span-22, div.span-23, div.span-24 {
43
+ float: left;
44
+ margin-right: 10px;
45
+ }
46
+
47
+ /* The last column in a row needs this class. */
48
+ div.last { margin-right: 0; }
49
+
50
+ /* Use these classes to set the width of a column. */
51
+ .span-1 { width: 30px; }
52
+ .span-2 { width: 70px; }
53
+ .span-3 { width: 110px; }
54
+ .span-4 { width: 150px; }
55
+ .span-5 { width: 190px; }
56
+ .span-6 { width: 230px; }
57
+ .span-7 { width: 270px; }
58
+ .span-8 { width: 310px; }
59
+ .span-9 { width: 350px; }
60
+ .span-10 { width: 390px; }
61
+ .span-11 { width: 430px; }
62
+ .span-12 { width: 470px; }
63
+ .span-13 { width: 510px; }
64
+ .span-14 { width: 550px; }
65
+ .span-15 { width: 590px; }
66
+ .span-16 { width: 630px; }
67
+ .span-17 { width: 670px; }
68
+ .span-18 { width: 710px; }
69
+ .span-19 { width: 750px; }
70
+ .span-20 { width: 790px; }
71
+ .span-21 { width: 830px; }
72
+ .span-22 { width: 870px; }
73
+ .span-23 { width: 910px; }
74
+ .span-24, div.span-24 { width: 950px; margin: 0; }
75
+
76
+ /* Add these to a column to append empty cols. */
77
+ .append-1 { padding-right: 40px; }
78
+ .append-2 { padding-right: 80px; }
79
+ .append-3 { padding-right: 120px; }
80
+ .append-4 { padding-right: 160px; }
81
+ .append-5 { padding-right: 200px; }
82
+ .append-6 { padding-right: 240px; }
83
+ .append-7 { padding-right: 280px; }
84
+ .append-8 { padding-right: 320px; }
85
+ .append-9 { padding-right: 360px; }
86
+ .append-10 { padding-right: 400px; }
87
+ .append-11 { padding-right: 440px; }
88
+ .append-12 { padding-right: 480px; }
89
+ .append-13 { padding-right: 520px; }
90
+ .append-14 { padding-right: 560px; }
91
+ .append-15 { padding-right: 600px; }
92
+ .append-16 { padding-right: 640px; }
93
+ .append-17 { padding-right: 680px; }
94
+ .append-18 { padding-right: 720px; }
95
+ .append-19 { padding-right: 760px; }
96
+ .append-20 { padding-right: 800px; }
97
+ .append-21 { padding-right: 840px; }
98
+ .append-22 { padding-right: 880px; }
99
+ .append-23 { padding-right: 920px; }
100
+
101
+ /* Add these to a column to prepend empty cols. */
102
+ .prepend-1 { padding-left: 40px; }
103
+ .prepend-2 { padding-left: 80px; }
104
+ .prepend-3 { padding-left: 120px; }
105
+ .prepend-4 { padding-left: 160px; }
106
+ .prepend-5 { padding-left: 200px; }
107
+ .prepend-6 { padding-left: 240px; }
108
+ .prepend-7 { padding-left: 280px; }
109
+ .prepend-8 { padding-left: 320px; }
110
+ .prepend-9 { padding-left: 360px; }
111
+ .prepend-10 { padding-left: 400px; }
112
+ .prepend-11 { padding-left: 440px; }
113
+ .prepend-12 { padding-left: 480px; }
114
+ .prepend-13 { padding-left: 520px; }
115
+ .prepend-14 { padding-left: 560px; }
116
+ .prepend-15 { padding-left: 600px; }
117
+ .prepend-16 { padding-left: 640px; }
118
+ .prepend-17 { padding-left: 680px; }
119
+ .prepend-18 { padding-left: 720px; }
120
+ .prepend-19 { padding-left: 760px; }
121
+ .prepend-20 { padding-left: 800px; }
122
+ .prepend-21 { padding-left: 840px; }
123
+ .prepend-22 { padding-left: 880px; }
124
+ .prepend-23 { padding-left: 920px; }
125
+
126
+
127
+ /* Border on right hand side of a column. */
128
+ div.border {
129
+ padding-right: 4px;
130
+ margin-right: 5px;
131
+ border-right: 1px solid #eee;
132
+ }
133
+
134
+ /* Border with more whitespace, spans one column. */
135
+ div.colborder {
136
+ padding-right: 24px;
137
+ margin-right: 25px;
138
+ border-right: 1px solid #eee;
139
+ }
140
+
141
+
142
+ /* Use these classes on an element to push it into the
143
+ next column, or to pull it into the previous column. */
144
+
145
+ .pull-1 { margin-left: -40px; }
146
+ .pull-2 { margin-left: -80px; }
147
+ .pull-3 { margin-left: -120px; }
148
+ .pull-4 { margin-left: -160px; }
149
+ .pull-5 { margin-left: -200px; }
150
+
151
+ .pull-1, .pull-2, .pull-3,
152
+ .pull-4, .pull-5, .pull-5 {
153
+ float:left;
154
+ position:relative;
155
+ }
156
+
157
+ .push-1 { margin: 0 -40px 1.5em 40px; }
158
+ .push-2 { margin: 0 -80px 1.5em 80px; }
159
+ .push-3 { margin: 0 -120px 1.5em 120px; }
160
+ .push-4 { margin: 0 -160px 1.5em 160px; }
161
+ .push-5 { margin: 0 -200px 1.5em 200px; }
162
+
163
+ .push-0, .push-1, .push-2,
164
+ .push-3, .push-4, .push-5 {
165
+ float: right;
166
+ position:relative;
167
+ }
168
+
169
+
170
+ /* Misc classes and elements
171
+ -------------------------------------------------------------- */
172
+
173
+ /* Use a .box to create a padded box inside a column. */
174
+ .box {
175
+ padding: 1.5em;
176
+ margin-bottom: 1.5em;
177
+ background: #E5ECF9;
178
+ }
179
+
180
+ /* Use this to create a horizontal ruler across a column. */
181
+ hr {
182
+ background: #ddd;
183
+ color: #ddd;
184
+ clear: both;
185
+ float: none;
186
+ width: 100%;
187
+ height: .1em;
188
+ margin: 0 0 1.45em;
189
+ border: none;
190
+ }
191
+ hr.space {
192
+ background: #fff;
193
+ color: #fff;
194
+ }
195
+
196
+
197
+ /* Clearing floats without extra markup
198
+ Based on How To Clear Floats Without Structural Markup by PiE
199
+ [http://www.positioniseverything.net/easyclearing.html] */
200
+
201
+ .clearfix:after, .container:after {
202
+ content: ".";
203
+ display: block;
204
+ height: 0;
205
+ clear: both;
206
+ visibility: hidden;
207
+ }
208
+ .clearfix, .container {display: inline-block;}
209
+ * html .clearfix,
210
+ * html .container {height: 1%;}
211
+ .clearfix, .container {display: block;}
212
+
213
+
214
+ /* Regular clearing
215
+ apply to column that should drop below previous ones. */
216
+
217
+ .clear { clear:both; }
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mrunleaded-photo_album
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.5
5
+ platform: ruby
6
+ authors:
7
+ - Kevin Thompson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-08-13 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description:
17
+ email: mrunleaded@gmail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - LICENSE
26
+ - photo_album.gemspec
27
+ - photo_album_generator.rb
28
+ - Rakefile
29
+ - README.mkdn
30
+ - templates/app/controllers/albums_controller.rb
31
+ - templates/app/controllers/photos_controller.rb
32
+ - templates/app/helpers/albums_helper.rb
33
+ - templates/app/models/album.rb
34
+ - templates/app/models/photo.rb
35
+ - templates/app/views/albums/_album.html.erb
36
+ - templates/app/views/albums/_form.html.erb
37
+ - templates/app/views/albums/_photo.html.erb
38
+ - templates/app/views/albums/edit.html.erb
39
+ - templates/app/views/albums/index.html.erb
40
+ - templates/app/views/albums/new.html.erb
41
+ - templates/app/views/albums/show.html.erb
42
+ - templates/app/views/layouts/albums.html.erb
43
+ - templates/INSTALL
44
+ - templates/migrate/create_albums.rb
45
+ - templates/migrate/create_photos.rb
46
+ - templates/public/javascripts/albums.js
47
+ - templates/public/stylesheets/albums.css
48
+ - templates/public/stylesheets/grid.css
49
+ - USAGE
50
+ has_rdoc: true
51
+ homepage:
52
+ post_install_message:
53
+ rdoc_options: []
54
+
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: "0"
62
+ version:
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: "0"
68
+ version:
69
+ requirements: []
70
+
71
+ rubyforge_project:
72
+ rubygems_version: 1.2.0
73
+ signing_key:
74
+ specification_version: 2
75
+ summary: A simple photo album plugin/generator.
76
+ test_files: []
77
+