diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 95991435a..600022c09 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -283,4 +283,12 @@ module ApplicationHelper defaults end + + def direction_for(string) + return (string.cleaned_is_rtl?) ? 'rtl' : '' + end + + def rtl? + @rtl ||= RTL_LANGUAGES.include? I18n.locale + end end diff --git a/app/views/comments/_comment.html.haml b/app/views/comments/_comment.html.haml index c9af008d7..ad635af13 100644 --- a/app/views/comments/_comment.html.haml +++ b/app/views/comments/_comment.html.haml @@ -13,5 +13,5 @@ %time.timeago{:datetime => comment.created_at} = comment.created_at ? timeago(comment.created_at) : timeago(Time.now) - %p + %p{ :class => direction_for(comment.text) } = markdownify(comment.text, :youtube_maps => comment.youtube_titles) diff --git a/app/views/comments/_comment.mobile.haml b/app/views/comments/_comment.mobile.haml index c81e0ff93..6056839f0 100644 --- a/app/views/comments/_comment.mobile.haml +++ b/app/views/comments/_comment.mobile.haml @@ -14,5 +14,6 @@ .content .from = person_link(comment.author) - = markdownify(comment.text, :youtube_maps => comment[:youtube_titles]) + %p{ :class => direction_for(comment.text) } + = markdownify(comment.text, :youtube_maps => comment[:youtube_titles]) diff --git a/app/views/conversations/_conversation.haml b/app/views/conversations/_conversation.haml index 0b7b84a75..72bc1baa6 100644 --- a/app/views/conversations/_conversation.haml +++ b/app/views/conversations/_conversation.haml @@ -10,7 +10,8 @@ .message_count = conversation.messages.size - = conversation.subject[0..30] + %div{ :class => direction_for(conversation.subject) } + = conversation.subject[0..30] .last_author .timestamp diff --git a/app/views/conversations/_show.haml b/app/views/conversations/_show.haml index 2feb8fbdc..ff1797a32 100644 --- a/app/views/conversations/_show.haml +++ b/app/views/conversations/_show.haml @@ -6,7 +6,7 @@ .span-16.last .conversation_participants .span-9 - %h3 + %h3{ :class => direction_for(conversation.subject) } = conversation.subject .conversation_controls diff --git a/app/views/invitations/edit.html.haml b/app/views/invitations/edit.html.haml index 42c526137..92569452d 100644 --- a/app/views/invitations/edit.html.haml +++ b/app/views/invitations/edit.html.haml @@ -1,7 +1,7 @@ = javascript_include_tag "validation" :javascript $(function() { - $('#user_new [title]').tipsy({trigger: 'focus', gravity: 'w'}); + $('#user_new [title]').tipsy({trigger: 'focus', gravity: ($('html').attr('dir') == 'rtl') ? 'e' : 'w'}); $("#user_username").focus(); }); diff --git a/app/views/invitations/new.html.haml b/app/views/invitations/new.html.haml index 2cd92a0e4..28b3d56fd 100644 --- a/app/views/invitations/new.html.haml +++ b/app/views/invitations/new.html.haml @@ -1,6 +1,6 @@ :javascript $(function() { - $('#new_user [title]').tipsy({trigger: 'focus', gravity: 'w'}); + $('#new_user [title]').tipsy({trigger: 'focus', gravity: ($('html').attr('dir') == 'rtl') ? 'e' : 'w'}); $("#user_email").focus(); }); diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index f59d9832b..d94d4582a 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -3,7 +3,7 @@ -# the COPYRIGHT file. !!! -%html{:lang => I18n.locale.to_s} +%html{:lang => I18n.locale.to_s, :dir => (rtl?) ? 'rtl' : 'ltr'} %head %meta{:charset => 'utf-8'} @@ -22,6 +22,8 @@ = stylesheet_link_tag "blueprint/screen", :media => 'screen' = stylesheet_link_tag "blueprint/print", :media => 'print' = include_stylesheets :default, :media => 'all' + - if rtl? + = include_stylesheets :rtl, :media => 'all'