Merge pull request #651 from Retrospring/feature/turn-that-frown-upside-down
Remove "frown" state when an answer/comment is smiled
This commit is contained in:
commit
dbaa6137dc
|
@ -47,11 +47,9 @@ export function commentSmileHandler(event: Event): void {
|
|||
switch(action) {
|
||||
case 'smile':
|
||||
button.dataset.action = 'unsmile';
|
||||
button.innerHTML = `<i class="fa fa-fw fa-frown-o"></i> <span id="ab-comment-smile-count-${id}">${count}</span>`;
|
||||
break;
|
||||
case 'unsmile':
|
||||
button.dataset.action = 'smile';
|
||||
button.innerHTML = `<i class="fa fa-fw fa-smile-o"></i> <span id="ab-comment-smile-count-${id}">${count}</span>`;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,11 +47,9 @@ export function answerboxSmileHandler(event: Event): void {
|
|||
switch(action) {
|
||||
case 'smile':
|
||||
button.dataset.action = 'unsmile';
|
||||
button.innerHTML = `<i class="fa fa-fw fa-frown-o"></i> <span id="ab-smile-count-${id}">${count}</span>`;
|
||||
break;
|
||||
case 'unsmile':
|
||||
button.dataset.action = 'smile';
|
||||
button.innerHTML = `<i class="fa fa-fw fa-smile-o"></i> <span id="ab-smile-count-${id}">${count}</span>`;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,5 @@
|
|||
%span.d-none.d-sm-inline.text-muted
|
||||
- if !user_signed_in? && a.smiles.count.positive?
|
||||
%button.btn.btn-info.btn-sm{ name: "ab-smile", disabled: true }
|
||||
%i.fa.fa-smile-o
|
||||
%span{ id: "ab-smile-count-#{a.id}" }= a.smiles.count
|
||||
- if user_signed_in?
|
||||
- if current_user.smiled? a
|
||||
%button.btn.btn-link.answerbox__action{ type: :button, name: "ab-smile", data: { a_id: a.id, action: :unsmile } }
|
||||
%i.fa.fa-fw.fa-frown-o
|
||||
%span{ id: "ab-smile-count-#{a.id}" }= a.smiles.count
|
||||
- else
|
||||
%button.btn.btn-link.answerbox__action{ type: :button, name: "ab-smile", data: { a_id: a.id, action: :smile } }
|
||||
%button.btn.btn-link.answerbox__action{ type: :button, name: "ab-smile", data: { a_id: a.id, action: current_user&.smiled?(a) ? :unsmile : :smile }, disabled: !user_signed_in? }
|
||||
%i.fa.fa-fw.fa-smile-o
|
||||
%span{ id: "ab-smile-count-#{a.id}" }= a.smiles.count
|
||||
- unless display_all
|
||||
|
|
|
@ -18,17 +18,7 @@
|
|||
= markdown comment.content
|
||||
.pull-right
|
||||
%span.d-none.d-sm-inline.text-muted
|
||||
- if !user_signed_in? && comment.smile_count.positive?
|
||||
%button.btn.btn-link.answerbox__action{ name: "ab-smile-comment", disabled: true }
|
||||
%i.fa.fa-fw.fa-smile-o
|
||||
%span{ id: "ab-comment-smile-count-#{comment.id}" }= comment.smile_count
|
||||
- if user_signed_in?
|
||||
- if current_user.smiled? comment
|
||||
%button.btn.btn-link.answerbox__action{ type: :button, name: "ab-smile-comment", data: { c_id: comment.id, action: :unsmile } }
|
||||
%i.fa.fa-fw.fa-frown-o
|
||||
%span{ id: "ab-comment-smile-count-#{comment.id}" }= comment.smile_count
|
||||
- else
|
||||
%button.btn.btn-link.answerbox__action{ type: :button, name: "ab-smile-comment", data: { c_id: comment.id, action: :smile } }
|
||||
%button.btn.btn-link.answerbox__action{ type: :button, name: "ab-smile-comment", data: { c_id: comment.id, action: current_user&.smiled?(comment) ? :unsmile : :smile }, disabled: !user_signed_in? }
|
||||
%i.fa.fa-fw.fa-smile-o
|
||||
%span{ id: "ab-comment-smile-count-#{comment.id}" }= comment.smile_count
|
||||
.btn-group
|
||||
|
|
Loading…
Reference in New Issue