Class: Kaui::TagsController

Inherits:
EngineController show all
Defined in:
app/controllers/kaui/tags_controller.rb

Instance Method Summary collapse

Methods inherited from EngineController

#current_ability, #current_user, #options_for_klient

Instance Method Details

#indexObject



3
4
# File 'app/controllers/kaui/tags_controller.rb', line 3

def index
end

#paginationObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/controllers/kaui/tags_controller.rb', line 6

def pagination
  search_key = params[:sSearch]
  offset     = params[:iDisplayStart] || 0
  limit      = params[:iDisplayLength] || 10

  tags = Kaui::Tag.list_or_search(search_key, offset, limit, options_for_klient)

  json = {
      :sEcho                => params[:sEcho],
      :iTotalRecords        => tags.pagination_max_nb_records,
      :iTotalDisplayRecords => tags.pagination_total_nb_records,
      :aaData               => []
  }

  tags.each do |tag|
    json[:aaData] << [
        tag.tag_id,
        tag.object_type,
        tag.tag_definition_name,
    ]
  end

  respond_to do |format|
    format.json { render :json => json }
  end
end