##// END OF EJS Templates
Don't add the inclusion error when tracker is not set, the blank error is enough....
Don't add the inclusion error when tracker is not set, the blank error is enough. git-svn-id: http://svn.redmine.org/redmine/trunk@15492 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r14954:42b5c332b2c2
r15110:90d14b71b365
Show More
custom_fields_controller.rb
96 lines | 2.8 KiB | text/x-ruby | RubyLexer
/ app / controllers / custom_fields_controller.rb
Jean-Philippe Lang
CustomFieldsController#list moved to #index....
r2272 # Redmine - project management software
Jean-Philippe Lang
Updates copyright for 2016....
r14856 # Copyright (C) 2006-2016 Jean-Philippe Lang
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 #
# 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.
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/custom_fields_controller.rb....
r6781 #
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 # 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.
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/custom_fields_controller.rb....
r6781 #
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 # 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 CustomFieldsController < ApplicationController
Jean-Philippe Lang
Adds an admin layout that displays the admin menu in the sidebar....
r3062 layout 'admin'
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/custom_fields_controller.rb....
r6781
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 before_filter :require_admin
Jean-Philippe Lang
Resourcified custom fields....
r8024 before_filter :build_new_custom_field, :only => [:new, :create]
before_filter :find_custom_field, :only => [:edit, :update, :destroy]
Jean-Philippe Lang
REST API: custom fields definition (#11159)....
r11935 accept_api_auth :index
Jean-Philippe Lang
0.3 unstable...
r10
Jean-Philippe Lang
Initial commit...
r2 def index
Jean-Philippe Lang
REST API: custom fields definition (#11159)....
r11935 respond_to do |format|
format.html {
@custom_fields_by_type = CustomField.all.group_by {|f| f.class.name }
}
format.api {
@custom_fields = CustomField.all
}
end
Jean-Philippe Lang
Initial commit...
r2 end
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/custom_fields_controller.rb....
r6781
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 def new
Jean-Philippe Lang
Merged custom fields format refactoring....
r12125 @custom_field.field_format = 'string' if @custom_field.field_format.blank?
@custom_field.default_value = nil
Jean-Philippe Lang
Resourcified custom fields....
r8024 end
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/custom_fields_controller.rb....
r6781
Jean-Philippe Lang
Resourcified custom fields....
r8024 def create
Jean-Philippe Lang
Code cleanup....
r10755 if @custom_field.save
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 flash[:notice] = l(:notice_successful_create)
Eric Davis
Added several more plugin hooks:...
r2535 call_hook(:controller_custom_fields_new_after_save, :params => params, :custom_field => @custom_field)
Jean-Philippe Lang
Redirect to custom field after create or update....
r14364 redirect_to edit_custom_field_path(@custom_field)
Toshi MARUYAMA
Fix potential Execution After Redirect bugs....
r5491 else
Jean-Philippe Lang
Resourcified custom fields....
r8024 render :action => 'new'
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 end
end
def edit
Jean-Philippe Lang
Resourcified custom fields....
r8024 end
def update
Jean-Philippe Lang
Code cleanup....
r10755 if @custom_field.update_attributes(params[:custom_field])
Eric Davis
Added several more plugin hooks:...
r2535 call_hook(:controller_custom_fields_edit_after_save, :params => params, :custom_field => @custom_field)
Jean-Philippe Lang
Lists can be reordered with drag and drop (#12909)....
r14954 respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_update)
redirect_back_or_default edit_custom_field_path(@custom_field)
}
format.js { render :nothing => true }
end
Toshi MARUYAMA
Fix potential Execution After Redirect bugs....
r5491 else
Jean-Philippe Lang
Lists can be reordered with drag and drop (#12909)....
r14954 respond_to do |format|
format.html { render :action => 'edit' }
format.js { render :nothing => true, :status => 422 }
end
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 end
end
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/custom_fields_controller.rb....
r6781
Jean-Philippe Lang
Initial commit...
r2 def destroy
Jean-Philippe Lang
Code cleanup....
r10755 begin
@custom_field.destroy
rescue
flash[:error] = l(:error_can_not_delete_custom_field)
end
Jean-Philippe Lang
Use named routes in controllers....
r10752 redirect_to custom_fields_path(:tab => @custom_field.class.name)
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 end
Jean-Philippe Lang
Resourcified custom fields....
r8024
private
def build_new_custom_field
@custom_field = CustomField.new_subclass_instance(params[:type], params[:custom_field])
if @custom_field.nil?
Jean-Philippe Lang
Show tabs for existing custom field types only and adds a view for choosing the type when adding a new custom field....
r12574 render :action => 'select_type'
Jean-Philippe Lang
Resourcified custom fields....
r8024 end
end
def find_custom_field
@custom_field = CustomField.find(params[:id])
rescue ActiveRecord::RecordNotFound
render_404
end
Jean-Philippe Lang
Initial commit...
r2 end