質問編集履歴

1

views/books/show.html.erbファイルを追加しました

2022/11/30 09:42

投稿

yuu_2310
yuu_2310

スコア1

test CHANGED
File without changes
test CHANGED
@@ -85,6 +85,45 @@
85
85
  ```
86
86
 
87
87
  ```ここに言語を入力
88
+ views/books/show.html.erb
89
+
90
+ <main>
91
+ <p id="notice"></p>
92
+ <div class="container">
93
+ <div class="row">
94
+ <div class="col-md-3">
95
+ <%= render 'users/list', user: @user %>
96
+ </div>
97
+ <div class="col-md-8 offset-md-1">
98
+ <h2>Bookdetail</h2>
99
+ <table class="table">
100
+ <tbody>
101
+ <tr>
102
+ <td>
103
+ <%= link_to user_path(@user) do %>
104
+ <%= image_tag @book.user.get_profile_image("100x100") %>
105
+ <p><%= @book.user.name %></p>
106
+ <% end %>
107
+ </td>
108
+ <td>
109
+ <%= link_to @book.title, book_path(@book.id) %>
110
+ </td>
111
+ <td><%= @book.body %></td>
112
+ <% if @book.user == current_user %>
113
+ <td><%= link_to "Edit", edit_book_path(@book.id), class:"btn btn-success" %></td>
114
+ <td><%= link_to "Destroy", book_path(@book.id), method: :delete, "data-confirm" => "本当に消しますか?", class:"btn btn-danger" %></td>
115
+ <% end %>
116
+ </tr>
117
+ </tbody>
118
+ </table>
119
+ </div>
120
+ </div>
121
+ </div>
122
+ </div>
123
+ </main>
124
+ ```
125
+
126
+ ```ここに言語を入力
88
127
  views/users/_list.html.erb
89
128
 
90
129
  <h2 class="mt-3">New book</h2>