diff app/controllers/news_controller.rb @ 909:cbb26bc654de redmine-1.3

Update to Redmine 1.3-stable branch (Redmine SVN rev 8964)
author Chris Cannam
date Fri, 24 Feb 2012 19:09:32 +0000
parents 0c939c159af4
children 5f33065ddc4b
line wrap: on
line diff
--- a/app/controllers/news_controller.rb	Fri Feb 24 18:36:29 2012 +0000
+++ b/app/controllers/news_controller.rb	Fri Feb 24 19:09:32 2012 +0000
@@ -5,12 +5,12 @@
 # modify it under the terms of the GNU General Public License
 # as published by the Free Software Foundation; either version 2
 # of the License, or (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
@@ -25,9 +25,9 @@
   before_filter :find_optional_project, :only => :index
   accept_rss_auth :index
   accept_api_auth :index
-  
+
   helper :watchers
-  
+
   def index
     case params[:format]
     when 'xml', 'json'
@@ -35,9 +35,9 @@
     else
       @limit =  10
     end
-    
+
     scope = @project ? @project.news.visible : News.visible
-    
+
     @news_count = scope.count
     @news_pages = Paginator.new self, @news_count, @limit, params['page']
     @offset ||= @news_pages.current.offset
@@ -45,14 +45,17 @@
                                        :order => "#{News.table_name}.created_on DESC",
                                        :offset => @offset,
                                        :limit => @limit)
-    
+
     respond_to do |format|
-      format.html { render :layout => false if request.xhr? }
+      format.html {
+        @news = News.new # for adding news inline
+        render :layout => false if request.xhr?
+      }
       format.api
       format.atom { render_feed(@newss, :title => (@project ? @project.name : Setting.app_title) + ": #{l(:label_news_plural)}") }
     end
   end
-  
+
   def show
     @comments = @news.comments
     @comments.reverse! if User.current.wants_comments_in_reverse_order?
@@ -77,7 +80,7 @@
 
   def edit
   end
-  
+
   def update
     if request.put? and @news.update_attributes(params[:news])
       flash[:notice] = l(:notice_successful_update)
@@ -91,14 +94,14 @@
     @news.destroy
     redirect_to :action => 'index', :project_id => @project
   end
-  
+
 private
   def find_project
     @project = Project.find(params[:project_id])
   rescue ActiveRecord::RecordNotFound
     render_404
   end
-  
+
   def find_optional_project
     return true unless params[:project_id]
     @project = Project.find(params[:project_id])