2017-11-09 19:57:05 +00:00
|
|
|
class CustomUrlsController < ApplicationController
|
2017-11-09 17:25:52 +00:00
|
|
|
def administrate
|
2017-11-10 11:12:03 +00:00
|
|
|
raise AccessError unless cuser && cuser.admin?
|
2017-11-09 17:25:52 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
2017-11-10 11:12:03 +00:00
|
|
|
raise AccessError unless request.xhr?
|
2017-11-09 17:25:52 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def show
|
2017-11-10 09:42:35 +00:00
|
|
|
custom_url = CustomUrl.find_by_name(params[:name])
|
|
|
|
@article = custom_url.article
|
|
|
|
raise AccessError unless @article.can_show? cuser
|
|
|
|
@article.read_by! cuser if cuser
|
|
|
|
render 'articles/show'
|
2017-11-09 17:25:52 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
2017-11-10 11:12:03 +00:00
|
|
|
raise AccessError unless request.xhr?
|
2017-11-09 17:25:52 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
2017-11-10 11:12:03 +00:00
|
|
|
raise AccessError unless request.xhr?
|
2017-11-09 17:25:52 +00:00
|
|
|
end
|
|
|
|
end
|