質問編集履歴
2
application.html.erbのコードを変えた
test
CHANGED
File without changes
|
test
CHANGED
@@ -32,7 +32,7 @@
|
|
32
32
|
|
33
33
|
|
34
34
|
|
35
|
-
application.html.erb
|
35
|
+
元のapplication.html.erb
|
36
36
|
|
37
37
|
```
|
38
38
|
|
@@ -142,6 +142,8 @@
|
|
142
142
|
|
143
143
|
application.html.rb(自分でnavを適用したとき)
|
144
144
|
|
145
|
+
|
146
|
+
|
145
147
|
```
|
146
148
|
|
147
149
|
<!DOCTYPE html>
|
@@ -200,7 +202,7 @@
|
|
200
202
|
|
201
203
|
<% if @current_user %>
|
202
204
|
|
203
|
-
<li
|
205
|
+
<li>
|
204
206
|
|
205
207
|
<%= link_to(@current_user.name,"/users/#{@current_user.id}") %>
|
206
208
|
|
@@ -208,25 +210,25 @@
|
|
208
210
|
|
209
211
|
<li class="nav-item">
|
210
212
|
|
211
|
-
<%= link_to("投稿一覧", "/posts/index"
|
213
|
+
<%= link_to("投稿一覧", "/posts/index" ,{class: 'nav-link'}) %>
|
212
|
-
|
214
|
+
|
213
|
-
</li>
|
215
|
+
</li>
|
214
|
-
|
216
|
+
|
215
|
-
<li class="nav-item">
|
217
|
+
<li class="nav-item">
|
216
|
-
|
218
|
+
|
217
|
-
<%= link_to("投稿", "/posts/new"
|
219
|
+
<%= link_to("投稿", "/posts/new" ,{class: 'nav-link'}) %>
|
218
|
-
|
220
|
+
|
219
|
-
</li>
|
221
|
+
</li>
|
220
|
-
|
222
|
+
|
221
|
-
<li class="nav-item">
|
223
|
+
<li class="nav-item">
|
222
|
-
|
224
|
+
|
223
|
-
<%= link_to("ユーザー", "/users/index"
|
225
|
+
<%= link_to("ユーザー", "/users/index" ,{class: 'nav-link'}) %>
|
224
|
-
|
226
|
+
|
225
|
-
</li>
|
227
|
+
</li>
|
226
|
-
|
228
|
+
|
227
|
-
<li class="nav-item">
|
229
|
+
<li class="nav-item">
|
228
|
-
|
230
|
+
|
229
|
-
<%= link_to("ログアウト", "/logout", {method: :post}
|
231
|
+
<%= link_to("ログアウト", "/logout", {method: :post} ,{class: 'nav-link'}) %>
|
230
232
|
|
231
233
|
</li>
|
232
234
|
|
@@ -234,19 +236,19 @@
|
|
234
236
|
|
235
237
|
<li class="nav-item">
|
236
238
|
|
237
|
-
<%= link_to("TweetBookとは", "/about"
|
239
|
+
<%= link_to("TweetBookとは", "/about" ,{class: 'nav-link'}) %>
|
238
|
-
|
240
|
+
|
239
|
-
</li>
|
241
|
+
</li>
|
240
|
-
|
242
|
+
|
241
|
-
<li class="nav-item">
|
243
|
+
<li class="nav-item">
|
242
|
-
|
244
|
+
|
243
|
-
<%= link_to("新規登録", "/users/signup"
|
245
|
+
<%= link_to("新規登録", "/users/signup" ,{class: 'nav-link'}) %>
|
244
|
-
|
246
|
+
|
245
|
-
</li>
|
247
|
+
</li>
|
246
|
-
|
248
|
+
|
247
|
-
<li class="nav-item">
|
249
|
+
<li class="nav-item">
|
248
|
-
|
250
|
+
|
249
|
-
<%= link_to("ログイン", "/login"
|
251
|
+
<%= link_to("ログイン", "/login" ,{class: 'nav-link'}) %>
|
250
252
|
|
251
253
|
</li>
|
252
254
|
|
@@ -280,15 +282,15 @@
|
|
280
282
|
|
281
283
|
</html>
|
282
284
|
|
283
|
-
|
284
|
-
|
285
|
-
```
|
285
|
+
```
|
286
|
-
|
286
|
+
|
287
|
+
|
288
|
+
|
287
|
-
起きる
|
289
|
+
起きるデザイン崩れと変なボタン
|
288
290
|
|
289
291
|
↓
|
290
292
|
|
291
|
-
![イメージ説明](
|
293
|
+
![イメージ説明](5e3c771425c99da1e62a5701b1791cfb.png)
|
292
294
|
|
293
295
|
|
294
296
|
|
1
エラーが起きるときのコードを貼った
test
CHANGED
File without changes
|
test
CHANGED
@@ -140,6 +140,158 @@
|
|
140
140
|
|
141
141
|
|
142
142
|
|
143
|
+
application.html.rb(自分でnavを適用したとき)
|
144
|
+
|
145
|
+
```
|
146
|
+
|
147
|
+
<!DOCTYPE html>
|
148
|
+
|
149
|
+
<html>
|
150
|
+
|
151
|
+
<head>
|
152
|
+
|
153
|
+
<title>TweetBook</title>
|
154
|
+
|
155
|
+
<%= csrf_meta_tags %>
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
160
|
+
|
161
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
162
|
+
|
163
|
+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
|
164
|
+
|
165
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
166
|
+
|
167
|
+
</head>
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
<body>
|
172
|
+
|
173
|
+
<header>
|
174
|
+
|
175
|
+
<div class="header-logo">
|
176
|
+
|
177
|
+
<% if @current_user %>
|
178
|
+
|
179
|
+
<%= link_to("TweetBook", "/posts/index") %>
|
180
|
+
|
181
|
+
<% else %>
|
182
|
+
|
183
|
+
<%= link_to("TweetBook", "/") %>
|
184
|
+
|
185
|
+
<% end %>
|
186
|
+
|
187
|
+
</div>
|
188
|
+
|
189
|
+
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
190
|
+
|
191
|
+
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
192
|
+
|
193
|
+
<span class="navbar-toggler-icon"></span>
|
194
|
+
|
195
|
+
</button>
|
196
|
+
|
197
|
+
<div class="collapse navbar-collapse" id="navbarNav">
|
198
|
+
|
199
|
+
<ul class="header-menus navbar-nav">
|
200
|
+
|
201
|
+
<% if @current_user %>
|
202
|
+
|
203
|
+
<li class="nav-item">
|
204
|
+
|
205
|
+
<%= link_to(@current_user.name,"/users/#{@current_user.id}") %>
|
206
|
+
|
207
|
+
</li>
|
208
|
+
|
209
|
+
<li class="nav-item">
|
210
|
+
|
211
|
+
<%= link_to("投稿一覧", "/posts/index") ,{class="nav-link"} %>
|
212
|
+
|
213
|
+
</li>
|
214
|
+
|
215
|
+
<li class="nav-item">
|
216
|
+
|
217
|
+
<%= link_to("投稿", "/posts/new") ,{class="nav-link"} %>
|
218
|
+
|
219
|
+
</li>
|
220
|
+
|
221
|
+
<li class="nav-item">
|
222
|
+
|
223
|
+
<%= link_to("ユーザー", "/users/index") ,{class="nav-link"} %>
|
224
|
+
|
225
|
+
</li>
|
226
|
+
|
227
|
+
<li class="nav-item">
|
228
|
+
|
229
|
+
<%= link_to("ログアウト", "/logout", {method: :post}) ,{class="nav-link"} %>
|
230
|
+
|
231
|
+
</li>
|
232
|
+
|
233
|
+
<% else %>
|
234
|
+
|
235
|
+
<li class="nav-item">
|
236
|
+
|
237
|
+
<%= link_to("TweetBookとは", "/about") ,{class="nav-link"} %>
|
238
|
+
|
239
|
+
</li>
|
240
|
+
|
241
|
+
<li class="nav-item">
|
242
|
+
|
243
|
+
<%= link_to("新規登録", "/users/signup") ,{class="nav-link"} %>
|
244
|
+
|
245
|
+
</li>
|
246
|
+
|
247
|
+
<li class="nav-item">
|
248
|
+
|
249
|
+
<%= link_to("ログイン", "/login") ,{class="nav-link"} %>
|
250
|
+
|
251
|
+
</li>
|
252
|
+
|
253
|
+
<% end %>
|
254
|
+
|
255
|
+
</ul>
|
256
|
+
|
257
|
+
</div>
|
258
|
+
|
259
|
+
</nav>
|
260
|
+
|
261
|
+
</header>
|
262
|
+
|
263
|
+
<!-- flash[:notice]に代入されたメッセージを表示してください -->
|
264
|
+
|
265
|
+
<% if flash[:notice] %>
|
266
|
+
|
267
|
+
<div class="flash">
|
268
|
+
|
269
|
+
<%= flash[:notice] %>
|
270
|
+
|
271
|
+
</div>
|
272
|
+
|
273
|
+
<% end %>
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
<%= yield %>
|
278
|
+
|
279
|
+
</body>
|
280
|
+
|
281
|
+
</html>
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
```
|
286
|
+
|
287
|
+
起きるエラー
|
288
|
+
|
289
|
+
↓
|
290
|
+
|
291
|
+
![イメージ説明](69458df4bdbbc0368ea18eb154124225.png)
|
292
|
+
|
293
|
+
|
294
|
+
|
143
295
|
|
144
296
|
|
145
297
|
適用したいnav( https://getbootstrap.jp/docs/4.2/components/navbar/ にあった具体例)
|