質問編集履歴

2

投稿ページのheadにもjavascript読み込みのコードを記載しました。

2019/03/12 07:42

投稿

k.chisato
k.chisato

スコア18

test CHANGED
File without changes
test CHANGED
@@ -160,6 +160,8 @@
160
160
 
161
161
  <script src="new.js"></script>
162
162
 
163
+   <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
164
+
163
165
  </head>
164
166
 
165
167
  <body>

1

コードを切り取って記載していたので、フルで記載し直しました。(まだ汚くて恥ずかしいですが・・・)

2019/03/12 07:42

投稿

k.chisato
k.chisato

スコア18

test CHANGED
File without changes
test CHANGED
@@ -52,50 +52,332 @@
52
52
 
53
53
  ```html
54
54
 
55
- <head>
56
-
57
- <script src="new.js"></script>
58
-
59
- </head>
60
-
61
-
62
-
63
- <body>
64
-
65
- <div class="input-field col s12 country-select">
66
-
67
- <select>
68
-
69
- <optgroup label="team 1">
70
-
71
- <option value="1">Option 1</option>
72
-
73
- <option value="2">Option 2</option>
74
-
75
- </optgroup>
76
-
77
- <optgroup label="team 2">
78
-
79
- <option value="3">Option 3</option>
80
-
81
- <option value="4">Option 4</option>
82
-
83
- </optgroup>
84
-
85
- </select>
86
-
87
- <label>国</label>
88
-
89
- </div>
90
-
91
- </body>
92
-
93
-
55
+ <!-- ここでmaterializeを読み込んでいます! -->
56
+
57
+ <!DOCTYPE html>
58
+
59
+ <html>
60
+
61
+ <head>
62
+
63
+ <meta charset="UTF-8" />
64
+
65
+ <title>LifeStampRally</title>
66
+
67
+ <style type="text/css" href="./style.css">
68
+
69
+ </style>
70
+
71
+ <!-- Compiled and minified CSS -->
72
+
73
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
74
+
75
+
76
+
77
+ <!-- Compiled and minified JavaScript -->
78
+
79
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
80
+
81
+
82
+
83
+ <!--CSS-->
84
+
85
+ <link rel="stylesheet" href="index.css">
86
+
87
+
88
+
89
+ <!--アイコン用-->
90
+
91
+ <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
92
+
93
+
94
+
95
+ <!--jQuery-->
96
+
97
+ <script
98
+
99
+ src="https://code.jquery.com/jquery-3.3.1.js"
100
+
101
+ integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60="
102
+
103
+ crossorigin="anonymous"></script>
104
+
105
+
106
+
107
+ <%= csrf_meta_tags %>
108
+
109
+ <%= csp_meta_tag %>
110
+
111
+
112
+
113
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
114
+
115
+ <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
116
+
117
+ </head>
118
+
119
+
120
+
121
+ <body>
122
+
123
+ <nav class="white navigation">
124
+
125
+ <div class="nav-wrapper">
126
+
127
+ <a href="/" class="brand-logo green-text">Life Stamp Rally</a>
128
+
129
+ <ul class="right hide-on-med-and-down">
130
+
131
+ <li><a href="/stamps/new" class="waves-effect waves-light btn card-panel teal lighten-1"><i class="material-icons left">cloud_upload</i>Stamp!</a></li>
132
+
133
+ </ul>
134
+
135
+ </div>
136
+
137
+ </nav>
138
+
139
+
140
+
141
+ <%= yield %>
142
+
143
+ </body>
144
+
145
+ </html>
94
146
 
95
147
  ```
96
148
 
97
149
 
98
150
 
