Skip to content

Commit

Permalink
courses一覧画面の条件式を修正
Browse files Browse the repository at this point in the history
  • Loading branch information
mono-nobe committed Mar 21, 2023
1 parent 22ce5e4 commit 67d5207
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
25 changes: 13 additions & 12 deletions app/views/courses/_course.html.slim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.col-xxl-3.col-xl-4.col-lg-4.col-md-6.col-xs-12
.courses-item(id="course_#{course.id}" class="#{!current_user.admin? || course.published ? 'is-published' : 'is-closed'}")
.courses-item(id="course_#{course.id}" class="#{course.published ? 'is-published' : 'is-closed'}")
.courses-item__inner.a-card
header.courses-item__header
h3.courses-item__title
Expand All @@ -11,14 +11,15 @@
= course.title
.courses-item__description
= simple_format(course.description)
footer.card-footer
.card-main-actions
ul.card-main-actions__items
li.card-main-actions__item
= link_to edit_mentor_course_path(course), class: 'a-button is-sm is-secondary is-block' do
i.fa-solid.fa-pen
| 編集
li.card-main-actions__item
= link_to course_categories_path(course), class: 'a-button is-sm is-secondary is-block' do
i.fa-solid.fa-align-justify
| 並び替え
- if mentor_login?
footer.card-footer
.card-main-actions
ul.card-main-actions__items
li.card-main-actions__item
= link_to edit_mentor_course_path(course), class: 'a-button is-sm is-secondary is-block' do
i.fa-solid.fa-pen
| 編集
li.card-main-actions__item
= link_to course_categories_path(course), class: 'a-button is-sm is-secondary is-block' do
i.fa-solid.fa-align-justify
| 並び替え
4 changes: 2 additions & 2 deletions app/views/courses/index.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ header.page-header
.container
.courses-items
.row
- if (current_user&.admin? && @courses.present?) || (current_user&.mentor? && @courses.present?)
- if current_user&.mentor? && @courses.present?
= render @courses.order(:created_at)
- elsif !current_user&.admin? && @courses.where(published: true).present?
- elsif !current_user&.mentor? && @courses.where(published: true).present?
= render @courses.where(published: true).order(:created_at)
- else
.o-empty-message
Expand Down

0 comments on commit 67d5207

Please sign in to comment.