Class: TagSetsController
Instance Method Summary
collapse
#dashboard, #keyboard_tools, #upload
Instance Method Details
#global ⇒ Object
11
12
13
14
15
|
# File 'app/controllers/tag_sets_controller.rb', line 11
def global
@tag_sets = TagSet.unscoped.all.includes(:community)
@counts = @tag_sets.left_joins(:tags).group(:id).count(Arel.sql('tags.id'))
render :index
end
|
#index ⇒ Object
6
7
8
9
|
# File 'app/controllers/tag_sets_controller.rb', line 6
def index
@tag_sets = TagSet.all.includes(:community)
@counts = @tag_sets.left_joins(:tags).group(:id).count(Arel.sql('tags.id'))
end
|
#show ⇒ Object
17
18
19
20
21
22
23
|
# File 'app/controllers/tag_sets_controller.rb', line 17
def show
respond_to do |format|
format.json do
render json: @tag_set
end
end
end
|
#update ⇒ Object
25
26
27
28
29
30
31
32
33
34
|
# File 'app/controllers/tag_sets_controller.rb', line 25
def update
before = @tag_set.attributes_print
if @tag_set.update(name: params[:name])
render json: { tag_set: @tag_set, status: 'success' }
AuditLog.admin_audit(event_type: 'tag_set_update', related: @tag_set, user: current_user,
comment: "from <<TagSet #{before}>>\nto <<TagSet #{@tag_set.attributes_print}>>")
else
render json: { tag_set: @tag_set, status: 'failed' }, status: :internal_server_error
end
end
|