質問編集履歴

1

変更

2021/10/27 06:56

投稿

rat_mouse
rat_mouse

スコア17

test CHANGED
File without changes
test CHANGED
@@ -340,206 +340,198 @@
340
340
 
341
341
 
342
342
 
343
- .mainVisual_news
344
-
345
- .pageBox_header
346
-
347
- h1 募集
348
-
349
- p recruitment
350
-
351
- section
352
-
353
- .container
354
-
355
- .card
356
-
357
- .card-header
358
-
359
- h5.card-title
360
-
361
- i.fa.fa-info-circle
362
-
363
- | 検索
343
+ .pageBox.mb-5.mt-2
344
+
345
+ .row
346
+
347
+ .pageBox.flex_blog
348
+
349
+ .col-md-8
350
+
351
+ h1.wow.fadeIn.animated
352
+
353
+ - @recruitments.each do |recruitment|
354
+
355
+ - if recruitment.end_date > @current_time
356
+
357
+ h2.wow.fadeIn.animated
358
+
359
+ = recruitment.title
360
+
361
+
362
+
363
+ .archive-entries
364
+
365
+ .archive-entry-header
366
+
367
+ .archive-date
368
+
369
+ = recruitment.target
370
+
371
+ .archive-entry-body
372
+
373
+ .entry-description
374
+
375
+ = image_tag recruitment.top_image.attachment.service_url if recruitment.top_image.attached?
376
+
377
+ == recruitment.content
378
+
379
+ .social-area.mb-2
380
+
381
+
382
+
383
+ .border_end
384
+
385
+
386
+
387
+ ```
388
+
389
+
390
+
391
+ user/app/controllers/recruitment.controller.rb
392
+
393
+ ```ここに言語を入力
394
+
395
+ class RecruitmentsController < ApplicationController
396
+
397
+ before_action :set_recruitment, only: [:show, :edit, :update, :destroy]
398
+
399
+
400
+
401
+ respond_to :html
402
+
403
+
404
+
405
+ def index
406
+
407
+ @q = Recruitment.where(status: 'delivered').order(created_at: :desc).ransack(params[:q])
408
+
409
+ @recruitments = RansackUtil.paged_scope(@q, params).per(18)
410
+
411
+ @current_time = Time.current
412
+
413
+ respond_with(@recruitments)
414
+
415
+ end
416
+
417
+
418
+
419
+ def show
420
+
421
+ respond_with(@recruitment)
422
+
423
+ end
424
+
425
+
426
+
427
+ def new
428
+
429
+ @recruitment = Recruitment.new
430
+
431
+ respond_with(@recruitment)
432
+
433
+ end
434
+
435
+
436
+
437
+ def edit
438
+
439
+ end
440
+
441
+
442
+
443
+ def create
444
+
445
+ @recruitment = Recruitment.new(recruitment_params)
446
+
447
+ @recruitment.save
448
+
449
+ respond_with(@recruitment)
450
+
451
+ end
452
+
453
+
454
+
455
+ def update
456
+
457
+ @recruitment.update(recruitment_params)
458
+
459
+ respond_with(@recruitment)
460
+
461
+ end
462
+
463
+
464
+
465
+ def destroy
466
+
467
+ @recruitment.destroy
468
+
469
+ respond_with(@recruitment)
470
+
471
+ end
472
+
473
+
474
+
475
+ private
476
+
477
+ def set_recruitment
478
+
479
+ @recruitment = Recruitment.find(params[:id])
480
+
481
+ end
482
+
483
+
484
+
485
+ def recruitment_params
486
+
487
+ params.require(:recruitment).permit(:title, :content, :target, :start_date, :end_date)
488
+
489
+ end
490
+
491
+ end
492
+
493
+ ```
494
+
495
+ user/app/models/recruitment.rb
496
+
497
+ ```ここに言語を入力
498
+
499
+ class Recruitment < ApplicationRecord
500
+
501
+ has_rich_text :content
502
+
503
+ has_one_attached :top_image
504
+
505
+
506
+
507
+ acts_as_paranoid
508
+
509
+ stampable with_deleted: true
364
510
 
