Skip to content

Instantly share code, notes, and snippets.

@EGreg
Created June 18, 2014 18:05
Show Gist options
  • Save EGreg/f8801bb9e28f8aeba64e to your computer and use it in GitHub Desktop.
Save EGreg/f8801bb9e28f8aeba64e to your computer and use it in GitHub Desktop.
Streams/access diff to fix some things for now
diff -r c3f7255b9205 platform/plugins/Streams/web/js/tools/access.js
--- a/platform/plugins/Streams/web/js/tools/access.js Wed Jun 18 12:38:37 2014 -0400
+++ b/platform/plugins/Streams/web/js/tools/access.js Wed Jun 18 14:05:18 2014 -0400
@@ -81,7 +81,7 @@
}
$this.closest('tr').remove();
if (criteria.ofUserId) {
- delete me.child('Streams_userChooser_').exclude[criteria.ofUserId];
+ delete me.child('Streams_userChooser').exclude[criteria.ofUserId];
} else if (criteria.ofContactLabel) {
$('option', temp_select).each(function () {
if ($(this).val() === criteria.ofContactLabel) {
@@ -114,7 +114,7 @@
avatar = options.avatar_array[userId];
}
criteria = {ofUserId: userId};
- me.child('Streams_userChooser_').exclude[userId] = true;
+ me.child('Streams_userChooser').exclude[userId] = true;
} else if (contact_label) {
criteria = {ofContactLabel: contact_label};
$('.Streams_access_level_add_label option', tool).each(function () {
@@ -157,7 +157,7 @@
}
}
- this.Q.onInit.set(function () {
+ setTimeout(function () {
var i, userId, access;
prepareSelect(level_for_everyone, '', options.stream.fields[field_name], 'stream');
@@ -167,7 +167,7 @@
addAccessRow(access);
}
- me.child('Streams_userChooser_').onChoose = function (userId, avatar) {
+ me.child('Streams_userChooser').onChoose = function (userId, avatar) {
var url = Q.action(
'Streams/access'
+ '?publisherId='+options.stream.fields.publisherId
@@ -207,7 +207,7 @@
}
);
});
- }, 'Streams/access');
+ }, 1000);
});
diff -r c3f7255b9205 platform/plugins/Streams/web/js/tools/userChooser.js
--- a/platform/plugins/Streams/web/js/tools/userChooser.js Wed Jun 18 12:38:37 2014 -0400
+++ b/platform/plugins/Streams/web/js/tools/userChooser.js Wed Jun 18 14:05:18 2014 -0400
@@ -12,6 +12,7 @@
*/
Q.Tool.define("Streams/userChooser", function(o) {
+ Q.plugins.Streams.cache = Q.plugins.Streams.cache || {};
Q.plugins.Streams.cache.userChooser = Q.plugins.Streams.cache.userChooser || {};
var me = this;
@@ -20,8 +21,8 @@
me.delay = o.delay;
me.exclude = o.exclude;
- var tool = this.element;
- var input = $('input', tool);
+ var element = $(this.element);
+ var input = $('input', element);
var cached = {};
var focusedResults = false;
var results = $('<div style="text-align: left;" />')
@@ -35,16 +36,16 @@
background: 'white',
border: 'solid 1px #99a',
'tab-index': 9000
- }).bind('mousedown focusin', function () {
+ }).on('mousedown focusin', function () {
focusedResults = true;
}).appendTo('body');
var t = null;
- tool.bind('Q-closingOverlay', function() {
+ element.on('Q-closingOverlay', function() {
input.blur();
results.remove();
});
- input.bind('blur', function (event) {
+ input.on('blur', function (event) {
setTimeout(function () {
if (!focusedResults) {
results.remove();
@@ -55,8 +56,8 @@
}
focusedResults = false;
}, 10);
- }).bind('focus change', doQuery);
- tool.bind('keyup keydown', doQuery);
+ }).on('focus change', doQuery);
+ element.on('keyup keydown', doQuery);
function doQuery(event) {
@@ -160,7 +161,7 @@
onChoose($(this));
}).data('userId', k)
.data('avatar', data.avatars[k])
- .bind('mousedown focusin', function () {
+ .on('mousedown focusin', function () {
focusedResults = true;
}).appendTo(results);
if (!show) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment