app/controllers/admin/schools_controller.rb in scidea-schools-1.0.1 vs app/controllers/admin/schools_controller.rb in scidea-schools-1.0.2
- old
+ new
@@ -10,10 +10,15 @@
has_widgets do |root|
root << widget(:paginated_list) << widget(:datatable)
end
+ def initialize
+ super
+ @sort_columns = %w[name city state zipcode approved]
+ end
+
# GET /schools
def index
@schools = School.search(params[:search]).
order(sort_column + ' ' + sort_direction).
paginate(:per_page => per_page, :page => params[:page])
@@ -108,18 +113,9 @@
def check_school_approved(school, params)
if params[:school] && params[:school][:approved]
school.approved = params[:school][:approved] == '1'
end
- end
-
-
- def per_page
- %w[25 50 100].include?(params[:per_page]) ? params[:per_page] : "25"
- end
-
- def sort_column
- %w[name city state zipcode approved].include?(params[:sort]) ? params[:sort] : "name"
end
end
end