[minor] check permission for editable web page

This commit is contained in:
Anand Doshi 2013-11-13 15:03:32 +05:30
parent 4a67d36735
commit 89844f803d
2 changed files with 11 additions and 8 deletions

View File

@ -41,10 +41,12 @@
<script>
$(function() {
if(window.logged_in && getCookie("system_user")==="yes") {
wn.require("lib/js/wn/website/editable.js");
wn.make_editable($('[itemprop="description"]'), "Item Group", "{{ name }}", "description");
wn.has_permission("Item Group", "{{ name }}", "write", function(r) {
wn.require("lib/js/wn/website/editable.js");
wn.make_editable($('[itemprop="description"]'), "Item Group", "{{ name }}", "description");
});
}
})
});
</script>
{% endblock %}

View File

@ -3,14 +3,15 @@
{% block javascript %}
<script>
{% include "app/stock/doctype/item/templates/includes/product_page.js" %}
$(function() {
if(window.logged_in && getCookie("system_user")==="yes") {
wn.require("lib/js/wn/website/editable.js");
wn.make_editable($('[itemprop="description"]'), "Item", "{{ name }}", "web_long_description");
wn.has_permission("Item", "{{ name }}", "write", function(r) {
wn.require("lib/js/wn/website/editable.js");
wn.make_editable($('[itemprop="description"]'), "Item", "{{ name }}", "web_long_description");
});
}
})
});
</script>
{% endblock %}