From 58a86872f5e35798f2a9245ff2616d13d04ed7bb Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 13 Apr 2016 23:52:01 +0300 Subject: [PATCH] Add specific event for update page options. --- src/uxbox/data/pages.cljs | 13 +++++++++++++ src/uxbox/data/workspace.cljs | 9 +++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/uxbox/data/pages.cljs b/src/uxbox/data/pages.cljs index 9d4cfe4ce..0c566db60 100644 --- a/src/uxbox/data/pages.cljs +++ b/src/uxbox/data/pages.cljs @@ -168,6 +168,19 @@ (dissoc data :data) (map->UpdatePageMetadata))) +;; --- Update Page Options + +(defrecord UpdatePageOptions [id options] + rs/WatchEvent + (-apply-watch [this state s] + (let [page (get-in state [:pages-by-id id]) + page (assoc page :options options)] + (rx/of (map->UpdatePageMetadata page))))) + +(defn update-page-options + [id options] + (UpdatePageOptions. id options)) + ;; --- Delete Page (by id) (defrecord DeletePage [id callback] diff --git a/src/uxbox/data/workspace.cljs b/src/uxbox/data/workspace.cljs index fe5f3c420..5a721f0b4 100644 --- a/src/uxbox/data/workspace.cljs +++ b/src/uxbox/data/workspace.cljs @@ -203,12 +203,9 @@ (defrecord UpdateWorkspaceSettings [id options] rs/WatchEvent (-apply-watch [_ state s] - (let [page (get-in state [:pages-by-id id]) - page (assoc page :options options)] - (rx/of - (udp/update-page-metadata page) - (initialize-alignment-index id) - (udf/clean :workspace/settings)))) + (rx/of (udp/update-page-options id options) + (initialize-alignment-index id) + (udf/clean :workspace/settings))) rs/EffectEvent (-apply-effect [_ state]