Skip to content

Commit

Permalink
refactor: prefer rate-limited-action-button over :button
Browse files Browse the repository at this point in the history
  • Loading branch information
Macroz committed Apr 11, 2024
1 parent 86842cf commit 30fc8d4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
10 changes: 6 additions & 4 deletions src/cljs/rems/administration/catalogue_items.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,14 @@
(text :t.administration/create-catalogue-item)])

(defn- update-catalogue-item-button [items]
[:button.btn.btn-primary
{:disabled (when (empty? items) :disabled)
[atoms/rate-limited-action-button
{:id :update-catalogue-item
:class "btn-primary"
:disabled (when (empty? items) :disabled)
:on-click (fn []
(rf/dispatch [:rems.administration.update-catalogue-item/enter-page items])
(navigate! "/administration/catalogue-items/update-catalogue-item"))}
(text :t.administration/update-catalogue-item)])
(navigate! "/administration/catalogue-items/update-catalogue-item"))
:label (text :t.administration/update-catalogue-item)}])

(defn- categories-button []
[atoms/link {:class "btn btn-primary" :id :manage-categories}
Expand Down
9 changes: 5 additions & 4 deletions src/cljs/rems/administration/update_catalogue_item.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,13 @@
items))

(defn- update-catalogue-item-button [items {:keys [form workflow]}]
[:button.btn.btn-primary
{:type :button
[atoms/rate-limited-button
{:id :update-catalogue-item
:class "btn-primary"
:on-click (fn [] (item-update-loop items form workflow))
:disabled (or (empty? items)
(all-items-have-the-form-and-workflow-already? items form workflow))}
(text :t.administration/update-catalogue-item)])
(all-items-have-the-form-and-workflow-already? items form workflow))
:label (text :t.administration/update-catalogue-item)}])



Expand Down

0 comments on commit 30fc8d4

Please sign in to comment.