Sophivorus has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/348836 )
Change subject: Fix bug when adding citations to references without name ...................................................................... Fix bug when adding citations to references without name Bug: T150101 Change-Id: I3acc28f611c409d34b06b830bba83fab98d00ab6 --- M proveit.js 1 file changed, 11 insertions(+), 6 deletions(-) Approvals: Sophivorus: Verified; Looks good to me, approved diff --git a/proveit.js b/proveit.js index 875e68f..ac2c768 100755 --- a/proveit.js +++ b/proveit.js @@ -537,9 +537,14 @@ this.cite = function ( event ) { var reference = event.data; - // If the reference has no name, ask the user for one + if ( reference.name ) { + // Add the citation + var citation = new proveit.Citation({ 'name': reference.name }); + citation.insert(); + + // If there's no reference name, ask the user for one // @todo check if the name is unique - if ( !reference.name ) { + } else { reference.name = prompt( proveit.getMessage( 'prompt-name' ) ); if ( !reference.name ) { return; @@ -551,15 +556,15 @@ reference.loadFromForm(); var newString = reference.string; + // Add the citation + var citation = new proveit.Citation({ 'name': reference.name }); + citation.insert(); + // Replace the old reference var textbox = proveit.getTextbox(), text = textbox.val().replace( oldString, newString ); textbox.val( text ); } - - // Add the citation - var citation = new proveit.Citation({ 'name': reference.name }); - citation.insert(); }; /** -- To view, visit https://gerrit.wikimedia.org/r/348836 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I3acc28f611c409d34b06b830bba83fab98d00ab6 Gerrit-PatchSet: 1 Gerrit-Project: wikipedia/gadgets/ProveIt Gerrit-Branch: master Gerrit-Owner: Sophivorus <scheno...@gmail.com> Gerrit-Reviewer: Sophivorus <scheno...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits