Added haml-lint and fix warnings (#2773)

* add haml_lint to Gemfile

* add .haml-lint.yml

* fix warnings of haml_lint
lolsob-rspec
yhirano 2017-05-08 10:35:25 +09:00 committed by Eugen Rochko
parent 4557bf1255
commit cf1f65bf58
39 changed files with 207 additions and 90 deletions

108
.haml-lint.yml Normal file
View File

@ -0,0 +1,108 @@
# Whether to ignore frontmatter at the beginning of HAML documents for
# frameworks such as Jekyll/Middleman
skip_frontmatter: false
exclude:
- 'vendor/**/*'
- 'spec/**/*'
- 'lib/templates/**/*'
- 'app/views/kaminari/**/*'
linters:
AltText:
enabled: false
ClassAttributeWithStaticValue:
enabled: true
ClassesBeforeIds:
enabled: true
ConsecutiveComments:
enabled: true
ConsecutiveSilentScripts:
enabled: true
max_consecutive: 2
EmptyObjectReference:
enabled: true
EmptyScript:
enabled: true
FinalNewline:
enabled: true
present: true
HtmlAttributes:
enabled: true
ImplicitDiv:
enabled: true
LeadingCommentSpace:
enabled: true
LineLength:
enabled: false
max: 80
MultilinePipe:
enabled: true
MultilineScript:
enabled: true
ObjectReferenceAttributes:
enabled: true
RuboCop:
enabled: true
# These cops are incredibly noisy when it comes to HAML templates, so we
# ignore them.
ignored_cops:
- Lint/BlockAlignment
- Lint/EndAlignment
- Lint/Void
- Metrics/BlockLength
- Metrics/LineLength
- Style/AlignParameters
- Style/BlockNesting
- Style/ElseAlignment
- Style/EndOfLine
- Style/FileName
- Style/FinalNewline
- Style/FrozenStringLiteralComment
- Style/IfUnlessModifier
- Style/IndentationWidth
- Style/Next
- Style/TrailingBlankLines
- Style/TrailingWhitespace
- Style/WhileUntilModifier
RubyComments:
enabled: true
SpaceBeforeScript:
enabled: true
SpaceInsideHashAttributes:
enabled: true
style: space
Indentation:
enabled: true
character: space # or tab
TagName:
enabled: true
TrailingWhitespace:
enabled: true
UnnecessaryInterpolation:
enabled: true
UnnecessaryStringOutput:
enabled: true

View File

@ -89,6 +89,7 @@ group :development do
gem 'brakeman', '~> 3.6.0', require: false gem 'brakeman', '~> 3.6.0', require: false
gem 'bundler-audit', '~> 0.4.0', require: false gem 'bundler-audit', '~> 0.4.0', require: false
gem 'scss_lint', '0.42.2', require: false gem 'scss_lint', '0.42.2', require: false
gem 'haml_lint', '~> 0.19.0', require: false
gem 'capistrano', '3.8.0' gem 'capistrano', '3.8.0'
gem 'capistrano-rails' gem 'capistrano-rails'

View File

@ -157,6 +157,13 @@ GEM
addressable (~> 2.4) addressable (~> 2.4)
http (~> 2.0) http (~> 2.0)
nokogiri (~> 1.6) nokogiri (~> 1.6)
haml (4.0.7)
tilt
haml_lint (0.19.0)
haml (~> 4.0)
rake (>= 10, < 13)
rubocop (>= 0.36.0)
sysexits (~> 1.1)
hamlit (2.8.1) hamlit (2.8.1)
temple (>= 0.8.0) temple (>= 0.8.0)
thor thor
@ -431,6 +438,7 @@ GEM
net-scp (>= 1.1.2) net-scp (>= 1.1.2)
net-ssh (>= 2.8.0) net-ssh (>= 2.8.0)
statsd-instrument (2.1.2) statsd-instrument (2.1.2)
sysexits (1.2.0)
temple (0.8.0) temple (0.8.0)
terminal-table (1.7.3) terminal-table (1.7.3)
unicode-display_width (~> 1.1.1) unicode-display_width (~> 1.1.1)
@ -495,6 +503,7 @@ DEPENDENCIES
fast_blank fast_blank
fuubar fuubar
goldfinger goldfinger
haml_lint (~> 0.19.0)
hamlit-rails hamlit-rails
hiredis hiredis
htmlentities htmlentities

View File

@ -7,7 +7,7 @@
.name .name
= link_to TagManager.instance.url_for(contact.contact_account) do = link_to TagManager.instance.url_for(contact.contact_account) do
%span.display_name.emojify= display_name(contact.contact_account) %span.display_name.emojify= display_name(contact.contact_account)
%span.username= "@#{contact.contact_account.acct}" %span.username @#{contact.contact_account.acct}
- if contact.site_contact_email - if contact.site_contact_email
.contact-email .contact-email

View File

@ -11,12 +11,12 @@
required: true, required: true,
input_html: { 'aria-label' => t('simple_form.labels.defaults.email') } input_html: { 'aria-label' => t('simple_form.labels.defaults.email') }
= f.input :password, = f.input :password,
autocomplete: "off", autocomplete: 'off',
placeholder: t('simple_form.labels.defaults.password'), placeholder: t('simple_form.labels.defaults.password'),
required: true, required: true,
input_html: { 'aria-label' => t('simple_form.labels.defaults.password') } input_html: { 'aria-label' => t('simple_form.labels.defaults.password') }
= f.input :password_confirmation, = f.input :password_confirmation,
autocomplete: "off", autocomplete: 'off',
placeholder: t('simple_form.labels.defaults.confirm_password'), placeholder: t('simple_form.labels.defaults.confirm_password'),
required: true, required: true,
input_html: { 'aria-label' => t('simple_form.labels.defaults.confirm_password') } input_html: { 'aria-label' => t('simple_form.labels.defaults.confirm_password') }

View File

@ -8,7 +8,7 @@
%h2= site_hostname %h2= site_hostname
- unless @instance_presenter.site_description.blank? - unless @instance_presenter.site_description.blank?
%p= @instance_presenter.site_description.html_safe %p!= @instance_presenter.site_description
.information-board .information-board
.section .section
@ -25,7 +25,7 @@
%span= t 'about.domain_count_after' %span= t 'about.domain_count_after'
- unless @instance_presenter.site_extended_description.blank? - unless @instance_presenter.site_extended_description.blank?
.panel= @instance_presenter.site_extended_description.html_safe .panel!= @instance_presenter.site_extended_description
.sidebar .sidebar
= render 'contact', contact: @instance_presenter = render 'contact', contact: @instance_presenter

View File

@ -20,7 +20,7 @@
= image_tag asset_pack_path('logo.png') = image_tag asset_pack_path('logo.png')
= Setting.site_title = Setting.site_title
%p= t('about.about_mastodon').html_safe %p!= t('about.about_mastodon')
.screenshot-with-signup .screenshot-with-signup
.mascot= image_tag asset_pack_path('fluffy-elephant-friend.png') .mascot= image_tag asset_pack_path('fluffy-elephant-friend.png')
@ -32,7 +32,7 @@
- if @instance_presenter.closed_registrations_message.blank? - if @instance_presenter.closed_registrations_message.blank?
%p= t('about.closed_registrations') %p= t('about.closed_registrations')
- else - else
= @instance_presenter.closed_registrations_message.html_safe != @instance_presenter.closed_registrations_message
.info .info
= link_to t('auth.login'), new_user_session_path, class: 'webapp-btn' = link_to t('auth.login'), new_user_session_path, class: 'webapp-btn'
· ·
@ -74,7 +74,7 @@
- unless @instance_presenter.site_description.blank? - unless @instance_presenter.site_description.blank?
%h3= t('about.description_headline', domain: site_hostname) %h3= t('about.description_headline', domain: site_hostname)
%p= @instance_presenter.site_description.html_safe %p!= @instance_presenter.site_description
.actions .actions
.info .info

View File

@ -4,5 +4,5 @@
.name .name
= link_to TagManager.instance.url_for(account) do = link_to TagManager.instance.url_for(account) do
%span.display_name.emojify= display_name(account) %span.display_name.emojify= display_name(account)
%span.username= "@#{account.acct}" %span.username @#{account.acct}
%p.note.emojify= truncate(strip_tags(account.note), length: 150) %p.note.emojify= truncate(strip_tags(account.note), length: 150)

View File

@ -1,4 +1,4 @@
.card.h-card.p-author{ style: "background-image: url(#{account.header.url( :original)})" } .card.h-card.p-author{ style: "background-image: url(#{account.header.url(:original)})" }
- if user_signed_in? && current_account.id != account.id && !current_account.requested?(account) - if user_signed_in? && current_account.id != account.id && !current_account.requested?(account)
.controls .controls
- if current_account.following?(account) - if current_account.following?(account)
@ -13,7 +13,7 @@
%h1.name %h1.name
%span.p-name.emojify= display_name(account) %span.p-name.emojify= display_name(account)
%small %small
%span= "@#{account.username}" %span @#{account.username}
= fa_icon('lock') if account.locked? = fa_icon('lock') if account.locked?
.details .details
.bio .bio

View File

@ -6,7 +6,7 @@
%tr %tr
%td= t('admin.accounts.show.targeted_reports') %td= t('admin.accounts.show.targeted_reports')
%td= link_to pluralize(account.targeted_reports.count, t('admin.accounts.show.report')), admin_reports_path(target_account_id: account.id) %td= link_to pluralize(account.targeted_reports.count, t('admin.accounts.show.report')), admin_reports_path(target_account_id: account.id)
- if account.silenced? or account.suspended? - if account.silenced? || account.suspended?
%tr %tr
%td= t('admin.accounts.moderation.title') %td= t('admin.accounts.moderation.title')
%td %td

View File

@ -6,15 +6,15 @@
%td.reporter %td.reporter
= link_to report.account.acct, admin_account_path(report.account.id) = link_to report.account.acct, admin_account_path(report.account.id)
%td.comment %td.comment
%span{title: report.comment} %span{ title: report.comment }
= truncate(report.comment, length: 30, separator: ' ') = truncate(report.comment, length: 30, separator: ' ')
%td.stats %td.stats
- unless report.statuses.empty? - unless report.statuses.empty?
%span{title: t('admin.accounts.statuses')} %span{ title: t('admin.accounts.statuses') }
= fa_icon('comment') = fa_icon('comment')
= report.statuses.count = report.statuses.count
- unless report.media_attachments.empty? - unless report.media_attachments.empty?
%span{title: t('admin.accounts.media_attachments')} %span{ title: t('admin.accounts.media_attachments') }
= fa_icon('camera') = fa_icon('camera')
= report.media_attachments.count = report.media_attachments.count
%td %td

View File

@ -5,7 +5,7 @@
%table.table %table.table
%thead %thead
%tr %tr
%th{width: '40%'} %th{ width: '40%' }
= t('admin.settings.setting') = t('admin.settings.setting')
%th %th
%tbody %tbody

View File

@ -1,3 +1,3 @@
- user_facing_flashes.each do |key, value| - user_facing_flashes.each do |key, value|
.flash-message{class: key} .flash-message{ class: key }
%strong= value %strong= value

View File

@ -9,4 +9,4 @@
.actions .actions
= f.button :button, t('auth.resend_confirmation'), type: :submit = f.button :button, t('auth.resend_confirmation'), type: :submit
.form-footer= render "auth/shared/links" .form-footer= render 'auth/shared/links'

View File

@ -5,10 +5,10 @@
= render 'shared/error_messages', object: resource = render 'shared/error_messages', object: resource
= f.input :reset_password_token, as: :hidden = f.input :reset_password_token, as: :hidden
= f.input :password, autofocus: true, autocomplete: "off", placeholder: t('simple_form.labels.defaults.new_password'), input_html: { 'aria-label' => t('simple_form.labels.defaults.new_password') } = f.input :password, autofocus: true, autocomplete: 'off', placeholder: t('simple_form.labels.defaults.new_password'), input_html: { 'aria-label' => t('simple_form.labels.defaults.new_password') }
= f.input :password_confirmation, autocomplete: "off", placeholder: t('simple_form.labels.defaults.confirm_new_password'), input_html: { 'aria-label' => t('simple_form.labels.defaults.confirm_new_password') } = f.input :password_confirmation, autocomplete: 'off', placeholder: t('simple_form.labels.defaults.confirm_new_password'), input_html: { 'aria-label' => t('simple_form.labels.defaults.confirm_new_password') }
.actions .actions
= f.button :button, t('auth.set_new_password'), type: :submit = f.button :button, t('auth.set_new_password'), type: :submit
.form-footer= render "devise/shared/links" .form-footer= render 'devise/shared/links'

View File

@ -9,4 +9,4 @@
.actions .actions
= f.button :button, t('auth.reset_password'), type: :submit = f.button :button, t('auth.reset_password'), type: :submit
.form-footer= render "auth/shared/links" .form-footer= render 'auth/shared/links'

View File

@ -5,9 +5,9 @@
= render 'shared/error_messages', object: resource = render 'shared/error_messages', object: resource
= f.input :email, placeholder: t('simple_form.labels.defaults.email'), input_html: { 'aria-label' => t('simple_form.labels.defaults.email') } = f.input :email, placeholder: t('simple_form.labels.defaults.email'), input_html: { 'aria-label' => t('simple_form.labels.defaults.email') }
= f.input :password, autocomplete: "off", placeholder: t('simple_form.labels.defaults.new_password'), input_html: { 'aria-label' => t('simple_form.labels.defaults.new_password') } = f.input :password, autocomplete: 'off', placeholder: t('simple_form.labels.defaults.new_password'), input_html: { 'aria-label' => t('simple_form.labels.defaults.new_password') }
= f.input :password_confirmation, autocomplete: "off", placeholder: t('simple_form.labels.defaults.confirm_new_password'), input_html: { 'aria-label' => t('simple_form.labels.defaults.confirm_new_password') } = f.input :password_confirmation, autocomplete: 'off', placeholder: t('simple_form.labels.defaults.confirm_new_password'), input_html: { 'aria-label' => t('simple_form.labels.defaults.confirm_new_password') }
= f.input :current_password, autocomplete: "off", placeholder: t('simple_form.labels.defaults.current_password'), input_html: { 'aria-label' => t('simple_form.labels.defaults.current_password') } = f.input :current_password, autocomplete: 'off', placeholder: t('simple_form.labels.defaults.current_password'), input_html: { 'aria-label' => t('simple_form.labels.defaults.current_password') }
.actions .actions
= f.button :button, t('generic.save_changes'), type: :submit = f.button :button, t('generic.save_changes'), type: :submit

View File

@ -8,10 +8,10 @@
= ff.input :username, autofocus: true, placeholder: t('simple_form.labels.defaults.username'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.username') } = ff.input :username, autofocus: true, placeholder: t('simple_form.labels.defaults.username'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.username') }
= f.input :email, placeholder: t('simple_form.labels.defaults.email'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.email') } = f.input :email, placeholder: t('simple_form.labels.defaults.email'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.email') }
= f.input :password, autocomplete: "off", placeholder: t('simple_form.labels.defaults.password'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.password') } = f.input :password, autocomplete: 'off', placeholder: t('simple_form.labels.defaults.password'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.password') }
= f.input :password_confirmation, autocomplete: "off", placeholder: t('simple_form.labels.defaults.confirm_password'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.confirm_password') } = f.input :password_confirmation, autocomplete: 'off', placeholder: t('simple_form.labels.defaults.confirm_password'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.confirm_password') }
.actions .actions
= f.button :button, t('auth.register'), type: :submit = f.button :button, t('auth.register'), type: :submit
.form-footer= render "auth/shared/links" .form-footer= render 'auth/shared/links'

