From 65396000d210d1afd41391c7d5035f44e600721d Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Fri, 13 Nov 2015 16:22:27 -0500 Subject: [PATCH] Updated modal to not be .confirm() but .dialog() Also updated composer code to actually send a link back to the other topic... Closes #3693 --- public/language/en_GB/topic.json | 6 +++- public/src/client/topic/postTools.js | 46 ++++++++++++++++++++++------ 2 files changed, 41 insertions(+), 11 deletions(-) diff --git a/public/language/en_GB/topic.json b/public/language/en_GB/topic.json index c26d0c05f8..dcc651fc24 100644 --- a/public/language/en_GB/topic.json +++ b/public/language/en_GB/topic.json @@ -116,7 +116,11 @@ "most_votes": "Most votes", "most_posts": "Most posts", - "stale_topic_warning": "The topic you are replying to is quite old. Would you like to create a new topic instead, and reference this one in your reply?", + "stale.title": "Create new topic instead?", + "stale.warning": "The topic you are replying to is quite old. Would you like to create a new topic instead, and reference this one in your reply?", + "stale.create": "Create a new topic", + "stale.reply_anyway": "Reply to this topic anyway", + "stale.link_back": "Re: [%1](%2)\n\n", "spam": "Spam", "offensive": "Offensive", diff --git a/public/src/client/topic/postTools.js b/public/src/client/topic/postTools.js index 0232932d6e..c07cb2417c 100644 --- a/public/src/client/topic/postTools.js +++ b/public/src/client/topic/postTools.js @@ -408,18 +408,44 @@ define('forum/topic/postTools', ['share', 'navigator', 'components', 'translator function showStaleWarning(callback) { if (ajaxify.data.lastposttime < (Date.now() - (1000*60*60*24*config.topicStaleDays))) { - translator.translate('[[topic:stale_topic_warning]]', function(translated) { - bootbox.confirm(translated, function(create) { - if (create) { - $(window).trigger('action:composer.topic.new', { - cid: ajaxify.data.cid - }); - - } + translator.translate('[[topic:stale.warning]]', function(translated) { + var warning = bootbox.dialog({ + title: '[[topic:stale.title]]', + message: translated, + buttons: { + reply: { + label: '[[topic:stale.reply_anyway]]', + className: 'btn-link', + callback: function() { + callback(false); + } + }, + create: { + label: '[[topic:stale.create]]', + className: 'btn-primary', + callback: function() { + translator.translate('[[topic:stale.link_back, ' + ajaxify.data.title + ', ' + config.relative_path + '/topic/' + ajaxify.data.slug + ']]', function(body) { + $(window).trigger('action:composer.topic.new', { + cid: ajaxify.data.cid, + body: body + }); + }); + } + } + } + }); - callback(create); - }); + warning.modal(); }); + // bootbox.confirm(translated, function(create) { + // if (create) { + + + // } + + // callback(create); + // }); + // }); } else { callback(false); }