Fix lints in app/views/inbox

This commit is contained in:
Andreas Nedbal 2020-05-10 13:21:41 +02:00
parent 29a35ccecb
commit 516b5f160d
6 changed files with 42 additions and 40 deletions

View File

@ -22,7 +22,7 @@
btn.button "reset" btn.button "reset"
($ document).on "click", "button#ib-author", -> ($ document).on "click", "button#ib-author", ->
$('#author_form').submit -> $('#author-form').submit ->
query = $('#author').val() query = $('#author').val()
window.location.href = '/inbox/' + query window.location.href = '/inbox/' + query
false false

View File

@ -1,36 +1,36 @@
.card.inbox-entry{class: i.new? ? 'inbox-entry--new' : '', data: { id: i.id }} .card.inbox-entry{ class: i.new? ? 'inbox-entry--new' : '', data: { id: i.id } }
.card-header .card-header
.media .media
- unless i.question.author_is_anonymous - unless i.question.author_is_anonymous
%a.pull-left{href: show_user_profile_path(i.question.user.screen_name)} %a.pull-left{ href: show_user_profile_path(i.question.user.screen_name) }
%img.answerbox__question-user-avatar.avatar-md{src: i.question.user.profile_picture.url(:medium)} %img.answerbox__question-user-avatar.avatar-md{ src: i.question.user.profile_picture.url(:medium) }
.media-body .media-body
%h6.text-muted.media-heading.answerbox__question-user %h6.text-muted.media-heading.answerbox__question-user
= raw t('views.inbox.entry.asked', user: user_screen_name(i.question.user, anonymous: i.question.author_is_anonymous), time: time_tooltip(i.question)) = raw t('views.inbox.entry.asked', user: user_screen_name(i.question.user, anonymous: i.question.author_is_anonymous), time: time_tooltip(i.question))
- unless i.question.author_is_anonymous - unless i.question.author_is_anonymous
- if i.question.answer_count > 0 - if i.question.answer_count.positive?
· ·
%a{href: show_user_question_path(i.question.user.screen_name, i.question.id)} %a{ href: show_user_question_path(i.question.user.screen_name, i.question.id) }
= pluralize(i.question.answer_count, t('views.inbox.entry.response')) = pluralize(i.question.answer_count, t('views.inbox.entry.response'))
%p.answerbox__question-text= i.question.content %p.answerbox__question-text= i.question.content
.card-body .card-body
%textarea.form-control{name: 'ib-answer', placeholder: t('views.placeholder.inbox'), data: { id: i.id }} %textarea.form-control{ name: 'ib-answer', placeholder: t('views.placeholder.inbox'), data: { id: i.id } }
%br/ %br/
%button.btn.btn-success{name: 'ib-answer', data: { ib_id: i.id }} %button.btn.btn-success{ name: 'ib-answer', data: { ib_id: i.id } }
= t 'views.actions.answer' = t 'views.actions.answer'
%button.btn.btn-danger{name: 'ib-destroy', data: { ib_id: i.id }} %button.btn.btn-danger{ name: 'ib-destroy', data: { ib_id: i.id } }
= t 'views.actions.delete' = t 'views.actions.delete'
%button.btn.btn-default{name: 'ib-options', data: { ib_id: i.id, state: :hidden }} %button.btn.btn-default{ name: 'ib-options', data: { ib_id: i.id, state: :hidden } }
%i.fa.fa-cog %i.fa.fa-cog
%span.sr-only= t 'views.actions.options' %span.sr-only= t 'views.actions.options'
.card-footer{id: "ib-options-#{i.id}", style: 'display: none'} .card-footer{ id: "ib-options-#{i.id}", style: 'display: none' }
%h4= t 'views.inbox.entry.sharing.title' %h4= t 'views.inbox.entry.sharing.title'
- if current_user.services.count > 0 - if current_user.services.count.positive?
.row .row
- current_user.services.each do |service| - current_user.services.each do |service|
.col-md-3.col-sm-4.col-xs-6 .col-md-3.col-sm-4.col-xs-6
%label %label
%input{type: 'checkbox', name: 'ib-share', checked: :checked, data: { ib_id: i.id, service: service.provider }} %input{ type: 'checkbox', name: 'ib-share', checked: :checked, data: { ib_id: i.id, service: service.provider } }
= raw t('views.inbox.entry.sharing.post', service: service.provider.capitalize) = raw t('views.inbox.entry.sharing.post', service: service.provider.capitalize)
- else - else
%p= raw t('views.inbox.entry.sharing.none', settings: link_to(t('views.inbox.entry.sharing.settings'), services_path)) %p= raw t('views.inbox.entry.sharing.none', settings: link_to(t('views.inbox.entry.sharing.settings'), services_path))

View File

@ -0,0 +1,27 @@
.card
.card-header= t 'views.inbox.sidebar.questions.title'
.card-body
%button.btn.btn-block.btn-info{ type: :button, id: 'ib-generate-question' }= t 'views.inbox.sidebar.questions.button'
.card
.card-header= t 'views.inbox.sidebar.share.title'
.card-body
%a.btn.btn-block.btn-primary{ target: '_blank',
href: "https://twitter.com/intent/tweet?text=Ask%20me%20anything%21&url=#{show_user_profile_url(current_user.screen_name)}" }
%i.fa.fa-fw.fa-twitter
= raw t('views.inbox.sidebar.share.button', service: 'Twitter')
%a.btn.btn-block.btn-primary{ target: '_blank',
href: "https://www.tumblr.com/share/link?url=#{show_user_profile_url(current_user.screen_name)}&name=Ask%20me%20anything%21" }
%i.fa.fa-fw.fa-tumblr
= raw t('views.inbox.sidebar.share.button', service: 'Tumblr')
.card
.card-header Show author
.card-body
%form#author-form
= bootstrap_form_tag url: inbox_path, method: :get do |f|
= f.text_field :author, value: params[:author], placeholder: 'username', prepend: '@', hide_label: true
= f.button 'Show', name: nil, class: 'btn btn-light btn-block btn-sm', id: 'ib-author'
.card
.card-header= t 'views.inbox.sidebar.actions.title'
.card-body
%button.btn.btn-block.btn-danger{ type: :button, id: delete_id, disabled: (disabled ? 'disabled' : nil), data: { ib_count: inbox_count } }
= t 'views.inbox.sidebar.actions.button'

View File

@ -1,25 +0,0 @@
.card.inbox--panel
.card-header= t 'views.inbox.sidebar.questions.title'
.card-body
%button.btn.btn-block.btn-info{type: :button, id: 'ib-generate-question'}= t 'views.inbox.sidebar.questions.button'
.card.inbox--panel
.card-header= t 'views.inbox.sidebar.share.title'
.card-body
%a.btn.btn-block.btn-primary{target: '_blank', href: "https://twitter.com/intent/tweet?text=Ask%20me%20anything%21&url=#{show_user_profile_url(current_user.screen_name)}"}
%i.fa.fa-fw.fa-twitter
= raw t('views.inbox.sidebar.share.button', service: "Twitter")
%a.btn.btn-block.btn-primary{target: '_blank', href: "https://www.tumblr.com/share/link?url=#{show_user_profile_url(current_user.screen_name)}&name=Ask%20me%20anything%21"}
%i.fa.fa-fw.fa-tumblr
= raw t('views.inbox.sidebar.share.button', service: "Tumblr")
.card.inbox--panel
.card-header Show author
.card-body
%form#author_form
= bootstrap_form_tag url: inbox_path, method: :get do |f|
= f.text_field :author, value: params[:author], placeholder: "username", prepend: "@" , hide_label: true
= f.button "Show", name: nil, class: "btn btn-light btn-block btn-sm", id: "ib-author"
.card.warning--panel
.card-header= t 'views.inbox.sidebar.actions.title'
.card-body
%button.btn.btn-block.btn-danger{type: :button, id: @delete_id , disabled: (@disabled ? 'disabled' : nil), data: { ib_count: @inbox_count }}= t 'views.inbox.sidebar.actions.button'

View File

@ -8,5 +8,5 @@
= render 'shared/cursored_pagination_dummy', more_data_available: @more_data_available, last_id: @inbox_last_id = render 'shared/cursored_pagination_dummy', more_data_available: @more_data_available, last_id: @inbox_last_id
- if @more_data_available - if @more_data_available
%button#load-more-btn.btn.btn-default{type: :button, data: { last_id: @inbox_last_id }} %button.btn.btn-default#load-more-btn{ type: :button, data: { last_id: @inbox_last_id } }
= t 'views.actions.load' = t 'views.actions.load'

View File

@ -1,7 +1,7 @@
.container.container--main .container.container--main
.row .row
.col-md-3.col-xs-12.col-sm-4.order-2.order-sm-1 .col-md-3.col-xs-12.col-sm-4.order-2.order-sm-1
= render 'inbox/sidebar' = render 'inbox/sidebar', delete_id: @delete_id, disabled: @disabled, inbox_count: @inbox_count
.col-md-9.col-xs-12.col-sm-8.order-1.order-sm-2 .col-md-9.col-xs-12.col-sm-8.order-1.order-sm-2
= render 'layouts/messages' = render 'layouts/messages'
= yield = yield