[minor] duration bar

This commit is contained in:
pratu16x7 2017-02-16 09:27:53 +05:30
parent ca56ad0bfc
commit 86415f394d

View File

@ -90,7 +90,7 @@
</div>
</div>
<script>
frappe.ready(function(){
frappe.ready(function() {
var max_width = $(".duration").width() * 0.8;
var durations = [];
$(".duration .duration-bar").each(function() {
@ -100,15 +100,15 @@
var width_factor = max_width/max_duration;
$(".duration .duration-bar").each(function() {
var duration = $(this).find(".duration-value").html();
$(this).width(duration * width_factor);
if($(this).width() < $(this).find(".duration-value").width()) {
var html = $($(this).html());
html.addClass("duration-bar");
html.addClass("bar-outer-text");
$(this).find(".duration-value").removeClass("duration-value").addClass("duration-invisible");
$(this).closest("td").append(html);
}
var duration = $(this).find(".duration-value").html();
$(this).width(duration * width_factor);
if($(this).width() < $(this).find(".duration-value").width()) {
var html = $($(this).html());
html.addClass("duration-bar");
html.addClass("bar-outer-text");
$(this).find(".duration-value").removeClass("duration-value").addClass("duration-invisible");
$(this).closest(".duration").append(html);
}
});
})
</script>