Merge pull request #382 from Ducz0r/lm-sci-166-fix

Re-add tags index controller action to render tags [SCI-166]
This commit is contained in:
Luka Murn 2017-01-04 10:48:09 +01:00 committed by GitHub
commit cedc6c5074
2 changed files with 19 additions and 2 deletions

View file

@ -1,6 +1,6 @@
class MyModuleTagsController < ApplicationController
before_action :load_vars
before_action :check_view_permissions, only: [:index_edit]
before_action :check_view_permissions, only: [:index_edit, :index]
before_action :check_create_permissions, only: [:create]
before_action :check_destroy_permissions, only: [:destroy]
@ -22,6 +22,23 @@ class MyModuleTagsController < ApplicationController
end
end
def index
respond_to do |format|
format.json do
render json: {
html_canvas: render_to_string(
partial: 'canvas/tags.html.erb',
locals: { my_module: @my_module }
),
html_module_header: render_to_string(
partial: 'my_modules/tags.html.erb',
locals: { my_module: @my_module }
)
}
end
end
end
def create
@mt = MyModuleTag.new(mt_params.merge(my_module: @my_module))
@mt.created_by = current_user

View file

@ -191,7 +191,7 @@ Rails.application.routes.draw do
# Show action is a popup (JSON) for individual module in full-zoom canvas,
# as well as "module info" page for single module (HTML)
resources :my_modules, path: '/modules', only: [:show, :update] do
resources :my_module_tags, path: '/tags', only: [:create, :destroy]
resources :my_module_tags, path: '/tags', only: [:index, :create, :destroy]
resources :user_my_modules, path: '/users',
only: [:index, :create, :destroy]
resources :my_module_comments,