Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CONCD-482 Build Tutorial popup and cards navigation #2114

Merged
merged 12 commits into from
Oct 13, 2023
30 changes: 30 additions & 0 deletions concordia/static/scss/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1029,6 +1029,36 @@ $card-progress-height: 12px;
}
}

/*
* Tutorial popup and cards navigation
*/
#card-carousel .carousel-item img {
background-color: #fff;
border-top: 1px solid #efefef;
padding-bottom: 1rem;
}

#card-carousel ul {
padding-left: 1.5rem;
}

#card-carousel .carousel-indicators > li.active {
background-color: #007bff;
border-color: #007bff;
}

#previous-card {
position: absolute;
bottom: 10px;
left: 0;
}

#next-card {
position: absolute;
bottom: 10px;
right: 0;
}

/*
* Campaign Resources Panel
*/
Expand Down
46 changes: 46 additions & 0 deletions concordia/templates/transcriptions/asset_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,52 @@ <h5 class="modal-title">Are you sure?</h5>
</div>
</div>
<div class="print-transcription-image d-none d-print-block"><img class="img-fluid" alt="Scanned image of the current content page" src="{% asset_media_url asset %}"></div>
{% if cards %}
<div id="tutorial-popup" class="modal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header border-bottom-0">
<h4>Quick Tips</h4>
<button type="button" class="close text-primary" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">x</span>
</button>
</div>
<div class="modal-body">
<div id="card-carousel" class="carousel slide" data-interval="false">
<div class="carousel-inner">
{% for card in cards %}
<div class="carousel-item pb-4 {% if forloop.first %} active {% endif %}">
{% if not forloop.first %}
<a id="previous-card" href="#card-carousel" role="button" data-slide="prev">
<strong><u><&nbsp;Back</u></strong>
</a>
{% endif %}
<div class="position-static d-flex flex-column justify-content-around">
{% if card.image %}
<img src="{{ card.image.url }}">
{% endif %}
<h3>{{ card.title }}</h3>
<p>{{ card.body_text|safe }}</p>
</div>
{% if not forloop.last %}
<a id="next-card" href="#card-carousel" data-slide="next">
<strong><u>Next&nbsp;></u></strong>
</a>
{% endif %}
</div>
{% endfor %}
</div>
<ol class="carousel-indicators d-none d-lg-flex">
{% for card in cards %}
<li data-target="#card-carousel" data-slide-to="{{ forloop.counter0 }}" {% if forloop.first %}class="active" {% endif %}></li>
{% endfor %}
</ol>
</div>
</div>
</div>
</div>
</div>
{% endif %}
{% endblock main_content %}

{% block body_scripts %}
Expand Down
11 changes: 11 additions & 0 deletions concordia/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
AssetTranscriptionReservation,
Banner,
Campaign,
CardFamily,
CarouselSlide,
ConcordiaUser,
Item,
Expand All @@ -87,6 +88,7 @@
Topic,
Transcription,
TranscriptionStatus,
TutorialCard,
UserAssetTagCollection,
UserProfileActivity,
)
Expand Down Expand Up @@ -1270,6 +1272,15 @@ def get_context_data(self, **kwargs):

ctx["registered_contributors"] = asset.get_contributor_count()

if project.campaign.card_family:
card_family = project.campaign.card_family
else:
card_family = CardFamily.objects.filter(default=True).first()
if card_family is not None:
unordered_cards = TutorialCard.objects.filter(tutorial=card_family)
ordered_cards = unordered_cards.order_by("order")
ctx["cards"] = [tutorial_card.card for tutorial_card in ordered_cards]

return ctx


Expand Down