#
# SETTINGS
#
+ # TODO - remove from ApplicationController
def by_category_name(categories)
Api::Utils.insensitive_sort(categories) { |category| category_name(category) }
end
+ # TODO - remove from ApplicationController
def by_subcategory_name(category, subcategories)
Api::Utils.insensitive_sort(subcategories) { |subcategory|
if (subcategory == category)
}
end
+ # TODO - remove from ApplicationController
def category_name(category)
# Try with lowercase key then with original key for backward compatibility
message("property.category.#{category.key}", :default => message("property.category.#{category.originalKey}", :default => category.originalKey))
end
+ # TODO - remove from ApplicationController
def subcategory_name(category, subcategory)
if (category.key == subcategory.key)
# If subcategory == category then it is the default one
end
end
+ # TODO - remove from ApplicationController
def processProperties(definitions_per_category)
@categories = by_category_name(definitions_per_category.keys)
end
def create_form
- @groups = Group.find(:all, :order => 'name')
if params[:id]
+ # TODO is it used ?
@group = Group.find(params[:id])
else
@group = Group.new
if params[:id]
@group = Group.find(params[:id])
else
+ # TODO is it used ?
@group = Group.new
end
render :partial => 'groups/edit_form'
end
def create
+ verify_post_request
group = Group.new(params[:group])
if group.save
flash[:notice] = 'The new group is created.'
end
def update
+ verify_post_request
group = Group.find(params[:id])
if group.update_attributes(params[:group])
flash[:notice] = 'Group is updated.'
end
def delete
+ verify_post_request
group = Group.find(params[:id])
if group.destroy
flash[:notice] = 'Group is deleted.'
redirect_to(:action => 'index')
end
- def to_index(errors, id)
- if !errors.empty?
- flash[:error] = errors.full_messages.join("<br/>\n")
- end
+ private
+
+ def to_index(errors, id)
+ flash[:error] = errors.full_messages.join("<br/>\n") unless errors.empty?
redirect_to(:action => 'index', :id => id)
end
end
def create_form
- init_users_list
if params[:id]
+ # TODO is it really used ?
@user = User.find(params[:id])
else
@user = User.new
end
def reactivate_form
- init_users_list
if params[:id]
@user = User.find(params[:id])
else
end
def edit_form
- init_users_list
@user = User.find(params[:id])
render :partial => 'users/edit_form', :status => 200
end
def change_password_form
- init_users_list
@user = User.find(params[:id])
render :partial => 'users/change_password_form', :status => 200
end