summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSacred Seven <sacred.seven@yahoo.com>2014-12-20 19:59:00 +0330
committerSacred Seven <sacred.seven@yahoo.com>2014-12-20 19:59:00 +0330
commit02f3c7eb64777dc8bb31db216783a1096f65a2f3 (patch)
tree612287d56d3cbe0f54ed5362fcd9d138a19d6230
parent2bfeb280ed8837ed2562290d8c2d9155f97ed9fe (diff)
downloadgitlab-ce-02f3c7eb64777dc8bb31db216783a1096f65a2f3.tar.gz
Fixing email and markdown RTL
closes #1
-rw-r--r--app/assets/javascripts/application.js.coffee3
-rw-r--r--app/helpers/gitlab_markdown_helper.rb4
-rw-r--r--app/views/notify/_note_message.html.haml8
-rw-r--r--app/views/notify/new_issue_email.html.haml8
-rw-r--r--app/views/notify/new_merge_request_email.html.haml8
-rw-r--r--app/views/notify/repository_push_email.html.haml8
6 files changed, 3 insertions, 36 deletions
diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee
index 7aa99b64ca4..fa0edfe7059 100644
--- a/app/assets/javascripts/application.js.coffee
+++ b/app/assets/javascripts/application.js.coffee
@@ -182,9 +182,6 @@ $ ->
toggleClass('fa fa-chevron-up')
$(@).closest(".diff-file").find(".notes_holder").toggle()
e.preventDefault()
-
- # RTL Support in wiki pages
- $('.wiki').find('*').not('li').attr('dir', 'auto');
$(document).on "click", '.js-confirm-danger', (e) ->
e.preventDefault()
diff --git a/app/helpers/gitlab_markdown_helper.rb b/app/helpers/gitlab_markdown_helper.rb
index 7d3cb749829..f00d8828f60 100644
--- a/app/helpers/gitlab_markdown_helper.rb
+++ b/app/helpers/gitlab_markdown_helper.rb
@@ -48,7 +48,9 @@ module GitlabMarkdownHelper
space_after_headers: true,
superscript: true)
end
- @markdown.render(text).html_safe
+ html_doc = Nokogiri::HTML(@markdown.render(text))
+ html_doc.css(':not(li)').each { |dom| dom[:dir] = :auto }
+ html_doc.to_html.html_safe
end
# Return the first line of +text+, up to +max_chars+, after parsing the line
diff --git a/app/views/notify/_note_message.html.haml b/app/views/notify/_note_message.html.haml
index 1de6ccfba0b..5272dfa0ede 100644
--- a/app/views/notify/_note_message.html.haml
+++ b/app/views/notify/_note_message.html.haml
@@ -1,10 +1,2 @@
%div
= markdown(@note.note)
-
-:javascript
- document.addEventListener("DOMContentLoaded", function(event) {
- var elements = document.getElementsByTagName("*");
- for (var i = 0; i < elements.length; ++i) {
- elements[i].setAttribute("dir", "auto");
- }
- });
diff --git a/app/views/notify/new_issue_email.html.haml b/app/views/notify/new_issue_email.html.haml
index bef1bff4fe0..f3637ef1c2a 100644
--- a/app/views/notify/new_issue_email.html.haml
+++ b/app/views/notify/new_issue_email.html.haml
@@ -5,11 +5,3 @@
%p
Assignee:
%span= @issue.assignee_name
-
-:javascript
- document.addEventListener("DOMContentLoaded", function(event) {
- var elements = document.getElementsByTagName("*");
- for (var i = 0; i < elements.length; ++i) {
- elements[i].setAttribute("dir", "auto");
- }
- });
diff --git a/app/views/notify/new_merge_request_email.html.haml b/app/views/notify/new_merge_request_email.html.haml
index c4cbee44b1e..fe1bd3444bb 100644
--- a/app/views/notify/new_merge_request_email.html.haml
+++ b/app/views/notify/new_merge_request_email.html.haml
@@ -10,11 +10,3 @@
-if @merge_request.description
= markdown(@merge_request.description)
-
-:javascript
- document.addEventListener("DOMContentLoaded", function(event) {
- var elements = document.getElementsByTagName("*");
- for (var i = 0; i < elements.length; ++i) {
- elements[i].setAttribute("dir", "auto");
- }
- });
diff --git a/app/views/notify/repository_push_email.html.haml b/app/views/notify/repository_push_email.html.haml
index bd9f97e73c8..3cf50bf0826 100644
--- a/app/views/notify/repository_push_email.html.haml
+++ b/app/views/notify/repository_push_email.html.haml
@@ -26,11 +26,3 @@
- if @compare.timeout
%h5 Huge diff. To prevent performance issues changes are hidden
-
-:javascript
- document.addEventListener("DOMContentLoaded", function(event) {
- var elements = document.getElementsByTagName("*");
- for (var i = 0; i < elements.length; ++i) {
- elements[i].setAttribute("dir", "auto");
- }
- });