-
-
Notifications
You must be signed in to change notification settings - Fork 398
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2205 from neotyk/dev/block-types-ui-extension-points
Block view/edit reusability
- Loading branch information
Showing
19 changed files
with
998 additions
and
606 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
(ns athens.events.dragging | ||
(:require | ||
[re-frame.core :as rf])) | ||
|
||
|
||
(rf/reg-event-db | ||
::cleanup! | ||
(fn [db [_ uid]] | ||
(update db :dragging dissoc uid))) | ||
|
||
|
||
(rf/reg-event-db | ||
::set-dragging! | ||
(fn [db [_ uid dragging?]] | ||
(assoc-in db [:dragging uid :dragging?] dragging?))) | ||
|
||
|
||
(rf/reg-event-db | ||
::set-drag-target! | ||
(fn [db [_ uid drag-target]] | ||
(assoc-in db [:dragging uid :drag-target] drag-target))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
(ns athens.events.inline-refs | ||
(:require | ||
[re-frame.core :as rf])) | ||
|
||
|
||
(rf/reg-event-db | ||
::cleanup! | ||
(fn [db [_ uid]] | ||
(update db :inline-refs dissoc uid))) | ||
|
||
|
||
(rf/reg-event-db | ||
::set-open! | ||
(fn [db [_ uid open?]] | ||
(assoc-in db [:inline-refs uid :open?] open?))) | ||
|
||
|
||
(rf/reg-event-db | ||
::toggle-open! | ||
(fn [db [_ uid]] | ||
(update-in db [:inline-refs uid :open?] not))) | ||
|
||
|
||
(rf/reg-event-db | ||
::set-state! | ||
(fn [db [_ uid state]] | ||
(assoc-in db [:inline-refs uid :state] state))) | ||
|
||
|
||
(rf/reg-event-db | ||
::toggle-state-open! | ||
(fn [db [_ uid]] | ||
(update-in db [:inline-refs uid :state :open?] not))) | ||
|
||
|
||
(rf/reg-event-db | ||
::set-block! | ||
(fn [db [_ uid block]] | ||
(assoc-in db [:inline-refs uid :state :block] block))) | ||
|
||
|
||
(rf/reg-event-db | ||
::set-parents! | ||
(fn [db [_ uid parents]] | ||
(assoc-in db [:inline-refs uid :state :parents] parents))) | ||
|
||
|
||
(rf/reg-event-db | ||
::set-focus! | ||
(fn [db [_ uid focus?]] | ||
(assoc-in db [:inline-refs uid :state :focus?] focus?))) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
(ns athens.events.inline-search | ||
"Inline Search Events" | ||
(:require | ||
[re-frame.core :as rf])) | ||
|
||
|
||
(rf/reg-event-db | ||
::set-type! | ||
(fn [db [_ uid type]] | ||
(assoc-in db [:inline-search uid :type] type))) | ||
|
||
|
||
(rf/reg-event-db | ||
::close! | ||
(fn [db [_ uid]] | ||
(assoc-in db [:inline-search uid :type] nil))) | ||
|
||
|
||
(rf/reg-event-db | ||
::set-index! | ||
(fn [db [_ uid index]] | ||
(assoc-in db [:inline-search uid :index] index))) | ||
|
||
|
||
(rf/reg-event-db | ||
::set-results! | ||
(fn [db [_ uid results]] | ||
(assoc-in db [:inline-search uid :results] results))) | ||
|
||
|
||
(rf/reg-event-db | ||
::clear-results! | ||
(fn [db [_ uid]] | ||
(assoc-in db [:inline-search uid :results] []))) | ||
|
||
|
||
(rf/reg-event-db | ||
::set-query! | ||
(fn [db [_ uid query]] | ||
(assoc-in db [:inline-search uid :query] query))) | ||
|
||
|
||
(rf/reg-event-db | ||
::clear-query! | ||
(fn [db [_ uid]] | ||
(assoc-in db [:inline-search uid :query] ""))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
(ns athens.events.linked-refs | ||
(:require | ||
[re-frame.core :as rf])) | ||
|
||
|
||
(rf/reg-event-db | ||
::cleanup! | ||
(fn [db [_ uid]] | ||
(update db :linked-ref dissoc uid))) | ||
|
||
|
||
(rf/reg-event-db | ||
::set-open! | ||
(fn [db [_ uid open?]] | ||
(assoc-in db [:linked-ref uid] open?))) | ||
|
||
|
||
(rf/reg-event-db | ||
::toggle-open! | ||
(fn [db [_ uid]] | ||
(update-in db [:linked-ref uid] (fnil not false)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
(ns athens.subs.dragging | ||
(:require | ||
[re-frame.core :as rf])) | ||
|
||
|
||
(rf/reg-sub | ||
::drag-target | ||
(fn [db [_ uid]] | ||
(get-in db [:dragging uid :drag-target]))) | ||
|
||
|
||
(rf/reg-sub | ||
::dragging? | ||
(fn [db [_ uid]] | ||
(get-in db [:dragging uid :dragging?]))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
(ns athens.subs.inline-refs | ||
(:require | ||
[re-frame.core :as rf])) | ||
|
||
|
||
(rf/reg-sub | ||
::open? | ||
(fn [db [_ uid]] | ||
(get-in db [:inline-refs uid :open?] false))) | ||
|
||
|
||
(rf/reg-sub | ||
::state-open? | ||
(fn [db [_ uid]] | ||
(get-in db [:inline-refs uid :state :open?] false))) | ||
|
||
|
||
(rf/reg-sub | ||
::state-focus? | ||
(fn [db [_ uid]] | ||
(get-in db [:inline-refs uid :state :focus?] false))) | ||
|
||
|
||
(rf/reg-sub | ||
::state-block | ||
(fn [db [_ uid]] | ||
(get-in db [:inline-refs uid :state :block]))) | ||
|
||
|
||
(rf/reg-sub | ||
::state-parents | ||
(fn [db [_ uid]] | ||
(get-in db [:inline-refs uid :state :parents]))) | ||
|
||
|
||
(rf/reg-sub | ||
::state-embed-id | ||
(fn [db [_ uid]] | ||
(get-in db [:inline-refs uid :state :focus?]))) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
(ns athens.subs.inline-search | ||
(:require | ||
[re-frame.core :as rf])) | ||
|
||
|
||
(rf/reg-sub | ||
::type | ||
(fn [db [_ uid]] | ||
(get-in db [:inline-search uid :type]))) | ||
|
||
|
||
(rf/reg-sub | ||
::index | ||
(fn [db [_ uid]] | ||
(get-in db [:inline-search uid :index]))) | ||
|
||
|
||
(rf/reg-sub | ||
::results | ||
(fn [db [_ uid]] | ||
(get-in db [:inline-search uid :results]))) | ||
|
||
|
||
(rf/reg-sub | ||
::query | ||
(fn [db [_ uid]] | ||
(get-in db [:inline-search uid :query]))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
(ns athens.subs.linked-refs | ||
(:require | ||
[re-frame.core :as rf])) | ||
|
||
|
||
(rf/reg-sub | ||
::open? | ||
(fn [db [_ uid]] | ||
(get-in db [:linked-ref uid] false))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.