View File

@ -8,4 +8,4 @@
.actions .actions
= f.button :button, t('auth.login'), type: :submit = f.button :button, t('auth.login'), type: :submit
.form-footer= render "auth/shared/links" .form-footer= render 'auth/shared/links'

View File

@ -9,4 +9,4 @@
.actions .actions
= f.button :button, t('auth.login'), type: :submit = f.button :button, t('auth.login'), type: :submit
.form-footer= render "auth/shared/links" .form-footer= render 'auth/shared/links'

View File

@ -6,7 +6,7 @@
%span.display-name %span.display-name
= link_to TagManager.instance.url_for(account), class: 'detailed-status__display-name p-author h-card', target: '_blank', rel: 'noopener' do = link_to TagManager.instance.url_for(account), class: 'detailed-status__display-name p-author h-card', target: '_blank', rel: 'noopener' do
%strong.emojify= display_name(account) %strong.emojify= display_name(account)
%span= "@#{account.acct}" %span @#{account.acct}
- if account.note? - if account.note?
.account__header__content.emojify= Formatter.instance.simplified_format(account) .account__header__content.emojify= Formatter.instance.simplified_format(account)

View File

@ -1,6 +1,6 @@
- content_for :header_tags do - content_for :header_tags do
%script#initial-state{:type => 'application/json'}!= json_escape(render(file: 'home/initial_state', formats: :json)) %script#initial-state{ type: 'application/json' }!= json_escape(render(file: 'home/initial_state', formats: :json))
= javascript_pack_tag 'application', integrity: true, crossorigin: 'anonymous' = javascript_pack_tag 'application', integrity: true, crossorigin: 'anonymous'
.app-holder#mastodon{ data: { props: Oj.dump(default_props) }} .app-holder#mastodon{ data: { props: Oj.dump(default_props) } }

