|
|
|
@ -276,103 +276,6 @@ timelinesApp.factory('UI', [function() { |
|
|
|
|
overrides: ['actualDays', 'weekDays', 'months', 'quarters'] |
|
|
|
|
}}; |
|
|
|
|
}, |
|
|
|
|
getAvailableRows: function() { |
|
|
|
|
function renderHistoricalKind(data, val, diff) { |
|
|
|
|
if (!data.does_historical_differ(val)) { |
|
|
|
|
return ""; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (typeof diff === "function") { |
|
|
|
|
return diff(data[val], data.historical()[val]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return "changed"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function historicalHtml(data, val) { |
|
|
|
|
var kind = renderHistoricalKind(data, val); |
|
|
|
|
|
|
|
|
|
return renderHistoricalHtml(data, val, kind); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function renderHistoricalHtml(data, val, kind) { |
|
|
|
|
var result = "", theVal; |
|
|
|
|
|
|
|
|
|
if (data.does_historical_differ(val)) { |
|
|
|
|
theVal = data.historical().getAttribute(val); |
|
|
|
|
|
|
|
|
|
if (!theVal) { |
|
|
|
|
theVal = timeline.i18n('timelines.empty'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
result += '<span class="tl-historical">'; |
|
|
|
|
result += timeline.escape(theVal); |
|
|
|
|
result += '<a href="javascript://" title="%t" class="%c"/>' |
|
|
|
|
.replace(/%t/, timeline.i18n('timelines.change')) |
|
|
|
|
.replace(/%c/, 'icon tl-icon-' + kind); |
|
|
|
|
result += '</span><br/>'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function historicalKindDate(oldVal, newVal) { |
|
|
|
|
if (oldVal && newVal) { |
|
|
|
|
return (newVal < oldVal ? 'postponed' : 'preponed'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return "changed"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var map = { |
|
|
|
|
"type": "getTypeName", |
|
|
|
|
"status": "getStatusName", |
|
|
|
|
"responsible": "getResponsibleName", |
|
|
|
|
"assigned_to": "getAssignedName", |
|
|
|
|
"project": "getProjectName" |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
var timeline = this; |
|
|
|
|
return { |
|
|
|
|
all: ['due_date', 'type', 'status', 'responsible', 'start_date'], |
|
|
|
|
general: function (data, val) { |
|
|
|
|
if (!map[val]) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
val = map[val]; |
|
|
|
|
|
|
|
|
|
var result = ""; |
|
|
|
|
var theVal = data.getAttribute(val); |
|
|
|
|
|
|
|
|
|
result += historicalHtml(data, val); |
|
|
|
|
return jQuery(result + '<span class="tl-column">' + timeline.escape(theVal) + '</span>'); |
|
|
|
|
}, |
|
|
|
|
start_date: function(data) { |
|
|
|
|
var kind = renderHistoricalKind(data, "start_date", historicalKindDate), |
|
|
|
|
result = ''; |
|
|
|
|
|
|
|
|
|
result += renderHistoricalHtml(data, "start_date", kind); |
|
|
|
|
|
|
|
|
|
if (data.start_date !== undefined) { |
|
|
|
|
result += '<span class="tl-column tl-current tl-' + kind + '">' + timeline.escape(data.start_date) + '</span>'; |
|
|
|
|
} |
|
|
|
|
return jQuery(result); |
|
|
|
|
}, |
|
|
|
|
due_date: function(data) { |
|
|
|
|
var kind = renderHistoricalKind(data, "due_date", historicalKindDate), |
|
|
|
|
result = ''; |
|
|
|
|
|
|
|
|
|
result += renderHistoricalHtml(data, "due_date", kind); |
|
|
|
|
|
|
|
|
|
if (data.due_date !== undefined) { |
|
|
|
|
result += '<span class="tl-column tl-current tl-' + kind + '">' + |
|
|
|
|
timeline.escape(data.due_date) + '</span>'; |
|
|
|
|
} |
|
|
|
|
return jQuery(result); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
getUiRoot: function() { |
|
|
|
|
return this.uiRoot; |
|
|
|
|
}, |
|
|
|
|