the comment button now actually does something!
This commit is contained in:
parent
d6111d6835
commit
668b032a25
|
@ -154,6 +154,21 @@ $(document).on "click", "button[name=ab-smile]", ->
|
||||||
btn[0].dataset.action = 'smile'
|
btn[0].dataset.action = 'smile'
|
||||||
btn.html "<i class=\"fa fa-smile-o\"></i>"
|
btn.html "<i class=\"fa fa-smile-o\"></i>"
|
||||||
|
|
||||||
|
$(document).on "click", "button[name=ab-comments]", ->
|
||||||
|
btn = $(this)
|
||||||
|
aid = btn[0].dataset.aId
|
||||||
|
state = btn[0].dataset.state
|
||||||
|
commentBox = $("#ab-comments-#{aid}")
|
||||||
|
|
||||||
|
switch state
|
||||||
|
when 'hidden'
|
||||||
|
commentBox.slideDown()
|
||||||
|
btn[0].dataset.state = 'shown'
|
||||||
|
when 'shown'
|
||||||
|
commentBox.slideUp()
|
||||||
|
btn[0].dataset.state = 'hidden'
|
||||||
|
|
||||||
|
|
||||||
$(document).on "click", "button[name=user-action]", ->
|
$(document).on "click", "button[name=user-action]", ->
|
||||||
btn = $(this)
|
btn = $(this)
|
||||||
btn.button "loading"
|
btn.button "loading"
|
||||||
|
|
|
@ -29,3 +29,5 @@
|
||||||
.row
|
.row
|
||||||
.col-md-6.col-md-offset-6.col-sm-8.col-sm-offset-4.col-xs-6.col-xs-offset-6.text-right
|
.col-md-6.col-md-offset-6.col-sm-8.col-sm-offset-4.col-xs-6.col-xs-offset-6.text-right
|
||||||
= render 'shared/answerbox_buttons', a: a
|
= render 'shared/answerbox_buttons', a: a
|
||||||
|
.panel-footer{id: "ab-comments-#{a.id}", style: 'display: none'}
|
||||||
|
= render 'shared/comments', comments: a.comments
|
||||||
|
|
|
@ -8,8 +8,9 @@
|
||||||
- else
|
- else
|
||||||
%button.btn.btn-info.btn-sm{type: :button, name: 'ab-smile', 'data-a-id' => a.id, 'data-action' => 'smile'}
|
%button.btn.btn-info.btn-sm{type: :button, name: 'ab-smile', 'data-a-id' => a.id, 'data-action' => 'smile'}
|
||||||
%i.fa.fa-smile-o
|
%i.fa.fa-smile-o
|
||||||
%a.btn.btn-primary.btn-sm
|
%button.btn.btn-primary.btn-sm{type: :button, name: 'ab-comments', 'data-a-id' => a.id, 'data-state' => :hidden}
|
||||||
%i.fa.fa-comments
|
%i.fa.fa-comments
|
||||||
|
%span{id: "ab-comment-count-#{a.id}"}= a.comment_count
|
||||||
- if privileged? a.user
|
- if privileged? a.user
|
||||||
%button.btn.btn-danger.btn-sm{name: 'ab-destroy', 'data-a-id' => a.id}
|
%button.btn.btn-danger.btn-sm{name: 'ab-destroy', 'data-a-id' => a.id}
|
||||||
%i.fa.fa-trash-o
|
%i.fa.fa-trash-o
|
|
@ -0,0 +1,8 @@
|
||||||
|
- if comments.all.count == 0
|
||||||
|
There are no comments yet.
|
||||||
|
- else # TODO: some design guy (i.e. pixeldesu) should make some black magic here
|
||||||
|
%ul
|
||||||
|
- comments.all.each do |comment|
|
||||||
|
%li
|
||||||
|
#{user_screen_name comment.user}:
|
||||||
|
= comment.content
|
Loading…
Reference in New Issue