-
Notifications
You must be signed in to change notification settings - Fork 27
/
common.min.js
1 lines (1 loc) · 6.63 KB
/
common.min.js
1
function switchToProject(e){document.getElementById("menu_project_id").value=e;document.forms["choseProjectForm"].submit();return false}function destroySortable(){$("#bug-list div.items").sortable("destroy")}function expandFilterItems(){$("ul.simpleTreeMenu").each(function(){$(this).find("li.Node").each(function(){var e=$(this);if(e.hasClass("expanded"))e.data("collapseOnStop",false);else{e.addClass("expanded").find("ul").show();e.data("collapseOnStop",true)}})})}function restoreExpandedFilterItems(){$("ul.simpleTreeMenu").each(function(){$(this).find("li.Node.expanded").each(function(){var e=$(this);if(e.data("collapseOnStop"))e.removeClass("expanded").find("ul").hide()})})}function collapseFilterItems(){$("ul.simpleTreeMenu").each(function(){$(this).find("li.Node").each(function(){var e=$(this);if(e.hasClass("expanded")){e.removeClass("expanded").find("ul").hide();e.data("expandOnStop",true)}else{e.data("expandOnStop",false)}})})}function restoreCollapsedFilterItems(){$("ul.simpleTreeMenu").each(function(){$(this).find("li.Node").each(function(){var e=$(this);if(e.data("expandOnStop")){e.addClass("expanded").find("ul").show()}})})}function setupSortable(){$("#bug-list div.items").sortable({change:function(e,t){flag=true;var n=0;var r=0;$(".items div").each(function(e){if($(this).hasClass("separator")){n=e}if($(this).hasClass("ui-sortable-placeholder")){r=e}});if(n==r-4||n==r+1){$(".separator").css("display","none");$(".separator").css("visibility","hidden")}else{$(".separator").css("display","block");$(".separator").css("visibility","visible")}},start:function(){window.FilterEventHandlers.onDragStart;$(".ui-sortable-placeholder").after($(".ui-sortable-placeholder").clone());$(".ui-sortable-placeholder").each(function(e){if(e==0){$(this).removeClass("ticket-item moreTwoDays unchecked ui-sortable-placeholder");$(this).attr("class","separator");$(this).css("height","1px");$(this).css("display","none");$(this).css("margin-bottom","10px");$(this).css("width","98%");$(this).css("background-color","#2A70BF");$(this).css("visibility","visible");$(this).css("z-index","12")}if(e==1){$(this).css("visibility","visible");$(this).css("border-style","dashed");$(this).css("border-width","2px");$(this).css("border-color","#F1F1F1");$(this).css("z-index","999")}})},stop:function(){window.FilterEventHandlers.onDragStop;$(".ui-sortable-placeholder").remove()},opacity:.618,refreshPositions:true,cursor:"pointer",forcePlaceholderSize:true,forceHelperSize:true,items:"div.ticket-item",update:function(e,t){$("#bug-list div.items").sortable({disabled:true});var n=$(this).sortable("toArray"),r;$.each(n,function(e,n){if(n==t.item.attr("id")){r=e}});var i=JSON.parse($("#user_data").text()).project_id;$.getJSON("/bug/GetTicketOrder/"+i,function(e){var n=[],i=[];$.each(e,function(e,t){var r=$("#bug-list").find("div[ticketid="+t.id+"]");if(r.length){n.push(t.id);i.push(t.priority_order)}});var s=$.inArray(t.item.attr("ticketid"),n);n.splice(s,1);n.splice(r,0,t.item.attr("ticketid"));var o=[],u={};$.each(n,function(e,t){if(r==e){u={id:t,position:i[e]}}o.push({id:t,position:i[e]})});changeTicketList=[];if(s<r){$.each(o,function(e,t){if(e>=s&&e<=r){changeTicketList.push(t)}})}else{$.each(o,function(e,t){if(e<=s&&e>=r){changeTicketList.push(t)}})}dndUrl="/bug/UpdateTicketOrder";$.ajax({url:dndUrl,type:"post",data:{newpositions:JSON.stringify(changeTicketList),YII_CSRF_TOKEN:YII_CSRF_TOKEN},success:function(e,t,n){$.each(o,function(e,t){$("#"+t.id+"").attr("position",t.position)});var r=$("#bug-list div.items").children();r.sort(function(e,t){var n=parseInt($(e).attr("position"));var r=parseInt($(t).attr("position"));return n<r?-1:n>r?1:0});$("#bug-list div.items").empty().html(r);$("#bug-list div.items").sortable("refresh");$("#bug-list div.items").sortable({disabled:false})},error:function(e,t,n){alert("We are unable to set the priority order at this time. Please try again in a few minutes.")}})});if(typeof mixpanel!="undefined"){mixpanel.track(TICKETS_ORDER_CHANGED_BY_DRAG_N_DROP)}}});$("#bug-list div.items").disableSelection()}function addTooltip(){$("#bug-list span.clock[title]").colorTip({color:"yellow",timeout:100});$("#bug-list a[title]").colorTip({color:"yellow",timeout:100,delay:750});$("#bug-list div.imageset").imageSet()}function renderUser(e,t){return'<a href="user/'+t+'" title="'+e.name+'"><img src="'+e.profile_img+'" class="bug-profile-pic"></a>'}function renderTicketUsersAndLabels(){var e=JSON.parse($("#ticketMetaData").html());$("div.items div.ticket-item").each(function(){var t=$(this);if(t.attr("label_set").length>0){var n=t.attr("label_set").split(",")}if(t.attr("user_set").length>0){var r=t.attr("user_set").split(",")}if(n!=null){o=0;jQuery.each(n,function(){if(typeof e.labels[this]!="undefined"&&o<maxLabels){var n=e.labels[this];var r='<span class="bubble" style="background-color:'+n.label_color+'">'+n.name.trunc(12)+"</span>";t.find("span.title").append(r);o++}})}if(r!=null){var i='<span class="photo thumb">';var s=r.length;if(s<3){jQuery.each(r,function(){if(typeof e.users[this]!="undefined"){var t=e.users[this];i+=renderUser(t,this)}})}else{var o=0;jQuery.each(r,function(){if(typeof e.users[this]!="undefined"){$user=e.users[this];if(o==0){i+=renderUser($user,this);i+='<div class="imageset round5">'}else{i+=renderUser($user,this)}o++}});i+="</div>"}i+="</span>";if(t.find("span.clock").length>0){t.find("span.clock").after(i)}else{t.append(i)}}})}if(/#?_=_/.test(window.location.hash))window.location.hash="";var bkScreen=null;(function(e){e.fn.serializeObject=function(){var t={};var n=this.serializeArray();e.each(n,function(){if(t[this.name]!==undefined){if(!t[this.name].push){t[this.name]=[t[this.name]]}t[this.name].push(this.value||"")}else{t[this.name]=this.value||""}});return t}})(jQuery);$(function(){$("body").append(bugkick.string.buildString('<input type="text" ','id="focusme" ','style="position: absolute; left: -1000px; top: -1000px; width: 10px;" ',"/>"));var e=$("#focusme");$(document).on("dialogclose",function(){e.focus().blur()});$(".chzn-select").chosen();$(".iPhone-checkbox").iphoneStyle()});window.FilterEventHandlers={onDragStart:collapseFilterItems,onDragStop:restoreCollapsedFilterItems};$(function(){setupSortable();$("#showCalendar").click(function(){$.ajax({url:"/site/calendar",type:"post",data:{YII_CSRF_TOKEN:YII_CSRF_TOKEN},success:function(e){$(".main_middle").html(e)},error:function(e){alert("We are unable to load calendar. Please try again later.")},dataType:"html"});return false})});String.prototype.trunc=function(e){return this.substr(0,e-1)+(this.length>e?"…":"")};$(document).ready(function(){$(".ui-widget-overlay").live("click",function(){$(".ui-dialog-content").dialog("close")});bugkick.time.toLocal(".utc-timestamp-date","Do MMMM YYYY - h:mm a")})