Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 13
- Log:
Initial import of Typo 2.6.0 sources from a downloaded Tarball.
Typo is a Ruby On Rails based blog engine.
- Author:
- adh
- Date:
- Sat Jul 22 22:25:02 +0100 2006
- Size:
- 2457 Bytes
1 | class Admin::ContentController < Admin::BaseController |
2 | |
3 | cache_sweeper :blog_sweeper |
4 | |
5 | def index |
6 | list |
7 | render_action 'list' |
8 | end |
9 | |
10 | def list |
11 | @articles_pages, @articles = paginate :article, :per_page => 15, :order_by => "created_at DESC", :parameter => 'id' |
12 | @categories = Category.find(:all) |
13 | @article = Article.new(params[:article]) |
14 | @article.text_filter = config[:text_filter] |
15 | end |
16 | |
17 | def show |
18 | @article = Article.find(params[:id]) |
19 | @categories = Category.find(:all, :order => 'name') |
20 | end |
21 | |
22 | def new |
23 | @article = Article.new(params[:article]) |
24 | @article.author = session[:user].login |
25 | @article.allow_comments ||= config[:default_allow_comments] |
26 | @article.allow_pings ||= config[:default_allow_pings] |
27 | @article.text_filter ||= config[:text_filter] |
28 | @article.user = session[:user] |
29 | |
30 | @categories = Category.find_all |
31 | if request.post? |
32 | @article.categories.clear |
33 | @article.categories << Category.find(params[:categories]) if params[:categories] |
34 | if @article.save |
35 | flash[:notice] = 'Article was successfully created.' |
36 | redirect_to :action => 'show', :id => @article.id |
37 | end |
38 | end |
39 | end |
40 | |
41 | def edit |
42 | @article = Article.find(params[:id]) |
43 | @article.attributes = params[:article] |
44 | @categories = Category.find_all |
45 | @selected = @article.categories.collect { |cat| cat.id.to_i } |
46 | if request.post? |
47 | @article.categories.clear |
48 | @article.categories << Category.find(params[:categories]) if params[:categories] |
49 | if @article.save |
50 | flash[:notice] = 'Article was successfully updated.' |
51 | redirect_to :action => 'show', :id => @article.id |
52 | end |
53 | end |
54 | end |
55 | |
56 | def destroy |
57 | @article = Article.find(params[:id]) |
58 | if request.post? |
59 | @article.destroy |
60 | redirect_to :action => 'list' |
61 | end |
62 | end |
63 | |
64 | def category_add |
65 | @article = Article.find(params[:id]) |
66 | @category = Category.find(params[:category_id]) |
67 | @article.categories << @category |
68 | @article.save |
69 | redirect_to :action => 'show', :id => @article.id |
70 | end |
71 | |
72 | def category_remove |
73 | @article = Article.find(params[:id]) |
74 | @category = Category.find(params[:category_id]) |
75 | @article.categories.delete(@category) |
76 | @article.save |
77 | redirect_to :action => 'show', :id => @article.id |
78 | end |
79 | |
80 | def preview |
81 | @headers["Content-Type"] = "text/html; charset=utf-8" |
82 | @article = params[:article] |
83 | render :layout => false |
84 | end |
85 | |
86 | end |