summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2020-09-26 14:41:31 +0200
committerJules Laplace <julescarbon@gmail.com>2020-09-26 14:41:31 +0200
commit2231a6e1c05b07bb7ec5906716aedec93d02429c (patch)
treeed61d3045ca6cded5420ee6850bcc58ff6994848
parentc2f2d222ebeee0862bdeb54e49b86c3c5cd14ee3 (diff)
fix bug in crud reducer
-rw-r--r--README.md7
-rw-r--r--frontend/api/crud.reducer.js16
-rw-r--r--frontend/views/page/components/tile.handle.js15
3 files changed, 23 insertions, 15 deletions
diff --git a/README.md b/README.md
index 38a303e..91bc1bd 100644
--- a/README.md
+++ b/README.md
@@ -47,3 +47,10 @@ Generate a new migration if you've modified the database:
./cli.py db revision --autogenerate -m 'describe the changes'
./cli.py db upgrade head
```
+
+## building the site
+
+```
+./cli.py site export --graph swimmer
+```
+
diff --git a/frontend/api/crud.reducer.js b/frontend/api/crud.reducer.js
index dd1fe48..2a7e4c4 100644
--- a/frontend/api/crud.reducer.js
+++ b/frontend/api/crud.reducer.js
@@ -1,6 +1,6 @@
-import * as types from '../types'
-import { getOrderedIds, getOrderedIdsFromLookup } from '../util'
-import { session } from '../session'
+import * as types from 'app/types'
+import { getOrderedIds, getOrderedIdsFromLookup } from 'app/utils'
+import { session } from 'app/session'
export const crudState = (type, options) => ({
index: {},
@@ -115,14 +115,14 @@ export const crudReducer = (type) => {
...state,
update: action.data,
index: addToIndex(state.index, action.data.res, state.options.sort),
- show: (state.show && state.show.res) ? {
- res: (state.show.res.id === action.data.res.id ? {
+ show: (state.show.res && state.show.res.id === action.data.res.id) ? {
+ res: {
...state.show.res,
...action.data.res,
- } : state.show.res),
- } : {}
+ }
+ } : state.show
}
- case crud_type.index_error:
+ case crud_type.update_error:
return {
...state,
update: { loading: false, error: true },
diff --git a/frontend/views/page/components/tile.handle.js b/frontend/views/page/components/tile.handle.js
index 9212dbb..e91f0b1 100644
--- a/frontend/views/page/components/tile.handle.js
+++ b/frontend/views/page/components/tile.handle.js
@@ -70,13 +70,14 @@ const TileHandle = ({ tile, bounds, box, viewing, onMouseDown, onDoubleClick })
if (viewing && tile.href) {
if (tile.href.indexOf('http') === 0) {
return (
- <div
- className={className}
- style={style}
- onClick={() => window.open(tile.href, '_blank')}
- >
- {content}
- </div>
+ <a href={tile.href} rel='noopener'>
+ <div
+ className={className}
+ style={style}
+ >
+ {content}
+ </div>
+ </a>
)
} else {
return (