aboutsummaryrefslogtreecommitdiff
path: root/app/views/things/_form.html.erb
blob: 62058a9c2ebca557f59de00882e0026038ed3292 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<%= form_with(model: thing) do |form| %>
  <%= render "layouts/errors", model: thing %>

  <div id="thing_form">
    <div class="thing_large">
      <%= form.label :title %>
      <%= form.text_field :title, autofocus: true, autocapitalize: 'on', required: true %>
    </div>

    <div class="thing_large">
      <%= form.label :authors %>
      <%= form.text_field :authors, autocapitalize: 'words', required: true %>
      <%= form.check_box :editors %>
      <%= form.label :editors %>
    </div>

    <div class="thing_large">
      <%= form.label :note %>
      <%= form.text_field :note, autocapitalize: 'on' %>
    </div>

    <div>
      <%= form.label :target %>
      <%= form.text_field :target, autocapitalize: 'on', required: true %>
    </div>

    <div>
      <%= form.label :publisher %>
      <%= form.text_field :publisher, autocapitalize: 'on' %>
    </div>

    <div>
      <%= form.label :year %>
      <%= form.number_field :year %>
    </div>

    <div>
      <%= form.label :address %>
      <%= form.text_field :address, autocapitalize: 'on' %>
    </div>

    <div>
      <%= form.label :url %>
      <%= form.text_field :url %>
    </div>

    <div>
      <%= form.label :access %>
      <%= form.date_field :access %>
    </div>

    <div>
      <%= form.label :insideof %>
      <%= form.text_field :insideof, autocapitalize: 'on' %>
    </div>

    <div>
      <%= form.label :pages %>
      <%= form.text_field :pages %>
    </div>

    <div>
      <%= form.label :rate %>
      <%= form.number_field :rate, min: 0, max: 10, required: true %>
    </div>

    <div>
      <%= form.label :status %>
      <%= form.select :status, options_for_select(Thing.statuses.map { |k, _| [I18n.t("things.status.#{k}"), k] }.sort, thing.status) %>
    </div>

    <div>
      <%= form.label :kind %>
      <%= form.select :kind, options_for_select(Thing.kinds.map { |k, _| [I18n.t("things.kind.#{k}"), k] }.sort, thing.kind) %>
    </div>

    <div>
      <%= form.label :bought_at %>
      <%= form.date_field :bought_at %>
    </div>

    <div>
      <%= form.label :where_is_it %>
      <%= form.text_field :where_is_it, autocapitalize: 'on' %>
    </div>
 </div>

 <%= render "tags/taggable", tag_references: thing.tag_references.pluck(:tag_id), form: form %>

  <div>
    <%= form.submit %>
  </div>
<% end %>

<% if thing.id %>
  <%= button_to I18n.t('general.delete').capitalize, thing, id: 'thing-delete-button', form: { data: { turbo_confirm: I18n.t('general.sure') } }, method: :delete %>
<% end %>