Fix lints in app/views/modal

This commit is contained in:
Andreas Nedbal 2020-05-10 12:53:30 +02:00
parent 13878070fd
commit 7414471d41
9 changed files with 86 additions and 79 deletions

View File

@ -10,7 +10,7 @@
= render "tabs/profile", user: @user = render "tabs/profile", user: @user
= yield = yield
- if user_signed_in? - if user_signed_in?
= render 'modal/group' = render 'modal/group', user: @user
- if current_user.mod? and @user != current_user - if current_user.mod? and @user != current_user
= render 'modal/privileges' = render 'modal/privileges', user: @user
= render 'modal/ban' = render 'modal/ban', user: @user

View File

@ -1,21 +1,21 @@
#modal-ask-followers.modal.fade{"aria-hidden" => "true", "aria-labelledby" => "modal-ask-followers-label", :role => "dialog", :tabindex => "-1"} .modal.fade#modal-ask-followers{ aria: { hidden: true, labelledby: 'modal-ask-followers-label' }, role: :dialog, tabindex: -1 }
.modal-dialog .modal-dialog
.modal-content .modal-content
.modal-header .modal-header
%h5#modal-ask-followers-label.modal-title= t 'views.modal.ask.title' %h5.modal-title#modal-ask-followers-label= t 'views.modal.ask.title'
%button.close{"data-dismiss" => "modal", :type => "button"} %button.close{ data: { dismiss: :modal }, type: :button }
%span{"aria-hidden" => "true"} × %span{ aria: { hidden: true } } ×
%span.sr-only= t 'views.actions.close' %span.sr-only= t 'views.actions.close'
.modal-body .modal-body
%textarea.form-control{:name => "qb-all-question", :placeholder => t('views.placeholder.question')} %textarea.form-control{ name: 'qb-all-question', placeholder: t('views.placeholder.question') }
.modal-footer .modal-footer
- if current_user.groups.count > 0 - if current_user.groups.count.positive?
%label %label
= t 'views.modal.ask.choose' = t 'views.modal.ask.choose'
%select{name: 'qb-all-rcpt', class: 'form-control', autocomplete: 'off'} %select.form-control{ name: 'qb-all-rcpt', autocomplete: 'off' }
%option{value: 'followers', selected: true}= t('views.general.follower').pluralize(2) %option{ value: 'followers', selected: true }= t('views.general.follower').pluralize(2)
%optgroup{label: t('views.group.title').pluralize(2)} %optgroup{ label: t('views.group.title').pluralize(2) }
- current_user.groups.each do |group| - current_user.groups.each do |group|
%option{value: "grp:#{group.name}"}= group.display_name %option{ value: "grp:#{group.name}" }= group.display_name
%button.btn.btn-default{"data-dismiss" => "modal", :type => "button"}= t 'views.actions.cancel' %button.btn.btn-default{ type: :button, data: { dismiss: :modal } }= t 'views.actions.cancel'
%button.btn.btn-primary{name: 'qb-all-ask', :type => "button", data: {loading_text: t('views.modal.ask.loading') }}= t 'views.actions.ask' %button.btn.btn-primary{ name: 'qb-all-ask', type: :button, data: { loading_text: t('views.modal.ask.loading') } }= t 'views.actions.ask'

View File

@ -1,21 +1,21 @@
#modal-ban.modal.fade{"aria-hidden" => "true", "aria-labelledby" => "modal-ban-label", :role => "dialog", :tabindex => "-1"} .modal.fade#modal-ban{ aria: { hidden: true, labelledby: 'modal-ban-label' }, role: :dialog, tabindex: -1 }
.modal-dialog .modal-dialog
.modal-content .modal-content
.modal-header .modal-header
%h5#modal-ban-label.modal-title %h5.modal-title#modal-ban-label
= t 'views.modal.bancontrol.title' = t 'views.modal.bancontrol.title'
%button.close{"data-dismiss" => "modal", :type => "button"} %button.close{ data: { dismiss: :modal }, type: :button }
%span{"aria-hidden" => "true"} × %span{ aria: { hidden: true } } ×
%span.sr-only Close %span.sr-only Close
= bootstrap_form_tag(url: '/mod/ban', html: { method: :post, novalidate: "novalidate" }) do |f| = bootstrap_form_tag(url: '/mod/ban', html: { method: :post, novalidate: 'novalidate' }) do |f|
= f.hidden_field :user, value: @user.screen_name = f.hidden_field :user, value: user.screen_name
#ban-control-super.modal-body .modal-body#ban-control-super
= f.check_box :ban, label: t('views.modal.bancontrol.ban'), checked: @user.banned? = f.check_box :ban, label: t('views.modal.bancontrol.ban'), checked: user.banned?
#ban-controls{style: "#{"display: none" unless @user.banned?}"} #ban-controls{ style: !user.banned? ? 'display: none' : '' }
= f.check_box :permaban, label: t('views.modal.bancontrol.permanent'), checked: @user.permanently_banned? = f.check_box :permaban, label: t('views.modal.bancontrol.permanent'), checked: user.permanently_banned?
#ban-controls-time{style: "#{"display: none" unless not @user.permanently_banned?}"} #ban-controls-time{ style: user.permanently_banned? ? 'display: none' : '' }
= f.text_field :until, label: "", required: true, value: (@user.banned_until || DateTime.current).strftime("%m/%d/%Y %I:%M %p") = f.text_field :until, label: '', required: true, value: (user.banned_until || DateTime.current).strftime('%m/%d/%Y %I:%M %p')
= f.text_field :reason, placeholder: t('views.modal.bancontrol.reason'), value: @user.ban_reason = f.text_field :reason, placeholder: t('views.modal.bancontrol.reason'), value: user.ban_reason
.modal-footer .modal-footer
%button.btn.btn-default{name: 'stop-time', type: :button, data: { dismiss: :modal }}= t 'views.actions.close' %button.btn.btn-default{ name: 'stop-time', type: :button, data: { dismiss: :modal } }= t 'views.actions.close'
= f.submit t('views.modal.bancontrol.hammertime'), class: "btn btn-primary", name: 'hammer-time' = f.submit t('views.modal.bancontrol.hammertime'), class: 'btn btn-primary', name: 'hammer-time'

View File

@ -1,18 +1,18 @@
.modal.fade{"id" => "modal-view-comment#{comment.id}-smiles","aria-hidden" => "true", "aria-labelledby" => "modal-view-comment#{comment.id}-smiles-label", :role => "dialog", :tabindex => "-1"} .modal.fade{ id: "modal-view-comment#{comment.id}-smiles", aria: { hidden: true, labelledby: 'modal-commentsmile-label' }, role: :dialog, tabindex: -1 }
.modal-dialog .modal-dialog
.modal-content .modal-content
.modal-header .modal-header
%h5#modal-ask-followers-label.modal-title= t 'views.answerbox.commentsmile' %h5.modal-title#modal-commentsmile-label= t 'views.answerbox.commentsmile'
%button.close{"data-dismiss" => "modal", :type => "button"} %button.close{ data: { dismiss: :modal }, type: :button }
%span{"aria-hidden" => "true"} × %span{ aria: { hidden: true } } ×
%span.sr-only Close %span.sr-only Close
.modal-body .modal-body
- if comment.smiles.all.count == 0 - if comment.smiles.all.count.zero?
= t 'views.answerbox.no_smile' = t 'views.answerbox.no_smile'
- else - else
%ul.smiles__user-list %ul.smiles__user-list
- comment.smiles.all.each do |smile| - comment.smiles.all.each do |smile|
%li.smiles__user-list-entry %li.smiles__user-list-entry
%a{href: show_user_profile_path(smile.user.screen_name)} %a{ href: show_user_profile_path(smile.user.screen_name) }
%img{src: smile.user.profile_picture.url(:medium), alt: user_screen_name(smile.user, url: false)} %img{ src: smile.user.profile_picture.url(:medium), alt: user_screen_name(smile.user, url: false) }
%span= user_screen_name(smile.user, url: false) %span= user_screen_name(smile.user, url: false)

View File

@ -1,28 +1,28 @@
#modal-group-memberships.modal.fade{"aria-hidden" => "true", "aria-labelledby" => "modal-group-memberships-label", :role => "dialog", :tabindex => "-1"} .modal.fade#modal-group-memberships{ aria: { hidden: true, labelledby: 'modal-group-memberships-label' }, role: :dialog, tabindex: -1 }
.modal-dialog .modal-dialog
.modal-content .modal-content
.modal-header .modal-header
%h5#modal-group-memberships-label.modal-title= t 'views.modal.group.title' %h5.modal-title#modal-group-memberships-label= t 'views.modal.group.title'
%button.close{"data-dismiss" => "modal", :type => "button"} %button.close{ data: { dismiss: :modal }, type: :button }
%span{"aria-hidden" => "true"} × %span{ aria: { hidden: true } } ×
%span.sr-only= t 'views.actions.close' %span.sr-only= t 'views.actions.close'
%div{role: "tabpanel"} %div{ role: 'tabpanel' }
%ul.nav.nav-tabs.mt-1{role: "tablist"} %ul.nav.nav-tabs.mt-1{ role: 'tablist' }
%li.nav-item{role: "presentation"} %li.nav-item{ role: 'presentation' }
%a.nav-link.active{href: "#grouplist", aria: {controls: "grouplist"}, data: {toggle: "tab"}, role: "tab"} %a.nav-link.active{ href: '#grouplist', aria: { controls: 'grouplist' }, data: { toggle: 'tab' }, role: 'tab' }
= t 'views.modal.group.tabs.main' = t 'views.modal.group.tabs.main'
%li.nav-item{role: "presentation"} %li.nav-item{ role: 'presentation' }
%a.nav-link{href: "#create", aria: {controls: "create"}, data: {toggle: "tab"}, role: "tab"} %a.nav-link{ href: '#create', aria: { controls: 'create' }, data: { toggle: 'tab' }, role: 'tab' }
= t 'views.modal.group.tabs.create' = t 'views.modal.group.tabs.create'
.tab-content .tab-content
.tab-pane.active{role:"tabpanel", id: "grouplist"} .tab-pane.active{ role: 'tabpanel', id: 'grouplist' }
%ul.list-group %ul.list-group
- current_user.groups.each do |group| - current_user.groups.each do |group|
= render 'modal/group/item', group: group, user: @user = render 'modal/group/item', group: group, user: user
.tab-pane{role:"tabpanel", id: "create"} .tab-pane{ role: 'tabpanel', id: 'create' }
.modal-body .modal-body
%input#new-group-name.form-control{type: :text, placeholder: t('views.modal.group.name')} %input.form-control#new-group-name{ type: :text, placeholder: t('views.modal.group.name') }
%button#create-group.btn.btn-primary{type: :button, data: { user: @user.screen_name }}= t('views.modal.group.create') %button.btn.btn-primary#create-group{ type: :button, data: { user: user.screen_name } }= t('views.modal.group.create')
.modal-footer .modal-footer
%button.btn.btn-primary{name: 'gm-save', type: :button, data: { dismiss: :modal }}= t 'views.actions.done' %button.btn.btn-primary{ name: 'gm-save', type: :button, data: { dismiss: :modal } }= t 'views.actions.done'

View File

@ -1,13 +1,16 @@
#modal-passwd.modal.fade{"aria-hidden" => "true", "aria-labelledby" => "modal-passwd-label", :role => "dialog", :tabindex => "-1"} .modal.fade#modal-passwd{ aria: { hidden: true, labelledby: 'modal-passwd-label' }, role: :dialog, tabindex: -1 }
.modal-dialog .modal-dialog
.modal-content .modal-content
.modal-header .modal-header
%h5#modal-passwd-label.modal-title= t 'views.settings.account.modal.title' %h5.modal-title#modal-passwd-label= t 'views.settings.account.modal.title'
%button.close{"data-dismiss" => "modal", :type => "button"} %button.close{ data: { dismiss: :modal }, type: :button }
%span{"aria-hidden" => "true"} × %span{ aria: { hidden: true } } ×
%span.sr-only= t 'views.actions.close' %span.sr-only= t 'views.actions.close'
.modal-body .modal-body
= f.password_field :current_password, autocomplete: "off", label: t('views.settings.account.password_current'), help: t('views.settings.account.password_current_help') = f.password_field :current_password,
autocomplete: 'off',
label: t('views.settings.account.password_current'),
help: t('views.settings.account.password_current_help')
.modal-footer .modal-footer
%button.btn.btn-default{"data-dismiss" => "modal", :type => "button"}= t 'views.actions.cancel' %button.btn.btn-default{ data: { dismiss: :modal }, type: :button }= t 'views.actions.cancel'
%button.btn.btn-primary{:type => "submit"}= t 'views.actions.save' %button.btn.btn-primary{ type: :submit }= t 'views.actions.save'

View File

