Merge branch 'ent-2215-cut-node-names-networkmap' into 'develop'
The node names of the networkmap are reduced if they are too long See merge request artica/pandorafms!1477
This commit is contained in:
commit
f341844368
|
@ -213,7 +213,7 @@ function update_fictional_node(id_db_node) {
|
||||||
graph.nodes[i].networkmap_id = networkmap_to_link;
|
graph.nodes[i].networkmap_id = networkmap_to_link;
|
||||||
|
|
||||||
$("#id_node_" + i + networkmap_id + " title").html(name);
|
$("#id_node_" + i + networkmap_id + " title").html(name);
|
||||||
$("#id_node_" + i + networkmap_id + " tspan").html(name);
|
$("#id_node_" + i + networkmap_id + " tspan").html(ellipsize(name, 30));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -251,7 +251,7 @@ function update_node_name(id_db_node) {
|
||||||
graph.nodes[i]['raw_text'] = data['raw_text'];
|
graph.nodes[i]['raw_text'] = data['raw_text'];
|
||||||
|
|
||||||
$("#id_node_" + i + networkmap_id + " title").html(data['raw_text']);
|
$("#id_node_" + i + networkmap_id + " title").html(data['raw_text']);
|
||||||
$("#id_node_" + i + networkmap_id + " tspan").html(data['raw_text']);
|
$("#id_node_" + i + networkmap_id + " tspan").html(ellipsize(data['raw_text'], 30));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -773,7 +773,7 @@ function edit_node(data_node, dblClick) {
|
||||||
|
|
||||||
$("#dialog_node_edit")
|
$("#dialog_node_edit")
|
||||||
.dialog("option", "title",
|
.dialog("option", "title",
|
||||||
dialog_node_edit_title.replace("%s", node_selected['text'])); // It doesn't eval the possible XSS so it's ok
|
dialog_node_edit_title.replace("%s", ellipsize(node_selected['text'], 40))); // It doesn't eval the possible XSS so it's ok
|
||||||
$("#dialog_node_edit").dialog("open");
|
$("#dialog_node_edit").dialog("open");
|
||||||
|
|
||||||
if (node_selected.id_agent == undefined || node_selected.id_agent == -2) {
|
if (node_selected.id_agent == undefined || node_selected.id_agent == -2) {
|
||||||
|
@ -3658,7 +3658,7 @@ function draw_elements_graph() {
|
||||||
.append("tspan")
|
.append("tspan")
|
||||||
.attr("style", "font-size: " + font_size + "px !important; font-family:Verdana; text-align:center; text-anchor:middle; fill:#000000")
|
.attr("style", "font-size: " + font_size + "px !important; font-family:Verdana; text-align:center; text-anchor:middle; fill:#000000")
|
||||||
.text(function (d) {
|
.text(function (d) {
|
||||||
return d.text;
|
return ellipsize(d.text, 30);
|
||||||
})
|
})
|
||||||
.classed('dragable_node', true) //own dragable
|
.classed('dragable_node', true) //own dragable
|
||||||
.on("click", selected_node)
|
.on("click", selected_node)
|
||||||
|
|
|
@ -1626,4 +1626,11 @@ function display_confirm_dialog (
|
||||||
"Confirm": ok_function_clean
|
"Confirm": ok_function_clean
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ellipsize (str, max, ellipse) {
|
||||||
|
if (max == null) max = 140;
|
||||||
|
if (ellipse == null) ellipse = "…";
|
||||||
|
|
||||||
|
return str.trim().length > max ? str.substr(0, max).trim() + ellipse : str;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue