Possibility to go to file manager from sidebard (#5816)

* Possibility to go to file from sidebard

* Refactor to use microtemplating
This commit is contained in:
Charles-Henri Decultot 2018-07-16 14:34:12 +02:00 committed by Rushabh Mehta
parent c9b36c63dd
commit b175ac407f
3 changed files with 18 additions and 13 deletions

View file

@ -265,7 +265,7 @@
"public/js/frappe/form/user_image.js",
"public/js/frappe/form/share.js",
"public/js/frappe/form/form_viewers.js",
"public/js/frappe/form/footer/attachment.html",
"public/js/frappe/form/footer/form_footer.html",
"public/js/frappe/form/footer/timeline.html",
"public/js/frappe/form/footer/timeline_item.html",

View file

@ -0,0 +1,10 @@
<li class="attachment-row">
<a class="close">&times;</a>
<a href="{{ file_path }}">
<i class="{{ icon }} fa-fw text-warning"></i>
</a>
<a href="{{ file_url }}" target="_blank" title="{{ file_name }}" class="ellipsis" style="max-width: calc(100% - 43px);">
<span>{{ file_name }}</span>
</a>
</li>

View file

@ -62,18 +62,13 @@ frappe.ui.form.Attachments = Class.extend({
}
var me = this;
var $attach = $(repl('<li class="attachment-row">\
<a class="close">&times;</a>\
%(lock_icon)s\
<a href="%(file_url)s" target="_blank" title="%(file_name)s" \
class="ellipsis" style="max-width: calc(100% - 43px);">\
<span>%(file_name)s</span></a>\
</li>', {
lock_icon: attachment.is_private ? '<i class="fa fa-lock fa-fw text-warning"></i> ': "",
file_name: file_name,
file_url: frappe.urllib.get_full_url(file_url)
}))
.insertAfter(this.attachments_label.addClass("has-attachments"));
var $attach = $(frappe.render_template("attachment", {
"file_path": "/desk#Form/File/" + fileid,
"icon": attachment.is_private ? "fa fa-lock" : "fa fa-unlock-alt",
"file_name": file_name,
"file_url": frappe.urllib.get_full_url(file_url)
})).insertAfter(this.attachments_label.addClass("has-attachments"));
var $close =
$attach.find(".close")