diff --git a/Capfile b/Capfile new file mode 100644 index 0000000..d04de11 --- /dev/null +++ b/Capfile @@ -0,0 +1,4 @@ +load 'deploy' if respond_to?(:namespace) # cap2 differentiator +Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) } + +load 'config/deploy' # remove this line to skip loading any of the default tasks \ No newline at end of file diff --git a/Gemfile b/Gemfile index d1dded6..0891a8e 100755 --- a/Gemfile +++ b/Gemfile @@ -4,6 +4,9 @@ gem 'rails', '3.0.6' gem 'sqlite3' gem 'paperclip', :git => 'git://github.com/thoughtbot/paperclip.git' gem 'will_paginate', '3.0.pre2' +gem 'devise', '1.1.rc0' +gem 'dynamic_form' +gem 'capistrano' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' diff --git a/Gemfile.lock b/Gemfile.lock index ece07fd..394e42f 100755 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,10 +1,11 @@ GIT remote: git://github.com/thoughtbot/paperclip.git - revision: 93753d5c4da6488cce82e5378997dc3f5478ceff + revision: e703662fd40fe43ec7af76266f1e897e9471a873 specs: paperclip (2.3.10) activerecord (>= 2.3.0) activesupport (>= 2.3.2) + cocaine (>= 0.0.2) GEM remote: http://rubygems.org/ @@ -36,19 +37,37 @@ GEM activemodel (= 3.0.6) activesupport (= 3.0.6) activesupport (3.0.6) - arel (2.0.9) + arel (2.0.10) builder (2.1.2) + capistrano (2.6.0) + highline + net-scp (>= 1.0.0) + net-sftp (>= 2.0.0) + net-ssh (>= 2.0.14) + net-ssh-gateway (>= 1.1.0) + cocaine (0.0.2) + devise (1.1.rc0) + warden (~> 0.10.3) + dynamic_form (1.1.4) erubis (2.6.6) abstract (>= 1.0.0) + highline (1.6.2) i18n (0.5.0) - mail (2.2.15) + mail (2.2.19) activesupport (>= 2.3.6) i18n (>= 0.4.0) mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.16) + net-scp (1.0.4) + net-ssh (>= 1.99.1) + net-sftp (2.0.5) + net-ssh (>= 2.0.9) + net-ssh (2.1.4) + net-ssh-gateway (1.1.0) + net-ssh (>= 1.99.1) polyglot (0.3.1) - rack (1.2.2) + rack (1.2.3) rack-mount (0.6.14) rack (>= 1.0.0) rack-test (0.5.7) @@ -72,7 +91,9 @@ GEM thor (0.14.6) treetop (1.4.9) polyglot (>= 0.3.1) - tzinfo (0.3.26) + tzinfo (0.3.27) + warden (0.10.7) + rack (>= 1.0.0) will_paginate (3.0.pre2) PLATFORMS @@ -80,6 +101,9 @@ PLATFORMS x86-mingw32 DEPENDENCIES + capistrano + devise (= 1.1.rc0) + dynamic_form paperclip! rails (= 3.0.6) sqlite3 diff --git a/app/controllers/._albums_controller.rb b/app/controllers/._albums_controller.rb new file mode 100755 index 0000000..d408fd9 Binary files /dev/null and b/app/controllers/._albums_controller.rb differ diff --git a/app/controllers/._comments_controller.rb b/app/controllers/._comments_controller.rb new file mode 100755 index 0000000..d9faa26 Binary files /dev/null and b/app/controllers/._comments_controller.rb differ diff --git a/app/controllers/._photos_controller.rb b/app/controllers/._photos_controller.rb new file mode 100755 index 0000000..71d11f2 Binary files /dev/null and b/app/controllers/._photos_controller.rb differ diff --git a/app/controllers/albums_controller.rb b/app/controllers/albums_controller.rb index 16a4cab..71c3f24 100755 --- a/app/controllers/albums_controller.rb +++ b/app/controllers/albums_controller.rb @@ -1,8 +1,10 @@ class AlbumsController < ApplicationController + before_filter :authenticate_person! + # GET /albums # GET /albums.xml def index - @albums = Album.paginate(:page => params[:page], :per_page => 8) + @albums = Album.paginate(:page => params[:page], :per_page => 5) respond_to do |format| format.html # index.html.erb @@ -47,7 +49,9 @@ def create format.html { redirect_to(@album, :notice => 'Album was successfully created.') } #format.xml { render :xml => @album, :status => :created, :location => @album } else + #??? format.html { render :action => "new" } + #format.html { redirect_to(new_album_path) } #format.xml { render :xml => @album.errors, :status => :unprocessable_entity } end end diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 07169a8..7077bc9 100755 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -1,4 +1,6 @@ class CommentsController < ApplicationController + before_filter :authenticate_person! + # GET /comments # GET /comments.xml def index diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb new file mode 100755 index 0000000..be172a1 --- /dev/null +++ b/app/controllers/home_controller.rb @@ -0,0 +1,7 @@ +class HomeController < ApplicationController + before_filter :authenticate_person! + + def index + end + +end diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb new file mode 100755 index 0000000..1746f63 --- /dev/null +++ b/app/controllers/people_controller.rb @@ -0,0 +1,83 @@ +class PeopleController < ApplicationController + # GET /people + # GET /people.xml + def index + @people = Person.all + + respond_to do |format| + format.html # index.html.erb + format.xml { render :xml => @people } + end + end + + # GET /people/1 + # GET /people/1.xml + def show + @person = Person.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.xml { render :xml => @person } + end + end + + # GET /people/new + # GET /people/new.xml + def new + @person = Person.new + + respond_to do |format| + format.html # new.html.erb + format.xml { render :xml => @person } + end + end + + # GET /people/1/edit + def edit + @person = Person.find(params[:id]) + end + + # POST /people + # POST /people.xml + def create + @person = Person.new(params[:person]) + + respond_to do |format| + if @person.save + format.html { redirect_to(@person, :notice => 'Person was successfully created.') } + format.xml { render :xml => @person, :status => :created, :location => @person } + else + format.html { render :action => "new" } + format.xml { render :xml => @person.errors, :status => :unprocessable_entity } + end + end + end + + # PUT /people/1 + # PUT /people/1.xml + def update + @person = Person.find(params[:id]) + + respond_to do |format| + if @person.update_attributes(params[:person]) + format.html { redirect_to(@person, :notice => 'Person was successfully updated.') } + format.xml { head :ok } + else + format.html { render :action => "edit" } + format.xml { render :xml => @person.errors, :status => :unprocessable_entity } + end + end + end + + # DELETE /people/1 + # DELETE /people/1.xml + def destroy + @person = Person.find(params[:id]) + @person.destroy + + respond_to do |format| + format.html { redirect_to(people_url) } + format.xml { head :ok } + end + end +end diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb index 9216f32..89b0c7e 100755 --- a/app/controllers/photos_controller.rb +++ b/app/controllers/photos_controller.rb @@ -1,4 +1,6 @@ class PhotosController < ApplicationController + before_filter :authenticate_person! + # GET /photos # GET /photos.xml def index diff --git a/app/controllers/sperrens_controller.rb b/app/controllers/sperrens_controller.rb new file mode 100755 index 0000000..eb2dca0 --- /dev/null +++ b/app/controllers/sperrens_controller.rb @@ -0,0 +1,83 @@ +class SperrensController < ApplicationController + # GET /sperrens + # GET /sperrens.xml + def index + @sperrens = Sperren.all + + respond_to do |format| + format.html # index.html.erb + format.xml { render :xml => @sperrens } + end + end + + # GET /sperrens/1 + # GET /sperrens/1.xml + def show + @sperren = Sperren.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.xml { render :xml => @sperren } + end + end + + # GET /sperrens/new + # GET /sperrens/new.xml + def new + @sperren = Sperren.new + + respond_to do |format| + format.html # new.html.erb + format.xml { render :xml => @sperren } + end + end + + # GET /sperrens/1/edit + def edit + @sperren = Sperren.find(params[:id]) + end + + # POST /sperrens + # POST /sperrens.xml + def create + @sperren = Sperren.new(params[:sperren]) + + respond_to do |format| + if @sperren.save + format.html { redirect_to(@sperren, :notice => 'Sperren was successfully created.') } + format.xml { render :xml => @sperren, :status => :created, :location => @sperren } + else + format.html { render :action => "new" } + format.xml { render :xml => @sperren.errors, :status => :unprocessable_entity } + end + end + end + + # PUT /sperrens/1 + # PUT /sperrens/1.xml + def update + @sperren = Sperren.find(params[:id]) + + respond_to do |format| + if @sperren.update_attributes(params[:sperren]) + format.html { redirect_to(@sperren, :notice => 'Sperren was successfully updated.') } + format.xml { head :ok } + else + format.html { render :action => "edit" } + format.xml { render :xml => @sperren.errors, :status => :unprocessable_entity } + end + end + end + + # DELETE /sperrens/1 + # DELETE /sperrens/1.xml + def destroy + @sperren = Sperren.find(params[:id]) + @sperren.destroy + + respond_to do |format| + format.html { redirect_to(sperrens_url) } + format.xml { head :ok } + end + end +end diff --git a/app/helpers/home_helper.rb b/app/helpers/home_helper.rb new file mode 100755 index 0000000..23de56a --- /dev/null +++ b/app/helpers/home_helper.rb @@ -0,0 +1,2 @@ +module HomeHelper +end diff --git a/app/helpers/people_helper.rb b/app/helpers/people_helper.rb new file mode 100755 index 0000000..b682fbf --- /dev/null +++ b/app/helpers/people_helper.rb @@ -0,0 +1,2 @@ +module PeopleHelper +end diff --git a/app/helpers/sperrens_helper.rb b/app/helpers/sperrens_helper.rb new file mode 100755 index 0000000..46b6c54 --- /dev/null +++ b/app/helpers/sperrens_helper.rb @@ -0,0 +1,2 @@ +module SperrensHelper +end diff --git a/app/models/._album.rb b/app/models/._album.rb new file mode 100755 index 0000000..009cf5c Binary files /dev/null and b/app/models/._album.rb differ diff --git a/app/models/._comment.rb b/app/models/._comment.rb new file mode 100755 index 0000000..0ff7af0 Binary files /dev/null and b/app/models/._comment.rb differ diff --git a/app/models/._photo.rb b/app/models/._photo.rb new file mode 100755 index 0000000..bd43ec4 Binary files /dev/null and b/app/models/._photo.rb differ diff --git a/app/models/person.rb b/app/models/person.rb new file mode 100755 index 0000000..1a318fd --- /dev/null +++ b/app/models/person.rb @@ -0,0 +1,21 @@ +class EmailValidator < ActiveModel::EachValidator + def validate_each(record, attribute, value) + record.errors[attribute] << (options[:message] || "is not an email") unless + value =~ /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i + end +end + +class Person < ActiveRecord::Base + # Include default devise modules. Others available are: + # :token_authenticatable, :lockable, :timeoutable, :confirmable and :activatable + devise :database_authenticatable, :registerable, + :recoverable, :rememberable, :trackable, :validatable + + # Setup accessible (or protected) attributes for your model + attr_accessible :username, :email, :password, :password_confirmation, :domain + validates :username, :presence => true, :uniqueness => true + validates :password, :presence => true + validates :email, :presence => true, :email => true + validates :domain, :presence => true + belongs_to :picture +end diff --git a/app/models/photo.rb b/app/models/photo.rb index 39a43e3..755f3ce 100755 --- a/app/models/photo.rb +++ b/app/models/photo.rb @@ -1,6 +1,6 @@ class Photo < ActiveRecord::Base # add file as property - has_attached_file :image, :styles => { :thumb => "100x100" } + has_attached_file :image, :styles => { :thumb => "130x130", :medium => "360x360" } # protect some of attributes of file attr_protected :image_file_name, :image_content_type, :image_size @@ -23,6 +23,11 @@ class Photo < ActiveRecord::Base # ... has_many :photos belongs_to :comment + # 1:n relation between 'comment' and 'user' + # add this line in model 'user': + # ... has_many :photos + belongs_to :owner + # 1:n relation between 'comment' and 'photo' # add this line in model 'comment': # ... belongs_to :photo diff --git a/app/models/sperren.rb b/app/models/sperren.rb new file mode 100755 index 0000000..9e9685d --- /dev/null +++ b/app/models/sperren.rb @@ -0,0 +1,7 @@ +class Sperren < ActiveRecord::Base + validates :startDate, :presence => true + validates :endDate, :presence => true + validates :reason, :presence => true + + belongs_to :person +end diff --git a/app/views/albums/.__form.html.erb b/app/views/albums/.__form.html.erb new file mode 100755 index 0000000..55684ff Binary files /dev/null and b/app/views/albums/.__form.html.erb differ diff --git a/app/views/albums/.__form_fake.html.erb b/app/views/albums/.__form_fake.html.erb new file mode 100755 index 0000000..a398494 Binary files /dev/null and b/app/views/albums/.__form_fake.html.erb differ diff --git a/app/views/albums/._edit.html.erb b/app/views/albums/._edit.html.erb new file mode 100755 index 0000000..81f5b01 Binary files /dev/null and b/app/views/albums/._edit.html.erb differ diff --git a/app/views/albums/._index.html.erb b/app/views/albums/._index.html.erb new file mode 100755 index 0000000..6cc3476 Binary files /dev/null and b/app/views/albums/._index.html.erb differ diff --git a/app/views/albums/._show.html.erb b/app/views/albums/._show.html.erb new file mode 100755 index 0000000..0ae3903 Binary files /dev/null and b/app/views/albums/._show.html.erb differ diff --git a/app/views/albums/_form.html.erb b/app/views/albums/_form.html.erb index 43fd8c8..ec7c32a 100755 --- a/app/views/albums/_form.html.erb +++ b/app/views/albums/_form.html.erb @@ -1,38 +1,22 @@ <%= form_for(@album) do |f| %> - <% if @album.errors.any? %> -
-

