diff --git a/src/uxbox/ui/dashboard/images.cljs b/src/uxbox/ui/dashboard/images.cljs index 2e5173d17..fde30b1a0 100644 --- a/src/uxbox/ui/dashboard/images.cljs +++ b/src/uxbox/ui/dashboard/images.cljs @@ -333,31 +333,3 @@ :transfer-state images-page-transfer-state :name "images-page" :mixins [mx/static]})) - -;; --- New Element Lightbox (TODO) - -(defn- new-image-lightbox-render - [own] - (html - [:div.lightbox-body - [:h3 "New image"] - [:div.row-flex - [:div.lightbox-big-btn - [:span.big-svg i/shapes] - [:span.text "Go to workspace"]] - [:div.lightbox-big-btn - [:span.big-svg.upload i/exit] - [:span.text "Upload file"]]] - [:a.close {:href "#" - :on-click #(do (dom/prevent-default %) - (udl/close!))} - i/close]])) - -(def ^:private new-image-lightbox - (mx/component - {:render new-image-lightbox-render - :name "new-image-lightbox"})) - -(defmethod lbx/render-lightbox :new-image - [_] - (new-image-lightbox)) diff --git a/src/uxbox/ui/workspace.cljs b/src/uxbox/ui/workspace.cljs index a79cbac35..469945862 100644 --- a/src/uxbox/ui/workspace.cljs +++ b/src/uxbox/ui/workspace.cljs @@ -20,6 +20,7 @@ [uxbox.ui.mixins :as mx] [uxbox.ui.messages :as uum] [uxbox.ui.confirm] + [uxbox.ui.workspace.images] [uxbox.ui.keyboard :as kbd] [uxbox.ui.workspace.scroll :as scroll] [uxbox.ui.workspace.download] diff --git a/src/uxbox/ui/workspace/header.cljs b/src/uxbox/ui/workspace/header.cljs index 4f3303129..98f28e129 100644 --- a/src/uxbox/ui/workspace/header.cljs +++ b/src/uxbox/ui/workspace/header.cljs @@ -75,6 +75,7 @@ toggle #(rs/emit! (dw/toggle-flag %)) on-undo #(rs/emit! (udh/backwards-to-previous-version)) on-redo #(rs/emit! (udh/forward-to-next-version)) + on-image #(udl/open! :new-image) ;; TODO: temporary open-confirm-dialog #(udl/open! :confirm)] (html @@ -136,7 +137,7 @@ i/export] [:li.tooltip.tooltip-bottom {:alt "Image (Ctrl + I)" - :on-click open-confirm-dialog} + :on-click on-image} i/image]] [:ul.options-btn [:li.tooltip.tooltip-bottom diff --git a/src/uxbox/ui/workspace/images.cljs b/src/uxbox/ui/workspace/images.cljs new file mode 100644 index 000000000..223b57aaf --- /dev/null +++ b/src/uxbox/ui/workspace/images.cljs @@ -0,0 +1,58 @@ +;; This Source Code Form is subject to the terms of the Mozilla Public +;; License, v. 2.0. If a copy of the MPL was not distributed with this +;; file, You can obtain one at http://mozilla.org/MPL/2.0/. +;; +;; Copyright (c) 2015-2016 Andrey Antukh +;; Copyright (c) 2015-2016 Juan de la Cruz + +(ns uxbox.ui.workspace.images + (:require [sablono.core :as html :refer-macros [html]] + [rum.core :as rum] + [lentes.core :as l] + [uxbox.locales :as t :refer (tr)] + [uxbox.state :as st] + [uxbox.rstore :as rs] + [uxbox.library :as library] + [uxbox.data.dashboard :as dd] + [uxbox.data.lightbox :as udl] + [uxbox.data.images :as di] + [uxbox.ui.icons :as i] + [uxbox.ui.mixins :as mx] + [uxbox.ui.lightbox :as lbx] + [uxbox.ui.keyboard :as k] + [uxbox.ui.library-bar :as ui.library-bar] + [uxbox.ui.dashboard.header :refer (header)] + [uxbox.util.lens :as ul] + [uxbox.util.dom :as dom])) + +;; --- Helpers & Constants + +(defn- new-image-lightbox-render + [own] + (html + [:div.lightbox-body + [:h3 "New image"] + [:div.row-flex + [:div.lightbox-big-btn + [:span.big-svg i/shapes] + [:span.text "Go to workspace"]] + [:div.lightbox-big-btn + {:on-click #(dom/click (dom/get-element-by-class "upload-image-input"))} + [:span.big-svg.upload i/exit] + [:span.text "Upload file"] + [:input.upload-image-input {:style {:display "none"} + :type "file" + :on-change #(rs/emit! (di/create-images nil (dom/get-event-files %)))}]]] + [:a.close {:href "#" + :on-click #(do (dom/prevent-default %) + (udl/close!))} + i/close]])) + +(def ^:private new-image-lightbox + (mx/component + {:render new-image-lightbox-render + :name "new-image-lightbox"})) + +(defmethod lbx/render-lightbox :new-image + [_] + (new-image-lightbox))