Luna LMS

Check-in [0aa47fe8cd]
Login

Check-in [0aa47fe8cd]

Overview
Comment:Hiding filter buttons, and changing back button now when there are no search results.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | search
Files: files | file ages | folders
SHA3-256: 0aa47fe8cd2b30acda4d2cbb79b5f239e792f604401246ffe7f15d63708a6e0a
User & Date: florian 2024-07-16 16:20:01
Context
2024-07-17
15:48
Merged changes from development. check-in: 85be88875b user: florian tags: search
2024-07-16
16:20
Merged changes from search. check-in: 78b779bf70 user: florian tags: development
16:20
Hiding filter buttons, and changing back button now when there are no search results. check-in: 0aa47fe8cd user: florian tags: search
16:05
Removed paragraph break in failure message. check-in: 248ade2307 user: florian tags: search
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to luna_lms/webapp.py.

1797
1798
1799
1800
1801
1802
1803















1804
1805
1806
1807
1808
1809
1810

				LOGGER.error("Path component is not an UUID: '{}'".format(args[0]))
				raise cherrypy.NotFound()

			LOGGER.error("Path '{}' is not cached in course {}, and does not point to a valid resource".format(course_id, path))
			raise cherrypy.NotFound()
		















		return_str = HTML_HEAD.format(title = _("Luna LMS: Kurs-Übersicht"))

		return_str += self._format_header(_("Kurs-Übersicht"))

		return_str += '<div class="w3-row-padding general_left_right_margin" style="margin-top:0rem;margin-bottom:0rem;"><div class="w3-col luna-l12 luna-m12 spacer" style="height:2.5rem;"></div></div>'

		return_str += '<main class="w3-row-padding general_left_right_margin" style="scroll-behavior: smooth;">'







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825

				LOGGER.error("Path component is not an UUID: '{}'".format(args[0]))
				raise cherrypy.NotFound()

			LOGGER.error("Path '{}' is not cached in course {}, and does not point to a valid resource".format(course_id, path))
			raise cherrypy.NotFound()
		
		courses = {}

		if "term" in kwargs.keys() and kwargs["term"].strip():
				
			courses = self.storage.find_courses(term=kwargs["term"])

		else:
			courses = self.storage.find_courses()

		# Create a list to be able to sort
		#
		titles = [key for key in courses.keys() if key.__class__ == str]

		titles.sort()

		return_str = HTML_HEAD.format(title = _("Luna LMS: Kurs-Übersicht"))

		return_str += self._format_header(_("Kurs-Übersicht"))

		return_str += '<div class="w3-row-padding general_left_right_margin" style="margin-top:0rem;margin-bottom:0rem;"><div class="w3-col luna-l12 luna-m12 spacer" style="height:2.5rem;"></div></div>'

		return_str += '<main class="w3-row-padding general_left_right_margin" style="scroll-behavior: smooth;">'
1820
1821
1822
1823
1824
1825
1826

1827
1828
1829
1830




1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
		if "term" in kwargs.keys() and kwargs["term"].strip():

			value = html.escape(kwargs["term"])

		return_str += '<input name="term" type="text" value="{}">'.format(value)
		
		return_str += '<button type="submit"><img src="/static/search-inactive.svg" alt="{}"></button>'.format(_("Suchen"))

		return_str += '</form>'

		return_str += '<div>'





		return_str += '''	<select name="sort" class="inactive" disabled>
		<option value="sort">{}</option>
	</select>
'''.format(_("Sortieren"))

		return_str += '''	<select name="filter" class="inactive" disabled>
		<option value="filter">{}</option>
	</select>
'''.format(_("Alle Filter"))

		return_str += '</div>'

		courses = {}

		if "term" in kwargs.keys() and kwargs["term"].strip():
				
			courses = self.storage.find_courses(term=kwargs["term"])

			# Leave tag open, as we possibly want to add a line
			#
			return_str += '<p>{} <strong>{}</strong>:'.format(_("Such-Ergebnisse für"), html.escape(kwargs["term"]))
			
		else:
			courses = self.storage.find_courses()

		# Create a list to be able to sort
		#
		titles = [key for key in courses.keys() if key.__class__ == str]

		if len(titles):
			return_str += '</p>'

		titles.sort()

		paginate_after = PAGINATE_COURSES
		pages = 0

		for title in titles:

			if len(titles) > PAGINATE_COURSES and paginate_after == PAGINATE_COURSES:








>




>
>
>
>
|




|






<
<

<
<





<
<
<
<
<
<
<



<
<







1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862


1863


1864
1865
1866
1867
1868







1869
1870
1871


1872
1873
1874
1875
1876
1877
1878
		if "term" in kwargs.keys() and kwargs["term"].strip():

			value = html.escape(kwargs["term"])

		return_str += '<input name="term" type="text" value="{}">'.format(value)
		
		return_str += '<button type="submit"><img src="/static/search-inactive.svg" alt="{}"></button>'.format(_("Suchen"))

		return_str += '</form>'

		return_str += '<div>'

		# Hide options when there are no results
		#
		if len(titles):

			return_str += '''	<select name="sort" class="inactive" disabled>
		<option value="sort">{}</option>
	</select>
'''.format(_("Sortieren"))

			return_str += '''	<select name="filter" class="inactive" disabled>
		<option value="filter">{}</option>
	</select>
'''.format(_("Alle Filter"))

		return_str += '</div>'



		if "term" in kwargs.keys() and kwargs["term"].strip():



			# Leave tag open, as we possibly want to add a line
			#
			return_str += '<p>{} <strong>{}</strong>:'.format(_("Such-Ergebnisse für"), html.escape(kwargs["term"]))
			







		if len(titles):
			return_str += '</p>'



		paginate_after = PAGINATE_COURSES
		pages = 0

		for title in titles:

			if len(titles) > PAGINATE_COURSES and paginate_after == PAGINATE_COURSES:

1982
1983
1984
1985
1986
1987
1988


1989



1990
1991
1992
1993
1994
1995
1996

	// Show visible index now
	displayVisible();

});
</script>'''



		return_str += '<a href="/" class="browse"><div class="image_spacer"><span class="back-icon"></span></div>{}</a>'.format(_("Zurück zur Start-Seite"))




		return_str += '</div>'

		return_str += '<div class="w3-col luna-l2 luna-m2 spacer"></div>'

		return_str += '''<div class="w3-col luna-l1 luna-m1">
	<div id="totop" aria-hidden="true" style="opacity: 0.0;">







>
>
|
>
>
>







1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008

	// Show visible index now
	displayVisible();

});
</script>'''

		if len(titles):

			return_str += '<a href="/" class="browse"><div class="image_spacer"><span class="back-icon"></span></div>{}</a>'.format(_("Zurück zur Start-Seite"))

		else:
			return_str += '<a href="/courses" class="browse"><div class="image_spacer"><span class="back-icon"></span></div>{}</a>'.format(_("Zurück"))

		return_str += '</div>'

		return_str += '<div class="w3-col luna-l2 luna-m2 spacer"></div>'

		return_str += '''<div class="w3-col luna-l1 luna-m1">
	<div id="totop" aria-hidden="true" style="opacity: 0.0;">