Browse Source

Add bookmarklet link to settings page

Getty Ritter 4 years ago
parent
commit
7690f83b0d
3 changed files with 13 additions and 1 deletions
  1. 1 1
      lc/app.py
  2. 6 0
      lc/view.py
  3. 6 0
      templates/config.mustache

+ 1 - 1
lc/app.py

@@ -104,7 +104,7 @@ class GetUser(Endpoint):
 
 
 @endpoint("/u/<string:user>/config")
-class UserConfig(Endpoint):
+class GetUserConfig(Endpoint):
     def html(self, user: str):
         u = self.require_authentication(user)
         return render(

+ 6 - 0
lc/view.py

@@ -46,6 +46,12 @@ class Config(View):
     username: str
     admin_pane: Optional[AdminPane]
 
+    def bookmarklet_link(self):
+        return ('javascript:(function(){window.open(`' +
+                c.app_path + '/u/' + self.username +
+                '/l?name=${document.title}&url=${document.URL}`);})();')
+
+
 
 @dataclass
 class Tag(View):

+ 6 - 0
templates/config.mustache

@@ -20,6 +20,12 @@
     </form>
   </div>
 </div>
+<div class="config-pane">
+  <div class="config">
+  <p>Drag the following link to your bookmark bar to create a bookmarklet:</p>
+  <p><a href="{{bookmarklet_link}}">Add Lament</a></p>
+  </div>
+</div>
 {{#admin_pane}}
   <div class="config-pane">
     <div class="config">