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

Made onsite buttons #3252

Merged
merged 6 commits into from
May 7, 2021
Merged
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
18 changes: 17 additions & 1 deletion esp/esp/program/modules/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,17 @@ def makeLink(self):

return mark_safe(link)


def makeButtonLink(self):
if not self.module.module_type == 'manage':
link = u'<a href="%s"><button type="button" class="module_link_large btn btn-default btn-lg"><div class="module_link_main">%s</div></button></a>' % \
(self.get_full_path(tl=self.module.module_type), self.module.link_title)
else:
link = u'<a href="%s" onmouseover="updateDocs(\'<p>%s</p>\');"></a><button type="button" class="module_link_large btn btn-default btn-lg"> <div class="module_link_main">%s%s</div></button></a>' % \
(self.get_full_path('manage'), self.docs().replace("'", "\\'").replace('\n','<br />\\n').replace('\r', ''), self.module.link_title, self.module.handler)

return mark_safe(link)

def useTemplate(self):
""" Use a template if the `mainView' function doesn't exist. """
return (not self.main_view)
Expand All @@ -299,7 +310,12 @@ def isAdminPortalFeatured(self):
'ListGenModule', 'ResourceModule', 'CommModule',
'VolunteerManage', 'ClassFlagModule', 'ProgramPrintables',
'AJAXSchedulingModule', 'NameTagModule', 'TeacherEventsModule']

def isOnSiteFeatured(self):
"""Don't display in the long list of additional modules if it's already featured
in the main portion of the admin portal"""
return self.module.handler in ['OnSiteCheckinModule', 'TeacherCheckinModule', 'OnSiteCheckoutModule',
'OnsiteClassSchedule', 'OnSiteClassList', 'OnSiteRegister',
'OnSiteAttendance', 'OnsitePaidItemsModule']
def isCompleted(self):
return False

Expand Down
6 changes: 6 additions & 0 deletions esp/esp/program/modules/handlers/onsiteclasslist.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,12 @@ def makeLink(self):
('/' + self.module.module_type + '/' + self.program.url + '/' + call[0], call[1], call[1]) for call in calls]
return "</li><li>".join(strings)

def makeButtonLink(self):
calls = [("classchange_grid","Grid-based Class Changes Interface"), ("classList","Scrolling Class List"), (self.get_main_view(),self.module.link_title)]
strings = [u'<a href="%s"><button type="button" class="module_link_large btn btn-default btn-lg"><div class="module_link_main">%s</div></button></a>' % \
('/' + self.module.module_type + '/' + self.program.url + '/' + call[0], call[1]) for call in calls]
return "<br>".join(strings)



class Meta:
Expand Down
60 changes: 53 additions & 7 deletions esp/templates/program/modules/onsitecore/mainpage.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
{% block title %}{{program.niceName}} Management{% endblock %}

{% block content %}
{% load modules %}
<style type="text/css">
.nocheckmark { border: 1px solid black; }
</style>
<br />
<link rel="stylesheet" href="/media/styles/management.css" type="text/css">
<br />

<br /><br />
<h1>Onsite Portal for {{program.niceName}} </h1>

<p style="text-align: center">
Expand All @@ -18,20 +18,66 @@ <h1>Onsite Portal for {{program.niceName}} </h1>
</p>

<br />
<strong>Your Options:</strong>
<ul>
<br>


<div class="module_group" id="module_group_2">
<div class="module_group_header">
Onsite Check-in
</div>
<div style="display: inline-block;" class="button_wrapper">
{% if program|hasModule:"OnSiteCheckinModule" %} <a href="onsite/{{ program.getUrlBase }}/attendance"><button type="button" class="module_link_large btn btn-default btn-lg"><div class="module_link_main">Check-in Students</div></button></a>{% endif %}
<!-- add if statement for moderators --!>

{% if program|hasModule:"TeacherCheckinModule" %}<a href="onsite/{{ program.getUrlBase }}/teachercheckin"><button type="button" class="module_link_large btn btn-default btn-lg"><div class="module_link_main">Check-in Teachers{% if program|hasModule:"TeacherModeratorModule" %}/{{ program.getModeratorTitle }}s{% endif %}</div></button></a>{% endif %}
{% if program|hasModule:"OnSiteCheckoutModule" %}<a href="onsite/{{ program.getUrlBase }}/checkout"><button type="button" class="module_link_large btn btn-default btn-lg"><div class="module_link_main">Check-out Students</div></button></a>{% endif %}
{% if program|hasModule:"OnSiteRegister" %}<a href="onsite/{{ program.getUrlBase }}/onsite_create"><button type="button" class="module_link_large btn btn-default btn-lg"><div class="module_link_main">Register a New Student</div></button></a>{% endif %}
</div>
</div>
<div class="module_group" id="module_group_2">
<div class="module_group_header">
Class Information and Changes
</div>
<div style="display: inline-block;" class="button_wrapper">
{% if program|hasModule:"OnsiteClassSchedule" %}<a href="onsite/{{ program.getUrlBase }}/schedule_students"><button type="button" class="module_link_large btn btn-default btn-lg"><div class="module_link_main">Scheduling and Class Changes</div></button></a>{% endif %}
{% if program|hasModule:"OnSiteClassList" %}<a href="onsite/{{ program.getUrlBase }}/classchange_grid"><button type="button" class="module_link_large btn btn-default btn-lg"><div class="module_link_main">Grid-Based Class Changes</div></button></a>{% endif %}
{% if program|hasModule:"OnSiteClassList" %}<a href="onsite/{{ program.getUrlBase }}/classlist"><button type="button" class="module_link_large btn btn-default btn-lg"><div class="module_link_main">Scrolling Class List</div></button></a>{% endif %}
{% if program|hasModule:"OnSiteClassList" %}<a href="onsite/{{ program.getUrlBase }}/allclasslist"><button type="button" class="module_link_large btn btn-default btn-lg"><div class="module_link_main">List of Open Classes</div></button></a>{% endif %}
</div>
</div>
<div class="module_group" id="module_group_2">
<div class="module_group_header">
Student Information
</div>
<div style="display: inline-block;" class="button_wrapper">
{% if program|hasModule:"OnSiteAttendance" %}<a href="onsite/{{ program.getUrlBase }}/attendance"><button type="button" class="module_link_large btn btn-default btn-lg"><div class="module_link_main">Check Student Attendance</div></button></a>{% endif %}
{% if program|hasModule:"OnsitePaidItemsModule" %}<a href="onsite/{{ program.getUrlBase }}/paiditems"><button type="button" class="module_link_large btn btn-default btn-lg"><div class="module_link_main">View Student's Purchased Items</div></button></a>{% endif %}
</div>
</div>
<div class="module_group" id="module_group_2">
<div class="module_group_header">
Other Modules
</div>

</div>



{% for module in modules %}
{% if module.isStep %}

{% comment %} am I a module that has not been called yet {% endcomment %}
{% if not module.isOnSiteFeatured %}
{% if not module.useTemplate %}
<li>{% autoescape off %}{{ module.makeLink }}{% endautoescape %}</li>
{% autoescape off %}{{ module.makeButtonLink }}{% endautoescape %}
{% else %}
<li><em>{{ module.module.link_title }} (below)</em></li>
<em>{{ module.module.link_title }} (below)</em>
{% endif %}
{% endif %}
{% endif %}
{% endfor %}

</ul>



<br />
Expand Down