質問編集履歴

1

コード修正

2018/06/13 06:16

投稿

koichi8888
koichi8888

スコア24

test CHANGED
File without changes
test CHANGED
@@ -94,88 +94,50 @@
94
94
 
95
95
  items = GyomuDatum.where('manage_id LIKE ?', "%#{params[:manage_id]}%")
96
96
 
97
- pp "manage_id_debug"
98
-
99
- pp items
100
-
101
97
  elsif params[:category_id].present?
102
98
 
103
99
  items = GyomuDatum.where('category_id LIKE ?', "%#{params[:category_id]}%")
104
100
 
105
- pp "category_id_debug"
106
-
107
- pp items
108
-
109
101
  elsif params[:publish_corporation].present?
110
102
 
111
103
  items = GyomuDatum.where('publish_corporation LIKE ?', "%#{params[:publish_corporation]}%")
112
104
 
113
- pp "publish_corporation_debug"
114
-
115
- pp items
116
-
117
- pp items
118
-
119
105
  elsif params[:ip_address].present?
120
106
 
121
107
  items = GyomuDatum.where('ip_address LIKE ?', "%#{params[:ip_address]}%")
122
108
 
123
- pp "ip_address_debug"
124
-
125
- pp items
126
-
127
109
  elsif params[:target_server].present?
128
110
 
129
111
  items = GyomuDatum.where('target_server LIKE ?', "%#{params[:target_server]}%")
130
112
 
131
- pp "target_server_debug"
132
-
133
- pp items
134
-
135
113
  elsif params[:start_date].present?
136
114
 
137
115
  items = GyomuDatum.where('start_date LIKE ?', "%#{params[:start_date]}%")
138
116
 
139
- pp "start_date_debug"
140
-
141
- pp items
142
-
143
117
  elsif params[:end_date].present?
144
118
 
145
119
  items = GyomuDatum.where('end_date LIKE ?', "%#{params[:end_date]}%")
146
120
 
147
- pp "end_date_debug"
148
-
149
- pp items
150
-
151
121
  elsif params[:comment].present?
152
122
 
153
123
  items = GyomuDatum.where('comment LIKE ?', "%#{params[:comment]}%")
154
124
 
155
- pp "comment_debug"
125
+
156
-
157
- pp items
158
126
 
159
127
  else
160
128
 
161
129
  items = GyomuDatum.all.order(created_at: 'desc')
162
130
 
163
- pp "all_debug"
131
+
164
-
165
- pp items
166
132
 
167
133
  end
168
134
 
135
+
136
+
169
137
 
170
138
 
171
- pp "elseout"
172
-
173
- pp items
174
-
175
139
 
176
140
 
177
-
178
-
179
141
 
180
142
 
181
143
  pp "############データ検索終了############"
@@ -202,57 +164,183 @@
202
164
 
203
165
 
204
166
 
167
+ end
168
+
169
+
170
+
205
- # レコード数カウント
171
+ def show
172
+
206
-
173
+ end
174
+
175
+
176
+
177
+ def new
178
+
207
- #record = GyomuDatum.count
179
+ @item = GyomuDatum.new
208
-
209
- #record = GyomuDatum.group(:created_at).count(:created_at)
180
+
210
-
211
- #record = select count(*) as cnt from GyomuDatum where created_at = 201806*;
212
-
213
- record = GyomuDatum.group(:category_id).count
214
-
215
-
216
-
217
- pp "レコード数表示"
181
+ end
218
-
182
+
183
+
184
+
219
- pp record
185
+ def create
186
+
187
+
188
+
189
+ # 変数定義
220
190
 
221
191
 
222
192
 
193
+ @item = GyomuDatum.new(item_params)
194
+
195
+ manage_id = @item.manage_id
196
+
197
+ category_id = @item.category_id
198
+
199
+
200
+
201
+
202
+
203
+ # 現在の時刻取得
204
+
205
+ require "date"
206
+
207
+ time = DateTime.now
208
+
209
+
210
+
211
+ # 操作履歴登録
212
+
213
+ histories = HistoriesDatum.new({manage_id: manage_id, category_id: category_id, type_id: '1', user_id: session[:user_id], user_name: session[:user_name], created_at: time, updated_at: time, deleted_at: ""})
214
+
215
+ histories.save
216
+
217
+
218
+
219
+
220
+
221
+ # データ登録判定
222
+
223
+
224
+
225
+ if @item.save
226
+
227
+ @notice_message = "データ登録成功"
228
+
229
+ flash[:notice] = @notice_message
230
+
231
+ redirect_to items_path
232
+
233
+ else
234
+
235
+ @notice_message = "データ登録失敗"
236
+
237
+ flash[:notice] = @notice_message
238
+
239
+ render 'new'
240
+
241
+ end
242
+
223
243
  end
