Merge branch 'rails3' of https://github.com/vanicat/balder into vanicat-rails3
This commit is contained in:
commit
3d97e3e3fe
2
Gemfile
2
Gemfile
|
@ -1,6 +1,6 @@
|
|||
source 'http://rubygems.org'
|
||||
|
||||
gem 'rails', '3.0.0'
|
||||
gem 'rails', '3.0.1'
|
||||
|
||||
gem "authlogic"
|
||||
gem 'mime-types', :require => 'mime/types'
|
||||
|
|
80
Gemfile.lock
80
Gemfile.lock
|
@ -1,20 +1,20 @@
|
|||
GIT
|
||||
remote: git://github.com/jnicklas/carrierwave.git
|
||||
revision: 3372a078a0ea4d6e4e2ee1990610db9186f43b41
|
||||
revision: 272c9aac1f2f30c4bd2990e28a3b1403c9820f37
|
||||
specs:
|
||||
carrierwave (0.5.0.beta2)
|
||||
activesupport (~> 3.0.0)
|
||||
carrierwave (0.5.0)
|
||||
activesupport (~> 3.0)
|
||||
|
||||
GEM
|
||||
remote: http://rubygems.org/
|
||||
specs:
|
||||
abstract (1.0.0)
|
||||
actionmailer (3.0.0)
|
||||
actionpack (= 3.0.0)
|
||||
actionmailer (3.0.1)
|
||||
actionpack (= 3.0.1)
|
||||
mail (~> 2.2.5)
|
||||
actionpack (3.0.0)
|
||||
activemodel (= 3.0.0)
|
||||
activesupport (= 3.0.0)
|
||||
actionpack (3.0.1)
|
||||
activemodel (= 3.0.1)
|
||||
activesupport (= 3.0.1)
|
||||
builder (~> 2.1.2)
|
||||
erubis (~> 2.6.6)
|
||||
i18n (~> 0.4.1)
|
||||
|
@ -22,19 +22,19 @@ GEM
|
|||
rack-mount (~> 0.6.12)
|
||||
rack-test (~> 0.5.4)
|
||||
tzinfo (~> 0.3.23)
|
||||
activemodel (3.0.0)
|
||||
activesupport (= 3.0.0)
|
||||
activemodel (3.0.1)
|
||||
activesupport (= 3.0.1)
|
||||
builder (~> 2.1.2)
|
||||
i18n (~> 0.4.1)
|
||||
activerecord (3.0.0)
|
||||
activemodel (= 3.0.0)
|
||||
activesupport (= 3.0.0)
|
||||
activerecord (3.0.1)
|
||||
activemodel (= 3.0.1)
|
||||
activesupport (= 3.0.1)
|
||||
arel (~> 1.0.0)
|
||||
tzinfo (~> 0.3.23)
|
||||
activeresource (3.0.0)
|
||||
activemodel (= 3.0.0)
|
||||
activesupport (= 3.0.0)
|
||||
activesupport (3.0.0)
|
||||
activeresource (3.0.1)
|
||||
activemodel (= 3.0.1)
|
||||
activesupport (= 3.0.1)
|
||||
activesupport (3.0.1)
|
||||
arel (1.0.1)
|
||||
activesupport (~> 3.0.0)
|
||||
authlogic (2.1.6)
|
||||
|
@ -42,10 +42,10 @@ GEM
|
|||
builder (2.1.2)
|
||||
erubis (2.6.6)
|
||||
abstract (>= 1.0.0)
|
||||
excon (0.2.3)
|
||||
fog (0.3.7)
|
||||
excon (0.2.4)
|
||||
fog (0.3.19)
|
||||
builder
|
||||
excon (>= 0.2.3)
|
||||
excon (>= 0.2.4)
|
||||
formatador (>= 0.0.15)
|
||||
json
|
||||
mime-types
|
||||
|
@ -53,12 +53,13 @@ GEM
|
|||
nokogiri (~> 1.4.3.1)
|
||||
ruby-hmac
|
||||
formatador (0.0.15)
|
||||
i18n (0.4.1)
|
||||
i18n (0.4.2)
|
||||
json (1.4.6)
|
||||
mail (2.2.6.1)
|
||||
mail (2.2.10)
|
||||
activesupport (>= 2.3.6)
|
||||
mime-types
|
||||
treetop (>= 1.4.5)
|
||||
i18n (~> 0.4.1)
|
||||
mime-types (~> 1.16)
|
||||
treetop (~> 1.4.8)
|
||||
mime-types (1.16)
|
||||
net-ssh (2.0.23)
|
||||
nokogiri (1.4.3.1)
|
||||
|
@ -67,26 +68,26 @@ GEM
|
|||
rack (1.2.1)
|
||||
rack-mount (0.6.13)
|
||||
rack (>= 1.0.0)
|
||||
rack-test (0.5.4)
|
||||
rack-test (0.5.6)
|
||||
rack (>= 1.0)
|
||||
rails (3.0.0)
|
||||
actionmailer (= 3.0.0)
|
||||
actionpack (= 3.0.0)
|
||||
activerecord (= 3.0.0)
|
||||
activeresource (= 3.0.0)
|
||||
activesupport (= 3.0.0)
|
||||
rails (3.0.1)
|
||||
actionmailer (= 3.0.1)
|
||||
actionpack (= 3.0.1)
|
||||
activerecord (= 3.0.1)
|
||||
activeresource (= 3.0.1)
|
||||
activesupport (= 3.0.1)
|
||||
bundler (~> 1.0.0)
|
||||
railties (= 3.0.0)
|
||||
railties (3.0.0)
|
||||
actionpack (= 3.0.0)
|
||||
activesupport (= 3.0.0)
|
||||
railties (= 3.0.1)
|
||||
railties (3.0.1)
|
||||
actionpack (= 3.0.1)
|
||||
activesupport (= 3.0.1)
|
||||
rake (>= 0.8.4)
|
||||
thor (~> 0.14.0)
|
||||
rake (0.8.7)
|
||||
rmagick (2.13.1)
|
||||
ruby-hmac (0.4.0)
|
||||
thor (0.14.1)
|
||||
treetop (1.4.8)
|
||||
thor (0.14.4)
|
||||
treetop (1.4.9)
|
||||
polyglot (>= 0.3.1)
|
||||
tzinfo (0.3.23)
|
||||
|
||||
|
@ -99,5 +100,8 @@ DEPENDENCIES
|
|||
fog
|
||||
mime-types
|
||||
pg
|
||||
rails (= 3.0.0)
|
||||
rails (= 3.0.1)
|
||||
rmagick
|
||||
|
||||
METADATA
|
||||
version: 1.0.6
|
||||
|
|
|
@ -6,7 +6,7 @@ module ApplicationHelper
|
|||
levels.delete_at(0)
|
||||
|
||||
#links = "You are here: "
|
||||
links = content_tag('a', "HOME", :href => "/") if include_home
|
||||
links = content_tag('a', "HOME", :href => root_path ) if include_home
|
||||
|
||||
nocrumb = ["collections", "albums", "photos", "tags", "new", "edit", "tags"]
|
||||
|
||||
|
|
|
@ -10,10 +10,8 @@ class FlashSessionCookieMiddleware
|
|||
if env['HTTP_USER_AGENT'] =~ /^(Adobe|Shockwave) Flash/
|
||||
req = Rack::Request.new(env)
|
||||
env['HTTP_COOKIE'] = [ @session_key,
|
||||
req.params[@session_key] ]
|
||||
.join('=').freeze unless req.params[@session_key].nil?
|
||||
env['HTTP_ACCEPT'] = "#{req.params['_http_accept']}"
|
||||
.freeze unless req.params['_http_accept'].nil?
|
||||
req.params[@session_key] ].join('=').freeze unless req.params[@session_key].nil?
|
||||
env['HTTP_ACCEPT'] = "#{req.params['_http_accept']}".freeze unless req.params['_http_accept'].nil?
|
||||
end
|
||||
|
||||
@app.call(env)
|
||||
|
|
|
@ -3,8 +3,8 @@ class Album < ActiveRecord::Base
|
|||
has_many :collection_albums
|
||||
has_many :collections, :through => :collection_albums
|
||||
|
||||
validates_uniqueness_of :path, :message => "Album already exsists on disc"
|
||||
validates_presence_of :title, :message => "can't be blank"
|
||||
validates :path, :presence => true, :uniqueness => true #, :message => "Album already exsists on disc"
|
||||
validates :title, :presence => true #, :message => "can't be blank"
|
||||
|
||||
before_validation :ensure_path, :set_title
|
||||
after_create :create_folders
|
||||
|
@ -13,22 +13,20 @@ class Album < ActiveRecord::Base
|
|||
attr_accessor :tags
|
||||
#attr_protected :path
|
||||
|
||||
scope :untouched, :conditions => "albums.id IN ( SELECT DISTINCT photos.album_id FROM photos WHERE photos.description IS NULL AND photos.id NOT IN ( SELECT photo_id FROM photo_tags) )", :order => 'title'
|
||||
scope :unused, :conditions => "albums.id NOT IN (SELECT album_id FROM collection_albums)"
|
||||
scope :used, :conditions => "albums.id IN (SELECT album_id FROM collection_albums)"
|
||||
scope :untouched, where("albums.id IN ( SELECT DISTINCT photos.album_id FROM photos WHERE photos.description IS NULL AND photos.id NOT IN ( SELECT photo_id FROM photo_tags) )").order('title')
|
||||
scope :unused, where("albums.id NOT IN (SELECT album_id FROM collection_albums)")
|
||||
scope :used, where("albums.id IN (SELECT album_id FROM collection_albums)")
|
||||
|
||||
def to_param
|
||||
"#{id}-#{title.parameterize}"
|
||||
end
|
||||
|
||||
|
||||
|
||||
def ensure_path
|
||||
self.path = self.title.parameterize unless self.path
|
||||
end
|
||||
|
||||
def set_title
|
||||
self.title = File.basename( self.path).titleize unless self.title || !self.path
|
||||
self.title = File.basename(self.path).titleize unless self.title || !self.path
|
||||
end
|
||||
|
||||
def tags
|
||||
|
|
|
@ -3,6 +3,8 @@ class Collection < ActiveRecord::Base
|
|||
has_many :albums, :through => :collection_albums
|
||||
attr_accessor :album_list
|
||||
|
||||
validates :title, :presence => true
|
||||
|
||||
def to_param
|
||||
"#{id}-#{title.parameterize}"
|
||||
end
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
class Photo < ActiveRecord::Base
|
||||
# TODO: path not used? it should be removed from the DB
|
||||
|
||||
belongs_to :album
|
||||
has_many :photo_tags, :dependent => :destroy
|
||||
has_many :tags, :through => :photo_tags
|
||||
|
||||
mount_uploader :file, FileUploader
|
||||
|
||||
#validates_uniqueness_of :path, :message => "Photo already exsists on disc"
|
||||
validates_presence_of :title
|
||||
validates :title, :presence => true
|
||||
|
||||
before_validation :set_title
|
||||
#before_create :exif_read
|
||||
|
@ -50,6 +51,10 @@ class Photo < ActiveRecord::Base
|
|||
self.tags = ts
|
||||
end
|
||||
|
||||
def _delete
|
||||
0
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
|
||||
|
@ -83,5 +88,4 @@ class Photo < ActiveRecord::Base
|
|||
photo.save
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@ class Role < ActiveRecord::Base
|
|||
has_many :subroles, :through => :roleables, :source => :roleable, :source_type => 'Role'
|
||||
has_many :users, :through => :roleables, :source => :roleable, :source_type => 'User'
|
||||
|
||||
validates_uniqueness_of :name
|
||||
validates :name, :presence => true, :uniqueness => true
|
||||
|
||||
acts_as_permissible
|
||||
end
|
|
@ -1,3 +1,6 @@
|
|||
class UserSession < Authlogic::Session::Base
|
||||
# configuration here, see documentation for sub modules of Authlogic::Session
|
||||
def to_key
|
||||
new_record? ? nil : [ self.send(self.class.primary_key) ]
|
||||
end
|
||||
end
|
|
@ -4,3 +4,9 @@
|
|||
<%= form.label :email %><br />
|
||||
<%= form.text_field :email %><br />
|
||||
<br/>
|
||||
<%= form.label :password %><br />
|
||||
<%= form.password_field :password %><br />
|
||||
<br/>
|
||||
<%= form.label :password_confirmation %><br />
|
||||
<%= form.password_field :password_confirmation %><br />
|
||||
<br/>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<% content_for :javascript do %>
|
||||
<script src="http://maps.google.com/maps/api/js?sensor=true" type="text/javascript"></script>
|
||||
<script src="/javascripts/tag/tag.js" type="text/javascript" charset="utf-8"></script>
|
||||
<%= javascript_include_tag "http://maps.google.com/maps/api/js?sensor=true" -%>
|
||||
<%= javascript_include_tag "tag/tag" -%>
|
||||
<% end %>
|
||||
|
||||
<div id="map_canvas"></div>
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
<% for album in @collection.albums %>
|
||||
<%= form.fields_for :album_list do |album_fields| %>
|
||||
<span>
|
||||
<img src="/images/delete-24x24.png" border="" class="delete" />
|
||||
<%= image_tag "delete-24x24.png", :class => "delete", :alt => "Delete" -%>
|
||||
|
||||
<% if album.photos.empty? %>
|
||||
<%= album.title %>
|
||||
<% else %>
|
||||
|
|
|
@ -19,18 +19,12 @@
|
|||
<% end %>
|
||||
</div>
|
||||
<h1>
|
||||
<a href="/">
|
||||
<% if ENV['LOGO'] %>
|
||||
<%= image_tag ENV['LOGO'] %>
|
||||
<% else %>
|
||||
<%= ENV['TITLE'] || "Photos" %>
|
||||
<% end %>
|
||||
</a>
|
||||
</h1>
|
||||
<form action="/albums" method="get" id="search">
|
||||
<%= link_to(if ENV['LOGO'] then image_tag(ENV['LOGO']) else (ENV['TITLE'] || "Photos") end, root_path) %>
|
||||
</h1>
|
||||
<% form_tag albums_path, { :id => :search } do -%>
|
||||
<input type="text" name="q" class="textfield"/>
|
||||
<input type="submit" value="Search" class="button" />
|
||||
</form>
|
||||
<% end -%>
|
||||
<hr class="seperator" />
|
||||
<%= breadcrumbs %>
|
||||
</div>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<% content_for :javascript do %>
|
||||
<script src="/javascripts/tag/tag.js" type="text/javascript" charset="utf-8"></script>
|
||||
<%= javascript_include_tag "tag/tag" -%>
|
||||
<% end %>
|
||||
<%= hidden_field_tag :all_tags, @tags %>
|
||||
<%= form.label :title %><br />
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<% content_for :javascript do %>
|
||||
<script type="text/javascript" src="/javascripts/uploadify-2.1/jquery.uploadify.v2.1.0.min.js"></script>
|
||||
<script type="text/javascript" src="/javascripts/uploadify-2.1/swfobject.js"></script>
|
||||
<%= javascript_include_tag "uploadify-2.1/jquery.uploadify.v2.1.0.min.js" -%>
|
||||
<%= javascript_include_tag "uploadify-2.1/swfobject.js" -%>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('#photo_file').uploadify({
|
||||
uploader:'/javascripts/uploadify-2.1/uploadify.swf',
|
||||
uploader:'<%= javascript_path "uploadify-2.1/uploadify.swf" -%>',
|
||||
script:'<%= photos_path %>',
|
||||
fileDataName : 'photo[file]',
|
||||
scriptData: {
|
||||
|
@ -13,7 +13,7 @@ $(document).ready(function() {
|
|||
'authenticity_token' : encodeURIComponent('<%= u form_authenticity_token if protect_against_forgery?%>'),
|
||||
'photo[album_id]' : "<%= @album.id %>"
|
||||
},
|
||||
cancelImg:'/javascripts/jquery.uploadify-v1.6.2.mit/cancel.png',
|
||||
cancelImg:'<%= javascript_path "jquery.uploadify-v1.6.2.mit/cancel.png" -%>',
|
||||
multi:true,
|
||||
auto:true,
|
||||
onComplete : function (e,queueId,fileObj,res,data) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
ActionController::Routing::Routes.draw do
|
||||
resources :account, :as => "users"
|
||||
resource :account, :controller => :users
|
||||
match "login", :to => "user_sessions#new", :as => :login
|
||||
match "authenticate", :to => "user_sessions#create", :as => :authenticate
|
||||
match "logout", :to => "user_sessions#destroy", :as => :logout
|
||||
|
@ -51,7 +51,7 @@ ActionController::Routing::Routes.draw do
|
|||
resources :albums
|
||||
end
|
||||
|
||||
resources :users, :to => "admin/users#index"
|
||||
resources :users, :controller => "admin/users"
|
||||
|
||||
root :to => "collections#index"
|
||||
|
||||
|
|
Loading…
Reference in a new issue