Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
mahara
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
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) {
// images need time to load before height can be properly calculated
window
.
setTimeout
(
function
(){
// no need to update the blocksizes for hidden timeline views
var
id
=
$
(
grid
.
container
).
attr
(
'
id
'
);
if
(
typeof
id
===
'
undefined
'
)
{
updateBlockSizes
();
}
},
300
);
}
function
initJs
()
{
...
...
@@ -70,6 +75,41 @@ function initJs() {
if
(
typeof
viewmenuInit
!==
"
undefined
"
)
{
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
)
{
...
...
@@ -132,25 +172,27 @@ function updateTranslatedGridRows(blocks) {
moveBlocks
(
updatedGrid
);
}
function
updateBlockSizes
()
{
$
.
each
(
$
(
'
.grid-stack
'
).
children
(),
function
(
index
,
element
)
{
function
updateBlockSizes
(
grid
)
{
if
(
typeof
grid
==
'
undefined
'
)
{
grid
=
$
(
'
.grid-stack
'
);
}
$
.
each
(
grid
.
children
(),
function
(
index
,
element
)
{
if
(
!
$
(
element
).
hasClass
(
'
staticblock
'
))
{
var
width
=
$
(
$
(
'
.grid-stack-item
'
)[
index
]
).
attr
(
'
data-gs-width
'
),
prevHeight
=
$
(
$
(
'
.grid-stack-item
'
)[
index
]
).
attr
(
'
data-gs-height
'
),
var
width
=
$
(
element
).
attr
(
'
data-gs-width
'
),
prevHeight
=
$
(
element
).
attr
(
'
data-gs-height
'
),
height
=
Math
.
ceil
(
(
$
(
'
.grid-stack-item-content
'
)[
index
].
scrollHeight
+
$
(
'
.grid-stack
'
)
.
data
(
'
gridstack
'
).
opts
.
verticalMargin
$
(
element
).
find
(
'
.grid-stack-item-content
'
)[
0
].
scrollHeight
+
grid
.
data
(
'
gridstack
'
).
opts
.
verticalMargin
)
/
(
$
(
'
.grid-stack
'
)
.
data
(
'
gridstack
'
).
cellHeight
()
+
$
(
'
.grid-stack
'
)
.
data
(
'
gridstack
'
).
opts
.
verticalMargin
grid
.
data
(
'
gridstack
'
).
cellHeight
()
+
grid
.
data
(
'
gridstack
'
).
opts
.
verticalMargin
)
);
//height = height.toString();
if
(
+
prevHeight
!=
height
)
{
$
(
'
.grid-stack
'
).
data
(
'
gridstack
'
).
resize
(
$
(
'
.grid-stack-item
'
)[
index
],
+
width
,
height
);
if
(
+
prevHeight
<
height
)
{
grid
.
data
(
'
gridstack
'
).
resize
(
element
,
+
width
,
height
);
}
}
});
...
...
@@ -172,7 +214,11 @@ function addNewWidget(blockContent, blockId, dimensions, grid, blocktypeclass, m
// images need time to load before height can be properly calculated
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
();
}
},
300
);
return
el
;
...
...
@@ -245,10 +291,6 @@ function gridInit() {
serializeWidgetMap
(
items
);
});
$
(
window
).
on
(
'
colresize
'
,
function
()
{
updateBlockSizes
();
});
}
function
gridRemoveEvents
()
{
...
...
htdocs/js/jTLine/js/jtline.js
View file @
c5f96d39
...
...
@@ -295,6 +295,7 @@
selectedContent
.
removeClass
(
'
enter-left enter-right
'
);
selectedContent
.
addClass
(
'
selected
'
);
evdone
=
true
;
$
(
window
).
trigger
(
'
timelineviewresizeblocks
'
);
}
});
// height of the version changes after it becomes visible
...
...
@@ -431,6 +432,7 @@
timeline
.
find
(
'
.cd-timeline-navigation
'
).
find
(
'
.next
'
).
addClass
(
'
inactive
'
);
}
});
$
(
window
).
trigger
(
'
timelineviewresizeblocks
'
);
}
else
{
$
(
obj
).
html
(
"
Error fetching data
"
);
...
...
htdocs/theme/raw/templates/view/versioning.tpl
View file @
c5f96d39
...
...
@@ -41,7 +41,7 @@
formatSubTitle
:
function
(
subTitle
,
obj
)
{
return
'
<div class="metadata">
'
+
subTitle
+
'
</div>
'
;
},
formatBodyContent
:
function
(
bodyCnt
,
obj
)
{
if
(
obj
.
gridlayout
)
{
var
grid
=
$
(
'
<div class="grid-stack"></div>
'
);
var
grid
=
$
(
'
<div
id="grid_
'
+
obj
.
assignID
+
'
"
class="grid-stack"></div>
'
);
var
options
=
{
verticalMargin
:
10
,
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