Commit 24ef78c9 authored by Mathieu's avatar Mathieu
Browse files

Fix file sorting

parent 5018752b
Pipeline #1246 failed with stage
in 8 minutes and 38 seconds
......@@ -218,7 +218,8 @@ object App {
div(img(src := "img/openmole_dark.png", height := "70px"), cls := "nav-container"),
treeNodePanel.fileToolBar.element,
treeNodePanel.fileControler,
treeNodePanel.labelArea,
// treeNodePanel.labelArea,
treeNodePanel.fileToolBar.sortingGroup,
treeNodePanel.view
),
div(
......
......@@ -240,7 +240,6 @@ class FileToolBar(treeNodePanel: TreeNodePanel) {
addRootDirButton.element,
form(newNodeInput, onSubmit --> { _
createNewNode
false
})
)
......@@ -321,33 +320,71 @@ class FileToolBar(treeNodePanel: TreeNodePanel) {
}
val sortingGroup = {
val topTriangle = Seq(glyph_triangle_up, (fontSize := "10"))
val bottomTriangle = Seq(glyph_triangle_down, fontSize := "10")
// exclusiveButtonGroup(omsheet.sortingBar, cls := ("sortingTool", "selectedSortingTool"))(
// ExclusiveButton.twoGlyphSpan(
// topTriangle,
// bottomTriangle,
// () ⇒ switchAlphaSorting,
// () ⇒ switchAlphaSorting,
// preString = "Aa",
// cls := "sortingTool"
// ),
// ExclusiveButton.twoGlyphButtonStates(
// topTriangle,
// bottomTriangle,
// () ⇒ switchTimeSorting,
// () ⇒ switchTimeSorting,
// preGlyph = Seq(twoGlyphButton, glyph_time)
// ),
// ExclusiveButton.twoGlyphButtonStates(
// topTriangle,
// bottomTriangle,
// () ⇒ switchSizeSorting,
// () ⇒ switchSizeSorting,
// preGlyph = Seq(twoGlyphButton, OMTags.glyph_data, paddingTop := 10, fontSize := 12)
// )
// )
div()
trait Sorting
object Name extends Sorting
object Size extends Sorting
object Time extends Sorting
trait State
object Up extends State
object Down extends State
case class SortingState(sorting: Sorting, state: State)
val sortingState: Var[SortingState] = Var(SortingState(Name, Up))
def item(sorting: Sorting, sState: SortingState) = {
val isSelected = sorting == sState.sorting
div(
centerInDiv,
div(
sorting match {
case Name "Aa"
case Time OMTags.glyph_clock
case Size OMTags.glyph_data
},
cls := "sorting-files-item" + {
if (isSelected) "-selected" else ""
}
),
onClick --> { _
sortingState.update(ss SortingState(
sorting,
if (isSelected) {
if (ss.state == Up) Down
else Up
}
else Up))
sorting match {
case Name switchAlphaSorting
case Size switchSizeSorting
case Time switchTimeSorting
}
}
)
}
div(
cls := "sorting-files",
div(
cls := "flex-row",
children <-- sortingState.signal.map { ss
Seq(
item(Name, ss),
item(Time, ss),
item(Size, ss),
div(
paddingLeft := "20px",
cls := "sorting-file-item-caret",
ss.state match {
case Up glyph_triangle_up
case Down glyph_triangle_down
}
)
)
}
)
)
}
def getIfSelected(butt: HtmlElement) = manager.selected.now.map { m
......
......@@ -59,7 +59,6 @@ class TreeNodePanel(val treeNodeManager: TreeNodeManager, fileDisplayer: FileDis
)
lazy val fileControler =
// val current = treeNodeManager.current()
div(
cls := "file-content tree-path",
child <-- treeNodeManager.current.signal.map { curr
......@@ -94,8 +93,7 @@ class TreeNodePanel(val treeNodeManager: TreeNodeManager, fileDisplayer: FileDis
fileToolBar.unselectTool
drawTree
})
),
fileToolBar.sortingGroup
)
)
}
)
......
......@@ -45,6 +45,7 @@ object OMTags {
val glyph_plug = cls("bi-plug-fill")
val glyph_data = cls("bi-server")
val glyph_clock = cls("bi-clock")
val glyph_share = cls("bi-forward-fill")
//val options = cls("glyphicon glyphicon-option-horizontal")
val glyph_eye_open = cls("bi-eye-fill")
......
......@@ -395,30 +395,6 @@ li.selectElement{
filter: alpha(opacity=0);
}
.sortingTool{
color: white;
background-color: #222;
opacity: 0.5;
width : 35px;
position: fixed;
margin-top: 142px;
}
.sortingTool.btn:hover{
color: white;
background-color: #222;
opacity: 1;
}
.selectedSortingTool.btn, .selectedSortingTool.btn:hover{
color: white;
background-color: #222;
opacity: 1;
font-weight: bold;
width : 50px;
margin-top: 142px;
}
.fullpanel {
height: 100%;
width: 100%;
......@@ -538,7 +514,7 @@ padding-bottom: 90px;
}
.file2{
flex: 0 0 50px;
flex: 0 0 100px;
font-size: 9px;
justify-content: flex-end;
display: flex;
......@@ -596,7 +572,7 @@ padding-bottom: 90px;
/* for Firefox */
min-height: 0;
width: 400px;
width: 600px;
}
.file-section.closed {
......@@ -700,7 +676,10 @@ padding-bottom: 90px;
direction: column;
}
.flex-row {
.flex-row,
.sorting-files,
.sorting-files-item,
sorting-files-group {
display: flex;
direction: row;
}
......@@ -762,4 +741,32 @@ padding-bottom: 90px;
font-weight: bold;
color: white;
cursor: pointer;
}
\ No newline at end of file
}
.sorting-files {
justify-content : right;
padding : 20;
background-color: #3f3d56;
}
.sorting-files-item,
.sorting-files-item-selected {
width: 25px;
opacity: 0.5;
color: white;
cursor: pointer;
font-size:14px;
padding: 0 20 0 20;
}
.sorting-files-item-selected {
opacity:1;
font-size:20px;
}
.sorting-file-item-caret {
font-size: 12px;
color: white;
width: 10px;
padding-left: 10px;
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment