Compare commits

..

32 commits

Author SHA1 Message Date
Espen Antonsen 4382b21d70 merge 2011-01-12 16:48:28 +08:00
Espen Antonsen 972dfbe25e dynamic storage path for saving to other folder on S3. more heroku friendly 2010-10-10 22:30:59 +02:00
Espen Antonsen 666750a72a config vars more suited for heroku. not overwritten 2010-10-10 20:09:30 +02:00
Espen Antonsen 9f401e3817 heroku conf hide 2010-10-07 00:41:47 +02:00
Espen Antonsen 481a91c7f3 no comments in gems file 2010-10-07 00:26:59 +02:00
Espen Antonsen 0928d3e582 config.gem "rmagick", 2010-10-07 00:24:27 +02:00
Espen Antonsen ff148424cc specify exact v 2010-10-07 00:19:50 +02:00
Espen Antonsen 1ef291c5d3 3.0? 2010-10-07 00:19:19 +02:00
Espen Antonsen bb23bfc205 rails2 version of carrierwave 2010-10-07 00:18:08 +02:00
Espen Antonsen 5c4f5043ed rails 2.3.9 2010-10-07 00:13:03 +02:00
Espen Antonsen b059720499 ignore balder.rb 2010-10-07 00:08:38 +02:00
Espen Antonsen dc163a9838 Merge branch 'master' of github.com:espen/balder 2010-10-07 00:01:32 +02:00
Espen Antonsen e4d3979c51 balder config file 2010-10-07 00:00:53 +02:00
Espen Antonsen 7d93e75784 opps 2010-10-06 23:56:47 +02:00
Espen Antonsen be83bbd0fd balder.rb 2010-10-06 23:56:03 +02:00
Espen Antonsen 709da5fb35 not require mysql2 on heroku. require aws on heroku 2010-10-06 23:52:46 +02:00
Espen Antonsen d0dbc1e2af rails gem 2010-10-06 23:38:31 +02:00
Espen Antonsen dbd4e1482a empty line 2010-10-06 23:26:57 +02:00
Espen Antonsen c6946167af heroku and s3 settings 2010-10-06 23:08:53 +02:00
Espen Antonsen 88c0c1b628 empty line 2010-10-06 23:06:00 +02:00
Espen Antonsen 94de99c668 ignore balder.rb 2010-10-06 23:02:34 +02:00
Espen Antonsen 5bdbd2558c and another one.. 2010-09-27 15:20:53 +02:00
Espen Antonsen e3ad068f40 fixture user 2010-09-27 13:23:23 +02:00
Espen Antonsen 4d0bd95d4a mysql2 2010-09-17 16:00:53 +02:00
Espen Antonsen 670c7dad5e updated so tag listing works. find_by_title instead of id 2010-08-07 13:30:53 +02:00
Espen Antonsen c049033193 remove old legacy code. now using carrierwave to retrieve url 2010-07-28 00:27:47 +02:00
Espen Antonsen e3ccbeb03b can now run from Heroku...yay! 2010-07-01 12:28:45 +02:00
Espen Antonsen 5920d3005d no need to set my locale for everyone else.. 2010-07-01 12:27:10 +02:00
Espen Antonsen fd64c725eb updated readme with info about carrierwave 2010-07-01 12:26:03 +02:00
Espen Antonsen b3b8baf8b5 initial iphone/ipad support 2010-07-01 12:14:23 +02:00
Espen Antonsen c854b3d2e9 fix set title. setting for heroku 2010-04-14 01:00:48 -04:00
Espen Antonsen 5cf109280b balder ENV settings. s3 init. remove settings.yml 2010-04-13 23:56:13 -04:00
392 changed files with 20509 additions and 12660 deletions

5
.gems Normal file
View file

@ -0,0 +1,5 @@
rails --version '2.3.9'
authlogic
carrierwave --version '0.4.5'
aws-s3
rmagick

11
.gitignore vendored
View file

@ -1,19 +1,14 @@
.bundle
.rvmrc
db/*.sqlite3
log/*.log
tmp
tmp/**/*
.DS_Store
doc/api
doc/app
config/balder.rb
config/database.yml
config/settings.yml
config/deploy.rb
config/deploy
Capfile
photos
public/thumbs
public/uploads
public/assets
vendor/cache
.idea
.sass-cache

62
Gemfile
View file

@ -1,62 +0,0 @@
source 'http://rubygems.org'
gem 'rails', '3.2.7'
gem 'sqlite3'
gem 'mime-types', :require => 'mime/types'
gem 'carrierwave'
gem 'dynamic_form'
gem 'kaminari', :git => 'git://github.com/amatsuda/kaminari.git'
gem 'princely'
gem 'unicorn'
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git'
gem 'ajaxful_rating_jquery', :git => 'git://github.com/greendog/ajaxful_rating_jquery.git'#, :branch => 'rails3'
gem 'configatron', :git => 'git://github.com/markbates/configatron.git'
gem 'plupload-rails', :git => 'git://github.com/bryanmig/plupload-rails.git'
#gem 'sequel', :git => 'git://github.com/jeremyevans/sequel.git'
gem 'breadcrumbs_on_rails', :git => 'git://github.com/lloydk/breadcrumbs_on_rails.git'
gem 'russian', :git => 'git://github.com/yaroslav/russian.git'
gem "devise_omniauth_engine", :git=>"git://github.com/greendog/devise_omniauth_engine.git"
gem 'omniauth-twitter'
gem 'omniauth-facebook'
gem 'omniauth-openid'
gem 'omniauth-google-apps'
gem 'omniauth-vkontakte', :git => 'git://github.com/mamantoha/omniauth-vkontakte.git'
gem 'cancan'
group :assets do
gem 'sass-rails'
gem 'coffee-rails'
gem 'uglifier'
end
group :development do
gem 'ffaker'
gem 'machinist'
gem 'action_mailer_tls', :git => 'git://github.com/openrain/action_mailer_tls.git'
gem 'capistrano', :git => 'git://github.com/capistrano/capistrano.git'
gem 'capistrano-unicorn', :git => 'git://github.com/sosedoff/capistrano-unicorn.git'
gem 'rvm-capistrano'
gem 'capistrano_colors'
end
# -- Cloud storage
# AWS S3 support. Can be disabled if using local file system instead of cloud storage.
gem 'fog'
# -- Photo resizing
# MiniMagick
gem "mini_magick"
# ImageMagick:
#gem "rmagick", :require => 'RMagick'
# FreeImage:
#gem "RubyInline"
#gem "image_science", :git => 'git://github.com/perezd/image_science.git'
# -- EXIF
# Mini exif tool. Can be disabled. Remove exif_read and exif_write filters in photo model
gem "mini_exiftool"

View file

@ -1,341 +0,0 @@
GIT
remote: git://github.com/amatsuda/kaminari.git
revision: 82a38e07db1ca1598c8daf073a8f6be22ae714d6
specs:
kaminari (0.13.0)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
GIT
remote: git://github.com/bryanmig/plupload-rails.git
revision: 6d07d0f7e05d0b3fdc9b03b49d3a7c3aa1cd703b
specs:
plupload-rails (1.0.6)
rails (~> 3.1)
GIT
remote: git://github.com/capistrano/capistrano.git
revision: 62a6cb723dc583468943fc642847791fb4ad2686
specs:
capistrano (2.12.0)
highline
net-scp (>= 1.0.0)
net-sftp (>= 2.0.0)
net-ssh (>= 2.0.14)
net-ssh-gateway (>= 1.1.0)
GIT
remote: git://github.com/greendog/ajaxful_rating_jquery.git
revision: ae3314d3067d9f13a62675fa08afa4ecd31a7828
specs:
ajaxful_rating_jquery (3.0.0.beta3)
GIT
remote: git://github.com/greendog/devise_omniauth_engine.git
revision: c46d449222133f709b5f0cafc31a57f1ae208f06
specs:
devise_omniauth_engine (1.0.0)
devise
omniauth
yettings
GIT
remote: git://github.com/lloydk/breadcrumbs_on_rails.git
revision: 310c40186b97dc816e22e9be7aac3b43dcef040b
specs:
breadcrumbs_on_rails (2.2.0)
GIT
remote: git://github.com/mamantoha/omniauth-vkontakte.git
revision: b2b9f62972911ba328538368d13407b01bc9f297
specs:
omniauth-vkontakte (1.0.9)
multi_json
omniauth (~> 1.1.0)
omniauth-oauth2 (~> 1.0)
GIT
remote: git://github.com/markbates/configatron.git
revision: 7a81defa5e1fb032b5ed62754d7e6d7bfecf07a2
specs:
configatron (2.9.1)
yamler (>= 0.1.0)
GIT
remote: git://github.com/openrain/action_mailer_tls.git
revision: 4c4db7e098d54b2239c1ce7c195417552718418c
specs:
action_mailer_tls (1.1.3)
GIT
remote: git://github.com/seyhunak/twitter-bootstrap-rails.git
revision: 908e150800610138e2b48738f842afb85b3a832e
specs:
twitter-bootstrap-rails (2.1.1)
actionpack (>= 3.1)
less-rails (~> 2.2.3)
railties (>= 3.1)
therubyracer (= 0.10.1)
GIT
remote: git://github.com/sosedoff/capistrano-unicorn.git
revision: bafc12cd8235307d30b5c85259914d17c5ece2d3
specs:
capistrano-unicorn (0.1.6)
capistrano
GIT
remote: git://github.com/yaroslav/russian.git
revision: e2dde13672bcee176f8b0be364a55ac256913231
specs:
russian (0.6.0)
i18n (>= 0.5.0)
GEM
remote: http://rubygems.org/
specs:
actionmailer (3.2.7)
actionpack (= 3.2.7)
mail (~> 2.4.4)
actionpack (3.2.7)
activemodel (= 3.2.7)
activesupport (= 3.2.7)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
rack (~> 1.4.0)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.1.3)
activemodel (3.2.7)
activesupport (= 3.2.7)
builder (~> 3.0.0)
activerecord (3.2.7)
activemodel (= 3.2.7)
activesupport (= 3.2.7)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.7)
activemodel (= 3.2.7)
activesupport (= 3.2.7)
activesupport (3.2.7)
i18n (~> 0.6)
multi_json (~> 1.0)
arel (3.0.2)
bcrypt-ruby (3.0.1)
builder (3.0.0)
cancan (1.6.8)
capistrano_colors (0.5.5)
carrierwave (0.6.2)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.3.3)
commonjs (0.2.6)
devise (2.1.2)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.1)
railties (~> 3.1)
warden (~> 1.2.1)
dynamic_form (1.1.4)
erubis (2.7.0)
excon (0.15.5)
execjs (1.4.0)
multi_json (~> 1.0)
faraday (0.8.1)
multipart-post (~> 1.1)
ffaker (1.15.0)
fog (1.5.0)
builder
excon (~> 0.14)
formatador (~> 0.2.0)
mime-types
multi_json (~> 1.0)
net-scp (~> 1.0.4)
net-ssh (>= 2.1.3)
nokogiri (~> 1.5.0)
ruby-hmac
formatador (0.2.3)
hashie (1.2.0)
highline (1.6.13)
hike (1.2.1)
httpauth (0.1)
i18n (0.6.0)
journey (1.0.4)
jquery-rails (2.0.2)
railties (>= 3.2.0, < 5.0)
thor (~> 0.14)
jquery-ui-rails (1.1.0)
jquery-rails
railties (>= 3.1.0)
json (1.7.4)
jwt (0.1.5)
multi_json (>= 1.0)
kgio (2.7.4)
less (2.2.1)
commonjs (~> 0.2.6)
less-rails (2.2.3)
actionpack (>= 3.1)
less (~> 2.2.0)
libv8 (3.3.10.4)
machinist (2.0)
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.19)
mini_exiftool (1.6.0)
mini_magick (3.4)
subexec (~> 0.2.1)
multi_json (1.3.6)
multipart-post (1.1.5)
net-scp (1.0.4)
net-ssh (>= 1.99.1)
net-sftp (2.0.5)
net-ssh (>= 2.0.9)
net-ssh (2.5.2)
net-ssh-gateway (1.1.0)
net-ssh (>= 1.99.1)
nokogiri (1.5.5)
oauth (0.4.6)
oauth2 (0.8.0)
faraday (~> 0.8)
httpauth (~> 0.1)
jwt (~> 0.1.4)
multi_json (~> 1.0)
rack (~> 1.2)
omniauth (1.1.0)
hashie (~> 1.2)
rack
omniauth-facebook (1.4.1)
omniauth-oauth2 (~> 1.1.0)
omniauth-google-apps (0.0.2)
omniauth (~> 1.0)
omniauth-openid (~> 1.0)
ruby-openid-apps-discovery (~> 1.2.0)
omniauth-oauth (1.0.1)
oauth
omniauth (~> 1.0)
omniauth-oauth2 (1.1.0)
oauth2 (~> 0.8.0)
omniauth (~> 1.0)
omniauth-openid (1.0.1)
omniauth (~> 1.0)
rack-openid (~> 1.3.1)
omniauth-twitter (0.0.12)
multi_json (~> 1.3)
omniauth-oauth (~> 1.0)
orm_adapter (0.4.0)
polyglot (0.3.3)
princely (1.2.5)
rack (1.4.1)
rack-cache (1.2)
rack (>= 0.4)
rack-openid (1.3.1)
rack (>= 1.1.0)
ruby-openid (>= 2.1.8)
rack-ssl (1.3.2)
rack
rack-test (0.6.1)
rack (>= 1.0)
rails (3.2.7)
actionmailer (= 3.2.7)
actionpack (= 3.2.7)
activerecord (= 3.2.7)
activeresource (= 3.2.7)
activesupport (= 3.2.7)
bundler (~> 1.0)
railties (= 3.2.7)
railties (3.2.7)
actionpack (= 3.2.7)
activesupport (= 3.2.7)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
raindrops (0.10.0)
rake (0.9.2.2)
rdoc (3.12)
json (~> 1.4)
ruby-hmac (0.4.0)
ruby-openid (2.2.0)
ruby-openid-apps-discovery (1.2.0)
ruby-openid (>= 2.1.7)
rvm-capistrano (1.2.5)
capistrano (>= 2.0.0)
sass (3.1.20)
sass-rails (3.2.5)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
sprockets (2.1.3)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.6)
subexec (0.2.2)
therubyracer (0.10.1)
libv8 (~> 3.3.10)
thor (0.15.4)
tilt (1.3.3)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.33)
uglifier (1.2.7)
execjs (>= 0.3.0)
multi_json (~> 1.3)
unicorn (4.3.1)
kgio (~> 2.6)
rack
raindrops (~> 0.7)
warden (1.2.1)
rack (>= 1.0)
yamler (0.1.0)
yettings (0.1.1)
PLATFORMS
ruby
DEPENDENCIES
action_mailer_tls!
ajaxful_rating_jquery!
breadcrumbs_on_rails!
cancan
capistrano!
capistrano-unicorn!
capistrano_colors
carrierwave
coffee-rails
configatron!
devise_omniauth_engine!
dynamic_form
ffaker
fog
jquery-rails
jquery-ui-rails
kaminari!
machinist
mime-types
mini_exiftool
mini_magick
omniauth-facebook
omniauth-google-apps
omniauth-openid
omniauth-twitter
omniauth-vkontakte!
plupload-rails!
princely
rails (= 3.2.7)
russian!
rvm-capistrano
sass-rails
sqlite3
twitter-bootstrap-rails!
uglifier
unicorn

676
LICENSE
View file

@ -1,8 +1,674 @@
The MIT License (MIT)
Copyright (c) 2011 Espen Antonsen
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
Preamble
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

79
README Normal file
View file

@ -0,0 +1,79 @@
== Welcome to Balder photo gallery
Made by Espen Antonsen.
Version 1.1
http://balderapp.com
== Features
* Stores photos to disk in folders or on S3 (can run from Heroku...yay)
* Create multiple thumbnails of custom sizes
* Read and writes EXIF/IPTC title, description and keywords
* Organize in albums (as events in iPhoto)
* Combine albums in collections (as albums in iPhoto)
* Upload multiple photos
* Tag photos. Can also tag albums (actually all photos in album is tagged)
* User management with roles and permissions
* Geo-location of albums & photos with Google Maps integration.
== License
Free for personal use. Contact me for commercial license.
== Requirements
Rails 2.3
Software
- RMagicK (required for Carrierwave resizing). Can also use ImageScience
Optional:
- ExifTool (required for Mini_EfixTool)
Ruby Gems
- AuthLogic
- Mime-Types
- Carrierwave
Optional:
- AWS/S3 (if saving to Amazon s3)
- Mini_Exiftool (to read exif info to database. See photo.rb model)
== Installation
1. Clone the project from GitHub or Gitorious:
GitHub: git clone git://github.com/espen/balder.git
Gitorious: git clone git://gitorious.org/gallery-without-a-name/gallery-without-a-name.git
2. install required software listed above
3. Copy settings file:
cp gallery/config/database.example.yml gallery/config/database.yml
cp gallery/config/settings.example.yml gallery/config/settings.yml
4. Create databsae user and edit settings files.
5. rake db:create
6. rake db:migrate
7. Start up the project with your preferred web-server
=== Optional: add photos directly to disk
The gallery has a web-based upload tool using Flash. Alternatively you can upload files directly by doing this:
Put photos in containing folders(albums) in the specified gallery folder.
Hierarchy of folders is not fully supported.
This format is recommended:
./ski weekend in hemsedal/snow.jpg
./ski weekend in hemsedal/afterski.jpg
./trip to iran/beautiful girls in tehran.jpg
./trip to iran/mosque in yazd.jpg
./trip to iran/powder snow in dizin.jpg
Every time you manually add photos to disk you must scan by visiting /photos/scan
In future releases the scan will be automated.
== Copyright and license info
This code is copyrighted by Espen Antonsen. The source code is available free under the GNU General Public License version 3 (GPLv3).
If the GPLv3 is not suitable for you please contact me for an alternative license for a fee.

157
README.md
View file

