Skip to content

Commit

Permalink
FIX: use the application's showLogin function to show login modal
Browse files Browse the repository at this point in the history
  • Loading branch information
featheredtoast committed Jul 25, 2018
1 parent b52597b commit 1aeac94
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
{{#if model.postStream.loaded}}
{{#if model.postStream.firstPostPresent}}
<div class="voting title-voting">
{{mount-widget widget="vote-box" args=model}}
{{mount-widget widget="vote-box" args=model
showLogin=(route-action "showLogin")
}}
</div>
{{/if}}
{{/if}}
Expand Down
5 changes: 3 additions & 2 deletions assets/javascripts/discourse/widgets/vote-button.js.es6
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { createWidget } from 'discourse/widgets/widget';
import showModal from 'discourse/lib/show-modal';

export default createWidget('vote-button', {
tagName: 'div.vote-button',
Expand Down Expand Up @@ -56,7 +55,9 @@ export default createWidget('vote-button', {

click(){
if (!this.currentUser){
showModal('login');
this.sendWidgetAction("showLogin");
$.cookie("destination_url", window.location.href);
return;
}
if (!this.attrs.closed && this.parentWidget.state.allowClick && !this.attrs.user_voted){
this.parentWidget.state.allowClick = false;
Expand Down

0 comments on commit 1aeac94

Please sign in to comment.