Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
mahara
mahara
Commits
c5f96d39
Commit
c5f96d39
authored
Oct 09, 2019
by
Robert Lyon
Committed by
Gerrit Code Review
Oct 09, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge "Bug 1813987: resizing block when expandig collapsible inside block"
parents
851d5d70
02c6617d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
18 deletions
+62
-18
htdocs/js/gridlayout.js
htdocs/js/gridlayout.js
+59
-17
htdocs/js/jTLine/js/jtline.js
htdocs/js/jTLine/js/jtline.js
+2
-0
htdocs/theme/raw/templates/view/versioning.tpl
htdocs/theme/raw/templates/view/versioning.tpl
+1
-1
No files found.
htdocs/js/gridlayout.js
View file @
c5f96d39
...
@@ -57,8 +57,13 @@ function loadGrid(grid, blocks) {
...
@@ -57,8 +57,13 @@ function loadGrid(grid, blocks) {
// images need time to load before height can be properly calculated
// images need time to load before height can be properly calculated
window
.
setTimeout
(
function
(){
window
.
setTimeout
(
function
(){
// no need to update the blocksizes for hidden timeline views
var
id
=
$
(
grid
.
container
).
attr
(
'
id
'
);
if
(
typeof
id
===
'
undefined
'
)
{
updateBlockSizes
();
updateBlockSizes
();
}
},
300
);
},
300
);
}
}
function
initJs
()
{
function
initJs
()
{
...
@@ -70,6 +75,41 @@ function initJs() {
...
@@ -70,6 +75,41 @@ function initJs() {
if
(
typeof
viewmenuInit
!==
"
undefined
"
)
{
if
(
typeof
viewmenuInit
!==
"
undefined
"
)
{
viewmenuInit
();
viewmenuInit
();
}
}
$
(
window
).
on
(
'
colresize
'
,
function
(
e
)
{
var
grid
=
$
(
e
.
target
).
closest
(
'
.grid-stack
'
);
var
id
=
grid
.
attr
(
'
id
'
);
//check we are not in timeline view
if
(
typeof
id
===
'
undefined
'
)
{
updateBlockSizes
();
}
else
{
// on timeline view
grid
.
gridstack
();
updateBlockSizes
(
grid
);
}
});
$
(
window
).
on
(
'
shown.bs.collapse
'
,
function
(
e
)
{
var
grid
=
$
(
e
.
target
).
closest
(
'
.grid-stack
'
);
var
id
=
grid
.
attr
(
'
id
'
);
//check we are not in timeline view
if
(
typeof
id
===
'
undefined
'
)
{
updateBlockSizes
();
}
else
{
// on timeline view
grid
.
gridstack
();
updateBlockSizes
(
grid
);
}
});
$
(
window
).
on
(
'
timelineviewresizeblocks
'
,
function
()
{
var
grid
=
$
(
'
.lineli.selected .grid-stack
'
);
grid
=
grid
.
gridstack
();
updateBlockSizes
(
grid
);
});
}
}
function
updateTranslatedGridRows
(
blocks
)
{
function
updateTranslatedGridRows
(
blocks
)
{
...
@@ -132,25 +172,27 @@ function updateTranslatedGridRows(blocks) {
...
@@ -132,25 +172,27 @@ function updateTranslatedGridRows(blocks) {
moveBlocks
(
updatedGrid
);
moveBlocks
(
updatedGrid
);
}
}
function
updateBlockSizes
()
{
function
updateBlockSizes
(
grid
)
{
$
.
each
(
$
(
'
.grid-stack
'
).
children
(),
function
(
index
,
element
)
{
if
(
typeof
grid
==
'
undefined
'
)
{
grid
=
$
(
'
.grid-stack
'
);
}
$
.
each
(
grid
.
children
(),
function
(
index
,
element
)
{
if
(
!
$
(
element
).
hasClass
(
'
staticblock
'
))
{
if
(
!
$
(
element
).
hasClass
(
'
staticblock
'
))
{
var
width
=
$
(
$
(
'
.grid-stack-item
'
)[
index
]
).
attr
(
'
data-gs-width
'
),
var
width
=
$
(
element
).
attr
(
'
data-gs-width
'
),
prevHeight
=
$
(
$
(
'
.grid-stack-item
'
)[
index
]
).
attr
(
'
data-gs-height
'
),
prevHeight
=
$
(
element
).
attr
(
'
data-gs-height
'
),
height
=
Math
.
ceil
(
height
=
Math
.
ceil
(
(
(
$
(
'
.grid-stack-item-content
'
)[
index
].
scrollHeight
+
$
(
element
).
find
(
'
.grid-stack-item-content
'
)[
0
].
scrollHeight
+
$
(
'
.grid-stack
'
)
.
data
(
'
gridstack
'
).
opts
.
verticalMargin
grid
.
data
(
'
gridstack
'
).
opts
.
verticalMargin
)
)
/
/
(
(
$
(
'
.grid-stack
'
)
.
data
(
'
gridstack
'
).
cellHeight
()
+
grid
.
data
(
'
gridstack
'
).
cellHeight
()
+
$
(
'
.grid-stack
'
)
.
data
(
'
gridstack
'
).
opts
.
verticalMargin
grid
.
data
(
'
gridstack
'
).
opts
.
verticalMargin
)
)
);
);
//height = height.toString();
if
(
+
prevHeight
<
height
)
{
if
(
+
prevHeight
!=
height
)
{
grid
.
data
(
'
gridstack
'
).
resize
(
element
,
+
width
,
height
);
$
(
'
.grid-stack
'
).
data
(
'
gridstack
'
).
resize
(
$
(
'
.grid-stack-item
'
)[
index
],
+
width
,
height
);
}
}
}
}
});
});
...
@@ -172,7 +214,11 @@ function addNewWidget(blockContent, blockId, dimensions, grid, blocktypeclass, m
...
@@ -172,7 +214,11 @@ function addNewWidget(blockContent, blockId, dimensions, grid, blocktypeclass, m
// images need time to load before height can be properly calculated
// images need time to load before height can be properly calculated
window
.
setTimeout
(
function
(){
window
.
setTimeout
(
function
(){
// no need to update sizes for timeline views that are hidden
var
id
=
$
(
grid
.
container
).
attr
(
'
id
'
);
if
(
typeof
id
==
'
undefined
'
)
{
updateBlockSizes
();
updateBlockSizes
();
}
},
300
);
},
300
);
return
el
;
return
el
;
...
@@ -245,10 +291,6 @@ function gridInit() {
...
@@ -245,10 +291,6 @@ function gridInit() {
serializeWidgetMap
(
items
);
serializeWidgetMap
(
items
);
});
});
$
(
window
).
on
(
'
colresize
'
,
function
()
{
updateBlockSizes
();
});
}
}
function
gridRemoveEvents
()
{
function
gridRemoveEvents
()
{
...
...
htdocs/js/jTLine/js/jtline.js
View file @
c5f96d39
...
@@ -295,6 +295,7 @@
...
@@ -295,6 +295,7 @@
selectedContent
.
removeClass
(
'
enter-left enter-right
'
);
selectedContent
.
removeClass
(
'
enter-left enter-right
'
);
selectedContent
.
addClass
(
'
selected
'
);
selectedContent
.
addClass
(
'
selected
'
);
evdone
=
true
;
evdone
=
true
;
$
(
window
).
trigger
(
'
timelineviewresizeblocks
'
);
}
}
});
});
// height of the version changes after it becomes visible
// height of the version changes after it becomes visible
...
@@ -431,6 +432,7 @@
...
@@ -431,6 +432,7 @@
timeline
.
find
(
'
.cd-timeline-navigation
'
).
find
(
'
.next
'
).
addClass
(
'
inactive
'
);
timeline
.
find
(
'
.cd-timeline-navigation
'
).
find
(
'
.next
'
).
addClass
(
'
inactive
'
);
}
}
});
});
$
(
window
).
trigger
(
'
timelineviewresizeblocks
'
);
}
}
else
{
else
{
$
(
obj
).
html
(
"
Error fetching data
"
);
$
(
obj
).
html
(
"
Error fetching data
"
);
...
...
htdocs/theme/raw/templates/view/versioning.tpl
View file @
c5f96d39
...
@@ -41,7 +41,7 @@
...
@@ -41,7 +41,7 @@
formatSubTitle
:
function
(
subTitle
,
obj
)
{
return
'
<div class="metadata">
'
+
subTitle
+
'
</div>
'
;
},
formatSubTitle
:
function
(
subTitle
,
obj
)
{
return
'
<div class="metadata">
'
+
subTitle
+
'
</div>
'
;
},
formatBodyContent
:
function
(
bodyCnt
,
obj
)
{
formatBodyContent
:
function
(
bodyCnt
,
obj
)
{
if
(
obj
.
gridlayout
)
{
if
(
obj
.
gridlayout
)
{
var
grid
=
$
(
'
<div class="grid-stack"></div>
'
);
var
grid
=
$
(
'
<div
id="grid_
'
+
obj
.
assignID
+
'
"
class="grid-stack"></div>
'
);
var
options
=
{
var
options
=
{
verticalMargin
:
10
,
verticalMargin
:
10
,
float
:
true
,
float
:
true
,
...
...
Write
Preview
Markdown
is supported
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