224
244
 
225
-
226
-
245
+
246
+
247
+
248
+
227
- def show
249
+ def edit
250
+
251
+ @item = GyomuDatum.find(params[:id])
228
252
 
229
253
  end
230
254
 
255
+
256
+
257
+ def update
258
+
231
259
 
232
260
 
233
- def new
234
-
235
- @item = GyomuDatum.new
261
+ # データ更新処理
262
+
263
+
264
+
265
+ # 変数定義
266
+
267
+ @item = GyomuDatum.find(params[:id])
268
+
269
+ manage_id = @item.manage_id
270
+
271
+ category_id = @item.category_id
272
+
273
+
274
+
275
+ # 現在の時刻取得
276
+
277
+ require "date"
278
+
279
+ time = DateTime.now
280
+
281
+
282
+
283
+ # 操作履歴登録
284
+
285
+ histories = HistoriesDatum.new({manage_id: manage_id, category_id: category_id, type_id: '2', user_id: session[:user_id], user_name: session[:user_name], created_at: time, updated_at: time, deleted_at: ""})
286
+
287
+ histories.save
288
+
289
+
290
+
291
+ # データ編集処理判定
292
+
293
+ if @item.update(item_params)
294
+
295
+ @notice_message = "データ編集成功"
296
+
297
+ flash[:notice] = @notice_message
298
+
299
+ redirect_to items_path
300
+
301
+ else
302
+
303
+ @notice_message = "データ編集失敗"
304
+
305
+ flash[:notice] = @notice_message
306
+
307
+ render 'edit'
308
+
309
+ end
236
310
 
237
311
  end
238
312
 
239
-
240
-
313
+
314
+
241
- def create
315
+ def destroy
316
+
317
+
318
+
242
-
319
+ # データ削除処理
243
-
320
+
321
+
244
322
 
245
323
  # 変数定義
246
324
 
325
+ @item = GyomuDatum.find(params[:id])
326
+
327
+ manage_id = @item.manage_id
328
+
329
+ category_id = @item.category_id
330
+
247
331
 
248
332
 
249
- @item = GyomuDatum.new(item_params)
250
-
251
- manage_id = @item.manage_id
333
+ # category_idの値を整数にする
252
-
334
+
253
- category_id = @item.category_id
335
+ if category_id == "SSL"
336
+
254
-
337
+ category_id = 1
338
+
255
-
339
+ elsif category_id == "ドメイン"
340
+
341
+ category_id = 2
342
+
343
+ end
256
344
 
257
345
 
258
346
 
@@ -266,642 +354,494 @@
266
354
 
267
355
  # 操作履歴登録
268
356
 
269
- histories = HistoriesDatum.new({manage_id: manage_id, category_id: category_id, type_id: '1', user_id: session[:user_id], user_name: session[:user_name], created_at: time, updated_at: time, deleted_at: ""})
357
+ histories = HistoriesDatum.new({manage_id: manage_id, category_id: category_id, type_id: '3', user_id: session[:user_id], user_name: session[:user_name], created_at: time, updated_at: time, deleted_at: ""})
270
358
 
271
359
  histories.save
272
360
 
361
+
362
+
363
+ # 削除処理
364
+
365
+ @item = GyomuDatum.find(params[:id])
366
+
367
+ @item.destroy
368
+
369
+ redirect_to items_path
370
+
371
+ end
372
+
373
+
374
+
375
+
376
+
377
+ # cron用メール送信メソッド
378
+
379
+ def mail_notice
380
+
381
+
382
+
383
+ # メール送信実行
384
+
385
+ SampleMailer.send_when_limit.deliver
386
+
387
+
388
+
389
+ end
390
+
391
+
392
+
393
+ # プライベートメソッド
394
+
395
+ private
396
+
397
+ def item_params
398
+
399
+ permits = [
400
+
401
+ :manage_id,
402
+
403
+ :category_id,
404
+
405
+ :publish_corporation,
406
+
407
+ :ip_address,
408
+
409
+ :target_server,
410
+
411
+ :start_date,
412
+
413
+ :end_date,
414
+
415
+ :comment
416
+
417
+ ]
418
+
419
+ params.require(:gyomu_datum).permit(permits)
420
+
421
+ end
422
+
423
+
424
+
425
+ # class範囲終了
426
+
427
+ end
428
+
429
+ ```
430
+
431
+
432
+
433
+ index.html.erb
434
+
435
+ ```html
436
+
437
+ <main>
438
+
439
+ <!-- ↓↓ログインメッセージ、データ登録、編集成功表示↓↓ -->
440
+
441
+
442
+
443
+ <% if flash[:notice] %>
444
+
445
+ <div class="alert alert-success">
446
+
447
+ <%= flash[:notice] %>
448
+
449
+ </div>
450
+
451
+ <% end %>
452
+
453
+
454
+
455
+ <!-- ↑↑ログインメッセージ、データ登録、編集成功表示↑↑ -->
456
+
457
+
458
+
459
+
460
+
461
+ <br>
462
+
463
+ <br>
464
+
465
+ <br>
466
+
467
+ <p class="rei1">通知</p>
468
+
469
+ <br>
470
+
471
+ <br>
472
+
473
+
474
+
475
+ <% @items_1month.each do |item| %>
476
+
477
+ <ul>
478
+
479
+ <li>
480
+
481
+ 管理ID <%= item.manage_id %> は期限切れまであとXX日です。有効期限の終了日は <%= item.end_date %> です。
482
+
483
+ </li>
484
+
485
+ </ul>
486
+
487
+ <% end %>
488
+
489
+
490
+
491
+
492
+
493
+ <br>
494
+
495
+ <p class="rei1">データ検索</p>
496
+
497
+
498
+
499
+ <div class="search_forms">
500
+
501
+ <br>
502
+
503
+ <%= form_tag('/items', method: 'get') do %>
504
+
505
+ <%= label_tag(:manage_id, '管理ID') %>
506
+
507
+ <%= text_field_tag(:manage_id) %>
508
+
509
+
510
+
511
+ <% if false %>
512
+
513
+ <%= label_tag(:category_id, 'カテゴリ') %>
514
+
515
+ <%= text_field_tag(:category_id) %>
516
+
517
+ <% end %>
518
+
519
+
520
+
521
+ <%= label_tag(:category_id, 'カテゴリ') %>
522
+
523
+ <%= select_tag 'category_id', options_for_select(["1", "2"]) %>
524
+
525
+
526
+
527
+
528
+
529
+ <%= label_tag(:publish_corporation, '発行会社') %>
530
+
531
+ <%= text_field_tag(:publish_corporation) %>
532
+
533
+
534
+
535
+ <%= label_tag(:ip_address, 'IPアドレス') %>
536
+
537
+ <%= text_field_tag(:ip_address) %>
538
+
539
+ <br>
540
+
541
+ <br>
542
+
543
+
544
+
545
+ <%= label_tag(:target_server, '対象サーバ') %>
546
+
547
+ <%= text_field_tag(:target_server) %>
548
+
549
+
550
+
551
+ <%= label_tag(:start_date, '有効期限の開始日') %>
552
+
553
+ <%= text_field_tag(:start_date) %>
554
+
555
+
556
+
557
+ <%= label_tag(:end_date, '有効期限の終了日') %>
558
+
559
+ <%= text_field_tag(:end_date) %>
560
+
561
+ <br>
562
+
563
+ <br>
564
+
565
+ <%= label_tag(:comment, 'コメント') %>
566
+
567
+ <%= text_field_tag(:comment) %>
568
+
569
+
570
+
571
+ <%= submit_tag "検索", class: "form_button" %> <%= link_to 'クリア', items_path %>
572
+
573
+ <% end %>
574
+
575
+ </div>
576
+
577
+
578
+
579
+
580
+
581
+ <br>
582
+
583
+ <p class="rei1">データ一覧</p>
584
+
585
+ <br>
586
+
587
+
588
+
589
+ <!-- 権限によってデータ一覧の項目値を変更 -->
590
+
591
+
592
+
593
+ <section>
594
+
595
+
596
+
597
+ <!-- 追加箇所開始 -->
598
+
599
+ <% if false %>
600
+
601
+ <%= page_entries_info @items %>
602
+
603
+ <% end %>
604
+
605
+ <!-- 追加箇所終了 -->
606
+
607
+
608
+
609
+
610
+
611
+ <table class="type06">
612
+
613
+ <thead>
614
+
615
+
616
+
617
+ <% if session[:authority] == "Admin" %>
618
+
619
+
620
+
621
+ <tr>
622
+
623
+ <th>管理ID</th>
624
+
625
+ <th>カテゴリ</th>
626
+
627
+ <th>発行会社</th>
628
+
629
+ <th>IPアドレス</th>
630
+
631
+ <th>対象サーバ</th>
632
+
633
+ <th>有効期限の開始日</th>
634
+
635
+ <th>有効期限の終了日</th>
636
+
637
+ <th>コメント</th>
638
+
639
+ <th>操作</th>
640
+
641
+ </tr>
642
+
643
+
644
+
645
+ </thead>
646
+
647
+ <tbody>
648
+
273
649
 