365
511
 
366
512
 
367
- .card-body.p-3.text-right.ibox-content
368
-
369
- .no-padding.no-margins
370
-
371
- = search_form_for @q,
372
-
373
- html: { class: 'form-horizontal'},
374
-
375
- defaults: { required: false, input_html: { novalidate: true } } do |f|
376
-
377
-
378
-
379
- .row.no-padding.no-margins
380
-
381
- .col-md-4
382
-
383
- = f.input :target_cont, label: "募集対象",
513
+ scope :order_seq, -> { order(:seq_order) }
384
-
385
- as: :select, placeholder: "募集対象を選択してください", collection: Recruitment.pluck(:target).uniq
514
+
386
-
387
- .row.no-margins.pt-2
515
+
388
-
389
- .col-md-12.flex_right
516
+
390
-
391
- = render 'shared/form_submit_search', models: @recruitments
392
-
393
-
394
-
395
- ```
396
-
397
-
398
-
399
- user/app/controllers/recruitment.controller.rb
400
-
401
- ```ここに言語を入力
402
-
403
- class RecruitmentsController < ApplicationController
404
-
405
- before_action :set_recruitment, only: [:show, :edit, :update, :destroy]
406
-
407
-
408
-
409
- respond_to :html
410
-
411
-
412
-
413
- def index
414
-
415
- @q = Recruitment.where(status: 'delivered').order(created_at: :desc).ransack(params[:q])
416
-
417
- @recruitments = RansackUtil.paged_scope(@q, params).per(18)
418
-
419
- @current_time = Time.current
420
-
421
- respond_with(@recruitments)
422
-
423
- end
424
-
425
-
426
-
427
- def show
428
-
429
- respond_with(@recruitment)
430
-
431
- end
432
-
433
-
434
-
435
- def new
436
-
437
- @recruitment = Recruitment.new
438
-
439
- respond_with(@recruitment)
440
-
441
- end
442
-
443
-
444
-
445
- def edit
446
-
447
- end
448
-
449
-
450
-
451
- def create
452
-
453
- @recruitment = Recruitment.new(recruitment_params)
517
+ after_initialize :default_values, if: :new_record?
454
-
455
- @recruitment.save
456
-
457
- respond_with(@recruitment)
458
-
459
- end
460
-
461
-
462
-
463
- def update
464
-
465
- @recruitment.update(recruitment_params)
466
-
467
- respond_with(@recruitment)
468
-
469
- end
470
-
471
-
472
-
473
- def destroy
474
-
475
- @recruitment.destroy
476
-
477
- respond_with(@recruitment)
478
-
479
- end
480
518
 
481
519
 
482
520
 
483
521
  private
484
522
 
523
+
524
+
485
- def set_recruitment
525
+ def default_values
526
+
486
-
527
+ # self.status ||= :preparing
528
+
487
- @recruitment = Recruitment.find(params[:id])
529
+ # self.contract_at ||= Time.zone.today
488
-
530
+
489
- end
531
+ end
490
-
491
-
492
-
493
- def recruitment_params
494
-
495
- params.require(:recruitment).permit(:title, :content, :target, :start_date, :end_date)
496
-
497
- end
498
532
 
499
533
  end
500
534
 
535
+
536
+
501
- ```
537
+ ```
502
-
503
- user/app/models/recruitment.rb
504
-
505
- ```ここに言語を入力
506
-
507
- class Recruitment < ApplicationRecord
508
-
509
- has_rich_text :content
510
-
511
- has_one_attached :top_image
512
-
513
-
514
-
515
- acts_as_paranoid
516
-
517
- stampable with_deleted: true
518
-
519
-
520
-
521
- scope :order_seq, -> { order(:seq_order) }
522
-
523
-
524
-
525
- after_initialize :default_values, if: :new_record?
526
-
527
-
528
-
529
- private
530
-
531
-
532
-
533
- def default_values
534
-
535
- # self.status ||= :preparing
536
-
537
- # self.contract_at ||= Time.zone.today
538
-
539
- end
540
-
541
- end
542
-
543
-
544
-
545
- ```