Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 448
- Log:
Various forum patches to work better with page and per-page parameters
during replies and editing inside topics. Fixes Ticket #351.
- Author:
- rool
- Date:
- Tue Sep 03 02:56:46 +0100 2013
- Size:
- 2065 Bytes
1 | class ForumsController < ApplicationController |
2 | before_filter :find_or_initialize_forum, :except => :index |
3 | |
4 | @@hubssolib_permissions = HubSsoLib::Permissions.new({ |
5 | :new => [ :admin, :webmaster ], |
6 | :create => [ :admin, :webmaster ], |
7 | :edit => [ :admin, :webmaster ], |
8 | :update => [ :admin, :webmaster ], |
9 | :destroy => [ :admin, :webmaster ], |
10 | }) |
11 | |
12 | def ForumsController.hubssolib_permissions |
13 | @@hubssolib_permissions |
14 | end |
15 | |
16 | def index |
17 | @forums = Forum.find(:all, :order => "position") |
18 | |
19 | respond_to do |format| |
20 | format.html |
21 | format.xml { render :xml => @forums.to_xml } |
22 | end |
23 | end |
24 | |
25 | def show |
26 | respond_to do |format| |
27 | format.html do |
28 | # keep track of when we last viewed this forum for activity indicators |
29 | (session[:forums] ||= {})[@forum.id] = Time.now.utc if logged_in? |
30 | @topic_pages, @topics = paginate(:topics, :per_page => 25, :conditions => ['forum_id = ?', params[:id]], :include => :replied_by_user, :order => 'sticky desc, replied_at desc') |
31 | end |
32 | |
33 | format.xml do |
34 | render :xml => @forum.to_xml |
35 | end |
36 | end |
37 | end |
38 | |
39 | # new renders new.rhtml |
40 | |
41 | def create |
42 | @forum.attributes = params[:forum] |
43 | @forum.save! |
44 | respond_to do |format| |
45 | format.html { redirect_to forums_path } |
46 | format.xml { head :created, :location => formatted_forum_url(:id => @forum, :format => :xml) } |
47 | end |
48 | end |
49 | |
50 | def update |
51 | @forum.attributes = params[:forum] |
52 | @forum.save! |
53 | respond_to do |format| |
54 | format.html { redirect_to forums_path } |
55 | format.xml { head 200 } |
56 | end |
57 | end |
58 | |
59 | def destroy |
60 | @forum.destroy |
61 | respond_to do |format| |
62 | format.html { redirect_to forums_path } |
63 | format.xml { head 200 } |
64 | end |
65 | end |
66 | |
67 | protected |
68 | def find_or_initialize_forum |
69 | @forum = params[:id] ? Forum.find(params[:id]) : Forum.new |
70 | end |
71 | |
72 | alias authorized? admin? |
73 | end |