mirror of https://github.com/django/django.git
fixed #2128: updated BiDi support
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3121 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
ece252ed0f
commit
4fcb72d306
|
@ -1,5 +0,0 @@
|
||||||
@import url('base.css');
|
|
||||||
|
|
||||||
body {
|
|
||||||
direction: rtl;
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
@import url('login.css');
|
|
||||||
@import url('base_rtl.css');
|
|
||||||
@import url('layout_rtl.css');
|
|
||||||
|
|
||||||
.login .form-row { float:right; }
|
|
||||||
.login .form-row label { float:right; padding-left:0.5em; padding-right:0; text-align:left;}
|
|
||||||
.login .submit-row { clear:both; padding:1em 9.4em 0 0; }
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
body { direction: rtl; }
|
||||||
|
|
||||||
|
/* login styles */
|
||||||
|
|
||||||
|
.login .form-row { float:right; }
|
||||||
|
.login .form-row label { float:right; padding-left:0.5em; padding-right:0; text-align:left;}
|
||||||
|
.login .submit-row { clear:both; padding:1em 9.4em 0 0; }
|
||||||
|
|
||||||
|
|
||||||
|
/* global styles */
|
||||||
|
th { text-align: right; }
|
||||||
|
.module h2, .module caption { text-align: right; }
|
||||||
|
.addlink, .changelink { padding-left:0px; padding-right:12px; background-position:100% 0.2em; }
|
||||||
|
.deletelink { padding-left:0px; padding-right:12px; background-position:100% 0.25em; }
|
||||||
|
.object-tools { float:left; }
|
||||||
|
|
||||||
|
|
||||||
|
/* layout styles */
|
||||||
|
#user-tools { right:auto; left:0; text-align:left; }
|
||||||
|
div.breadcrumbs { text-align:right; }
|
||||||
|
#content-main { float:right;}
|
||||||
|
#content-related { float:left; margin-left:-19em; margin-right:auto;}
|
||||||
|
.colMS { margin-left:20em !important; margin-right:10px !important;}
|
||||||
|
|
||||||
|
/* dashboard styles */
|
||||||
|
.dashboard .module table td a { padding-left:.6em; padding-right:12px; }
|
||||||
|
|
||||||
|
/* changelists styles */
|
||||||
|
.change-list .filtered { background:white url(../img/admin/changelist-bg_rtl.gif) top left repeat-y !important; }
|
||||||
|
.change-list .filtered table { border-left:1px solid #ddd; border-right:0px none; }
|
||||||
|
#changelist-filter { right:auto; left:0; border-left:0px none; border-right:1px solid #ddd;}
|
||||||
|
.change-list .filtered table, .change-list .filtered .paginator, .filtered #toolbar, .filtered div.xfull { margin-right:0px !important; margin-left:160px !important; }
|
||||||
|
#changelist-filter li.selected { border-left:0px none; padding-left:0px; margin-left:0; border-right:5px solid #ccc; padding-right:5px;margin-right:-10px; }
|
||||||
|
|
||||||
|
/* fomrs styles */
|
||||||
|
.aligned label { padding:0 0 3px 1em; float:right; }
|
||||||
|
.submit-row { text-align: left }
|
||||||
|
.vDateField, .vTimeField { margin-left:2px; }
|
||||||
|
|
||||||
|
/* widget styles */
|
||||||
|
.calendarnav-previous { top:0; left:auto; right:0; }
|
||||||
|
.calendarnav-next { top:0; right:auto; left:0;}
|
||||||
|
.calendar caption, .calendarbox h2 { text-align:center; }
|
||||||
|
|
||||||
|
.selector { float: right;}
|
||||||
|
.selector .selector-filter { text-align: right;}
|
|
@ -69,7 +69,16 @@ var DateTimeShortcuts = {
|
||||||
var clock_box = document.createElement('div');
|
var clock_box = document.createElement('div');
|
||||||
clock_box.style.display = 'none';
|
clock_box.style.display = 'none';
|
||||||
clock_box.style.position = 'absolute';
|
clock_box.style.position = 'absolute';
|
||||||
|
if (getStyle(document.body,'direction')!='rtl') {
|
||||||
clock_box.style.left = findPosX(clock_link) + 17 + 'px';
|
clock_box.style.left = findPosX(clock_link) + 17 + 'px';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// since style's width is in em, it'd be tough to calculate
|
||||||
|
// px value of it. let's use an estimated px for now
|
||||||
|
// TODO: IE returns wrong value for findPosX when in rtl mode
|
||||||
|
// (it returns as it was left aligned), needs to be fixed.
|
||||||
|
clock_box.style.left = findPosX(clock_link) - 110 + 'px';
|
||||||
|
}
|
||||||
clock_box.style.top = findPosY(clock_link) - 30 + 'px';
|
clock_box.style.top = findPosY(clock_link) - 30 + 'px';
|
||||||
clock_box.className = 'clockbox module';
|
clock_box.className = 'clockbox module';
|
||||||
clock_box.setAttribute('id', DateTimeShortcuts.clockDivName + num);
|
clock_box.setAttribute('id', DateTimeShortcuts.clockDivName + num);
|
||||||
|
@ -140,7 +149,17 @@ var DateTimeShortcuts = {
|
||||||
var cal_box = document.createElement('div');
|
var cal_box = document.createElement('div');
|
||||||
cal_box.style.display = 'none';
|
cal_box.style.display = 'none';
|
||||||
cal_box.style.position = 'absolute';
|
cal_box.style.position = 'absolute';
|
||||||
|
// is it left-to-right or right-to-left layout ?
|
||||||
|
if (getStyle(document.body,'direction')!='rtl') {
|
||||||
cal_box.style.left = findPosX(cal_link) + 17 + 'px';
|
cal_box.style.left = findPosX(cal_link) + 17 + 'px';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// since style's width is in em, it'd be tough to calculate
|
||||||
|
// px value of it. let's use an estimated px for now
|
||||||
|
// TODO: IE returns wrong value for findPosX when in rtl mode
|
||||||
|
// (it returns as it was left aligned), needs to be fixed.
|
||||||
|
cal_box.style.left = findPosX(cal_link) - 180 + 'px';
|
||||||
|
}
|
||||||
cal_box.style.top = findPosY(cal_link) - 75 + 'px';
|
cal_box.style.top = findPosY(cal_link) - 75 + 'px';
|
||||||
cal_box.className = 'calendarbox module';
|
cal_box.className = 'calendarbox module';
|
||||||
cal_box.setAttribute('id', DateTimeShortcuts.calendarDivName1 + num);
|
cal_box.setAttribute('id', DateTimeShortcuts.calendarDivName1 + num);
|
||||||
|
|
|
@ -136,3 +136,20 @@ String.prototype.pad_left = function(pad_length, pad_string) {
|
||||||
}
|
}
|
||||||
return new_string;
|
return new_string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Get the computed style for and element
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
function getStyle(oElm, strCssRule){
|
||||||
|
var strValue = "";
|
||||||
|
if(document.defaultView && document.defaultView.getComputedStyle){
|
||||||
|
strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
|
||||||
|
}
|
||||||
|
else if(oElm.currentStyle){
|
||||||
|
strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){
|
||||||
|
return p1.toUpperCase();
|
||||||
|
});
|
||||||
|
strValue = oElm.currentStyle[strCssRule];
|
||||||
|
}
|
||||||
|
return strValue;
|
||||||
|
}
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="{{ LANGUAGE_CODE }}" xml:lang="{{ LANGUAGE_CODE }}">
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="{{ LANGUAGE_CODE }}" xml:lang="{{ LANGUAGE_CODE }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif %}>
|
||||||
<head>
|
<head>
|
||||||
<title>{% block title %}{% endblock %}</title>
|
<title>{% block title %}{% endblock %}</title>
|
||||||
<link rel="stylesheet" type="text/css" href="{% block stylesheet %}{% load adminmedia %}{% admin_media_prefix %}css/base{% if LANGUAGE_BIDI %}_rtl{% endif %}.css{% endblock %}" />
|
<link rel="stylesheet" type="text/css" href="{% block stylesheet %}{% load adminmedia %}{% admin_media_prefix %}css/base.css{% endblock %}" />
|
||||||
|
{% if LANGUAGE_BIDI %}<link rel="stylesheet" type="text/css" href="{% block stylesheet_rtl %}{% admin_media_prefix %}css/rtl.css{% endblock %}" />{% endif %}
|
||||||
{% block extrastyle %}{% endblock %}
|
{% block extrastyle %}{% endblock %}
|
||||||
{% block extrahead %}{% endblock %}
|
{% block extrahead %}{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{% extends "admin/base_site.html" %}
|
{% extends "admin/base_site.html" %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block stylesheet %}{% load adminmedia %}{% admin_media_prefix %}css/login{% if LANGUAGE_BIDI %}_rtl{% endif %}.css{% endblock %}
|
{% block stylesheet %}{% load adminmedia %}{% admin_media_prefix %}css/login.css{% endblock %}
|
||||||
{% block bodyclass %}login{% endblock %}
|
{% block bodyclass %}login{% endblock %}
|
||||||
{% block content_title %}{% endblock %}
|
{% block content_title %}{% endblock %}
|
||||||
{% block breadcrumbs %}{% endblock %}
|
{% block breadcrumbs %}{% endblock %}
|
||||||
|
|
Loading…
Reference in New Issue