aboutsummaryrefslogtreecommitdiffstats
path: root/view/js/acl.js
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2016-08-03 22:50:37 +0200
committerMario Vavti <mario@mariovavti.com>2016-08-03 22:50:37 +0200
commitdf27a48e727ee319e3b9ff1f94024d1cf100f350 (patch)
treedac56214d3eafd13b291d8dcee9e1022b40e939b /view/js/acl.js
parentb959641ca82d45f641a803b58dcfb91a90274956 (diff)
downloadvolse-hubzilla-df27a48e727ee319e3b9ff1f94024d1cf100f350.tar.gz
volse-hubzilla-df27a48e727ee319e3b9ff1f94024d1cf100f350.tar.bz2
volse-hubzilla-df27a48e727ee319e3b9ff1f94024d1cf100f350.zip
multiple acl: store new data in update_view()
Diffstat (limited to 'view/js/acl.js')
-rw-r--r--view/js/acl.js42
1 files changed, 23 insertions, 19 deletions
diff --git a/view/js/acl.js b/view/js/acl.js
index 33895d260..0006bcfca 100644
--- a/view/js/acl.js
+++ b/view/js/acl.js
@@ -46,10 +46,6 @@ function ACL(backend_url) {
}
});
-
- //$(document).on('click', '.acl-submit', that.get_form_id_and_submit);
- //$(document).on('click', '.acl-select', that.get_form_id_and_submit);
-
$(document).on('focus', '.acl-form', that.get_form_data);
$(document).on('click', '.acl-form', that.get_form_data);
@@ -66,11 +62,13 @@ function ACL(backend_url) {
});
}
-// no longer called only on submit - call to update whenever a change occurs to the acl list.
+
ACL.prototype.get_form_data = function(event) {
//event.preventDefault()
- that.form_id = $(this).data('formid');
+ form_id = $(this).data('formid');
+
+ that.form_id = $('#' + form_id);
console.log(event);
@@ -83,22 +81,22 @@ ACL.prototype.get_form_data = function(event) {
that.on_submit();
}
+// no longer called only on submit - call to update whenever a change occurs to the acl list.
ACL.prototype.on_submit = function() {
-
- //console.log(that.form_id);
$('.acl-field').remove();
+
$(that.allow_gid).each(function(i,v) {
- $('#' + that.form_id).append("<input class='acl-field' type='hidden' name='group_allow[]' value='"+v+"'>");
+ that.form_id.append("<input class='acl-field' type='hidden' name='group_allow[]' value='"+v+"'>");
});
$(that.allow_cid).each(function(i,v) {
- $('#' + that.form_id).append("<input class='acl-field' type='hidden' name='contact_allow[]' value='"+v+"'>");
+ that.form_id.append("<input class='acl-field' type='hidden' name='contact_allow[]' value='"+v+"'>");
});
$(that.deny_gid).each(function(i,v) {
- $('#' + that.form_id).append("<input class='acl-field' type='hidden' name='group_deny[]' value='"+v+"'>");
+ that.form_id.append("<input class='acl-field' type='hidden' name='group_deny[]' value='"+v+"'>");
});
$(that.deny_cid).each(function(i,v) {
- $('#' + that.form_id).append("<input class='acl-field' type='hidden' name='contact_deny[]' value='"+v+"'>");
+ that.form_id.append("<input class='acl-field' type='hidden' name='contact_deny[]' value='"+v+"'>");
});
//areYouSure jquery plugin: recheck the form here
@@ -273,13 +271,19 @@ ACL.prototype.update_select = function(set) {
};
ACL.prototype.update_view = function(value) {
-
+ if(that.form_id) {
console.log(that.form_id);
- console.log(that.allow_cid);
- console.log(that.allow_gid);
- console.log(that.deny_cid);
- console.log(that.deny_gid);
+ that.form_id.data('allow_cid', that.allow_cid);
+ that.form_id.data('allow_gid', that.allow_gid);
+ that.form_id.data('deny_cid', that.deny_cid);
+ that.form_id.data('deny_gid', that.deny_gid);
+
+ console.log(that.form_id.data('allow_cid'));
+ console.log(that.form_id.data('allow_gid'));
+ console.log(that.form_id.data('deny_cid'));
+ console.log(that.form_id.data('deny_gid'));
+ }
if (that.allow_gid.length === 0 && that.allow_cid.length === 0 && that.deny_gid.length === 0 && that.deny_cid.length === 0) {
that.list.hide(); //hide acl-list
@@ -293,8 +297,8 @@ ACL.prototype.update_view = function(value) {
}
// if value != 'onlyme' we should fall through this one
- else if (that.allow_gid.length === 0 && that.allow_cid.length === 1 && that.allow_cid[0] === that.self[0] && that.deny_gid.length === 0 && that.deny_cid.length === 0 && value === 'onlyme') {
- that.list.hide(); //hide acl-list if
+ else if (that.allow_gid.length === 0 && that.allow_cid.length === 1 && that.allow_cid[0] === that.self[0] && that.deny_gid.length === 0 && that.deny_cid.length === 0 && value !== 'limited') {
+ that.list.hide(); //hide acl-list
that.info.hide(); //show acl-info
that.update_select('onlyme');