View File

@ -17,4 +17,4 @@
= yield = yield
= render template: "layouts/application", locals: { body_classes: 'admin' } = render template: 'layouts/application', locals: { body_classes: 'admin' }

View File

@ -1,17 +1,16 @@
!!! 5 !!! 5
%html{:lang => I18n.locale} %html{ lang: I18n.locale }
%head %head
%meta{:charset => 'utf-8'}/ %meta{ charset: 'utf-8' }/
%meta{:name => 'viewport', :content => 'width=device-width, initial-scale=1'}/ %meta{ name: 'viewport', content: 'width=device-width, initial-scale=1' }/
%meta{'http-equiv' => 'X-UA-Compatible', :content => 'IE=edge'}/ %meta{ 'http-equiv' => 'X-UA-Compatible', content: 'IE=edge' }/
%link{ rel: 'icon', href: favicon_path, type: 'image/x-icon' }/
%link{:rel => "icon", :href => favicon_path, :type => "image/x-icon"}/ %link{ rel: 'apple-touch-icon', sizes: '180x180', href: '/apple-touch-icon.png' }/
%link{:rel => "apple-touch-icon", :sizes => "180x180", :href => "/apple-touch-icon.png"}/ %link{ rel: 'mask-icon', href: '/mask-icon.svg', color: '#2B90D9' }/
%link{:rel => "mask-icon", :href => "/mask-icon.svg", :color => "#2B90D9"}/ %link{ rel: 'manifest', href: '/manifest.json' }/
%link{:rel => "manifest", :href => "/manifest.json"}/ %meta{ name: 'msapplication-config', content: '/browserconfig.xml' }/
%meta{:name => "msapplication-config", :content => "/browserconfig.xml"}/ %meta{ name: 'theme-color', content: '#282c37' }/
%meta{:name => "theme-color", :content => "#282c37"}/ %meta{ name: 'apple-mobile-web-app-capable', content: 'yes' }/
%meta{:name => "apple-mobile-web-app-capable", :content => "yes"}/
%title< %title<
- if content_for?(:page_title) - if content_for?(:page_title)

View File

@ -13,4 +13,4 @@
= yield = yield
= render template: "layouts/application" = render template: 'layouts/application'

View File

@ -1,7 +1,7 @@
!!! 5 !!! 5
%html{:lang => I18n.locale} %html{ lang: I18n.locale }
%head %head
%meta{:charset => 'utf-8'}/ %meta{ charset: 'utf-8' }/
= stylesheet_link_tag 'application', media: 'all' = stylesheet_link_tag 'application', media: 'all'
= javascript_pack_tag 'public', integrity: true, crossorigin: 'anonymous' = javascript_pack_tag 'public', integrity: true, crossorigin: 'anonymous'
%body.embed %body.embed

View File

@ -1,11 +1,11 @@
!!! !!!
%html{:lang => I18n.locale} %html{ lang: I18n.locale }
%head %head
%meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/ %meta{ content: 'text/html; charset=UTF-8', 'http-equiv' => 'Content-Type' }/
%meta{:charset => "utf-8"}/ %meta{ charset: 'utf-8' }/
%title= yield :page_title %title= yield :page_title
%meta{:content => "width=device-width,initial-scale=1", :name => "viewport"}/ %meta{ content: 'width=device-width,initial-scale=1', name: 'viewport' }/
%link{:href => "https://fonts.googleapis.com/css?family=Roboto:400", :rel => "stylesheet"}/ %link{ href: 'https://fonts.googleapis.com/css?family=Roboto:400', rel: 'stylesheet' }/
:css :css
body { body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
@ -31,6 +31,6 @@
} }
%body %body
.dialog .dialog
%img{:alt => "Mastodon", :src => "/oops.png"}/ %img{ alt: 'Mastodon', src: '/oops.png' }/
%div %div
%h1= yield :content %h1= yield :content

View File

@ -7,9 +7,9 @@
- if !user_signed_in? && single_user_mode? - if !user_signed_in? && single_user_mode?
%span.single-user-login %span.single-user-login
= link_to t('auth.login'), new_user_session_path = link_to t('auth.login'), new_user_session_path
= "\u2014" \u2014
%span.domain= link_to site_hostname, root_path %span.domain= link_to site_hostname, root_path
%span.powered-by %span.powered-by
= t('generic.powered_by', link: link_to('Mastodon', 'https://github.com/tootsuite/mastodon')).html_safe != t('generic.powered_by', link: link_to('Mastodon', 'https://github.com/tootsuite/mastodon'))
= render template: "layouts/application" = render template: 'layouts/application'

View File

@ -7,7 +7,7 @@
%p %p
= t('doorkeeper.authorizations.new.able_to') = t('doorkeeper.authorizations.new.able_to')
= @pre_auth.scopes.map { |scope| t(scope, scope: [:doorkeeper, :scopes]) }.map { |s| "<strong>#{s}</strong>"}.to_sentence.html_safe != @pre_auth.scopes.map { |scope| t(scope, scope: [:doorkeeper, :scopes]) }.map { |s| "<strong>#{s}</strong>" }.to_sentence
= form_tag oauth_authorization_path, method: :post, class: 'simple_form' do = form_tag oauth_authorization_path, method: :post, class: 'simple_form' do
= hidden_field_tag :client_id, @pre_auth.client.uid = hidden_field_tag :client_id, @pre_auth.client.uid

View File

@ -16,7 +16,7 @@
= application.name = application.name
- else - else
= link_to application.name, application.website, target: '_blank', rel: 'noopener' = link_to application.name, application.website, target: '_blank', rel: 'noopener'
%th= application.scopes.map { |scope| t(scope, scope: [:doorkeeper, :scopes]) }.join('<br />').html_safe %th!= application.scopes.map { |scope| t(scope, scope: [:doorkeeper, :scopes]) }.join('<br />')
%td= l application.created_at %td= l application.created_at
%td %td
- unless application.superapp? - unless application.superapp?

View File

@ -5,8 +5,8 @@
= render 'shared/error_messages', object: @account = render 'shared/error_messages', object: @account
.fields-group .fields-group
= f.input :display_name, placeholder: t('simple_form.labels.defaults.display_name'), hint: t('simple_form.hints.defaults.display_name', counter: "<span class=\"name-counter\">#{30-@account.display_name.size}</span>").html_safe = f.input :display_name, placeholder: t('simple_form.labels.defaults.display_name'), hint: t('simple_form.hints.defaults.display_name', counter: "<span class=\"name-counter\">#{30 - @account.display_name.size}</span>").html_safe
= f.input :note, placeholder: t('simple_form.labels.defaults.note'), hint: t('simple_form.hints.defaults.note', counter: "<span class=\"note-counter\">#{160-@account.note.size}</span>").html_safe = f.input :note, placeholder: t('simple_form.labels.defaults.note'), hint: t('simple_form.hints.defaults.note', counter: "<span class=\"note-counter\">#{160 - @account.note.size}</span>").html_safe
= f.input :avatar, wrapper: :with_label, hint: t('simple_form.hints.defaults.avatar') = f.input :avatar, wrapper: :with_label, hint: t('simple_form.hints.defaults.avatar')
= f.input :header, wrapper: :with_label, hint: t('simple_form.hints.defaults.header') = f.input :header, wrapper: :with_label, hint: t('simple_form.hints.defaults.header')

View File

@ -5,7 +5,7 @@
%p.hint= t('two_factor_authentication.instructions_html') %p.hint= t('two_factor_authentication.instructions_html')
.qr-wrapper .qr-wrapper
.qr-code= raw @qrcode.as_svg(padding: 0, module_size: 4) .qr-code!= @qrcode.as_svg(padding: 0, module_size: 4)
.qr-alternative .qr-alternative
%p.hint= t('two_factor_authentication.manual_instructions') %p.hint= t('two_factor_authentication.manual_instructions')

View File

@ -1,7 +1,7 @@
.detailed-status.light .detailed-status.light
= link_to TagManager.instance.url_for(status.account), class: 'detailed-status__display-name p-author h-card', target: stream_link_target, rel: 'noopener' do = link_to TagManager.instance.url_for(status.account), class: 'detailed-status__display-name p-author h-card', target: stream_link_target, rel: 'noopener' do
%div %div
%div.avatar .avatar
= image_tag status.account.avatar.url(:original), width: 48, height: 48, alt: '', class: 'u-photo' = image_tag status.account.avatar.url(:original), width: 48, height: 48, alt: '', class: 'u-photo'
%span.display-name %span.display-name
%strong.p-name.emojify= display_name(status.account) %strong.p-name.emojify= display_name(status.account)
@ -10,16 +10,16 @@
.status__content.p-name.emojify< .status__content.p-name.emojify<
- if status.spoiler_text? - if status.spoiler_text?
%p{ style: 'margin-bottom: 0' }< %p{ style: 'margin-bottom: 0' }<
%span.p-summary>= "#{status.spoiler_text} " %span.p-summary> #{status.spoiler_text}&nbsp;
%a.status__content__spoiler-link{ href: '#' }= t('statuses.show_more') %a.status__content__spoiler-link{ href: '#' }= t('statuses.show_more')
%div.e-content{ lang: status.language, style: "display: #{status.spoiler_text? ? 'none' : 'block'}; direction: #{rtl?(status.content) ? 'rtl' : 'ltr'}" }= Formatter.instance.format(status) .e-content{ lang: status.language, style: "display: #{status.spoiler_text? ? 'none' : 'block'}; direction: #{rtl?(status.content) ? 'rtl' : 'ltr'}" }= Formatter.instance.format(status)
- unless status.media_attachments.empty? - unless status.media_attachments.empty?
- if status.media_attachments.first.video? - if status.media_attachments.first.video?
.video-player .video-player
- if status.sensitive? - if status.sensitive?
= render partial: 'stream_entries/content_spoiler' = render partial: 'stream_entries/content_spoiler'
%video{ src: status.media_attachments.first.file.url(:original), loop: true, class: 'u-video' } %video.u-video{ src: status.media_attachments.first.file.url(:original), loop: true }
- else - else
.detailed-status__attachments .detailed-status__attachments
- if status.sensitive? - if status.sensitive?
@ -28,7 +28,7 @@
- status.media_attachments.each do |media| - status.media_attachments.each do |media|
= render partial: 'stream_entries/media', locals: { media: media } = render partial: 'stream_entries/media', locals: { media: media }
%div.detailed-status__meta .detailed-status__meta
%data.dt-published{ value: status.created_at.to_time.iso8601 } %data.dt-published{ value: status.created_at.to_time.iso8601 }
= link_to TagManager.instance.url_for(status), class: 'detailed-status__datetime u-url u-uid', target: stream_link_target, rel: 'noopener' do = link_to TagManager.instance.url_for(status), class: 'detailed-status__datetime u-url u-uid', target: stream_link_target, rel: 'noopener' do
%time{ datetime: status.created_at.iso8601, title: l(status.created_at), data: { format: t('time.formats.default') } }= l(status.created_at) %time{ datetime: status.created_at.iso8601, title: l(status.created_at), data: { format: t('time.formats.default') } }= l(status.created_at)

View File

@ -1,4 +1,4 @@
.media-item .media-item
= link_to media.remote_url.blank? ? media.file.url(:original) : media.remote_url, style: media.image? ? "background-image: url(#{media.file.url(:original)})" : "", target: '_blank', rel: 'noopener', class: "u-#{media.video? || media.gifv? ? 'video' : 'photo'}" do = link_to media.remote_url.blank? ? media.file.url(:original) : media.remote_url, style: media.image? ? "background-image: url(#{media.file.url(:original)})" : '', target: '_blank', rel: 'noopener', class: "u-#{media.video? || media.gifv? ? 'video' : 'photo'}" do
- unless media.image? - unless media.image?
%video{ src: media.file.url(:original), autoplay: true, loop: true }/ %video{ src: media.file.url(:original), autoplay: true, loop: true }/

View File

@ -16,9 +16,9 @@
.status__content.p-name.emojify< .status__content.p-name.emojify<
- if status.spoiler_text? - if status.spoiler_text?
%p{ style: 'margin-bottom: 0' }< %p{ style: 'margin-bottom: 0' }<
%span.p-summary>= "#{status.spoiler_text} " %span.p-summary> #{status.spoiler_text}&nbsp;
%a.status__content__spoiler-link{ href: '#' }= t('statuses.show_more') %a.status__content__spoiler-link{ href: '#' }= t('statuses.show_more')
%div.e-content{ lang: status.language, style: "display: #{status.spoiler_text? ? 'none' : 'block'}; direction: #{rtl?(status.content) ? 'rtl' : 'ltr'}" }= Formatter.instance.format(status) .e-content{ lang: status.language, style: "display: #{status.spoiler_text? ? 'none' : 'block'}; direction: #{rtl?(status.content) ? 'rtl' : 'ltr'}" }= Formatter.instance.format(status)
- unless status.media_attachments.empty? - unless status.media_attachments.empty?
.status__attachments .status__attachments

View File

@ -1,25 +1,25 @@
- include_threads ||= false :ruby
- is_predecessor ||= false include_threads ||= false
- is_successor ||= false is_predecessor ||= false
- direct_reply_id ||= false is_successor ||= false
- parent_id ||= false direct_reply_id ||= false
- is_direct_parent = direct_reply_id == status.id parent_id ||= false
- is_direct_child = parent_id == status.in_reply_to_id is_direct_parent = direct_reply_id == status.id
- parent_id ||= false is_direct_child = parent_id == status.in_reply_to_id
- centered ||= include_threads && !is_predecessor && !is_successor centered ||= include_threads && !is_predecessor && !is_successor
- h_class = microformats_h_class(status, is_predecessor, is_successor, include_threads) h_class = microformats_h_class(status, is_predecessor, is_successor, include_threads)
- style_classes = style_classes(status, is_predecessor, is_successor, include_threads) style_classes = style_classes(status, is_predecessor, is_successor, include_threads)
- mf_classes = microformats_classes(status, is_direct_parent, is_direct_child) mf_classes = microformats_classes(status, is_direct_parent, is_direct_child)
- entry_classes = h_class + ' ' + mf_classes + ' ' + style_classes entry_classes = h_class + ' ' + mf_classes + ' ' + style_classes
- if status.reply? && include_threads - if status.reply? && include_threads
= render partial: 'stream_entries/status', collection: @ancestors, as: :status, locals: { is_predecessor: true, direct_reply_id: status.in_reply_to_id} = render partial: 'stream_entries/status', collection: @ancestors, as: :status, locals: { is_predecessor: true, direct_reply_id: status.in_reply_to_id }
.entry{ class: entry_classes } .entry{ class: entry_classes }
- if status.reblog? - if status.reblog?
.pre-header .pre-header
%div.pre-header__icon .pre-header__icon
= fa_icon('retweet fw') = fa_icon('retweet fw')
%span %span
= link_to TagManager.instance.url_for(status.account), class: 'status__display-name muted' do = link_to TagManager.instance.url_for(status.account), class: 'status__display-name muted' do
@ -29,4 +29,4 @@
= render (centered ? 'stream_entries/detailed_status' : 'stream_entries/simple_status'), status: status.proper = render (centered ? 'stream_entries/detailed_status' : 'stream_entries/simple_status'), status: status.proper
- if include_threads - if include_threads
= render partial: 'stream_entries/status', collection: @descendants, as: :status, locals: { is_successor: true, parent_id: status.id} = render partial: 'stream_entries/status', collection: @descendants, as: :status, locals: { is_successor: true, parent_id: status.id }

View File

@ -4,7 +4,7 @@
.compact-header .compact-header
%h1< %h1<
= link_to site_title, root_path = link_to site_title, root_path
%small= "##{@tag.name}" %small ##{@tag.name}
- if @statuses.empty? - if @statuses.empty?
.accounts-grid .accounts-grid