annotate app/controllers/issue_statuses_controller.rb @ 976:0befb332f41a get_statistics

get stats up to current date
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Thu, 25 Oct 2012 13:50:45 +0100
parents cbb26bc654de
children 433d4f72a19b
rev   line source
Chris@909 1 # Redmine - project management software
Chris@909 2 # Copyright (C) 2006-2011 Jean-Philippe Lang
Chris@0 3 #
Chris@0 4 # This program is free software; you can redistribute it and/or
Chris@0 5 # modify it under the terms of the GNU General Public License
Chris@0 6 # as published by the Free Software Foundation; either version 2
Chris@0 7 # of the License, or (at your option) any later version.
Chris@909 8 #
Chris@0 9 # This program is distributed in the hope that it will be useful,
Chris@0 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@0 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@0 12 # GNU General Public License for more details.
Chris@909 13 #
Chris@0 14 # You should have received a copy of the GNU General Public License
Chris@0 15 # along with this program; if not, write to the Free Software
Chris@0 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Chris@0 17
Chris@0 18 class IssueStatusesController < ApplicationController
Chris@0 19 layout 'admin'
Chris@0 20
Chris@909 21 before_filter :require_admin, :except => :index
Chris@909 22 before_filter :require_admin_or_api_request, :only => :index
Chris@909 23 accept_api_auth :index
Chris@909 24
Chris@0 25 def index
Chris@909 26 respond_to do |format|
Chris@909 27 format.html {
Chris@909 28 @issue_status_pages, @issue_statuses = paginate :issue_statuses, :per_page => 25, :order => "position"
Chris@909 29 render :action => "index", :layout => false if request.xhr?
Chris@909 30 }
Chris@909 31 format.api {
Chris@909 32 @issue_statuses = IssueStatus.all(:order => 'position')
Chris@909 33 }
Chris@909 34 end
Chris@0 35 end
Chris@0 36
Chris@0 37 def new
Chris@0 38 @issue_status = IssueStatus.new
Chris@0 39 end
Chris@0 40
Chris@0 41 def create
Chris@0 42 @issue_status = IssueStatus.new(params[:issue_status])
Chris@909 43 if request.post? && @issue_status.save
Chris@0 44 flash[:notice] = l(:notice_successful_create)
Chris@0 45 redirect_to :action => 'index'
Chris@0 46 else
Chris@0 47 render :action => 'new'
Chris@0 48 end
Chris@0 49 end
Chris@0 50
Chris@0 51 def edit
Chris@0 52 @issue_status = IssueStatus.find(params[:id])
Chris@0 53 end
Chris@0 54
Chris@0 55 def update
Chris@0 56 @issue_status = IssueStatus.find(params[:id])
Chris@909 57 if request.put? && @issue_status.update_attributes(params[:issue_status])
Chris@0 58 flash[:notice] = l(:notice_successful_update)
Chris@0 59 redirect_to :action => 'index'
Chris@0 60 else
Chris@0 61 render :action => 'edit'
Chris@0 62 end
Chris@0 63 end
Chris@0 64
Chris@909 65 verify :method => :delete, :only => :destroy, :redirect_to => { :action => :index }
Chris@0 66 def destroy
Chris@0 67 IssueStatus.find(params[:id]).destroy
Chris@0 68 redirect_to :action => 'index'
Chris@0 69 rescue
Chris@0 70 flash[:error] = l(:error_unable_delete_issue_status)
Chris@0 71 redirect_to :action => 'index'
Chris@0 72 end
Chris@909 73
Chris@0 74 def update_issue_done_ratio
Chris@909 75 if request.post? && IssueStatus.update_issue_done_ratios
Chris@0 76 flash[:notice] = l(:notice_issue_done_ratios_updated)
Chris@0 77 else
Chris@0 78 flash[:error] = l(:error_issue_done_ratios_not_updated)
Chris@0 79 end
Chris@0 80 redirect_to :action => 'index'
Chris@0 81 end
Chris@0 82 end