質問編集履歴

1

コードを追記しました。

2020/01/04 12:14

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -15,3 +15,347 @@
15
15
  黄色の枠線の中が該当する部分です。
16
16
 
17
17
  ![イメージ説明](2d4ad7f8f46dc9cdaa3bb7e9487773ed.png)
18
+
19
+
20
+
21
+ ```
22
+
23
+ users/show.html.erb
24
+
25
+
26
+
27
+ <%= render 'shared/header' %>
28
+
29
+
30
+
31
+ <div class="header-space">
32
+
33
+
34
+
35
+ <div class="container">
36
+
37
+ <div class="row">
38
+
39
+ <div class="col-xs-3">
40
+
41
+
42
+
43
+ <h3>User info</h3>
44
+
45
+ <%= attachment_image_tag @user, :profile_image, :fill, 100, 100, format: 'jpeg', fallback: "no_image.jpg", size:'100x100' %>
46
+
47
+ <table class="table">
48
+
49
+ <tr>
50
+
51
+    <th><h4>name</h4></th>
52
+
53
+    <th><%= @user.name %></th>
54
+
55
+   </tr>
56
+
57
+   <tr>
58
+
59
+    <th><h4>introduction</h4></th>
60
+
61
+    <th><%= @user.introduction %></th>
62
+
63
+    </tr>
64
+
65
+ </table>
66
+
67
+ <% if @user == current_user %>
68
+
69
+ <div class="row">
70
+
71
+ <%= link_to edit_user_path(@user), class: "col-xs-12 btn btn-default" do %>
72
+
73
+ <i class="fa fa-wrench"></i>
74
+
75
+ <% end %>
76
+
77
+ </div>
78
+
79
+
80
+
81
+ <h3>New book</h3>
82
+
83
+ <%= form_for @book do |f| %>
84
+
85
+ <div class="book-form row">
86
+
87
+ <label for="book_title"><h4>Title</h4></label>
88
+
89
+ <%= f.text_field :title, :class => 'col-xs-12' %>
90
+
91
+ </div>
92
+
93
+ <div class="book-form row">
94
+
95
+ <label for="book_body"><h4>Opinion</h4></label>
96
+
97
+ <%= f.text_area :body, :class => 'col-xs-12' %>
98
+
99
+ </div>
100
+
101
+ <div class="row">
102
+
103
+ <%= f.submit 'Create Book', :class => 'col-xs-12 btn btn-primary' %>
104
+
105
+ </div>
106
+
107
+ <% end %>
108
+
109
+
110
+
111
+ <% end %>
112
+
113
+ </div>
114
+
115
+
116
+
117
+ <div class="col-xs-9">
118
+
119
+ <h3>Books</h3>
120
+
121
+
122
+
123
+ <table class="table table-hover table-inverse">
124
+
125
+ <thead>
126
+
127
+ <tr>
128
+
129
+ <th></th>
130
+
131
+ <th><h4>Title</h4></th>
132
+
133
+ <th><h4>Opinion</h4></th>
134
+
135
+ </tr>
136
+
137
+ </thead>
138
+
139
+ <% @books.each do |book| %>
140
+
141
+ <tbody>
142
+
143
+ <tr>
144
+
145
+ <td><%= attachment_image_tag book.user, :profile_image, :fill, 40, 40, format: 'jpeg', fallback: "no_image.jpg", size:'40x40' %></td>
146
+
147
+ <td><%= link_to book.title, book_path(book.id) %></td>
148
+
149
+ <td><%= book.body %></td>
150
+
151
+ </tr>
152
+
153
+ </tbody>
154
+
155
+ <% end %>
156
+
157
+ </table>
158
+
159
+ </div>
160
+
161
+
162
+
163
+ </div>
164
+
165
+ </div>
166
+
167
+
168
+
169
+ </div>
170
+
171
+
172
+
173
+ <%= render 'shared/footer' %>
174
+
175
+ ```
176
+
177
+
178
+
179
+ ```
180
+
181
+ application.scss
182
+
183
+
184
+
185
+ @import "bootstrap-sprockets";
186
+
187
+ @import "bootstrap";
188
+
189
+
190
+
191
+ @import 'font-awesome-sprockets';
192
+
193
+ @import 'font-awesome';
194
+
195
+
196
+
197
+ * {
198
+
199
+ margin: 0;
200
+
201
+ padding: 0;
202
+
203
+ box-sizing: border-box;
204
+
205
+ }
206
+
207
+ .clearfix::after {
208
+
209
+ content: "";
210
+
211
+ display: block;
212
+
213
+ clear: both;
214
+
215
+ }
216
+
217
+
218
+
219
+ .container{
220
+
221
+ margin-right: auto;
222
+
223
+ margin-left: auto;
224
+
225
+ padding: 0 15px;
226
+
227
+ }
228
+
229
+ h1{
230
+
231
+ margin-top: 5px;
232
+
233
+ font-size: 20px;
234
+
235
+ color: white;
236
+
237
+ }
238
+
239
+ .header-contents{
240
+
241
+ display: inline-block;
242
+
243
+ font-size: 13px;
244
+
245
+ font-family: "MS Serif";
246
+
247
+ }
248
+
249
+ .glyphicon{
250
+
251
+ padding-right: 5px;
252
+
253
+ }
254
+
255
+ .header-space{
256
+
257
+ margin-top: 60px;
258
+
259
+ }
260
+
261
+ .top-message{
262
+
263
+ padding: 0;
264
+
265
+ }
266
+
267
+ .top-title{
268
+
269
+ font-size: 35px;
270
+
271
+ }
272
+
273
+ .button_wrapper{
274
+
275
+ text-align: center;
276
+
277
+ }
278
+
279
+
280
+
281
+ .btn-top{
282
+
283
+ width: 450px;
284
+
285
+ color: #555555;
286
+
287
+ }
288
+
289
+
290
+
291
+ .row{
292
+
293
+ margin-right: -15px;
294
+
295
+ margin-left: -15px;
296
+
297
+ }
298
+
299
+ h3{
300
+
301
+ font-size: 30px;
302
+
303
+ font-weight: bold;
304
+
305
+ }
306
+
307
+ h4{
308
+
309
+ font-size: 15px;
310
+
311
+ font-weight: bold;
312
+
313
+ }
314
+
315
+ table {
316
+
317
+ border-collapse: collapse;
318
+
319
+ }
320
+
321
+ .book-form{
322
+
323
+ margin-bottom: 10px;
324
+
325
+ }
326
+
327
+
328
+
329
+ .table > thead{
330
+
331
+ border-bottom: 2px solid #ddd;
332
+
333
+ }
334
+
335
+ .table > tbody{
336
+
337
+ border-top: 1px solid #ddd;
338
+
339
+ }
340
+
341
+
342
+
343
+ label{
344
+
345
+ display: inline-block;
346
+
347
+ }
348
+
349
+
350
+
351
+ @media screen and (max-width:768px) {
352
+
353
+ .container {
354
+
355
+ width: 750px;
356
+
357
+ }
358
+
359
+ }
360
+
361
+ ```