admin_controller.rb
56 lines
| 1.8 KiB
| text/x-ruby
|
RubyLexer
|
r2 | # redMine - project management software | ||
# Copyright (C) 2006 Jean-Philippe Lang | ||||
# | ||||
# This program is free software; you can redistribute it and/or | ||||
# 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. | ||||
class AdminController < ApplicationController | ||||
|
r5 | layout 'base' | ||
before_filter :require_admin | ||||
helper :sort | ||||
include SortHelper | ||||
|
r2 | |||
|
r5 | def index | ||
end | ||||
|
r2 | |||
def projects | ||||
|
r5 | sort_init 'name', 'asc' | ||
sort_update | ||||
@project_count = Project.count | ||||
@project_pages = Paginator.new self, @project_count, | ||||
15, | ||||
|
r124 | params['page'] | ||
|
r5 | @projects = Project.find :all, :order => sort_clause, | ||
:limit => @project_pages.items_per_page, | ||||
|
r31 | :offset => @project_pages.current.offset | ||
render :action => "projects", :layout => false if request.xhr? | ||||
|
r2 | end | ||
|
r5 | |||
|
r2 | def mail_options | ||
|
r5 | @actions = Permission.find(:all, :conditions => ["mail_option=?", true]) || [] | ||
|
r2 | if request.post? | ||
@actions.each { |a| | ||||
|
r5 | a.mail_enabled = (params[:action_ids] || []).include? a.id.to_s | ||
|
r2 | a.save | ||
} | ||||
|
r15 | flash.now[:notice] = l(:notice_successful_update) | ||
|
r2 | end | ||
end | ||||
def info | ||||
@adapter_name = ActiveRecord::Base.connection.adapter_name | ||||
|
r5 | end | ||
|
r2 | end | ||