質問編集履歴
4
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -36,7 +36,7 @@
|
|
36
36
|
|
37
37
|
at alert (users?locale=ja:227)
|
38
38
|
|
39
|
-
at HTMLDocument.<anonymous> (
|
39
|
+
at HTMLDocument.<anonymous> (users?locale
|
40
40
|
|
41
41
|
というエラーになります
|
42
42
|
|
3
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -18,21 +18,31 @@
|
|
18
18
|
|
19
19
|
```
|
20
20
|
|
21
|
+
console.log($("#modal"));
|
22
|
+
|
21
|
-
console.log($("modal").modal
|
23
|
+
console.log($("modal").modal);
|
22
24
|
|
23
25
|
$("#modal").modal();
|
24
26
|
|
25
27
|
```
|
26
28
|
|
29
|
+
をかくと
|
30
|
+
|
31
|
+
jQuery.fn.init [div#modal.modal.fade, context: document, selector: "#modal"]
|
32
|
+
|
27
|
-
|
33
|
+
users?locale=ja:226 undefined
|
28
|
-
|
34
|
+
|
29
|
-
$(...).modal is not a function
|
35
|
+
users?locale=ja:227 Uncaught TypeError: $(...).modal is not a function
|
36
|
+
|
37
|
+
at alert (users?locale=ja:227)
|
38
|
+
|
39
|
+
at HTMLDocument.<anonymous> (p_users?locale
|
30
40
|
|
31
41
|
というエラーになります
|
32
42
|
|
33
43
|
|
34
44
|
|
35
|
-
$("#modal") はきちんと存在してい
|
45
|
+
$("#modal") はきちんと存在していて $("#modal").modal が存在していないみたいです
|
36
46
|
|
37
47
|
|
38
48
|
|
2
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -47,3 +47,161 @@
|
|
47
47
|
他に大量の JS がよみこまれていてわざわざ modal を undefined にするようなものがあるとは考えにくいのですが
|
48
48
|
|
49
49
|
何か考えられる可能性や、原因を調べるにはどこをみればいいか心当たりのある方はいないでしょうか…
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
追記:
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
view は業務内容のためすべてはみせられませんが
|
60
|
+
|
61
|
+
全ページに対して body の序盤に
|
62
|
+
|
63
|
+
以下のようなサブビューを呼び出す render 'modal' をおいてます
|
64
|
+
|
65
|
+
<script> 内はデバッグ用に一時的にいれてて動くようになったら assets 内のJSに移す予定です
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
_modal.html.erb
|
70
|
+
|
71
|
+
```
|
72
|
+
|
73
|
+
<div class="modal fade" id="modal" tabindex="-1">
|
74
|
+
|
75
|
+
<div class="modal-dialog">
|
76
|
+
|
77
|
+
<div class="modal-content">
|
78
|
+
|
79
|
+
<div class="modal-header">
|
80
|
+
|
81
|
+
<button type="button" class="close" data-dismiss="modal"><span>×</span></button>
|
82
|
+
|
83
|
+
<h4 class="modal-title"></h4>
|
84
|
+
|
85
|
+
</div>
|
86
|
+
|
87
|
+
<div class="modal-body">
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
<div class="modal-footer">
|
92
|
+
|
93
|
+
<button type="button" class="btn btn-default" data-dismiss="modal"><%= t 'common.close' %></button>
|
94
|
+
|
95
|
+
</div>
|
96
|
+
|
97
|
+
</div>
|
98
|
+
|
99
|
+
</div>
|
100
|
+
|
101
|
+
</div>
|
102
|
+
|
103
|
+
<script>
|
104
|
+
|
105
|
+
function alert(msg, title='') {
|
106
|
+
|
107
|
+
$("#modal .modal-body").html(msg);
|
108
|
+
|
109
|
+
$("#modal .modal-title").html(title);
|
110
|
+
|
111
|
+
console.log($("#modal").modal);
|
112
|
+
|
113
|
+
$("#modal").modal();
|
114
|
+
|
115
|
+
}
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
$(function () {
|
120
|
+
|
121
|
+
alert('test');
|
122
|
+
|
123
|
+
});
|
124
|
+
|
125
|
+
</script>
|
126
|
+
|
127
|
+
```
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
さらにテスト用に下記の様なシステムと同じ bootstrap, jquery のみよみこんだ
|
132
|
+
|
133
|
+
最小セットのHTMLをかいてブラウザで表示させると modal は動きます
|
134
|
+
|
135
|
+
なので途中によみこまれるJSのどこかでわざわざ undefined で上書きされてるとしか思えないのですが
|
136
|
+
|
137
|
+
'modal' という単語でリポジトリ内を全検索してもそれらしいコードはみあたりませんでした…
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
```
|
142
|
+
|
143
|
+
<html>
|
144
|
+
|
145
|
+
<head>
|
146
|
+
|
147
|
+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
|
148
|
+
|
149
|
+
<script src="https://code.jquery.com/jquery-2.1.4.min.js" data-turbolinks-eval="false"></script>
|
150
|
+
|
151
|
+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js" data-turbolinks-eval="false"></script>
|
152
|
+
|
153
|
+
</head>
|
154
|
+
|
155
|
+
<body>
|
156
|
+
|
157
|
+
<div class="modal fade" id="modal" tabindex="-1">
|
158
|
+
|
159
|
+
<div class="modal-dialog">
|
160
|
+
|
161
|
+
<div class="modal-content">
|
162
|
+
|
163
|
+
<div class="modal-header">
|
164
|
+
|
165
|
+
<button type="button" class="close" data-dismiss="modal"><span>×</span></button>
|
166
|
+
|
167
|
+
<h4 class="modal-title">test</h4>
|
168
|
+
|
169
|
+
</div>
|
170
|
+
|
171
|
+
<div class="modal-body">
|
172
|
+
|
173
|
+
test body
|
174
|
+
|
175
|
+
</div>
|
176
|
+
|
177
|
+
<div class="modal-footer">
|
178
|
+
|
179
|
+
<button type="button" class="btn btn-default" data-dismiss="modal"><%= t 'common.close' %></button>
|
180
|
+
|
181
|
+
</div>
|
182
|
+
|
183
|
+
</div>
|
184
|
+
|
185
|
+
</div>
|
186
|
+
|
187
|
+
</div>
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
<script>
|
192
|
+
|
193
|
+
$(function () {
|
194
|
+
|
195
|
+
$("#modal").modal();
|
196
|
+
|
197
|
+
});
|
198
|
+
|
199
|
+
</script>
|
200
|
+
|
201
|
+
</body>
|
202
|
+
|
203
|
+
</html>
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
```
|
1
タグ変更
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|