trabajo-afectivo/app/controllers/ticket_overviews_controller.rb

53 lines
1.2 KiB
Ruby
Raw Normal View History

2016-10-19 03:11:36 +00:00
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
require 'ticket/overviews'
2012-04-10 14:06:46 +00:00
class TicketOverviewsController < ApplicationController
before_action :authentication_check
2012-04-10 14:06:46 +00:00
# GET /api/v1/ticket_overviews
2012-04-10 14:06:46 +00:00
def show
# get navbar overview data
if !params[:view]
index_and_lists = Ticket::Overviews.index(current_user)
indexes = []
index_and_lists.each { |index|
assets = {}
overview = Overview.lookup(id: index[:overview][:id])
meta = {
name: overview.name,
prio: overview.prio,
link: overview.link,
count: index[:count],
}
indexes.push meta
}
render json: indexes
2012-11-26 23:22:52 +00:00
return
end
index_and_lists = Ticket::Overviews.index(current_user)
2012-04-10 14:06:46 +00:00
assets = {}
result = {}
index_and_lists.each { |index|
next if index[:overview][:view] != params[:view]
overview = Overview.lookup(id: index[:overview][:id])
assets = overview.assets(assets)
2016-06-30 20:04:48 +00:00
index[:tickets].each { |ticket_meta|
ticket = Ticket.lookup(id: ticket_meta[:id])
assets = ticket.assets(assets)
}
result = index
2012-04-10 14:06:46 +00:00
}
render json: {
assets: assets,
index: result,
2012-04-14 16:47:37 +00:00
}
2012-04-10 14:06:46 +00:00
end
end