From 1eafdf5755cbe41d123ca7e870f065e839d5dd15 Mon Sep 17 00:00:00 2001 From: Ryan Shaw Date: Fri, 30 Mar 2018 13:41:33 -0600 Subject: [PATCH] Handle RTL in inline styles Closes: CORE-1243 These are all the places that we are using in line styles that w ould be affected in right to left. This change does absolutely nothing to our existing left to right CSS it just flips it in right to left. Test plan: Because this change does not change anything for our left-to-right users We can safely merge it without having to manually check these pages Just likewe did With the other automated CSS changes Change-Id: I62841f4b47925b4d9594c3ca914fa3e5d53fd7b0 Reviewed-on: https://gerrit.instructure.com/145447 Tested-by: Jenkins Reviewed-by: Clay Diffrient Product-Review: Ryan Shaw QA-Review: Ryan Shaw --- app/helpers/application_helper.rb | 6 +++ .../_ldap_settings_test.html.erb | 12 ++--- app/views/accounts/_course.html.erb | 2 +- app/views/accounts/avatars.html.erb | 4 +- app/views/accounts/settings.html.erb | 14 +++--- app/views/accounts/sis_import.html.erb | 4 +- app/views/accounts/statistics.html.erb | 14 +++--- .../_peer_review_assignment.html.erb | 2 +- .../assignments/_submission_sidebar.html.erb | 2 +- .../assignments/_submit_assignment.html.erb | 14 +++--- .../_submit_online_text_entry.html.erb | 2 +- .../assignments/_syllabus_content.html.erb | 2 +- app/views/assignments/peer_reviews.html.erb | 6 +-- .../_full_calendar_event.html.erb | 2 +- .../_quiz_export_checklist.html.erb | 2 +- app/views/context/roster_user.html.erb | 8 ++-- .../context/roster_user_services.html.erb | 6 +-- app/views/context/roster_user_usage.html.erb | 4 +- app/views/context/undelete_index.html.erb | 6 +-- .../context_modules/_content_next.html.erb | 2 +- app/views/context_modules/url_show.html.erb | 2 +- app/views/courses/_recent_feedback.html.erb | 2 +- app/views/courses/settings.html.erb | 8 ++-- app/views/courses/statistics.html.erb | 10 ++-- app/views/discussion_topics/_entry.html.erb | 4 +- .../discussion_topics/_sub_entry.html.erb | 2 +- app/views/eportfolios/_eportfolio.html.erb | 2 +- app/views/eportfolios/_page_comment.html.erb | 2 +- app/views/eportfolios/_page_list.html.erb | 2 +- app/views/eportfolios/_page_section.html.erb | 2 +- app/views/eportfolios/_section_list.html.erb | 2 +- app/views/eportfolios/show.html.erb | 42 ++++++++-------- app/views/eportfolios/user_index.html.erb | 2 +- app/views/errors/index.html.erb | 2 +- app/views/gradebook_uploads/show.html.erb | 4 +- app/views/gradebooks/_grading_box.html.erb | 8 ++-- app/views/gradebooks/grade_summary.html.erb | 12 ++--- .../gradebooks/gradezilla/gradebook.html.erb | 2 +- .../gradebooks/gradezilla/individual.html.erb | 2 +- .../submissions_zip_upload.html.erb | 6 +-- app/views/jobs/index.html.erb | 20 ++++---- app/views/layouts/_fixed_bottom.html.erb | 2 +- app/views/layouts/application.html.erb | 2 +- .../outcomes/user_outcome_results.html.erb | 6 +-- app/views/page_views/_table.html.erb | 2 +- app/views/profile/profile.html.erb | 48 +++++++++---------- .../confirm_change_password.html.erb | 2 +- app/views/question_banks/index.html.erb | 8 ++-- .../quizzes/_display_question.html.erb | 2 +- .../quizzes/_find_question_from_bank.html.erb | 4 +- .../quizzes/quizzes/_form_answer.html.erb | 2 +- .../quizzes/quizzes/_form_question.html.erb | 8 ++-- .../quizzes/quizzes/_multi_answer.html.erb | 2 +- .../quizzes/quizzes/_question_group.html.erb | 2 +- .../quizzes/quizzes/_quiz_edit_header.erb | 2 +- .../quizzes/quizzes/_quiz_edit_questions.erb | 2 +- .../quizzes/quizzes/_quiz_right_side.html.erb | 4 +- .../quizzes/quizzes/_quiz_submission.html.erb | 4 +- .../quizzes/_take_quiz_right_side.html.erb | 2 +- app/views/quizzes/quizzes/show.html.erb | 4 +- app/views/sections/show.html.erb | 22 ++++----- app/views/shared/_find_outcome.html.erb | 4 +- app/views/shared/_global_dialogs.html.erb | 2 +- app/views/shared/_grading_standard.html.erb | 24 +++++----- app/views/shared/_inline_preview.html.erb | 10 ++-- app/views/shared/_rubric.html.erb | 8 ++-- app/views/shared/_rubric_criterion.html.erb | 2 +- app/views/shared/_rubric_dialog.html.erb | 8 ++-- app/views/shared/_rubric_summary.html.erb | 2 +- app/views/shared/_submission_comment.html.erb | 4 +- app/views/shared/_user_lists.html.erb | 6 +-- app/views/shared/_wiki_sidebar.html.erb | 2 +- app/views/submissions/show.html.erb | 20 ++++---- app/views/submissions/show_preview.html.erb | 2 +- app/views/user_notes/user_notes.html.erb | 4 +- app/views/users/_enrollment.html.erb | 4 +- app/views/users/_name.html.erb | 2 +- app/views/users/admin_merge.html.erb | 10 ++-- app/views/users/grades.html.erb | 2 +- app/views/users/show.html.erb | 12 ++--- app/views/users/teacher_activity.html.erb | 2 +- 81 files changed, 259 insertions(+), 253 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f8333ef3a83..f0d9bce4632 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -248,6 +248,12 @@ module ApplicationHelper @current_user.try(:feature_enabled?, :force_rtl) || (@domain_root_account.try(:feature_enabled?, :allow_rtl) && I18n.rtl?) end + # this is exactly the same as our sass helper with the same name + # see: https://www.npmjs.com/package/sass-direction + def direction(left_or_right) + use_rtl? ? {'left' => 'right', 'right' => 'left'}[left_or_right] : left_or_right + end + def css_variant(opts = {}) variant = use_responsive_layout? ? 'responsive_layout' : 'new_styles' use_high_contrast = @current_user && @current_user.prefers_high_contrast? || opts[:force_high_contrast] diff --git a/app/views/account_authorization_configs/_ldap_settings_test.html.erb b/app/views/account_authorization_configs/_ldap_settings_test.html.erb index ac3bfa8e1fd..586a3ad7c7e 100644 --- a/app/views/account_authorization_configs/_ldap_settings_test.html.erb +++ b/app/views/account_authorization_configs/_ldap_settings_test.html.erb @@ -80,7 +80,7 @@ ldap_tests << OpenStruct.new(

<%= t(:test_ldap_dialog_page_title, "Testing Your LDAP Configuration") %>

- +
<% ldap_tests.each do |test| %> @@ -89,7 +89,7 @@ ldap_tests << OpenStruct.new( - @@ -144,7 +144,7 @@ ldap_tests << OpenStruct.new(

<%= test.label %>

<%= password_field :ldap_test_login, :pass, style: "width:170px" %> + "/>
-
- diff --git a/app/views/accounts/_course.html.erb b/app/views/accounts/_course.html.erb index f59135978af..953fdae2ccd 100644 --- a/app/views/accounts/_course.html.erb +++ b/app/views/accounts/_course.html.erb @@ -32,7 +32,7 @@ <% if course %>
- + <%= show_code_and_term_for(course) %> diff --git a/app/views/accounts/avatars.html.erb b/app/views/accounts/avatars.html.erb index a8fcce08f3e..cdc0ee3bce1 100644 --- a/app/views/accounts/avatars.html.erb +++ b/app/views/accounts/avatars.html.erb @@ -38,13 +38,13 @@ padding: 2px 0; } #avatars td.link_holder { - text-align: right; + text-align: <%= direction('right') %>; } <% end %>

<%= t(:title, "Profile Pictures") %>

- <%= before_label :show, 'Show' %> + <%= before_label :show, 'Show' %> <%= t(:submitted_link, { :zero => "Submitted", :one => "Submitted %{count}", :other => "Submitted %{count}" }, :count => @avatar_counts[:submitted] || 0) %> | <%= t(:reported_link, { :zero => "Reported", :one => "Reported %{count}", :other => "Reported %{count}" }, :count => @avatar_counts[:reported] || 0) %> | <%= t(:re_reported_link, { :zero => "Approved, Re-Reported", :one => "Approved, Re-Reported %{count}", :other => "Approved, Re-Reported %{count}"}, :count => @avatar_counts[:re_reported] || 0) %> | diff --git a/app/views/accounts/settings.html.erb b/app/views/accounts/settings.html.erb index a63e550c460..7f768c3b02c 100644 --- a/app/views/accounts/settings.html.erb +++ b/app/views/accounts/settings.html.erb @@ -41,7 +41,7 @@ } fieldset.nested { margin-top: 0; - margin-left: 20px; + margin-<%= direction('left') %>: 20px; } legend{ font-size: 1.1em; @@ -696,10 +696,10 @@ acknowledge that you have read and agreed to the :class => 'notification_from_name_option' %> <%= settings.label :outgoing_email_default_name_option_default, :en => "Default Canvas Setting" %>
-
+
: 2em;'> <%= t 'notifications.example', 'Example:' %>
- +
: 1.5em;'> @@ -729,17 +729,17 @@ acknowledge that you have read and agreed to the :class => 'notification_from_name_option' %> <%= settings.label :outgoing_email_default_name_option_custom, :en => 'Custom "From" Name' %> -
+
: 2em;'>

<%= t('notifications.custom_name_description', 'If selected, this will replace all other branding sent in Canvas notifications.') %>
<%= text_field_tag 'account[settings][outgoing_email_default_name]', @account.settings[:outgoing_email_default_name] %>

-
+
: 2em;'> <%= t 'notifications.example', 'Example:' %>
-
<%= t 'notifications.from', 'From' %> <%= HostUrl.outgoing_email_default_name %> <%= '' %>
+
: 1.5em;'> @@ -775,7 +775,7 @@ acknowledge that you have read and agreed to the
<%= t 'notifications.from', 'From' %> <%= '' %>
- +
- + - + - + - + @@ -70,7 +70,7 @@ :file_size => number_to_human_size(@counts_report['files_size'] || 0), :count => @counts_report['files'], :wrapper => '\1') %> - + @@ -79,7 +79,7 @@ :file_size => number_to_human_size(@counts_report['media_files_size'] || 0), :count => @counts_report['media_files'], :wrapper => '\1') %> - +
<%= t('notifications.external_services_warning_label', 'Pop-up Message Content:') %> diff --git a/app/views/accounts/sis_import.html.erb b/app/views/accounts/sis_import.html.erb index bff774dee79..b3e59abd04e 100644 --- a/app/views/accounts/sis_import.html.erb +++ b/app/views/accounts/sis_import.html.erb @@ -72,7 +72,7 @@ <%= mt(:override_sis_stickiness_instructions, "By default, UI changes have priority over SIS import changes; for a number of fields, the SIS import will not change that field's data if an admin has changed that field through the UI. If you select this option, this SIS import will override UI changes. \nSee the documentation for details.") %>

-
+

@@ -80,7 +80,7 @@ "With this option selected, changes made through this SIS import will be processed as if they are UI changes, preventing subsequent non-overriding SIS imports from changing the fields changed here.") %>

-
+

diff --git a/app/views/accounts/statistics.html.erb b/app/views/accounts/statistics.html.erb index 4efa5b85ba4..da441663ecf 100644 --- a/app/views/accounts/statistics.html.erb +++ b/app/views/accounts/statistics.html.erb @@ -41,22 +41,22 @@

<%= before_label(:courses, "Courses") %> <%= n(@counts_report['courses']) %>"><%= t(:over_time_link, "over time") %>"><%= t(:over_time_link, "over time") %>
<%= before_label(:teachers, "Teachers") %> <%= n(@counts_report['teachers']) %>"><%= t(:over_time_link, "over time") %>"><%= t(:over_time_link, "over time") %>
<%= before_label(:students, "Students") %> <%= n(@counts_report['students']) %>"><%= t(:over_time_link, "over time") %>"><%= t(:over_time_link, "over time") %>
<%= before_label(:users, "Users") %> <%= n(@counts_report['users']) %>"><%= t(:over_time_link, "over time") %>"><%= t(:over_time_link, "over time") %>
<%= t(:file_storage_header, "File Storage") %>"><%= t(:over_time_link, "over time") %>"><%= t(:over_time_link, "over time") %>
  <%= before_label(:media_storage, "Media") %>"><%= t(:over_time_link, "over time") %>"><%= t(:over_time_link, "over time") %>
<% end %> @@ -155,7 +155,7 @@