Pārlūkot izejas kodu

Added remove link to to-do list

allens 1 nedēļu atpakaļ
vecāks
revīzija
0eafea0ed5
3 mainītis faili ar 16 papildinājumiem un 5 dzēšanām
  1. 0 2
      TODO.md
  2. 2 2
      ownchatbot/templates/mgmt.html
  3. 14 1
      ownchatbot/web_panels.py

+ 0 - 2
TODO.md

@@ -1,8 +1,6 @@
 * I'm pretty sure this is resolved, so get this out of the logs "[2026-01-21 09:32:15 -0700] [1644] [INFO] <Response [200]>"
 * Make fulfilled rewards disappear at the beginning of stream
 * Add celebration route for OBS overlay, for things like new followers and goals/milestones
- * Add customizable celebration emojis for this
 * Add chat notification when a reward is fulfilled
 * Short video tutorials on configuring OwnchatBot
 * Add option to set up Kofi subscriber-only awards
-* Add field in Kofi settings for streamer to list other Kofi perks, which will be displayed on the OCB info page.

+ 2 - 2
ownchatbot/templates/mgmt.html

@@ -439,12 +439,12 @@
                     {% if item.crossed == 'no' %}
                         <li style="text-decoration:none;">
                             {{ item.name }}
-                            <a href="{{ url_for('web_panels.cross', item_id=loop.index0) }}">[Cross Off]</a>
+                            <a href="{{ url_for('web_panels.cross', item_id=loop.index0) }}">[Cross Off]</a><span style="color: red;"><a href="{{ url_for('web_panels.rem_todo_item', item_id=loop.index0) }}">Remove</a></span>
                         </li>
                     {% else %}
                         <li> <span style="text-decoration:line-through;">
                             {{ item.name }}</span>
-                            <a href="{{ url_for('web_panels.uncross', item_id=loop.index0) }}">[Un-Cross]</a>
+                            <a href="{{ url_for('web_panels.uncross', item_id=loop.index0) }}">[Un-Cross]</a><span style="color: red;"><a href="{{ url_for('web_panels.rem_todo_item', item_id=loop.index0) }}">Remove</a></span>
                         </li>
                     {% endif %}
                 {% endfor %}

+ 14 - 1
ownchatbot/web_panels.py

@@ -594,7 +594,7 @@ def add_todo_item():
 @requires_login
 def cross(item_id):
     todolist_items = current_app.config['LIST']
-    if 0 <= item_id < len(todolist_items):
+    if 0 <= item_id < len(todolist_items):  # Make sure the item exists
         todolist_items[item_id]['crossed'] = 'yes'
         if save_todolist(todolist_items):  # Save todo list
             current_app.logger.info('Saved to-do list.')
@@ -612,6 +612,19 @@ def uncross(item_id):
     return redirect(url_for('web_panels.mgmt', activeTab='todolist'))
 
 
+@ocb.route('/mgmt/remtodoitem/<int:item_id>')
+@requires_login
+def rem_todo_item(item_id):
+    todolist_items = current_app.config['LIST']
+    item_item_id = name
+    if 0 <= item_id < len(todolist_items):  # Make sure the item exists
+        removed = todolist_items.pop([item_id])
+        current_app.logger.info(f'Removed \"{removed}\" from the to-do list.')
+        if save_todolist(todolist_items):  # Save todo list
+            current_app.logger.info('Saved to-do list.')
+    return redirect(url_for('web_panels.mgmt', activeTab='todolist'))
+
+
 @ocb.route('/mgmt/clearlist')
 @requires_login
 def clear_list():