diff --git a/package.json b/package.json index 7e03c304f3..b4901f90e3 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "nodebb-plugin-soundpack-default": "~0.1.1", "nodebb-plugin-spam-be-gone": "^0.4.0", "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-rewards-essentials": "^0.0.1", "npm": "^2.1.4", diff --git a/public/src/modules/composer.js b/public/src/modules/composer.js index 33fa2ac208..fa76d6b517 100644 --- a/public/src/modules/composer.js +++ b/public/src/modules/composer.js @@ -301,7 +301,8 @@ define('composer', [ var postContainer = $(composerTemplate[0]), 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]); categoryList.init(postContainer, composer.posts[post_uuid]); @@ -325,17 +326,31 @@ define('composer', [ composer.posts[post_uuid].modified = true; }); - postContainer.on('click', '[data-action="post"]', function() { - $(this).attr('disabled', true); - post(post_uuid); + submitBtn.on('click', function() { + var action = $(this).attr('data-action'); + + 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() { - $(this).attr('disabled', true); - post(post_uuid, {lock: true}); + postContainer.on('click', 'a[data-switch-action]', function() { + var action = $(this).attr('data-switch-action'), + 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) { discard(post_uuid); return;