remove html format from controller and allow anyone access to index
This commit is contained in:
parent
706e094c90
commit
245bb88112
1 changed files with 1 additions and 38 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
class MetacodeSetsController < ApplicationController
|
class MetacodeSetsController < ApplicationController
|
||||||
include MetacodesHelper
|
include MetacodesHelper
|
||||||
before_action :require_admin
|
before_action :require_admin, except: :index
|
||||||
|
|
||||||
# GET /metacode_sets
|
# GET /metacode_sets
|
||||||
# GET /metacode_sets.json
|
# GET /metacode_sets.json
|
||||||
|
@ -10,39 +10,10 @@ class MetacodeSetsController < ApplicationController
|
||||||
@metacode_sets = MetacodeSet.order('name').all
|
@metacode_sets = MetacodeSet.order('name').all
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html # index.html.erb
|
|
||||||
format.json { render json: metacode_sets_json }
|
format.json { render json: metacode_sets_json }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
### SHOW IS NOT CURRENTLY IN USE
|
|
||||||
# GET /metacode_sets/1
|
|
||||||
# GET /metacode_sets/1.json
|
|
||||||
# def show
|
|
||||||
# @metacode_set = MetacodeSet.find(params[:id])
|
|
||||||
#
|
|
||||||
# respond_to do |format|
|
|
||||||
# format.html # show.html.erb
|
|
||||||
# format.json { render json: @metacode_set }
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
|
|
||||||
# GET /metacode_sets/new
|
|
||||||
# GET /metacode_sets/new.json
|
|
||||||
def new
|
|
||||||
@metacode_set = MetacodeSet.new
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.html # new.html.erb
|
|
||||||
format.json { render json: @metacode_set }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# GET /metacode_sets/1/edit
|
|
||||||
def edit
|
|
||||||
@metacode_set = MetacodeSet.find(params[:id])
|
|
||||||
end
|
|
||||||
|
|
||||||
# POST /metacode_sets
|
# POST /metacode_sets
|
||||||
# POST /metacode_sets.json
|
# POST /metacode_sets.json
|
||||||
def create
|
def create
|
||||||
|
@ -57,15 +28,10 @@ class MetacodeSetsController < ApplicationController
|
||||||
@metacodes.each do |m|
|
@metacodes.each do |m|
|
||||||
InMetacodeSet.create(metacode_id: m, metacode_set_id: @metacode_set.id)
|
InMetacodeSet.create(metacode_id: m, metacode_set_id: @metacode_set.id)
|
||||||
end
|
end
|
||||||
format.html do
|
|
||||||
redirect_to metacode_sets_url,
|
|
||||||
notice: 'Metacode set was successfully created.'
|
|
||||||
end
|
|
||||||
format.json do
|
format.json do
|
||||||
render json: @metacode_set, status: :created, location: metacode_sets_url
|
render json: @metacode_set, status: :created, location: metacode_sets_url
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
format.html { render action: 'new' }
|
|
||||||
format.json { render json: @metacode_set.errors, status: :unprocessable_entity }
|
format.json { render json: @metacode_set.errors, status: :unprocessable_entity }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -97,10 +63,8 @@ class MetacodeSetsController < ApplicationController
|
||||||
InMetacodeSet.create(metacode_id: m, metacode_set_id: @metacode_set.id)
|
InMetacodeSet.create(metacode_id: m, metacode_set_id: @metacode_set.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
format.html { redirect_to metacode_sets_url, notice: 'Metacode set was successfully updated.' }
|
|
||||||
format.json { head :no_content }
|
format.json { head :no_content }
|
||||||
else
|
else
|
||||||
format.html { render action: 'edit' }
|
|
||||||
format.json { render json: @metacode_set.errors, status: :unprocessable_entity }
|
format.json { render json: @metacode_set.errors, status: :unprocessable_entity }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -117,7 +81,6 @@ class MetacodeSetsController < ApplicationController
|
||||||
@metacode_set.destroy
|
@metacode_set.destroy
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to metacode_sets_url }
|
|
||||||
format.json { head :no_content }
|
format.json { head :no_content }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue