Skip to content
This repository has been archived by the owner on Jan 13, 2019. It is now read-only.

Added Facebook, Google, Twitter login #41

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions static/admin/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ table.orderable-initalized .order-cell, body>tr>td.order-cell {

/* FORM DEFAULTS */

input, textarea, select, .form-row p {
input, textarea, select, .form-row p, form .button {
margin: 2px 0;
padding: 2px 3px;
vertical-align: middle;
Expand All @@ -431,14 +431,18 @@ textarea, select, .vTextField {

/* FORM BUTTONS */

.button, input[type=submit], input[type=button], .submit-row input {
.button, input[type=submit], input[type=button], .submit-row input, a.button {
background: #fff url(../img/nav-bg.gif) bottom repeat-x;
padding: 3px 5px;
color: black;
border: 1px solid #bbb;
border-color: #ddd #aaa #aaa #ddd;
}

a.button {
padding: 4px 5px;
}

.button:active, input[type=submit]:active, input[type=button]:active {
background-image: url(../img/nav-bg-reverse.gif);
background-position: top;
Expand Down Expand Up @@ -633,7 +637,7 @@ div.breadcrumbs {
background: url(../img/icon_addlink.gif) 0 .2em no-repeat;
}

.changelink {
.changelink, .inlinechangelink {
padding-left: 12px;
background: url(../img/icon_changelink.gif) 0 .2em no-repeat;
}
Expand Down
20 changes: 20 additions & 0 deletions static/admin/css/forms.css
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ form .aligned table p {
}

form .aligned p.help {
clear: left;
padding-left: 38px;
}

Expand Down Expand Up @@ -374,3 +375,22 @@ body.popup .submit-row {
.empty-form {
display: none;
}

/* RELATED FIELD ADD ONE / LOOKUP */

.add-another, .related-lookup {
margin-left: 5px;
display: inline-block;
}

.add-another {
width: 10px;
height: 10px;
background-image: url(../img/icon_addlink.gif);
}

.related-lookup {
width: 16px;
height: 16px;
background-image: url(../img/selector-search.gif);
}
2 changes: 1 addition & 1 deletion static/admin/css/ie.css
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@
.change-list ul.toplinks li {
zoom: 1;
*display: inline;
}
}
6 changes: 3 additions & 3 deletions static/admin/css/rtl.css
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ table thead th.sorted .sortoptions {
}

thead th.sorted .text {
padding-right: 0;
padding-left: 42px;
padding-right: 0;
padding-left: 42px;
}

/* dashboard styles */
Expand Down Expand Up @@ -247,4 +247,4 @@ div.colM {

.submit-row input {
float: left;
}
}
14 changes: 14 additions & 0 deletions static/admin/css/widgets.css
Original file line number Diff line number Diff line change
Expand Up @@ -576,3 +576,17 @@ ul.orderer li.deleted:hover, ul.orderer li.deleted a.selector:hover {
font-size: 11px;
border-top: 1px solid #ddd;
}

/* RELATED WIDGET WRAPPER */
.related-widget-wrapper {
float: left; /* display properly in form rows with multiple fields */
overflow: hidden; /* clear floated contents */
}

.related-widget-wrapper-link {
opacity: 0.3;
}

.related-widget-wrapper-link:link {
opacity: 1;
}
9 changes: 7 additions & 2 deletions static/admin/js/SelectFilter2.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function findForm(node) {
window.SelectFilter = {
init: function(field_id, field_name, is_stacked, admin_static_prefix) {
if (field_id.match(/__prefix__/)){
// Don't intialize on empty forms.
// Don't initialize on empty forms.
return;
}
var from_box = document.getElementById(field_id);
Expand Down Expand Up @@ -83,6 +83,7 @@ window.SelectFilter = {
from_box.setAttribute('name', from_box.getAttribute('name') + '_old');

// Set up the JavaScript event handlers for the select box filter interface
addEvent(filter_input, 'keypress', function(e) { SelectFilter.filter_key_press(e, field_id); });
addEvent(filter_input, 'keyup', function(e) { SelectFilter.filter_key_up(e, field_id); });
addEvent(filter_input, 'keydown', function(e) { SelectFilter.filter_key_down(e, field_id); });
addEvent(from_box, 'change', function(e) { SelectFilter.refresh_icons(field_id) });
Expand Down Expand Up @@ -123,15 +124,19 @@ window.SelectFilter = {
$('#' + field_id + '_add_all_link').toggleClass('active', from.find('option').length > 0);
$('#' + field_id + '_remove_all_link').toggleClass('active', to.find('option').length > 0);
},
filter_key_up: function(event, field_id) {
filter_key_press: function(event, field_id) {
var from = document.getElementById(field_id + '_from');
// don't submit form if user pressed Enter
if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)) {
from.selectedIndex = 0;
SelectBox.move(field_id + '_from', field_id + '_to');
from.selectedIndex = 0;
event.preventDefault()
return false;
}
},
filter_key_up: function(event, field_id) {
var from = document.getElementById(field_id + '_from');
var temp = from.selectedIndex;
SelectBox.filter(field_id + '_from', document.getElementById(field_id + '_input').value);
from.selectedIndex = temp;
Expand Down
11 changes: 6 additions & 5 deletions static/admin/js/admin/DateTimeShortcuts.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,11 +290,12 @@ var DateTimeShortcuts = {
// Determine if the current value in the input has a valid date.
// If so, draw the calendar with that date's year and month.
if (inp.value) {
var date_parts = inp.value.split('-');
var year = date_parts[0];
var month = parseFloat(date_parts[1]);
var selected = new Date(inp.value);
if (year.match(/\d\d\d\d/) && month >= 1 && month <= 12) {
var format = get_format('DATE_INPUT_FORMATS')[0];
var selected = inp.value.strptime(format);
var year = selected.getFullYear();
var month = selected.getMonth() + 1;
var re = /\d{4}/
if (re.test(year.toString()) && month >= 1 && month <= 12) {
DateTimeShortcuts.calendars[num].drawDate(month, year, selected);
}
}
Expand Down
61 changes: 47 additions & 14 deletions static/admin/js/admin/RelatedObjectLookups.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,24 @@ function windowname_to_id(text) {
return text;
}

function showRelatedObjectLookupPopup(triggeringLink) {
var name = triggeringLink.id.replace(/^lookup_/, '');
function showAdminPopup(triggeringLink, name_regexp) {
var name = triggeringLink.id.replace(name_regexp, '');
name = id_to_windowname(name);
var href;
if (triggeringLink.href.search(/\?/) >= 0) {
href = triggeringLink.href + '&_popup=1';
var href = triggeringLink.href;
if (href.indexOf('?') == -1) {
href += '?_popup=1';
} else {
href = triggeringLink.href + '?_popup=1';
href += '&_popup=1';
}
var win = window.open(href, name, 'height=500,width=800,resizable=yes,scrollbars=yes');
win.focus();
return false;
}

function showRelatedObjectLookupPopup(triggeringLink) {
return showAdminPopup(triggeringLink, /^lookup_/);
}

function dismissRelatedLookupPopup(win, chosenId) {
var name = windowname_to_id(win.name);
var elem = document.getElementById(name);
Expand All @@ -52,21 +56,16 @@ function dismissRelatedLookupPopup(win, chosenId) {
win.close();
}

function showAddAnotherPopup(triggeringLink) {
var name = triggeringLink.id.replace(/^add_/, '');
function showRelatedObjectPopup(triggeringLink) {
var name = triggeringLink.id.replace(/^(change|add|delete)_/, '');
name = id_to_windowname(name);
var href = triggeringLink.href;
if (href.indexOf('?') == -1) {
href += '?_popup=1';
} else {
href += '&_popup=1';
}
var win = window.open(href, name, 'height=500,width=800,resizable=yes,scrollbars=yes');
win.focus();
return false;
}

function dismissAddAnotherPopup(win, newId, newRepr) {
function dismissAddRelatedObjectPopup(win, newId, newRepr) {
// newId and newRepr are expected to have previously been escaped by
// django.utils.html.escape.
newId = html_unescape(newId);
Expand All @@ -87,6 +86,8 @@ function dismissAddAnotherPopup(win, newId, newRepr) {
elem.value = newId;
}
}
// Trigger a change event to update related links if required.
django.jQuery(elem).trigger('change');
} else {
var toId = name + "_to";
o = new Option(newRepr, newId);
Expand All @@ -95,3 +96,35 @@ function dismissAddAnotherPopup(win, newId, newRepr) {
}
win.close();
}

function dismissChangeRelatedObjectPopup(win, objId, newRepr, newId) {
objId = html_unescape(objId);
newRepr = html_unescape(newRepr);
var id = windowname_to_id(win.name).replace(/^edit_/, '');
var selectsSelector = interpolate('#%s, #%s_from, #%s_to', [id, id, id]);
var selects = django.jQuery(selectsSelector);
selects.find('option').each(function() {
if (this.value == objId) {
this.innerHTML = newRepr;
this.value = newId;
}
});
win.close();
};

function dismissDeleteRelatedObjectPopup(win, objId) {
objId = html_unescape(objId);
var id = windowname_to_id(win.name).replace(/^delete_/, '');
var selectsSelector = interpolate('#%s, #%s_from, #%s_to', [id, id, id]);
var selects = django.jQuery(selectsSelector);
selects.find('option').each(function() {
if (this.value == objId) {
django.jQuery(this).remove();
}
}).trigger('change');
win.close();
};

// Kept for backward compatibility
showAddAnotherPopup = showRelatedObjectPopup;
dismissAddAnotherPopup = dismissAddRelatedObjectPopup;
24 changes: 24 additions & 0 deletions static/admin/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,30 @@ String.prototype.pad_left = function(pad_length, pad_string) {
return new_string;
}

String.prototype.strptime = function(format) {
var split_format = format.split(/[.\-/]/);
var date = this.split(/[.\-/]/);
var i = 0;
while (i < split_format.length) {
switch (split_format[i]) {
case "%d":
var day = date[i];
break;
case "%m":
var month = date[i] - 1;
break;
case "%Y":
var year = date[i];
break;
case "%y":
var year = date[i];
break;
}
++i;
};
return new Date(year, month, day);
}

// ----------------------------------------------------------------------------
// Get the computed style for and element
// ----------------------------------------------------------------------------
Expand Down
Loading