Add admin UI to assign tips to exercises
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
- tip = exercise_tip.tip
|
||||
.card class="#{exercise_tip.parent_exercise_tip_id? ? 'mt-2' : ''}"
|
||||
.card class="#{exercise_tip.parent_exercise_tip_id? || exercise_tip.rank != 1 ? 'mt-2' : ''}"
|
||||
.card-header.p-2 id="tip-heading-#{exercise_tip.id}" role="tab"
|
||||
.card-title.mb-0
|
||||
a.collapsed aria-controls="tip-collapse-#{exercise_tip.id}" aria-expanded="false" data-parent="#tips" data-toggle="collapse" href="#tip-collapse-#{exercise_tip.id}"
|
||||
@@ -11,9 +11,10 @@
|
||||
= ": #{tip.title}" if tip.title?
|
||||
.card.card-collapse.collapse id="tip-collapse-#{exercise_tip.id}" aria-labelledby="tip-heading-#{exercise_tip.id}" role="tabpanel" data-exercise-tip-id=exercise_tip.id
|
||||
.card-body.p-3
|
||||
h5
|
||||
= t('exercises.implement.tips.description')
|
||||
= render_markdown(tip.description)
|
||||
- if tip.description?
|
||||
h5
|
||||
= t('exercises.implement.tips.description')
|
||||
= render_markdown(tip.description)
|
||||
- if tip.example?
|
||||
h5
|
||||
= t('exercises.implement.tips.example')
|
||||
|
8
app/views/tips/_sortable_tip.html.slim
Normal file
8
app/views/tips/_sortable_tip.html.slim
Normal file
@@ -0,0 +1,8 @@
|
||||
- tip = exercise_tip.tip
|
||||
.list-group-item.d-block data-tip-id=tip.id data-id=exercise_tip.id
|
||||
span.fa.fa-bars.mr-3
|
||||
= tip.to_s
|
||||
a.fa.fa-eye.ml-2 href=tip_path(tip) target='_blank'
|
||||
a.fa.fa-times.ml-2.remove-tip href='#'
|
||||
.list-group.nested-sortable-list class="#{exercise_tip.children.present? ? 'mt-3' : ''}"
|
||||
= render(partial: 'tips/sortable_tip', collection: exercise_tip.children, as: :exercise_tip)
|
Reference in New Issue
Block a user