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 1 commit
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
11 changes: 11 additions & 0 deletions 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</div></button></a>' % \
(self.get_full_path('manage'), self.docs().replace("'", "\\'").replace('\n','<br />\\n').replace('\r', ''), self.module.link_title)

return mark_safe(link)

def useTemplate(self):
""" Use a template if the `mainView' function doesn't exist. """
return (not self.main_view)
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
13 changes: 8 additions & 5 deletions esp/templates/program/modules/onsitecore/mainpage.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,23 @@ <h1>Onsite Portal for {{program.niceName}} </h1>
</p>

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





{% for module in modules %}
{% if module.isStep %}
{% if not module.useTemplate %}
<li>{% autoescape off %}{{ module.makeLink }}{% endautoescape %}</li>
{% autoescape off %}{{ module.makeButtonLink }}{% endautoescape %}<br>
{% else %}
<li><em>{{ module.module.link_title }} (below)</em></li>
<<em>{{ module.module.link_title }} (below)</em><br>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There shouldn't be two < signs here

{% endif %}
{% endif %}
{% endfor %}

</ul>



<br />
Expand Down