Skip to content

Commit 18ea1cd

Browse files
authored
Merge pull request #1929 from UlrichB22/fix_1928
add icon for +admin/user and some fault tolerance
2 parents 154c848 + d17c3e6 commit 18ea1cd

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/moin/constants/misc.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181

8282
# Iconclass to endpoint mapping used in navibars
8383
ICON_MAP = {
84+
"admin.index": "fa fa-cog",
8485
"admin.index_user": "fa fa-user",
8586
"frontend.backrefs": "fa fa-share",
8687
"frontend.convert_item": "fa fa-clone",

src/moin/themes/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def get_action_tabs(self, fqname, current_endpoint):
189189
if not check_exists or exists:
190190
if endpoint in navtabs_endpoints:
191191

192-
iconcls = ICON_MAP[endpoint]
192+
iconcls = ICON_MAP[endpoint] if endpoint in ICON_MAP else ""
193193
linkcls = None
194194

195195
if endpoint == "special.comments":
@@ -251,7 +251,7 @@ def get_local_panel(self, fqname):
251251
if endpoint in user_actions_endpoints:
252252
if flaskg.user.valid:
253253
href = url_for(endpoint, item_name=fqname)
254-
iconcls = ICON_MAP[endpoint]
254+
iconcls = ICON_MAP[endpoint] if endpoint in ICON_MAP else ""
255255
# endpoint = iconcls = label = None
256256

257257
if endpoint == "frontend.quicklink_item":
@@ -269,15 +269,15 @@ def get_local_panel(self, fqname):
269269

270270
elif endpoint in item_actions_endpoints:
271271

272-
iconcls = ICON_MAP[endpoint]
272+
iconcls = ICON_MAP[endpoint] if endpoint in ICON_MAP else ""
273273

274274
href = url_for(endpoint, item_name=fqname)
275275
item_actions.append((endpoint, href, iconcls, label, title, True))
276276

277277
# Special Supplementation defined only for named items
278278
elif endpoint in item_navigation_endpoints and fqname.field == NAME_EXACT:
279279

280-
iconcls = ICON_MAP[endpoint]
280+
iconcls = ICON_MAP[endpoint] if endpoint in ICON_MAP else ""
281281

282282
if endpoint == "special.supplementation":
283283
for sub_item_name in app.cfg.supplementation_item_names:
@@ -452,7 +452,7 @@ def navibar(self, fqname):
452452
link_text = f"{fqname.namespace}/{link_text}"
453453
elif endpoint == "admin.index" and not getattr(flaskg.user.may, SUPERUSER)():
454454
continue
455-
iconcls = ICON_MAP[endpoint]
455+
iconcls = ICON_MAP[endpoint] if endpoint in ICON_MAP else ""
456456
items.append((cls, url_for(endpoint, **args), link_text, title, iconcls))
457457
# Add user links to wiki links.
458458
for text in self.user.quicklinks:

0 commit comments

Comments
 (0)