diff --git a/redstring/parser.py b/redstring/parser.py index 1ccbfed..6891d59 100644 --- a/redstring/parser.py +++ b/redstring/parser.py @@ -80,7 +80,7 @@ class TagOptions: def interlink(self) -> bool: return self.options.get(self._INTERLINK_KEY, False) - @hyperlink.setter + @interlink.setter def interlink(self, value: bool): self.options[self._INTERLINK_KEY] = value diff --git a/redstring/server.py b/redstring/server.py index 116a6de..6258660 100644 --- a/redstring/server.py +++ b/redstring/server.py @@ -91,6 +91,36 @@ def edit(document_id): return redirect(url_for('edit', document_id=document_id)) return abort(400) + elif option := request.args.get('option'): + if tag_name := request.args.get('tag'): + tag = doc.get_tag(tag_name) + if option == 'hyperlink': + tag.options.hyperlink = not tag.options.hyperlink + elif option == 'interlink': + print(tag.options.options) + tag.options.interlink = not tag.options.interlink + elif option == 'private': + tag.options.private = not tag.options.private + else: + return abort(400) + with open(doc_path, 'w') as f: + dump(doc, f) + return redirect(url_for('edit', document_id=document_id)) + elif tab_name := request.args.get('tab'): + tab = doc.get_tab(tab_name) + if option == 'priority': + value = request.args.get('value', 0) + tab.options.priority = value + elif option == 'hide_names': + tab.options.hide_names = not tab.options.hide_names + elif option == 'private': + tab.options.private = not tab.options.private + else: + return abort(400) + with open(doc_path, 'w') as f: + dump(doc, f) + return redirect(url_for('edit', document_id=document_id)) + # Otherwise, return the editor page else: return render_template('edit.jinja', document=doc, index=False) diff --git a/redstring/templates/base.jinja b/redstring/templates/base.jinja index c55243b..66c7e87 100644 --- a/redstring/templates/base.jinja +++ b/redstring/templates/base.jinja @@ -104,9 +104,6 @@ table.page-table a { color: #8af; } - table.page-table a:visited { - color: #88f; - } /* Edit page styling */ input.tag-name { diff --git a/redstring/templates/edit.jinja b/redstring/templates/edit.jinja index 4044693..8d6139b 100644 --- a/redstring/templates/edit.jinja +++ b/redstring/templates/edit.jinja @@ -8,7 +8,6 @@ var newTabCounter = 0; function selectTab(name) { - let tab = document.getElementById("tab-" + name); if (tab) { @@ -71,6 +70,10 @@ window.onload = function () {