From: Michael Tremer Date: Thu, 1 Nov 2018 13:47:28 +0000 (+0000) Subject: Some tidying up X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eabe6b8d6798b8f689677b005c4289e122649239;p=ipfire.org.git Some tidying up Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index 9cd40b72..48a2ec4f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -151,8 +151,7 @@ templates_fireinfodir = $(templatesdir)/fireinfo templates_fireinfo_modules_DATA = \ src/templates/fireinfo/modules/table-devices-and-groups.html \ - src/templates/fireinfo/modules/table-devices.html \ - src/templates/fireinfo/modules/table-geo.html + src/templates/fireinfo/modules/table-devices.html templates_fireinfo_modulesdir = $(templates_fireinfodir)/modules diff --git a/src/templates/fireinfo/modules/table-geo.html b/src/templates/fireinfo/modules/table-geo.html deleted file mode 100644 index 80a70d5b..00000000 --- a/src/templates/fireinfo/modules/table-geo.html +++ /dev/null @@ -1,17 +0,0 @@ -
- {% for country in countries %} -
- {{ country.name }} - {% if country.code and not country.code in ("A1", "A2") %} - - {% end %} -
-
- {% module ProgressBar(country.value) %} -
- {% end %} -
- -{% if other_countries %} - {{ _("IPFire is also running in %s.") % locale.list(other_countries) }} -{% end %} diff --git a/src/web/__init__.py b/src/web/__init__.py index 85b58a5c..15c76dc8 100644 --- a/src/web/__init__.py +++ b/src/web/__init__.py @@ -46,7 +46,7 @@ class Application(tornado.web.Application): "static_path" : self.backend.config.get("global", "static_dir"), "template_path" : self.backend.config.get("global", "templates_dir"), - # UI Modules + # UI Methods "ui_methods" : { "format_country_name" : self.format_country_name, "format_month_name" : self.format_month_name, @@ -55,6 +55,8 @@ class Application(tornado.web.Application): "format_phone_number_location" : self.format_phone_number_location, "grouper" : grouper, }, + + # UI Modules "ui_modules" : { # Blog "BlogHistoryNavigation": blog.HistoryNavigationModule, @@ -67,10 +69,7 @@ class Application(tornado.web.Application): "BootMenuHeader" : boot.MenuHeaderModule, "BootMenuSeparator" : boot.MenuSeparatorModule, - # Location - "Map" : ui_modules.MapModule, - - # Talk + # People "AccountsList" : people.AccountsListModule, "CDR" : people.CDRModule, "Channels" : people.ChannelsModule, @@ -83,10 +82,13 @@ class Application(tornado.web.Application): "Code" : nopaste.CodeModule, # Fireinfo - "ProgressBar" : ui_modules.ProgressBarModule, "FireinfoDeviceTable" : fireinfo.DeviceTableModule, - "FireinfoDeviceAndGroupsTable" : fireinfo.DeviceAndGroupsTableModule, - "FireinfoGeoTable" : fireinfo.GeoTableModule, + "FireinfoDeviceAndGroupsTable" + : fireinfo.DeviceAndGroupsTableModule, + + # Misc + "Map" : ui_modules.MapModule, + "ProgressBar" : ui_modules.ProgressBarModule, }, # Call this when a page wasn't found diff --git a/src/web/fireinfo.py b/src/web/fireinfo.py index a00eaaac..cbb1518d 100644 --- a/src/web/fireinfo.py +++ b/src/web/fireinfo.py @@ -287,30 +287,3 @@ class DeviceAndGroupsTableModule(ui_modules.UIModule): return self.render_string("fireinfo/modules/table-devices-and-groups.html", groups=groups) - - -class GeoTableModule(ui_modules.UIModule): - def render(self, items): - countries = [] - other_countries = [] - for code, value in items: - # Skip the satellite providers in this ranking - if code in (None, "A1", "A2"): - continue - - name = self.backend.geoip.get_country_name(code) - - # Don't add countries with a small share on the list - if value < 0.01: - other_countries.append(name) - continue - - country = database.Row({ - "code" : code, - "name" : name, - "value" : value, - }) - countries.append(country) - - return self.render_string("fireinfo/modules/table-geo.html", - countries=countries, other_countries=other_countries)