274
650
 
275
-
276
-
277
- # @item = GyomuDatum.new(item_params)
278
-
279
-
280
-
281
- # データ登録判定
282
-
283
-
284
-
285
- if @item.save
286
-
287
- @notice_message = "データ登録成功"
288
-
289
- flash[:notice] = @notice_message
290
-
291
- redirect_to items_path
292
-
293
- else
294
-
295
- @notice_message = "データ登録失敗"
296
-
297
- flash[:notice] = @notice_message
298
-
299
- render 'new'
300
-
301
- end
302
-
303
- end
304
-
305
-
306
-
307
-
308
-
309
- def edit
310
-
311
- @item = GyomuDatum.find(params[:id])
312
-
313
- end
314
-
315
-
316
-
317
- def update
318
-
319
-
320
-
321
- # データ更新処理
322
-
323
-
324
-
325
- # 変数定義
326
-
327
- @item = GyomuDatum.find(params[:id])
328
-
329
- manage_id = @item.manage_id
330
-
331
- category_id = @item.category_id
332
-
333
-
334
-
335
- # 現在の時刻取得
336
-
337
- require "date"
338
-
339
- time = DateTime.now
340
-
341
-
342
-
343
- # 操作履歴登録
344
-
345
- histories = HistoriesDatum.new({manage_id: manage_id, category_id: category_id, type_id: '2', user_id: session[:user_id], user_name: session[:user_name], created_at: time, updated_at: time, deleted_at: ""})
346
-
347
- histories.save
348
-
349
-
350
-
351
- # データ編集処理判定
352
-
353
- if @item.update(item_params)
354
-
355
- @notice_message = "データ編集成功"
356
-
357
- flash[:notice] = @notice_message
358
-
359
- redirect_to items_path
360
-
361
- else
362
-
363
- @notice_message = "データ編集失敗"
364
-
365
- flash[:notice] = @notice_message
366
-
367
- render 'edit'
368
-
369
- end
370
-
371
- end
372
-
373
-
374
-
375
- def destroy
376
-
377
-
378
-
379
- # データ削除処理
380
-
381
-
382
-
383
- # 変数定義
384
-
385
- @item = GyomuDatum.find(params[:id])
386
-
387
- manage_id = @item.manage_id
388
-
389
- category_id = @item.category_id
390
-
391
-
392
-
393
- # category_idの値を整数にする
394
-
395
- if category_id == "SSL"
396
-
397
- category_id = 1
398
-
399
- elsif category_id == "ドメイン"
400
-
401
- category_id = 2
402
-
403
- end
404
-
405
-
406
-
407
- # 現在の時刻取得
408
-
409
- require "date"
410
-
411
- time = DateTime.now
412
-
413
-
414
-
415
- # 操作履歴登録
416
-
417
- histories = HistoriesDatum.new({manage_id: manage_id, category_id: category_id, type_id: '3', user_id: session[:user_id], user_name: session[:user_name], created_at: time, updated_at: time, deleted_at: ""})
418
-
419
- histories.save
420
-
421
-
422
-
423
- # 削除処理
424
-
425
- @item = GyomuDatum.find(params[:id])
426
-
427
- @item.destroy
428
-
429
- redirect_to items_path
430
-
431
- end
432
-
433
-
434
-
435
-
436
-
437
- # cron用メール送信メソッド
438
-
439
- def mail_notice
440
-
441
-
442
-
443
- # メール送信実行
444
-
445
- SampleMailer.send_when_limit.deliver
446
-
447
-
448
-
449
- end
450
-
451
-
452
-
453
- # プライベートメソッド
454
-
455
- private
456
-
457
- def item_params
458
-
459
- permits = [
460
-
461
- :manage_id,
462
-
463
- :category_id,
464
-
465
- :publish_corporation,
466
-
467
- :ip_address,
468
-
469
- :target_server,
470
-
471
- :start_date,
472
-
473
- :end_date,
474
-
475
- :comment
476
-
477
- ]
478
-
479
- params.require(:gyomu_datum).permit(permits)
480
-
481
- end
482
-
483
-
484
-
485
- # class範囲終了
486
-
487
- end
651
+ <% @items.each do |item| %>
652
+
653
+ <tr>
654
+
655
+ <td><%= item.manage_id %></td>
656
+
657
+ <td><%= item.category.name %></td>
658
+
659
+ <td><%= item.publish_corporation %></td>
660
+
661
+ <td><%= item.ip_address %></td>
662
+
663
+ <td><%= item.target_server %></td>
664
+
665
+ <td><%= item.start_date %></td>
666
+
667
+ <td><%= item.end_date %></td>
668
+
669
+ <td><%= item.comment %></td>
670
+
671
+ <td>
672
+
673
+ <%= link_to '[Edit]', edit_item_path(item), class: 'command' %>
674
+
675
+ <%= link_to '[Delete]',
676
+
677
+ item_path(item),
678
+
679
+ method: :delete,
680
+
681
+ class: 'command',
682
+
683
+ data: { confirm: 'データ削除しますか?' } %>
684
+
685
+ </td>
686
+
687
+ </tr>
688
+
689
+
690
+
691
+ <% end %>
692
+
693
+
694
+
695
+
696
+
697
+ <% elsif session[:authority] == "Operator" %>
698
+
699
+
700
+
701
+ <tr>
702
+
703
+ <th>管理ID</th>
704
+
705
+ <th>カテゴリ</th>
706
+
707
+ <th>発行会社</th>
708
+
709
+ <th>IPアドレス</th>
710
+
711
+ <th>対象サーバ</th>
712
+
713
+ <th>有効期限の開始日</th>
714
+
715
+ <th>有効期限の終了日</th>
716
+
717
+ <th>コメント</th>
718
+
719
+ </tr>
720
+
721
+
722
+
723
+ <% @items.each do |item| %>
724
+
725
+ <tr>
726
+
727
+ <td><%= item.manage_id %></td>
728
+
729
+ <td><%= item.category.name %></td>
730
+
731
+ <td><%= item.publish_corporation %></td>
732
+
733
+ <td><%= item.ip_address %></td>
734
+
735
+ <td><%= item.target_server %></td>
736
+
737
+ <td><%= item.start_date %></td>
738
+
739
+ <td><%= item.end_date %></td>
740
+
741
+ <td><%= item.comment %></td>
742
+
743
+ </tr>
744
+
745
+
746
+
747
+ <% end %>
748
+
749
+
750
+
751
+ <% else %>
752
+
753
+
754
+
755
+ <!-- データ一覧を表示しない -->
756
+
757
+
758
+
759
+ <% end %>
760
+
761
+
762
+
763
+ </tbody>
764
+
765
+ </table>
766
+
767
+
768
+
769
+
770
+
771
+ <!-- 追加箇所開始 -->
772
+
773
+
774
+
775
+ <%= paginate @items %>
776
+
777
+
778
+
779
+ <!-- 追加箇所終了 -->
780
+
781
+
782
+
783
+ </section>
784
+
785
+
786
+
787
+ <br>
788
+
789
+ <%= link_to "CSV出力", items_path(format: :csv), class: "btn btn-primary" %>
790
+
791
+
792
+
793
+
794
+
795
+
796
+
797
+ <% if false %>
798
+
799
+ <% @items.each do |item| %>
800
+
801
+ <%= item.category.name %>
802
+
803
+ <% end %>
804
+
805
+ <% end %>
806
+
807
+
808
+
809
+ <% if false %>
810
+
811
+
812
+
813
+ <%= @items.each do |item| %>
814
+
815
+ <%= item.manage_id %>
816
+
817
+
818
+
819
+ <% item.category.each do |p| %>
820
+
821
+ <%= p.id %>
822
+
823
+ <%= p.name %>
824
+
825
+ <% end %>
826
+
827
+
828
+
829
+ <% end %>
830
+
831
+
832
+
833
+ <% end %>
834
+
835
+
836
+
837
+
838
+
839
+ </main>
840
+
841
+
488
842
 
