|
|
|
@ -2,7 +2,8 @@ class LibrariesController < ApplicationController
|
|
|
|
|
include PaginateHelper
|
|
|
|
|
|
|
|
|
|
before_action :require_login, :check_auth, except: %i[index show]
|
|
|
|
|
|
|
|
|
|
before_action :check_account, except: %i[index show]
|
|
|
|
|
after_action :increment_visit_count, only: [:show, :edit, :update]
|
|
|
|
|
helper_method :current_library, :library_manageable?
|
|
|
|
|
|
|
|
|
|
def index
|
|
|
|
@ -80,6 +81,10 @@ class LibrariesController < ApplicationController
|
|
|
|
|
current_user&.id == library.user_id || admin_or_business?
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def increment_visit_count
|
|
|
|
|
current_library.increment_visited_count! if current_library && current_library.id
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def save_params
|
|
|
|
|
params.permit(:title, :content, :author_name, :author_school_name,
|
|
|
|
|
:cover_id, :publish, attachment_ids: [], tag_ids: [])
|
|
|
|
|