Fix lints in app/views/answerbox

This commit is contained in:
Andreas Nedbal 2020-05-10 14:22:04 +02:00
parent 72ce5f39f0
commit 4203e93bc4
4 changed files with 54 additions and 51 deletions

View File

@ -1,6 +1,6 @@
%span.d-none.d-sm-inline.text-muted %span.d-none.d-sm-inline.text-muted
- unless user_signed_in? - unless user_signed_in?
- if a.smile_count > 0 - if a.smile_count.positive?
%button.btn.btn-info.btn-sm{ name: 'ab-smile', disabled: true } %button.btn.btn-info.btn-sm{ name: 'ab-smile', disabled: true }
%i.fa.fa-smile-o %i.fa.fa-smile-o
%span{ id: "ab-smile-count-#{a.id}" }= a.smile_count %span{ id: "ab-smile-count-#{a.id}" }= a.smile_count
@ -13,22 +13,22 @@
%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: :smile } }
%i.fa.fa-fw.fa-smile-o %i.fa.fa-fw.fa-smile-o
%span{ id: "ab-smile-count-#{a.id}" }= a.smile_count %span{ id: "ab-smile-count-#{a.id}" }= a.smile_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
%span{ id: "ab-comment-count-#{a.id}" }= a.comment_count %span{ id: "ab-comment-count-#{a.id}" }= a.comment_count
- if user_signed_in? - if user_signed_in?
.btn-group .btn-group
%button.btn.btn-default.btn-sm.dropdown-toggle{data: { toggle: :dropdown }, aria: { expanded: :false }} %button.btn.btn-default.btn-sm.dropdown-toggle{ data: { toggle: :dropdown }, aria: { expanded: false } }
%span.caret %span.caret
.dropdown-menu.dropdown-menu-right{ role: :menu } .dropdown-menu.dropdown-menu-right{ role: :menu }
- if Subscription.is_subscribed(current_user, a) - if Subscription.is_subscribed(current_user, a)
-# fun joke should subscribe? -# fun joke should subscribe?
%a.dropdown-item{href: '#', data: { a_id: a.id, action: 'ab-submarine', torpedo: "no" }} %a.dropdown-item{ href: '#', data: { a_id: a.id, action: 'ab-submarine', torpedo: 'no' } }
%i.fa.fa-anchor %i.fa.fa-anchor
= t 'views.actions.unsubscribe' = t 'views.actions.unsubscribe'
- else - else
%a.dropdown-item{href: '#', data: { a_id: a.id, action: 'ab-submarine', torpedo: "yes" }} %a.dropdown-item{ href: '#', data: { a_id: a.id, action: 'ab-submarine', torpedo: 'yes' } }
%i.fa.fa-anchor %i.fa.fa-anchor
= t 'views.actions.subscribe' = t 'views.actions.subscribe'
- if privileged? a.user - if privileged? a.user

View File

@ -1,10 +1,10 @@
- if a.comments.all.count == 0 - if a.comments.all.count.zero?
= t 'views.answerbox.no_comment' = t 'views.answerbox.no_comment'
- else - else
%ul.comment__container %ul.comment__container
- a.comments.order(:created_at).each do |comment| - a.comments.order(:created_at).each do |comment|
%li.comment{ data: { comment_id: comment.id } } %li.comment{ data: { comment_id: comment.id } }
%div{class: "ab-comment-smile-list", style: "height: 0; width: 0"}= render "modal/comment_smiles", comment: comment %div{ style: 'height: 0; width: 0' }= render 'modal/comment_smiles', comment: comment
.media .media
.pull-left .pull-left
%img.comment__user-avatar.avatar-sm{ src: comment.user.profile_picture.url(:medium) } %img.comment__user-avatar.avatar-sm{ src: comment.user.profile_picture.url(:medium) }
@ -12,13 +12,14 @@
%h6.media-heading.comment__user %h6.media-heading.comment__user
= user_screen_name comment.user = user_screen_name comment.user
%span.text-muted{ title: comment.created_at, data: { toggle: :tooltip, placement: :right } } %span.text-muted{ title: comment.created_at, data: { toggle: :tooltip, placement: :right } }
= "#{time_ago_in_words(comment.created_at)} ago" = time_ago_in_words(comment.created_at)
ago
.comment__content .comment__content
= 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
- unless user_signed_in? - unless user_signed_in?
- if comment.smile_count > 0 - if comment.smile_count.positive?
%button.btn.btn-link.answerbox__action{ name: 'ab-smile-comment', disabled: true } %button.btn.btn-link.answerbox__action{ name: 'ab-smile-comment', disabled: true }
%i.fa.fa-smile-o %i.fa.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
@ -32,13 +33,13 @@
%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
.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
.dropdown-menu.dropdown-menu-right{ role: :menu } .dropdown-menu.dropdown-menu-right{ role: :menu }
%a.dropdown-item{ href: '#', type: :button, data: { target: "#modal-view-comment#{comment.id}-smiles", toggle: :modal } } %a.dropdown-item{ href: '#', type: :button, data: { target: "#modal-view-comment#{comment.id}-smiles", toggle: :modal } }
%i.fa.fa-smile-o %i.fa.fa-smile-o
= t 'views.actions.view' = t 'views.actions.view'
- if privileged?(comment.user) or privileged?(a.user) - if privileged?(comment.user) || privileged?(a.user)
%a.dropdown-item.text-danger{ href: '#', data: { action: 'ab-comment-destroy', c_id: comment.id } } %a.dropdown-item.text-danger{ href: '#', data: { action: 'ab-comment-destroy', c_id: comment.id } }
%i.fa.fa-trash-o %i.fa.fa-trash-o
= t 'views.actions.delete' = t 'views.actions.delete'

View File

@ -7,10 +7,10 @@
- if user_signed_in? - if user_signed_in?
.pull-right .pull-right
.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
.dropdown-menu.dropdown-menu-right{ role: :menu } .dropdown-menu.dropdown-menu-right{ role: :menu }
- if current_user.mod? or a.question.user == current_user - if current_user.mod? || a.question.user == current_user
%a.dropdown-item.text-danger{ href: '#', tabindex: -1, data: { action: 'ab-question-destroy', q_id: a.question.id } } %a.dropdown-item.text-danger{ href: '#', tabindex: -1, data: { action: 'ab-question-destroy', q_id: a.question.id } }
%i.fa.fa-trash-o %i.fa.fa-trash-o
= t 'views.actions.delete' = t 'views.actions.delete'

View File

@ -2,9 +2,11 @@
.pull-left .pull-left
%i.fa.fa-smile-o %i.fa.fa-smile-o
.media-body .media-body
- if a.smiles.all.count == 0 - if a.smiles.all.count.zero?
= t 'views.answerbox.no_smile' = t 'views.answerbox.no_smile'
- else - else
- a.smiles.all.each do |smile| - a.smiles.all.each do |smile|
%a{href: show_user_profile_path(smile.user.screen_name), title: smile.user.screen_name, data: { toggle: :tooltip, placement: :top, smile_id: smile.id }} %a{ href: show_user_profile_path(smile.user.screen_name),
title: smile.user.screen_name,
data: { toggle: :tooltip, placement: :top, smile_id: smile.id } }
%img.avatar-xs{ src: smile.user.profile_picture.url(:medium) } %img.avatar-xs{ src: smile.user.profile_picture.url(:medium) }