Skip to content

Commit d645c88

Browse files
committed
wip: カーリル連番印刷の作成フォームを追加
1 parent e9c23a9 commit d645c88

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

app/controllers/calil/barcodes_controller.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
class Calil::BarcodesController < ApplicationController
22
def new
3+
@library = Library.friendly.find(params[:library_id])
4+
authorize @library
5+
6+
@calil_barcode = Calil::Barcode.new(name: @library.name)
37
end
48

59
def create
Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,27 @@
1-
<h1>Calil::Barcodes#new</h1>
2-
<p>Find me in app/views/calil/barcodes/new.html.erb</p>
1+
<div id="content_detail" class="ui-corner-all ui-widget-content">
2+
<h1 class="title"><%= @library.display_name.localize -%></h1>
3+
<div id="content_list">
4+
<%= render 'page/required_field' %>
5+
<%= form_with(model: @calil_barcode, url: library_barcodes_path, method: :post) do |f| %>
6+
<%= error_messages(@calil_barcode) %>
7+
<div class="field">
8+
<%= f.label :name %>
9+
<%= f.text_field :name, class: 'short_name' %>
10+
</div>
11+
12+
<div class="field">
13+
<%= f.label :initial_number %>
14+
<%= f.text_field :initial_number, class: 'short_name' %>
15+
</div>
16+
17+
<div class="field">
18+
<%= f.label :number_of_sheets %>
19+
<%= f.number_field :number_of_sheets, class: 'short_name' %>
20+
</div>
21+
22+
<% end %>
23+
</div>
24+
</div>
25+
26+
<div id="submenu" class="ui-corner-all ui-widget-content">
27+
</div>

app/views/libraries/show.html.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@
133133
<li><%= link_to t('page.new', model: t('activerecord.models.event')), new_event_path(library_id: @library.id) -%></li>
134134
<%- end -%>
135135
<%- end -%>
136+
<li><%= link_to "連番を作成する", new_library_barcode_path(library_id: @library.name) -%></li>
136137
<li><%= link_to t('page.listing', model: t('activerecord.models.library')), libraries_path -%></li>
137138
</ul>
138139
</div>

0 commit comments

Comments
 (0)