<%= pluralize(@album.errors.count, "error") %> prohibited this album from being saved:

- - -
- <% end %> - - - - - -
- -
- <%= f.label :title %>
- <%= f.text_field :title %> -
- -
- <%= f.label :description %>
- <%= f.text_area :description %> -
- -
- -
- <%= f.submit %> -
- -
- +
+
<%= f.label :title, "Titel" %>*
+ <%= f.text_field :title, :class => "text_field" %> +
<%= f.label :description, "Beschreibung" %>
+ <%= f.text_area :description, :class => "text_area" %> +
+ Mit * gekennzeichnete Felder sind Pflichtangaben +
+
+<% if @album.errors.any? %> +
+ + <% @album.errors.full_messages.each do |msg| %> + <%= msg %>
+ <% end %> +
+
+<% end %> <% end %> + + diff --git a/app/views/albums/_form_fake.html.erb b/app/views/albums/_form_fake.html.erb new file mode 100755 index 0000000..b9c278d --- /dev/null +++ b/app/views/albums/_form_fake.html.erb @@ -0,0 +1,15 @@ +
+
<%= "Titel" %>
+
<%= @album.title %>
+
<%= "Beschreibung" %>
+
<%= @album.description %>
+
+<% if notice %> +
+ + <%= notice %>
+
+
+<% end %> + + diff --git a/app/views/albums/edit.html.erb b/app/views/albums/edit.html.erb index 028f6ac..f439fde 100755 --- a/app/views/albums/edit.html.erb +++ b/app/views/albums/edit.html.erb @@ -1,5 +1,16 @@ -

Editing album #<%= @album.id %>

- -

<%= link_to 'Back', albums_path %>

- -<%= render 'form' %> +
+
+ Album #<%= @album.id %> ändern +
+
+
+ <%= link_to_function 'Speichern', ["edit_album_", @album.id, ".submit()"], :class => "link_white" %> +
+
+ <%= link_to 'Zurück', albums_path, :class => "link_white" %> +
+
+
+
+ <%= render 'form' %> +
diff --git a/app/views/albums/index.html.erb b/app/views/albums/index.html.erb index aa11b9d..2808089 100755 --- a/app/views/albums/index.html.erb +++ b/app/views/albums/index.html.erb @@ -1,48 +1,49 @@ -

Listing albums

- -

<%= link_to 'New Album', new_album_path %>

- -

<%= will_paginate %>

- - - <% i = 0 %> - <% @albums.each do |album| %> - <% if i%4 == 0 %> - - <% end %> - - <% if i%4 == 3 %> - - <% end %> - <% i = i+1 %> - <% end %> -
- - - - - - - - - - - - - - - - -
- <%= album.title %> (<%= album.number_of_photos %>) -
- -
- <%= album.description %>
- <%= album.created_at_date %> -
- <%= link_to 'Show', album_photos_url(album) %>  - <%= link_to 'Edit', edit_album_path(album) %>  - <%= link_to 'Destroy', album, :confirm => 'Are you sure?', :method => :delete %> -
-
+
+
+ Alben auflisten +
<%= current_person.username %>: <%= current_person.id %> +
+
+
+ <%= link_to 'Album hinzufügen', new_album_path, :class => "link_white" %> +
+ <% if @albums.total_pages > 1 %> +
+ <%= will_paginate @albums %> +
+ <% end %> +
+
+
+
+ <% @albums.each do |album| %> +
+ <%= link_to album_photos_url(album) do %> +
+ +
+ <% end %> + <% if album.number_of_photos > 0 %> +
+ <%= album.number_of_photos %> +
+ <% end %> +
+ <%= album.title %> +
+ +
+ <% end %> +
+ <% if Album.count < 1 %> +
+ + Es wurden keine Alben gefunden + +
+ <% end %> +
diff --git a/app/views/albums/new.html.erb b/app/views/albums/new.html.erb index 103abc0..22757a8 100755 --- a/app/views/albums/new.html.erb +++ b/app/views/albums/new.html.erb @@ -1,5 +1,16 @@ -

New album

- -

<%= link_to 'Back', albums_path %>

- -<%= render 'form' %> +
+
+ Album hinzufügen +
+
+
+ <%= link_to_function 'Speichern', "new_album.submit()", :class => "link_white" %> +
+
+ <%= link_to 'Zurück', albums_path, :class => "link_white" %> +
+
+
+
+ <%= render 'form' %> +
diff --git a/app/views/albums/show.html.erb b/app/views/albums/show.html.erb index 351e223..ad66810 100755 --- a/app/views/albums/show.html.erb +++ b/app/views/albums/show.html.erb @@ -1,23 +1,15 @@ -

<%= notice %>

+
+
+ Album #<%= @album.id %> anzeigen +
+
+
+ <%= link_to 'Zurück', albums_path, :class => "link_white" %> +
+
+
+
+ <%= render 'form_fake' %> +
-

Showing album #<%= @album.id %>

-

<%= link_to 'Back', albums_path %>

- - - - - -
- -

- Title: - <%= @album.title %> -

- -

- Description: - <%= @album.description %> -

- -
diff --git a/app/views/comments/.__form.html.erb b/app/views/comments/.__form.html.erb new file mode 100755 index 0000000..3305205 Binary files /dev/null and b/app/views/comments/.__form.html.erb differ diff --git a/app/views/comments/._edit.html.erb b/app/views/comments/._edit.html.erb new file mode 100755 index 0000000..c3a5a22 Binary files /dev/null and b/app/views/comments/._edit.html.erb differ diff --git a/app/views/comments/._new.html.erb b/app/views/comments/._new.html.erb new file mode 100755 index 0000000..b9e86ea Binary files /dev/null and b/app/views/comments/._new.html.erb differ diff --git a/app/views/devise/confirmations/new.html.erb b/app/views/devise/confirmations/new.html.erb new file mode 100755 index 0000000..8ce5cc0 --- /dev/null +++ b/app/views/devise/confirmations/new.html.erb @@ -0,0 +1,12 @@ +

Resend confirmation instructions

+ +<%= form_for(resource_name, resource, :url => confirmation_path(resource_name)) do |f| %> + <%= f.error_messages %> + +

<%= f.label :email %>

+

<%= f.text_field :email %>

+ +

<%= f.submit "Resend confirmation instructions" %>

+<% end %> + +<%= render :partial => "devise/shared/links" %> \ No newline at end of file diff --git a/app/views/devise/mailer/confirmation_instructions.html.erb b/app/views/devise/mailer/confirmation_instructions.html.erb new file mode 100755 index 0000000..a6ea8ca --- /dev/null +++ b/app/views/devise/mailer/confirmation_instructions.html.erb @@ -0,0 +1,5 @@ +

Welcome <%= @resource.email %>!

+ +

You can confirm your account through the link below:

+ +

<%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %>

diff --git a/app/views/devise/mailer/reset_password_instructions.html.erb b/app/views/devise/mailer/reset_password_instructions.html.erb new file mode 100755 index 0000000..ae9e888 --- /dev/null +++ b/app/views/devise/mailer/reset_password_instructions.html.erb @@ -0,0 +1,8 @@ +

Hello <%= @resource.email %>!

+ +

Someone has requested a link to change your password, and you can do this through the link below.

+ +

<%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %>

+ +

If you didn't request this, please ignore this email.

+

Your password won't change until you access the link above and create a new one.

diff --git a/app/views/devise/mailer/unlock_instructions.html.erb b/app/views/devise/mailer/unlock_instructions.html.erb new file mode 100755 index 0000000..2263c21 --- /dev/null +++ b/app/views/devise/mailer/unlock_instructions.html.erb @@ -0,0 +1,7 @@ +

Hello <%= @resource.email %>!

+ +

Your account has been locked due to an excessive amount of unsuccessful sign in attempts.

+ +

Click the link below to unlock your account:

+ +

<%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %>

diff --git a/app/views/devise/passwords/.__form.html.erb b/app/views/devise/passwords/.__form.html.erb new file mode 100755 index 0000000..73a0ce3 Binary files /dev/null and b/app/views/devise/passwords/.__form.html.erb differ diff --git a/app/views/devise/passwords/_form.html.erb b/app/views/devise/passwords/_form.html.erb new file mode 100755 index 0000000..2ac4a98 --- /dev/null +++ b/app/views/devise/passwords/_form.html.erb @@ -0,0 +1,18 @@ +<%= form_for(resource_name, resource, :url => password_path(resource_name), :html => { :id => "forgot" }) do |f| %> +
+
<%= f.label :email, "Email" %>*
+ <%= f.text_field :email, :class => "text_field" %> +
+ Mit * gekennzeichnete Felder sind Pflichtangaben +
+
+<% if @person.errors.any? %> +
+ + <% @person.errors.full_messages.each do |msg| %> + <%= msg %>
+ <% end %> +
+
+<% end %> +<% end %> diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb new file mode 100755 index 0000000..82858b4 --- /dev/null +++ b/app/views/devise/passwords/edit.html.erb @@ -0,0 +1,16 @@ +

Change your password

+ +<%= form_for(resource_name, resource, :url => password_path(resource_name), :html => { :method => :put }) do |f| %> + <%= f.error_messages %> + <%= f.hidden_field :reset_password_token %> + +

<%= f.label :password %>

+

<%= f.password_field :password %>

+ +

<%= f.label :password_confirmation %>

+

<%= f.password_field :password_confirmation %>

+ +

<%= f.submit "Change my password" %>

+<% end %> + +<%= render :partial => "devise/shared/links" %> \ No newline at end of file diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb new file mode 100755 index 0000000..57fd2ad --- /dev/null +++ b/app/views/devise/passwords/new.html.erb @@ -0,0 +1,16 @@ +
+
+ Passwort vergessen? +
+
+
+ <%= link_to_function 'Abschicken', "forgot.submit()", :class => "link_white" %> +
+
+ <%= link_to 'Zurück', new_session_path(resource_name), :class => "link_white" %> +
+
+
+
+ <%= render 'form' %> +
diff --git a/app/views/devise/registrations/.__form.html.erb b/app/views/devise/registrations/.__form.html.erb new file mode 100755 index 0000000..f9b2c94 Binary files /dev/null and b/app/views/devise/registrations/.__form.html.erb differ diff --git a/app/views/devise/registrations/_form.html.erb b/app/views/devise/registrations/_form.html.erb new file mode 100755 index 0000000..73e8c97 --- /dev/null +++ b/app/views/devise/registrations/_form.html.erb @@ -0,0 +1,32 @@ +<%= form_for(resource_name, resource, :url => registration_path(resource_name), :html => { :id => "register" }) do |f| %> +
+
<%= f.label :username, "Benutzer" %>*
+ <%= f.text_field :username, :class => "text_field" %> +
<%= f.label :email, "Email" %>*
+ <%= f.text_field :email, :class => "text_field" %> +
<%= f.label :password, "Password" %>*
+ <%= f.password_field :password, :class => "text_field" %> +
<%= f.label :password_confirmation, "Password bestätigen" %>*
+ <%= f.password_field :password_confirmation, :class => "text_field" %> +
<%= f.label :domain, "Bereich" %>*
+ <%= f.text_field :domain, :class => "text_field" %> +
+ Mit * gekennzeichnete Felder sind Pflichtangaben +
+
+
+
<%= f.label :firstName, "Vorname" %>
+ <%= f.text_field :firstName, :class => "text_field" %> +
<%= f.label :lastName, "Nachname" %>
+ <%= f.text_field :lastName, :class => "text_field" %> +
+<% if @person.errors.any? %> +
+ + <% @person.errors.full_messages.each do |msg| %> + <%= msg %>
+ <% end %> +
+
+<% end %> +<% end %> diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb new file mode 100755 index 0000000..7a6952d --- /dev/null +++ b/app/views/devise/registrations/edit.html.erb @@ -0,0 +1,37 @@ +

Edit <%= resource_name.to_s.humanize %>

