Commit ce0a52d1 authored by Ryan Herbert's avatar Ryan Herbert

jstree onload

For clarity purposes we don't want the users to have to trigger the
mouseover event in order to display the jstree file selector. So using
the onload event is much better in that respect. Howver given the way
these DOM elements are loaded, that event is not triggered by the
browser. Therefore we need to trigger it ourselves.

For this we need to target the specific DOM node we want the event to be
triggered on since the 'load' event does not bubble, so triggering it on
for instance the div with id "db_content" does not work for us.
parent bfb0c67c
......@@ -1610,10 +1610,12 @@ h3 .uid {
}
.db_footer{
display: inline-block;
display: block;
position: absolute;
bottom: 5px;
left:0px;
width: 100%;
background: white;
}
.db_block_left {
......
......@@ -389,6 +389,9 @@ Database.prototype = {
$("#menu-container").addClass('disabledClass');
// Hax !
$('.jstree').trigger('load');
return 0 ;
}
......
......@@ -329,8 +329,9 @@ FileFormBuilder.prototype.build_jstree = function() {
indicator.id = "file_indicator_" + self.index;
d.appendChild(indicator);
var tree_par = document.createElement('div');
tree_par.id = "jstree_loader_" + self.index;
tree_par.className = "jstree";
tree_par.onmouseover = function() {db.set_jstree($('#jstree_' + self.index), self.index)};
tree_par.onload = function() {db.set_jstree($('#jstree_' + self.index), self.index)};
tree_par.appendChild(document.createTextNode('file'));
d.appendChild(tree_par);
var tree = document.createElement('div');
......
......@@ -33,7 +33,7 @@
{{ pass }}
</div>
<span class="button"
onclick="document.getElementById('fieldset_container').appendChild(new FileFormBuilder({{=group_ids}}, {{=str(source_module_active).lower()}}).build(this.dataset.index++));"
onclick="document.getElementById('fieldset_container').appendChild(new FileFormBuilder({{=group_ids}}, {{=str(source_module_active).lower()}}).build(this.dataset.index)); $('#jstree_loader_'+this.dataset.index++).trigger('load');"
data-index="{{=len(files)}}">add file</span>
<input type="submit" value="Soumettre" class="btn">
</form>
......
......@@ -29,11 +29,11 @@
<div class="jstree_container" {{if not source_module_active:}} hidden {{pass}}>
selected
<div id="file_indicator_{{=i}}"></div>
<div class="jstree"
<div class="jstree" id="jstree_loader_{{=i}}"
{{if not source_module_active:}}
hidden
{{else:}}
onmouseover="db.set_jstree($('#jstree_{{=i}}'), {{=i}})"
onload="db.set_jstree($('#jstree_{{=i}}'), {{=i}})"
{{pass}}>
file
<div id="jstree_{{=i}}" data-index="{{=i}}"></div>
......
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