diff --git a/app/controllers/calil/barcodes_controller.rb b/app/controllers/calil/barcodes_controller.rb new file mode 100644 index 0000000000..9e08f83779 --- /dev/null +++ b/app/controllers/calil/barcodes_controller.rb @@ -0,0 +1,11 @@ +class Calil::BarcodesController < ApplicationController + def new + @library = Library.friendly.find(params[:library_id]) + authorize @library + + @calil_barcode = Calil::Barcode.new(name: @library.name) + end + + def create + end +end diff --git a/app/models/calil/barcode.rb b/app/models/calil/barcode.rb new file mode 100644 index 0000000000..c02b81e72c --- /dev/null +++ b/app/models/calil/barcode.rb @@ -0,0 +1,15 @@ +module Calil + class Barcode + include ActiveModel::Model + include ActiveModel::Attributes + attributes :name, :string + attributes :initial_number, :string + attribuets :number_of_sheets, :integer, default: 1 + + with_options presence: true do + validates :name # 図書館名 + validates :initial_number # 開始番号 + end + validates :number_of_sheets, numericality: { greater_than_or_equal_to: 0 } # 枚数 + end +end diff --git a/app/views/calil/barcodes/new.html.erb b/app/views/calil/barcodes/new.html.erb new file mode 100644 index 0000000000..caf34f06ce --- /dev/null +++ b/app/views/calil/barcodes/new.html.erb @@ -0,0 +1,27 @@ +
+ + diff --git a/app/views/libraries/show.html.erb b/app/views/libraries/show.html.erb index 99ac450971..98a713b663 100644 --- a/app/views/libraries/show.html.erb +++ b/app/views/libraries/show.html.erb @@ -133,6 +133,7 @@