diff --git a/app/javascript/controllers/index.ts b/app/javascript/controllers/index.ts index 103dfcfdb..806d7496a 100644 --- a/app/javascript/controllers/index.ts +++ b/app/javascript/controllers/index.ts @@ -15,5 +15,8 @@ application.register("hotkeys", HotkeysController); import KeepUnreadToggleController from "./keep_unread_toggle_controller"; application.register("keep-unread-toggle", KeepUnreadToggleController); +import MarkAllAsReadController from "./mark_all_as_read_controller"; +application.register("mark-all-as-read", MarkAllAsReadController); + import StarToggleController from "./star_toggle_controller"; application.register("star-toggle", StarToggleController); diff --git a/app/javascript/controllers/mark_all_as_read_controller.ts b/app/javascript/controllers/mark_all_as_read_controller.ts new file mode 100644 index 000000000..d237103fd --- /dev/null +++ b/app/javascript/controllers/mark_all_as_read_controller.ts @@ -0,0 +1,15 @@ +import {Controller} from "@hotwired/stimulus"; + +import {assert} from "helpers/assert"; + +export default class extends Controller { + static override targets = ["form"]; + + formTarget!: HTMLFormElement; + + submit(event: Event): void { + event.preventDefault(); + + assert(this.formTarget).requestSubmit(); + } +} diff --git a/app/views/feeds/_single_feed_action_bar.html.erb b/app/views/feeds/_single_feed_action_bar.html.erb index 7b4e17730..ee0bd0ac1 100644 --- a/app/views/feeds/_single_feed_action_bar.html.erb +++ b/app/views/feeds/_single_feed_action_bar.html.erb @@ -1,13 +1,13 @@ -
+
@@ -22,32 +22,8 @@ - +
- - diff --git a/app/views/stories/_action_bar.html.erb b/app/views/stories/_action_bar.html.erb index adde91546..87ad929d2 100644 --- a/app/views/stories/_action_bar.html.erb +++ b/app/views/stories/_action_bar.html.erb @@ -1,10 +1,10 @@ -