Merge branch 'responsive' of github.com:webnotes/wnframework into responsive

This commit is contained in:
Rushabh Mehta 2013-06-03 17:40:21 +05:30
commit ebf1130003
2 changed files with 14 additions and 10 deletions

View file

@ -105,14 +105,15 @@ wn.RoleEditor = Class.extend({
var me = this;
// uncheck all roles
$(this.wrapper).find('input[type="checkbox"]').removeAttr("checked");
$(this.wrapper).find('input[type="checkbox"]')
.each(function(i, checkbox) { checkbox.checked = false; });
// set user roles as checked
$.each(wn.model.get("UserRole", {parent: cur_frm.doc.name,
parentfield: "user_roles"}), function(i, user_role) {
$(me.wrapper)
.find('[data-user-role="'+user_role.role
+'"] input[type="checkbox"]').attr('checked', 'checked');
var checkbox = $(me.wrapper)
.find('[data-user-role="'+user_role.role+'"] input[type="checkbox"]').get(0);
if(checkbox) checkbox.checked = true;
});
},
set_roles_in_table: function() {
@ -147,8 +148,7 @@ wn.RoleEditor = Class.extend({
var checked_roles = [];
var unchecked_roles = [];
$(this.wrapper).find('[data-user-role]').each(function() {
var $check = $(this).find('input[type="checkbox"]');
if($check.attr('checked')) {
if($(this).find('input[type="checkbox"]:checked').length) {
checked_roles.push($(this).attr('data-user-role'));
} else {
unchecked_roles.push($(this).attr('data-user-role'));

View file

@ -491,14 +491,13 @@ wn.ui.form.ControlSelect = wn.ui.form.ControlData.extend({
padding-left: 6px; padding-right: 6px; margin-left: 6px;'>\
<i class='icon-plus'></i></button>")
.click(function() {
me.frm.attachments.new_attachment();
me.frm.attachments.new_attachment(me.df.fieldname);
})
.appendTo(this.input_area);
$(document).on("upload_complete", function(event, filename, file_url) {
if(cur_frm === me.frm) {
me.set_options();
me.set_input(filename ? ("files/" + filename) : file_url);
}
})
},
@ -513,13 +512,18 @@ wn.ui.form.ControlSelect = wn.ui.form.ControlData.extend({
if(this.in_filter && options[0] != "") {
options = add_lists([''], options);
}
var selected = this.$input.find(":selected").val();
this.$input.empty().add_options(options || []);
if(selected) this.$input.val(selected);
},
get_file_attachment_list: function() {
if(!this.frm) return;
var fl = wn.model.docinfo[this.frm.doctype][this.frm.docname];
if(fl) {
if(fl && fl.attachments) {
fl = fl.attachments;
this.set_description("");
var options = [""];
for(var fname in fl) {