Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 206
- Log:
Initial import of Gullery, an open source photo gallery:
http://nubyonrails.com/pages/gullery
- Author:
- rool
- Date:
- Sun May 20 19:05:59 +0100 2007
- Size:
- 1128 Bytes
1 | class ProjectsController < ApplicationController |
2 | |
3 | before_filter :login_required, :only => [:create, :update_description, :destroy, :sort] |
4 | |
5 | def index |
6 | if User.count == 0 |
7 | redirect_to signup_url |
8 | return |
9 | end |
10 | @user = User.find_first |
11 | @projects = Project.find :all, :order => 'position, created_at' |
12 | end |
13 | |
14 | def show |
15 | @project = Project.find @params[:id] |
16 | end |
17 | |
18 | def create |
19 | @project = Project.new @params[:project] |
20 | @project.user_id = current_user.id |
21 | if @project.save |
22 | redirect_to projects_url |
23 | else |
24 | render :action => 'error' |
25 | end |
26 | end |
27 | |
28 | def update_description |
29 | @project = Project.find @params[:id] |
30 | @project.description = @params[:value] |
31 | if @project.save |
32 | render :text => textilize(@project.description) |
33 | end |
34 | end |
35 | |
36 | def destroy |
37 | @project = Project.find @params[:id] |
38 | @project.destroy |
39 | end |
40 | |
41 | def sort |
42 | project_ids = @params[:project_list] |
43 | project_ids.each_with_index do |project_id, index| |
44 | project = Project.find project_id |
45 | project.update_attribute(:position, index) |
46 | end |
47 | render :nothing => true |
48 | end |
49 | |
50 | end |