repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/jobs/event_import_file_job.rb | app/jobs/event_import_file_job.rb | class EventImportFileJob < ApplicationJob
queue_as :enju_leaf
def perform(event_import_file)
event_import_file.import_start
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/jobs/user_import_file_job.rb | app/jobs/user_import_file_job.rb | class UserImportFileJob < ApplicationJob
queue_as :enju_leaf
def perform(user_import_file)
user_import_file.import_start
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/jobs/manifestation_reserve_stat_job.rb | app/jobs/manifestation_reserve_stat_job.rb | class ManifestationReserveStatJob < ApplicationJob
queue_as :enju_leaf
def perform(manifestation_reserve_stat)
manifestation_reserve_stat.transition_to!(:started)
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/jobs/application_job.rb | app/jobs/application_job.rb | class ApplicationJob < ActiveJob::Base
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/jobs/resource_export_file_job.rb | app/jobs/resource_export_file_job.rb | class ResourceExportFileJob < ApplicationJob
queue_as :enju_leaf
def perform(resource_export_file)
resource_export_file.export!
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/jobs/user_reserve_stat_job.rb | app/jobs/user_reserve_stat_job.rb | class UserReserveStatJob < ApplicationJob
queue_as :enju_leaf
def perform(user_reserve_stat)
user_reserve_stat.transition_to!(:started)
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/jobs/user_checkout_stat_job.rb | app/jobs/user_checkout_stat_job.rb | class UserCheckoutStatJob < ApplicationJob
queue_as :enju_leaf
def perform(user_checkout_stat)
user_checkout_stat.transition_to!(:started)
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/jobs/manifestation_checkout_stat_job.rb | app/jobs/manifestation_checkout_stat_job.rb | class ManifestationCheckoutStatJob < ApplicationJob
queue_as :enju_leaf
def perform(manifestation_checkout_stat)
manifestation_checkout_stat.transition_to!(:started)
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/jobs/event_export_file_job.rb | app/jobs/event_export_file_job.rb | class EventExportFileJob < ApplicationJob
queue_as :enju_leaf
def perform(event_export_file)
event_export_file.export!
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/jobs/agent_import_file_job.rb | app/jobs/agent_import_file_job.rb | class AgentImportFileJob < ApplicationJob
queue_as :enju_leaf
def perform(agent_import_file)
agent_import_file.import_start
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/helpers/shelves_helper.rb | app/helpers/shelves_helper.rb | module ShelvesHelper
def library_shelf_facet(current_library, facet)
library = Library.where(name: facet.value).select([ :name, :display_name ]).first
return nil unless library
current = true if current_library.try(:name) == library.name
content_tag :li do
if current
content_tag :strong do
link_to("#{library.display_name.localize} (" + facet.count.to_s + ")", url_for(filtered_params.merge(page: nil, library_id: library.name, only_path: true)))
end
else
link_to("#{library.display_name.localize} (" + facet.count.to_s + ")", url_for(filtered_params.merge(page: nil, library_id: library.name, only_path: true)))
end
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/helpers/series_statements_helper.rb | app/helpers/series_statements_helper.rb | module SeriesStatementsHelper
include ManifestationsHelper
def series_pagination_link
if flash[:manifestation_id]
render "manifestations/paginate_id_link", manifestation: Manifestation.find(flash[:manifestation_id])
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/helpers/libraries_helper.rb | app/helpers/libraries_helper.rb | module LibrariesHelper
def filtered_params
params.permit([ :q, :query, :view, :format, :order, :sort_by, :page, :per_page ])
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/helpers/items_helper.rb | app/helpers/items_helper.rb | module ItemsHelper
def circulation_status_facet(facet)
circulation_status = CirculationStatus.where(name: facet.value).select([ :name, :display_name ]).first
if circulation_status
# string << form_icon(circulation_status)
current = true if params[:circulation_status] == circulation_status.name
if current
content_tag :strong do
link_to("#{circulation_status.display_name.localize} (" + facet.count.to_s + ")", url_for(filtered_params.merge(circulation_status: circulation_status.name, page: nil, view: nil, only_path: true)))
end
else
link_to("#{circulation_status.display_name.localize} (" + facet.count.to_s + ")", url_for(filtered_params.merge(circulation_status: circulation_status.name, page: nil, view: nil, only_path: true)))
end
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/helpers/picture_files_helper.rb | app/helpers/picture_files_helper.rb | module PictureFilesHelper
def show_image(picture_file, options = { size: :medium })
return unless picture_file.attachment.attached?
case options[:size]
when :medium
image_tag picture_file.attachment.variant(resize_to_limit: [ 600, nil ]), alt: "*", width: 600
when :thumb
image_tag picture_file.attachment.variant(resize_to_limit: [ 100, nil ]), alt: "*", width: 100
else
image_tag picture_file.attachment, alt: "*", width: picture_file.attachment.metadata["width"], height: picture_file.attachment.metadata["height"]
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/helpers/loc_search_helper.rb | app/helpers/loc_search_helper.rb | module LocSearchHelper
def link_to_import_from_loc(lccn)
if lccn.blank?
t("enju_loc.not_available")
else
manifestation = LccnRecord.find_by(body: lccn)&.manifestation
unless manifestation
button_to t("enju_loc.add"), loc_search_index_path(book: { lccn: lccn }), method: :post, data: { disable_with: t("page.saving") }
else
link_to t("enju_loc.already_exists"), manifestation
end
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/helpers/checkouts_helper.rb | app/helpers/checkouts_helper.rb | module CheckoutsHelper
def filtered_params
params.permit([ :user_id, :days_overdue, :reserved ])
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/helpers/reserves_helper.rb | app/helpers/reserves_helper.rb | module ReservesHelper
include ManifestationsHelper rescue nil
def i18n_state(state)
case state
when "pending"
t("reserve.pending")
when "requested"
t("reserve.requested")
when "retained"
t("reserve.retained")
when "canceled"
t("reserve.canceled")
when "expired"
t("reserve.expired")
when "postponed"
t("reserve.postponed")
when "completed"
t("reserve.completed")
end
end
def filtered_params
params.permit([ :user_id, :reserved_from, :reserved_until, :query, :sort_by, :state ])
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/helpers/ndl_books_helper.rb | app/helpers/ndl_books_helper.rb | module NdlBooksHelper
def link_to_import_from_ndl(iss_itemno)
if iss_itemno.blank?
t("enju_ndl.not_available")
else
ndl_bib_id_record = NdlBibIdRecord.find_by(body: iss_itemno)
if ndl_bib_id_record
link_to t("enju_ndl.already_exists"), ndl_bib_id_record.manifestation
else
button_to t("enju_ndl.add"), ndl_books_path(book: { iss_itemno: iss_itemno }), method: :post, data: { disable_with: t("page.saving") }
end
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/helpers/owns_helper.rb | app/helpers/owns_helper.rb | module OwnsHelper
include ManifestationsHelper
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/helpers/order_list_helper.rb | app/helpers/order_list_helper.rb | module OrderListHelper
def localized_order_state(current_state)
case current_state
when "pending"
t("state.pending")
when "not_ordered"
t("order_list.not_ordered")
when "ordered"
t("order_list.ordered")
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/helpers/messages_helper.rb | app/helpers/messages_helper.rb | module MessagesHelper
def filtered_params
params.permit([ :view, :format, :page, :mode, :sort_by, :per_page ])
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/helpers/cinii_books_helper.rb | app/helpers/cinii_books_helper.rb | module CiniiBooksHelper
def link_to_import_from_cinii(ncid)
if ncid.blank?
t("enju_nii.not_available")
else
ncid_record = NcidRecord.find_by(body: "ncid")
if ncid_record
link_to t("enju_nii.already_exists"), ncid_record.manifestation
else
button_to t("enju_nii.add"), cinii_books_path(book: { ncid: ncid }), method: :post, data: { disable_with: t("page.saving") }
end
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/helpers/application_helper.rb | app/helpers/application_helper.rb | module ApplicationHelper
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/helpers/events_helper.rb | app/helpers/events_helper.rb | module EventsHelper
def filtered_params
params.permit([ :format, :library_id, :mode, :query, :page, :per_page ])
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/helpers/manifestations_helper.rb | app/helpers/manifestations_helper.rb | module ManifestationsHelper
# include EnjuCirculation::ManifestationsHelper if defined?(EnjuCirculation)
def resource_title(manifestation, action)
string = LibraryGroup.site_config.display_name.localize.dup
unless action == ("index" or "new")
if manifestation.try(:original_title)
string << " - " + manifestation.original_title.to_s
end
end
string << " - Next-L Enju Leaf"
string.html_safe
end
def back_to_manifestation_index
if session[:params]
params = session[:params].merge(view: nil, controller: :manifestations)
link_to t("page.back_to_search_results"), url_for(params)
else
link_to t("page.back"), :back
end
# rescue
# link_to t('page.listing', model: t('activerecord.models.manifestation')), manifestations_path
end
def call_number_label(item)
if item.call_number?
unless item.shelf.web_shelf?
# TODO 請求記号の区切り文字
numbers = item.call_number.split(item.shelf.library.call_number_delimiter)
call_numbers = []
numbers.each do |number|
call_numbers << h(number.to_s)
end
render partial: "manifestations/call_number", locals: { item: item, call_numbers: call_numbers }
end
end
end
def language_list(languages)
list = []
languages.each do |language|
list << language.display_name.localize if language.name != "unknown"
end
list.join("; ")
end
def paginate_id_link(manifestation, manifestation_ids)
links = []
if manifestation_ids.is_a?(Array)
current_seq = manifestation_ids.index(manifestation.id)
if current_seq
unless manifestation.id == manifestation_ids.last
links << link_to(t("page.next"), manifestation_path(manifestation_ids[current_seq + 1]))
else
links << t("page.next").to_s
end
unless manifestation.id == manifestation_ids.first
links << link_to(t("page.previous"), manifestation_path(manifestation_ids[current_seq - 1]))
else
links << t("page.previous").to_s
end
end
end
links.join(" ").html_safe
end
def language_facet(language, current_languages, facet)
string = ""
languages = current_languages.dup
current = true if languages.include?(language.name)
if current
content_tag :strong do
link_to("#{language.display_name.localize} (" + facet.count.to_s + ")", url_for(request.params.merge(page: nil, language: language.name, view: nil, only_path: true)))
end
else
link_to("#{language.display_name.localize} (" + facet.count.to_s + ")", url_for(request.params.merge(page: nil, language: language.name, view: nil, only_path: true)))
end
end
def library_facet(current_libraries, facet)
library = Library.where(name: facet.value).select([ :name, :display_name ]).first
return nil unless library
string = ""
current = true if current_libraries.include?(library.name)
content_tag :li do
if current
content_tag :strong do
link_to("#{library.display_name.localize} (" + facet.count.to_s + ")", url_for(request.params.merge(page: nil, library: (current_libraries << library.name).uniq.join(" "), view: nil, only_path: true)))
end
else
link_to("#{library.display_name.localize} (" + facet.count.to_s + ")", url_for(request.params.merge(page: nil, library: (current_libraries << library.name).uniq.join(" "), view: nil, only_path: true)))
end
end
end
def carrier_type_facet(facet)
string = ""
carrier_type = CarrierType.where(name: facet.value).select([ :id, :name, :display_name ]).first
if carrier_type
string << form_icon(carrier_type)
current = true if params[:carrier_type] == carrier_type.name
if current
content_tag :strong do
link_to("#{carrier_type.display_name.localize} (" + facet.count.to_s + ")", url_for(request.params.merge(carrier_type: carrier_type.name, page: nil, view: nil, only_path: true)))
end
else
link_to("#{carrier_type.display_name.localize} (" + facet.count.to_s + ")", url_for(request.params.merge(carrier_type: carrier_type.name, page: nil, view: nil, only_path: true)))
end
end
end
def pub_year_facet(pub_date_from, pub_date_until, facet)
current = true if facet.value.first.to_i == pub_date_from.to_i and facet.value.last.to_i - 1 == pub_date_until.to_i
if current
content_tag :strong do
link_to("#{facet.value.first.to_i} - #{facet.value.last.to_i - 1} (" + facet.count.to_s + ")", url_for(request.params.merge(pub_date_from: facet.value.first.to_i, pub_date_until: facet.value.last.to_i - 1, page: nil, view: nil, only_path: true)))
end
else
link_to("#{facet.value.first.to_i} - #{facet.value.last.to_i - 1} (" + facet.count.to_s + ")", url_for(request.params.merge(pub_date_from: facet.value.first.to_i, pub_date_until: facet.value.last.to_i - 1, page: nil, view: nil, only_path: true)))
end
end
def title_with_volume_number(manifestation)
title = manifestation.original_title
if manifestation.volume_number_string?
title << " " + manifestation.volume_number_string
end
if manifestation.serial?
if manifestation.issue_number_string?
title << " (#{manifestation.issue_number_string})"
end
if manifestation.serial_number?
title << " " + manifestation.serial_number.to_s
end
end
title
end
def holding_item_sort_criteria(item)
own_library = 2
own_library = 1 if signed_in? and current_user.profile.library_id == item.shelf.library_id
[ own_library, Library.find(item.shelf.library_id).position, item.shelf.position, item.id ]
end
def link_to_reservation(manifestation, reserve)
if current_user
if current_user.has_role?("Librarian")
link_to t("manifestation.reserve_this"), new_reserve_path(manifestation_id: manifestation.id)
else
if manifestation.is_checked_out_by?(current_user)
I18n.t("manifestation.currently_checked_out")
else
if manifestation.is_reserved_by?(current_user)
link_to t("manifestation.cancel_reservation"), reserve, confirm: t("page.are_you_sure"), method: :delete
else
link_to t("manifestation.reserve_this"), new_reserve_path(manifestation_id: manifestation.id)
end
end
end
else
unless manifestation.items.for_checkout.empty?
link_to t("manifestation.reserve_this"), new_reserve_path(manifestation_id: manifestation.id)
end
end
end
if defined?(EnjuBookmark)
def link_to_bookmark(manifestation)
if manifestation.bookmarked?(current_user)
link_to t("bookmark.remove_from_my_bookmark"), bookmark_path(Bookmark.where(user_id: current_user.id, manifestation_id: manifestation.id).first), confirm: t("page.are_you_sure"), method: :delete
else
link_to t("bookmark.add_to_my_bookmark"), new_bookmark_path(bookmark: { url: manifestation_url(manifestation) })
end
end
def rdf_statement(manifestation)
nextl = RDF::Vocabulary.new("https://next-l.jp/vocab/")
subject = RDF::URI.new(manifestation_url(manifestation))
graph = RDF::Graph.new
graph << RDF::Statement.new(
subject,
nextl.original_title,
RDF::Literal.new(manifestation.original_title)
)
graph << RDF::Statement.new(
subject,
nextl.title_alternative,
RDF::Literal.new(manifestation.title_alternative)
)
graph << RDF::Statement.new(
subject,
nextl.title_transcription,
RDF::Literal.new(manifestation.title_transcription)
)
graph << RDF::Statement.new(
subject,
nextl.manifestation_identifier,
RDF::Literal.new(manifestation.manifestation_identifier)
)
graph << RDF::Statement.new(
subject,
nextl.pub_date,
RDF::Literal.new(manifestation.pub_date)
)
graph << RDF::Statement.new(
subject,
nextl.publication_place,
RDF::Literal.new(manifestation.publication_place)
)
graph << RDF::Statement.new(
subject,
nextl.manifestation_created_at,
RDF::Literal.new(manifestation.created_at)
)
graph << RDF::Statement.new(
subject,
nextl.manifestation_updated_at,
RDF::Literal.new(manifestation.updated_at)
)
graph << RDF::Statement.new(
subject,
nextl.carrier_type,
RDF::Literal.new(manifestation.carrier_type.name)
)
graph << RDF::Statement.new(
subject,
nextl.content_type,
RDF::Literal.new(manifestation.manifestation_content_type.name)
)
graph << RDF::Statement.new(
subject,
nextl.frequency,
RDF::Literal.new(manifestation.frequency.name)
)
graph << RDF::Statement.new(
subject,
nextl.language,
RDF::Literal.new(manifestation.language.name)
)
graph << RDF::Statement.new(
subject,
nextl.volume_number,
RDF::Literal.new(manifestation.volume_number)
)
graph << RDF::Statement.new(
subject,
nextl.volume_number_string,
RDF::Literal.new(manifestation.volume_number_string)
)
graph << RDF::Statement.new(
subject,
nextl.edition,
RDF::Literal.new(manifestation.edition)
)
graph << RDF::Statement.new(
subject,
nextl.edition_string,
RDF::Literal.new(manifestation.edition_string)
)
graph << RDF::Statement.new(
subject,
nextl.serial_number,
RDF::Literal.new(manifestation.serial_number)
)
graph << RDF::Statement.new(
subject,
nextl.extent,
RDF::Literal.new(manifestation.extent)
)
graph << RDF::Statement.new(
subject,
nextl.start_page,
RDF::Literal.new(manifestation.start_page)
)
graph << RDF::Statement.new(
subject,
nextl.end_page,
RDF::Literal.new(manifestation.end_page)
)
graph << RDF::Statement.new(
subject,
nextl.dimensions,
RDF::Literal.new(manifestation.dimensions)
)
graph << RDF::Statement.new(
subject,
nextl.height,
RDF::Literal.new(manifestation.height)
)
graph << RDF::Statement.new(
subject,
nextl.width,
RDF::Literal.new(manifestation.width)
)
graph << RDF::Statement.new(
subject,
nextl.depth,
RDF::Literal.new(manifestation.depth)
)
graph << RDF::Statement.new(
subject,
nextl.manifestation_price,
RDF::Literal.new(manifestation.price)
)
graph << RDF::Statement.new(
subject,
nextl.access_address,
RDF::Literal.new(manifestation.access_address)
)
graph << RDF::Statement.new(
subject,
nextl.manifestation_required_role,
RDF::Literal.new(manifestation.required_role.name)
)
graph << RDF::Statement.new(
subject,
nextl.abstract,
RDF::Literal.new(manifestation.abstract)
)
graph << RDF::Statement.new(
subject,
nextl.description,
RDF::Literal.new(manifestation.description)
)
graph << RDF::Statement.new(
subject,
nextl.note,
RDF::Literal.new(manifestation.note)
)
manifestation.isbn_records.each do |i|
graph << RDF::Statement.new(
subject,
nextl.isbn,
RDF::Literal.new(i.body)
)
end
manifestation.issn_records.each do |i|
graph << RDF::Statement.new(
subject,
nextl.issn,
RDF::Literal.new(i.body)
)
end
if manifestation.jpno_record
graph << RDF::Statement.new(
subject,
nextl.jpno,
RDF::Literal.new(manifestation.jpno_record.body)
)
end
if manifestation.doi_record
graph << RDF::Statement.new(
subject,
nextl.doi,
RDF::Literal.new(manifestation.doi_record.body)
)
end
if manifestation.ndl_bib_id_record
graph << RDF::Statement.new(
subject,
nextl.iss_itemno,
RDF::Literal.new(manifestation.ndl_bib_id_record.body)
)
end
if manifestation.lccn_record
graph << RDF::Statement.new(
subject,
nextl.lccn,
RDF::Literal.new(manifestation.lccn_record.body)
)
end
if manifestation.ncid_record
graph << RDF::Statement.new(
subject,
nextl.ncid,
RDF::Literal.new(manifestation.ncid_record.body)
)
end
manifestation.identifier_contents(:loc_identifier).each do |i|
graph << RDF::Statement.new(
subject,
nextl.loc_identifier,
RDF::Literal.new(i)
)
end
manifestation.identifier_contents(:epi).each do |i|
graph << RDF::Statement.new(
subject,
nextl.epi,
RDF::Literal.new(i)
)
end
manifestation.series_statements.each do |i|
graph << RDF::Statement.new(
subject,
nextl.series_statement_id,
RDF::Literal.new(i.id)
)
graph << RDF::Statement.new(
subject,
nextl.series_statement_original_title,
RDF::Literal.new(i.original_title)
)
graph << RDF::Statement.new(
subject,
nextl.series_statement_title_subseries_transcription,
RDF::Literal.new(i.title_subseries_transcription)
)
graph << RDF::Statement.new(
subject,
nextl.series_statement_title_transcription,
RDF::Literal.new(i.title_transcription)
)
graph << RDF::Statement.new(
subject,
nextl.series_statement_title_subseries,
RDF::Literal.new(i.title_subseries)
)
end
manifestation.creators.each do |i|
graph << RDF::Statement.new(
subject,
nextl.creators,
RDF::Literal.new(i.full_name)
)
end
manifestation.contributors.each do |i|
graph << RDF::Statement.new(
subject,
nextl.contributors,
RDF::Literal.new(i.full_name)
)
end
manifestation.publishers.each do |i|
graph << RDF::Statement.new(
subject,
nextl.publishers,
RDF::Literal.new(i.full_name)
)
end
manifestation.subjects.each do |i|
graph << RDF::Statement.new(
subject,
nextl.subject,
RDF::Literal.new(i.term)
)
end
manifestation.classifications.each do |i|
graph << RDF::Statement.new(
subject,
nextl.classification,
RDF::Literal.new(i.category)
)
end
graph.dump(:turtle)
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/helpers/agents_helper.rb | app/helpers/agents_helper.rb | module AgentsHelper
include PictureFilesHelper
def agent_custom_book_jacket(agent)
link = ""
agent.picture_files.each_with_index do |picture_file, i|
if i == 0
link += link_to(show_image(picture_file, size: :thumb), rails_blob_url(picture_file.attachment), rel: "agent_#{agent.id}")
else
link += content_tag :span, style: "display: none" do
link_to(show_image(picture_file, size: :thumb), rails_blob_url(picture_file.attachment), rel: "agent_#{agent.id}")
end
end
end
link.html_safe
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/helpers/nii_types_helper.rb | app/helpers/nii_types_helper.rb | module NiiTypesHelper
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/helpers/page_helper.rb | app/helpers/page_helper.rb | module PageHelper
def check_all_button(param, label)
html = <<-EOF
<button type="button" id="check_all_#{param}">#{label}</button>
<script>
$(function(){
$("#check_all_#{param}").click(function(e){
var checkboxes = $("input##{param}");
checkboxes.prop("checked", !checkboxes.prop("checked"));
});
});
</script>
EOF
html.html_safe
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/helpers/enju_leaf/application_helper.rb | app/helpers/enju_leaf/application_helper.rb | module EnjuLeaf
module ApplicationHelper
# 使用中のデータベースのアダプタ名を表示します。
def database_adapter
case ActiveRecord::Base.connection.adapter_name
when "PostgreSQL"
link_to "PostgreSQL", "https://www.postgresql.org/"
when "MySQL"
link_to "MySQL", "https://www.mysql.com/"
when "SQLite"
link_to "SQLite", "https://www.sqlite.org/"
end
end
# HTMLのtitleに表示されるアクション名を設定します。
def title_action_name
case controller.action_name
when "index"
t("title.index")
when "show"
t("title.show")
when "new"
t("title.new")
when "edit"
t("title.edit")
end
end
def link_to_wikipedia(string)
link_to "Wikipedia", "http://#{I18n.locale}.wikipedia.org/wiki/#{URI.encode_www_form_component(string)}"
end
def locale_display_name(locale)
Language.where(iso_639_1: locale).first.display_name
end
def locale_native_name(locale)
Language.where(iso_639_1: locale).first.native_name
end
def move_position(object)
render partial: "page/position", locals: { object: object }
end
# I18nに対応した状態名を表示します。
# @param [String] state 状態名
def localized_state(state)
case state
when "pending"
t("state.pending")
when "canceled"
t("state.canceled")
when "started"
t("state.started")
when "failed"
t("state.failed")
when "completed"
t("state.completed")
else
state
end
end
# I18nに対応した状態名を表示します。
# @param [Boolean] bool 状態名
def localized_boolean(bool)
case bool.to_s
when nil
when "true"
t("page.boolean.true")
when "false"
t("page.boolean.false")
end
end
# ログイン中のユーザの権限名を表示します。
def current_user_role_name
current_user.try(:role).try(:name) || "Guest"
end
# HTMLのtitleを表示します。
def title(controller_name, model_name = controller_name.singularize)
string = ""
unless [ "page", "routing_error", "my_accounts" ].include?(controller_name)
string << t("activerecord.models.#{model_name}") + " - "
end
if controller_name == "routing_error"
string << t("page.routing_error") + " - "
end
string << LibraryGroup.system_name + " - Next-L Enju Leaf"
string.html_safe
end
# 前の画面に戻るリンクを表示します。
# @param [Hash] options
def back_to_index(options = {})
if options == nil
options = {}
else
options.reject! { |_key, value| value.blank? }
options.delete(:page) if options[:page].to_i == 1
end
unless controller_name == "test"
link_to t("page.listing", model: t("activerecord.models.#{controller_name.singularize}")), url_for(filtered_params.merge(controller: controller_name, action: :index, page: nil, id: nil, only_path: true).merge(options))
end
end
# 検索フォームにフォーカスを移動するJavaScriptを表示します。
def set_focus_on_search_form
javascript_tag("$(function(){$('#search_form').focus()})") if @query.blank?
end
# Markdownの文字列をパースして表示します。
# @param [String] string Markdownの文字列
def markdown_helper(string)
return unless string
Kramdown::Document.new(string.to_s).to_html.html_safe
end
# ユーザの未読メッセージ数を表示します。
# @param [User] user ユーザ
def messages_count(user)
Message.search do
with(:receiver_id).equal_to user.id
with(:is_read).equal_to false
end.hits.total_entries
end
# フォームでのエラーメッセージを表示します。
def error_messages(model)
if model.errors.any?
render("page/error_message", model: model)
end
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/helpers/enju_biblio/application_helper.rb | app/helpers/enju_biblio/application_helper.rb | module EnjuBiblio
module ApplicationHelper
def form_icon(carrier_type)
unless carrier_type
return image_tag("icons/help.png", size: "16x16", class: "enju_icon", alt: t("page.unknown"))
end
if carrier_type.attachment.attached?
image_tag(carrier_type.attachment.representation(resize_to_limit: [ 16, 16 ]), size: "16x16", class: "enju_icon", alt: carrier_type.display_name.localize)
else
image_tag("icons/help.png", size: "16x16", class: "enju_icon", alt: t("page.unknown"))
end
end
def content_type_icon(content_type)
case content_type.name
when "text"
image_tag("icons/page_white_text.png", size: "16x16", class: "enju_icon", alt: content_type.display_name.localize)
when "still_image"
image_tag("icons/picture.png", size: "16x16", class: "enju_icon", alt: content_type.display_name.localize)
when "sounds"
image_tag("icons/sound.png", size: "16x16", class: "enju_icon", alt: content_type.display_name.localize)
when "two_dimensional_moving_image"
image_tag("icons/film.png", size: "16x16", class: "enju_icon", alt: content_type.display_name.localize)
else
image_tag("icons/help.png", size: "16x16", class: "enju_icon", alt: t("page.unknown"))
end
rescue NoMethodError
image_tag("icons/help.png", size: "16x16", class: "enju_icon", alt: t("page.unknown"))
end
def agent_type_icon(agent_type)
case agent_type
when "person"
image_tag("icons/user.png", size: "16x16", class: "enju_icon", alt: "Person")
when "corporate_body"
image_tag("icons/group.png", size: "16x16", class: "enju_icon", alt: "CorporateBody")
else
image_tag("icons/help.png", size: "16x16", class: "enju_icon", alt: t("page.unknown"))
end
end
def agents_list(agents = [], options = {})
return nil if agents.blank?
agents_list = []
if options[:nolink]
agents_list = agents.map { |agent| agent.full_name }
else
agents_list = agents.map { |agent|
link_to(agent.full_name, manifestations_path(query: "\"#{agent.full_name}\""), options) + " " + (link_to("[A]", agent_path(agent)) if agent.ndla_record)
}
end
agents_list.join(" ").html_safe
end
def ndl_bib_id_record_link(ndl_bib_id_record)
if ndl_bib_id_record.body =~ /\AR[0-9A-Za-z]+?-I[0-9A-Za-z]+?-00\z/
link_to ndl_bib_id_record.body, "https://iss.ndl.go.jp/books/#{ndl_bib_id_record.body}"
else
link_to ndl_bib_id_record.body, "https://ndlsearch.ndl.go.jp/books/#{ndl_bib_id_record.body}"
end
end
def identifier_link(identifier)
identifier.body
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/helpers/enju_manifestation_viewer/book_jacket_helper.rb | app/helpers/enju_manifestation_viewer/book_jacket_helper.rb | module EnjuManifestationViewer
module BookJacketHelper
def book_jacket(manifestation)
if manifestation.picture_files.exists?
link = ""
manifestation.picture_files.each_with_index do |picture_file, i|
next unless picture_file.attachment.attached?
link += if i == 0
link_to(show_image(picture_file, size: :thumb), rails_blob_url(picture_file.attachment), rel: "manifestation_#{manifestation.id}")
else
content_tag :span, style: "display: none" do
link_to(show_image(picture_file, size: :thumb), rails_blob_url(picture_file.attachment), rel: "manifestation_#{manifestation.id}")
end
end
end
return link.html_safe
else
link = book_jacket_tag(manifestation)
link ||= screenshot_tag(manifestation)
end
link ||= link_to image_tag("unknown_resource.png", width: "100", height: "100", alt: "*", itemprop: "image"), manifestation
link
end
def screenshot_tag(manifestation, generator = LibraryGroup.site_config.screenshot_generator)
return nil unless manifestation.try(:access_address)
case generator
when "mozshot"
link_to image_tag("https://blinky.nemui.org/shot?#{manifestation.access_address}", width: 128, height: 128, alt: manifestation.original_title, border: 0, itemprop: "image"), manifestation.access_address
when "simpleapi"
link_to image_tag("http://img.simpleapi.net/small/#{manifestation.access_address}", width: 128, height: 128, alt: manifestation.original_title, border: 0, itemprop: "image"), manifestation.access_address
when "heartrails"
link_to image_tag("http://capture.heartrails.com/medium?#{manifestation.access_address}", width: 120, height: 90, alt: manifestation.original_title, border: 0, itemprop: "image"), manifestation.access_address
when "thumbalizr"
link_to image_tag("http://api.thumbalizr.com/?url=#{manifestation.access_address}&width=128", width: 128, height: 144, alt: manifestation.original_title, border: 0, itemprop: "image"), manifestation.access_address
end
end
def book_jacket_tag(manifestation, generator = LibraryGroup.site_config.book_jacket_source)
return nil unless manifestation
case generator
when "google"
render partial: "manifestations/google_book_thumbnail", locals: { manifestation: manifestation }
when "hanmotocom"
render partial: "manifestations/hanmotocom_thumbnail", locals: { manifestation: manifestation }
when "openbd"
render partial: "manifestations/openbd_thumbnail", locals: { manifestation: manifestation }
end
end
def book_jacket_source_link(source = LibraryGroup.site_config.book_jacket_source)
case source
when "google"
link_to "Google Books", "https://books.google.com/"
end
end
def book_jacket_header(source = LibraryGroup.site_config.book_jacket_source)
string = ""
case source
when "google"
string << javascript_tag(nil, src: "https://www.google.com/jsapi")
string << render("manifestations/google_book_thumbnail_header")
when "openbd"
string << render("manifestations/openbd_thumbnail_header")
end
string.html_safe
end
def screenshot_generator_link(generator = LibraryGroup.site_config.screenshot_generator)
case generator
when "mozshot"
link_to "MozShot", "https://blinky.nemui.org/"
when "simpleapi"
link_to "SimpleAPI", "http://img.simpleapi.net/"
when "heartrails"
link_to "HeartRails Capture", "http://capture.heartrails.com/"
when "thumbalizr"
link_to "thumbalizr", "https://www.thumbalizr.com/"
end
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/helpers/enju_manifestation_viewer/manifestation_viewer_helper.rb | app/helpers/enju_manifestation_viewer/manifestation_viewer_helper.rb | module EnjuManifestationViewer
module ManifestationViewerHelper
extend ApplicationHelper
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/helpers/enju_manifestation_viewer/application_helper.rb | app/helpers/enju_manifestation_viewer/application_helper.rb | module EnjuManifestationViewer
module ApplicationHelper
def google_book_search_preview(isbn)
render partial: "manifestations/google_book_search", locals: { isbn: isbn }
end
def embed_content(manifestation)
if manifestation.youtube_id
render partial: "manifestations/youtube", locals: { manifestation: manifestation }
elsif manifestation.nicovideo_id
render partial: "manifestations/nicovideo", locals: { manifestation: manifestation }
elsif manifestation.flickr.present?
render partial: "manifestations/flickr", locals: { manifestation: manifestation }
elsif manifestation.respond_to?(:ipaper_id)
render partial: "manifestations/scribd", locals: { manifestation: manifestation }
end
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/helpers/enju_bookmark/application_helper.rb | app/helpers/enju_bookmark/application_helper.rb | module EnjuBookmark
module ApplicationHelper
def link_to_tag(tag)
link_to tag, manifestations_path(tag: tag.name)
end
def render_tag_cloud(tags, options = {})
# TODO: add options to specify different limits and sorts
# tags = Tag.all(:limit => 100, :order => 'taggings_count DESC').sort_by(&:name)
# TODO: add option to specify which classes you want and overide this if you want?
classes = %w(popular v-popular vv-popular vvv-popular vvvv-popular)
max, min = 0, 0
tags.each do |tag|
# if options[:max] or options[:min]
# max = options[:max].to_i
# min = options[:min].to_i
# end
max = tag.taggings.size if tag.taggings.size > max
min = tag.taggings.size if tag.taggings.size < min
end
divisor = ((max - min).div(classes.size)) + 1
content_tag :div, class: "hTagcloud" do
content_tag :ul, class: "popularity" do
tags.collect do |tag|
concat(content_tag :li, link_to(tag.name, manifestations_path(tag: tag.name), class: classes[(tag.taggings.size - min).div(divisor)]) + "\n")
end
end
end
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/content_type_policy.rb | app/policies/content_type_policy.rb | class ContentTypePolicy < ApplicationPolicy
def index?
true if user.try(:has_role?, "Administrator")
end
def show?
true if user.try(:has_role?, "Administrator")
end
def create?
true if user.try(:has_role?, "Administrator")
end
def update?
true if user.try(:has_role?, "Administrator")
end
def destroy?
if user.try(:has_role?, "Administrator")
true if record.manifestations.empty?
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/create_type_policy.rb | app/policies/create_type_policy.rb | class CreateTypePolicy < ApplicationPolicy
def index?
true if user.try(:has_role?, "Librarian")
end
def show?
true if user.try(:has_role?, "Librarian")
end
def create?
true if user.try(:has_role?, "Administrator")
end
def update?
true if user.try(:has_role?, "Administrator")
end
def destroy?
true if user.try(:has_role?, "Administrator")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/bookmark_policy.rb | app/policies/bookmark_policy.rb | class BookmarkPolicy < ApplicationPolicy
def index?
user.try(:has_role?, "User")
end
def show?
case user.try(:role).try(:name)
when "Administrator"
true
when "Librarian"
true
when "User"
if record.user == user
true
elsif user.profile.try(:share_bookmarks)
true
else
false
end
end
end
def create?
user.try(:has_role?, "User")
end
def update?
case user.try(:role).try(:name)
when "Administrator"
true
when "Librarian"
true
when "User"
true if record.user == user
end
end
def destroy?
update?
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/checkin_policy.rb | app/policies/checkin_policy.rb | class CheckinPolicy < ApplicationPolicy
def index?
user.try(:has_role?, "Librarian")
end
def show?
user.try(:has_role?, "Librarian")
end
def create?
user.try(:has_role?, "Librarian")
end
def update?
user.try(:has_role?, "Librarian")
end
def destroy?
user.try(:has_role?, "Librarian")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/manifestation_custom_property_policy.rb | app/policies/manifestation_custom_property_policy.rb | class ManifestationCustomPropertyPolicy < ApplicationPolicy
def index?
true if user.try(:has_role?, "Librarian")
end
def show?
true if user.try(:has_role?, "Librarian")
end
def create?
true if user.try(:has_role?, "Administrator")
end
def update?
true if user.try(:has_role?, "Administrator")
end
def destroy?
true if user.try(:has_role?, "Administrator")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/event_policy.rb | app/policies/event_policy.rb | class EventPolicy < ApplicationPolicy
def index?
true
end
def show?
true
end
def create?
user.try(:has_role?, "Librarian")
end
def update?
user.try(:has_role?, "Librarian")
end
def destroy?
user.try(:has_role?, "Librarian")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/checked_item_policy.rb | app/policies/checked_item_policy.rb | class CheckedItemPolicy < ApplicationPolicy
def index?
user.try(:has_role?, "Librarian")
end
def show?
user.try(:has_role?, "Librarian")
end
def create?
user.try(:has_role?, "Librarian")
end
def update?
user.try(:has_role?, "Librarian")
end
def destroy?
user.try(:has_role?, "Librarian")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/withdraw_policy.rb | app/policies/withdraw_policy.rb | class WithdrawPolicy < ApplicationPolicy
def index?
true if user.try(:has_role?, "Librarian")
end
def show?
true if user.try(:has_role?, "Librarian")
end
def create?
true if user.try(:has_role?, "Librarian")
end
def update?
true if user.try(:has_role?, "Librarian")
end
def destroy?
true if user.try(:has_role?, "Librarian")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/agent_relationship_policy.rb | app/policies/agent_relationship_policy.rb | class AgentRelationshipPolicy < ApplicationPolicy
def index?
true
end
def show?
true
end
def create?
true if user.try(:has_role?, "Librarian")
end
def update?
true if user.try(:has_role?, "Librarian")
end
def destroy?
true if user.try(:has_role?, "Librarian")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/inventory_policy.rb | app/policies/inventory_policy.rb | class InventoryPolicy < ApplicationPolicy
def index?
user.try(:has_role?, "Librarian")
end
def show?
user.try(:has_role?, "Librarian")
end
def create?
user.try(:has_role?, "Applicationistrator")
end
def update?
user.try(:has_role?, "Applicationistrator")
end
def destroy?
user.try(:has_role?, "Applicationistrator")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/checkout_policy.rb | app/policies/checkout_policy.rb | class CheckoutPolicy < ApplicationPolicy
def index?
true
end
def show?
if user.try(:has_role?, "Librarian")
true
elsif user && (user == record.user)
true
end
end
def create?
user.try(:has_role?, "Librarian")
end
def update?
if user.try(:has_role?, "Librarian")
true
elsif user && (user == record.user)
true
end
end
def destroy?
if record.checkin && record.user
if user.try(:has_role?, "Librarian")
true
elsif user && (user == record.user)
true
end
end
end
def remove_all?
true if user.try(:has_role?, "User")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/user_group_policy.rb | app/policies/user_group_policy.rb | class UserGroupPolicy < ApplicationPolicy
def index?
true
end
def show?
true
end
def create?
true if user.try(:has_role?, "Administrator")
end
def update?
true if user.try(:has_role?, "Administrator")
end
def destroy?
return false unless record.profiles.empty?
user.try(:has_role?, "Administrator")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/subject_type_policy.rb | app/policies/subject_type_policy.rb | class SubjectTypePolicy < ApplicationPolicy
def index?
true if user.try(:has_role?, "Librarian")
end
def show?
true if user.try(:has_role?, "Librarian")
end
def create?
true if user.try(:has_role?, "Administrator")
end
def update?
true if user.try(:has_role?, "Administrator")
end
def destroy?
true if user.try(:has_role?, "Administrator")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/news_post_policy.rb | app/policies/news_post_policy.rb | class NewsPostPolicy < ApplicationPolicy
def index?
true
end
def show?
true
end
def create?
true if user.try(:has_role?, "Administrator")
end
def update?
true if user.try(:has_role?, "Administrator")
end
def destroy?
true if user.try(:has_role?, "Administrator")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/order_policy.rb | app/policies/order_policy.rb | class OrderPolicy < ApplicationPolicy
def index?
true if user.try(:has_role?, "Librarian")
end
def show?
true if user.try(:has_role?, "Librarian")
end
def create?
true if user.try(:has_role?, "Librarian")
end
def update?
true if user.try(:has_role?, "Librarian")
end
def destroy?
true if user.try(:has_role?, "Librarian")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/purchase_request_policy.rb | app/policies/purchase_request_policy.rb | class PurchaseRequestPolicy < ApplicationPolicy
def index?
true if user.try(:has_role?, "User")
end
def show?
if user.try(:has_role?, "Librarian")
true
elsif user.try(:has_role?, "User")
true if record.user == user
end
end
def create?
true if user.try(:has_role?, "User")
end
def update?
show?
end
def destroy?
show?
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/event_export_file_policy.rb | app/policies/event_export_file_policy.rb | class EventExportFilePolicy < ApplicationPolicy
def index?
user.try(:has_role?, "Librarian")
end
def show?
user.try(:has_role?, "Librarian")
end
def create?
user.try(:has_role?, "Librarian")
end
def update?
user.try(:has_role?, "Librarian")
end
def destroy?
user.try(:has_role?, "Librarian")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/user_group_has_checkout_type_policy.rb | app/policies/user_group_has_checkout_type_policy.rb | class UserGroupHasCheckoutTypePolicy < ApplicationPolicy
def index?
user.try(:has_role?, "Librarian")
end
def show?
user.try(:has_role?, "Librarian")
end
def create?
user.try(:has_role?, "Administrator")
end
def update?
user.try(:has_role?, "Administrator")
end
def destroy?
user.try(:has_role?, "Administrator")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/participate_policy.rb | app/policies/participate_policy.rb | class ParticipatePolicy < ApplicationPolicy
def index?
user.try(:has_role?, "Librarian")
end
def show?
user.try(:has_role?, "Librarian")
end
def create?
user.try(:has_role?, "Librarian")
end
def update?
user.try(:has_role?, "Librarian")
end
def destroy?
user.try(:has_role?, "Librarian")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/classification_policy.rb | app/policies/classification_policy.rb | class ClassificationPolicy < ApplicationPolicy
def index?
true
end
def show?
true
end
def create?
true if user.try(:has_role?, "Administrator")
end
def update?
true if user.try(:has_role?, "Administrator")
end
def destroy?
true if user.try(:has_role?, "Administrator")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/subject_policy.rb | app/policies/subject_policy.rb | class SubjectPolicy < ApplicationPolicy
def index?
true
end
def show?
true
end
def create?
true if user.try(:has_role?, "Administrator")
end
def update?
true if user.try(:has_role?, "Administrator")
end
def destroy?
true if user.try(:has_role?, "Administrator")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/series_statement_policy.rb | app/policies/series_statement_policy.rb | class SeriesStatementPolicy < ApplicationPolicy
def index?
true
end
def show?
true
end
def create?
true if user.try(:has_role?, "Librarian")
end
def edit?
true if user.try(:has_role?, "Librarian")
end
def update?
true if user.try(:has_role?, "Librarian")
end
def destroy?
true if user.try(:has_role?, "Librarian")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/create_policy.rb | app/policies/create_policy.rb | class CreatePolicy < ApplicationPolicy
def index?
true
end
def show?
true
end
def create?
true if user.try(:has_role?, "Librarian")
end
def update?
true if user.try(:has_role?, "Librarian")
end
def destroy?
true if user.try(:has_role?, "Librarian")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/loc_search_policy.rb | app/policies/loc_search_policy.rb | class LocSearchPolicy < ApplicationPolicy
def index?
true if user.try(:has_role?, "Librarian")
end
def create?
true if user.try(:has_role?, "Librarian")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/news_feed_policy.rb | app/policies/news_feed_policy.rb | class NewsFeedPolicy < ApplicationPolicy
def index?
true if user.try(:has_role?, "Librarian")
end
def show?
true if user.try(:has_role?, "Librarian")
end
def create?
true if user.try(:has_role?, "Administrator")
end
def update?
true if user.try(:has_role?, "Administrator")
end
def destroy?
true if user.try(:has_role?, "Administrator")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/application_policy.rb | app/policies/application_policy.rb | class ApplicationPolicy
attr_reader :user, :record
def initialize(user, record)
@user = user
@record = record
end
def index?
false
end
def show?
false
# scope.where(id: record.id).exists?
end
def create?
false
end
def new?
create?
end
def update?
false
end
def edit?
update?
end
def destroy?
false
end
def scope
Pundit.policy_scope!(user, record.class)
end
class Scope
attr_reader :user, :scope
def initialize(user, scope)
@user = user
@scope = scope
end
def resolve
scope
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/agent_relationship_type_policy.rb | app/policies/agent_relationship_type_policy.rb | class AgentRelationshipTypePolicy < ApplicationPolicy
def index?
true
end
def show?
true
end
def create?
true if user.try(:has_role?, "Administrator")
end
def update?
true if user.try(:has_role?, "Administrator")
end
def destroy?
true if user.try(:has_role?, "Administrator")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/picture_file_policy.rb | app/policies/picture_file_policy.rb | class PictureFilePolicy < ApplicationPolicy
def index?
true
end
def show?
case user.try(:role).try(:name)
when "Librarian"
true
when "User"
true if record.picture_attachable.try(:required_role_id).to_i <= 2
else
true if record.picture_attachable.try(:required_role_id).to_i <= 1
end
end
def create?
true if user.try(:has_role?, "Librarian")
end
def edit?
true if user.try(:has_role?, "Librarian")
end
def update?
true if user.try(:has_role?, "Librarian")
end
def destroy?
true if user.try(:has_role?, "Librarian")
end
def download?
show?
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/agent_import_file_policy.rb | app/policies/agent_import_file_policy.rb | class AgentImportFilePolicy < ApplicationPolicy
def index?
true if user.try(:has_role?, "Librarian")
end
def show?
true if user.try(:has_role?, "Librarian")
end
def create?
true if user.try(:has_role?, "Librarian")
end
def update?
true if user.try(:has_role?, "Librarian")
end
def destroy?
true if user.try(:has_role?, "Librarian")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/library_group_policy.rb | app/policies/library_group_policy.rb | class LibraryGroupPolicy < ApplicationPolicy
def index?
true if user.try(:has_role?, "Librarian")
end
def show?
true if user.try(:has_role?, "Librarian")
end
def show_logo?
true
end
def create?
true if user.try(:has_role?, "Administrator")
end
def update?
true if user.try(:has_role?, "Administrator")
end
def destroy?
if user.try(:has_role?, "Administrator")
true if record.shelves.empty? && !record.web?
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/periodical_policy.rb | app/policies/periodical_policy.rb | class PeriodicalPolicy < ApplicationPolicy
class Scope
def initialize(user, scope)
@user = user
@scope = scope
end
def resolve
role_id = user&.role&.id || 1
scope.joins(:manifestation).where("manifestations.required_role_id <= ?", role_id)
end
private
attr_reader :user, :scope
end
def index?
true if user.try(:has_role?, "Librarian")
end
def show?
true if user.try(:has_role?, "Librarian")
end
def create?
true if user.try(:has_role?, "Librarian")
end
def update?
true if user.try(:has_role?, "Librarian")
end
def destroy?
if user.try(:has_role?, "Librarian")
true if record.manifestations.empty?
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/user_checkout_stat_policy.rb | app/policies/user_checkout_stat_policy.rb | class UserCheckoutStatPolicy < ApplicationPolicy
def index?
user.try(:has_role?, "Librarian")
end
def show?
user.try(:has_role?, "Librarian")
end
def create?
user.try(:has_role?, "Librarian")
end
def update?
user.try(:has_role?, "Librarian")
end
def destroy?
user.try(:has_role?, "Administrator")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/resource_import_file_policy.rb | app/policies/resource_import_file_policy.rb | class ResourceImportFilePolicy < ApplicationPolicy
def index?
true if user.try(:has_role?, "Librarian")
end
def show?
true if user.try(:has_role?, "Librarian")
end
def create?
true if user.try(:has_role?, "Librarian")
end
def update?
true if user.try(:has_role?, "Librarian")
end
def destroy?
true if user.try(:has_role?, "Librarian")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/produce_policy.rb | app/policies/produce_policy.rb | class ProducePolicy < ApplicationPolicy
def index?
true
end
def show?
true
end
def create?
true if user.try(:has_role?, "Librarian")
end
def update?
true if user.try(:has_role?, "Librarian")
end
def destroy?
true if user.try(:has_role?, "Librarian")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/nii_type_policy.rb | app/policies/nii_type_policy.rb | class NiiTypePolicy < ApplicationPolicy
def index?
true
end
def show?
true
end
def create?
true if user.try(:has_role?, "Administrator")
end
def update?
true if user.try(:has_role?, "Administrator")
end
def destroy?
if user.try(:has_role?, "Administrator")
true unless record.manifestations.exists?
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/resource_import_result_policy.rb | app/policies/resource_import_result_policy.rb | class ResourceImportResultPolicy < ApplicationPolicy
def index?
true if user.try(:has_role?, "Librarian")
end
def show?
true if user.try(:has_role?, "Librarian")
end
def destroy?
false
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/item_policy.rb | app/policies/item_policy.rb | class ItemPolicy < ApplicationPolicy
class Scope
def initialize(user, scope)
@user = user
@scope = scope
end
def resolve
role_id = user&.role&.id || 1
scope.where("items.required_role_id <= ?", role_id)
end
private
attr_reader :user, :scope
end
def index?
true
end
def show?
true
end
def create?
true if user.try(:has_role?, "Librarian")
end
def edit?
true if user.try(:has_role?, "Librarian")
end
def update?
true if user.try(:has_role?, "Librarian")
end
def destroy?
if user.try(:has_role?, "Librarian")
record.removable?
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/subscribe_policy.rb | app/policies/subscribe_policy.rb | class SubscribePolicy < ApplicationPolicy
def index?
true if user.try(:has_role?, "Librarian")
end
def show?
true if user.try(:has_role?, "Librarian")
end
def create?
true if user.try(:has_role?, "Librarian")
end
def update?
true if user.try(:has_role?, "Librarian")
end
def destroy?
true if user.try(:has_role?, "Librarian")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/subject_heading_type_policy.rb | app/policies/subject_heading_type_policy.rb | class SubjectHeadingTypePolicy < ApplicationPolicy
def index?
true
end
def show?
true
end
def create?
true if user.try(:has_role?, "Administrator")
end
def update?
true if user.try(:has_role?, "Administrator")
end
def destroy?
if user.try(:has_role?, "Administrator")
true if record.subjects.empty?
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/agent_type_policy.rb | app/policies/agent_type_policy.rb | class AgentTypePolicy < ApplicationPolicy
def index?
true if user.try(:has_role?, "Librarian")
end
def show?
true if user.try(:has_role?, "Librarian")
end
def create?
true if user.try(:has_role?, "Administrator")
end
def update?
true if user.try(:has_role?, "Administrator")
end
def destroy?
if user.try(:has_role?, "Administrator")
true if record.agents.empty?
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/language_policy.rb | app/policies/language_policy.rb | class LanguagePolicy < ApplicationPolicy
def index?
true
end
def show?
true
end
def create?
true if user.try(:has_role?, "Administrator")
end
def update?
true if user.try(:has_role?, "Administrator")
end
def destroy?
true if user.try(:has_role?, "Administrator")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/event_category_policy.rb | app/policies/event_category_policy.rb | class EventCategoryPolicy < ApplicationPolicy
def index?
true
end
def show?
true
end
def create?
user.try(:has_role?, "Administrator")
end
def update?
user.try(:has_role?, "Administrator")
end
def destroy?
if user.try(:has_role?, "Administrator")
if record.events.empty?
true if ![ "unknown", "closed" ].include?(record.name)
end
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/agent_merge_list_policy.rb | app/policies/agent_merge_list_policy.rb | class AgentMergeListPolicy < ApplicationPolicy
def index?
true if user.try(:has_role?, "Librarian")
end
def show?
true if user.try(:has_role?, "Librarian")
end
def create?
true if user.try(:has_role?, "Librarian")
end
def edit?
true if user.try(:has_role?, "Librarian")
end
def update?
true if user.try(:has_role?, "Librarian")
end
def destroy?
true if user.try(:has_role?, "Librarian")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/budget_type_policy.rb | app/policies/budget_type_policy.rb | class BudgetTypePolicy < ApplicationPolicy
def index?
true if user.try(:has_role?, "Librarian")
end
def show?
true if user.try(:has_role?, "Librarian")
end
def create?
true if user.try(:has_role?, "Administrator")
end
def update?
true if user.try(:has_role?, "Administrator")
end
def destroy?
true if user.try(:has_role?, "Administrator")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/subscription_policy.rb | app/policies/subscription_policy.rb | class SubscriptionPolicy < ApplicationPolicy
def index?
true if user.try(:has_role?, "Librarian")
end
def show?
true if user.try(:has_role?, "Librarian")
end
def create?
true if user.try(:has_role?, "Librarian")
end
def update?
true if user.try(:has_role?, "Librarian")
end
def destroy?
true if user.try(:has_role?, "Librarian")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/bookstore_policy.rb | app/policies/bookstore_policy.rb | class BookstorePolicy < ApplicationPolicy
def index?
true if user.try(:has_role?, "Librarian")
end
def show?
true if user.try(:has_role?, "Librarian")
end
def create?
true if user.try(:has_role?, "Administrator")
end
def update?
true if user.try(:has_role?, "Administrator")
end
def destroy?
if user.try(:has_role?, "Administrator")
true if record.items.empty? and record.order_lists.empty?
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/series_statement_merge_policy.rb | app/policies/series_statement_merge_policy.rb | class SeriesStatementMergePolicy < ApplicationPolicy
def index?
true if user.try(:has_role?, "Librarian")
end
def show?
true if user.try(:has_role?, "Librarian")
end
def create?
true if user.try(:has_role?, "Librarian")
end
def edit?
true if user.try(:has_role?, "Librarian")
end
def update?
true if user.try(:has_role?, "Librarian")
end
def destroy?
true if user.try(:has_role?, "Librarian")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/role_policy.rb | app/policies/role_policy.rb | class RolePolicy < ApplicationPolicy
def index?
true if user.try(:has_role?, "Librarian")
end
def show?
true if user.try(:has_role?, "Librarian")
end
def create?
false
end
def update?
true if user.try(:has_role?, "Administrator")
end
def destroy?
false
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/event_import_result_policy.rb | app/policies/event_import_result_policy.rb | class EventImportResultPolicy < ApplicationPolicy
def index?
true if user.try(:has_role?, "Librarian")
end
def show?
true if user.try(:has_role?, "Librarian")
end
def destroy?
false
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/donate_policy.rb | app/policies/donate_policy.rb | class DonatePolicy < ApplicationPolicy
def index?
true if user.try(:has_role?, "Librarian")
end
def show?
true if user.try(:has_role?, "Librarian")
end
def create?
true if user.try(:has_role?, "Librarian")
end
def update?
true if user.try(:has_role?, "Librarian")
end
def destroy?
true if user.try(:has_role?, "Librarian")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/agent_merge_policy.rb | app/policies/agent_merge_policy.rb | class AgentMergePolicy < ApplicationPolicy
def index?
true if user.try(:has_role?, "Librarian")
end
def show?
true if user.try(:has_role?, "Librarian")
end
def create?
true if user.try(:has_role?, "Librarian")
end
def edit?
true if user.try(:has_role?, "Librarian")
end
def update?
true if user.try(:has_role?, "Librarian")
end
def destroy?
true if user.try(:has_role?, "Librarian")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/import_request_policy.rb | app/policies/import_request_policy.rb | class ImportRequestPolicy < ApplicationPolicy
def index?
true if user.try(:has_role?, "Librarian")
end
def show?
true if user.try(:has_role?, "Librarian")
end
def create?
true if user.try(:has_role?, "Librarian")
end
def update?
true if user.try(:has_role?, "Librarian")
end
def destroy?
true if user.try(:has_role?, "Librarian")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/user_export_file_policy.rb | app/policies/user_export_file_policy.rb | class UserExportFilePolicy < ApplicationPolicy
def index?
true if user.try(:has_role?, "Administrator")
end
def show?
true if user.try(:has_role?, "Administrator")
end
def create?
true if user.try(:has_role?, "Administrator")
end
def update?
true if user.try(:has_role?, "Administrator")
end
def destroy?
true if user.try(:has_role?, "Administrator")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/manifestation_policy.rb | app/policies/manifestation_policy.rb | class ManifestationPolicy < ApplicationPolicy
class Scope
def initialize(user, scope)
@user = user
@scope = scope
end
def resolve
role_id = user&.role&.id || 1
scope.where("manifestations.required_role_id <= ?", role_id)
end
private
attr_reader :user, :scope
end
def index?
true
end
def show?
case user.try(:role).try(:name)
when "Administrator"
true
when "Librarian"
true if record.required_role_id <= 3
when "User"
true if record.required_role_id <= 2
else
true if record.required_role_id <= 1
end
end
def create?
true if user.try(:has_role?, "Librarian")
end
def edit?
case user.try(:role).try(:name)
when "Administrator"
true
when "Librarian"
true if record.required_role_id <= 3
when "User"
true if record.required_role_id <= 2
end
end
def update?
true if user.try(:has_role?, "Librarian")
end
def destroy?
if record.items.empty?
unless record.try(:is_reserved?)
if record.series_master?
if record.children.empty?
case user.try(:role).try(:name)
when "Administrator"
true
when "Librarian"
true if record.required_role_id <= 3
else
false
end
else
false
end
else
case user.try(:role).try(:name)
when "Administrator"
true
when "Librarian"
true if record.required_role_id <= 3
else
false
end
end
end
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/cinii_book_policy.rb | app/policies/cinii_book_policy.rb | class CiniiBookPolicy < ApplicationPolicy
def index?
true if user.try(:has_role?, "Librarian")
end
def create?
true if user.try(:has_role?, "Librarian")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/series_statement_merge_list_policy.rb | app/policies/series_statement_merge_list_policy.rb | class SeriesStatementMergeListPolicy < ApplicationPolicy
def index?
true if user.try(:has_role?, "Librarian")
end
def show?
true if user.try(:has_role?, "Librarian")
end
def create?
true if user.try(:has_role?, "Librarian")
end
def edit?
true if user.try(:has_role?, "Librarian")
end
def update?
true if user.try(:has_role?, "Librarian")
end
def destroy?
true if user.try(:has_role?, "Librarian")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/request_type_policy.rb | app/policies/request_type_policy.rb | class RequestTypePolicy < ApplicationPolicy
def index?
true if user.try(:has_role?, "Librarian")
end
def show?
true if user.try(:has_role?, "Librarian")
end
def create?
false
end
def update?
true if user.try(:has_role?, "Administrator")
end
def destroy?
false
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/library_policy.rb | app/policies/library_policy.rb | class LibraryPolicy < ApplicationPolicy
def index?
true
end
def show?
true
end
def create?
true if user.try(:has_role?, "Administrator")
end
def update?
true if user.try(:has_role?, "Administrator")
end
def destroy?
if user.try(:has_role?, "Administrator")
if record.profiles.empty?
true if record.shelves.empty? && !record.web?
end
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/realize_policy.rb | app/policies/realize_policy.rb | class RealizePolicy < ApplicationPolicy
def index?
true
end
def show?
true
end
def create?
true if user.try(:has_role?, "Librarian")
end
def update?
true if user.try(:has_role?, "Librarian")
end
def destroy?
true if user.try(:has_role?, "Librarian")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/user_import_result_policy.rb | app/policies/user_import_result_policy.rb | class UserImportResultPolicy < ApplicationPolicy
def index?
true if user.try(:has_role?, "Librarian")
end
def show?
true if user.try(:has_role?, "Librarian")
end
def destroy?
false
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/carrier_type_has_checkout_type_policy.rb | app/policies/carrier_type_has_checkout_type_policy.rb | class CarrierTypeHasCheckoutTypePolicy < ApplicationPolicy
def index?
user.try(:has_role?, "Librarian")
end
def show?
user.try(:has_role?, "Librarian")
end
def create?
user.try(:has_role?, "Administrator")
end
def update?
user.try(:has_role?, "Administrator")
end
def destroy?
user.try(:has_role?, "Administrator")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/classification_type_policy.rb | app/policies/classification_type_policy.rb | class ClassificationTypePolicy < ApplicationPolicy
def index?
true
end
def show?
true
end
def create?
true if user.try(:has_role?, "Administrator")
end
def update?
true if user.try(:has_role?, "Administrator")
end
def destroy?
if user.try(:has_role?, "Administrator")
true if record.classifications.empty?
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/message_policy.rb | app/policies/message_policy.rb | class MessagePolicy < ApplicationPolicy
def index?
true if user.try(:has_role?, "User")
end
def show?
case user.try(:role).try(:name)
when "Administrator"
true
when "Librarian"
true if record.try(:receiver) == user
when "User"
true if record.try(:receiver) == user
end
end
def create?
true if user.try(:has_role?, "Librarian")
end
def update?
case user.try(:role).try(:name)
when "Administrator"
true if record.try(:receiver) == user
when "Librarian"
true if record.try(:receiver) == user
end
end
def destroy?
show?
end
def destroy_selected?
true if user.try(:has_role?, "User")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/inventory_file_policy.rb | app/policies/inventory_file_policy.rb | class InventoryFilePolicy < ApplicationPolicy
def index?
user.try(:has_role?, "Librarian")
end
def show?
user.try(:has_role?, "Librarian")
end
def create?
user.try(:has_role?, "Librarian")
end
def update?
user.try(:has_role?, "Librarian")
end
def destroy?
user.try(:has_role?, "Librarian")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/app/policies/user_import_file_policy.rb | app/policies/user_import_file_policy.rb | class UserImportFilePolicy < ApplicationPolicy
def index?
true if user.try(:has_role?, "Librarian")
end
def show?
true if user.try(:has_role?, "Librarian")
end
def create?
true if user.try(:has_role?, "Librarian")
end
def update?
true if user.try(:has_role?, "Librarian")
end
def destroy?
true if user.try(:has_role?, "Librarian")
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.