質問するログイン新規登録

質問編集履歴

6

修正

2021/12/26 13:30

投稿

ria_ria
ria_ria

スコア4

title CHANGED
File without changes
body CHANGED
@@ -118,7 +118,7 @@
118
118
  $('#memo').append($('<option>').val(value.id).text(value.name));
119
119
  })
120
120
  })
121
- .$fail(function(jqXHR, textStatus, errorThrown){
121
+ .fail(function(jqXHR, textStatus, errorThrown){
122
122
  console.log(jqXHR);
123
123
  console.log(textStatus);
124
124
  console.log(errorThrown);

5

更新

2021/12/26 13:30

投稿

ria_ria
ria_ria

スコア4

title CHANGED
File without changes
body CHANGED
@@ -46,7 +46,8 @@
46
46
  初心者で至らない点があると思いますが、よろしくお願いいたします。
47
47
  ### 補足情報
48
48
  ```progressblade
49
+
49
- @extends('layouts.app')
50
+ @extends('layouts.app')
50
51
  @section('content')
51
52
 
52
53
 
@@ -59,11 +60,10 @@
59
60
 
60
61
  @csrf
61
62
  <input type='hidden' name='user_id' value="{{ $user['id'] }}">
62
-
63
- <div class="form-group row”>
63
+   <div class="form-group row”>
64
64
  <label for="memo">科目</label>
65
65
 
66
- <select name='tagname' id=tagname type="select" class="form-control" >
66
+ <select name='tagname' id="tagname" type="select" class="form-control" >
67
67
  @foreach($tags as $tag)
68
68
  <option value="{{ $tag['tagname']}}">{{ $tag['tagname']}}</option>
69
69
  @endforeach
@@ -72,13 +72,12 @@
72
72
  <div class="form-group row”>
73
73
  <label for="memo">課題</label>
74
74
 
75
- <select name='content' id=memo type="select" class="form-control" >
75
+ <select name='content' id="memo" type="select" class="form-control" >
76
76
  @foreach($memos as $memo)
77
77
 
78
78
  <option value="{{ $memo['content']}}">{{ $memo['content']}}</option>
79
79
  @endforeach
80
80
  </select>
81
-
82
81
 
83
82
  <div class="text-center">
84
83
  <button type='submit' class="btn btn-danger btn-lg">登録する</button>
@@ -87,12 +86,13 @@
87
86
  </div>
88
87
  </div>
89
88
  </div>
89
+ @endsection
90
90
 
91
- @endsection
92
91
  @push('scripts')
93
- <script src="{{ asset('/js/progress.js') }}"></script>
92
+ <script src="{{ asset('/js/progress.js') }}" type="module"></script>
94
93
  @endpush
95
94
 
95
+
96
96
  ```
97
97
  ```progressjs
98
98
  $(function() {
@@ -118,9 +118,12 @@
118
118
  $('#memo').append($('<option>').val(value.id).text(value.name));
119
119
  })
120
120
  })
121
- .fail(function() {
121
+ .$fail(function(jqXHR, textStatus, errorThrown){
122
+ console.log(jqXHR);
122
- // 失敗した際の処理を記述
123
+ console.log(textStatus);
124
+ console.log(errorThrown);
123
- })
125
+ });
126
+
124
127
  })
125
128
  })
126
129
 
@@ -129,8 +132,7 @@
129
132
  ```
130
133
  ```app
131
134
  layoutsのapp.blade.php
132
-
133
- <!doctype html>
135
+ <!doctype html>
134
136
  <html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
135
137
  <head>
136
138
  <meta charset="utf-8">
@@ -142,8 +144,9 @@
142
144
  <title>{{ config('app.name', 'SimpleNote') }}</title>
143
145
 
144
146
  <!-- Scripts -->
147
+
145
- <script src="{{ '/js/app.js' }}" defer></script>
148
+ <script src="{{ asset('js/app.js') }}" defer></script>
146
- @yield('js')
149
+ @yield('js')
147
150
 
148
151
  <!-- Fonts -->
149
152
  <link rel="dns-prefetch" href="//fonts.gstatic.com">
@@ -151,11 +154,19 @@
151
154
  <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet">
152
155
 
153
156
  <!-- Styles -->
157
+
154
- <link href="{{ '/css/app.css' }}" rel="stylesheet">
158
+ <link href="{{ asset('css/app.css') }}" rel="stylesheet">
155
- <link href="{{ '/css/utility.css' }}" rel="stylesheet">
159
+ <link href="{{ asset('css/utility.css') }}" rel="stylesheet">
160
+ @yield('css')
161
+
162
+
156
163
 
164
+ <script src="//code.jquery.com/jquery-1.12.1.min.js"></script>
165
+ {{-- <script src="{{ asset('js/progress.js') }}" defer></script> --}}
157
166
  @stack('scripts')
158
- @yield('css')
167
+
168
+
169
+
159
170
  </head>
160
171
  <body>
161
172
  <div id="app">    
@@ -248,6 +259,9 @@
248
259
  </div>
249
260
  </div>
250
261
  </div>
262
+
263
+
264
+
251
265
  </div>
252
266
  </div>
253
267
  </div> <!-- col-md-3 -->
@@ -268,5 +282,4 @@
268
282
  </body>
269
283
  </html>
270
284
  ```
271
- ![イメージ説明](9371fe315e140c59ebd4c816a6cdc3aa.png)
285
+ ![イメージ説明](38840a495221a0b8dfb4830a1da758ac.png)
272
- ![イメージ説明](6f6f814cc73add9d1c40d671aba3e040.png)

4

追記

2021/12/26 12:23

投稿

ria_ria
ria_ria

スコア4

title CHANGED
File without changes
body CHANGED
@@ -268,4 +268,5 @@
268
268
  </body>
269
269
  </html>
270
270
  ```
271
- ![イメージ説明](9371fe315e140c59ebd4c816a6cdc3aa.png)
271
+ ![イメージ説明](9371fe315e140c59ebd4c816a6cdc3aa.png)
272
+ ![イメージ説明](6f6f814cc73add9d1c40d671aba3e040.png)

3

追記

2021/12/26 07:30

投稿

ria_ria
ria_ria

スコア4

title CHANGED
File without changes
body CHANGED
@@ -45,4 +45,227 @@
45
45
  色々調べましたが、わかりませんでした。できなくて本当に困っています。
46
46
  初心者で至らない点があると思いますが、よろしくお願いいたします。
47
47
  ### 補足情報
48
- 画像を載せさせていただきました。
48
+ ```progressblade
49
+ @extends('layouts.app')
50
+ @section('content')
51
+
52
+
53
+ <div class="row justify-content-center ml-0 mr-0 h-100">
54
+ <div class="card w-100">
55
+ <div class="card-header">進捗状況登録</div>
56
+
57
+ <div class="card-body">
58
+ <form method='POST' action="/store2">
59
+
60
+ @csrf
61
+ <input type='hidden' name='user_id' value="{{ $user['id'] }}">
62
+
63
+ <div class="form-group row”>
64
+ <label for="memo">科目</label>
65
+
66
+ <select name='tagname' id=tagname type="select" class="form-control" >
67
+ @foreach($tags as $tag)
68
+ <option value="{{ $tag['tagname']}}">{{ $tag['tagname']}}</option>
69
+ @endforeach
70
+ </select>
71
+ <div>
72
+ <div class="form-group row”>
73
+ <label for="memo">課題</label>
74
+
75
+ <select name='content' id=memo type="select" class="form-control" >
76
+ @foreach($memos as $memo)
77
+
78
+ <option value="{{ $memo['content']}}">{{ $memo['content']}}</option>
79
+ @endforeach
80
+ </select>
81
+
82
+
83
+ <div class="text-center">
84
+ <button type='submit' class="btn btn-danger btn-lg">登録する</button>
85
+ </div>
86
+ </form>
87
+ </div>
88
+ </div>
89
+ </div>
90
+
91
+ @endsection
92
+ @push('scripts')
93
+ <script src="{{ asset('/js/progress.js') }}"></script>
94
+ @endpush
95
+
96
+ ```
97
+ ```progressjs
98
+ $(function() {
99
+ // 「科目」のセレクトボックスが変更された場合
100
+ $('#tagname').on('change', function() {
101
+ // value属性の値を取得
102
+ let tag_name_val = $(this).val();
103
+ // tag_name_valをHomeControllerへ渡す
104
+ $.ajax({
105
+ headers: {
106
+ 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
107
+ },
108
+ type: "POST",
109
+ url: "/addContent",
110
+ dataType: "JSON",
111
+ data: {
112
+ val: tag_name_val
113
+ }
114
+ })
115
+ .done(function(data) {
116
+ $.each(data['memos'], function(index, value) {
117
+ // コントローラ側で取得した課題のデータをセレクトボックスに追加する
118
+ $('#memo').append($('<option>').val(value.id).text(value.name));
119
+ })
120
+ })
121
+ .fail(function() {
122
+ // 失敗した際の処理を記述
123
+ })
124
+ })
125
+ })
126
+
127
+
128
+
129
+ ```
130
+ ```app
131
+ layoutsのapp.blade.php
132
+
133
+ <!doctype html>
134
+ <html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
135
+ <head>
136
+ <meta charset="utf-8">
137
+ <meta name="viewport" content="width=device-width, initial-scale=1">
138
+ <body bgcolor="black" text="white">
139
+ <!-- CSRF Token -->
140
+ <meta name="csrf-token" content="{{ csrf_token() }}">
141
+
142
+ <title>{{ config('app.name', 'SimpleNote') }}</title>
143
+
144
+ <!-- Scripts -->
145
+ <script src="{{ '/js/app.js' }}" defer></script>
146
+ @yield('js')
147
+
148
+ <!-- Fonts -->
149
+ <link rel="dns-prefetch" href="//fonts.gstatic.com">
150
+ <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt" crossorigin="anonymous">
151
+ <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet">
152
+
153
+ <!-- Styles -->
154
+ <link href="{{ '/css/app.css' }}" rel="stylesheet">
155
+ <link href="{{ '/css/utility.css' }}" rel="stylesheet">
156
+
157
+ @stack('scripts')
158
+ @yield('css')
159
+ </head>
160
+ <body>
161
+ <div id="app">    
162
+ <nav class="navbar navbar-expand-md navbar-light bg-white shadow-sm">
163
+ <div class="container">
164
+ <a class="navbar-brand" href="{{ url('/') }}">
165
+ {{ config('app.name', 'Laravel') }}
166
+ </a>
167
+ <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="{{ __('Toggle navigation') }}">
168
+ <span class="navbar-toggler-icon"></span>
169
+ </button>
170
+
171
+ <div class="collapse navbar-collapse" id="navbarSupportedContent">
172
+ <!-- Left Side Of Navbar -->
173
+ <ul class="navbar-nav mr-auto">
174
+
175
+ </ul>
176
+
177
+ <!-- Right Side Of Navbar -->
178
+ <ul class="navbar-nav ml-auto">
179
+ <!-- Authentication Links -->
180
+ @guest
181
+ <li class="nav-item">
182
+ <a class="nav-link" href="{{ route('login') }}">{{ __('Login') }}</a>
183
+ </li>
184
+ @if (Route::has('register'))
185
+ <li class="nav-item">
186
+ <a class="nav-link" href="{{ route('register') }}">{{ __('Register') }}</a>
187
+ </li>
188
+ @endif
189
+ @else
190
+ <li class="nav-item dropdown">
191
+ <a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" v-pre>
192
+ {{ Auth::user()->name }} <span class="caret"></span>
193
+ </a>
194
+
195
+ <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
196
+ <a class="dropdown-item" href="{{ route('logout') }}"
197
+ onclick="event.preventDefault();
198
+ document.getElementById('logout-form').submit();">
199
+ {{ __('ログアウト') }}
200
+ </a>
201
+
202
+ <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
203
+ @csrf
204
+ </form>
205
+ </div>
206
+ </li>
207
+ @endguest
208
+ </ul>
209
+ </div>
210
+ </div>
211
+ </nav>
212
+
213
+ <main class="main">
214
+ @if(session('success'))
215
+ <div class="alert alert-success" role="alert">
216
+ {{ session('success') }}
217
+ </div>
218
+ @endif
219
+
220
+ <div class="card" style="width: 18rem;">
221
+ <ul class="list-group list-group-flush">
222
+ <li class="list-group-item">
223
+ <a href="{{ url('/mypage') }}"> マイページ </a>
224
+ </li>
225
+ <li class="list-group-item">
226
+ <a href="{{ url('/add') }}"> 科目登録 </a>
227
+ </li>
228
+ <li class="list-group-item">
229
+ <a href="{{ url('/create') }}"> 課題作成 </a></li>
230
+ <li class="list-group-item">
231
+ <a href="{{ url('/progress') }}"> 進捗状況登録 </a></li>
232
+ </ul>
233
+ </div>
234
+ </div>
235
+ <p></p>
236
+ <div class="card" style="width: 18rem;">
237
+ <div class="card w-100 ">
238
+ <div class="card-header">科目一覧</div>
239
+ <p></p>
240
+ <a href="{{ url('/kadai') }}"> 科目名(課題詳細) </a></li>
241
+ @foreach($tags as $tag)
242
+
243
+ <a href="/?tag={{ $tag['tagname'] }}" class='d-block'>{{ $tag['tagname'] }}</a>
244
+ @endforeach
245
+
246
+ <div class="card-body ">
247
+ </div>
248
+ </div>
249
+ </div>
250
+ </div>
251
+ </div>
252
+ </div>
253
+ </div> <!-- col-md-3 -->
254
+
255
+ <div style="position:absolute; top:80px; left:300px;'>
256
+ <div class="col-md-8">
257
+
258
+ @yield('content')
259
+ </div>
260
+ </div>
261
+ </div>
262
+ </div>
263
+ </div> <!-- row justify-content-center -->
264
+ </div>
265
+ </main>
266
+ </div>
267
+ @yield('footer')
268
+ </body>
269
+ </html>
270
+ ```
271
+ ![イメージ説明](9371fe315e140c59ebd4c816a6cdc3aa.png)

2

誤字

2021/12/26 05:31

投稿

ria_ria
ria_ria

スコア4

title CHANGED
File without changes
body CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  ### 該当のソースコード
12
12
 
13
- ```progresds
13
+ ```progress
14
14
  <div class="form-group row”>
15
15
  <label for="memo">科目</label>
16
16
  <select name='tagname' class="form-control" >

1

修正

2021/12/26 02:22

投稿

ria_ria
ria_ria

スコア4

title CHANGED
File without changes
body CHANGED
@@ -45,5 +45,4 @@
45
45
  色々調べましたが、わかりませんでした。できなくて本当に困っています。
46
46
  初心者で至らない点があると思いますが、よろしくお願いいたします。
47
47
  ### 補足情報
48
- 画像を載せさせていただきました。
48
+ 画像を載せさせていただきました。
49
- 詳しく、コードを教えていただけたら幸いです。