質問編集履歴
4
指摘内容反映4
test
CHANGED
File without changes
|
test
CHANGED
@@ -166,14 +166,6 @@
|
|
166
166
|
|
167
167
|
|
168
168
|
|
169
|
-
// yarn + webpacker でMaterial Design for Bootstrapを導入する
|
170
|
-
|
171
|
-
import 'bootstrap-material-design'
|
172
|
-
|
173
|
-
import '../stylesheets/application'
|
174
|
-
|
175
|
-
|
176
|
-
|
177
169
|
require("@rails/ujs").start()
|
178
170
|
|
179
171
|
require("turbolinks").start()
|
@@ -184,9 +176,7 @@
|
|
184
176
|
|
185
177
|
|
186
178
|
|
187
|
-
|
179
|
+
|
188
|
-
|
189
|
-
require('jquery');
|
190
180
|
|
191
181
|
// Uncomment to copy all static images under ../images to the output folder and reference
|
192
182
|
|
@@ -202,6 +192,16 @@
|
|
202
192
|
|
203
193
|
|
204
194
|
|
195
|
+
// Bootstrapのための追記
|
196
|
+
|
197
|
+
import 'bootstrap';
|
198
|
+
|
199
|
+
import '../stylesheets/application';
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
205
205
|
```
|
206
206
|
|
207
207
|
|
3
指摘内容反映3
test
CHANGED
File without changes
|
test
CHANGED
@@ -154,6 +154,8 @@
|
|
154
154
|
|
155
155
|
```javascript
|
156
156
|
|
157
|
+
// application.js
|
158
|
+
|
157
159
|
// This file is automatically compiled by Webpack, along with any other files
|
158
160
|
|
159
161
|
// present in this directory. You're encouraged to place your actual application logic in
|
@@ -164,6 +166,14 @@
|
|
164
166
|
|
165
167
|
|
166
168
|
|
169
|
+
// yarn + webpacker でMaterial Design for Bootstrapを導入する
|
170
|
+
|
171
|
+
import 'bootstrap-material-design'
|
172
|
+
|
173
|
+
import '../stylesheets/application'
|
174
|
+
|
175
|
+
|
176
|
+
|
167
177
|
require("@rails/ujs").start()
|
168
178
|
|
169
179
|
require("turbolinks").start()
|
@@ -174,7 +184,9 @@
|
|
174
184
|
|
175
185
|
|
176
186
|
|
177
|
-
|
187
|
+
// 追加
|
188
|
+
|
189
|
+
require('jquery');
|
178
190
|
|
179
191
|
// Uncomment to copy all static images under ../images to the output folder and reference
|
180
192
|
|
@@ -190,12 +202,6 @@
|
|
190
202
|
|
191
203
|
|
192
204
|
|
193
|
-
// Bootstrapのための追記
|
194
|
-
|
195
|
-
import 'bootstrap';
|
196
|
-
|
197
|
-
import '../stylesheets/application';
|
198
|
-
|
199
205
|
```
|
200
206
|
|
201
207
|
|
2
指摘内容反映2
test
CHANGED
File without changes
|
test
CHANGED
@@ -152,6 +152,54 @@
|
|
152
152
|
|
153
153
|
|
154
154
|
|
155
|
+
```javascript
|
156
|
+
|
157
|
+
// This file is automatically compiled by Webpack, along with any other files
|
158
|
+
|
159
|
+
// present in this directory. You're encouraged to place your actual application logic in
|
160
|
+
|
161
|
+
// a relevant structure within app/javascript and only use these pack files to reference
|
162
|
+
|
163
|
+
// that code so it'll be compiled.
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
require("@rails/ujs").start()
|
168
|
+
|
169
|
+
require("turbolinks").start()
|
170
|
+
|
171
|
+
require("@rails/activestorage").start()
|
172
|
+
|
173
|
+
require("channels")
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
// Uncomment to copy all static images under ../images to the output folder and reference
|
180
|
+
|
181
|
+
// them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>)
|
182
|
+
|
183
|
+
// or the `imagePath` JavaScript helper below.
|
184
|
+
|
185
|
+
//
|
186
|
+
|
187
|
+
// const images = require.context('../images', true)
|
188
|
+
|
189
|
+
// const imagePath = (name) => images(name, true)
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
// Bootstrapのための追記
|
194
|
+
|
195
|
+
import 'bootstrap';
|
196
|
+
|
197
|
+
import '../stylesheets/application';
|
198
|
+
|
199
|
+
```
|
200
|
+
|
201
|
+
|
202
|
+
|
155
203
|
# 実施してみたこと
|
156
204
|
|
157
205
|
|
1
指摘内容反映
test
CHANGED
File without changes
|
test
CHANGED
@@ -16,30 +16,158 @@
|
|
16
16
|
|
17
17
|
|
18
18
|
|
19
|
+
# 関連ソース
|
20
|
+
|
21
|
+
```ERB
|
22
|
+
|
23
|
+
<%# _header.html.erb %>
|
24
|
+
|
25
|
+
<nav class="navbar navbar-default">
|
26
|
+
|
27
|
+
<div class="container">
|
28
|
+
|
29
|
+
<div class="navbar-header">
|
30
|
+
|
31
|
+
<button type="button" class="navbar-toggle collapseddata-toggle="collapse" data-target="#navigation">
|
32
|
+
|
33
|
+
<span class="icon-bar"></span>
|
34
|
+
|
35
|
+
<span class="icon-bar"></span>
|
36
|
+
|
37
|
+
<span class="icon-bar"></span>
|
38
|
+
|
39
|
+
</button>
|
40
|
+
|
41
|
+
<%# deviseでヘルパーとして追加されたuser_signed_in?メソッドを使用する %>
|
42
|
+
|
43
|
+
<% if user_signed_in? %>
|
44
|
+
|
45
|
+
<a class="navbar-brand" href="/">ブログ</a>
|
46
|
+
|
47
|
+
<%= link_to '新規作成', new_article_path %>
|
48
|
+
|
49
|
+
<%= link_to 'ログアウト', destroy_user_session_path, method: :delete %>
|
50
|
+
|
51
|
+
<% else %>
|
52
|
+
|
53
|
+
<a class="navbar-brand" href="/">新規ユーザさんのページ</a>
|
54
|
+
|
55
|
+
<%= link_to 'ユーザ登録', new_user_registration_path %>
|
56
|
+
|
57
|
+
<%= link_to 'ログイン', new_user_session_path %>
|
58
|
+
|
59
|
+
<% end %>
|
60
|
+
|
61
|
+
</div>
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
<%# 右側に表示するログインユーザの名前 %>
|
66
|
+
|
67
|
+
<div class="collapse navbar-collapse" id="navigation">
|
68
|
+
|
69
|
+
<p class="navbar-text navbar-right"></p>
|
70
|
+
|
71
|
+
</div>
|
72
|
+
|
73
|
+
</nav>
|
74
|
+
|
75
|
+
```
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
```ERB
|
80
|
+
|
81
|
+
<%# application.html.erb %>
|
82
|
+
|
83
|
+
<!DOCTYPE html>
|
84
|
+
|
85
|
+
<html>
|
86
|
+
|
87
|
+
<head>
|
88
|
+
|
89
|
+
<title>Blog</title>
|
90
|
+
|
91
|
+
<%= javascript_pack_tag 'application' %>
|
92
|
+
|
93
|
+
<%= csrf_meta_tags %>
|
94
|
+
|
95
|
+
<%= csp_meta_tag %>
|
96
|
+
|
97
|
+
<%= stylesheet_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
|
98
|
+
|
99
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
100
|
+
|
101
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
102
|
+
|
103
|
+
</head>
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
<body>
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
<%= render 'layouts/header'%>
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
<%# 新規登録やログイン時にメッセージ表示 %>
|
116
|
+
|
117
|
+
<p class="notice"><%= notice %></p>
|
118
|
+
|
119
|
+
<p class="alert"><%= alert %></p>
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
<%= yield %>
|
124
|
+
|
125
|
+
</body>
|
126
|
+
|
127
|
+
</html>
|
128
|
+
|
129
|
+
```
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
```Ruby
|
134
|
+
|
135
|
+
# Routes.rb
|
136
|
+
|
137
|
+
Rails.application.routes.draw do
|
138
|
+
|
139
|
+
devise_for :users
|
140
|
+
|
141
|
+
resources :articles
|
142
|
+
|
143
|
+
root 'articles#index'
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
|
148
|
+
|
149
|
+
end
|
150
|
+
|
151
|
+
```
|
152
|
+
|
153
|
+
|
154
|
+
|
19
155
|
# 実施してみたこと
|
20
156
|
|
21
157
|
|
22
158
|
|
23
|
-
* route.rbに記載しているdevise_for :usersを削除する方法
|
24
|
-
|
25
|
-
https://qiita.com/hellhellmymy/items/f3d871e849508f1f90eb
|
159
|
+
* [route.rbに記載しているdevise_for :usersを削除する方法](https://qiita.com/hellhellmymy/items/f3d871e849508f1f90eb)
|
26
160
|
|
27
161
|
|
28
162
|
|
29
|
-
* javascriptの設定を見直す
|
30
|
-
|
31
|
-
https://qiita.com/yuskamiya/items/ee5280dfcbca9d7216ae
|
163
|
+
* [javascriptの設定を見直す](https://qiita.com/yuskamiya/items/ee5280dfcbca9d7216ae)
|
32
164
|
|
33
165
|
|
34
166
|
|
35
|
-
* route.rbに明にdestroyアクションを記載する(これが一番成功するかなと思っていたのですが、そもそも私の環境ではapp/views/devise/sessionsの配下にdestroyアクションに対応するviewがない)
|
36
|
-
|
37
|
-
https://qiita.com/colorrabbit/items/5545fce7e5cd4e494396
|
167
|
+
* [route.rbに明にdestroyアクションを記載する](https://qiita.com/colorrabbit/items/5545fce7e5cd4e494396)
|
38
168
|
|
39
169
|
|
40
170
|
|
41
171
|
# deviseを使うのに参考にした記事
|
42
172
|
|
43
|
-
この手順に沿って作成しました。
|
44
|
-
|
45
|
-
https://qiita.com/cigalecigales/items/73d7bd7ec59a001ccd74
|
173
|
+
[deviseの使い方(rails4版)](https://qiita.com/cigalecigales/items/73d7bd7ec59a001ccd74)
|