fixed around event handling for composer submit button, and upped vanilla minver

v1.18.x
Julian Lam 10 years ago
parent 8e17f34de4
commit d249a46fae

@ -46,7 +46,7 @@
"nodebb-plugin-soundpack-default": "~0.1.1", "nodebb-plugin-soundpack-default": "~0.1.1",
"nodebb-plugin-spam-be-gone": "^0.4.0", "nodebb-plugin-spam-be-gone": "^0.4.0",
"nodebb-theme-lavender": "^1.0.22", "nodebb-theme-lavender": "^1.0.22",
"nodebb-theme-vanilla": "^1.0.65", "nodebb-theme-vanilla": "^1.0.80",
"nodebb-widget-essentials": "~0.2.12", "nodebb-widget-essentials": "~0.2.12",
"nodebb-rewards-essentials": "^0.0.1", "nodebb-rewards-essentials": "^0.0.1",
"npm": "^2.1.4", "npm": "^2.1.4",

@ -301,7 +301,8 @@ define('composer', [
var postContainer = $(composerTemplate[0]), var postContainer = $(composerTemplate[0]),
bodyEl = postContainer.find('textarea'), bodyEl = postContainer.find('textarea'),
draft = drafts.getDraft(postData.save_id); draft = drafts.getDraft(postData.save_id),
submitBtn = postContainer.find('.composer-submit');
tags.init(postContainer, composer.posts[post_uuid]); tags.init(postContainer, composer.posts[post_uuid]);
categoryList.init(postContainer, composer.posts[post_uuid]); categoryList.init(postContainer, composer.posts[post_uuid]);
@ -325,17 +326,31 @@ define('composer', [
composer.posts[post_uuid].modified = true; composer.posts[post_uuid].modified = true;
}); });
postContainer.on('click', '[data-action="post"]', function() { submitBtn.on('click', function() {
$(this).attr('disabled', true); var action = $(this).attr('data-action');
post(post_uuid);
switch(action) {
case 'post-lock':
$(this).attr('disabled', true);
post(post_uuid, {lock: true});
break;
case 'post': // intentional fall-through
default:
$(this).attr('disabled', true);
post(post_uuid);
break;
}
}); });
postContainer.on('click', '[data-action="post-lock"]', function() { postContainer.on('click', 'a[data-switch-action]', function() {
$(this).attr('disabled', true); var action = $(this).attr('data-switch-action'),
post(post_uuid, {lock: true}); label = $(this).html();
submitBtn.attr('data-action', action).html(label);
}); });
postContainer.on('click', '[data-action="discard"]', function() { postContainer.find('.composer-discard').on('click', function() {
if (!composer.posts[post_uuid].modified) { if (!composer.posts[post_uuid].modified) {
discard(post_uuid); discard(post_uuid);
return; return;

Loading…
Cancel
Save