@ -1,15 +1,15 @@
#modal-privileges.modal.fade{"aria-hidden" => "true", "aria-labelledby" => "modal-privileges-label", :role => "dialog", :tabindex => "-1"} .modal.fade#modal-privileges{ aria: { hidden: true, labelledby: 'modal-privileges-label' }, role: :dialog, tabindex: -1 }
.modal-dialog .modal-dialog
.modal-content .modal-content
.modal-header .modal-header
%h5#modal-privileges-label.modal-title %h5.modal-title#modal-privileges-label
= raw t('views.actions.privilege', user: @user.screen_name) = raw t('views.actions.privilege', user: user.screen_name)
%button.close{"data-dismiss" => "modal", :type => "button"} %button.close{ data: { dismiss: :modal }, type: :button }
%span{"aria-hidden" => "true"} × %span{ aria: { hidden: true } } ×
%span.sr-only= t 'views.actions.close' %span.sr-only= t 'views.actions.close'
%ul.list-group.groups--list %ul.list-group.groups--list
- if current_user.has_role?(:administrator) - if current_user.has_role?(:administrator)
= render 'modal/privileges/item', privilege: 'moderator', description: t('views.modal.privilege.moderator'),user: @user = render 'modal/privileges/item', privilege: 'moderator', description: t('views.modal.privilege.moderator'), user: user
= render 'modal/privileges/item', privilege: 'admin', description: t('views.modal.privilege.admin'), user: @user = render 'modal/privileges/item', privilege: 'admin', description: t('views.modal.privilege.admin'), user: user
.modal-footer .modal-footer
%button.btn.btn-primary{name: 'checked-privileges', type: :button, data: { dismiss: :modal }}= t 'views.actions.done' %button.btn.btn-primary{ name: 'checked-privileges', type: :button, data: { dismiss: :modal } }= t 'views.actions.done'

View File

@ -1,15 +1,18 @@
%li.list-group-item{id: "group-#{group.name}"} %li.list-group-item{ id: "group-#{group.name}" }
.media .media
.pull-left .pull-left
.custom-control.custom-checkbox .custom-control.custom-checkbox
%input.custom-control-input{type: :checkbox, id: "groupCheck#{group.id}", name: 'gm-group-check', data: { group: group.name, user: user.screen_name }, checked: user.member_of?(group), autocomplete: 'off'} %input.custom-control-input{ type: :checkbox,
%label.custom-control-label{for: "groupCheck#{group.id}"} id: "groupCheck#{group.id}",
name: 'gm-group-check',
data: { group: group.name, user: user.screen_name }, checked: user.member_of?(group), autocomplete: 'off' }
%label.custom-control-label{ for: "groupCheck#{group.id}" }
.media-body .media-body
.list-group-item-heading= group.display_name .list-group-item-heading= group.display_name
.list-group-item-text.text-muted .list-group-item-text.text-muted
%span{id: "#{group.name}-members"}= group.members.count %span{ id: "#{group.name}-members" }= group.members.count
= t 'views.modal.group.members' = t 'views.modal.group.members'
· ·
%a.text-danger#delete-group{href: "#", data: { group: group.name }} %a.text-danger#delete-group{ href: '#', data: { group: group.name } }
%i.fa.fa-close %i.fa.fa-close
= t 'views.actions.delete' = t 'views.actions.delete'

View File

@ -1,11 +1,12 @@
- description ||= '' :ruby
- role_mapping = {"admin" => "administrator"} description ||= ''
- requires_role = %w[admin moderator].include?(privilege) role_mapping = { admin: 'administrator' }
- checked = requires_role ? user.has_role?(role_mapping.fetch(privilege, privilege).to_sym) : user.public_send("#{privilege}?") requires_role = %w[admin moderator].include?(privilege)
%li.list-group-item{id: "privilege-#{privilege}"} checked = requires_role ? user.has_role?(role_mapping.fetch(privilege, privilege).to_sym) : user.public_send("#{privilege}?")
%li.list-group-item{ id: "privilege-#{privilege}" }
.media .media
.pull-left .pull-left
%input{type: :checkbox, name: 'check-your-privileges', data: { type: privilege, user: user.screen_name }, checked: checked, autocomplete: 'off'} %input{ type: :checkbox, name: 'check-your-privileges', data: { type: privilege, user: user.screen_name }, checked: checked, autocomplete: 'off' }
.media-body .media-body
.list-group-item-heading= privilege.capitalize .list-group-item-heading= privilege.capitalize
- unless description.blank? - unless description.blank?