mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	This changes the time render to be done on the client-side and therefore take advantage of knowing the client’s timezone, along with being formatted in a more human-parseable way.
		
			
				
	
	
		
			35 lines
		
	
	
		
			975 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			975 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
var attachments_ui = (function () {
 | 
						|
 | 
						|
var exports = {};
 | 
						|
 | 
						|
function delete_attachments(attachment) {
 | 
						|
    channel.del({url: '/json/attachments/' + attachment, idempotent: true});
 | 
						|
}
 | 
						|
 | 
						|
exports.set_up_attachments = function () {
 | 
						|
    // The settings page must be rendered before this function gets called.
 | 
						|
 | 
						|
    var attachment_list = $('#attachments_list');
 | 
						|
    _.each(page_params.attachments, function (attachment) {
 | 
						|
        _.each(attachment.messages, function (o) {
 | 
						|
            o.name = timerender.absolute_time(o.name);
 | 
						|
        });
 | 
						|
 | 
						|
        var li = templates.render('attachment-item', {attachment: attachment});
 | 
						|
        attachment_list.append(li);
 | 
						|
    });
 | 
						|
 | 
						|
    $('#attachments_list').on('click', '.remove-attachment', function (event) {
 | 
						|
        var li = $(event.currentTarget).parents('li');
 | 
						|
        li.remove();
 | 
						|
        delete_attachments($(this).data('attachment'));
 | 
						|
    });
 | 
						|
};
 | 
						|
 | 
						|
return exports;
 | 
						|
}());
 | 
						|
 | 
						|
if (typeof module !== 'undefined') {
 | 
						|
    module.exports = attachments_ui;
 | 
						|
}
 |