Add link_to_edit for frontend
This commit is contained in:
		
							parent
							
								
									16ae9aa31f
								
							
						
					
					
						commit
						a0391f0c1e
					
				| 
						 | 
					@ -4,20 +4,15 @@ class ArchivesController < ApplicationController
 | 
				
			||||||
		@categories = []
 | 
							@categories = []
 | 
				
			||||||
		if categories.first == "all"
 | 
							if categories.first == "all"
 | 
				
			||||||
			module_app = OrbitHelper.this_module_app
 | 
								module_app = OrbitHelper.this_module_app
 | 
				
			||||||
			@categories = module_app.categories.collect do |cat|
 | 
								@categories = module_app.categories
 | 
				
			||||||
				{
 | 
					 | 
				
			||||||
					"title" => cat.title || "",
 | 
					 | 
				
			||||||
					"id" => cat.id.to_s
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			end
 | 
					 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			categories.each do |cat|
 | 
								categories.each do |cat|
 | 
				
			||||||
				c = Category.find(cat)
 | 
									@categories << Category.find(cat)
 | 
				
			||||||
				@categories << {"title" => c.title || "", "id" => c.id.to_s}
 | 
					 | 
				
			||||||
			end
 | 
								end
 | 
				
			||||||
		end
 | 
							end
 | 
				
			||||||
		cats = @categories.collect do |cat|
 | 
							cats = @categories.collect do |cat|
 | 
				
			||||||
			archives = ArchiveFile.where(:category_id => cat["id"]).order_by(:sort_number=>'asc').collect do |archive|
 | 
								url_to_edit = OrbitHelper.user_has_cateogry?(cat) ? "/admin/archive_files?filters[category][]=#{cat.id.to_s}" : ""
 | 
				
			||||||
 | 
								archives = ArchiveFile.where(:category_id => cat.id).order_by(:sort_number=>'asc').collect do |archive|
 | 
				
			||||||
				 statuses = archive.statuses_with_classname.collect do |status|
 | 
									 statuses = archive.statuses_with_classname.collect do |status|
 | 
				
			||||||
			        {
 | 
								        {
 | 
				
			||||||
			          "status" => status["name"] || "",
 | 
								          "status" => status["name"] || "",
 | 
				
			||||||
| 
						 | 
					@ -42,8 +37,9 @@ class ArchivesController < ApplicationController
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			end
 | 
								end
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				"category-title" => cat["title"] || "",
 | 
									"category-title" => cat.title || "",
 | 
				
			||||||
				"archives" => archives 
 | 
									"archives" => archives ,
 | 
				
			||||||
 | 
									"url_to_edit" => url_to_edit
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		end
 | 
							end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue