forked from hedyorg/hedy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show adventure content in tabs in non-adventure mode
- Loading branch information
Showing
8 changed files
with
102 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,3 +143,4 @@ logs.txt | |
# Ignore vim swap files | ||
*.swp | ||
*.swo | ||
.local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* Activate tabs | ||
* | ||
* Protocol: | ||
* | ||
* - Tabs consist of a TAB (the sticky-outy bit) and a TARGET | ||
* (the pane that gets shown and hidden). | ||
* | ||
* - TABS should have: <... data-tab="SOME-ID"> | ||
* | ||
* - TARGETS should have: <... data-tabtarget="SOME-ID"> | ||
* | ||
* When a TAB is clicked, the TARGET with the matching id is shown | ||
* (and all other TARGETS in the same containing HTML element are hidden). | ||
* | ||
* The active TAB is indicated by the '.tab-selected' class, the active | ||
* TARGET by the *absence* of the '.hidden' class. | ||
*/ | ||
$(function() { | ||
$('*[data-tab]').click(function (e) { | ||
const tab = $(e.target); | ||
const allTabs = tab.siblings('*[data-tab]'); | ||
|
||
const target = $('*[data-tabtarget="' + tab.data('tab') + '"]'); | ||
const allTargets = target.siblings('*[data-tabtarget]'); | ||
|
||
allTabs.removeClass('tab-selected'); | ||
tab.addClass('tab-selected'); | ||
|
||
allTargets.addClass('hidden'); | ||
target.removeClass('hidden'); | ||
|
||
e.preventDefault(); | ||
return false; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{# TABS #} | ||
<div class="mt-8"> | ||
<div class="flex cursor-pointer flex-end"> | ||
{% for assignment in adventure_assignments %} | ||
<a tabindex="0" href="#" data-tab="t-{{assignment.name}}" class="block text-black no-underline font-light tab {% if assignment.selected %}tab-selected{% endif %}" tabindex="0">{{ assignment.name }}</a> | ||
{% endfor %} | ||
</ul> | ||
</div> | ||
{# PANES #} | ||
<div style='width: 100%;' class="bg-white p-4 mb-8 shadow-md"> | ||
{% for assignment in adventure_assignments %} | ||
<div data-tabtarget="t-{{assignment.name}}" {% if not assignment.selected %}class="hidden"{% endif %}> | ||
{% if assignment.image %} | ||
<img class="float-right w-48" src="/images/{{assignment.image}}"> | ||
{% endif %} | ||
<div> | ||
{{ assignment.text|commonmark }} | ||
</div> | ||
<div class="clear-right"></div> | ||
</div> | ||
{% endfor %} | ||
</div> |