+ +<%= form_for(resource_name, resource, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %> + <%= f.error_messages %> + +

<%= f.label :username %>
+ <%= f.text_field :username %>

+ +

<%= f.label :email %>
+ <%= f.text_field :email %>

+ +

<%= f.label :password %> (leave blank if you don't want to change it)
+ <%= f.password_field :password %>

+ +

<%= f.label :password_confirmation %>
+ <%= f.password_field :password_confirmation %>

+ +

<%= f.label :current_password %> (we need your current password to confirm your changes)
+ <%= f.password_field :current_password %>

+ +

<%= f.label :domain %>
+ <%= f.text_field :domain %>

+ +

<%= f.label :lastName %>
+ <%= f.text_field :lastName %>

+ +

<%= f.label :firstName %>
+ <%= f.text_field :firstName %>

+ +

<%= f.submit "Update" %>

+<% end %> + +

Cancel my account

+ +

Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.

+ +<%= link_to "Back", :back %> diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb new file mode 100755 index 0000000..2542e85 --- /dev/null +++ b/app/views/devise/registrations/new.html.erb @@ -0,0 +1,16 @@ +
+
+ Registrieren +
+
+
+ <%= link_to_function 'Registrieren', "register.submit()", :class => "link_white" %> +
+
+ <%= link_to 'Zurück', new_session_path(resource_name), :class => "link_white" %> +
+
+
+
+ <%= render 'form' %> +
diff --git a/app/views/devise/sessions/.__form.html.erb b/app/views/devise/sessions/.__form.html.erb new file mode 100755 index 0000000..803c32d Binary files /dev/null and b/app/views/devise/sessions/.__form.html.erb differ diff --git a/app/views/devise/sessions/_form.html.erb b/app/views/devise/sessions/_form.html.erb new file mode 100755 index 0000000..913d2de --- /dev/null +++ b/app/views/devise/sessions/_form.html.erb @@ -0,0 +1,23 @@ +<%= form_for(resource_name, resource, :url => session_path(resource_name), :html => { :id => "login" }) do |f| %> +
+
<%= f.label :username, "Benutzer" %>*
+ <%= f.text_field :username, :class => "text_field" %> +
<%= f.label :password, "Passwort" %>*
+ <%= f.password_field :password, :class => "text_field" %> + <% if devise_mapping.rememberable? -%> +
<%= f.check_box :remember_me %> <%= f.label :remember_me , "Eingelogt bleiben" %>
+ <% end -%> +
+ Mit * gekennzeichnete Felder sind Pflichtangaben +
+
+<% if @person.errors.any? %> +
+ + <% @person.errors.full_messages.each do |msg| %> + <%= msg %>
+ <% end %> +
+
+<% end %> +<% end %> diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb new file mode 100755 index 0000000..5a077f9 --- /dev/null +++ b/app/views/devise/sessions/new.html.erb @@ -0,0 +1,19 @@ +
+
+ Anmelden +
+
+
+ <%= link_to_function 'Anmelden', "login.submit()", :class => "link_white" %> +
+
+ <%= link_to 'Registrieren', new_registration_path(resource_name), :class => "link_white" %> +
+
+ <%= link_to 'Passwort vergessen', new_password_path(resource_name), :class => "link_white" %> +
+
+
+
+ <%= render 'form' %> +
diff --git a/app/views/devise/shared/_links.erb b/app/views/devise/shared/_links.erb new file mode 100755 index 0000000..a843470 --- /dev/null +++ b/app/views/devise/shared/_links.erb @@ -0,0 +1,19 @@ +<%- if controller_name != 'sessions' %> + <%= link_to "Sign in", new_session_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.registerable? && controller_name != 'registrations' %> + <%= link_to "Registrieren", new_registration_path(resource_name) %> +<% end -%> + +<%- if devise_mapping.recoverable? && controller_name != 'passwords' %> + <%= link_to "Passwort vergessen?", new_password_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> + <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.lockable? && controller_name != 'unlocks' %> + <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>
+<% end -%> diff --git a/app/views/devise/unlocks/new.html.erb b/app/views/devise/unlocks/new.html.erb new file mode 100755 index 0000000..401bfa8 --- /dev/null +++ b/app/views/devise/unlocks/new.html.erb @@ -0,0 +1,12 @@ +

Resend unlock instructions

+ +<%= form_for(resource_name, resource, :url => unlock_path(resource_name)) do |f| %> + <%= f.error_messages %> + +

<%= f.label :email %>

+

<%= f.text_field :email %>

+ +

<%= f.submit "Resend unlock instructions" %>

+<% end %> + +<%= render :partial => "devise/shared/links" %> \ No newline at end of file diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb new file mode 100755 index 0000000..76b00c8 --- /dev/null +++ b/app/views/home/index.html.erb @@ -0,0 +1,11 @@ +
+ <% if person_signed_in? %> + <%= link_to "Sign out", destroy_person_session_path %>
+

Hallo <%= current_person.username %>

+ <% else %> + <%= link_to "sign in", new_person_session_path %> or <%= link_to "Sign up", new_person_registration_path %> + <% end %> +
+ + + diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 1482360..38c0d32 100755 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,14 +1,34 @@ - - Photosharing - <%= stylesheet_link_tag :all %> - <%= javascript_include_tag :defaults %> - <%= csrf_meta_tag %> - - - -<%= yield %> - - + + Photosharing + <%= stylesheet_link_tag :all %> + <%= javascript_include_tag :defaults %> + <%= csrf_meta_tag %> + + +
+
+ <% if person_signed_in? %> + Herzlich Willkommen <%= current_person.username %> Profil | <%= link_to "Abmelden", destroy_person_session_path, :class => "link_white" %> + <% end %> +
+
+
+
+ +
+
+ <%= yield %> +
+
+ +
+
+
+
+ Arthur Helmel, Bastian Landherr, Kevin Virmani. Entwickelt für die Vorlesung Softwareengineering II. Alle Rechte vorbehalten. +
+
+ diff --git a/app/views/people/_form.html.erb b/app/views/people/_form.html.erb new file mode 100755 index 0000000..0affd9b --- /dev/null +++ b/app/views/people/_form.html.erb @@ -0,0 +1,61 @@ +<%= form_for(@person) do |f| %> + <% if @person.errors.any? %> +
+

<%= pluralize(@person.errors.count, "error") %> prohibited this person from being saved:

+ + +
+ <% end %> + +
+ <%= f.label :username %>
+ <%= f.text_field :username %> +
+
+ <%= f.label :password %>
+ <%= f.text_field :password %> +
+
+ <%= f.label :email %>
+ <%= f.text_field :email %> +
+
+ <%= f.label :domain %>
+ <%= f.text_field :domain %> +
+
+ <%= f.label :typ %>
+ <%= f.text_field :typ %> +
+
+ <%= f.label :lastName %>
+ <%= f.text_field :lastName %> +
+
+ <%= f.label :firstName %>
+ <%= f.text_field :firstName %> +
+
+ <%= f.label :status %>
+ <%= f.check_box :status %> +
+
+ <%= f.label :blockedTo %>
+ <%= f.date_select :blockedTo %> +
+
+ <%= f.label :signatur %>
+ <%= f.text_area :signatur %> +
+
+ <%= f.label :picture %>
+ <%= f.text_field :picture %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/people/edit.html.erb b/app/views/people/edit.html.erb new file mode 100755 index 0000000..4d91b25 --- /dev/null +++ b/app/views/people/edit.html.erb @@ -0,0 +1,6 @@ +

Editing person

+ +<%= render 'form' %> + +<%= link_to 'Show', @person %> | +<%= link_to 'Back', people_path %> diff --git a/app/views/people/index.html.erb b/app/views/people/index.html.erb new file mode 100755 index 0000000..fbe29a1 --- /dev/null +++ b/app/views/people/index.html.erb @@ -0,0 +1,43 @@ +

Listing people

+ + + + + + + + + + + + + + + + + + + +<% @people.each do |person| %> + + + + + + + + + + + + + + + + +<% end %> +
UsernamePasswordEmailDomainTypLastnameFirstnameStatusBlockedtoSignaturPicture
<%= person.username %><%= person.password %><%= person.email %><%= person.domain %><%= person.typ %><%= person.lastName %><%= person.firstName %><%= person.status %><%= person.blockedTo %><%= person.signatur %><%= person.picture %><%= link_to 'Show', person %><%= link_to 'Edit', edit_person_path(person) %><%= link_to 'Destroy', person, :confirm => 'Are you sure?', :method => :delete %>
+ +
+ +<%= link_to 'New Person', new_person_path %> diff --git a/app/views/people/new.html.erb b/app/views/people/new.html.erb new file mode 100755 index 0000000..3618249 --- /dev/null +++ b/app/views/people/new.html.erb @@ -0,0 +1,5 @@ +

New person

+ +<%= render 'form' %> + +<%= link_to 'Back', people_path %> diff --git a/app/views/people/show.html.erb b/app/views/people/show.html.erb new file mode 100755 index 0000000..785a05d --- /dev/null +++ b/app/views/people/show.html.erb @@ -0,0 +1,60 @@ +

<%= notice %>

+ +

+ Username: + <%= @person.username %> +

+ +

+ Password: + <%= @person.password %> +

+ +

+ Email: + <%= @person.email %> +

+ +

+ Domain: + <%= @person.domain %> +

+ +

+ Typ: + <%= @person.typ %> +

+ +

+ Lastname: + <%= @person.lastName %> +

+ +

+ Firstname: + <%= @person.firstName %> +

+ +

+ Status: + <%= @person.status %> +

+ +

+ Blockedto: + <%= @person.blockedTo %> +

+ +

+ Signatur: + <%= @person.signatur %> +

+ +

+ Picture: + <%= @person.picture %> +

+ + +<%= link_to 'Edit', edit_person_path(@person) %> | +<%= link_to 'Back', people_path %> diff --git a/app/views/photos/.__form.html.erb b/app/views/photos/.__form.html.erb new file mode 100755 index 0000000..5a9e890 Binary files /dev/null and b/app/views/photos/.__form.html.erb differ diff --git a/app/views/photos/.__form_fake.html.erb b/app/views/photos/.__form_fake.html.erb new file mode 100755 index 0000000..c54b712 Binary files /dev/null and b/app/views/photos/.__form_fake.html.erb differ diff --git a/app/views/photos/._edit.html.erb b/app/views/photos/._edit.html.erb new file mode 100755 index 0000000..8efac38 Binary files /dev/null and b/app/views/photos/._edit.html.erb differ diff --git a/app/views/photos/._expand.html.erb b/app/views/photos/._expand.html.erb new file mode 100755 index 0000000..44c5ff7 Binary files /dev/null and b/app/views/photos/._expand.html.erb differ diff --git a/app/views/photos/._index.html.erb b/app/views/photos/._index.html.erb new file mode 100755 index 0000000..c073e45 Binary files /dev/null and b/app/views/photos/._index.html.erb differ diff --git a/app/views/photos/._new.html.erb b/app/views/photos/._new.html.erb new file mode 100755 index 0000000..cb8c1ff Binary files /dev/null and b/app/views/photos/._new.html.erb differ diff --git a/app/views/photos/._show.html.erb b/app/views/photos/._show.html.erb new file mode 100755 index 0000000..3271112 Binary files /dev/null and b/app/views/photos/._show.html.erb differ diff --git a/app/views/photos/_form.html.erb b/app/views/photos/_form.html.erb index 460d5e3..23fe07a 100755 --- a/app/views/photos/_form.html.erb +++ b/app/views/photos/_form.html.erb @@ -1,4 +1,37 @@ <%= form_for [@album, @photo], :html => { :multipart => true } do |f| %> +
+
<%= f.label :title, "Titel" %>*
+ <%= f.text_field :title, :class => "text_field" %> +
<%= f.label :image, "Bild" %>*
+ <%= f.file_field :image, :class => "file_field" %> +
+ Mit * gekennzeichnete Felder sind Pflichtangaben +
+
+<% if @photo.errors.any? %> +
+ + <% @photo.errors.full_messages.each do |msg| %> + <%= msg %>
+ <% end %> +
+
+<% end %> +<% end %> + + + + + + + + + + + + + diff --git a/app/views/photos/_form_fake.html.erb b/app/views/photos/_form_fake.html.erb new file mode 100755 index 0000000..58f85ae --- /dev/null +++ b/app/views/photos/_form_fake.html.erb @@ -0,0 +1,14 @@ +
+
<%= "Titel" %>
+
<%= @photo.title %>
+ +
<%= "Bild" %>
+
<%= image_tag @photo.image.url(:medium) %>
+
+<% if notice %> +
+ + <%= notice %>
+
+
+<% end %> diff --git a/app/views/photos/edit.html.erb b/app/views/photos/edit.html.erb index e426c41..031e424 100755 --- a/app/views/photos/edit.html.erb +++ b/app/views/photos/edit.html.erb @@ -1,5 +1,16 @@ -

Editing photo #<%= @photo.id %>

- -

<%= link_to 'Back', album_photos_path(@album) %>

- -<%= render 'form' %> \ No newline at end of file +
+
+ Foto #<%= @photo.id %> ändern +
+
+
+ <%= link_to_function 'Speichern', ["edit_photo_", @photo.id, ".submit()"], :class => "link_white" %> +
+
+ <%= link_to 'Zurück', album_photos_path(@album), :class => "link_white" %> +
+
+
+
+ <%= render 'form' %> +
diff --git a/app/views/photos/expand.html.erb b/app/views/photos/expand.html.erb new file mode 100755 index 0000000..b1170d8 --- /dev/null +++ b/app/views/photos/expand.html.erb @@ -0,0 +1,36 @@ +
+
+ Foto #<%= @photo.id %> anzeigen +
+
+
+ <%= link_to 'Kommentar hinzufügen', new_photo_comment_path(@photo), :class => "link_white" %> +
+
+ <%= link_to 'Zurück', album_photos_path(@album), :class => "link_white" %> +
+
+
+
+ <%= render 'form_fake' %> +
+ + diff --git a/app/views/photos/index.html.erb b/app/views/photos/index.html.erb index e7cd91e..5ce1beb 100755 --- a/app/views/photos/index.html.erb +++ b/app/views/photos/index.html.erb @@ -1,52 +1,49 @@ -

Listing photos of album #<%= @album.id %>

- -

- <%= link_to 'Back', albums_path %> | - <%= link_to 'New Photo', new_album_photo_path(@album) %> -

- -

<%= will_paginate %>

- - - <% i = 0 %> - <% @photos.each do |photo| %> - <% if i%4 == 0 %> - - <% end %> - - <% if i%4 == 3 %> - - <% end %> - <% i = i+1 %> - <% end %> -
- - - - - - - - - - - - - - - - - - -
- <%= photo.title %> (<%= photo.number_of_comments %>) -
- <%= image_tag photo.image.url(:thumb) %> -
- <%= photo.created_at_date %> -
- <%= link_to 'Show', album_photo_path(@album, photo) %>  - <%= link_to 'Edit', edit_album_photo_path(@album, photo) %>  - <%= link_to 'Destroy', [@album, photo], :confirm => 'Are you sure?', :method => :delete %> -
-
+
+
+ Fotos im Album #<%= @album.id %> +
+
+
+ <%= link_to 'Foto hinzufügen', new_album_photo_path(@album), :class => "link_white" %> +
+
+ <%= link_to 'Zurück', albums_path, :class => "link_white" %> +
+ <% if @photos.total_pages > 1 %> +
+ <%= will_paginate @photos %> +
+ <% end %> +
+
+
+
+ <% @photos.each do |photo| %> +
+ <%= link_to album_photo_path(@album, photo) do %> +
+ <%= image_tag photo.image.url(:thumb) %> +
+ <% end %> + <% if photo.number_of_comments > 0 %> +
+ <%= photo.number_of_comments %> +
+ <% end %> +
+ <%= photo.title %> +
+ +
+ <% end %> +
+ <% if @photos.count < 1 %> +
+ + Es wurden keine Fotos gefunden + +
+ <% end %> +
diff --git a/app/views/photos/new.html.erb b/app/views/photos/new.html.erb index a654b64..a0cf48f 100755 --- a/app/views/photos/new.html.erb +++ b/app/views/photos/new.html.erb @@ -1,5 +1,16 @@ -

New photo in album #<%= @album.id %>

- -

<%= link_to 'Back', album_photos_path(@album) %>

- -<%= render 'form' %> \ No newline at end of file +
+
+ Foto hinzufügen +
+
+
+ <%= link_to_function 'Speichern', "new_photo.submit()", :class => "link_white" %> +
+
+ <%= link_to 'Zurück', album_photos_path(@album), :class => "link_white" %> +
+
+
+
+ <%= render 'form' %> +
diff --git a/app/views/photos/show.html.erb b/app/views/photos/show.html.erb index 0d6166e..e2b5b6c 100755 --- a/app/views/photos/show.html.erb +++ b/app/views/photos/show.html.erb @@ -1,46 +1,13 @@ -

<%= notice %>

- -

Showing photo #<%= @photo.id %>

- -

- <%= link_to 'Back', album_photos_path(@album) %> | - <%= link_to 'New Comment', new_photo_comment_path(@photo) %> -

- - - - - -
- -

- Title: - <%= @photo.title %> -

- -

- Image: - <%= image_tag @photo.image.url %> -

- -
- -
- -<% if @photo.comments.count > 0 %> -

Comments

-<% end %> - - - <% @photo.comments.each do |c| %> - - - - <% end %> -
- User: <%= %>
- <%= c.body %>
- - <%= link_to 'Edit', edit_comment_path(c) %>  - <%= link_to 'Destroy', c, :confirm => 'Are you sure?', :method => :delete %> -
+
+
+ Foto #<%= @photo.id %> anzeigen +
+
+
+ <%= link_to 'Zurück', album_photos_path(@album), :class => "link_white" %> +
+
+
+
+ <%= render 'form_fake' %> +
diff --git a/app/views/sperrens/_form.html.erb b/app/views/sperrens/_form.html.erb new file mode 100755 index 0000000..eb94bb1 --- /dev/null +++ b/app/views/sperrens/_form.html.erb @@ -0,0 +1,29 @@ +<%= form_for(@sperren) do |f| %> + <% if @sperren.errors.any? %> +
+

<%= pluralize(@sperren.errors.count, "error") %> prohibited this sperren from being saved:

+ + +
+ <% end %> + +
+ <%= f.label :startDate %>
+ <%= f.date_select :startDate %> +
+
+ <%= f.label :endDate %>
+ <%= f.date_select :endDate %> +
+
+ <%= f.label :reason %>
+ <%= f.text_field :reason %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/sperrens/edit.html.erb b/app/views/sperrens/edit.html.erb new file mode 100755 index 0000000..6465581 --- /dev/null +++ b/app/views/sperrens/edit.html.erb @@ -0,0 +1,6 @@ +

Editing sperren

+ +<%= render 'form' %> + +<%= link_to 'Show', @sperren %> | +<%= link_to 'Back', sperrens_path %> diff --git a/app/views/sperrens/index.html.erb b/app/views/sperrens/index.html.erb new file mode 100755 index 0000000..2c00b6a --- /dev/null +++ b/app/views/sperrens/index.html.erb @@ -0,0 +1,27 @@ +

Listing sperrens

+ + + + + + + + + + + +<% @sperrens.each do |sperren| %> + + + + + + + + +<% end %> +
StartdateEnddateReason
<%= sperren.startDate %><%= sperren.endDate %><%= sperren.reason %><%= link_to 'Show', sperren %><%= link_to 'Edit', edit_sperren_path(sperren) %><%= link_to 'Destroy', sperren, :confirm => 'Are you sure?', :method => :delete %>
+ +
+ +<%= link_to 'New Sperren', new_sperren_path %> diff --git a/app/views/sperrens/new.html.erb b/app/views/sperrens/new.html.erb new file mode 100755 index 0000000..d51898c --- /dev/null +++ b/app/views/sperrens/new.html.erb @@ -0,0 +1,5 @@ +

New sperren

+ +<%= render 'form' %> + +<%= link_to 'Back', sperrens_path %> diff --git a/app/views/sperrens/show.html.erb b/app/views/sperrens/show.html.erb new file mode 100755 index 0000000..e69c118 --- /dev/null +++ b/app/views/sperrens/show.html.erb @@ -0,0 +1,20 @@ +

<%= notice %>

+ +

+ Startdate: + <%= @sperren.startDate %> +

+ +

+ Enddate: + <%= @sperren.endDate %> +

+ +

+ Reason: + <%= @sperren.reason %> +

+ + +<%= link_to 'Edit', edit_sperren_path(@sperren) %> | +<%= link_to 'Back', sperrens_path %> diff --git a/config/._routes.rb b/config/._routes.rb new file mode 100755 index 0000000..4514f2f Binary files /dev/null and b/config/._routes.rb differ diff --git a/config/Kopie von deploy.rb b/config/Kopie von deploy.rb new file mode 100644 index 0000000..10358f5 --- /dev/null +++ b/config/Kopie von deploy.rb @@ -0,0 +1,40 @@ +require 'bundler/capistrano' + +set :application, "Photosharing" + +set :repository, "https://github.com/ahelmel/Photosharing.git" +set :scm, :git +# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none` + +# role :web, "your web-server here" # Your HTTP server, Apache/etc +# role :app, "your app-server here" # This may be the same as your `Web` server +# role :db, "your primary db-server here", :primary => true # This is where Rails migrations will run +# role :db, "your slave db-server here" + +server "10.28.19.108", :web, :app, :db, :primary => true + +set :user, 'student' +set :use_sudo, true + +set :deploy_to, '/home/student/todo' + +# if you're still using the script/reaper helper you will need +# these http://github.com/rails/irs_process_scripts + +# If you are using Passenger mod_rails uncomment this: +# namespace :deploy do +# task :start do ; end +# task :stop do ; end +# task :restart, :roles => :app, :except => { :no_release => true } do +# run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}" +# end +# end + +namespace :customs do + task :symlink, :roles => :app do + run <<-CMD + ln -nfs #{shared_path}/images #{release_path}/public/images + CMD + end +end +after "deploy:update_code","customs:symlink" \ No newline at end of file diff --git a/config/application.rb b/config/application.rb index 5f33a9d..176e3b1 100755 --- a/config/application.rb +++ b/config/application.rb @@ -41,5 +41,8 @@ class Application < Rails::Application # Configure sensitive parameters which will be filtered from the log file. config.filter_parameters += [:password] + + # Enables autoloading of all files in lib folder + config.autoload_paths += %W(#{config.root}/lib) end end diff --git a/config/deploy.rb b/config/deploy.rb new file mode 100644 index 0000000..1094154 --- /dev/null +++ b/config/deploy.rb @@ -0,0 +1,41 @@ +require 'bundler/capistrano' + +set :application, "Photosharing" + +set :repository, "https://github.com/ahelmel/Photosharing.git" +set :scm, :git +# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none` + +# role :web, "your web-server here" # Your HTTP server, Apache/etc +# role :app, "your app-server here" # This may be the same as your `Web` server +# role :db, "your primary db-server here", :primary => true # This is where Rails migrations will run +# role :db, "your slave db-server here" + +server "10.28.19.108", :web, :app, :db, :primary => true + +set :user, 'student' +set :password, '$tuD3NtSS11' +set :use_sudo, true + +set :deploy_to, '/home/student/todo' + +# if you're still using the script/reaper helper you will need +# these http://github.com/rails/irs_process_scripts + +# If you are using Passenger mod_rails uncomment this: +# namespace :deploy do +# task :start do ; end +# task :stop do ; end +# task :restart, :roles => :app, :except => { :no_release => true } do +# run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}" +# end +# end + +namespace :customs do + task :symlink, :roles => :app do + run <<-CMD + ln -nfs #{shared_path}/images #{release_path}/public/images + CMD + end +end +after "deploy:update_code","customs:symlink" diff --git a/config/environment.rb b/config/environment.rb index 9d88b79..3b84d31 100755 --- a/config/environment.rb +++ b/config/environment.rb @@ -4,6 +4,7 @@ # Initialize the rails application Photosharing::Application.initialize! + ActionMailer::Base.delivery_method = :smtp ActionMailer::Base.smtp_settings = { @@ -13,4 +14,9 @@ :authentication => :login, :user_name => "vampire.photosharing@googlemail.com", :password => "hm11sweII", -} \ No newline at end of file +} +#======= +# Initialize pagination +WillPaginate::ViewHelpers.pagination_options[:prev_label] = "< Zurück" +WillPaginate::ViewHelpers.pagination_options[:next_label] = "Vor >" +WillPaginate::ViewHelpers.pagination_options[:renderer] = 'MinimalPaginationLinkRenderer' \ No newline at end of file diff --git a/config/environments/development.rb b/config/environments/development.rb index 339c5e5..e091edb 100755 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -19,7 +19,8 @@ # Don't care if the mailer can't send config.action_mailer.raise_delivery_errors = false - + config.action_mailer.default_url_options = { :host => 'localhost:3000' } + # Print deprecation notices to the Rails logger config.active_support.deprecation = :log diff --git a/config/initializers/._.DS_Store b/config/initializers/._.DS_Store new file mode 100755 index 0000000..1954799 Binary files /dev/null and b/config/initializers/._.DS_Store differ diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb new file mode 100755 index 0000000..7f9cf88 --- /dev/null +++ b/config/initializers/devise.rb @@ -0,0 +1,116 @@ +# Use this hook to configure devise mailer, warden hooks and so forth. The first +# four configuration values can also be set straight in your models. +Devise.setup do |config| + # Configure the e-mail address which will be shown in DeviseMailer. + config.mailer_sender = "please-change-me@config-initializers-devise.com" + + # ==> Configuration for any authentication mechanism + # Configure which keys are used when authenticating an user. By default is + # just :email. You can configure it to use [:username, :subdomain], so for + # authenticating an user, both parameters are required. Remember that those + # parameters are used only when authenticating and not when retrieving from + # session. If you need permissions, you should implement that in a before filter. + config.authentication_keys = [ :username ] + + # Tell if authentication through request.params is enabled. True by default. + # config.params_authenticatable = true + + # Tell if authentication through HTTP Basic Auth is enabled. True by default. + # config.http_authenticatable = true + + # The realm used in Http Basic Authentication + # config.http_authentication_realm = "Application" + + # ==> Configuration for :database_authenticatable + # Invoke `rake secret` and use the printed value to setup a pepper to generate + # the encrypted password. By default no pepper is used. + # config.pepper = "rake secret output" + + # Configure how many times you want the password is reencrypted. Default is 10. + # config.stretches = 10 + + # Define which will be the encryption algorithm. Supported algorithms are :sha1 + # (default), :sha512 and :bcrypt. Devise also supports encryptors from others + # authentication tools as :clearance_sha1, :authlogic_sha512 (then you should set + # stretches above to 20 for default behavior) and :restful_authentication_sha1 + # (then you should set stretches to 10, and copy REST_AUTH_SITE_KEY to pepper) + # config.encryptor = :sha1 + + # ==> Configuration for :confirmable + # The time you want give to your user to confirm his account. During this time + # he will be able to access your application without confirming. Default is nil. + # config.confirm_within = 2.days + + # ==> Configuration for :rememberable + # The time the user will be remembered without asking for credentials again. + # config.remember_for = 2.weeks + + # ==> Configuration for :validatable + # Range for password length + # config.password_length = 6..20 + + # Regex to use to validate the email address + # config.email_regexp = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i + + # ==> Configuration for :timeoutable + # The time you want to timeout the user session without activity. After this + # time the user will be asked for credentials again. + # config.timeout_in = 10.minutes + + # ==> Configuration for :lockable + # Defines which strategy will be used to lock an account. + # :failed_attempts = Locks an account after a number of failed attempts to sign in. + # :none = No lock strategy. You should handle locking by yourself. + # config.lock_strategy = :failed_attempts + + # Defines which strategy will be used to unlock an account. + # :email = Sends an unlock link to the user email + # :time = Reanables login after a certain ammount of time (see :unlock_in below) + # :both = Enables both strategies + # :none = No unlock strategy. You should handle unlocking by yourself. + # config.unlock_strategy = :both + + # Number of authentication tries before locking an account if lock_strategy + # is failed attempts. + # config.maximum_attempts = 20 + + # Time interval to unlock the account if :time is enabled as unlock_strategy. + # config.unlock_in = 1.hour + + # ==> Configuration for :token_authenticatable + # Defines name of the authentication token params key + # config.token_authentication_key = :auth_token + + # ==> General configuration + # Load and configure the ORM. Supports :active_record (default), :mongoid + # (requires mongo_ext installed) and :data_mapper (experimental). + require 'devise/orm/active_record' + + # Turn scoped views on. Before rendering "sessions/new", it will first check for + # "sessions/users/new". It's turned off by default because it's slower if you + # are using only default views. + # config.scoped_views = true + + # By default, devise detects the role accessed based on the url. So whenever + # accessing "/users/sign_in", it knows you are accessing an User. This makes + # routes as "/sign_in" not possible, unless you tell Devise to use the default + # scope, setting true below. + # config.use_default_scope = true + + # Configure the default scope used by Devise. By default it's the first devise + # role declared in your routes. + # config.default_scope = :user + + # If you want to use other strategies, that are not (yet) supported by Devise, + # you can configure them inside the config.warden block. The example below + # allows you to setup OAuth, using http://github.com/roman/warden_oauth + # + # config.warden do |manager| + # manager.oauth(:twitter) do |twitter| + # twitter.consumer_secret = + # twitter.consumer_key = + # twitter.options :site => 'http://twitter.com' + # end + # manager.default_strategies(:scope => :user).unshift :twitter_oauth + # end +end diff --git a/config/locales/._.DS_Store b/config/locales/._.DS_Store new file mode 100755 index 0000000..2748f73 Binary files /dev/null and b/config/locales/._.DS_Store differ diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml new file mode 100755 index 0000000..7cfc463 --- /dev/null +++ b/config/locales/devise.en.yml @@ -0,0 +1,36 @@ +en: + errors: + messages: + not_found: "not found" + already_confirmed: "was already confirmed" + not_locked: "was not locked" + + devise: + failure: + unauthenticated: 'You need to sign in or sign up before continuing.' + unconfirmed: 'You have to confirm your account before continuing.' + locked: 'Your account is locked.' + invalid: 'Invalid email or password.' + invalid_token: 'Invalid authentication token.' + timeout: 'Your session expired, please sign in again to continue.' + inactive: 'Your account was not activated yet.' + sessions: + signed_in: 'Signed in successfully.' + signed_out: 'Signed out successfully.' + passwords: + send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.' + updated: 'Your password was changed successfully. You are now signed in.' + confirmations: + send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.' + confirmed: 'Your account was successfully confirmed. You are now signed in.' + registrations: + signed_up: 'You have signed up successfully.' + updated: 'You updated your account successfully.' + destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.' + unlocks: + send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.' + unlocked: 'Your account was successfully unlocked. You are now signed in.' + mailer: + confirmation_instructions: 'Confirmation instructions' + reset_password_instructions: 'Reset password instructions' + unlock_instructions: 'Unlock Instructions' diff --git a/config/routes.rb b/config/routes.rb index c3ea8c3..3e30560 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,12 @@ Photosharing::Application.routes.draw do + get "home/index" + + devise_for :people + + resources :sperrens + + resources :people + resources :comments resources :photos do @@ -10,6 +18,7 @@ end + # The priority is based upon order of creation: # first created -> highest priority. @@ -59,7 +68,7 @@ # You can have the root of your site routed with "root" # just remember to delete public/index.html. - # root :to => "welcome#index" + root :to => "albums#index" # See how all your routes lay out with "rake routes" diff --git a/db/migrate/20110512185556_add_foreignkey_to_photos.rb b/db/migrate/20110512185556_add_foreignkey_to_photos.rb old mode 100644 new mode 100755 diff --git a/db/migrate/20110512200334_add_foreignkey_to_comments.rb b/db/migrate/20110512200334_add_foreignkey_to_comments.rb old mode 100644 new mode 100755 diff --git a/db/migrate/20110520003451_create_people.rb b/db/migrate/20110520003451_create_people.rb new file mode 100755 index 0000000..0083fb3 --- /dev/null +++ b/db/migrate/20110520003451_create_people.rb @@ -0,0 +1,23 @@ +class CreatePeople < ActiveRecord::Migration + def self.up + create_table :people do |t| + t.string :username + t.string :password + t.string :email + t.string :domain + t.integer :typ + t.string :lastName + t.string :firstName + t.boolean :status + t.date :blockedTo + t.text :signatur + t.references :picture + + t.timestamps + end + end + + def self.down + drop_table :people + end +end diff --git a/db/migrate/20110520003648_create_sperrens.rb b/db/migrate/20110520003648_create_sperrens.rb new file mode 100755 index 0000000..f656dc6 --- /dev/null +++ b/db/migrate/20110520003648_create_sperrens.rb @@ -0,0 +1,15 @@ +class CreateSperrens < ActiveRecord::Migration + def self.up + create_table :sperrens do |t| + t.date :startDate + t.date :endDate + t.string :reason + + t.timestamps + end + end + + def self.down + drop_table :sperrens + end +end diff --git a/db/migrate/20110524165140_devise_create_people.rb b/db/migrate/20110524165140_devise_create_people.rb new file mode 100755 index 0000000..cfffb33 --- /dev/null +++ b/db/migrate/20110524165140_devise_create_people.rb @@ -0,0 +1,36 @@ +class DeviseCreatePeople < ActiveRecord::Migration + def self.up + create_table(:people) do |t| + t.database_authenticatable :null => false + #t.confirmable + t.recoverable + t.rememberable + t.trackable + # t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both + + t.string :username + t.string :password + t.string :domain + t.integer :typ + t.string :lastName + t.string :firstName + t.boolean :status + t.date :blockedTo + t.text :signatur + t.references :picture + + + t.timestamps + end + + add_index :people, :username, :unique => true + add_index :people, :email, :unique => true + #add_index :people, :confirmation_token, :unique => true + add_index :people, :reset_password_token, :unique => true + # add_index :people, :unlock_token, :unique => true + end + + def self.down + drop_table :people + end +end diff --git a/db/schema.rb b/db/schema.rb index b4ec591..619ff11 100755 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20110512200334) do +ActiveRecord::Schema.define(:version => 20110524165140) do create_table "albums", :force => true do |t| t.string "title" @@ -27,6 +27,36 @@ t.integer "photo_id" end + create_table "people", :force => true do |t| + t.string "email", :default => "", :null => false + t.string "encrypted_password", :limit => 128, :default => "", :null => false + t.string "password_salt", :default => "", :null => false + t.string "reset_password_token" + t.string "remember_token" + t.datetime "remember_created_at" + t.integer "sign_in_count", :default => 0 + t.datetime "current_sign_in_at" + t.datetime "last_sign_in_at" + t.string "current_sign_in_ip" + t.string "last_sign_in_ip" + t.string "username" + t.string "password" + t.string "domain" + t.integer "typ" + t.string "lastName" + t.string "firstName" + t.boolean "status" + t.date "blockedTo" + t.text "signatur" + t.integer "picture_id" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "people", ["email"], :name => "index_people_on_email", :unique => true + add_index "people", ["reset_password_token"], :name => "index_people_on_reset_password_token", :unique => true + add_index "people", ["username"], :name => "index_people_on_username", :unique => true + create_table "photos", :force => true do |t| t.string "title" t.integer "owner_id" @@ -38,4 +68,12 @@ t.integer "album_id" end + create_table "sperrens", :force => true do |t| + t.date "startDate" + t.date "endDate" + t.string "reason" + t.datetime "created_at" + t.datetime "updated_at" + end + end diff --git a/lib/minimal_pagination_link_renderer.rb b/lib/minimal_pagination_link_renderer.rb new file mode 100755 index 0000000..bdc76ac --- /dev/null +++ b/lib/minimal_pagination_link_renderer.rb @@ -0,0 +1,41 @@ +class MinimalPaginationLinkRenderer < WillPaginate::ViewHelpers::LinkRenderer + + def container_attributes + super.except(:first_label, :last_label) + end + + protected + + def page_number(page) + page_title = ((page>9)? page: ["0", page]) + + if page == current_page + tag(:em, page_title) + elsif current_page == 1 + if page == (current_page + 1) || page == (current_page + 2) + link(page_title, page, :rel => rel_value(page)) + end + elsif current_page == total_pages + if page == (current_page - 1) || page == (current_page - 2) + link(page_title, page, :rel => rel_value(page)) + end + else + if page == (current_page - 1) || page == (current_page + 1) + link(page_title, page, :rel => rel_value(page)) + end + end + end + + def gap + + end + + def first_page + previous_or_next_page(current_page == 1 ? nil : 1, @options[:first_label], "first_page") + end + + def last_page + previous_or_next_page(current_page == total_pages ? nil : total_pages, @options[:last_label], "last_page") + end + +end diff --git a/public/images/bg_add_album.png b/public/images/bg_add_album.png new file mode 100755 index 0000000..f645908 Binary files /dev/null and b/public/images/bg_add_album.png differ diff --git a/public/images/bg_add_comment.png b/public/images/bg_add_comment.png new file mode 100755 index 0000000..c5c8d7f Binary files /dev/null and b/public/images/bg_add_comment.png differ diff --git a/public/images/bg_error.png b/public/images/bg_error.png new file mode 100755 index 0000000..0e3e4d1 Binary files /dev/null and b/public/images/bg_error.png differ diff --git a/public/images/bg_img.png b/public/images/bg_img.png new file mode 100755 index 0000000..e171b98 Binary files /dev/null and b/public/images/bg_img.png differ diff --git a/public/images/bg_items.png b/public/images/bg_items.png new file mode 100755 index 0000000..8960a61 Binary files /dev/null and b/public/images/bg_items.png differ diff --git a/public/images/bg_login.png b/public/images/bg_login.png new file mode 100755 index 0000000..d047849 Binary files /dev/null and b/public/images/bg_login.png differ diff --git a/public/images/bg_pages Kopie.png b/public/images/bg_pages Kopie.png new file mode 100755 index 0000000..3fb1ace Binary files /dev/null and b/public/images/bg_pages Kopie.png differ diff --git a/public/images/bg_pages.png b/public/images/bg_pages.png new file mode 100755 index 0000000..d04a9dd Binary files /dev/null and b/public/images/bg_pages.png differ diff --git a/public/images/bg_password.png b/public/images/bg_password.png new file mode 100755 index 0000000..f645908 Binary files /dev/null and b/public/images/bg_password.png differ diff --git a/public/images/bg_save_album.png b/public/images/bg_save_album.png new file mode 100755 index 0000000..51c7689 Binary files /dev/null and b/public/images/bg_save_album.png differ diff --git a/public/images/bg_success.png b/public/images/bg_success.png new file mode 100755 index 0000000..8857ccd Binary files /dev/null and b/public/images/bg_success.png differ diff --git a/public/images/roundedbox_ro.png b/public/images/roundedbox_ro.png new file mode 100755 index 0000000..cdb97a4 Binary files /dev/null and b/public/images/roundedbox_ro.png differ diff --git a/public/images/roundedbox_ru.png b/public/images/roundedbox_ru.png new file mode 100755 index 0000000..06c4225 Binary files /dev/null and b/public/images/roundedbox_ru.png differ diff --git a/public/stylesheets/scaffold.css b/public/stylesheets/scaffold.css index 1ae7000..cb7fae9 100755 --- a/public/stylesheets/scaffold.css +++ b/public/stylesheets/scaffold.css @@ -1,56 +1,521 @@ -body { background-color: #fff; color: #333; } +body +{ + font:100% Verdana; + background-color:#006699; + margin:0px 0px 0px 0px; + padding:0px 0px 0px 0px; +} + +div +{ + margin:0px 0px 0px 0px; + padding:0px 0px 0px 0px; +} + +a +{ + text-decoration:none; +} + +#top_container +{ + float:left; + position:relative; + width:950px; + height:40px; + padding:0px 0px 0px 0px; +} + +#top_container_content +{ + position:absolute; + right:0px; + bottom:10px; +} + +#middle_container +{ + float:left; + position:relative; + width:980px; + background-color:#FFFFFF; +} + +#middle_container div +{ + float:left; +} + +#bottom_container +{ + float:left; + position:relative; + width:950px; + height:40px; +} + +#bottom_container div +{ + position:absolute; + right:0px; + top:10px; +} + +#corner_top_right +{ + position:absolute; + right:0px; + top:0px; +} + +#corner_bottom_right +{ + position:absolute; + right:0px; + bottom:0px; +} + +#page_content +{ + float:left; + position:relative; + left:30px; + width:950px; +} + +#page_title +{ + position:relative; + width:950px; + height:80px; +} -body, p, ol, ul, td { - font-family: verdana, arial, helvetica, sans-serif; - font-size: 13px; - line-height: 18px; +#page_title_content +{ + position:absolute; + top:20px; } -pre { - background-color: #eee; - padding: 10px; - font-size: 11px; +/* ACTIONS ------------------------------------------------------------------------------*/ +#page_title_actions +{ + position:absolute; + left:450px; + width:530px; + height:40px; } -a { color: #000; } -a:visited { color: #666; } -a:hover { color: #fff; background-color:#000; } +.actions_add +{ + float:left; + position:relative; + margin:0px 15px 0px 0px; + width:170px; + height:40px; + background:url(/images/bg_add_album.png) top left no-repeat; +} + +.actions_add span +{ + position:absolute; + left:20px; + top:10px; + width:130px; + text-align:center; + font-size:14px; + color:#FFFFFF; +} + +.actions_pages +{ + float:left; + position:relative; + margin:0px 15px 0px 0px; + width:230px; + height:40px; + background:url(/images/bg_pages.png) top left no-repeat; +} + +.actions_password +{ + float:left; + position:relative; + margin:0px 15px 0px 0px; + width:170px; + height:40px; + background:url(/images/bg_password.png) top left no-repeat; +} + +.actions_password span +{ + position:absolute; + left:10px; + top:10px; + width:150px; + text-align:center; + font-size:14px; + color:#FFFFFF; +} + +.actions_save +{ + float:left; + position:relative; + margin:0px 15px 0px 0px; + width:130px; + height:40px; + background:url(/images/bg_save_album.png) top left no-repeat; +} + +.actions_save span +{ + position:absolute; + left:20px; + top:10px; + width:90px; + text-align:center; + font-size:14px; + color:#FFFFFF; +} + +.actions_cancel +{ + float:left; + position:relative; + margin:0px 15px 0px 0px; + width:130px; + height:40px; + background:url(/images/bg_save_album.png) top left no-repeat; +} + +.actions_cancel span +{ + position:absolute; + left:20px; + top:10px; + width:90px; + text-align:center; + font-size:14px; + color:#FFFFFF; +} +/* ACTIONS ------------------------------------------------------------------------------*/ + +#page_text +{ + position:relative; + width:950px; + min-height:120px; +} + +/* FORM with FIELDS ---------------------------------------------------------------------*/ +.form +{ + position:relative; + width:450px; +} -div.field, div.actions { - margin-bottom: 10px; +.form .point +{ + color:#FF0000; } -#notice { - color: green; +.form .caption +{ + position:relative; + width:380px; + margin:0px 0px 10px 0px; + font-size:14px; + color:#000000; } -.field_with_errors { - padding: 2px; - background-color: red; - display: table; +.form .text_field +{ + position:relative; + width:360px; + height:30px; + margin:0px 0px 20px 0px; + padding: 0px 8px 0px 8px; + font:100% Verdana; + font-size:14px; + color:#000000; + line-height:26px; + border:solid 2px; + border-color:#999999; } -#error_explanation { - width: 450px; - border: 2px solid red; - padding: 7px; - padding-bottom: 0; - margin-bottom: 20px; - background-color: #f0f0f0; +.form .text_field_fake +{ + position:relative; + width:360px; + height:30px; + margin:0px 0px 20px 0px; + padding: 0px 8px 0px 8px; + font:100% Verdana; + font-size:14px; + color:#000000; + line-height:26px; + border:solid 2px; + border-color:#DDDDDD; + background-color:#DDDDDD; } -#error_explanation h2 { - text-align: left; - font-weight: bold; - padding: 5px 5px 5px 15px; - font-size: 12px; - margin: -7px; - margin-bottom: 0px; - background-color: #c00; - color: #fff; +.form .file_field +{ + position:relative; + width:360px; + height:30px; + margin:0px 0px 20px 0px; + padding: 0px 8px 0px 8px; + font:100% Verdana; + font-size:14px; + color:#000000; + line-height:26px; + border:solid 2px; + border-color:#FFFFFF; } -#error_explanation ul li { - font-size: 12px; - list-style: square; +.form .file_field_fake +{ + position:relative; + margin:0px 0px 20px 0px; + padding: 8px 8px 4px 8px; + + border:solid 2px; + border-color:#DDDDDD; + background-color:#DDDDDD; } + +.form .text_area +{ + position:relative; + width:360px; + height:160px; + margin:0px 0px 20px 0px; + padding: 4px 8px 0px 8px; + font:100% Verdana; + font-size:14px; + color:#000000; + line-height:26px; + border:solid 2px; + border-color:#999999; +} + +.form .text_area_fake +{ + position:relative; + width:360px; + height:160px; + margin:0px 0px 20px 0px; + padding: 4px 8px 0px 8px; + font:100% Verdana; + font-size:14px; + color:#000000; + line-height:26px; + border:solid 2px; + border-color:#DDDDDD; + background-color:#DDDDDD; +} +/* FORM with FIELDS ---------------------------------------------------------------------*/ + +/* NOT NULL -----------------------------------------------------------------------------*/ +#not_null +{ + position:relative; + width:420px; + height:40px; + padding: 0px 0px 10px 0px; +} + +#not_null .point +{ + color:#FF0000; +} + +#not_null span +{ + position:absolute; + top:10px; + width:420px; + font-size:14px; + color:#000000; + line-height:26px; +} +/* NOT NULL -----------------------------------------------------------------------------*/ + +/* ERROR --------------------------------------------------------------------------------*/ +#error +{ + position:absolute; + left:450px; + bottom:0px; + width:450px; + padding:10px 0px 10px 20px; + background:url(/images/bg_error.png) top left no-repeat; +} + +#error span +{ + line-height:26px; + font-size:14px; + color:#FFFFFF; +} +/* ERROR --------------------------------------------------------------------------------*/ + +/* SUCCESS ------------------------------------------------------------------------------*/ +#success +{ + /* + position:relative; + margin:0px 0px 0px 450px; + */ + position:absolute; + left:450px; + bottom:0px; + width:450px; + padding:10px 0px 10px 20px; + background:url(/images/bg_success.png) top left no-repeat; +} + +#success span +{ + line-height:26px; + font-size:14px; + color:#FFFFFF; +} +/* SUCCESS ------------------------------------------------------------------------------*/ + +/* TABLE with ROWS & CELLS --------------------------------------------------------------*/ +.row div +{ + float:left; + margin:0px 25px 20px 0px; +} + +.cell +{ + position:relative; + width:160px; + height:210px; + font-size:14px; + color:#666666; + border:solid 2px; + border-color:#999999; +} + +.cell_title +{ + position:absolute; + bottom:20px; + left:15px; + width:130px; +} + +.cell_title span +{ + font-size:14px; + color:#000000; +} + +.cell_image +{ + position:absolute; + top:15px; + left:15px; + width:130px; + height:130px; + background-color:#CCCCCC; +} + +.cell_items +{ + position:absolute; + top:-2px; + right:-27px; + width:43px; + height:40px; + background:url(/images/bg_items.png) top left no-repeat; +} + +.cell_items span +{ + position:absolute; + top:10px; + width:33px; + margin:0px 5px 0px 5px; + text-align:center; + font-size:14px; + color:#FFFFFF; +} + +.cell_link +{ + position:absolute; + bottom:-5px; + left:15px; + width:130px; +} + +.cell_link a, .cell_link a:hover, .cell_link a:active +{ + font-size:14px; + color:#666666; +} +/* TABLE with ROWS & CELLS --------------------------------------------------------------*/ + +/* PAGINATE -----------------------------------------------------------------------------*/ +div.pagination +{ + position:absolute; + left:15px; + top:10px; + width:150px; + text-align:center; + white-space:nowrap; + font-size:14px; + color:#FFFFFF; +} + +div.pagination a, div.pagination a:hover, div.pagination a:active +{ + padding: 0px 2px 0px 2px; + text-decoration:none; + color:#FFFFFF; +} + +div.pagination em +{ + padding: 0px 2px 0px 2px; + font-style:normal; + color:#FF0000; +} + +div.pagination span.disabled +{ + color:#666666; +} +/* PAGINATE -----------------------------------------------------------------------------*/ + +.text_light_blue +{ + font-size:14px; + color:#04ADFF; +} + +.text_white +{ + font-size:14px; + color:#FFFFFF; +} + +.title_black +{ + font-size:28px; + font-weight:bold; + color:#000000; +} + +.link_white +{ + font-size:14px; + color:#FFFFFF; +} \ No newline at end of file diff --git a/public/stylesheets/scaffold_org.css.zip b/public/stylesheets/scaffold_org.css.zip new file mode 100755 index 0000000..99f36f7 Binary files /dev/null and b/public/stylesheets/scaffold_org.css.zip differ diff --git a/public/system/images/._.DS_Store b/public/system/images/._.DS_Store new file mode 100755 index 0000000..52140f0 Binary files /dev/null and b/public/system/images/._.DS_Store differ diff --git a/public/system/images/1/original/carmen-electra---american-glamour-model-wallpaper1600-x-1200-_female-celebrities.jpg b/public/system/images/1/original/carmen-electra---american-glamour-model-wallpaper1600-x-1200-_female-celebrities.jpg new file mode 100644 index 0000000..2f4c385 Binary files /dev/null and b/public/system/images/1/original/carmen-electra---american-glamour-model-wallpaper1600-x-1200-_female-celebrities.jpg differ diff --git a/public/system/images/1/thumb/carmen-electra---american-glamour-model-wallpaper1600-x-1200-_female-celebrities.jpg b/public/system/images/1/thumb/carmen-electra---american-glamour-model-wallpaper1600-x-1200-_female-celebrities.jpg new file mode 100644 index 0000000..0737735 Binary files /dev/null and b/public/system/images/1/thumb/carmen-electra---american-glamour-model-wallpaper1600-x-1200-_female-celebrities.jpg differ diff --git a/public/system/images/12/medium/carmen-electra---american-glamour-model-wallpaper1600-x-1200-_female-celebrities.jpg b/public/system/images/12/medium/carmen-electra---american-glamour-model-wallpaper1600-x-1200-_female-celebrities.jpg new file mode 100644 index 0000000..f4ffbb2 Binary files /dev/null and b/public/system/images/12/medium/carmen-electra---american-glamour-model-wallpaper1600-x-1200-_female-celebrities.jpg differ diff --git a/public/system/images/12/original/carmen-electra---american-glamour-model-wallpaper1600-x-1200-_female-celebrities.jpg b/public/system/images/12/original/carmen-electra---american-glamour-model-wallpaper1600-x-1200-_female-celebrities.jpg new file mode 100644 index 0000000..2f4c385 Binary files /dev/null and b/public/system/images/12/original/carmen-electra---american-glamour-model-wallpaper1600-x-1200-_female-celebrities.jpg differ diff --git a/public/system/images/12/thumb/carmen-electra---american-glamour-model-wallpaper1600-x-1200-_female-celebrities.jpg b/public/system/images/12/thumb/carmen-electra---american-glamour-model-wallpaper1600-x-1200-_female-celebrities.jpg new file mode 100644 index 0000000..39f7282 Binary files /dev/null and b/public/system/images/12/thumb/carmen-electra---american-glamour-model-wallpaper1600-x-1200-_female-celebrities.jpg differ diff --git a/public/system/images/2/original/carmen-electra---american-glamour-model-wallpaper1600-x-1200-_female-celebrities.jpg b/public/system/images/2/original/carmen-electra---american-glamour-model-wallpaper1600-x-1200-_female-celebrities.jpg new file mode 100644 index 0000000..2f4c385 Binary files /dev/null and b/public/system/images/2/original/carmen-electra---american-glamour-model-wallpaper1600-x-1200-_female-celebrities.jpg differ diff --git a/public/system/images/2/thumb/carmen-electra---american-glamour-model-wallpaper1600-x-1200-_female-celebrities.jpg b/public/system/images/2/thumb/carmen-electra---american-glamour-model-wallpaper1600-x-1200-_female-celebrities.jpg new file mode 100644 index 0000000..0737735 Binary files /dev/null and b/public/system/images/2/thumb/carmen-electra---american-glamour-model-wallpaper1600-x-1200-_female-celebrities.jpg differ diff --git a/public/system/images/21/._.DS_Store b/public/system/images/21/._.DS_Store new file mode 100755 index 0000000..48ce7ad Binary files /dev/null and b/public/system/images/21/._.DS_Store differ diff --git a/public/system/images/21/original/._.DS_Store b/public/system/images/21/original/._.DS_Store new file mode 100755 index 0000000..044e616 Binary files /dev/null and b/public/system/images/21/original/._.DS_Store differ diff --git a/public/system/images/23/original/20110302-kn1d44i5asxacr6grupty19caw.jpg b/public/system/images/23/original/20110302-kn1d44i5asxacr6grupty19caw.jpg old mode 100644 new mode 100755 diff --git a/public/system/images/23/thumb/20110302-kn1d44i5asxacr6grupty19caw.jpg b/public/system/images/23/thumb/20110302-kn1d44i5asxacr6grupty19caw.jpg old mode 100644 new mode 100755 diff --git a/public/system/images/24/original/20110302-mf8qsp9gmrd9h1qsu4cdybs1yd.jpg b/public/system/images/24/original/20110302-mf8qsp9gmrd9h1qsu4cdybs1yd.jpg old mode 100644 new mode 100755 diff --git a/public/system/images/24/thumb/20110302-mf8qsp9gmrd9h1qsu4cdybs1yd.jpg b/public/system/images/24/thumb/20110302-mf8qsp9gmrd9h1qsu4cdybs1yd.jpg old mode 100644 new mode 100755 diff --git a/public/system/images/25/original/3398481426_bdf00749b5.jpg b/public/system/images/25/original/3398481426_bdf00749b5.jpg old mode 100644 new mode 100755 diff --git a/public/system/images/25/thumb/3398481426_bdf00749b5.jpg b/public/system/images/25/thumb/3398481426_bdf00749b5.jpg old mode 100644 new mode 100755 diff --git a/public/system/images/26/original/iphoneindigotvvm3.jpg b/public/system/images/26/original/iphoneindigotvvm3.jpg old mode 100644 new mode 100755 diff --git a/public/system/images/26/thumb/iphoneindigotvvm3.jpg b/public/system/images/26/thumb/iphoneindigotvvm3.jpg old mode 100644 new mode 100755 diff --git a/public/system/images/27/original/3398481426_bdf00749b5.jpg b/public/system/images/27/original/3398481426_bdf00749b5.jpg new file mode 100755 index 0000000..bf7d148 Binary files /dev/null and b/public/system/images/27/original/3398481426_bdf00749b5.jpg differ diff --git a/public/system/images/27/thumb/3398481426_bdf00749b5.jpg b/public/system/images/27/thumb/3398481426_bdf00749b5.jpg new file mode 100755 index 0000000..1557a36 Binary files /dev/null and b/public/system/images/27/thumb/3398481426_bdf00749b5.jpg differ diff --git a/public/system/images/28/original/slider3.png b/public/system/images/28/original/slider3.png new file mode 100644 index 0000000..e93323c Binary files /dev/null and b/public/system/images/28/original/slider3.png differ diff --git a/public/system/images/28/thumb/slider3.png b/public/system/images/28/thumb/slider3.png new file mode 100644 index 0000000..92d135e Binary files /dev/null and b/public/system/images/28/thumb/slider3.png differ diff --git a/public/system/images/29/original/29.jpg b/public/system/images/29/original/29.jpg new file mode 100644 index 0000000..7f55bbe Binary files /dev/null and b/public/system/images/29/original/29.jpg differ diff --git a/public/system/images/29/thumb/29.jpg b/public/system/images/29/thumb/29.jpg new file mode 100644 index 0000000..f6352ac Binary files /dev/null and b/public/system/images/29/thumb/29.jpg differ diff --git a/public/system/images/4/original/lemmings-20060922083201674_640w.jpg b/public/system/images/4/original/lemmings-20060922083201674_640w.jpg new file mode 100644 index 0000000..b5cf522 Binary files /dev/null and b/public/system/images/4/original/lemmings-20060922083201674_640w.jpg differ diff --git a/public/system/images/4/thumb/lemmings-20060922083201674_640w.jpg b/public/system/images/4/thumb/lemmings-20060922083201674_640w.jpg new file mode 100644 index 0000000..9f1a203 Binary files /dev/null and b/public/system/images/4/thumb/lemmings-20060922083201674_640w.jpg differ diff --git a/public/system/images/5/original/lemmings-20060526031530368.jpg b/public/system/images/5/original/lemmings-20060526031530368.jpg new file mode 100644 index 0000000..e50b1c1 Binary files /dev/null and b/public/system/images/5/original/lemmings-20060526031530368.jpg differ diff --git a/public/system/images/5/thumb/lemmings-20060526031530368.jpg b/public/system/images/5/thumb/lemmings-20060526031530368.jpg new file mode 100644 index 0000000..53c33ca Binary files /dev/null and b/public/system/images/5/thumb/lemmings-20060526031530368.jpg differ diff --git a/public/system/images/6/original/lemmings.jpg b/public/system/images/6/original/lemmings.jpg new file mode 100644 index 0000000..2bc2820 Binary files /dev/null and b/public/system/images/6/original/lemmings.jpg differ diff --git a/public/system/images/6/thumb/lemmings.jpg b/public/system/images/6/thumb/lemmings.jpg new file mode 100644 index 0000000..631a09a Binary files /dev/null and b/public/system/images/6/thumb/lemmings.jpg differ diff --git a/public/system/images/7/original/lemmings.jpg b/public/system/images/7/original/lemmings.jpg new file mode 100644 index 0000000..2bc2820 Binary files /dev/null and b/public/system/images/7/original/lemmings.jpg differ diff --git a/public/system/images/7/thumb/lemmings.jpg b/public/system/images/7/thumb/lemmings.jpg new file mode 100644 index 0000000..f6a5191 Binary files /dev/null and b/public/system/images/7/thumb/lemmings.jpg differ diff --git a/public/system/images/8/original/lemmings1.jpg b/public/system/images/8/original/lemmings1.jpg new file mode 100644 index 0000000..1b28685 Binary files /dev/null and b/public/system/images/8/original/lemmings1.jpg differ diff --git a/public/system/images/8/thumb/lemmings1.jpg b/public/system/images/8/thumb/lemmings1.jpg new file mode 100644 index 0000000..ecefdda Binary files /dev/null and b/public/system/images/8/thumb/lemmings1.jpg differ diff --git a/public/system/images/980190963/original/13.jpg b/public/system/images/980190963/original/13.jpg new file mode 100644 index 0000000..1209948 Binary files /dev/null and b/public/system/images/980190963/original/13.jpg differ diff --git a/public/system/images/980190963/original/15.jpg b/public/system/images/980190963/original/15.jpg new file mode 100644 index 0000000..35ab2d5 Binary files /dev/null and b/public/system/images/980190963/original/15.jpg differ diff --git a/public/system/images/980190963/thumb/13.jpg b/public/system/images/980190963/thumb/13.jpg new file mode 100644 index 0000000..6b3bbcf Binary files /dev/null and b/public/system/images/980190963/thumb/13.jpg differ diff --git a/public/system/images/980190963/thumb/15.jpg b/public/system/images/980190963/thumb/15.jpg new file mode 100644 index 0000000..c517aba Binary files /dev/null and b/public/system/images/980190963/thumb/15.jpg differ diff --git a/public/system/images/980190964/original/13.jpg b/public/system/images/980190964/original/13.jpg new file mode 100644 index 0000000..1209948 Binary files /dev/null and b/public/system/images/980190964/original/13.jpg differ diff --git a/public/system/images/980190964/original/15.jpg b/public/system/images/980190964/original/15.jpg new file mode 100644 index 0000000..35ab2d5 Binary files /dev/null and b/public/system/images/980190964/original/15.jpg differ diff --git a/public/system/images/980190964/thumb/13.jpg b/public/system/images/980190964/thumb/13.jpg new file mode 100644 index 0000000..6b3bbcf Binary files /dev/null and b/public/system/images/980190964/thumb/13.jpg differ diff --git a/public/system/images/980190964/thumb/15.jpg b/public/system/images/980190964/thumb/15.jpg new file mode 100644 index 0000000..c517aba Binary files /dev/null and b/public/system/images/980190964/thumb/15.jpg differ diff --git a/public/system/images/980190965/original/13.jpg b/public/system/images/980190965/original/13.jpg new file mode 100644 index 0000000..1209948 Binary files /dev/null and b/public/system/images/980190965/original/13.jpg differ diff --git a/public/system/images/980190965/original/15.jpg b/public/system/images/980190965/original/15.jpg new file mode 100644 index 0000000..35ab2d5 Binary files /dev/null and b/public/system/images/980190965/original/15.jpg differ diff --git a/public/system/images/980190965/thumb/13.jpg b/public/system/images/980190965/thumb/13.jpg new file mode 100644 index 0000000..6b3bbcf Binary files /dev/null and b/public/system/images/980190965/thumb/13.jpg differ diff --git a/public/system/images/980190965/thumb/15.jpg b/public/system/images/980190965/thumb/15.jpg new file mode 100644 index 0000000..c517aba Binary files /dev/null and b/public/system/images/980190965/thumb/15.jpg differ diff --git a/public/system/images/980190966/original/13.jpg b/public/system/images/980190966/original/13.jpg new file mode 100644 index 0000000..1209948 Binary files /dev/null and b/public/system/images/980190966/original/13.jpg differ diff --git a/public/system/images/980190966/original/15.jpg b/public/system/images/980190966/original/15.jpg new file mode 100644 index 0000000..35ab2d5 Binary files /dev/null and b/public/system/images/980190966/original/15.jpg differ diff --git a/public/system/images/980190966/thumb/13.jpg b/public/system/images/980190966/thumb/13.jpg new file mode 100644 index 0000000..6b3bbcf Binary files /dev/null and b/public/system/images/980190966/thumb/13.jpg differ diff --git a/public/system/images/980190966/thumb/15.jpg b/public/system/images/980190966/thumb/15.jpg new file mode 100644 index 0000000..c517aba Binary files /dev/null and b/public/system/images/980190966/thumb/15.jpg differ diff --git a/public/system/images/980190967/original/13.jpg b/public/system/images/980190967/original/13.jpg new file mode 100644 index 0000000..1209948 Binary files /dev/null and b/public/system/images/980190967/original/13.jpg differ diff --git a/public/system/images/980190967/thumb/13.jpg b/public/system/images/980190967/thumb/13.jpg new file mode 100644 index 0000000..6b3bbcf Binary files /dev/null and b/public/system/images/980190967/thumb/13.jpg differ diff --git a/public/system/images/980190968/original/13.jpg b/public/system/images/980190968/original/13.jpg new file mode 100644 index 0000000..1209948 Binary files /dev/null and b/public/system/images/980190968/original/13.jpg differ diff --git a/public/system/images/980190968/original/15.jpg b/public/system/images/980190968/original/15.jpg new file mode 100644 index 0000000..35ab2d5 Binary files /dev/null and b/public/system/images/980190968/original/15.jpg differ diff --git a/public/system/images/980190968/thumb/13.jpg b/public/system/images/980190968/thumb/13.jpg new file mode 100644 index 0000000..6b3bbcf Binary files /dev/null and b/public/system/images/980190968/thumb/13.jpg differ diff --git a/public/system/images/980190968/thumb/15.jpg b/public/system/images/980190968/thumb/15.jpg new file mode 100644 index 0000000..c517aba Binary files /dev/null and b/public/system/images/980190968/thumb/15.jpg differ diff --git a/public/system/images/980190969/original/13.jpg b/public/system/images/980190969/original/13.jpg new file mode 100644 index 0000000..1209948 Binary files /dev/null and b/public/system/images/980190969/original/13.jpg differ diff --git a/public/system/images/980190969/thumb/13.jpg b/public/system/images/980190969/thumb/13.jpg new file mode 100644 index 0000000..6b3bbcf Binary files /dev/null and b/public/system/images/980190969/thumb/13.jpg differ diff --git a/test/fixtures/._13.jpg b/test/fixtures/._13.jpg new file mode 100644 index 0000000..ae37e3f Binary files /dev/null and b/test/fixtures/._13.jpg differ diff --git a/test/fixtures/._15.jpg b/test/fixtures/._15.jpg new file mode 100644 index 0000000..70b282b Binary files /dev/null and b/test/fixtures/._15.jpg differ diff --git a/test/fixtures/13.jpg b/test/fixtures/13.jpg new file mode 100644 index 0000000..1209948 Binary files /dev/null and b/test/fixtures/13.jpg differ diff --git a/test/fixtures/15.jpg b/test/fixtures/15.jpg new file mode 100644 index 0000000..35ab2d5 Binary files /dev/null and b/test/fixtures/15.jpg differ diff --git a/test/fixtures/people.yml b/test/fixtures/people.yml new file mode 100755 index 0000000..83d37a4 --- /dev/null +++ b/test/fixtures/people.yml @@ -0,0 +1,27 @@ +# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html + +one: + username: MyString + password: MyString + email: MyString + domain: MyString + typ: 1 + lastName: MyString + firstName: MyString + status: false + blockedTo: 2011-05-20 + signatur: MyText + picture: + +two: + username: MyString + password: MyString + email: MyString + domain: MyString + typ: 1 + lastName: MyString + firstName: MyString + status: false + blockedTo: 2011-05-20 + signatur: MyText + picture: diff --git a/test/fixtures/sperrens.yml b/test/fixtures/sperrens.yml new file mode 100755 index 0000000..f756490 --- /dev/null +++ b/test/fixtures/sperrens.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html + +one: + startDate: 2011-05-20 + endDate: 2011-05-20 + reason: MyString + +two: + startDate: 2011-05-20 + endDate: 2011-05-20 + reason: MyString diff --git a/test/functional/home_controller_test.rb b/test/functional/home_controller_test.rb new file mode 100755 index 0000000..0d9bb47 --- /dev/null +++ b/test/functional/home_controller_test.rb @@ -0,0 +1,9 @@ +require 'test_helper' + +class HomeControllerTest < ActionController::TestCase + test "should get index" do + get :index + assert_response :success + end + +end diff --git a/test/functional/people_controller_test.rb b/test/functional/people_controller_test.rb new file mode 100755 index 0000000..27b798a --- /dev/null +++ b/test/functional/people_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class PeopleControllerTest < ActionController::TestCase + setup do + @person = people(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:people) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create person" do + assert_difference('Person.count') do + post :create, :person => @person.attributes + end + + assert_redirected_to person_path(assigns(:person)) + end + + test "should show person" do + get :show, :id => @person.to_param + assert_response :success + end + + test "should get edit" do + get :edit, :id => @person.to_param + assert_response :success + end + + test "should update person" do + put :update, :id => @person.to_param, :person => @person.attributes + assert_redirected_to person_path(assigns(:person)) + end + + test "should destroy person" do + assert_difference('Person.count', -1) do + delete :destroy, :id => @person.to_param + end + + assert_redirected_to people_path + end +end diff --git a/test/functional/sperrens_controller_test.rb b/test/functional/sperrens_controller_test.rb new file mode 100755 index 0000000..ef7a84f --- /dev/null +++ b/test/functional/sperrens_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class SperrensControllerTest < ActionController::TestCase + setup do + @sperren = sperrens(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:sperrens) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create sperren" do + assert_difference('Sperren.count') do + post :create, :sperren => @sperren.attributes + end + + assert_redirected_to sperren_path(assigns(:sperren)) + end + + test "should show sperren" do + get :show, :id => @sperren.to_param + assert_response :success + end + + test "should get edit" do + get :edit, :id => @sperren.to_param + assert_response :success + end + + test "should update sperren" do + put :update, :id => @sperren.to_param, :sperren => @sperren.attributes + assert_redirected_to sperren_path(assigns(:sperren)) + end + + test "should destroy sperren" do + assert_difference('Sperren.count', -1) do + delete :destroy, :id => @sperren.to_param + end + + assert_redirected_to sperrens_path + end +end diff --git a/test/unit/album_test.rb b/test/unit/album_test.rb index f95b6e1..b3e25a3 100755 --- a/test/unit/album_test.rb +++ b/test/unit/album_test.rb @@ -2,7 +2,9 @@ class AlbumTest < ActiveSupport::TestCase setup do - @album = Album.new(:title => "album1") + @title1 = "album1" + @title2 = "album2" + @album = Album.new(:title => @title1) end test "should not save album without title" do @@ -25,9 +27,9 @@ class AlbumTest < ActiveSupport::TestCase test "should update attributes of album" do @album.save - @album.update_attributes(:title => "neues album1") + @album.update_attributes(:title => @title2) expected = Album.find(@album.id) - assert @album.update_attributes(:title => "neues album1") && expected.title == "neues album1", "did not updated attributes of album" + assert @album.update_attributes(:title => @title2) && expected.title == @title2, "did not updated attributes of album" end def teardown diff --git a/test/unit/comment_test.rb b/test/unit/comment_test.rb index 916d82d..8257991 100755 --- a/test/unit/comment_test.rb +++ b/test/unit/comment_test.rb @@ -2,7 +2,9 @@ class CommentTest < ActiveSupport::TestCase setup do - @comment = Comment.new(:body => "Beschreibung für photo1") + @body1 = "Beschreibung für photo1" + @body2 = "Beschreibung für photo2" + @comment = Comment.new(:body => @body1) end test "should not save comment without body" do @@ -15,11 +17,21 @@ class CommentTest < ActiveSupport::TestCase end test "should respond to author" do + @comment.save assert_respond_to @comment, :author, "do not belongs to author" + author = @comment.author + if author + assert_kind_of Person, author, "author of wrong type" + end end test "should respond to photos" do - assert_respond_to @comment, :photos, "do not have photos" + @comment.save + assert_respond_to @comment, :photos, "do not belongs to photo" + photo = @comment.photo + if photo + assert_kind_of Photo, photo, "photo of wrong type" + end end test "should delete comment" do @@ -33,9 +45,9 @@ class CommentTest < ActiveSupport::TestCase test "should update attributes of comment" do @comment.save - @comment.update_attributes(:body => "Neue Beschreibung für Foto") + @comment.update_attributes(:body => @body2) expected = Comment.find(@comment.id) - assert @comment.update_attributes(:body => "Neue Beschreibung für Foto") && expected.body == "Neue Beschreibung für Foto", "did not updated attributes of comment" + assert @comment.update_attributes(:body => @body2) && expected.body == @body2, "did not updated attributes of comment" end def teardown diff --git a/test/unit/helpers/home_helper_test.rb b/test/unit/helpers/home_helper_test.rb new file mode 100755 index 0000000..4740a18 --- /dev/null +++ b/test/unit/helpers/home_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class HomeHelperTest < ActionView::TestCase +end diff --git a/test/unit/helpers/people_helper_test.rb b/test/unit/helpers/people_helper_test.rb new file mode 100755 index 0000000..d554493 --- /dev/null +++ b/test/unit/helpers/people_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class PeopleHelperTest < ActionView::TestCase +end diff --git a/test/unit/helpers/sperrens_helper_test.rb b/test/unit/helpers/sperrens_helper_test.rb new file mode 100755 index 0000000..3ba4fae --- /dev/null +++ b/test/unit/helpers/sperrens_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class SperrensHelperTest < ActionView::TestCase +end diff --git a/test/unit/person_test.rb b/test/unit/person_test.rb new file mode 100755 index 0000000..810103c --- /dev/null +++ b/test/unit/person_test.rb @@ -0,0 +1,103 @@ +require 'test_helper' + +class PersonTest < ActiveSupport::TestCase + setup do + @person = Person.new(:username => "Admin", :password => "abc123", :domain => "Munich", :email => "admin@theWeb.de", :lastName => "Mustermann", :firstName => "Max", :status => true, :blockedTo => "20.05.2011", :typ => "2") + end + + test "shouldn't save without username password domain email" do + person = Person.new + assert !person.save, "shouldn't save person" + end + + test "shouldn't save without email" do + person = Person.new(:username => "Admin", :password => "abc123", :domain => "Munich") + assert !person.save, "shouldn't save person" + end + + test "shouldn't save without domain" do + person = Person.new(:username => "Admin", :password => "abc123", :email => "admin@theWeb.de") + assert !person.save, "shouldn't save person" + end + + test "shouldn't save without password" do + person = Person.new(:username => "Admin", :domain => "Munich", :email => "admin@theWeb.de") + assert !person.save, "shouldn't save person" + end + + test "shouldn't save without username" do + person = Person.new(:password => "abc123", :domain => "Munich", :email => "admin@theWeb.de") + assert !person.save, "shouldn't save person" + end + + test "should save Person" do + assert @person.save, "should have saved Person" + end + + test "ckeck if last Name ist saved correct" do + person = Person.new(:username => "Admin", :password => "abc123", :domain => "Munich", :email => "admin@theWeb.de", :lastName => "Mustermann") + person.save + assert_equal(person.lastName, "Mustermann", "Lastname wasn't saved.") + end + + test "ckeck if first Name ist saved correct" do + person = Person.new(:username => "Admin", :password => "abc123", :domain => "Munich", :email => "admin@theWeb.de", :firstName => "Max") + person.save + assert_equal(person.firstName, "Max", "Firstname wasn't saved.") + end + + test "ckeck if Domain ist saved correct" do + person = Person.new(:username => "Admin", :password => "abc123", :domain => "Munich", :email => "admin@theWeb.de") + person.save + assert_equal(person.domain, "Munich", "Lastname wasn't saved.") + end + + test "ckeck if Status ist saved correct" do + person = Person.new(:username => "Admin", :password => "abc123", :domain => "Munich", :email => "admin@theWeb.de", :status => true) + person.save + assert person.status, "Status didn't got saved." + end + + test "ckeck if blockedTo ist saved correct" do + person = Person.new(:username => "Admin", :password => "abc123", :domain => "Munich", :email => "admin@theWeb.de", :blockedTo => "20.05.2011") + person.save + assert_equal(person.blockedTo.to_s, '2011-05-20', "Blocked date wasn't saved.") + end + + test "ckeck if typ ist saved correct" do + person = Person.new(:username => "Admin", :password => "abc123", :domain => "Munich", :email => "admin@theWeb.de", :typ => "2") + person.save + assert_equal(person.typ, 2, "Typ wasn't saved.") + end + + test "ckeck if signatur ist saved correct" do + person = Person.new(:username => "Admin", :password => "abc123", :domain => "Munich", :email => "admin@theWeb.de", :signatur => "This is a text, as Signatur") + person.save + assert_equal(person.signatur, "This is a text, as Signatur", "Signatur wasn't saved.") + end + + test "test unique user name " do + @person.save + person = Person.new(:username => "Admin", :password => "abc123", :domain => "Munich", :email => "admin@theWeb.de") + assert !person.save, "shouldn't save secound Admin" + end + + test "e-mail have to be valid, without @" do + person = Person.new(:username => "Admin", :password => "abc123", :domain => "Munich", :email => "admintheWeb.de") + assert !person.save, "False Mailadresse was accepted" + end + + test "e-mail have to be valid, without domain" do + person = Person.new(:username => "Admin", :password => "abc123", :domain => "Munich", :email => "admin@theWeb") + assert !person.save, "False Mailadresse was accepted" + end + + test "e-mail have to be valid, with unallowed symbols" do + person = Person.new(:username => "Admin", :password => "abc123", :domain => "Munich", :email => "admin@the|Web.de") + assert !person.save, "False Mailadresse was accepted" + end + + def teardown + @person = nil + end +end diff --git a/test/unit/photo_test.rb b/test/unit/photo_test.rb index b5c56db..3c59482 100755 --- a/test/unit/photo_test.rb +++ b/test/unit/photo_test.rb @@ -2,28 +2,63 @@ class PhotoTest < ActiveSupport::TestCase setup do - @photo = Photo.new(:title => "photo1") + @title1 = "photo1" + @title2 = "photo2" + @file1 = File.new(Rails.root.join("test/fixtures/15.jpg")) + @file2 = File.new(Rails.root.join("test/fixtures/13.jpg")) + @comment1 = Comment.new(:body => "Beschreibung für photo1") + @photo = Photo.new(:title => @title1, :image => @file1, :comments => [ @comment1 ]) end test "should not save photo without title" do - photo = Photo.new - assert !photo.save, "saved photo without title" + photo1 = Photo.new + photo2 = Photo.new(:image => @file1) + assert !photo1.save && !photo2.save, "saved photo without title" + end + + test "should not save photo without image" do + photo = Photo.new(:title => @title1) + assert !photo.save, "saved photo without image" end test "should create photo" do assert @photo.save, "did not create photo" end - test "should respond to owner" do + test "should belong to owner" do + @photo.save assert_respond_to @photo, :owner, "do not belongs to owner" + owner = @photo.owner + if owner + assert_kind_of Person, owner, "owner of wrong type" + end end - test "should respond to comment" do + test "should belong to album" do + @photo.save + assert_respond_to @photo, :album, "do not belongs to album" + album = @photo.album + if album + assert_kind_of Album, album, "album of wrong type" + end + end + + test "should belong to comment" do + @photo.save assert_respond_to @photo, :comment, "do not belongs to comment" + comment = @photo.comment + if comment + assert_kind_of Comment, comment, "comment of wrong type" + end end test "should respond to comments" do + @photo.save assert_respond_to @photo, :comments, "do not have comments" + comment = @photo.comments.first + if comment + assert_kind_of Comment, comment, "comment of wrong type" + end end test "should delete photo" do @@ -37,9 +72,20 @@ class PhotoTest < ActiveSupport::TestCase test "should update attributes of photo" do @photo.save - @photo.update_attributes(:title => "neues photo1") + update = @photo.update_attributes(:title => @title2, :image => @file2) expected = Photo.find(@photo.id) - assert @photo.update_attributes(:title => "neues photo1") && expected.title == "neues photo1", "did not updated attributes of photo" + assert update && expected.title == @title2 && expected.image_file_name == File.basename(@file2.path), "did not updated attributes of photo" + end + + test "should upload photo" do + #image = "" + #file = Rack::Test::UploadedFile.new(image, "image/png") + #??? + # check if uploaded file is present in image directory + #@photo.attachment = File.new("test/fixtures/sample_file.png") + #file = File.new("../test/fixtures/15.jpg") + #photo = Photo.new(:title => "photo1", :image => file) + #assert photo.save end def teardown diff --git a/test/unit/sperren_test.rb b/test/unit/sperren_test.rb new file mode 100755 index 0000000..f3ee496 --- /dev/null +++ b/test/unit/sperren_test.rb @@ -0,0 +1,24 @@ +require 'test_helper' + +class SperrenTest < ActiveSupport::TestCase + test "Sperre ohne Start Datum" do + sperre = Sperren.new(:endDate => "18.05.2011", :reason => "insult" ) + assert !sperre.save, "Sperre wurde ohne Startdatum gespeichert" + end + + test "Sperre ohne End Datum" do + sperre = Sperren.new(:startDate => "18.05.2011", :reason => "insult" ) + assert !sperre.save, "Sperre wurde ohne Enddatum gespeichert" + end + + test "Sperre ohne Grund" do + sperre = Sperren.new(:startDate => "18.05.2011", :endDate => "19.05.2011" ) + assert !sperre.save, "Sperre wurde ohne Grund gespeichert" + end + + test "Sperre sollte gespeichert werden" do + sperre = Sperren.new(:startDate => "10.05.2011", :endDate => "18.05.2011", :reason => "insult" ) + assert sperre.save, "Sperre wurde nicht erstellt" + end + +end