Update archive_files_controller.rb
This commit is contained in:
parent
4825923647
commit
40c29eb6fb
|
@ -50,7 +50,18 @@ class Admin::ArchiveFilesController < OrbitAdminController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
def categories_order
|
def categories_order
|
||||||
@categories = @module_app.categories
|
categories = @module_app.categories
|
||||||
|
categories.each do |category|
|
||||||
|
archive_cat = ArchiveCategory.All.select{ |value| value.category_id.to_s == category.id.to_s}
|
||||||
|
if archive_cat.length == 0
|
||||||
|
ArchiveCategory.create(category_id: category.id.to_s)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
cats_with_nil = ArchiveCategory.All.in(sort_number: nil)
|
||||||
|
cats_no_nil = ArchiveCategory.All.not_in(sort_number: nil)
|
||||||
|
@cats = cats_no_nil.concat(cats_with_nil).collect do |cat|
|
||||||
|
[categories.where(:_id => cat.category_id).first,cat.sort_number.to_s]
|
||||||
|
end
|
||||||
render :partial => "categories_order" if request.xhr?
|
render :partial => "categories_order" if request.xhr?
|
||||||
end
|
end
|
||||||
def create
|
def create
|
||||||
|
|
Loading…
Reference in New Issue