@ -1,157 +0,0 @@
Welcome to Balder photo gallery
===============================
Made by Espen Antonsen.
Version 1.2.3 for Rails 3.2. See the rails2 branch for previous version.
[http://balderapp.com](http://balderapp.com)
Features
========
* Stores photos to disk in folders or on S3 (can run from Heroku...yay)
* Create multiple thumbnails of custom sizes
* Read and writes EXIF/IPTC title, description and keywords
* Organize in albums (as events in iPhoto)
* Combine albums in collections (as albums in iPhoto)
* Upload multiple photos
* Tag photos. Can also tag albums (actually all photos in album is tagged)
* User management with roles and permissions
* Geo-location of albums & photos with Google Maps integration.
Requirements
============
Rails 3.2
Software
Default:
- **[ExifTool]** (required for *Mini_EfixTool*). Can be disabled. Default is to read EXIF tags but not write them to the file when database is updated as writing EXIF is slow. To enable just uncomment `exif_write in photo.rb`
- **[ImageMagicK]**. *Carrierwave* can use either *RMagicK* or *MiniMagicK* (default). To change resize option the correct gem must be used (specified in Gemfile) and change included setting for Carrierwave in `file_uploader.rb`
Optional:
- *ImageScience* which requires **[FreeImage]**.
Ruby Gems: See `Gemfile`
Configuration
=============
{#configuration}
`config/balder.rb` has the following adjustable settings:
STORAGE_PATH
: Relative path to where the photos are stored. Default: uploads
Under the specified path two folders are used. "files" for original files and "thumbs" for generated thumbnails.
This can be adjusted in app/uploaders/file_uploader.rb
PRIVATE
: Require visitors to have a user and authenticate before viewing photos.
TITLE
: Title of site
HEROKU
: To be used on heroku.com. This will adjust carrierwave to save to Heroku's tmp area.
S3_KEY
: For saving files to Amazon S3 (required for Heroku)
S3_SECRET
: For saving files to Amazon S3 (required for Heroku)
S3_BUCKET
: For saving files to Amazon S3 (required for Heroku)
As these are environment variables you can easily add them to Heroku:
http://devcenter.heroku.com/articles/config-vars#rack_env_rails_env_merb_env
For a brief introduction to how to set up Balder on Heroku see:
http://blog.inspired.no/rails-photo-gallery-balder-on-heroku-and-s3-726
Installation
============
1. Clone the project from GitHub or Gitorious:
git clone git://github.com/espen/balder.git # GitHup
2. Install required software listed above
3. `bundle install` to install required gems.
4. Adjust the settings in `balder.rb` or as Heroku config variables (See [configuration above](#configuration))
5. Copy database file (not needed when hosting on Heroku):
cp config/database.example.yml config/database.yml
6. Create database user and edit database file. (unless on Heroku or using SQLite3)
7. Create database:
rake db:create
8. Migrate database schema:
rake db:migrate
9. Start up the project with your preferred web-server
For example:
rails start # or:
passenger start
Optional: add photos directly to disk
-------------------------------------
The gallery has a web-based upload tool. Alternatively you can upload files directly to the upload folder. This means you can import an existing folder based photo collection to Balder.
Put photos in containing folders(albums) in the specified gallery folder.
Hierarchy of folders is not fully supported.
This format is recommended:
./ski weekend in hemsedal/snow.jpg
./ski weekend in hemsedal/afterski.jpg
./trip to iran/beautiful girls in tehran.jpg
./trip to iran/mosque in yazd.jpg
./trip to iran/powder snow in dizin.jpg
Every time you manually add photos to disk you must scan by visiting `/photos/scan` or run `ScanFiles.Scan(false)` from the console.
Version history
===============
v1.2.3
: Rails 1.2.3
v1.2.2
: Rails 3.1
v1.2.1
: Using plupupload instead of uploadify for non-flash upload options. Can now use html5, normal form, silverlight, gears and browserplus for photo upload.
v1.2.0
: New storage path: `/uploads/files/` instead of `/uploads/`. Make sure you move your photos or adjust the storage path.
TODO
====
- Testing...
IDEAS
=====
- Themes
- Improved UX
- Mobile/Tablet friendly display using CSS media queries
Patches welcome!
Copyright and license info
==========================
This code is copyrighted by Espen Antonsen.
The source code is available free under the MIT License.
[ImageMagicK]: http://www.imagemagick.org
[ExifTool]: http://www.sno.phy.queensu.ca/~phil/exiftool/
[FreeImage]: http://sourceforge.net/projects/freeimage/

View file

@ -1,7 +1,10 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
require 'rake'
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
Photomix::Application.load_tasks
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'tasks/rails'

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 302 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

View file

@ -1,59 +0,0 @@
// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require jquery
//= require jquery_ujs
//= require jquery.easing.1.3
//= require jquery.noisy.min
//= require jquery.mousewheel
//= require fancybox/jquery.fancybox.pack
//= require fancybox/helpers/jquery.fancybox-buttons
//= require fancybox/helpers/jquery.fancybox-media
//= require fancybox/helpers/jquery.fancybox-thumbs
//= require twitter/bootstrap
//= require plupload
//= require jquery.plupload.queue
//= require plupload.flash
//= require plupload.silverlight
//= require plupload.html4
//= require plupload.html5
//= require plupload.gears
//= require plupload.browserplus
//= require_tree .
$(document).ready(function () {
$('body').noisy({
'intensity':10,
'size':200,
'opacity':0.120,
'fallback':'',
'monochrome':false
}).css('background-color', '#fefefe');
$('.icon-popover').popover()
$(".fancybox-thumb").fancybox({
prevEffect : 'none',
nextEffect : 'none',
helpers : {
title : {
type: 'outside'
},
overlay : {
opacity : 0.8,
css : {
'background-color' : '#000'
}
},
thumbs : {
width : 50,
height : 50
}
}
});
});

View file

@ -1,4 +0,0 @@
jQuery ->
$("a[rel=popover]").popover()
$(".tooltip").tooltip()
$("a[rel=tooltip]").tooltip()

View file

@ -1,2 +0,0 @@
// Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.

View file

@ -1,91 +0,0 @@
/*
* Style by Rogie http://www.komodomedia.com/blog/2007/01/css-star-rating-redux/
*/
.ajaxful-rating,
.ajaxful-rating a:hover,
.ajaxful-rating a:active,
.ajaxful-rating a:focus,
.ajaxful-rating .show-value {
background: url("/assets/ajaxful_rating/star.png") left -1000px repeat-x;
}
.ajaxful-rating {
position: relative;
/*width: 125px; this is setted dynamically */
height: 25px;
overflow: hidden;
list-style: none;
margin: 0;
padding: 0;
background-position: left top;
}
.ajaxful-rating li {
display: inline;
}
.ajaxful-rating a,
.ajaxful-rating span,
.ajaxful-rating .show-value {
position: absolute;
top: 0;
left: 0;
text-indent: -1000em;
height: 25px;
line-height: 25px;
outline: none;
overflow: hidden;
border: none;
}
.ajaxful-rating a:hover,
.ajaxful-rating a:active,
.ajaxful-rating a:focus {
background-position: left bottom;
}
/* This section is generated dynamically.
Just add a call to the helper method 'ajaxful_rating_style' within
the head tags in your main layout
.ajaxful-rating .stars-1{
width: 20%;
z-index: 6;
}
.ajaxful-rating .stars-2{
width: 40%;
z-index: 5;
}
.ajaxful-rating .stars-3{
width: 60%;
z-index: 4;
}
.ajaxful-rating .stars-4{
width: 80%;
z-index: 3;
}
.ajaxful-rating .stars-5{
width: 100%;
z-index: 2;
}
*/
.ajaxful-rating .show-value {
z-index: 1;
background-position: left center;
}
/* smaller star */
.ajaxful-rating.small {
/*width: 50px; this is setted dynamically */
height: 10px;
}
.ajaxful-rating.small,
.ajaxful-rating.small a:hover,
.ajaxful-rating.small a:active,
.ajaxful-rating.small a:focus,
.ajaxful-rating.small .show-value {
background-image: url("/assets/ajaxful_rating/star_small.png");
line-height: 10px;
height: 10px;
}

View file

@ -1,191 +0,0 @@
/*
*= require_tree .
*= require jquery.plupload.queue
*= require bootstrap_and_overrides
*= require fancybox/jquery.fancybox
*= require fancybox/helpers/jquery.fancybox-buttons
*= require fancybox/helpers/jquery.fancybox-thumbs
*= require_self
*/
* {
text-shadow: 1px 1px 1px #999;
/*text-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 0 30px rgba(255, 255, 255, 0.125);*/
font-family: 'Nunito', 'Istok Web', sans-serif;
color: #333;
}
body {
padding-top: 90px;
padding-bottom: 40px;
}
h1, h2, h3, h4, h5, h6 {
color: #666;
}
.navbar-inner {
background-color: #FAFAFA !important;
background-image: -moz-linear-gradient(center top, #FAFAFA, #EAEAEA) !important;
background-image: -ms-linear-gradient(center top, #FAFAFA, #EAEAEA) !important;
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#FAFAFA), to(#EAEAEA)) !important;
background-image: -webkit-linear-gradient(center top, #FAFAFA, #EAEAEA) !important;
background-image: -o-linear-gradient(center top, #FAFAFA, #EAEAEA) !important;
background-image: linear-gradient(top, #FAFAFA, #EAEAEA) !important;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = '#FAFAFA', endColorstr = '#EAEAEA', GradientType = 0) !important;
}
.navbar .brand {
color: #000 !important;
font-weight: bold !important;
padding-bottom: 5px !important;
padding: 10px 20px 12px;
/*text-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 0 30px rgba(255, 255, 255, 0.125);*/
}
.navbar .nav .dropdown-toggle .caret, .navbar .nav .open.dropdown .caret {
border-top-color: #000000;
}
.navbar .nav {
margin-top: 5px;
margin-bottom: 10px;
}
.navbar .nav > li {
padding-right: 5px;
}
.navbar .nav .divider-vertical {
padding: 0;
}
.navbar .nav > li > a {
color: #333333;
font-size: 18px;
}
.navbar .nav > li > a:hover {
background-color: #FAFAFA;
color: #7B7B7B;
border: 0px solid #C9C9C9;
border-radius: 5px 5px 5px 5px;
-webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5), 0 1px 0px rgba(255, 255, 255, 0.75);
-moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5), 0 1px 0px rgba(255, 255, 255, 0.75);
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5), 0 1px 0px rgba(255, 255, 255, 0.75);
transition: none;
}
.navbar .nav .active > a, .navbar .nav .active > a:hover {
background-color: #FAFAFA;
color: #7B7B7B;
border: 0;
border-radius: 5px 5px 5px 5px;
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5), 0 1px 0px rgba(255, 255, 255, 0.75);
transition: none;
}
.navbar .nav .open > .dropdown-toggle, .navbar .nav .active > .dropdown-toggle, .navbar .nav .open.active > .dropdown-toggle {
background-color: #FAFAFA;
color: #7B7B7B;
}
.navbar .nav .active > .dropdown-toggle:hover {
color: #7B7B7B;
}
.navbar-search {
margin-top: 15px;
}
.navbar-search .search-query {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 15px;
font-weight: normal;
line-height: 1.2;
color: #333;
background: #666;
background: rgba(255, 255, 255, 0.3);
border: 0;
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5), 0 1px 0px rgba(255, 255, 255, 0.75);
transition: none;
}
.navbar-search .search-query :-moz-placeholder {
color: #666;
}
.navbar-search .search-query::-webkit-input-placeholder {
color: #666;
}
.navbar-search .search-query:hover {
color: #333;
background-color: #999999;
background-color: rgba(255, 255, 255, 0.5);
}
.navbar-search .search-query:focus, .navbar-search .search-query.focused {
padding: 5px 10px;
color: #333333;
text-shadow: 0 1px 0 #ffffff;
background-color: #ffffff;
border: 0;
box-shadow: 0 0 3px rgba(0, 0, 0, 0.15);
outline: 0;
}
.ajaxful-rating-wrapper {
float: right;
}
.view-btn {
display: inline;
padding: 5px;
float: left;
}
.anythingSlider {
padding: 0 0 28px 0;
}
.thumbnail {
background: none repeat scroll 0 0 #FFFFFF;
border: 0 none;
border-radius: 7px 7px 7px 7px;
box-shadow: 1px 1px 3px #D9D9D9;
display: block;
height: 340px;
}
.caption {
position: relative;
bottom: 0px;
height: 150px;
}
.caption .title {
padding: 5px 0 5px 0;
font-size: 13px;
text-align: center;
}
.caption .descr {
display: block;
padding: 10px 0 0 0;
}
.caption .controls {
position: absolute;
bottom: 5px;
width: 250px;
}
.caption .controls .tooltips{
float: left;
width: 15px;
padding: 5px;
}
.icon-popover{
cursor: pointer;
}

View file

@ -1,32 +0,0 @@
@import "twitter/bootstrap/bootstrap";
body {
padding-top: 60px;
}
@import "twitter/bootstrap/responsive";
// Set the correct sprite paths
@iconSpritePath: asset-path('twitter/bootstrap/glyphicons-halflings.png');
@iconWhiteSpritePath: asset-path('twitter/bootstrap/glyphicons-halflings-white.png');
// Set the Font Awesome (Font Awesome is default. You can disable by commenting below lines)
// Note: If you use asset_path() here, your compiled boostrap_and_overrides.css will not
// have the proper paths. So for now we use the absolute path.
@fontAwesomeEotPath: '/assets/fontawesome-webfont.eot';
@fontAwesomeWoffPath: '/assets/fontawesome-webfont.woff';
@fontAwesomeTtfPath: '/assets/fontawesome-webfont.ttf';
@fontAwesomeSvgPath: '/assets/fontawesome-webfont.svg';
// Font Awesome
@import "fontawesome";
// Your custom LESS stylesheets goes here
//
// Since bootstrap was imported above you have access to its mixins which
// you may use and inherit here
//
// If you'd like to override bootstrap's own variables, you can do so here as well
// See http://twitter.github.com/bootstrap/less.html for their names and documentation
//
// Example:
// @linkColor: #ff0000;

View file

@ -1,3 +0,0 @@
// Place all the styles related to the home controller here.
// They will automatically be included in application.css.
// You can use Less here: http://lesscss.org/

View file

@ -1,177 +0,0 @@
/*
Plupload
------------------------------------------------------------------- */
.plupload_button {
display: -moz-inline-box; /* FF < 3*/
display: inline-block;
font: normal 12px sans-serif;
text-decoration: none;
color: #42454a;
border: 1px solid #bababa;
padding: 2px 8px 3px 20px;
margin-right: 4px;
background: #f3f3f3 url(asset_path("buttons.png")) no-repeat 0 center;
outline: 0;
/* Optional rounded corners for browsers that support it */
-moz-border-radius: 3px;
-khtml-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
}
.plupload_button:hover {
color: #000;
text-decoration: none;
}
.plupload_disabled, a.plupload_disabled:hover {
color: #737373;
border-color: #c5c5c5;
background: #ededed url(asset_path('buttons-disabled.png')) no-repeat 0 center;
cursor: default;
}
.plupload_add {
background-position: -181px center;
}
.plupload_wrapper {
font: normal 11px Verdana,sans-serif;
width: 100%;
}
.plupload_container {
padding: 8px;
background: url(asset_path('transp50.png'));
/*-moz-border-radius: 5px;*/
}
.plupload_container input {
border: 1px solid #DDD;
font: normal 11px Verdana,sans-serif;
width: 98%;
}
.plupload_header {background: #2A2C2E url(asset_path('backgrounds.gif')) repeat-x;}
.plupload_header_content {
background: url(asset_path('backgrounds.gif')) no-repeat 0 -317px;
min-height: 56px;
padding-left: 60px;
color: #FFF;
}
.plupload_header_title {
font: normal 18px sans-serif;
padding: 6px 0 3px;
}
.plupload_header_text {
font: normal 12px sans-serif;
}
.plupload_filelist {
margin: 0;
padding: 0;
list-style: none;
}
.plupload_scroll .plupload_filelist {
height: 185px;
background: #F5F5F5;
overflow-y: scroll;
}
.plupload_filelist li {
padding: 10px 8px;
background: #F5F5F5 url(asset_path('backgrounds.gif')) repeat-x 0 -156px;
border-bottom: 1px solid #DDD;
}
.plupload_filelist_header, .plupload_filelist_footer {
background: #DFDFDF;
padding: 8px 8px;
color: #42454A;
}
.plupload_filelist_header {
border-top: 1px solid #EEE;
border-bottom: 1px solid #CDCDCD;
}
.plupload_filelist_footer {border-top: 1px solid #FFF; height: 22px; line-height: 20px; vertical-align: middle;}
.plupload_file_name {float: left; overflow: hidden}
.plupload_file_status {color: #777;}
.plupload_file_status span {color: #42454A;}
.plupload_file_size, .plupload_file_status, .plupload_progress {
float: right;
width: 80px;
}
.plupload_file_size, .plupload_file_status, .plupload_file_action {text-align: right;}
.plupload_filelist .plupload_file_name {width: 205px}
.plupload_file_action {
float: right;
width: 16px;
height: 16px;
margin-left: 15px;
}
.plupload_file_action * {
display: none;
width: 16px;
height: 16px;
}
li.plupload_uploading {background: #ECF3DC url(asset_path('backgrounds.gif')) repeat-x 0 -238px;}
li.plupload_done {color:#AAA}
li.plupload_delete a {
background: url(asset_path('delete.gif'));
}
li.plupload_failed a {
background: url(asset_path('error.gif'));
cursor: default;
}
li.plupload_done a {
background: url(asset_path('done.gif'));
cursor: default;
}
.plupload_progress, .plupload_upload_status {
display: none;
}
.plupload_progress_container {
margin-top: 3px;
border: 1px solid #CCC;
background: #FFF;
padding: 1px;
}
.plupload_progress_bar {
width: 0px;
height: 7px;
background: #CDEB8B;
}
.plupload_scroll .plupload_filelist_header .plupload_file_action, .plupload_scroll .plupload_filelist_footer .plupload_file_action {
margin-right: 17px;
}
/* Floats */
.plupload_clear,.plupload_clearer {clear: both;}
.plupload_clearer, .plupload_progress_bar {
display: block;
font-size: 0;
line-height: 0;
}
li.plupload_droptext {
background: transparent;
text-align: center;
vertical-align: middle;
border: 0;
line-height: 165px;
}

View file

@ -1,146 +0,0 @@
/*
Plupload
------------------------------------------------------------------- */
.plupload_button {cursor: pointer;}
.plupload_wrapper {
font: normal 11px Verdana,sans-serif;
width: 100%;
}
.plupload .plupload_container input {width: 98%;}
.plupload .plupload_filelist_footer {border-width: 1px 0 0 0}
.plupload .plupload_filelist_header {border-width: 0 0 1px 0}
div.plupload .plupload_file {border-width: 0 0 1px 0}
div.plupload div.plupload_header {border-width: 0 0 1px 0; position: relative;}
.plupload_file .ui-icon {
cursor:pointer;
}
.plupload_header_content {
background-image: url(asset_path('plupload.png'));
background-repeat: no-repeat;
background-position: 8px center;
min-height: 56px;
padding-left: 60px;
position:relative;
}
.plupload_header_content_bw {background-image: url(asset_path('plupload-bw.png'));}
.plupload_header_title {
font: normal 18px sans-serif;
padding: 6px 0 3px;
}
.plupload_header_text {font: normal 12px sans-serif;}
.plupload_filelist,
.plupload_filelist_content {
border-collapse: collapse;
margin: 0;
padding: 0;
width: 100%;
-moz-user-select:none;
-webkit-user-select:none;
user-select:none;
}
.plupload_cell {padding: 8px 6px;}
.plupload_file {
border-left: none;
border-right: none;
}
.plupload .ui-sortable-helper,
.plupload .ui-sortable .plupload_file {
cursor:move;
}
.plupload_scroll {
max-height: 180px;
min-height: 168px;
_height: 168px;
}
.plupload_file_size, .plupload_file_status {text-align: right;}
.plupload_file_size, .plupload_file_status {width: 52px;}
.plupload_file_action {width: 16px;}
.plupload_file_name {
overflow: hidden;
padding-left: 10px;
}
.plupload_file_rename {
width:95%;
}
.plupload_progress {width: 60px;}
.plupload_progress_container {padding: 1px;}
/* Floats */
.plupload_right {float: right;}
.plupload_left {float: left;}
.plupload_clear,.plupload_clearer {clear: both;}
.plupload_clearer, .plupload_progress_bar {
display: block;
font-size: 0;
line-height: 0;
}
.plupload_clearer {height: 0;}
/* Misc */
.plupload_hidden {display: none;}
.plupload_droptext {
background: transparent;
text-align: center;
vertical-align: middle;
border: 0;
line-height: 165px;
}
.plupload_buttons, .plupload_upload_status {float: left}
.plupload_message {
position: absolute;
top: 0px;
left: 0px;
height: 100%;
width: 100%;
}
.plupload_message p {
padding:0.7em;
margin:0;
}
.plupload_message strong {
font-weight: bold;
}
plupload_message i {
font-style: italic;
}
.plupload_message p span.ui-icon {
float: left;
margin-right: 0.3em;
}
.plupload_header_content .ui-state-error,
.plupload_header_content .ui-state-highlight {
border:none;
}
.plupload_message_close {
position:absolute;
top:5px;
right:5px;
cursor:pointer;
}
.plupload .ui-sortable-placeholder {
height:35px;
}

View file

@ -0,0 +1,5 @@
class Admin::ApplicationController < ApplicationController
before_filter :require_role_admin
end

View file

@ -0,0 +1,47 @@
class Admin::UsersController < Admin::ApplicationController
def index
@users = User.find(:all, :order => "Name, email")
end
def show
@user = User.find(params[:id])
end
def new
@user = User.new
end
def create
@user = User.new(params[:user])
if @user.save
flash[:notice] = "Account registered!"
redirect_to @user
else
render :action => :new
end
end
def edit
@user = User.find(params[:id])
end
def update
@user = User.find(params[:id])
if @user.update_attributes(params[:user])
flash[:notice] = "Account updated!"
redirect_to @user
else
render :action => :edit
end
end
def destroy
@user = User.find(params[:id])
if @user.destroy
redirect_to users_path
else
redirect_to @user
end
end
end

View file

@ -1,15 +1,10 @@
class AlbumsController < ApplicationController
before_filter :check_public_access
skip_before_filter :authenticate_user!, :only => [:index, :show]
before_filter :require_role_admin, :only => [:untouched, :new, :create, :edit, :update, :destroy]
def index
add_breadcrumb t('activerecord.models.album.popular'), collections_path, :title => t('activerecord.models.album.popular')
add_breadcrumb t('activerecord.actions.create', :model => I18n.t('activerecord.models.album.single')), new_album_path,
:title => t('activerecord.actions.create', :model => I18n.t('activerecord.models.album.single')),
:li_icon => 'icon-plus-sign'
if params[:tag_id]
@albums = Album.where(:conditions => [ "id IN ( SELECT DISTINCT photos.album_id FROM photos WHERE photos.id IN ( SELECT photo_id FROM photo_tags WHERE photo_tags.tag_id = :q) )", { :q => Tag.find( params[:tag_id] ).id } ]).order('title')
@albums = Album.find(:all, :conditions => [ "id IN ( SELECT DISTINCT photos.album_id FROM photos WHERE photos.id IN ( SELECT photo_id FROM photo_tags WHERE photo_tags.tag_id = :q) )", { :q => Tag.find( params[:tag_id] ).id } ], :order => 'title')
elsif params[:q]
#search = params[:q]
#search = search.split("AND").map{|q|q.strip}
@ -25,7 +20,7 @@ class AlbumsController < ApplicationController
end
}
else
@albums = Album.popular.page(@page).per(@per_page)
@albums = Album.find(:all, :order => 'title')
end
respond_to do |format|
format.html
@ -45,8 +40,6 @@ class AlbumsController < ApplicationController
def show
@album = Album.find( params[:id])
@photos = @album.photos.popular
respond_to do |format|
format.html
format.json { render :json => @album }
@ -63,13 +56,11 @@ class AlbumsController < ApplicationController
@album = Album.new(params[:album])
if @album.save
flash[:notice] = "Album created! Now add some nice photos."
if params[:collection_id]
unless params[:collection_id].empty?
@album.collections << Collection.find( params[:collection_id] )
redirect_to upload_collection_album_photos_path(params[:collection_id], @album )
else
redirect_to upload_album_photos_path( @album )
end
flash[:notice] = "Album created!"
redirect_to @album
else
render :action => :new
end
@ -83,11 +74,7 @@ class AlbumsController < ApplicationController
@album = Album.find( params[:id])
if @album.update_attributes(params[:album])
flash[:notice] = "Album updated!"
if params[:collection_id]
redirect_to collection_album_path(params[:collection_id], @album )
else
redirect_to @album
end
else
render :action => :edit
end
@ -96,20 +83,10 @@ class AlbumsController < ApplicationController
def destroy
@album = Album.find( params[:id])
if @album.destroy
if params[:collection_id]
redirect_to collection_path(params[:collection_id] )
else
redirect_to albums_path
end
else
redirect_to @album
end
end
def rate
@album = Album.find(params[:id])
@album.rate(params[:stars], current_user, params[:dimension])
render :json => {:id => @album.wrapper_dom_id(params), :width => 125}
end
end

View file

@ -2,50 +2,115 @@
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
layout 'bootstrap'
helper :all # include all helpers, all the time
protect_from_forgery # See ActionController::RequestForgeryProtection for details
before_filter :set_locale
before_filter :authenticate_user!, :set_current_user
before_filter :setup, :set_pagination_params
filter_parameter_logging :password, :password_confirmation
helper_method :current_user, :current_user_session
before_filter :setup
#before_filter :adjust_format
layout :application_layout
private
# This hack is needed to access the current user in models. See http://rails-bestpractices.com/posts/47-fetch-current-user-in-models
def set_current_user
User.current = current_user
def application_layout
@browser_name ||= begin
if iphone_request?
'application.iphone'
else
'application'
end
end
end
# Set iPhone format if request to iphone.trawlr.com
def adjust_format
request.format = :iphone if iphone_request?
request.format = :ipad if ipad_request?
end
# Return true for requests to iphone.trawlr.com
def iphone_request?
return (request.subdomains.first == "iphone" || request.env['HTTP_USER_AGENT'].downcase.include?('iphone') )
end
# Return true for requests to iphone.trawlr.com
def ipad_request?
return (request.subdomains.first == "iphone" || request.env['HTTP_USER_AGENT'].downcase.include?('ipad') )
end
def setup
redirect_to new_account_path if User.all.size == 0
redirect_to new_account_path if User.all.length == 0
end
def check_public_access
require_user if ENV['PRIVATE'] == 'true'
end
def current_user_session
return @current_user_session if defined?(@current_user_session)
@current_user_session = UserSession.find
end
def current_user
return @current_user if defined?(@current_user)
@current_user = current_user_session && current_user_session.user
end
def require_role(roles = [])
unless current_user && current_user.in_role?(*roles)
store_location
flash[:notice] = "You must have permission to access this page"
redirect_to account_path
return false
end
return true
end
def require_role_admin
return false if !require_user
return require_role("admin")
end
def require_permission(permissions = [])
return false if !require_user
unless current_user && current_user.has_permission?(*permissions)
store_location
flash[:notice] = "You must have permission to access this page"
redirect_to account_path
return false
end
return true
end
def require_user
unless current_user
store_location
flash[:notice] = "You must be logged in to access this page"
redirect_to login_path
return false
end
return true
end
def require_no_user
if current_user
store_location
flash[:notice] = "Already logged in. Please logout"
redirect_to account_path
return false
end
return true
end
def store_location
session[:return_to] = request.fullpath
session[:return_to] = request.request_uri
end
def redirect_back_or_default(default)
redirect_to(session[:return_to] || default)
session[:return_to] = nil
end
private
def set_pagination_params
@page = params[:page]
@per_page = params[:per_page]
end
def set_locale
I18n.locale = session[:locale]
if params[:locale] && I18n.available_locales.include?(params[:locale].to_sym)
session[:locale] = I18n.locale = params[:locale].to_sym
end
end
end

View file

@ -1,14 +1,9 @@
class CollectionsController < ApplicationController
before_filter :check_public_access
skip_before_filter :authenticate_user!, :only => [:index, :show]
add_breadcrumb I18n.t('home_page'), :root_path, :title => I18n.t('home_page')
before_filter :require_role_admin, :only => [:new, :create, :edit, :update, :destroy]
def index
add_breadcrumb t('activerecord.models.collection.popular'), collections_path, :title => t('activerecord.models.collection.popular')
add_breadcrumb t('activerecord.actions.create', :model => I18n.t('activerecord.models.collection.single')), new_collection_path,
:title => t('activerecord.actions.create'), :li_icon => 'icon-plus-sign'
@collections = Collection.popular.page(@page).per(@per_page)
@collections = Collection.find(:all, :order => 'title')
respond_to do |format|
format.html
format.json { render :json => @collections }
@ -18,14 +13,7 @@ class CollectionsController < ApplicationController
def show
@collection = Collection.find( params[:id] )
add_breadcrumb t('activerecord.models.collection.popular'), collections_path, :title => t('activerecord.models.collection.popular')
add_breadcrumb @collection.title, collection_path(@collection), :title => @collection.title
add_breadcrumb t('activerecord.actions.update', :model => I18n.t('activerecord.models.collection.single')), edit_collection_path,
:title => t('activerecord.actions.update', :model => I18n.t('activerecord.models.collection.single'))
add_breadcrumb t('activerecord.actions.destroy', :model => I18n.t('activerecord.models.collection.single')),collection_path(@collection),
:title => t('activerecord.actions.destroy', :model => I18n.t('activerecord.models.collection.single'))
@albums = @collection.albums.includes(:photos).where("photos.id NOT NULL").order('albums.rating_average desc').page(@page).per(@per_page)
@albums = @collection.albums.find(:all, :order => 'title')
respond_to do |format|
format.html
format.json { render :json => @collection }
@ -36,17 +24,13 @@ class CollectionsController < ApplicationController
def new
@collection = Collection.new
add_breadcrumb t('activerecord.models.collection.other').mb_chars.capitalize.to_s, collections_path,
:title => t('activerecord.models.collection.other')
add_breadcrumb t('activerecord.actions.new', :model => I18n.t('activerecord.models.collection.one')), new_collection_path,
:title => t('activerecord.actions.new', :model => I18n.t('activerecord.models.collection.one'))
end
def create
@collection = Collection.new(params[:collection])
if @collection.save
flash[:notice] = "Collection created! Now lets add a new album."
redirect_to new_collection_album_path(@collection)
flash[:notice] = "Collection created!"
redirect_to @collection
else
render :action => :new
end
@ -58,8 +42,6 @@ class CollectionsController < ApplicationController
def update
@collection = Collection.find( params[:id])
add_breadcrumb t('activerecord.models.collection.popular'), collections_path, :title => t('activerecord.models.collection.popular')
add_breadcrumb t('activerecord.actions.create', :model => I18n.t('activerecord.models.collection.single')), new_collection_path, :title => t('activerecord.actions.create')
if @collection.update_attributes(params[:collection])
flash[:notice] = "Collection updated!"
redirect_to @collection
@ -77,10 +59,4 @@ class CollectionsController < ApplicationController
end
end
def rate
@collection = Collection.find(params[:id])
@collection.rate(params[:stars], current_user, params[:dimension])
render :json => {:id => @collection.wrapper_dom_id(params), :width => 125}
end
end

View file

@ -1,16 +0,0 @@
class HomeController < ApplicationController
skip_before_filter :authenticate_user!, :only => [:index]
add_breadcrumb I18n.t(:home_page), :root_path
def index
@collections = Collection.popular.limit(12)
@popular_photos = Photo.popular.limit(10)
respond_to do |format|
format.html
format.json { render :json => @collections }
format.xml { render :xml => @collections }
end
end
end

View file

@ -1,16 +0,0 @@
class LocaleController < ApplicationController
skip_before_filter :authenticate_user!, :only => [:set]
def set
if request.referer && request.referer.starts_with?('http://' + request.host)
session['return_to'] = request.referer
end
if params[:locale] && I18n.available_locales.include?(params[:locale].to_sym)
session[:locale] = I18n.locale = params[:locale].to_sym
flash.notice = t(:locale_changed)
else
flash[:error] = t(:locale_not_changed)
end
redirect_back_or_default(root_path)
end
end

View file

@ -1,17 +1,15 @@
class PhotosController < ApplicationController
#skip_before_filter :verify_authenticity_token
before_filter :check_public_access
skip_before_filter :authenticate_user!, :only => [:index, :show]
before_filter :require_role_admin, :only => [:untouched, :upload, :new, :create, :edit, :update, :destroy]
def index
if params[:tag_id] && params[:album_id]
@tag = Tag.find_by_title!( params[:tag_id] )
@photos = @tag.photos.where(:conditions => ['photos.album_id = :album', {:album => Album.find(params[:album_id] ) } ]).order("photos.id ASC")
@photos = Tag.find_by_title( params[:tag_id] ).photos.find(:all, :conditions => ['photos.album_id = :album', {:album => Album.find(params[:album_id] ) } ], :order => "photos.id ASC")
elsif params[:tag_id]
@tag = Tag.find_by_title!( params[:tag_id] )
@photos = @tag.photos.order("photos.id ASC")
@photos = Tag.find_by_title( params[:tag_id] ).photos.find(:all, :order => "photos.id ASC")
elsif params[:album_id]
@album = Album.find( params[:album_id])
@photos = @album.photos.order("photos.id ASC")
@photos = Album.find( params[:album_id]).photos.find(:all, :order => "photos.id ASC")
elsif params[:q]
#search = params[:q]
#search = search.split("AND").map{|q|q.strip}
@ -25,7 +23,7 @@ class PhotosController < ApplicationController
end
}
else
@photos = Photo.popular.page(@page).per(@per_page)
@photos = Photo.find(:all, :order => "photos.id ASC")
end
respond_to do |format|
format.html
@ -37,9 +35,9 @@ class PhotosController < ApplicationController
def untouched
if params[:album_id]
@album = Album.find( params[:album_id])
@photos = @album.photos.untouched.page(@page).per(@per_page)
@photos = @album.photos.untouched
else
@photos = Photo.untouched().page(@page).per(@per_page)
@photos = Photo.untouched()
end
respond_to do |format|
format.html
@ -77,10 +75,9 @@ class PhotosController < ApplicationController
def create
@photo = Photo.new(params[:photo])
@photo.attachment = params[:file]
respond_to do |format|
if @photo.save
format.html { render :text => "FILEID:" + @photo.attachment.album.url }
format.html { render :text => "FILEID:" + @photo.file.album.url }
format.xml { render :nothing => true }
else
format.html { render :text => "ERRORS:" + @photo.errors.full_messages.join(" "), :status => 500 }
@ -91,7 +88,7 @@ class PhotosController < ApplicationController
def edit
@photo = Photo.find( params[:id])
@tags = Tag.all.map { |tag| tag.title }.join('\',\'')
@tags = Tag.find(:all).map { |tag| tag.title }.join('\',\'')
end
def edit_multiple
@ -107,13 +104,7 @@ class PhotosController < ApplicationController
@photo = Photo.find( params[:id])
if @photo.update_attributes(params[:photo])
flash[:notice] = "Photo updated!"
if params[:collection_id]
redirect_to collection_album_photo_path( params[:collection_id], params[:album_id], @photo )
elsif params[:album_id]
redirect_to album_photo_path( params[:album_id], @photo )
else
redirect_to @photo
end
else
render :action => :edit
end
@ -139,19 +130,9 @@ class PhotosController < ApplicationController
@photo = Photo.find( params[:id])
@album = @photo.album
if @photo.destroy
if params[:collection_id]
redirect_to collection_album_path( params[:collection_id], @album )
else
redirect_to @album
end
else
redirect_to @photo
end
end
def rate
@photo = Photo.find(params[:id])
@photo.rate(params[:stars], current_user, params[:dimension])
render :json => {:id => @photo.wrapper_dom_id(params), :width => 125}
end
end

View file

@ -5,7 +5,7 @@ class TagsController < ApplicationController
if params[:album_id]
@tags = Album.find( params[:album_id] ).photo_tags
else
@tags = Tag.order('title')
@tags = Tag.find( :all, :order => 'title')
end
respond_to do |format|
format.html

View file

@ -0,0 +1,24 @@
class UserSessionsController < ApplicationController
before_filter :require_no_user, :only => [:new, :create]
before_filter :require_user, :only => :destroy
def new
@user_session = UserSession.new
end
def create
@user_session = UserSession.new(params[:user_session])
if @user_session.save
flash[:notice] = "Login successful!"
redirect_back_or_default account_path
else
render :new
end
end
def destroy
current_user_session.destroy
flash[:notice] = "Logout successful!"
redirect_to root_path
end
end

View file

@ -1,6 +1,6 @@
class UsersController < ApplicationController
before_filter :check_public_access
skip_before_filter :authenticate_user!, :only => [:new, :create]
before_filter :require_no_user, :only => [:new, :create]
before_filter :require_user, :only => [:show, :edit, :update, :destroy]
skip_filter :setup
def new

View file

@ -1,10 +1,10 @@
module AlbumsHelper
def new_upload_path_with_session_information
session_key = self.get_session_key
session_key = ActionController::Base.session_options[:key]
photos_path(session_key => cookies[session_key], request_forgery_protection_token => form_authenticity_token)
end
def get_session_key
Rails.application.config.session_options[:key]
ActionController::Base.session_options[:key]
end
end

View file

@ -1,13 +1,12 @@
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
=begin
def breadcrumbs(sep = "/", include_home = true)
levels = request.path.split('?')[0].split('/')
levels.delete_at(0)
#links = "You are here: "
links = content_tag('li', (content_tag('a', t(:home_page), :href => root_path ) if include_home))
links = content_tag('a', "HOME", :href => "/") if include_home
nocrumb = ["collections", "albums", "photos", "tags", "new", "edit", "tags"]
@ -16,19 +15,12 @@ module ApplicationHelper
level = level.gsub("-", " ")
if index+1 == levels.length
#links += " #{sep} #{level.upcase}" unless nocrumb.include?(level)
#elsif !nocrumb.include?(level)
elsif !nocrumb.include?(level)
links += " " + sep + " "
links += content_tag('li', content_tag('a', level, :href => '/'+levels[0..index].join('/')))
links += content_tag('a', level.upcase, :href => '/'+levels[0..index].join('/'))
end
end
content_tag("ul", links, :class => "breadcrumb")
end
=end
def pluralize(string, count=nil, variants=nil)
# example variants for russian: # Russian.pluralize(3.14, "вещь", "вещи", "вещей", "вещи")
a,b,c,d=*variants
I18n.locale.eql?(:ru) ? Russian.pluralize(count, a,b,c,d) : string.pluralize
content_tag("div", links, :id => "breadcrumb")
end
end

View file

@ -0,0 +1,2 @@
module CollectionsHelper
end

View file

@ -1,2 +0,0 @@
module HomeHelper
end

View file

@ -0,0 +1,2 @@
module PhotosHelper
end

View file

@ -0,0 +1,2 @@
module UserSessionsHelper
end

View file

@ -1,3 +1,9 @@
module UsersHelper
def has_permission?(permissions = [])
return current_user && current_user.has_permission?(permissions)
end
def has_role?(roles = [])
return current_user && current_user.in_role?(roles)
end
end

View file

@ -8,11 +8,13 @@ class FlashSessionCookieMiddleware
def call(env)
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?
params = ::Rack::Request.new(env).params
unless params[@session_key].nil?
env['HTTP_COOKIE'] = "#{@session_key}=#{params[@session_key]}".freeze
end
end
@app.call(env)
end
end

View file

@ -1,63 +0,0 @@
class Ability
include CanCan::Ability
def initialize(user)
self.clear_aliased_actions
alias_action :edit, :to => :update
alias_action :new, :to => :create
alias_action :new_action, :to => :create
alias_action :show, :to => :read
if user.has_role? 'admin'
can :manage, :all
else
#############################
can :read, User do |resource|
resource == user
end
can :update, User do |resource|
resource == user
end
can :create, User
##############################
can :read, Profile do |resource|
resource == user
end
can :update, Profile do |resource|
resource == user
end
can :create, Profile
###############################
can :read, Link do |resource|
resource == user
end
can :update, Link do |resource|
resource == user
end
can :create, Link
end
# Define abilities for the passed in user here. For example:
#
# user ||= User.new # guest user (not logged in)
# if user.admin?
# can :manage, :all
# else
# can :read, :all
# end
#
# The first argument to `can` is the action you are giving the user permission to do.
# If you pass :manage it will apply to every action. Other common actions here are
# :read, :create, :update and :destroy.
#
# The second argument is the resource the user can perform the action on. If you pass
# :all it will apply to every resource. Otherwise pass a Ruby class of the resource.
#
# The third argument is an optional hash of conditions to further filter the objects.
# For example, here the user can only update published articles.
#
# can :update, Article, :published => true
#
# See the wiki for details: https://github.com/ryanb/cancan/wiki/Defining-Abilities
end
end

View file

@ -1,31 +1,28 @@
class Album < ActiveRecord::Base
extend Ext::GroupFor
ajaxful_rateable :stars => 5, :cache_column => :rating_average
has_many :photos, :dependent => :destroy
has_many :collection_albums
has_many :collections, :through => :collection_albums
validates :path, :presence => true, :uniqueness => true #, :message => "Album already exsists on disc"
validates :title, :presence => true #, :message => "can't be blank"
validates_uniqueness_of :path, :message => "Album already exsists on disc"
validates_presence_of :title, :message => "can't be blank"
before_validation :ensure_path, :set_title
after_create :create_folders
after_destroy :destroy_folders
attr_accessor :tags
#attr_protected :path
scope :visible, lambda { where(:public => true) }
scope :popular, lambda{visible.includes(:photos).where("photos.id NOT NULL").order('albums.rating_average desc')}
scope :untouched, lambda{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, lambda{where("albums.id NOT IN (SELECT album_id FROM collection_albums)")}
scope :used, lambda{where("albums.id IN (SELECT album_id FROM collection_albums)")}
named_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'
named_scope :unused, :conditions => "albums.id NOT IN (SELECT album_id FROM collection_albums)"
named_scope :used, :conditions => "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

View file

@ -1,21 +1,8 @@
class Collection < ActiveRecord::Base
extend Ext::GroupFor
ajaxful_rateable :stars => 5, :cache_column => :rating_average
has_many :collection_albums
has_many :albums, :through => :collection_albums
attr_accessor :album_list
validates :title, :presence => true
scope :visible, where(:public => true)
scope :popular, lambda{visible.includes(:albums => :photos).where("photos.id NOT NULL").order('collections.rating_average desc')}
def photos_count
self.albums.includes(:photos).size
end
def to_param
"#{id}-#{title.parameterize}"
end

19
app/models/permission.rb Normal file
View file

@ -0,0 +1,19 @@
class Permission < ActiveRecord::Base
# uncomment any of the following lines which is relevant to your application,
# or create your own with the name of the model which acts_as_permissible.
belongs_to :user
belongs_to :role
belongs_to :permissible, :polymorphic => true, :dependent => :destroy
validates_presence_of :permissible_id, :permissible_type, :action
validates_format_of :action, :with => /^[a-z_]+$/
validates_numericality_of :permissible_id
validates_uniqueness_of :action, :scope => [:permissible_id,:permissible_type]
def to_hash
self.new_record? ? {} : {self.action => self.granted}
end
end

View file

@ -1,25 +1,23 @@
class Photo < ActiveRecord::Base
extend Ext::GroupFor
ajaxful_rateable :stars => 5, :cache_column => :rating_average
belongs_to :album
has_many :photo_tags, :dependent => :destroy
has_many :tags, :through => :photo_tags
mount_uploader :attachment, FileUploader
mount_uploader :file, FileUploader
before_create :exif_read
before_update :exif_write
after_create :set_title, :set_visible
#validates_uniqueness_of :path, :message => "Photo already exsists on disc"
validates_presence_of :title
before_validation :set_title
#before_create :exif_read
#before_update :exif_write # should only write if tags are changed as images can be large and thus ExifTool will take a while to write to the file
attr_accessor :tag_list
#attr_protected :path
scope :visible, where(:public => true)
scope :popular, visible.order('rating_average desc')
scope :untouched, :conditions => "photos.description IS NULL AND photos.id NOT IN ( SELECT photo_id FROM photo_tags)", :include => :album
scope :previous, lambda { |p,a| { :conditions => ["id < :id AND album_Id = :album ", { :id => p, :album => a } ], :limit => 1, :order => "id DESC"} }
scope :next, lambda { |p,a| { :conditions => ["id > :id AND album_Id = :album ", { :id => p, :album => a } ], :limit => 1, :order => "id ASC"} }
named_scope :untouched, :conditions => "photos.description IS NULL AND photos.id NOT IN ( SELECT photo_id FROM photo_tags)", :include => :album
named_scope :previous, lambda { |p,a| { :conditions => ["id < :id AND album_Id = :album ", { :id => p, :album => a } ], :limit => 1, :order => "id DESC"} }
named_scope :next, lambda { |p,a| { :conditions => ["id > :id AND album_Id = :album ", { :id => p, :album => a } ], :limit => 1, :order => "id ASC"} }
def to_param
"#{id}-#{title.parameterize}"
@ -41,7 +39,7 @@ class Photo < ActiveRecord::Base
end
def tag_list
return self.tags.order('title').map{ |t| t.title }.sort.join(" ")
return self.tags.find(:all, :order => 'title').map{ |t| t.title }.sort.join(" ")
end
def tag_list=(tags)
@ -52,33 +50,31 @@ class Photo < ActiveRecord::Base
self.tags = ts
end
def _delete
0
end
protected
private
def set_visible
update_attribute(:public, true) unless self.public
def set_title
self.title = self.file.file.basename.titleize unless self.title
end
def set_title
update_attribute(:title, self.attachment.file.basename.titleize) unless self.title
def ensure_file
#self.destroy if !File.exists?( APP_CONFIG[:photos_path] + self.path )
end
def exif_read
photo = MiniExiftool.new(self.attachment.file.file)
photo = MiniExiftool.new(self.file.path)
self.longitude = photo.GPSLongitude if self.longitude.nil?
self.latitude = photo.GPSLatitude if self.latitude.nil?
self.title = photo.DocumentName if self.title.nil?
self.description = photo.ImageDescription if self.description.nil? && photo.ImageDescription != 'Exif_JPEG_PICTURE'
self.description = photo.ImageDescription if self.description.nil? || photo.ImageDescription != 'Exif_JPEG_PICTURE'
self.tag_list = (self.tags.empty? ? "" : self.album.tag_list) + " " + (photo.Keywords.nil? ? "" : photo.Keywords.to_a.map { |tag| tag.gsub(" ", "_") }.join(" "))
end
def exif_write
# should only write if tags are changed as images can be large and thus ExifTool will take a while to write to the file
photo = MiniExiftool.new(self.attachment.file.file)
photo = MiniExiftool.new(self.path.file)
photo.GPSLongitude = self.longitude
photo.GPSLatitude = self.latitude
photo.DocumentName = self.title
@ -87,4 +83,5 @@ class Photo < ActiveRecord::Base
photo.save
end
end

View file

@ -1,7 +0,0 @@
class Rate < ActiveRecord::Base
belongs_to :rater, :class_name => "User"
belongs_to :rateable, :polymorphic => true
validates_numericality_of :stars, :minimum => 1
attr_accessible :rate, :dimension
end

View file

@ -1,5 +1,12 @@
class Role < ActiveRecord::Base
attr_accessible :name
has_many :role_memberships, :as => :roleable, :dependent => :destroy
has_many :roles, :through => :role_memberships, :source => :role
has_and_belongs_to_many :users
has_many :roleables, :class_name => "RoleMembership", :foreign_key => "role_id", :dependent => :destroy
has_many :subroles, :through => :roleables, :source => :roleable, :source_type => 'Role'
has_many :users, :through => :roleables, :source => :roleable, :source_type => 'User'
validates_uniqueness_of :name
acts_as_permissible
end

View file

@ -0,0 +1,36 @@
class RoleMembership < ActiveRecord::Base
belongs_to :user
belongs_to :role
belongs_to :roleable, :polymorphic => true
validates_presence_of :roleable_id, :roleable_type, :role_id
validates_uniqueness_of :role_id, :scope => [:roleable_id, :roleable_type]
validates_numericality_of :roleable_id, :role_id
validates_format_of :roleable_type, :with => /^[A-Z]{1}[a-z0-9]+([A-Z]{1}[a-z0-9]+)*$/
validate :role_does_not_belong_to_itself_in_a_loop
protected
def role_does_not_belong_to_itself_in_a_loop
if roleable_type == "Role"
if role_id == roleable_id
errors.add_to_base("A role cannot belong to itself.")
else
if belongs_to_itself_through_other?(roleable_id, role_id)
errors.add_to_base("A role cannot belong to a role which belongs to it.")
end
end
end
end
def belongs_to_itself_through_other?(original_roleable_id, current_role_id)
if self.class.find(:first, :select => "id", :conditions => ["roleable_id=? AND roleable_type='Role' AND role_id=?",current_role_id,original_roleable_id])
return true
else
memberships = self.class.find(:all, :select => "role_id", :conditions => ["roleable_id=? AND roleable_type='Role'",current_role_id])
if memberships.any? {|membership| belongs_to_itself_through_other?(original_roleable_id,membership.role_id)}
return true
end
end
return false
end
end

View file

@ -1,7 +0,0 @@
class SecretLinkObserver < ActiveRecord::Observer
observe :collection, :album, :photo
def before_create(record)
record.url = ::SecureRandom.hex(16)
end
end

View file

@ -1,45 +1,4 @@
class User < ActiveRecord::Base
devise :database_authenticatable, :registerable, :confirmable, :token_authenticatable,
:recoverable, :rememberable, :trackable, :validatable, :omniauthable, :lockable
attr_accessible :id, :name, :second_name, :surname, :email, :password, :password_confirmation, :remember_me, :userpic
ajaxful_rater
mount_uploader :userpic, UserpicUploader
has_and_belongs_to_many :roles
def small_url
userpic.url(:small)
end
alias_method :avatar, :small_url
def thumb_url
userpic.url(:thumb)
end
def original_url
userpic.url(:original)
end
##########################################################
# This hack is needed to access the current user in models.
#See http://rails-bestpractices.com/posts/47-fetch-current-user-in-models
def self.current
Thread.current[:user]
end
def self.current=(user)
Thread.current[:user] = user
end
def self.admin_created?
User.admin.count > 0
end
def has_role?(role_in_question)
roles.any? { |role| role.name == role_in_question.to_s }
end
acts_as_authentic
acts_as_permissible
end

View file

@ -0,0 +1,3 @@
class UserSession < Authlogic::Session::Base
# configuration here, see documentation for sub modules of Authlogic::Session
end

View file

@ -2,20 +2,17 @@
class FileUploader < CarrierWave::Uploader::Base
@@generate_file_name = ''
@@original_filename = ''
# Include RMagick or ImageScience support
# include CarrierWave::RMagick
include CarrierWave::RMagick
# include CarrierWave::ImageScience
include CarrierWave::MiniMagick
# Choose what kind of storage to use for this uploader
#storage :file
if ENV['S3_KEY']
storage :fog
storage :s3
def cache_dir
"#{Rails.root.to_s}/tmp/uploads" if ENV['HEROKU'] == 'true'
"#{RAILS_ROOT}/tmp/uploads" if ENV['HEROKU'] == 'true'
end
else
storage :file
@ -25,15 +22,7 @@ class FileUploader < CarrierWave::Uploader::Base
# This is a sensible default for uploaders that are meant to be mounted:
def store_dir
#{}"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
ENV['STORAGE_PATH'] + "/files/#{model.album.path}/#{model.id}"
end
def filename
unless @@original_filename == original_filename
@@original_filename = original_filename
@@generate_file_name = "#{::SecureRandom.hex(8)}#{File.extname(original_filename).downcase}" if original_filename
end
@@generate_file_name
ENV['STORAGE_PATH'] + "files/#{model.album.path}"
end
# Provide a default URL as a default if there hasn't been a file uploaded
@ -49,50 +38,40 @@ class FileUploader < CarrierWave::Uploader::Base
# end
# Create different versions of your uploaded files
version :thumb do
process :resize_to_fill => [260, 180]
version :collection do
process :resize_to_fill => [200, 200]
def store_dir
ENV['STORAGE_PATH'] + "/thumbs/#{model.album.path}/#{model.id}"
ENV['STORAGE_PATH'] + "/thumbs/#{model.album.path}"
end
end
######################################################################################################################
# Note
# The default grid system provided in Bootstrap utilizes 12 columns that
# render out at widths of 724px, 940px (default without responsive CSS included), and 1170px.
# Below 767px viewports, the columns become fluid and stack vertically.
version :middle do
process :resize_to_fill => [742, 500]
version :album do
process :resize_to_fill => [100, 100]
def store_dir
ENV['STORAGE_PATH'] + "/thumbs/#{model.album.path}/#{model.id}"
ENV['STORAGE_PATH'] + "/thumbs/#{model.album.path}"
end
end
version :large do
process :resize_to_fill => [940, 600]
version :preview do
process :resize_to_fit => [210, 210]
def store_dir
ENV['STORAGE_PATH'] + "/thumbs/#{model.album.path}/#{model.id}"
ENV['STORAGE_PATH'] + "/thumbs/#{model.album.path}"
end
end
version :largest do
process :resize_to_fill => [1170, 600]
version :single do
process :resize_to_limit => [950, 950]
def store_dir
ENV['STORAGE_PATH'] + "/thumbs/#{model.album.path}/#{model.id}"
ENV['STORAGE_PATH'] + "/thumbs/#{model.album.path}"
end
end
######################################################################################################################
# Add a white list of extensions which are allowed to be uploaded,
# for images you might use something like this:
def extension_white_list
%w(jpg jpeg gif png bmp tiff)
end
# def extension_white_list
# %w(jpg jpeg gif png)
# end
# Override the filename of the uploaded files
# def filename
# "something.jpg" if original_filename
# end
end

View file

@ -1,28 +0,0 @@
class UserpicUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
def store_dir
"#{ENV['STORAGE_PATH']}/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}/original"
end
def filename
"#{::SecureRandom.hex(8)}#{File.extname(original_filename).downcase}" if original_filename
end
version :mini do
process :resize_to_fit => [50, 50]
def store_dir
"#{ENV['STORAGE_PATH']}/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}/mini"
end
end
version :small do
process :resize_to_fit => [100, 100]
def store_dir
"#{ENV['STORAGE_PATH']}/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}/small"
end
end
end

View file

@ -0,0 +1,6 @@
<%= form.label :name, 'Display name' %><br />
<%= form.text_field :name %><br />
<br />
<%= form.label :email %><br />
<%= form.text_field :email %><br />
<br/>

View file

@ -0,0 +1,15 @@
<h1>Edit Account</h1>
<% form_for @user do |f| %>
<%= f.error_messages %>
<%= render :partial => "form", :object => f %>
<%= f.submit "Update" %>
<% end %>
<% content_for :action_links do %>
<%= link_to("Delete user", { :action => "destroy", :id => @user },
:confirm => "Are you sure you want to delete this user?",
:method => :delete) %>
<% end %>

View file

@ -0,0 +1,7 @@
<% for user in @users %>
<h2><%= link_to user.name || user.email , user %></h2>
<% end %>
<% content_for :action_links do %>
<%= link_to "New user", new_user_path %>
<% end %>

View file

@ -0,0 +1,7 @@
<h1>Register</h1>
<% form_for @user do |f| %>
<%= f.error_messages %>
<%= render :partial => "form", :object => f %>
<%= f.submit "Register" %>
<% end %>

View file

@ -0,0 +1,45 @@
<p>
<b>Name:</b>
<%=h @user.name %>
</p>
<p>
<b>Email:</b>
<%=h @user.email %>
</p>
<p>
<b>Login count:</b>
<%=h @user.login_count %>
</p>
<p>
<b>Last request at:</b>
<%=h @user.last_request_at %>
</p>
<p>
<b>Last login at:</b>
<%=h @user.last_login_at %>
</p>
<p>
<b>Current login at:</b>
<%=h @user.current_login_at %>
</p>
<p>
<b>Last login ip:</b>
<%=h @user.last_login_ip %>
</p>
<p>
<b>Current login ip:</b>
<%=h @user.current_login_ip %>
</p>
<% content_for :action_links do %>
<%= link_to 'Edit', edit_user_path(@user) %>
<% end %>

View file

@ -1,63 +1,30 @@
<%= content_for :javascript do %>
<%= javascript_include_tag "http://maps.google.com/maps/api/js?sensor=true" -%>
<%= javascript_include_tag "tag/tag" -%>
<% 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>
<% end %>
<div id="map_canvas"></div>
<fieldset>
<%= hidden_field_tag :all_tags, "'#{Tag.all.map { |tag| tag.title }.join('\',\'')}'" %>
<%= hidden_field_tag :all_tags, "'#{Tag.find(:all).map { |tag| tag.title }.join('\',\'')}'" %>
<%= hidden_field_tag :collection_id, params[:collection_id] %>
<%= form.hidden_field :id %>
<%= form.hidden_field :latitude %>
<%= form.hidden_field :longitude %>
<div class="control-group">
<%= form.label :title, t('activerecord.models.album.attributes.title'), {:class => 'control-label'} %>
<div class="controls">
<%= form.text_field :title, {:class => 'input-xlarge'} %>
</div>
</div>
<%= form.label :title, :Title, {:class => 'big'} %><br />
<%= form.text_field :title, {:class => 'big'} %><br />
<div class="control-group">
<%= form.label :description, t('activerecord.models.album.attributes.description'), {:class => 'control-label'} %>
<div class="controls">
<%= form.text_area :description, {:class => 'input-xlarge', :rows => 5} %>
</div>
</div>
<%= form.label :description %><br />
<%= form.text_area :description %><br />
<div class="control-group">
<%= form.label :public, t('activerecord.models.album.attributes.visible'), {:class => 'control-label'} %>
<div class="controls">
<label class="checkbox">
<%= check_box 'collection', :public %> <%= t(:make_visible_for_all) %>
</label>
</div>
</div>
<%= form.label :address %><br />
<%= form.text_area :address, { :rows => 3} %><br />
<div class="control-group">
<%= form.label :address, t('activerecord.models.album.attributes.address'), {:class => 'control-label'} %>
<div class="controls">
<%= form.text_area :address, {:class => 'input-xlarge', :rows => 5} %>
</div>
</div>
<div class="control-group">
<%= form.label :note, t('activerecord.models.album.attributes.note'), {:class => 'control-label'} %>
<div class="controls">
<%= form.text_area :note, {:class => 'input-xlarge', :rows => 5} %>
</div>
</div>
<div class="control-group">
<%= form.label :tags, t('activerecord.models.album.attributes.tags'), {:class => 'control-label'} %>
<div class="controls">
<%= form.text_field :tags, {:class => 'input-xlarge', :autocomplete => "off", :class => 'tag_list', :value => (@album.tags.map{|tag|tag.title}.join(" ") unless @album.tags.nil?) } %>
</div>
</div>
<%= form.label :note %><br />
<%= form.text_area :note %><br />
<%= form.label :tags %><br />
<%= form.text_field :tags, { :autocomplete => "off", :class => 'tag_list', :value => (@album.tags.map{|tag|tag.title}.join(" ") unless @album.tags.nil?) } %><br />
<br />
Contains: <%= @album.photos.count %> photos<br/>
</fieldset>

View file

@ -1,28 +0,0 @@
<div class="row">
<div class="span12">
<% @albums.in_groups_of(4).each do |group| %>
<% unless group.empty? %>
<ul class="thumbnails">
<% group.compact.each_with_index do |album, index| %>
<li class="span3">
<div class="thumbnail">
<%= image_tag album.photos.first.attachment.thumb.url %>
<div class="caption">
<h5 class="title"><%= album.title %></h5>
<em class="descr"><%= album.description %></em>
<div class="controls">
<p class="view-btn"><%= link_to 'View', (album_path(album) unless album.photos.empty?), {:class => 'btn btn-primary'} %></p>
<div class="tooltips">
<span rel="popover" class="icon-th icon-popover" data-content="<%= t(:photos_counter, :count => album.photos.count) %>"></span>
</div>
<%= ratings_for album %>
</div>
</div>
</div>
</li>
<% end %>
</ul>
<% end %>
<% end %>
</div>
</div>

View file

@ -1,16 +1,16 @@
<h1>Edit Album</h1>
<%= form_for @album do |f| %>
<% form_for @album do |f| %>
<%= f.error_messages %>
<%= render :partial => "form", :object => f %>
<%= f.submit "Update" %>
<% end %>
<%= content_for :action_links do %>
<% content_for :action_links do %>
<% if has_role?("admin") %>
<%= link_to("Delete album", { :action => "destroy", :id => @album, :collection_id => params[:collection_id] },
<%= link_to("Delete album", { :action => "destroy", :id => @album },
:confirm => "Are you sure you want to delete this album?",
:method => :delete) %>
<% end %>

View file

@ -1,10 +1,18 @@
<%= paginate @albums %>
<%= render 'row_collections' %>
<%= paginate @albums %>
<% for album in @albums %>
<div class="row">
<div class="title">
<%= render :partial => "photos/thumb", :locals => {:photo => album.photos.first } unless album.photos.empty? %>
<p><%= link_to album.title, album %></p>
</div>
<div class="image">
<%= render :partial => "photos/thumb", :collection => album.photos.find(:all, :limit => 5, :offset => 1), :as => :photo %>
</div>
</div>
<% end %>
<%= content_for :action_links do %>
<% content_for :action_links do %>
<%= link_to "Show just the photos tagged with #{params[:q]}", photos_path(:q => params[:q]) if params[:q] %>
<% if current_user and current_user.has_role?("admin") %>
<% if has_role?("admin") %>
<%= " |&nbsp;" if params[:q] %>
<%= link_to "New album", new_album_path() %>
<% end %>

View file

@ -1,9 +1,8 @@
<%= form_for @album, :html => {:class => 'form-horizontal'} do |f| %>
<legend><%= t('activerecord.actions.new', :model => I18n.t('activerecord.models.album.one')) %></legend>
<h1>New Album</h1>
<% form_for @album do |f| %>
<%= f.error_messages %>
<%= render :partial => "form", :object => f %>
<div class="form-actions">
<%= f.button "Create", :class => 'btn btn-primary btn-large' %>
</div>
<%= f.submit "Create" %>
<% end %>

View file

@ -1,5 +1,16 @@
<h2><%= @album.title %></h2>
<%= render :partial => 'photos/row_collections' %>
<div id="multipleimages">
<table>
<% count = 0.0 %>
<% for photo in @album.photos.find(:all, :order => "Id ASC") %>
<% count += 1%>
<% if count == 1 || ( (count-1) / 4.0 == ( (count-1) / 4.0).to_i ) %><tr><% end %>
<td><%= link_to image_tag( photo.file.preview.url ), [@album.collections.first, @album, photo] %></td>
<% if count / 4.0 == (count / 4.0).to_i %></tr><% end %>
<% end %>
</table>
</div>
<p><%= @album.description %></p>
@ -13,35 +24,28 @@
<% unless @album.collections.empty? %>
<p>Part of:
<% for collection in @album.collections.order('title') %>
<% for collection in @album.collections.find(:all, :order => 'title') %>
<%= link_to collection.title, collection_path(collection) %>
<% end %>
</p>
<% end %>
<% if current_user and current_user.has_role?("admin") %>
<% if has_role?("admin") %>
<p><%= @album.address %></p>
<% end %>
<% if has_role?("admin") %>
<p><%= @album.note %></p>
<% end %>
<%= content_for :action_links do %>
<% if current_user and current_user.has_role?("admin") %>
<% if params[:collection_id] %>
<li><%= link_to "PDF", collection_album_path(params[:collection_id], @album, :format => 'pdf') %></li>
<li><%= link_to "Edit album", edit_collection_album_path(params[:collection_id], @album) %></li>
<li><%= link_to "Edit all photos", edit_multiple_collection_album_photos_path(params[:collection_id], @album) %></li>
<li><%= link_to "Edit untouched photos", untouched_collection_album_photos_path(params[:collection_id], @album) %></li>
<li><%= link_to "Add photos", upload_collection_album_photos_path(params[:collection_id], @album) %></li>
<% else %>
<li><%= link_to "PDF", album_path(@album, :format => 'pdf') %></li>
<li><%= link_to "Edit album", edit_album_path(@album) %></li>
<li><%= link_to "Edit all photos", edit_multiple_album_photos_path(@album) %></li>
<li><%= link_to "Edit untouched photos", untouched_album_photos_path(@album) %></li>
<li><%= link_to "Add photos", upload_album_photos_path(@album) %></li>
<% end %>
<% content_for :action_links do %>
<% if has_role?("admin") %>
<%= link_to "PDF", album_path(@album, :format => 'pdf') %> |&nbsp;
<%= link_to "Edit album", edit_album_path(@album) %> |&nbsp;
<%= link_to "Edit all photos", edit_multiple_album_photos_path(@album) %> |&nbsp;
<%= link_to "Edit untouched photos", untouched_album_photos_path(@album) %> |&nbsp;
<%= link_to "Add photos", upload_album_photos_path(@album) %>
<% end %>
<% end %>

View file

@ -1,41 +1,28 @@
<fieldset>
<div class="control-group">
<%= form.label :title, t('activerecord.models.collection.attributes.title'), {:class => 'control-label'} %>
<div class="controls">
<%= form.text_field :title, {:class => 'input-xlarge'} %>
</div>
</div>
<%= form.label :title, :Title, {:class => 'big'} %><br />
<%= form.text_field :title, {:class => 'big'} %><br />
<div class="control-group">
<%= form.label :description, t('activerecord.models.collection.attributes.description'), {:class => 'control-label'} %>
<div class="controls">
<%= form.text_area :description, {:class => 'input-xlarge', :rows => 5} %>
</div>
</div>
<div class="control-group">
<%= form.label :public, t('activerecord.models.collection.attributes.visible'), {:class => 'control-label'} %>
<div class="controls">
<label class="checkbox">
<%= check_box 'collection', :public %> <%= t(:make_visible_for_all) %>
</label>
</div>
</div>
<%= form.label :description %><br />
<%= form.text_area :description %><br />
<% unless @collection.albums.empty? %>
<%= form.label :albums %>
<% @collection.albums.each do |album| %>
<%= form.fields_for :album_list do |album_fields| %>
<%= image_tag "delete-24x24.png", :class => "delete", :alt => "Delete" -%>
<%= form.label :albums %><br />
<div id="collection_albums">
<% for album in @collection.albums %>
<% form.fields_for :album_list do |album_fields| %>
<span>
<img src="/images/delete-24x24.png" border="" class="delete" />
<% if album.photos.empty? %>
<%= album.title %>
<% else %>
<%= image_tag album.photos.first.attachment.thumb.url, :alt => album.title %>
<%= image_tag album.photos.first.file.album.url, :alt => album.title %>
<% end %>
<%= album_fields.hidden_field album.id %>
</span>
<% end %>
<% end %>
</div>
<p class="clear">
<%
grouped_options = [
['Available albums',[['Choose album to add','']]],
@ -45,5 +32,6 @@
grouped_options_for_select(grouped_options)
%>
<%= select_tag 'available_albums', grouped_options_for_select(grouped_options) %>
</p>
<% end %>
</fieldset>

View file

@ -1,29 +0,0 @@
<div class="row">
<div class="span12">
<% @collections.in_groups_of(4).each do |group| %>
<% unless group.empty? %>
<ul class="thumbnails">
<% group.compact.each_with_index do |collection, index| %>
<li class="span3">
<div class="thumbnail">
<%= image_tag collection.albums.first.photos.first.attachment.thumb.url %>
<div class="caption">
<h5 class="title"><%= collection.title %></h5>
<em class="descr"><%= collection.description %></em>
<div class="controls">
<p class="view-btn"><%= link_to 'View', (collection_path(collection) unless collection.albums.empty? || collection.albums.first.photos.empty?), {:class => 'btn btn-primary'} %></p>
<div class="tooltips">
<span rel="popover" class="icon-th-large icon-popover" data-content="<%= t(:albums_counter, :count => collection.albums.size) %>"></span>
<span rel="popover" class="icon-th icon-popover" data-content="<%= t(:photos_counter, :count => collection.photos_count) %>"></span>
</div>
<%= ratings_for collection %>
</div>
</div>
</div>
</li>
<% end %>
</ul>
<% end %>
<% end %>
</div>
</div>

View file

@ -1,12 +1,12 @@
<h1>Edit collection</h1>
<%= form_for @collection do |f| %>
<% form_for @collection do |f| %>
<%= f.error_messages %>
<%= render :partial => "form", :object => f %>
<%= f.submit "Update" %>
<% end %>
<%= content_for :action_links do %>
<% content_for :action_links do %>
<%= link_to("Delete this collection", { :action => "destroy", :id => @collection },
:confirm => "Are you sure you want to delete this collection?",
:method => :delete) %>

View file

@ -1,6 +1,14 @@
<h1><%= t('activerecord.models.collection.pluralize') %></h1>
<%= paginate @collections %>
<%= render 'row_collections' %>
<%= paginate @collections %>
<div id="multipleimages">
<% for collection in @collections %>
<div class="thumb">
<h3><%= link_to collection.title, collection %></h3>
<%= link_to (image_tag collection.albums.find(:first).photos.first.file.collection.url ), collection_path(collection) unless collection.albums.empty? || collection.albums.find(:first).photos.empty? %>
</div>
<% end %>
</div>
<% content_for :action_links do %>
<% if has_role?("admin") %>
<%= link_to "New collection", new_collection_path %>
<% end %>
<% end %>

View file

@ -1,8 +1,7 @@
<%= form_for @collection, :html => {:class => 'form-horizontal'} do |f| %>
<legend><%= t('activerecord.actions.new', :model => I18n.t('activerecord.models.collection.one')) %></legend>
<h1>New collection</h1>
<% form_for @collection do |f| %>
<%= f.error_messages %>
<%= render :partial => "form", :object => f %>
<div class="form-actions">
<%= f.button "Create", :class => 'btn btn-primary btn-large' %>
</div>
<%= f.submit "Create" %>
<% end %>

View file

@ -1,12 +1,22 @@
<h2><%= @collection.title %></h2>
<p><%= @collection.description %></p>
<h2><%= h @collection.title %></h2>
<p><%= h @collection.description %></p>
<%= render :partial => 'albums/row_collections' %>
<% for album in @albums %>
<div class="row">
<div class="title">
<%= render :partial => "photos/thumb", :locals => {:photo => album.photos.first } unless album.photos.empty? %>
<p><%= link_to album.title, collection_album_path(@collection, album) %></p>
</div>
<div class="image">
<%= render :partial => "photos/thumb", :collection => album.photos.find(:all, :limit => 5, :offset => 1), :as => :photo %>
</div>
</div>
<% end %>
<%= content_for :action_links do %>
<% if current_user and current_user.has_role?("admin") %>
<li><%= link_to "PDF", collection_path(@collection, :format => 'pdf') %></li>
<li><%= link_to "Edit collection", edit_collection_path(@collection) %></li>
<li><%= link_to "New album", new_collection_album_path(@collection) %></li>
<% content_for :action_links do %>
<% if has_role?("admin") %>
<%= link_to "PDF", collection_path(@collection, :format => 'pdf') %> |&nbsp;
<%= link_to "Edit collection", edit_collection_path(@collection) %> |
<%= link_to "New album", new_collection_album_path(@collection) %>
<% end %>
<% end %>

View file

@ -1,24 +0,0 @@
<%- if controller_name != 'sessions' %>
<%= link_to t('devise.sign_in'), login_path %><br />
<% end -%>
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
<%= link_to t('devise.sign_up'), signup_path %><br />
<% end -%>
<%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
<%= link_to t('devise.forgot_your_password'), new_password_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
<%= link_to t('devise.send_confirmation_instructions'), new_confirmation_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
<%= link_to t('devise.send_unlock_instructions'), new_unlock_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.omniauthable? %>
<%- resource_class.omniauth_providers.each do |provider| %>
<%= link_to t('devise.sign_in_with', :provider => provider.to_s.titleize), omniauth_authorize_path(resource_name, provider) %><br />
<% end -%>
<% end -%>

View file

@ -1,12 +0,0 @@
<h2>Resend confirmation instructions</h2>
<%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %>
<%= devise_error_messages! %>
<div><%= f.label :email %><br />
<%= f.email_field :email %></div>
<div><%= f.submit "Resend confirmation instructions" %></div>
<% end %>
<%= render "links" %>

View file

@ -1,5 +0,0 @@
<p>Welcome <%= @resource.email %>!</p>
<p>You can confirm your account email through the link below:</p>
<p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %></p>

View file

@ -1,8 +0,0 @@
<p>Hello <%= @resource.email %>!</p>
<p>Someone has requested a link to change your password, and you can do this through the link below.</p>
<p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %></p>
<p>If you didn't request this, please ignore this email.</p>
<p>Your password won't change until you access the link above and create a new one.</p>

View file

@ -1,7 +0,0 @@
<p>Hello <%= @resource.email %>!</p>
<p>Your account has been locked due to an excessive amount of unsuccessful sign in attempts.</p>
<p>Click the link below to unlock your account:</p>
<p><%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %></p>

View file

@ -1,16 +0,0 @@
<h2>Change your password</h2>
<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %>
<%= devise_error_messages! %>
<%= f.hidden_field :reset_password_token %>
<div><%= f.label :password, "New password" %><br />
<%= f.password_field :password %></div>
<div><%= f.label :password_confirmation, "Confirm new password" %><br />
<%= f.password_field :password_confirmation %></div>
<div><%= f.submit "Change my password" %></div>
<% end %>
<%= render "links" %>

View file

@ -1,12 +0,0 @@
<h2>Forgot your password?</h2>
<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %>
<%= devise_error_messages! %>
<div><%= f.label :email %><br />
<%= f.email_field :email %></div>
<div><%= f.submit "Send me reset password instructions" %></div>
<% end %>
<%= render "links" %>

View file

@ -1,25 +0,0 @@
<h2>Edit <%= resource_name.to_s.humanize %></h2>
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
<%= devise_error_messages! %>
<div><%= f.label :email %><br />
<%= f.email_field :email %></div>
<div><%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
<%= f.password_field :password, :autocomplete => "off" %></div>
<div><%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation %></div>
<div><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
<%= f.password_field :current_password %></div>
<div><%= f.submit "Update" %></div>
<% end %>
<h3>Cancel my account</h3>
<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.</p>
<%= link_to "Back", :back %>

View file

@ -1,18 +0,0 @@
<h2>Sign up</h2>
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
<%= devise_error_messages! %>
<div><%= f.label :email %><br />
<%= f.email_field :email %></div>
<div><%= f.label :password %><br />
<%= f.password_field :password %></div>
<div><%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation %></div>
<div><%= f.submit "Sign up" %></div>
<% end %>
<%= render "links" %>

View file

@ -1,17 +0,0 @@
<h2><%= t("devise.sign_in") %></h2>
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
<div><%= f.label :email %><br />
<%= f.email_field :email %></div>
<div><%= f.label :password %><br />
<%= f.password_field :password %></div>
<% if devise_mapping.rememberable? -%>
<div><%= f.check_box :remember_me %> <%= f.label :remember_me %></div>
<% end -%>
<div><%= f.submit "Sign in" %></div>
<% end %>
<%= render "links" %>

View file

@ -1,12 +0,0 @@
<h2>Resend unlock instructions</h2>
<%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| %>
<%= devise_error_messages! %>
<div><%= f.label :email %><br />
<%= f.email_field :email %></div>
<div><%= f.submit "Resend unlock instructions" %></div>
<% end %>
<%= render "links" %>

View file

@ -1,5 +0,0 @@
<div class="row">
<%= render 'shared/home_slider' %>
</div>
<h2><%= t('activerecord.models.collection.popular') %></h2>
<%= render :partial => 'collections/row_collections' %>

View file

@ -1,13 +0,0 @@
<%# Link to the "First" page
- available local variables
url: url to the first page
current_page: a page object for the currently displayed page
num_pages: total number of pages
per_page: number of items to fetch per page
remote: data-remote
-%>
<% unless current_page.first? %>
<li class="first">
<%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote %>
</li>
<% end %>

View file

@ -1,8 +0,0 @@
<%# Non-link tag that stands for skipped pages...
- available local variables
current_page: a page object for the currently displayed page
num_pages: total number of pages
per_page: number of items to fetch per page
remote: data-remote
-%>
<li class="page gap disabled"><a href="#" onclick="return false;"><%= raw(t 'views.pagination.truncate') %></a></li>

View file

@ -1,13 +0,0 @@
<%# Link to the "Last" page
- available local variables
url: url to the last page
current_page: a page object for the currently displayed page
num_pages: total number of pages
per_page: number of items to fetch per page
remote: data-remote
-%>
<% unless current_page.last? %>
<li class="last next"><%# "next" class present for border styling in twitter bootstrap %>
<%= link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote} %>
</li>
<% end %>

View file

@ -1,13 +0,0 @@
<%# Link to the "Next" page
- available local variables
url: url to the next page
current_page: a page object for the currently displayed page
num_pages: total number of pages
per_page: number of items to fetch per page
remote: data-remote
-%>
<% unless current_page.last? %>
<li class="next_page">
<%= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote %>
</li>
<% end %>

View file

@ -1,12 +0,0 @@
<%# Link showing page number
- available local variables
page: a page object for "this" page
url: url to this page
current_page: a page object for the currently displayed page
num_pages: total number of pages
per_page: number of items to fetch per page
remote: data-remote
-%>
<li class="page<%= ' active' if page.current? %>">
<%= link_to page, url, opts = {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} %>
</li>

View file

@ -1,25 +0,0 @@
<%# The container tag
- available local variables
current_page: a page object for the currently displayed page
num_pages: total number of pages
per_page: number of items to fetch per page
remote: data-remote
paginator: the paginator that renders the pagination tags inside
-%>
<%= paginator.render do -%>
<div class="pagination">
<ul>
<%= first_page_tag unless current_page.first? %>
<%= prev_page_tag unless current_page.first? %>
<% each_page do |page| -%>
<% if page.left_outer? || page.right_outer? || page.inside_window? -%>
<%= page_tag page %>
<% elsif !page.was_truncated? -%>
<%= gap_tag %>
<% end -%>
<% end -%>
<%= next_page_tag unless current_page.last? %>
<%= last_page_tag unless current_page.last? %>
</ul>
</div>
<% end -%>

View file

@ -1,13 +0,0 @@
<%# Link to the "Previous" page
- available local variables
url: url to the previous page
current_page: a page object for the currently displayed page
num_pages: total number of pages
per_page: number of items to fetch per page
remote: data-remote
-%>
<% unless current_page.first? %>
<li class="prev">
<%= link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, :rel => 'prev', :remote => remote %>
</li>
<% end %>

View file

@ -1,7 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<%= render :partial => 'shared/head' %>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><%= ENV['TITLE'] || "Photos" %></title>
<%= yield :head %>
<%= stylesheet_link_tag 'application' %>
</head>
<body>
<div id="container">
@ -15,12 +19,18 @@
<% end %>
</div>
<h1>
<%= link_to(if ENV['LOGO'] then image_tag(ENV['LOGO']) else (ENV['TITLE'] || "Photos") end, root_path) %>
<a href="/">
<% if ENV['LOGO'] %>
<%= image_tag ENV['LOGO'] %>
<% else %>
<%= ENV['TITLE'] %>
<% end %>
</a>
</h1>
<%= form_tag albums_path, { :id => :search } do -%>
<form action="/albums" method="get" id="search">
<input type="text" name="q" class="textfield"/>
<input type="submit" value="Search" class="button" />
<% end -%>
</form>
<hr class="seperator" />
<%= breadcrumbs %>
</div>
@ -33,10 +43,11 @@
<div id="footer">
<hr class="seperator" />
&copy; <a href="http://balderapp.com">Balder - open source photo gallery</a>.
&copy; <a href="http://balderapp.com">Balder</a>.
</div>
</div>
<%= javascript_include_tag 'jquery-1.3.2.js', 'jquery.livequery.js', 'balder' %>
<%= yield :javascript %>
</body>
</html>

View file

@ -0,0 +1,47 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name = "viewport" content = "width = device-width">
<meta name = "viewport" content = "initial-scale = 1.0, user-scalable=no">
<title><%= ENV['TITLE'] %></title>
<%= yield :head %>
<%= stylesheet_link_tag 'application', 'iphone' %>
</head>
<body>
<div id="container">
<div id="header">
<%= breadcrumbs('/',false) %>
<div id="action_links">
<%= yield :action_links %>
<% if current_user %>
Logged in as <%= current_user.name %>
<%= link_to 'Logout', logout_path %>
<% end %>
</div>
<h1>
<% if ENV['LOGO'] %>
<%= image_tag ENV['LOGO'] %>
<% else %>
<%= ENV['TITLE'] %>
<% end %>
</h1>
<hr class="seperator" />
</div>
<div id="content">
<p id="notice"><%= flash[:notice] %></p>
<%= yield %>
</div>
<div id="footer">
</div>
</div>
<%= javascript_include_tag 'jquery-1.3.2.js', 'jquery.livequery.js', 'balder' %>
<%= yield :javascript %>
</body>
</html>

View file

@ -1,22 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<%= render :partial => 'shared/head' %>
</head>
<body>
<%= render :partial => 'shared/nav_bar' %>
<div class="container">
<div class="row">
<div class="span12">
<%= render :partial => 'shared/notifications' %>
<%= render_breadcrumbs %>
<%= yield %>
</div>
</div>
<hr>
<footer>
<p>&copy; Photomix 2012</p>
</footer>
</div>
</body>
</html>

View file

@ -1,5 +1,5 @@
<%= content_for :javascript do %>
<%= javascript_include_tag "tag/tag" -%>
<% content_for :javascript do %>
<script src="/javascripts/tag/tag.js" type="text/javascript" charset="utf-8"></script>
<% end %>
<%= hidden_field_tag :all_tags, @tags %>
<%= form.label :title %><br />
@ -11,4 +11,4 @@
<%= form.label :description %><br />
<%= form.text_area :description %><br />
<br/>
<p>On disk: ~/<%= @photo.attachment.path %></p>
<p>On disk: ~/<%= @photo.path %></p>

View file

@ -1 +1 @@
<%= image_tag photo.attachment.single.url %><br/>
<%= image_tag photo.file.single.url %><br/>

View file

@ -1,22 +0,0 @@
<div class="row">
<div class="span12">
<% @photos.in_groups_of(4).each do |group| %>
<% unless group.empty? %>
<ul class="thumbnails">
<% group.compact.each_with_index do |photo, index| %>
<li class="span3">
<div class="thumbnail">
<%= link_to image_tag(photo.attachment.thumb.url), photo.attachment.largest.url, :class => 'fancybox-thumb', :rel => "fancybox-thumb" %>
<div class="caption">
<h5 class="title"><%= photo.title %></h5>
<em class="descr"><%= photo.description %></em>
<%= ratings_for photo %>
</div>
</div>
</li>
<% end %>
</ul>
<% end %>
<% end %>
</div>
</div>

View file

@ -1 +1 @@
<%= link_to image_tag(eval('photo.attachment.' + (defined?(photosize) ? photosize : "thumb") + '.url')), [photo.album.collections.first, photo.album, photo] %>
<%= link_to (image_tag eval('photo.file.' + (defined?(photosize) ? photosize : "album") + '.url') ), [photo.album.collections.first, photo.album, photo] %>

View file

@ -1,17 +1,15 @@
<h1>Edit Photo</h1>
<%= image_tag @photo.attachment.preview.url %>
<%= image_tag @photo.file.preview.url %>
<%= form_for @photo do |f| %>
<%= hidden_field_tag :collection_id, params[:collection_id] %>
<%= hidden_field_tag :album_id, params[:album_id] %>
<% form_for @photo do |f| %>
<%= f.error_messages %>
<%= render :partial => "form", :object => f %>
<%= f.submit "Update" %>
<% end %>
<%= content_for :action_links do %>
<%= link_to("Delete photo", {:action => "destroy", :id => @photo, :collection_id => params[:collection_id]},
<% content_for :action_links do %>
<%= link_to("Delete photo", { :action => "destroy", :id => @photo },
:confirm => "Are you sure you want to delete this photo?",
:method => :delete) %>
<% end %>

Some files were not shown because too many files have changed in this diff Show more