@@ -5,12 +5,12 | |||
|
5 | 5 | # modify it under the terms of the GNU General Public License |
|
6 | 6 | # as published by the Free Software Foundation; either version 2 |
|
7 | 7 | # of the License, or (at your option) any later version. |
|
8 |
# |
|
|
8 | # | |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 |
# |
|
|
13 | # | |
|
14 | 14 | # You should have received a copy of the GNU General Public License |
|
15 | 15 | # along with this program; if not, write to the Free Software |
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
@@ -25,9 +25,9 class NewsController < ApplicationController | |||
|
25 | 25 | before_filter :find_optional_project, :only => :index |
|
26 | 26 | accept_rss_auth :index |
|
27 | 27 | accept_api_auth :index |
|
28 | ||
|
28 | ||
|
29 | 29 | helper :watchers |
|
30 | ||
|
30 | ||
|
31 | 31 | def index |
|
32 | 32 | case params[:format] |
|
33 | 33 | when 'xml', 'json' |
@@ -35,9 +35,9 class NewsController < ApplicationController | |||
|
35 | 35 | else |
|
36 | 36 | @limit = 10 |
|
37 | 37 | end |
|
38 | ||
|
38 | ||
|
39 | 39 | scope = @project ? @project.news.visible : News.visible |
|
40 | ||
|
40 | ||
|
41 | 41 | @news_count = scope.count |
|
42 | 42 | @news_pages = Paginator.new self, @news_count, @limit, params['page'] |
|
43 | 43 | @offset ||= @news_pages.current.offset |
@@ -45,14 +45,14 class NewsController < ApplicationController | |||
|
45 | 45 | :order => "#{News.table_name}.created_on DESC", |
|
46 | 46 | :offset => @offset, |
|
47 | 47 | :limit => @limit) |
|
48 | ||
|
48 | ||
|
49 | 49 | respond_to do |format| |
|
50 | 50 | format.html { render :layout => false if request.xhr? } |
|
51 | 51 | format.api |
|
52 | 52 | format.atom { render_feed(@newss, :title => (@project ? @project.name : Setting.app_title) + ": #{l(:label_news_plural)}") } |
|
53 | 53 | end |
|
54 | 54 | end |
|
55 | ||
|
55 | ||
|
56 | 56 | def show |
|
57 | 57 | @comments = @news.comments |
|
58 | 58 | @comments.reverse! if User.current.wants_comments_in_reverse_order? |
@@ -77,7 +77,7 class NewsController < ApplicationController | |||
|
77 | 77 | |
|
78 | 78 | def edit |
|
79 | 79 | end |
|
80 | ||
|
80 | ||
|
81 | 81 | def update |
|
82 | 82 | if request.put? and @news.update_attributes(params[:news]) |
|
83 | 83 | flash[:notice] = l(:notice_successful_update) |
@@ -91,14 +91,14 class NewsController < ApplicationController | |||
|
91 | 91 | @news.destroy |
|
92 | 92 | redirect_to :action => 'index', :project_id => @project |
|
93 | 93 | end |
|
94 | ||
|
94 | ||
|
95 | 95 | private |
|
96 | 96 | def find_project |
|
97 | 97 | @project = Project.find(params[:project_id]) |
|
98 | 98 | rescue ActiveRecord::RecordNotFound |
|
99 | 99 | render_404 |
|
100 | 100 | end |
|
101 | ||
|
101 | ||
|
102 | 102 | def find_optional_project |
|
103 | 103 | return true unless params[:project_id] |
|
104 | 104 | @project = Project.find(params[:project_id]) |
General Comments 0
You need to be logged in to leave comments.
Login now