Skip to content
This repository was archived by the owner on Sep 30, 2020. It is now read-only.
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
4 changes: 3 additions & 1 deletion inginious/frontend/webapp/pages/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,6 @@ def show_page(self, success):

registerable_courses = OrderedDict(sorted(iter(registerable_courses.items()), key=lambda x: x[1].get_name()))

return self.template_helper.get_renderer().main(open_courses, registerable_courses, except_free_last_submissions, success)
additional_divs = self.plugin_manager.call_hook('main_page_div', template_helper=self.template_helper)

return self.template_helper.get_renderer().main(open_courses, registerable_courses, except_free_last_submissions, success, additional_divs)
10 changes: 9 additions & 1 deletion inginious/frontend/webapp/plugins/problem_bank/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
from . import pages
import os.path
from inginious.frontend.webapp.plugins.utils import create_static_resource_page
from .constants import _REACT_BASE_URL, _REACT_BUILD_FOLDER, _BASE_STATIC_FOLDER, _BASE_STATIC_URL
from .constants import _REACT_BASE_URL, _REACT_BUILD_FOLDER, _BASE_STATIC_FOLDER, _BASE_STATIC_URL, _BASE_RENDERER_PATH



def problem_bank_main_div(template_helper):
div_id = 'problem_bank_main'
content = template_helper.get_custom_renderer(_BASE_RENDERER_PATH, layout=False).problem_bank_div()
return div_id, content

def init(plugin_manager, course_factory, client, config):
if "problem_banks" not in plugin_manager.get_database().collection_names():
plugin_manager.get_database().create_collection("problem_banks")
Expand All @@ -16,3 +23,4 @@ def init(plugin_manager, course_factory, client, config):
plugin_manager.add_page(r'/plugins/problems_bank/api/bank_tasks', pages.SearchTaskApi)
plugin_manager.add_page(r'/plugins/problems_bank/api/filter_bank_tasks', pages.FilterTasksApi)
plugin_manager.add_page(r'/plugins/problems_bank', pages.BankPage)
plugin_manager.add_hook('main_page_div', problem_bank_main_div)
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
_PLUGIN_FOLDER = os.path.dirname(os.path.realpath(__file__))
_REACT_BUILD_FOLDER = os.path.join(_PLUGIN_FOLDER, 'react_app', 'build')
_REACT_BASE_URL = '/plugins/problem_bank/react/'
_BASE_RENDERER_PATH = _PLUGIN_FOLDER
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<form action="$get_homepath()/plugins/problems_bank">
<button type="submit" class="btn btn-block btn-primary">Problems Bank</button>
</form>
7 changes: 6 additions & 1 deletion inginious/frontend/webapp/templates/main.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$def with (open_courses,registrable_courses,submissions,success)
$def with (open_courses,registrable_courses,submissions,success, additional_divs)

$#
$# This file is part of INGInious. See the LICENSE and the COPYRIGHTS files for
Expand Down Expand Up @@ -114,3 +114,8 @@ <h3>Register for a course</h3>
</div>
<div class="col-sm-12"><button type="submit" class="btn btn-block btn-default">Register</button></div>
</form>

$for div_id, div_content in additional_divs:
<div id="$div_id">
$:div_content
</div>