151
+ ```html
152
+
153
+ <!DOCTYPE html>
154
+
155
+ <!--ここがキャプチャの投稿画面です-->
156
+
157
+ <html>
158
+
159
+ <head>
160
+
161
+ <script src="new.js"></script>
162
+
163
+ </head>
164
+
165
+ <body>
166
+
167
+ <!--カード-->
168
+
169
+ <div class="col s12 m7">
170
+
171
+ <%= form_for @photo, :url => {:action => 'create'} do |f| %>
172
+
173
+ <h5 class="header">Let's STAMP the memory about your journey</h5>
174
+
175
+ <div class="card horizontal">
176
+
177
+ <div class="card-image">
178
+
179
+ <!--アップした写真を表示したい-->
180
+
181
+ <img src="http://butsuri.fun/wp-content/uploads/2018/04/757226.jpg">
182
+
183
+ </div>
184
+
185
+ <div class="card-stacked">
186
+
187
+ <div class="card-content">
188
+
189
+ <!--タイトル、そもそもいる?-->
190
+
191
+ <div class="row title">
192
+
193
+ <form class="col s12">
194
+
195
+ <div class="row">
196
+
197
+ <div class="input-field col s6">
198
+
199
+ <!--データ型変更しないと!-->
200
+
201
+ <input id="icon_prefix" type="text" name="title" class="validate">
202
+
203
+ <label for="icon_prefix">タイトル</label>
204
+
205
+ </div>
206
+
207
+ </div>
208
+
209
+ </form>
210
+
211
+ </div>
212
+
213
+
214
+
215
+ <!--国選択-->
216
+
217
+ <div class="input-field col s12 country-select">
218
+
219
+ <select>
220
+
221
+ <optgroup label="team 1">
222
+
223
+ <option value="1">Option 1</option>
224
+
225
+ <option value="2">Option 2</option>
226
+
227
+ </optgroup>
228
+
229
+ <optgroup label="team 2">
230
+
231
+ <option value="3">Option 3</option>
232
+
233
+ <option value="4">Option 4</option>
234
+
235
+ </optgroup>
236
+
237
+ </select>
238
+
239
+ <label>国</label>
240
+
241
+  </div>
242
+
243
+
244
+
245
+ <label class="field waves-effect waves-light btn card-panel teal lighten-1">
246
+
247
+ <a><i class="large material-icons left">camera_alt</i></a>
248
+
249
+ <div id="filename">
250
+
251
+   <%= f.file_field :photo, multiple: true, :value => "photo" %>
252
+
253
+  </div>
254
+
255
+ </label>
256
+
257
+ <textarea name="text" placeholder="メモ" rows="10" cols="30"></textarea>
258
+
259
+ </div>
260
+
261
+ <div class="card-action">
262
+
263
+ <input type="submit" value="Stamp!!">
264
+
265
+ </div>
266
+
267
+ </div>
268
+
269
+ </div>
270
+
271
+ <% end %>
272
+
273
+ </div>
274
+
275
+
276
+
277
+ </body>
278
+
279
+ </html>
280
+
281
+ ```
282
+
283
+
284
+
285
+ ```css
286
+
287
+ .col{
288
+
289
+ margin:0 auto;
290
+
291
+ }
292
+
293
+
294
+
295
+ .header{
296
+
297
+ text-align:center
298
+
299
+ }
300
+
301
+
302
+
303
+ .card{
304
+
305
+ margin:0 auto;
306
+
307
+ width:610px;
308
+
309
+ height:400px;
310
+
311
+ }
312
+
313
+
314
+
315
+ .card-image{
316
+
317
+ width:30%;
318
+
319
+ }
320
+
321
+
322
+
323
+ .card-content input{
324
+
325
+ width: 320px;
326
+
327
+ }
328
+
329
+
330
+
331
+ .card-content title{
332
+
333
+ display:block;
334
+
335
+ padding-bottom:20px;
336
+
337
+ }
338
+
339
+
340
+
341
+ .country-select{
342
+
343
+ display:block;
344
+
345
+ padding-bottom:50px;
346
+
347
+ }
348
+
349
+
350
+
351
+ .btn a{
352
+
353
+ color:white;
354
+
355
+ font-size: 1000px;
356
+
357
+ }
358
+
359
+
360
+
361
+ .btn i{
362
+
363
+ display:block;
364
+
365
+ margin:0 auto;
366
+
367
+ }
368
+
369
+
370
+
371
+ #filename{
372
+
373
+ display: none;
374
+
375
+ }
376
+
377
+ ```
378
+
379
+
380
+
99
381
  ```js
100
382
 
101
383
  document.addEventListener('DOMContentLoaded', function() {