Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
gy4443
chemotion_eln_server
Commits
25fdad2e
Commit
25fdad2e
authored
Aug 17, 2015
by
Marco Sehrer
Browse files
Allow to have nested collection/sample routes
parent
345a1085
Changes
6
Hide whitespace changes
Inline
Side-by-side
app/assets/javascripts/components/App.js
View file @
25fdad2e
...
...
@@ -18,16 +18,12 @@ Aviator.setRoutes({
'
/
'
:
'
root
'
,
target
:
{
root
:
function
(
e
)
{
UIActions
.
deselectAllElements
(
'
sample
'
);
//UIActions.selectCollection({id: 'all'});
let
modalDomNode
=
document
.
getElementById
(
'
modal
'
);
if
(
modalDomNode
)
{
React
.
unmountComponentAtNode
(
modalDomNode
);
}
}
},
'
/collection
'
:
{
target
:
{
show
:
function
(
e
)
{
...
...
@@ -40,10 +36,10 @@ Aviator.setRoutes({
'
/sample
'
:
{
target
:
{
show
:
function
(
e
)
{
UIActions
.
selectElement
({
type
:
'
sample
'
,
id
:
e
[
'
params
'
][
'
id
'
]})
UIActions
.
selectElement
({
type
:
'
sample
'
,
id
:
e
[
'
params
'
][
'
sampleID
'
]})
}
},
'
/:
id
'
:
'
show
'
'
/:
sampleID
'
:
'
show
'
},
'
/sharing
'
:
{
'
/*
'
:
'
showShareModal
'
,
...
...
app/assets/javascripts/components/CollectionSubtree.js
View file @
25fdad2e
...
...
@@ -11,10 +11,10 @@ import Aviator from 'aviator';
export
default
class
CollectionSubtree
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
let
uiStoreState
=
UIStore
.
getState
();
let
selec
te
d
=
ui
Store
State
.
currentCollectionId
==
props
.
root
.
id
;
let
childIds
=
props
.
root
.
children
.
map
(
c
=>
c
.
id
)
;
let
visible
=
childI
ds
.
indexOf
(
parseInt
(
uiSt
oreSt
ate
.
currentCollectionId
))
>
-
1
let
uiSta
te
=
UI
Store
.
getState
()
;
let
selected
=
uiState
.
currentCollectionId
==
props
.
root
.
id
;
let
visible
=
props
.
root
.
descendant_i
ds
.
indexOf
(
parseInt
(
uiState
.
currentCollectionId
))
>
-
1
this
.
state
=
{
label
:
props
.
root
.
label
,
...
...
app/assets/javascripts/components/CollectionTree.js
View file @
25fdad2e
...
...
@@ -63,10 +63,12 @@ export default class CollectionTree extends React.Component {
}
render
()
{
//Fake All-Collection
let
allCollection
=
{
label
:
'
All *
'
,
id
:
'
all
'
,
children
:
[]
children
:
[],
descendant_ids
:
[]
};
return
(
...
...
app/assets/javascripts/components/ElementsTable.js
View file @
25fdad2e
import
React
from
'
react
'
;
import
{
Label
,
Pagination
,
Table
}
from
'
react-bootstrap
'
;
import
UIStore
from
'
./stores/UIStore
'
;
import
ElementStore
from
'
./stores/ElementStore
'
;
import
ElementAllCheckbox
from
'
./ElementAllCheckbox
'
;
import
ElementCheckbox
from
'
./ElementCheckbox
'
;
...
...
@@ -116,7 +117,8 @@ export default class ElementsTable extends React.Component {
}
showDetails
(
element
)
{
Aviator
.
navigate
(
`/
${
element
.
type
}
/
${
element
.
id
}
`
);
let
uiState
=
UIStore
.
getState
();
Aviator
.
navigate
(
`/collection/
${
uiState
.
currentCollectionId
}
/
${
element
.
type
}
/
${
element
.
id
}
`
);
}
handlePaginationSelect
(
event
,
selectedEvent
)
{
...
...
app/assets/javascripts/components/SampleDetails.js
View file @
25fdad2e
...
...
@@ -4,6 +4,10 @@ import SVG from 'react-inlinesvg';
import
ElementActions
from
'
./actions/ElementActions
'
;
import
ElementStore
from
'
./stores/ElementStore
'
;
import
UIActions
from
'
./actions/UIActions
'
;
import
UIStore
from
'
./stores/UIStore
'
;
import
NumeralInputWithUnits
from
'
./NumeralInputWithUnits
'
import
ElementCollectionLabels
from
'
./ElementCollectionLabels
'
;
...
...
@@ -39,7 +43,9 @@ export default class SampleDetails extends React.Component {
}
closeDetails
()
{
Aviator
.
navigate
(
'
/
'
);
let
uiState
=
UIStore
.
getState
();
UIActions
.
deselectAllElements
(
'
sample
'
);
Aviator
.
navigate
(
`/collection/
${
uiState
.
currentCollectionId
}
`
);
}
updateSample
()
{
...
...
app/serializers/collection_serializer.rb
View file @
25fdad2e
class
CollectionSerializer
<
ActiveModel
::
Serializer
attributes
:id
,
:label
attributes
:id
,
:label
,
:descendant_ids
has_many
:children
...
...
@@ -7,4 +7,8 @@ class CollectionSerializer < ActiveModel::Serializer
object
.
children
end
def
descendant_ids
object
.
descendant_ids
end
end
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment