From ac092d03e7a781d27aff9cb9ea4637be9c5f2a2a Mon Sep 17 00:00:00 2001 From: M Somerville Date: Fri, 24 Aug 2018 22:55:41 +0100 Subject: Add missing video descriptions (#8416) * Pass through video description as necessary. * Add title to video, matching aria-label. --- app/views/admin/reports/_status.html.haml | 2 +- app/views/stream_entries/_detailed_status.html.haml | 2 +- app/views/stream_entries/_simple_status.html.haml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'app/views') diff --git a/app/views/admin/reports/_status.html.haml b/app/views/admin/reports/_status.html.haml index 5b410ec84..4d557b071 100644 --- a/app/views/admin/reports/_status.html.haml +++ b/app/views/admin/reports/_status.html.haml @@ -14,7 +14,7 @@ - unless status.proper.media_attachments.empty? - if status.proper.media_attachments.first.video? - video = status.proper.media_attachments.first - = react_component :video, src: video.file.url(:original), preview: video.file.url(:small), sensitive: status.proper.sensitive? && !current_account&.user&.setting_display_sensitive_media, width: 610, height: 343, inline: true + = react_component :video, src: video.file.url(:original), preview: video.file.url(:small), sensitive: status.proper.sensitive? && !current_account&.user&.setting_display_sensitive_media, width: 610, height: 343, inline: true, alt: video.description - else = react_component :media_gallery, height: 343, sensitive: status.proper.sensitive? && !current_account&.user&.setting_display_sensitive_media, 'autoPlayGif': current_account&.user&.setting_auto_play_gif, media: status.proper.media_attachments.map { |a| ActiveModelSerializers::SerializableResource.new(a, serializer: REST::MediaAttachmentSerializer).as_json } diff --git a/app/views/stream_entries/_detailed_status.html.haml b/app/views/stream_entries/_detailed_status.html.haml index a7c767816..7843005c1 100644 --- a/app/views/stream_entries/_detailed_status.html.haml +++ b/app/views/stream_entries/_detailed_status.html.haml @@ -21,7 +21,7 @@ - if !status.media_attachments.empty? - if status.media_attachments.first.video? - video = status.media_attachments.first - = react_component :video, src: video.file.url(:original), preview: video.file.url(:small), sensitive: status.sensitive? && !current_account&.user&.setting_display_sensitive_media, width: 670, height: 380, detailed: true, inline: true + = react_component :video, src: video.file.url(:original), preview: video.file.url(:small), sensitive: status.sensitive? && !current_account&.user&.setting_display_sensitive_media, width: 670, height: 380, detailed: true, inline: true, alt: video.description - else = react_component :media_gallery, height: 380, sensitive: status.sensitive? && !current_account&.user&.setting_display_sensitive_media, standalone: true, 'autoPlayGif': current_account&.user&.setting_auto_play_gif, 'reduceMotion': current_account&.user&.setting_reduce_motion, media: status.media_attachments.map { |a| ActiveModelSerializers::SerializableResource.new(a, serializer: REST::MediaAttachmentSerializer).as_json } - elsif status.preview_cards.first diff --git a/app/views/stream_entries/_simple_status.html.haml b/app/views/stream_entries/_simple_status.html.haml index ec8b69bb6..875795f2a 100644 --- a/app/views/stream_entries/_simple_status.html.haml +++ b/app/views/stream_entries/_simple_status.html.haml @@ -24,7 +24,7 @@ - unless status.media_attachments.empty? - if status.media_attachments.first.video? - video = status.media_attachments.first - = react_component :video, src: video.file.url(:original), preview: video.file.url(:small), sensitive: status.sensitive? && !current_account&.user&.setting_display_sensitive_media, width: 610, height: 343, inline: true + = react_component :video, src: video.file.url(:original), preview: video.file.url(:small), sensitive: status.sensitive? && !current_account&.user&.setting_display_sensitive_media, width: 610, height: 343, inline: true, alt: video.description - else = react_component :media_gallery, height: 343, sensitive: status.sensitive? && !current_account&.user&.setting_display_sensitive_media, 'autoPlayGif': current_account&.user&.setting_auto_play_gif, media: status.media_attachments.map { |a| ActiveModelSerializers::SerializableResource.new(a, serializer: REST::MediaAttachmentSerializer).as_json } -- cgit From 29da56cf75c1381b31a8b26738a94eff482f8099 Mon Sep 17 00:00:00 2001 From: M Somerville Date: Sat, 25 Aug 2018 12:26:17 +0100 Subject: Hide reject media checkbox when not relevant. (#8426) --- app/javascript/packs/admin.js | 7 +++++++ app/views/admin/domain_blocks/new.html.haml | 3 +++ 2 files changed, 10 insertions(+) (limited to 'app/views') diff --git a/app/javascript/packs/admin.js b/app/javascript/packs/admin.js index 5dbcc03d3..ce5f70ee7 100644 --- a/app/javascript/packs/admin.js +++ b/app/javascript/packs/admin.js @@ -39,3 +39,10 @@ delegate(document, '.media-spoiler-hide-button', 'click', () => { element.click(); }); }); + +delegate(document, '#domain_block_severity', 'change', ({ target }) => { + const rejectMediaDiv = document.querySelector('.input.with_label.domain_block_reject_media'); + if (rejectMediaDiv) { + rejectMediaDiv.style.display = (target.value === 'suspend') ? 'none' : 'block'; + } +}); diff --git a/app/views/admin/domain_blocks/new.html.haml b/app/views/admin/domain_blocks/new.html.haml index 38fa90169..2b8b24e23 100644 --- a/app/views/admin/domain_blocks/new.html.haml +++ b/app/views/admin/domain_blocks/new.html.haml @@ -1,3 +1,6 @@ +- content_for :header_tags do + = javascript_pack_tag 'admin', integrity: true, async: true, crossorigin: 'anonymous' + - content_for :page_title do = t('.title') -- cgit From 22e46ebad84111f2a0eeb935ec05ba44a99ab2ba Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 25 Aug 2018 22:55:25 +0200 Subject: Add theme identifier to body classes for easier custom CSS styling (#8439) Add forgotten custom CSS admin setting strings --- app/helpers/application_helper.rb | 14 +++++++++----- app/views/layouts/application.html.haml | 6 +----- config/locales/en.yml | 3 +++ spec/helpers/application_helper_spec.rb | 10 +++++----- 4 files changed, 18 insertions(+), 15 deletions(-) (limited to 'app/views') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 327901e4e..9eb042938 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -27,11 +27,6 @@ module ApplicationHelper Setting.open_deletion end - def add_rtl_body_class(other_classes) - other_classes = "#{other_classes} rtl" if locale_direction == 'rtl' - other_classes - end - def locale_direction if [:ar, :fa, :he].include?(I18n.locale) 'rtl' @@ -77,4 +72,13 @@ module ApplicationHelper def react_component(name, props = {}) content_tag(:div, nil, data: { component: name.to_s.camelcase, props: Oj.dump(props) }) end + + def body_classes + output = (@body_classes || '').split(' ') + output << "theme-#{current_theme.parameterize}" + output << 'system-font' if current_account&.user&.setting_system_font_ui + output << current_account&.user&.setting_reduce_motion ? 'reduce-motion' : 'no-reduce-motion' + output << 'rtl' if locale_direction == 'rtl' + output.reject(&:blank?).join(' ') + end end diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 68a903197..436864237 100755 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -24,9 +24,5 @@ = yield :header_tags - - body_classes ||= @body_classes || '' - - body_classes += ' system-font' if current_account&.user&.setting_system_font_ui - - body_classes += current_account&.user&.setting_reduce_motion ? ' reduce-motion' : ' no-reduce-motion' - - %body{ class: add_rtl_body_class(body_classes) } + %body{ class: body_classes } = content_for?(:content) ? yield(:content) : yield diff --git a/config/locales/en.yml b/config/locales/en.yml index 5e127dc71..d8a1086e4 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -350,6 +350,9 @@ en: contact_information: email: Business e-mail username: Contact username + custom_css: + desc_html: Modify the look with CSS loaded on every page + title: Custom CSS hero: desc_html: Displayed on the frontpage. At least 600x100px recommended. When not set, falls back to instance thumbnail title: Hero image diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index ac54f1f70..3ccd96f44 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -17,7 +17,7 @@ describe ApplicationHelper do end end - describe 'add_rtl_body_class' do + describe 'locale_direction' do around do |example| current_locale = I18n.locale example.run @@ -26,22 +26,22 @@ describe ApplicationHelper do it 'adds rtl body class if locale is Arabic' do I18n.locale = :ar - expect(helper.add_rtl_body_class('other classes')).to eq 'other classes rtl' + expect(helper.locale_direction).to eq 'rtl' end it 'adds rtl body class if locale is Farsi' do I18n.locale = :fa - expect(helper.add_rtl_body_class('other classes')).to eq 'other classes rtl' + expect(helper.locale_direction).to eq 'rtl' end it 'adds rtl if locale is Hebrew' do I18n.locale = :he - expect(helper.add_rtl_body_class('other classes')).to eq 'other classes rtl' + expect(helper.locale_direction).to eq 'rtl' end it 'does not add rtl if locale is Thai' do I18n.locale = :th - expect(helper.add_rtl_body_class('other classes')).to eq 'other classes' + expect(helper.locale_direction).to_not eq 'rtl' end end -- cgit From 104d089df16214855cf3860671f022f7d2520a51 Mon Sep 17 00:00:00 2001 From: Tad Thorley Date: Sun, 26 Aug 2018 06:33:59 -0600 Subject: Update _bio.html.haml (#8449) On my local instance (https://ruby.social) we have a custom emoji for octocat (:octocat:). I would love to be able to use the emoji in the metadata for my profile. Instead of: | github | https://github.com/phaedryx It could be: | :octocat: | https://github.com/phaedryx (using a single emoji makes it easier to read the urls) --- app/views/accounts/_bio.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/views') diff --git a/app/views/accounts/_bio.html.haml b/app/views/accounts/_bio.html.haml index c9a4d8f1b..4e674beff 100644 --- a/app/views/accounts/_bio.html.haml +++ b/app/views/accounts/_bio.html.haml @@ -3,7 +3,7 @@ .account__header__fields - account.fields.each do |field| %dl - %dt.emojify{ title: field.name }= field.name + %dt.emojify{ title: field.name }= Formatter.instance.format_field(account, field.name, custom_emojify: true) %dd.emojify{ title: field.value }= Formatter.instance.format_field(account, field.value, custom_emojify: true) = account_badge(account) -- cgit