diff --git a/app/controllers/archives_controller.rb b/app/controllers/archives_controller.rb index 6d8bc7a..782005b 100644 --- a/app/controllers/archives_controller.rb +++ b/app/controllers/archives_controller.rb @@ -262,7 +262,7 @@ F cats = files_by_cateogry.keys.collect do |cat| if categories.first == "all" categories = OrbitHelper.widget_module_app.categories puts categories - categories_sort = get_sorted_cat_with_filter(categories,'orm') + categories_sort = get_sorted_cat_with_filter(categories,'id') @categories = categories_sort.collect do |cat| { "title" => cat.title, @@ -332,14 +332,13 @@ F cats = files_by_cateogry.keys.collect do |cat| all_categories_id = all_categories_no_nil.concat(all_categories_with_nil).collect do |cat| cat.category_id.to_s end - all_categories_id + if cat_type=='id' + categories_temp = ModuleApp.where(:key => "archive").first.categories + categories = categories_temp.where(id: categories) + end categories_sort = [] all_categories_id.each do |cat_id| - if cat_type=='orm' - category_selected = categories.select{|category| cat_id == category.id.to_s} - elsif cat_type=='id' - category_selected = categories.select{|category| cat_id == category} - end + category_selected = categories.select{|category| cat_id == category.id.to_s} if category_selected.length!=0 categories_sort << category_selected[0] end