489
843
  ```
490
844
 
491
-
492
-
493
- index.html.erb
494
-
495
- ```html
496
-
497
- <main>
498
-
499
- <!-- ↓↓ログインメッセージ、データ登録、編集成功表示↓↓ -->
500
-
501
-
502
-
503
- <% if flash[:notice] %>
504
-
505
- <div class="alert alert-success">
506
-
507
- <%= flash[:notice] %>
508
-
509
- </div>
510
-
511
- <% end %>
512
-
513
-
514
-
515
- <!-- ↑↑ログインメッセージ、データ登録、編集成功表示↑↑ -->
516
-
517
-
518
-
519
-
520
-
521
- <br>
522
-
523
- <br>
524
-
525
- <br>
526
-
527
- <p class="rei1">通知</p>
528
-
529
- <br>
530
-
531
- <br>
532
-
533
-
534
-
535
- <% @items_1month.each do |item| %>
536
-
537
- <ul>
538
-
539
- <li>
540
-
541
- 管理ID <%= item.manage_id %> は期限切れまであとXX日です。有効期限の終了日は <%= item.end_date %> です。
542
-
543
- </li>
544
-
545
- </ul>
546
-
547
- <% end %>
548
-
549
-
550
-
551
-
552
-
553
- <br>
554
-
555
- <p class="rei1">データ検索</p>
556
-
557
-
558
-
559
- <div class="search_forms">
560
-
561
- <br>
562
-
563
- <%= form_tag('/items', method: 'get') do %>
564
-
565
- <%= label_tag(:manage_id, '管理ID') %>
566
-
567
- <%= text_field_tag(:manage_id) %>
568
-
569
-
570
-
571
- <% if false %>
572
-
573
- <%= label_tag(:category_id, 'カテゴリ') %>
574
-
575
- <%= text_field_tag(:category_id) %>
576
-
577
- <% end %>
578
-
579
-
580
-
581
- <%= label_tag(:category_id, 'カテゴリ') %>
582
-
583
- <%= select_tag 'category_id', options_for_select(["1", "2"]) %>
584
-
585
-
586
-
587
-
588
-
589
- <%= label_tag(:publish_corporation, '発行会社') %>
590
-
591
- <%= text_field_tag(:publish_corporation) %>
592
-
593
-
594
-
595
- <%= label_tag(:ip_address, 'IPアドレス') %>
596
-
597
- <%= text_field_tag(:ip_address) %>
598
-
599
- <br>
600
-
601
- <br>
602
-
603
-
604
-
605
- <%= label_tag(:target_server, '対象サーバ') %>
606
-
607
- <%= text_field_tag(:target_server) %>
608
-
609
-
610
-
611
- <%= label_tag(:start_date, '有効期限の開始日') %>
612
-
613
- <%= text_field_tag(:start_date) %>
614
-
615
-
616
-
617
- <%= label_tag(:end_date, '有効期限の終了日') %>
618
-
619
- <%= text_field_tag(:end_date) %>
620
-
621
- <br>
622
-
623
- <br>
624
-
625
- <%= label_tag(:comment, 'コメント') %>
626
-
627
- <%= text_field_tag(:comment) %>
628
-
629
-
630
-
631
- <%= submit_tag "検索", class: "form_button" %> <%= link_to 'クリア', items_path %>
632
-
633
- <% end %>
634
-
635
- </div>
636
-
637
-
638
-
639
-
640
-
641
- <br>
642
-
643
- <p class="rei1">データ一覧</p>
644
-
645
- <br>
646
-
647
-
648
-
649
- <!-- 権限によってデータ一覧の項目値を変更 -->
650
-
651
-
652
-
653
- <section>
654
-
655
-
656
-
657
- <!-- 追加箇所開始 -->
658
-
659
- <% if false %>
660
-
661
- <%= page_entries_info @items %>
662
-
663
- <% end %>
664
-
665
- <!-- 追加箇所終了 -->
666
-
667
-
668
-
669
-
670
-
671
- <table class="type06">
672
-
673
- <thead>
674
-
675
-
676
-
677
- <% if session[:authority] == "Admin" %>
678
-
679
-
680
-
681
- <tr>
682
-
683
- <th>管理ID</th>
684
-
685
- <th>カテゴリ</th>
686
-
687
- <th>発行会社</th>
688
-
689
- <th>IPアドレス</th>
690
-
691
- <th>対象サーバ</th>
692
-
693
- <th>有効期限の開始日</th>
694
-
695
- <th>有効期限の終了日</th>
696
-
697
- <th>コメント</th>
698
-
699
- <th>操作</th>
700
-
701
- </tr>
702
-
703
-
704
-
705
- </thead>
706
-
707
- <tbody>
708
-
709
-
710
-
711
- <% @items.each do |item| %>
712
-
713
- <tr>
714
-
715
- <td><%= item.manage_id %></td>
716
-
717
- <td><%= item.category.name %></td>
718
-
719
- <td><%= item.publish_corporation %></td>
720
-
721
- <td><%= item.ip_address %></td>
722
-
723
- <td><%= item.target_server %></td>
724
-
725
- <td><%= item.start_date %></td>
726
-
727
- <td><%= item.end_date %></td>
728
-
729
- <td><%= item.comment %></td>
730
-
731
- <td>
732
-
733
- <%= link_to '[Edit]', edit_item_path(item), class: 'command' %>
734
-
735
- <%= link_to '[Delete]',
736
-
737
- item_path(item),
738
-
739
- method: :delete,
740
-
741
- class: 'command',
742
-
743
- data: { confirm: 'データ削除しますか?' } %>
744
-
745
- </td>
746
-
747
- </tr>
748
-
749
-
750
-
751
- <% end %>
752
-
753
-
754
-
755
-
756
-
757
- <% elsif session[:authority] == "Operator" %>
758
-
759
-
760
-
761
- <tr>
762
-
763
- <th>管理ID</th>
764
-
765
- <th>カテゴリ</th>
766
-
767
- <th>発行会社</th>
768
-
769
- <th>IPアドレス</th>
770
-
771
- <th>対象サーバ</th>
772
-
773
- <th>有効期限の開始日</th>
774
-
775
- <th>有効期限の終了日</th>
776
-
777
- <th>コメント</th>
778
-
779
- </tr>
780
-
781
-
782
-
783
- <% @items.each do |item| %>
784
-
785
- <tr>
786
-
787
- <td><%= item.manage_id %></td>
788
-
789
- <td><%= item.category.name %></td>
790
-
791
- <td><%= item.publish_corporation %></td>
792
-
793
- <td><%= item.ip_address %></td>
794
-
795
- <td><%= item.target_server %></td>
796
-
797
- <td><%= item.start_date %></td>
798
-
799
- <td><%= item.end_date %></td>
800
-
801
- <td><%= item.comment %></td>
802
-
803
- </tr>
804
-
805
-
806
-
807
- <% end %>
808
-
809
-
810
-
811
- <% else %>
812
-
813
-
814
-
815
- <!-- データ一覧を表示しない -->
816
-
817
-
818
-
819
- <% end %>
820
-
821
-
822
-
823
- </tbody>
824
-
825
- </table>
826
-
827
-
828
-
829
-
830
-
831
- <!-- 追加箇所開始 -->
832
-
833
-
834
-
835
- <%= paginate @items %>
836
-
837
-
838
-
839
- <!-- 追加箇所終了 -->
840
-
841
-
842
-
843
- </section>
844
-
845
-
846
-
847
- <br>
848
-
849
- <%= link_to "CSV出力", items_path(format: :csv), class: "btn btn-primary" %>
850
-
851
-
852
-
853
-
854
-
855
-
856
-
857
- <% if false %>
858
-
859
- <% @items.each do |item| %>
860
-
861
- <%= item.category.name %>
862
-
863
- <% end %>
864
-
865
- <% end %>
866
-
867
-
868
-
869
- <% if false %>
870
-
871
-
872
-
873
- <%= @items.each do |item| %>
874
-
875
- <%= item.manage_id %>
876
-
877
-
878
-
879
- <% item.category.each do |p| %>
880
-
881
- <%= p.id %>
882
-
883
- <%= p.name %>
884
-
885
- <% end %>
886
-
887
-
888
-
889
- <% end %>
890
-
891
-
892
-
893
- <% end %>
894
-
895
-
896
-
897
-
898
-
899
- </main>
900
-
901
-
902
-
903
- ```
904
-
905
845
  ### 試したこと
906
846
 
907
847