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

add dojo ability to hide challenges and scoreboard #636

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion dojo_plugin/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class Dojos(db.Model):
"pages": [],
"privileged": False,
"importable": True,
"show_scoreboard": True,
}

users = db.relationship("DojoUsers", back_populates="dojo")
Expand Down Expand Up @@ -332,7 +333,9 @@ class DojoModules(db.Model):
data = db.Column(db.JSON)
data_fields = ["importable"]
data_defaults = {
"importable": True
"importable": True,
"show_scoreboard": True,
"show_challenges": True,
}

dojo = db.relationship("Dojos", back_populates="_modules")
Expand Down
3 changes: 3 additions & 0 deletions dojo_plugin/utils/dojo.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@

Optional("image"): IMAGE_REGEX,
Optional("allow_privileged"): bool,
Optional("show_scoreboard"): bool,
Optional("importable"): bool,

Optional("import"): {
Expand All @@ -69,6 +70,8 @@

Optional("image"): IMAGE_REGEX,
Optional("allow_privileged"): bool,
Optional("show_challenges"): bool,
Optional("show_scoreboard"): bool,
Optional("importable"): bool,

Optional("import"): {
Expand Down
3 changes: 3 additions & 0 deletions dojo_theme/templates/dojo.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ <h2 class="row">Modules</h2>
{% endfor %}
</ul>

{% if dojo.show_scoreboard %}
<br>

<h2 class="row" id="scoreboard-heading">30-Day Scoreboard:</h2>
Expand All @@ -123,6 +124,8 @@ <h2 class="row" id="scoreboard-heading">30-Day Scoreboard:</h2>
{{ scoreboard() }}

{% endif %}

{% endif %}
</div>
{% endblock %}

Expand Down
5 changes: 4 additions & 1 deletion dojo_theme/templates/module.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ <h4 class="accordion-item-name">{{ resource.name }}</h4>
<br>
{% endif %}

{% if challenges %}
{% if challenges and module.show_challenges %}
<h2>Challenges</h2>

<div class="accordion" id="challenges">
Expand Down Expand Up @@ -137,6 +137,9 @@ <h4 class="accordion-item-name challenge-name {{ active }}">
</div>

<br>
{% endif %}

{% if challenges and module.show_scoreboard %}

<h2 class="row" id="scoreboard-heading">30-Day Scoreboard:</h2>
<p>This scoreboard reflects solves for challenges in this module after the module launched in this dojo.</p>
Expand Down
Loading