From a7791635aa98f012d35f97c3c5288494bbb28e38 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Wed, 13 Mar 2024 18:03:43 +0100 Subject: Initial commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- app/views/things/_form.html.erb | 102 +++++++++++++++++++++++++++++++++++++++ app/views/things/_thing.html.erb | 7 +++ app/views/things/edit.html.erb | 3 ++ app/views/things/new.html.erb | 1 + app/views/things/show.html.erb | 7 +++ 5 files changed, 120 insertions(+) create mode 100644 app/views/things/_form.html.erb create mode 100644 app/views/things/_thing.html.erb create mode 100644 app/views/things/edit.html.erb create mode 100644 app/views/things/new.html.erb create mode 100644 app/views/things/show.html.erb (limited to 'app/views/things') diff --git a/app/views/things/_form.html.erb b/app/views/things/_form.html.erb new file mode 100644 index 0000000..da90302 --- /dev/null +++ b/app/views/things/_form.html.erb @@ -0,0 +1,102 @@ +<%= form_with(model: thing) do |form| %> + <%= render "layouts/errors", model: thing %> + +
+
+ <%= form.label :title %> + <%= form.text_field :title, autofocus: true, required: true %> +
+ +
+ <%= form.label :authors %> + <%= form.text_field :authors, required: true %> + <%= form.check_box :editors %> + <%= form.label :editors %> +
+ +
+ <%= form.label :note %> + <%= form.text_field :note %> +
+ +
+ <%= form.label :target %> + <%= form.text_field :target, required: true %> +
+ +
+ <%= form.label :publisher %> + <%= form.text_field :publisher %> +
+ +
+ <%= form.label :year %> + <%= form.number_field :year %> +
+ +
+ <%= form.label :address %> + <%= form.text_field :address %> +
+ +
+ <%= form.label :url %> + <%= form.text_field :url %> +
+ +
+ <%= form.label :access %> + <%= form.date_field :access %> +
+ +
+ <%= form.label :location %> + <%= form.text_field :location %> +
+ +
+ <%= form.label :insideof %> + <%= form.text_field :insideof %> +
+ +
+ <%= form.label :pages %> + <%= form.text_field :pages %> +
+ +
+ <%= form.label :rate %> + <%= form.number_field :rate, min: 0, max: 10, required: true %> +
+ +
+ <%= form.label :status %> + <%= form.select :status, options_for_select(Thing.statuses.map { |k, _| [I18n.t("things.status.#{k}"), k] }.sort, thing.status) %> +
+ +
+ <%= form.label :kind %> + <%= form.select :kind, options_for_select(Thing.kinds.map { |k, _| [I18n.t("things.kind.#{k}"), k] }.sort, thing.kind) %> +
+ +
+ <%= form.label :bought_at %> + <%= form.date_field :bought_at %> +
+ +
+ <%= form.label :where_is_it %> + <%= form.text_field :where_is_it %> +
+
+ + <%= render "tags/taggable", tag_references: thing.tag_references.pluck(:tag_id), form: form %> + +
+ <%= form.submit %> +
+<% 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 %> diff --git a/app/views/things/_thing.html.erb b/app/views/things/_thing.html.erb new file mode 100644 index 0000000..5a31ccc --- /dev/null +++ b/app/views/things/_thing.html.erb @@ -0,0 +1,7 @@ +
+
+
">
+
+
<%= link_to thing.title, edit_thing_path(thing) %>
+
<%= thing.rate %>
+
diff --git a/app/views/things/edit.html.erb b/app/views/things/edit.html.erb new file mode 100644 index 0000000..f30ec5c --- /dev/null +++ b/app/views/things/edit.html.erb @@ -0,0 +1,3 @@ +<%= render "form", thing: @thing %> + +<%= render "comments/list", thing: @thing, from: 'things/edit' %> diff --git a/app/views/things/new.html.erb b/app/views/things/new.html.erb new file mode 100644 index 0000000..d28df14 --- /dev/null +++ b/app/views/things/new.html.erb @@ -0,0 +1 @@ +<%= render "form", thing: @thing %> diff --git a/app/views/things/show.html.erb b/app/views/things/show.html.erb new file mode 100644 index 0000000..c534e49 --- /dev/null +++ b/app/views/things/show.html.erb @@ -0,0 +1,7 @@ +<%= render "things/thing", thing: @thing %> + +

+ <%= link_to I18n.t('things.create-another'), new_thing_path %> +

+ +<%= render "comments/list", thing: @thing, from: 'things/show' %> -- cgit v1.2.3