mirror of
https://github.com/Retrospring/retrospring.git
synced 2024-11-20 14:19:53 +01:00
Remove "frown" state when an answer/comment is smiled
This commit is contained in:
parent
633a88ec4f
commit
ba0ee581c4
4 changed files with 6 additions and 30 deletions
|
@ -47,11 +47,9 @@ export function commentSmileHandler(event: Event): void {
|
||||||
switch(action) {
|
switch(action) {
|
||||||
case 'smile':
|
case 'smile':
|
||||||
button.dataset.action = 'unsmile';
|
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;
|
break;
|
||||||
case 'unsmile':
|
case 'unsmile':
|
||||||
button.dataset.action = 'smile';
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,11 +47,9 @@ export function answerboxSmileHandler(event: Event): void {
|
||||||
switch(action) {
|
switch(action) {
|
||||||
case 'smile':
|
case 'smile':
|
||||||
button.dataset.action = 'unsmile';
|
button.dataset.action = 'unsmile';
|
||||||
button.innerHTML = `<i class="fa fa-fw fa-frown-o"></i> <span id="ab-smile-count-${id}">${count}</span>`;
|
|
||||||
break;
|
break;
|
||||||
case 'unsmile':
|
case 'unsmile':
|
||||||
button.dataset.action = 'smile';
|
button.dataset.action = 'smile';
|
||||||
button.innerHTML = `<i class="fa fa-fw fa-smile-o"></i> <span id="ab-smile-count-${id}">${count}</span>`;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,7 @@
|
||||||
%span.d-none.d-sm-inline.text-muted
|
%span.d-none.d-sm-inline.text-muted
|
||||||
- if !user_signed_in? && a.smiles.count.positive?
|
%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? }
|
||||||
%button.btn.btn-info.btn-sm{ name: "ab-smile", disabled: true }
|
%i.fa.fa-fw.fa-smile-o
|
||||||
%i.fa.fa-smile-o
|
%span{ id: "ab-smile-count-#{a.id}" }= a.smiles.count
|
||||||
%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 } }
|
|
||||||
%i.fa.fa-fw.fa-smile-o
|
|
||||||
%span{ id: "ab-smile-count-#{a.id}" }= a.smiles.count
|
|
||||||
- unless display_all
|
- unless display_all
|
||||||
%button.btn.btn-link.answerbox__action{ type: :button, name: "ab-comments", data: { a_id: a.id, state: :hidden } }
|
%button.btn.btn-link.answerbox__action{ type: :button, name: "ab-comments", data: { a_id: a.id, state: :hidden } }
|
||||||
%i.fa.fa-fw.fa-comments
|
%i.fa.fa-fw.fa-comments
|
||||||
|
|
|
@ -18,19 +18,9 @@
|
||||||
= markdown comment.content
|
= markdown comment.content
|
||||||
.pull-right
|
.pull-right
|
||||||
%span.d-none.d-sm-inline.text-muted
|
%span.d-none.d-sm-inline.text-muted
|
||||||
- if !user_signed_in? && comment.smile_count.positive?
|
%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? }
|
||||||
%button.btn.btn-link.answerbox__action{ name: "ab-smile-comment", disabled: true }
|
%i.fa.fa-fw.fa-smile-o
|
||||||
%i.fa.fa-fw.fa-smile-o
|
%span{ id: "ab-comment-smile-count-#{comment.id}" }= comment.smile_count
|
||||||
%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 } }
|
|
||||||
%i.fa.fa-fw.fa-smile-o
|
|
||||||
%span{ id: "ab-comment-smile-count-#{comment.id}" }= comment.smile_count
|
|
||||||
.btn-group
|
.btn-group
|
||||||
%button.btn.btn-link.btn-sm.dropdown-toggle{ data: { toggle: :dropdown }, aria: { expanded: false } }
|
%button.btn.btn-link.btn-sm.dropdown-toggle{ data: { toggle: :dropdown }, aria: { expanded: false } }
|
||||||
%span.caret
|
%span.caret
|
||||||
|
|
Loading…
Reference in a new issue