From c21a3d0f73c3c097b22a3a06a684cc0d19e9f305 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sun, 10 May 2020 10:40:48 +0200 Subject: [PATCH] Fix lints in app/views/settings --- app/views/settings/_account.haml | 10 +++--- app/views/settings/_data.haml | 26 +++++++------- app/views/settings/_export.haml | 12 +++---- app/views/settings/_privacy.haml | 4 +-- app/views/settings/_profile.haml | 28 ++++++++-------- app/views/settings/_services.haml | 15 +++++---- app/views/settings/_theme.haml | 56 +++++++++++++++---------------- 7 files changed, 77 insertions(+), 74 deletions(-) diff --git a/app/views/settings/_account.haml b/app/views/settings/_account.haml index bc34b0a9..0b0dd7ae 100644 --- a/app/views/settings/_account.haml +++ b/app/views/settings/_account.haml @@ -11,19 +11,19 @@ - if devise_mapping.confirmable? && resource.pending_reconfirmation? %div= raw t('views.settings.account.email_confirm', resource: resource.unconfirmed_email) - = f.password_field :password, autocomplete: "off", label: t('views.settings.account.password'), help: t('views.settings.account.password_help') - = f.password_field :password_confirmation, autocomplete: "off", label: t('views.settings.account.password_confirm') + = f.password_field :password, autocomplete: 'off', label: t('views.settings.account.password'), help: t('views.settings.account.password_help') + = f.password_field :password_confirmation, autocomplete: 'off', label: t('views.settings.account.password_confirm') - %button.btn.btn-primary{"data-target" => "#modal-passwd", "data-toggle" => "modal", :type => "button"} + %button.btn.btn-primary{ data: { target: '#modal-passwd', toggle: :modal, type: :button } } = t 'views.actions.save' %hr/ %p = t 'views.settings.account.unsatisfied' - =button_to t('views.settings.account.delete'), '/settings/account', data: { confirm: "Are you sure?" }, method: :delete, class: "btn btn-danger btn-xs" + = button_to t('views.settings.account.delete'), '/settings/account', data: { confirm: 'Are you sure?' }, method: :delete, class: 'btn btn-danger btn-xs' = link_to t('views.settings.account.back'), :back -.visible-xs= render "shared/links" +.visible-xs= render 'shared/links' diff --git a/app/views/settings/_data.haml b/app/views/settings/_data.haml index fd6b4829..98b80195 100644 --- a/app/views/settings/_data.haml +++ b/app/views/settings/_data.haml @@ -43,28 +43,28 @@ %p.font-weight-bold.mb-0 Profile picture .media .pull-left - %img.profile--img{src: current_user.profile_picture.url(:medium)} + %img.profile--img{ src: current_user.profile_picture.url(:medium) } .media-body %ul %li - %a{href: current_user.profile_picture.url(:small)} Small + %a{ href: current_user.profile_picture.url(:small) } Small %li - %a{href: current_user.profile_picture.url(:medium)} Medium + %a{ href: current_user.profile_picture.url(:medium) } Medium %li - %a{href: current_user.profile_picture.url(:large)} Large + %a{ href: current_user.profile_picture.url(:large) } Large %li - %a{href: current_user.profile_picture.url(:original)} Original image + %a{ href: current_user.profile_picture.url(:original) } Original image %p.font-weight-bold.mb-0 Header picture - %img{src: current_user.profile_header.url(:mobile), style: 'width: 100%'} + %img{ src: current_user.profile_header.url(:mobile), style: 'width: 100%' } %p - %a{href: current_user.profile_header.url(:mobile)} Mobile + %a{ href: current_user.profile_header.url(:mobile) } Mobile | - %a{href: current_user.profile_header.url(:web)} Web + %a{ href: current_user.profile_header.url(:web) } Web | - %a{href: current_user.profile_header.url(:retina)} Retina + %a{ href: current_user.profile_header.url(:retina) } Retina | - %a{href: current_user.profile_header.url(:original)} Original image + %a{ href: current_user.profile_header.url(:original) } Original image .row .col-md-6.col-sm-6.col-xs-12 %h4 Statistics @@ -132,13 +132,13 @@ %h4 Sign In %p.font-weight-bold.mb-0 Current Sign In - %p.text-muted= current_user.current_sign_in_at ? localize(current_user.current_sign_in_at) : "Not set" + %p.text-muted= current_user.current_sign_in_at ? localize(current_user.current_sign_in_at) : 'Not set' %p.font-weight-bold.mb-0 Last Sign In - %p.text-muted= current_user.last_sign_in_at ? localize(current_user.last_sign_in_at) : "Not set" + %p.text-muted= current_user.last_sign_in_at ? localize(current_user.last_sign_in_at) : 'Not set' %p.font-weight-bold.mb-0 Remember me set at - %p.text-muted= current_user.remember_created_at ? localize(current_user.remember_created_at) : "Not set" + %p.text-muted= current_user.remember_created_at ? localize(current_user.remember_created_at) : 'Not set' .col-md-6.col-sm-6.col-xs-12 %h4 Create/Update diff --git a/app/views/settings/_export.haml b/app/views/settings/_export.haml index 91634d2c..90ee4fd3 100644 --- a/app/views/settings/_export.haml +++ b/app/views/settings/_export.haml @@ -3,7 +3,7 @@ %h2 Export your data %p The data is inside a - %code= ".tar.gz" + %code= '.tar.gz' archive and available in three formats: YAML, JSON, and XML. The archive also contains a copy of your profile picture and header picture in all sizes. %p @@ -11,13 +11,13 @@ will take a while, so please be patient. You will receive a question once exporting is done. - if current_user.can_export? - %form{action: begin_user_export_path, method: 'POST'} + %form{ action: begin_user_export_path, method: 'POST' } %p.text-center - %button#export-btn.btn.btn-lg.btn-primary{type: :submit} Export + %button.btn.btn-lg.btn-primary#export-btn{ type: :submit } Export = hidden_field_tag :authenticity_token, form_authenticity_token - else %p.text-center - %button.btn.btn-lg.btn-primary.disabled{disabled: :disabled} Export + %button.btn.btn-lg.btn-primary.disabled{ disabled: :disabled } Export %p - if current_user.export_url.nil? Once exporting your account is done, a download link will appear here. @@ -25,5 +25,5 @@ Here is your export from = succeed ':' do = current_user.export_created_at - %a{href: current_user.export_url} - = File.basename current_user.export_url \ No newline at end of file + %a{ href: current_user.export_url } + = File.basename current_user.export_url diff --git a/app/views/settings/_privacy.haml b/app/views/settings/_privacy.haml index e3edd407..ca7bb9e2 100644 --- a/app/views/settings/_privacy.haml +++ b/app/views/settings/_privacy.haml @@ -1,9 +1,9 @@ .card .card-body - = bootstrap_form_for(current_user, url: {action: "edit_privacy"}, method: "patch") do |f| + = bootstrap_form_for(current_user, url: { action: 'edit_privacy' }, method: 'patch') do |f| = f.check_box :privacy_allow_anonymous_questions, label: t('views.settings.privacy.anonymous') = f.check_box :privacy_allow_public_timeline, label: t('views.settings.privacy.public') = f.check_box :privacy_allow_stranger_answers, label: t('views.settings.privacy.stranger') - = f.submit t('views.actions.save'), class: 'btn btn-primary' \ No newline at end of file + = f.submit t('views.actions.save'), class: 'btn btn-primary' diff --git a/app/views/settings/_profile.haml b/app/views/settings/_profile.haml index 1dcd3cda..b3c37c28 100644 --- a/app/views/settings/_profile.haml +++ b/app/views/settings/_profile.haml @@ -1,41 +1,41 @@ .card .card-body - = bootstrap_form_for(current_user, url: {action: "edit"}, :html => { :multipart => true }, method: "patch") do |f| + = bootstrap_form_for(current_user, url: { action: 'edit' }, html: { multipart: true }, method: 'patch') do |f| = f.text_field :display_name, label: t('views.settings.profile.displayname') .media#profile-picture-media .pull-left - %img.avatar-lg.mr-3{src: current_user.profile_picture.url(:medium)} + %img.avatar-lg.mr-3{ src: current_user.profile_picture.url(:medium) } .media-body = f.file_field :profile_picture, label: t('views.settings.profile.avatar') - .row#profile-picture-crop-controls{style: 'display: none;'} + .row#profile-picture-crop-controls{ style: 'display: none;' } .col-sm-10.col-md-8 %strong= t('views.settings.profile.avatar_adjust') - %img#profile-picture-cropper{src: current_user.profile_picture.url(:medium)} + %img#profile-picture-cropper{ src: current_user.profile_picture.url(:medium) } .col-sm-2.col-md-4 .btn-group - %button#cropper-zoom-out.btn.btn-inverse{type: :button} + %button.btn.btn-inverse#cropper-zoom-out{ type: :button } %i.fa.fa-search-minus - %button#cropper-zoom-in.btn.btn-inverse{type: :button} + %button.btn.btn-inverse#cropper-zoom-in{ type: :button } %i.fa.fa-search-plus .row.mb-2#profile-header-media .col - %img.mw-100.mr-3{src: current_user.profile_header.url(:mobile)} + %img.mw-100.mr-3{ src: current_user.profile_header.url(:mobile) } .col-xs-12.mt-3.mt-sm-0.pl-3.pr-3 = f.file_field :profile_header, label: t('views.settings.profile.header') - .row#profile-header-crop-controls{style: 'display: none;'} + .row#profile-header-crop-controls{ style: 'display: none;' } .col-sm-10.col-md-8 %strong= t('views.settings.profile.header_adjust') - %img#profile-header-cropper{src: current_user.profile_header.url(:web)} + %img#profile-header-cropper{ src: current_user.profile_header.url(:web) } .col-sm-2.col-md-4 .btn-group - %button#cropper-header-zoom-out.btn.btn-inverse{type: :button} + %button.btn.btn-inverse#cropper-header-zoom-out{ type: :button } %i.fa.fa-search-minus - %button#cropper-header-zoom-in.btn.btn-inverse{type: :button} + %button.btn.btn-inverse#cropper-header-zoom-in{ type: :button } %i.fa.fa-search-plus = f.text_field :motivation_header, label: t('views.settings.profile.motivation'), placeholder: t('views.settings.profile.placeholder.motivation') @@ -48,10 +48,10 @@ = f.check_box :show_foreign_themes, label: 'Render other user themes when visiting their profile' - - for attrib in %i(crop_x crop_y crop_w crop_h) + - %i[crop_x crop_y crop_w crop_h].each do |attrib| = f.hidden_field attrib, id: attrib - - for attrib in %i(crop_h_x crop_h_y crop_h_w crop_h_h) + - %i[crop_h_x crop_h_y crop_h_w crop_h_h].each do |attrib| = f.hidden_field attrib, id: attrib - = f.submit t('views.actions.save'), class: 'btn btn-primary' \ No newline at end of file + = f.submit t('views.actions.save'), class: 'btn btn-primary' diff --git a/app/views/settings/_services.haml b/app/views/settings/_services.haml index 6967f0fc..be9c7493 100644 --- a/app/views/settings/_services.haml +++ b/app/views/settings/_services.haml @@ -1,19 +1,22 @@ .card .card-body - - if @services.count > 0 + - if @services.count.positive? = t 'views.settings.service.enabled' - else = t 'views.settings.service.none' - APP_CONFIG['sharing'].each do |service, service_options| - - if service_options['enabled'] and !@services.any? { |x| x.provider == service.to_s } - %p=link_to t('views.settings.service.connect', service: service.capitalize), "/auth/#{service}" + - if service_options['enabled'] && @services.none? { |x| x.provider == service.to_s } + %p= link_to t('views.settings.service.connect', service: service.capitalize), "/auth/#{service}" - - if @services.count > 0 + - if @services.count.positive? %ul.list-group - @services.each do |service| %li.list-group-item - %i{class: "fa fa-#{service.provider}"} + %i{ class: "fa fa-#{service.provider}" } %strong= service.provider.capitalize (#{service.nickname}) - = link_to t('views.settings.service.disconnect'), service_path(service), data: { confirm: t('views.settings.service.confirm', service: service.provider.capitalize) }, method: :delete \ No newline at end of file + = link_to t('views.settings.service.disconnect'), + service_path(service), + data: { confirm: t('views.settings.service.confirm', service: service.provider.capitalize) }, + method: :delete diff --git a/app/views/settings/_theme.haml b/app/views/settings/_theme.haml index 53f4ba6f..7debd0fa 100644 --- a/app/views/settings/_theme.haml +++ b/app/views/settings/_theme.haml @@ -2,19 +2,19 @@ .card-body %h1 Theming %p.lead Welcome to the Theme Editor! - %p - Here you'll be able to modify your Retrospring experience by adjusting all available colors. - To further help you with adjusting needs, there are a few example elements using the specified colors, and sections will include + %p + Here you'll be able to modify your Retrospring experience by adjusting all available colors. + To further help you with adjusting needs, there are a few example elements using the specified colors, and sections will include descriptions on their general use on the site! - %p + %p And with that: %b Happy Theming! - + - if current_user.theme .pull-right - = button_to 'Delete Theme', delete_user_theme_path, data: { confirm: "Are you sure?" }, tabindex: -1, method: :delete, class: "btn btn-danger" -= bootstrap_form_for(current_user.theme || Theme.new, url: {action: "update_theme"}, html: {id: 'update_theme'}, method: "patch") do |f| + = button_to 'Delete Theme', delete_user_theme_path, data: { confirm: 'Are you sure?' }, tabindex: -1, method: :delete, class: 'btn btn-danger' += bootstrap_form_for(current_user.theme || Theme.new, url: { action: 'update_theme' }, html: { id: 'update_theme' }, method: 'patch') do |f| .card .card-body %h2 General @@ -22,9 +22,9 @@ Here you'll find general page values that are basically visible all across the page. .row .col-sm-6 - = f.text_field :background_color, class: 'color', data: {default: 0xF0EDF4} + = f.text_field :background_color, class: 'color', data: { default: 0xF0EDF4 } .col-sm-6 - = f.text_field :body_text, class: 'color', data: {default: 0x000000} + = f.text_field :body_text, class: 'color', data: { default: 0x000000 } .card .card-body %h2 Colors @@ -50,61 +50,61 @@ Color used for messages if something went through successfully. .row .col-sm-6 - = f.text_field :primary_color, class: 'color', data: {default: 0x5E35B1} + = f.text_field :primary_color, class: 'color', data: { default: 0x5E35B1 } .col-sm-6 - = f.text_field :primary_text, class: 'color', data: {default: 0xFFFFFF} + = f.text_field :primary_text, class: 'color', data: { default: 0xFFFFFF } .col-sm-12 .alert.alert-primary A simple primary alert—check it out! .row .col-sm-6 - = f.text_field :danger_color, class: 'color', data: {default: 0xDC3545} + = f.text_field :danger_color, class: 'color', data: { default: 0xDC3545 } .col-sm-6 - = f.text_field :danger_text, class: 'color', data: {default: 0xFFFFFF} + = f.text_field :danger_text, class: 'color', data: { default: 0xFFFFFF } .col-sm-12 .alert.alert-danger A simple danger alert—check it out! .row .col-sm-6 - = f.text_field :warning_color, class: 'color', data: {default: 0xFFC107} + = f.text_field :warning_color, class: 'color', data: { default: 0xFFC107 } .col-sm-6 - = f.text_field :warning_text, class: 'color', data: {default: 0x292929} + = f.text_field :warning_text, class: 'color', data: { default: 0x292929 } .col-sm-12 .alert.alert-warning A simple warning alert—check it out! .row .col-sm-6 - = f.text_field :info_color, class: 'color', data: {default: 0x17A2B8} + = f.text_field :info_color, class: 'color', data: { default: 0x17A2B8 } .col-sm-6 - = f.text_field :info_text, class: 'color', data: {default: 0xFFFFFF} + = f.text_field :info_text, class: 'color', data: { default: 0xFFFFFF } .col-sm-12 .alert.alert-info A simple info alert—check it out! .row .col-sm-6 - = f.text_field :success_color, class: 'color', data: {default: 0x28A745} + = f.text_field :success_color, class: 'color', data: { default: 0x28A745 } .col-sm-6 - = f.text_field :success_text, class: 'color', data: {default: 0xFFFFFF} + = f.text_field :success_text, class: 'color', data: { default: 0xFFFFFF } .col-sm-12 .alert.alert-success A simple success alert—check it out! .row .col-sm-6 - = f.text_field :dark_color, class: 'color', data: {default: 0x343A40} + = f.text_field :dark_color, class: 'color', data: { default: 0x343A40 } .col-sm-6 - = f.text_field :dark_text, class: 'color', data: {default: 0xFFFFFF} + = f.text_field :dark_text, class: 'color', data: { default: 0xFFFFFF } .col-sm-12 %a.btn.btn-dark.mb-3{ href: '#' } A dark button .row .col-sm-6 - = f.text_field :light_color, class: 'color', data: {default: 0xF8F9FA} + = f.text_field :light_color, class: 'color', data: { default: 0xF8F9FA } .col-sm-6 - = f.text_field :light_text, class: 'color', data: {default: 0xFFFFFF} + = f.text_field :light_text, class: 'color', data: { default: 0xFFFFFF } .col-sm-12 %a.btn.btn-light.mb-3{ href: '#' } A light button .row .col-sm-6 - = f.text_field :muted_text, class: 'color', data: {default: 0x6C757D} + = f.text_field :muted_text, class: 'color', data: { default: 0x6C757D } .col-sm-6 %p.pt-4.text-muted Some muted text .card @@ -114,9 +114,9 @@ Styles for form inputs, like textfields. .row .col-sm-6 - = f.text_field :input_color, class: 'color', data: {default: 0xFFFFFF} + = f.text_field :input_color, class: 'color', data: { default: 0xFFFFFF } .col-sm-6 - = f.text_field :input_text, class: 'color', data: {default: 0x000000} + = f.text_field :input_text, class: 'color', data: { default: 0x000000 } .card .card-body %h2 Raised Content @@ -124,9 +124,9 @@ Raised content basically describes all the different boxes and panels you can see across the site. .row .col-sm-6 - = f.text_field :raised_background, class: 'color', data: {default: 0xFFFFFF} + = f.text_field :raised_background, class: 'color', data: { default: 0xFFFFFF } .col-sm-6 - = f.text_field :raised_accent, class: 'color', data: {default: 0xF7F7F7} + = f.text_field :raised_accent, class: 'color', data: { default: 0xF7F7F7 } .card-footer %p Some text on top of a accented area on a raised element! .card