7 changed files with 52 additions and 27 deletions
-
6app/assets/stylesheets/input.css
-
9app/controllers/concerns/turbo_controller.js
-
5app/controllers/livres_controller.rb
-
8app/views/layouts/application.html.erb
-
2app/views/livres/form.html.erb
-
19app/views/livres/index.html.erb
-
16app/views/livres/new.html.erb
@ -1 +1,7 @@ |
|||||
@import "tailwindcss"; |
@import "tailwindcss"; |
||||
|
|
||||
|
@layer base { |
||||
|
.font-Inter { |
||||
|
font-family: 'Inter', sans-serif; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,9 @@ |
|||||
|
import { Controller } from "@hotwired/stimulus" |
||||
|
|
||||
|
export default class extends Controller { |
||||
|
visit(event) { |
||||
|
event.preventDefault() |
||||
|
Turbo.visit(event.target.dataset.url) |
||||
|
this.element.innerHTML = "" |
||||
|
} |
||||
|
} |
||||
@ -1,23 +1,27 @@ |
|||||
<h1>Ajouter un nouveau livre</h1> |
|
||||
|
<turbo-frame id="nouveau_livre"> |
||||
|
<h1 class=" font-bold text-gray-800 mb-6">AJOUTER UN NOUVEAU</h1> |
||||
|
|
||||
<%= form_with model: @livre, local: true do |form| %> |
<%= form_with model: @livre, local: true do |form| %> |
||||
|
|
||||
<p > |
<p > |
||||
<%= form.label :titre %><br> |
|
||||
|
<%= form.label :titre,class:" font-bold text-gray-800 mb-6 " %><br> |
||||
<%= form.text_field :titre %> |
<%= form.text_field :titre %> |
||||
</p> |
</p> |
||||
|
|
||||
<p> |
<p> |
||||
<%= form.label :auteur %><br> |
|
||||
|
<%= form.label :auteur,class:" font-bold text-gray-800 mb-6 " %><br> |
||||
<%= form.text_field :auteur %> |
<%= form.text_field :auteur %> |
||||
</p> |
</p> |
||||
|
|
||||
<p> |
<p> |
||||
<%= form.label :date_de_sortie, "Date de sortie" %><br> |
|
||||
|
<%= form.label :date_de_sortie,class:" font-bold text-gray-800 mb-6 " %><br> |
||||
<%= form.date_field :date_de_sortie %> |
<%= form.date_field :date_de_sortie %> |
||||
</p> |
</p> |
||||
|
|
||||
|
<div class="font-bold text-gray-800 mb-6 uppercase"> |
||||
<%= form.submit "Créer le livre" %> |
<%= form.submit "Créer le livre" %> |
||||
|
</div> |
||||
|
|
||||
<% end %> |
<% end %> |
||||
|
|
||||
<p><%= link_to "← Retour au catalogue", livres_path %></p> |
|
||||
|
<p><%= link_to "← Fermer l'éditeur", livres_path %></p> |
||||
|
</turbo-frame> |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue