| '+a.addText+""),m=b.find("tr:last a")):(d.filter(":last").after('"),m=d.filter(":last").next().find("a"));m.click(function(b){b.preventDefault();b=c("#"+a.prefix+"-empty");var f=b.clone(!0);f.removeClass(a.emptyCssClass).addClass(a.formCssClass).attr("id",
3 | a.prefix+"-"+l);f.is("tr")?f.children(":last").append('"):f.is("ul")||f.is("ol")?f.append(''+a.deleteText+""):f.children(":first").append(''+a.deleteText+"");f.find("*").each(function(){k(this,a.prefix,e.val())});f.insertBefore(c(b));c(e).val(parseInt(e.val(),10)+1);l+=1;""!==g.val()&&0>=g.val()-e.val()&&m.parent().hide();
4 | f.find("a."+a.deleteCssClass).click(function(b){b.preventDefault();f.remove();--l;a.removed&&a.removed(f);c(document).trigger("formset:removed",[f,a.prefix]);b=c("."+a.formCssClass);c("#id_"+a.prefix+"-TOTAL_FORMS").val(b.length);(""===g.val()||0';
34 | box.outerHTML = new_options;
35 | },
36 | filter: function(id, text) {
37 | // Redisplay the HTML select box, displaying only the choices containing ALL
38 | // the words in text. (It's an AND search.)
39 | var tokens = text.toLowerCase().split(/\s+/);
40 | var node, token;
41 | var cache = SelectBox.cache[id];
42 | for (var i = 0, j = cache.length; i < j; i++) {
43 | node = cache[i];
44 | node.displayed = 1;
45 | var node_text = node.text.toLowerCase();
46 | var numTokens = tokens.length;
47 | for (var k = 0; k < numTokens; k++) {
48 | token = tokens[k];
49 | if (node_text.indexOf(token) === -1) {
50 | node.displayed = 0;
51 | break; // Once the first token isn't found we're done
52 | }
53 | }
54 | }
55 | SelectBox.redisplay(id);
56 | },
57 | delete_from_cache: function(id, value) {
58 | var node, delete_index = null;
59 | var cache = SelectBox.cache[id];
60 | for (var i = 0, j = cache.length; i < j; i++) {
61 | node = cache[i];
62 | if (node.value === value) {
63 | delete_index = i;
64 | break;
65 | }
66 | }
67 | cache.splice(delete_index, 1);
68 | },
69 | add_to_cache: function(id, option) {
70 | SelectBox.cache[id].push({value: option.value, text: option.text, displayed: 1});
71 | },
72 | cache_contains: function(id, value) {
73 | // Check if an item is contained in the cache
74 | var node;
75 | var cache = SelectBox.cache[id];
76 | for (var i = 0, j = cache.length; i < j; i++) {
77 | node = cache[i];
78 | if (node.value === value) {
79 | return true;
80 | }
81 | }
82 | return false;
83 | },
84 | move: function(from, to) {
85 | var from_box = document.getElementById(from);
86 | var option;
87 | var boxOptions = from_box.options;
88 | var boxOptionsLength = boxOptions.length;
89 | for (var i = 0, j = boxOptionsLength; i < j; i++) {
90 | option = boxOptions[i];
91 | var option_value = option.value;
92 | if (option.selected && SelectBox.cache_contains(from, option_value)) {
93 | SelectBox.add_to_cache(to, {value: option_value, text: option.text, displayed: 1});
94 | SelectBox.delete_from_cache(from, option_value);
95 | }
96 | }
97 | SelectBox.redisplay(from);
98 | SelectBox.redisplay(to);
99 | },
100 | move_all: function(from, to) {
101 | var from_box = document.getElementById(from);
102 | var option;
103 | var boxOptions = from_box.options;
104 | var boxOptionsLength = boxOptions.length;
105 | for (var i = 0, j = boxOptionsLength; i < j; i++) {
106 | option = boxOptions[i];
107 | var option_value = option.value;
108 | if (SelectBox.cache_contains(from, option_value)) {
109 | SelectBox.add_to_cache(to, {value: option_value, text: option.text, displayed: 1});
110 | SelectBox.delete_from_cache(from, option_value);
111 | }
112 | }
113 | SelectBox.redisplay(from);
114 | SelectBox.redisplay(to);
115 | },
116 | sort: function(id) {
117 | SelectBox.cache[id].sort(function(a, b) {
118 | a = a.text.toLowerCase();
119 | b = b.text.toLowerCase();
120 | try {
121 | if (a > b) {
122 | return 1;
123 | }
124 | if (a < b) {
125 | return -1;
126 | }
127 | }
128 | catch (e) {
129 | // silently fail on IE 'unknown' exception
130 | }
131 | return 0;
132 | } );
133 | },
134 | select_all: function(id) {
135 | var box = document.getElementById(id);
136 | var boxOptions = box.options;
137 | var boxOptionsLength = boxOptions.length;
138 | for (var i = 0; i < boxOptionsLength; i++) {
139 | boxOptions[i].selected = 'selected';
140 | }
141 | }
142 | };
143 | window.SelectBox = SelectBox;
144 | })(django.jQuery);
145 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 | # Srvup 2 | Video Membership
4 | Learn step-by-step to create a video membership site like [CodingForEntrepreneurs.com](http://codingforentrepreneurs.com) using Django 1.10 and Bootstrap.
5 |
6 | Video content is taking over all content on the web so it's time to build a system that allows you share videos with the world. Let's do this!
7 |
8 |
9 | Watch it [here](https://www.codingforentrepreneurs.com/projects/srvup-2/)
10 |
11 | ====
12 |
13 | ### Lecture Code
14 |
15 | 1. Introduction
16 |
17 | 2. Walkthrough
18 |
19 | 3. Setup & Requirements
20 |
21 | 4. On Versions
22 |
23 | 5. Github
24 |
25 | [6 - Virtualenv & Django Setup](../../tree/552d2b476a6e82a2106b4b80ce71111220038ee1)
26 |
27 | [7 - First App & Model](../../tree/e28137ffc0b941649bdc369f83c7ad9f3b4196de)
28 |
29 | [8 - Admin & Create Super User](../../tree/b516953207a9af1cada6ecf16c1619ea500d691d)
30 |
31 | [9 - Making Model Changes](../../tree/5734a79a542efbc860ab84f2ab176331712592be)
32 |
33 | [10 - Customize the Admin](../../tree/bce03cffdb8d638ef5d4251404f376e870abe29c)
34 |
35 | [11 - Setup Views](../../tree/72d40c910e1ed8aa4608105bd3a62fcf14d69145)
36 |
37 | [12 - Views & Urls](../../tree/7b1fad85df52e665a46a5037b40a31dfadee9475)
38 |
39 | [13 - Loading Templates](../../tree/2b5e57426e380647d36926644cfbf60135549aa1)
40 |
41 | [14 - Context Basics](../../tree/e8f115dd0fe5c46591912a6adca3f4dc24ddeb7b)
42 |
43 | [15 - Context in Generic Views](../../tree/1f20689ac8fe53284931ae81f46fc03d812c8e37)
44 |
45 | [16 - Template Inheritance](../../tree/7dedca15455dadd1ae922d910aee51f7af19792e)
46 |
47 | [17 - Video Detail View](../../tree/67d9c1c819e6cf233c30a5df906465be844c5295)
48 |
49 | [18 - SlugField & Slug Lookups](../../tree/a203bbbc458c93ba89617467304566920f363ffe)
50 |
51 | [19 - Auto Generate Slugs with Signals](../../tree/35d753ab054c7e2aa6a378383a2eda6991f781b4)
52 |
53 | [20 - Override Get Object or Get Queryset](../../tree/6cbb0665aa0f8fc82e7b3c21024f1b996f6ff48c)
54 |
55 | [21 - Django Model Form](../../tree/c82bee8e06e155f6b966f758df944b935d39c234)
56 |
57 | [22 - Get Absolute URL](../../tree/0e57431993e09f4550e7350fcb44c3182d36106e)
58 |
59 | [23 - Delete & Update View](../../tree/62300c42ea666c26c03e36bdde6e187b75dfb4c2)
60 |
61 | [24 - Video Search View](../../tree/aba2c1a98dad63687ae55657de07f5deab51809d)
62 |
63 | [25 - Member Required Mixin](../../tree/fe50072c0551abd8a34937206e6d6e688794e406)
64 |
65 | [26 - Serving Static Files](../../tree/f270011761027f4d885005a3bd8656bffac03f61)
66 |
67 | [27 - Course Setup Part 1](../../tree/2b53d4bd7b65dc160d4b4e1bcc3074261be02d60)
68 |
69 | [28 - Urls inside Apps](../../tree/03796b218d8c13db97e50a0d2ab436c197e768c8)
70 |
71 | [29 - Course Setup Part 2](../../tree/4d331f8cee91b619ea386d2e561d3d87f2bbbbe6)
72 |
73 | [30 - Migrate Courses App](../../tree/1baae3e348d01005a5ae42e43ab447c847e5d226)
74 |
75 | [31 - MultipleObjectsReturned](../../tree/515d39bc5b1d085ce5575efe0225b74a11f86f5a)
76 |
77 | [32 - Create Unique Slug](../../tree/5ee92b739b87d8c70e5123c2988935eff4385b8f)
78 |
79 | [33 - Form Validation](../../tree/9bf8804746b47787f4a89a40cf3afe5a02dfb2d3)
80 |
81 | [34 - Minor Bootstrap Additions](../../tree/8c08e49c556a0180d837685a116cfae069cfe924)
82 |
83 | [35 - Lecture Model](../../tree/e2702d37dfc7ab1a4b17e5e676275bc115b69d1f)
84 |
85 | [36 - Add Lecture to Admin](../../tree/730a678b88ce22bfe21fbe0eb81df8a9bb2fd05d)
86 |
87 | [37 - Unique Lecture Slugs](../../tree/519788c16ee7edf864b2dcd73a38f852f5661c0c)
88 |
89 | [38 - Lecture Detail View](../../tree/48cf1dd654acef45087f1d2f2f780d43d2a36636)
90 |
91 | [39 - Dynamic Values for Foreign Key Fields](../../tree/debfa81b77b74f86a422243a633c6b4f3d527b8a)
92 |
93 | [40 - Django PositionField](../../tree/d51a2bf379fbf5a1cffd4819dab22586377afa2a)
94 |
95 | [41 - Django PositionField Part 2](../../tree/66da55f412f8ee3daef58e160880a1c41d632c8b)
96 |
97 | [42 - Display Price](../../tree/bc94ab4573a7d278ae5862bca72bb22e4046380c)
98 |
99 | [43 - My Courses](../../tree/750bf6a9790c7395e9cfe238d543ae00aa585625)
100 |
101 | [44 - Prefetch Related](../../tree/b146e402b85b6e4c62524c4ddda7b074441631a5)
102 |
103 | [45 - Manager & QuerySet method for Prefetch Related](../../tree/58c10aa14ffb3aee7688886cc42fc04a8a796491)
104 |
105 | [46 - One Click Purchase](../../tree/5a70447b6843b451305b7448513e81b8ce32c0a3)
106 |
107 | [47 - Categories App](../../tree/cb0d2ad2b39625270fa9131692511716c26b905e)
108 |
109 | [48 - Category List Groups](../../tree/0d6d94d287da86262ebed710962ce19eb8697f84)
110 |
111 | [49 - Prefetch Related Course](../../tree/d311e2cb11e273129a6165e31cc9de7e7e57bcab)
112 |
113 | [50 - Annotate Secondary Categories](../../tree/3b311ac672812e4e2dc92746cc892530ed4902cd)
114 |
115 | [51 - Category Video](../../tree/4d4ea8d20e391695403c1b6e62633a30e16e95e0)
116 |
117 | [52 - Render Video Template Tag](../../tree/5730155ae547aaa16aedde36191c60f8323b6928)
118 |
119 | [53 - Course Image Field](../../tree/bfcaf4311c91887e0fd6ec31e1e0079639104806)
120 |
121 | [54 - List Display Courses](../../tree/35718d8973edc907c0c0f1d4a1cb5a68f217a32d)
122 |
123 | [55 - Override Category Context Data](../../tree/f86b3179b2254d00be9a22b729fc03065b1edb0f)
124 |
125 | [56 - Update Course Detail View Style](../../tree/24bf712e40d660f9170a4b974f21f64f55b3fe95)
126 |
127 | [57 - Lecture View Ownership](../../tree/024232f39a9d3531a82ee07bee52f0f8b0c3f5ce)
128 |
129 | [58 - Lecture Free Preview](../../tree/999981e105284103cccdcb52f14428f37d139820)
130 |
131 | [59 - Copy QuerySet Values](../../tree/df2726d040f0d9901e600238dc79d864715dc5b9)
132 |
133 | [60 - Update Course List Display](../../tree/02ba79007eb1e7a29f02e362444e7f83fa396f0a)
134 |
135 | [61 - Pagination](../../tree/bfa8e7ceca9dfaee8e0215ca3571485fcf9724b3)
136 |
137 | [62 - Category Display Counts](../../tree/6931e31bc22a839b8968d6174ec52bbeed81bf8f)
138 |
139 | [63 - Search App](../../tree/4cfabb4048b4b8c513d977365061ac9b8775cf8a)
140 |
141 | [64 - Basic Search Results](../../tree/c6a42b0b97b26d7af5b968e07cf4a764965a2bda)
142 |
143 | [65 - Complex Lookups with Q](../../tree/cd8c7bcc58c0832d7a49b9bcee9108e9b3a3270f)
144 |
145 | [66 - Search Template Tag](../../tree/aaf65138e36c8d3f87b5d8de337866c67b5ce299)
146 |
147 | [67 - Improve Navigation](../../tree/3bf170bfe7e7a1ea4772452b26c9ecb4fd43f4eb)
148 |
149 | [68 - Style Paginatinor](../../tree/78b404b137f1e08d63dbd494b2c1d185241e8528)
150 |
151 | [69 - Featured Category on Homepage](../../tree/8be0428d0c10cca2e4d942475b0f0e7da726ce37)
152 |
153 | [70 Analytics App](../../tree/f213112e554bc865afb4721636d0856b0a3d0765)
154 |
155 |
156 |
157 |
--------------------------------------------------------------------------------
/static_root/admin/js/actions.js:
--------------------------------------------------------------------------------
1 | /*global gettext, interpolate, ngettext*/
2 | (function($) {
3 | 'use strict';
4 | var lastChecked;
5 |
6 | $.fn.actions = function(opts) {
7 | var options = $.extend({}, $.fn.actions.defaults, opts);
8 | var actionCheckboxes = $(this);
9 | var list_editable_changed = false;
10 | var showQuestion = function() {
11 | $(options.acrossClears).hide();
12 | $(options.acrossQuestions).show();
13 | $(options.allContainer).hide();
14 | },
15 | showClear = function() {
16 | $(options.acrossClears).show();
17 | $(options.acrossQuestions).hide();
18 | $(options.actionContainer).toggleClass(options.selectedClass);
19 | $(options.allContainer).show();
20 | $(options.counterContainer).hide();
21 | },
22 | reset = function() {
23 | $(options.acrossClears).hide();
24 | $(options.acrossQuestions).hide();
25 | $(options.allContainer).hide();
26 | $(options.counterContainer).show();
27 | },
28 | clearAcross = function() {
29 | reset();
30 | $(options.acrossInput).val(0);
31 | $(options.actionContainer).removeClass(options.selectedClass);
32 | },
33 | checker = function(checked) {
34 | if (checked) {
35 | showQuestion();
36 | } else {
37 | reset();
38 | }
39 | $(actionCheckboxes).prop("checked", checked)
40 | .parent().parent().toggleClass(options.selectedClass, checked);
41 | },
42 | updateCounter = function() {
43 | var sel = $(actionCheckboxes).filter(":checked").length;
44 | // data-actions-icnt is defined in the generated HTML
45 | // and contains the total amount of objects in the queryset
46 | var actions_icnt = $('.action-counter').data('actionsIcnt');
47 | $(options.counterContainer).html(interpolate(
48 | ngettext('%(sel)s of %(cnt)s selected', '%(sel)s of %(cnt)s selected', sel), {
49 | sel: sel,
50 | cnt: actions_icnt
51 | }, true));
52 | $(options.allToggle).prop("checked", function() {
53 | var value;
54 | if (sel === actionCheckboxes.length) {
55 | value = true;
56 | showQuestion();
57 | } else {
58 | value = false;
59 | clearAcross();
60 | }
61 | return value;
62 | });
63 | };
64 | // Show counter by default
65 | $(options.counterContainer).show();
66 | // Check state of checkboxes and reinit state if needed
67 | $(this).filter(":checked").each(function(i) {
68 | $(this).parent().parent().toggleClass(options.selectedClass);
69 | updateCounter();
70 | if ($(options.acrossInput).val() === 1) {
71 | showClear();
72 | }
73 | });
74 | $(options.allToggle).show().click(function() {
75 | checker($(this).prop("checked"));
76 | updateCounter();
77 | });
78 | $("a", options.acrossQuestions).click(function(event) {
79 | event.preventDefault();
80 | $(options.acrossInput).val(1);
81 | showClear();
82 | });
83 | $("a", options.acrossClears).click(function(event) {
84 | event.preventDefault();
85 | $(options.allToggle).prop("checked", false);
86 | clearAcross();
87 | checker(0);
88 | updateCounter();
89 | });
90 | lastChecked = null;
91 | $(actionCheckboxes).click(function(event) {
92 | if (!event) { event = window.event; }
93 | var target = event.target ? event.target : event.srcElement;
94 | if (lastChecked && $.data(lastChecked) !== $.data(target) && event.shiftKey === true) {
95 | var inrange = false;
96 | $(lastChecked).prop("checked", target.checked)
97 | .parent().parent().toggleClass(options.selectedClass, target.checked);
98 | $(actionCheckboxes).each(function() {
99 | if ($.data(this) === $.data(lastChecked) || $.data(this) === $.data(target)) {
100 | inrange = (inrange) ? false : true;
101 | }
102 | if (inrange) {
103 | $(this).prop("checked", target.checked)
104 | .parent().parent().toggleClass(options.selectedClass, target.checked);
105 | }
106 | });
107 | }
108 | $(target).parent().parent().toggleClass(options.selectedClass, target.checked);
109 | lastChecked = target;
110 | updateCounter();
111 | });
112 | $('form#changelist-form table#result_list tr').find('td:gt(0) :input').change(function() {
113 | list_editable_changed = true;
114 | });
115 | $('form#changelist-form button[name="index"]').click(function(event) {
116 | if (list_editable_changed) {
117 | return confirm(gettext("You have unsaved changes on individual editable fields. If you run an action, your unsaved changes will be lost."));
118 | }
119 | });
120 | $('form#changelist-form input[name="_save"]').click(function(event) {
121 | var action_changed = false;
122 | $('select option:selected', options.actionContainer).each(function() {
123 | if ($(this).val()) {
124 | action_changed = true;
125 | }
126 | });
127 | if (action_changed) {
128 | if (list_editable_changed) {
129 | return confirm(gettext("You have selected an action, but you haven't saved your changes to individual fields yet. Please click OK to save. You'll need to re-run the action."));
130 | } else {
131 | return confirm(gettext("You have selected an action, and you haven't made any changes on individual fields. You're probably looking for the Go button rather than the Save button."));
132 | }
133 | }
134 | });
135 | };
136 | /* Setup plugin defaults */
137 | $.fn.actions.defaults = {
138 | actionContainer: "div.actions",
139 | counterContainer: "span.action-counter",
140 | allContainer: "div.actions span.all",
141 | acrossInput: "div.actions input.select-across",
142 | acrossQuestions: "div.actions span.question",
143 | acrossClears: "div.actions span.clear",
144 | allToggle: "#action-toggle",
145 | selectedClass: "selected"
146 | };
147 | $(document).ready(function() {
148 | var $actionsEls = $('tr input.action-select');
149 | if ($actionsEls.length > 0) {
150 | $actionsEls.actions();
151 | }
152 | });
153 | })(django.jQuery);
154 |
--------------------------------------------------------------------------------
/static_root/admin/js/admin/RelatedObjectLookups.js:
--------------------------------------------------------------------------------
1 | /*global SelectBox, interpolate*/
2 | // Handles related-objects functionality: lookup link for raw_id_fields
3 | // and Add Another links.
4 |
5 | (function($) {
6 | 'use strict';
7 |
8 | // IE doesn't accept periods or dashes in the window name, but the element IDs
9 | // we use to generate popup window names may contain them, therefore we map them
10 | // to allowed characters in a reversible way so that we can locate the correct
11 | // element when the popup window is dismissed.
12 | function id_to_windowname(text) {
13 | text = text.replace(/\./g, '__dot__');
14 | text = text.replace(/\-/g, '__dash__');
15 | return text;
16 | }
17 |
18 | function windowname_to_id(text) {
19 | text = text.replace(/__dot__/g, '.');
20 | text = text.replace(/__dash__/g, '-');
21 | return text;
22 | }
23 |
24 | function showAdminPopup(triggeringLink, name_regexp, add_popup) {
25 | var name = triggeringLink.id.replace(name_regexp, '');
26 | name = id_to_windowname(name);
27 | var href = triggeringLink.href;
28 | if (add_popup) {
29 | if (href.indexOf('?') === -1) {
30 | href += '?_popup=1';
31 | } else {
32 | href += '&_popup=1';
33 | }
34 | }
35 | var win = window.open(href, name, 'height=500,width=800,resizable=yes,scrollbars=yes');
36 | win.focus();
37 | return false;
38 | }
39 |
40 | function showRelatedObjectLookupPopup(triggeringLink) {
41 | return showAdminPopup(triggeringLink, /^lookup_/, true);
42 | }
43 |
44 | function dismissRelatedLookupPopup(win, chosenId) {
45 | var name = windowname_to_id(win.name);
46 | var elem = document.getElementById(name);
47 | if (elem.className.indexOf('vManyToManyRawIdAdminField') !== -1 && elem.value) {
48 | elem.value += ',' + chosenId;
49 | } else {
50 | document.getElementById(name).value = chosenId;
51 | }
52 | win.close();
53 | }
54 |
55 | function showRelatedObjectPopup(triggeringLink) {
56 | return showAdminPopup(triggeringLink, /^(change|add|delete)_/, false);
57 | }
58 |
59 | function updateRelatedObjectLinks(triggeringLink) {
60 | var $this = $(triggeringLink);
61 | var siblings = $this.nextAll('.change-related, .delete-related');
62 | if (!siblings.length) {
63 | return;
64 | }
65 | var value = $this.val();
66 | if (value) {
67 | siblings.each(function() {
68 | var elm = $(this);
69 | elm.attr('href', elm.attr('data-href-template').replace('__fk__', value));
70 | });
71 | } else {
72 | siblings.removeAttr('href');
73 | }
74 | }
75 |
76 | function dismissAddRelatedObjectPopup(win, newId, newRepr) {
77 | var name = windowname_to_id(win.name);
78 | var elem = document.getElementById(name);
79 | if (elem) {
80 | var elemName = elem.nodeName.toUpperCase();
81 | if (elemName === 'SELECT') {
82 | elem.options[elem.options.length] = new Option(newRepr, newId, true, true);
83 | } else if (elemName === 'INPUT') {
84 | if (elem.className.indexOf('vManyToManyRawIdAdminField') !== -1 && elem.value) {
85 | elem.value += ',' + newId;
86 | } else {
87 | elem.value = newId;
88 | }
89 | }
90 | // Trigger a change event to update related links if required.
91 | $(elem).trigger('change');
92 | } else {
93 | var toId = name + "_to";
94 | var o = new Option(newRepr, newId);
95 | SelectBox.add_to_cache(toId, o);
96 | SelectBox.redisplay(toId);
97 | }
98 | win.close();
99 | }
100 |
101 | function dismissChangeRelatedObjectPopup(win, objId, newRepr, newId) {
102 | var id = windowname_to_id(win.name).replace(/^edit_/, '');
103 | var selectsSelector = interpolate('#%s, #%s_from, #%s_to', [id, id, id]);
104 | var selects = $(selectsSelector);
105 | selects.find('option').each(function() {
106 | if (this.value === objId) {
107 | this.textContent = newRepr;
108 | this.value = newId;
109 | }
110 | });
111 | win.close();
112 | }
113 |
114 | function dismissDeleteRelatedObjectPopup(win, objId) {
115 | var id = windowname_to_id(win.name).replace(/^delete_/, '');
116 | var selectsSelector = interpolate('#%s, #%s_from, #%s_to', [id, id, id]);
117 | var selects = $(selectsSelector);
118 | selects.find('option').each(function() {
119 | if (this.value === objId) {
120 | $(this).remove();
121 | }
122 | }).trigger('change');
123 | win.close();
124 | }
125 |
126 | // Global for testing purposes
127 | window.id_to_windowname = id_to_windowname;
128 | window.windowname_to_id = windowname_to_id;
129 |
130 | window.showRelatedObjectLookupPopup = showRelatedObjectLookupPopup;
131 | window.dismissRelatedLookupPopup = dismissRelatedLookupPopup;
132 | window.showRelatedObjectPopup = showRelatedObjectPopup;
133 | window.updateRelatedObjectLinks = updateRelatedObjectLinks;
134 | window.dismissAddRelatedObjectPopup = dismissAddRelatedObjectPopup;
135 | window.dismissChangeRelatedObjectPopup = dismissChangeRelatedObjectPopup;
136 | window.dismissDeleteRelatedObjectPopup = dismissDeleteRelatedObjectPopup;
137 |
138 | // Kept for backward compatibility
139 | window.showAddAnotherPopup = showRelatedObjectPopup;
140 | window.dismissAddAnotherPopup = dismissAddRelatedObjectPopup;
141 |
142 | $(document).ready(function() {
143 | $("a[data-popup-opener]").click(function(event) {
144 | event.preventDefault();
145 | opener.dismissRelatedLookupPopup(window, $(this).data("popup-opener"));
146 | });
147 | $('body').on('click', '.related-widget-wrapper-link', function(e) {
148 | e.preventDefault();
149 | if (this.href) {
150 | var event = $.Event('django:show-related', {href: this.href});
151 | $(this).trigger(event);
152 | if (!event.isDefaultPrevented()) {
153 | showRelatedObjectPopup(this);
154 | }
155 | }
156 | });
157 | $('body').on('change', '.related-widget-wrapper select', function(e) {
158 | var event = $.Event('django:update-related');
159 | $(this).trigger(event);
160 | if (!event.isDefaultPrevented()) {
161 | updateRelatedObjectLinks(this);
162 | }
163 | });
164 | $('.related-widget-wrapper select').trigger('change');
165 | $('.related-lookup').click(function(e) {
166 | e.preventDefault();
167 | var event = $.Event('django:lookup-related');
168 | $(this).trigger(event);
169 | if (!event.isDefaultPrevented()) {
170 | showRelatedObjectLookupPopup(this);
171 | }
172 | });
173 | });
174 |
175 | })(django.jQuery);
176 |
--------------------------------------------------------------------------------
/static_root/admin/css/changelists.css:
--------------------------------------------------------------------------------
1 | /* CHANGELISTS */
2 |
3 | #changelist {
4 | position: relative;
5 | width: 100%;
6 | }
7 |
8 | #changelist table {
9 | width: 100%;
10 | }
11 |
12 | .change-list .hiddenfields { display:none; }
13 |
14 | .change-list .filtered table {
15 | border-right: none;
16 | }
17 |
18 | .change-list .filtered {
19 | min-height: 400px;
20 | }
21 |
22 | .change-list .filtered .results, .change-list .filtered .paginator,
23 | .filtered #toolbar, .filtered div.xfull {
24 | margin-right: 280px;
25 | width: auto;
26 | }
27 |
28 | .change-list .filtered table tbody th {
29 | padding-right: 1em;
30 | }
31 |
32 | #changelist-form .results {
33 | overflow-x: auto;
34 | }
35 |
36 | #changelist .toplinks {
37 | border-bottom: 1px solid #ddd;
38 | }
39 |
40 | #changelist .paginator {
41 | color: #666;
42 | border-bottom: 1px solid #eee;
43 | background: #fff;
44 | overflow: hidden;
45 | }
46 |
47 | /* CHANGELIST TABLES */
48 |
49 | #changelist table thead th {
50 | padding: 0;
51 | white-space: nowrap;
52 | vertical-align: middle;
53 | }
54 |
55 | #changelist table thead th.action-checkbox-column {
56 | width: 1.5em;
57 | text-align: center;
58 | }
59 |
60 | #changelist table tbody td.action-checkbox {
61 | text-align: center;
62 | }
63 |
64 | #changelist table tfoot {
65 | color: #666;
66 | }
67 |
68 | /* TOOLBAR */
69 |
70 | #changelist #toolbar {
71 | padding: 8px 10px;
72 | margin-bottom: 15px;
73 | border-top: 1px solid #eee;
74 | border-bottom: 1px solid #eee;
75 | background: #f8f8f8;
76 | color: #666;
77 | }
78 |
79 | #changelist #toolbar form input {
80 | border-radius: 4px;
81 | font-size: 14px;
82 | padding: 5px;
83 | color: #333;
84 | }
85 |
86 | #changelist #toolbar form #searchbar {
87 | height: 19px;
88 | border: 1px solid #ccc;
89 | padding: 2px 5px;
90 | margin: 0;
91 | vertical-align: top;
92 | font-size: 13px;
93 | }
94 |
95 | #changelist #toolbar form #searchbar:focus {
96 | border-color: #999;
97 | }
98 |
99 | #changelist #toolbar form input[type="submit"] {
100 | border: 1px solid #ccc;
101 | padding: 2px 10px;
102 | margin: 0;
103 | vertical-align: middle;
104 | background: #fff;
105 | box-shadow: 0 -15px 20px -10px rgba(0, 0, 0, 0.15) inset;
106 | cursor: pointer;
107 | color: #333;
108 | }
109 |
110 | #changelist #toolbar form input[type="submit"]:focus,
111 | #changelist #toolbar form input[type="submit"]:hover {
112 | border-color: #999;
113 | }
114 |
115 | #changelist #changelist-search img {
116 | vertical-align: middle;
117 | margin-right: 4px;
118 | }
119 |
120 | /* FILTER COLUMN */
121 |
122 | #changelist-filter {
123 | position: absolute;
124 | top: 0;
125 | right: 0;
126 | z-index: 1000;
127 | width: 240px;
128 | background: #f8f8f8;
129 | border-left: none;
130 | margin: 0;
131 | }
132 |
133 | #changelist-filter h2 {
134 | font-size: 14px;
135 | text-transform: uppercase;
136 | letter-spacing: 0.5px;
137 | padding: 5px 15px;
138 | margin-bottom: 12px;
139 | border-bottom: none;
140 | }
141 |
142 | #changelist-filter h3 {
143 | font-weight: 400;
144 | font-size: 14px;
145 | padding: 0 15px;
146 | margin-bottom: 10px;
147 | }
148 |
149 | #changelist-filter ul {
150 | margin: 5px 0;
151 | padding: 0 15px 15px;
152 | border-bottom: 1px solid #eaeaea;
153 | }
154 |
155 | #changelist-filter ul:last-child {
156 | border-bottom: none;
157 | padding-bottom: none;
158 | }
159 |
160 | #changelist-filter li {
161 | list-style-type: none;
162 | margin-left: 0;
163 | padding-left: 0;
164 | }
165 |
166 | #changelist-filter a {
167 | display: block;
168 | color: #999;
169 | }
170 |
171 | #changelist-filter li.selected {
172 | border-left: 5px solid #eaeaea;
173 | padding-left: 10px;
174 | margin-left: -15px;
175 | }
176 |
177 | #changelist-filter li.selected a {
178 | color: #5b80b2;
179 | }
180 |
181 | #changelist-filter a:focus, #changelist-filter a:hover,
182 | #changelist-filter li.selected a:focus,
183 | #changelist-filter li.selected a:hover {
184 | color: #036;
185 | }
186 |
187 | /* DATE DRILLDOWN */
188 |
189 | .change-list ul.toplinks {
190 | display: block;
191 | float: left;
192 | padding: 0;
193 | margin: 0;
194 | width: 100%;
195 | }
196 |
197 | .change-list ul.toplinks li {
198 | padding: 3px 6px;
199 | font-weight: bold;
200 | list-style-type: none;
201 | display: inline-block;
202 | }
203 |
204 | .change-list ul.toplinks .date-back a {
205 | color: #999;
206 | }
207 |
208 | .change-list ul.toplinks .date-back a:focus,
209 | .change-list ul.toplinks .date-back a:hover {
210 | color: #036;
211 | }
212 |
213 | /* PAGINATOR */
214 |
215 | .paginator {
216 | font-size: 13px;
217 | padding-top: 10px;
218 | padding-bottom: 10px;
219 | line-height: 22px;
220 | margin: 0;
221 | border-top: 1px solid #ddd;
222 | }
223 |
224 | .paginator a:link, .paginator a:visited {
225 | padding: 2px 6px;
226 | background: #79aec8;
227 | text-decoration: none;
228 | color: #fff;
229 | }
230 |
231 | .paginator a.showall {
232 | padding: 0;
233 | border: none;
234 | background: none;
235 | color: #5b80b2;
236 | }
237 |
238 | .paginator a.showall:focus, .paginator a.showall:hover {
239 | background: none;
240 | color: #036;
241 | }
242 |
243 | .paginator .end {
244 | margin-right: 6px;
245 | }
246 |
247 | .paginator .this-page {
248 | padding: 2px 6px;
249 | font-weight: bold;
250 | font-size: 13px;
251 | vertical-align: top;
252 | }
253 |
254 | .paginator a:focus, .paginator a:hover {
255 | color: white;
256 | background: #036;
257 | }
258 |
259 | /* ACTIONS */
260 |
261 | .filtered .actions {
262 | margin-right: 280px;
263 | border-right: none;
264 | }
265 |
266 | #changelist table input {
267 | margin: 0;
268 | vertical-align: baseline;
269 | }
270 |
271 | #changelist table tbody tr.selected {
272 | background-color: #FFFFCC;
273 | }
274 |
275 | #changelist .actions {
276 | padding: 10px;
277 | background: #fff;
278 | border-top: none;
279 | border-bottom: none;
280 | line-height: 24px;
281 | color: #999;
282 | }
283 |
284 | #changelist .actions.selected {
285 | background: #fffccf;
286 | border-top: 1px solid #fffee8;
287 | border-bottom: 1px solid #edecd6;
288 | }
289 |
290 | #changelist .actions span.all,
291 | #changelist .actions span.action-counter,
292 | #changelist .actions span.clear,
293 | #changelist .actions span.question {
294 | font-size: 13px;
295 | margin: 0 0.5em;
296 | display: none;
297 | }
298 |
299 | #changelist .actions:last-child {
300 | border-bottom: none;
301 | }
302 |
303 | #changelist .actions select {
304 | vertical-align: top;
305 | height: 24px;
306 | background: none;
307 | color: #000;
308 | border: 1px solid #ccc;
309 | border-radius: 4px;
310 | font-size: 14px;
311 | padding: 0 0 0 4px;
312 | margin: 0;
313 | margin-left: 10px;
314 | }
315 |
316 | #changelist .actions select:focus {
317 | border-color: #999;
318 | }
319 |
320 | #changelist .actions label {
321 | display: inline-block;
322 | vertical-align: middle;
323 | font-size: 13px;
324 | }
325 |
326 | #changelist .actions .button {
327 | font-size: 13px;
328 | border: 1px solid #ccc;
329 | border-radius: 4px;
330 | background: #fff;
331 | box-shadow: 0 -15px 20px -10px rgba(0, 0, 0, 0.15) inset;
332 | cursor: pointer;
333 | height: 24px;
334 | line-height: 1;
335 | padding: 4px 8px;
336 | margin: 0;
337 | color: #333;
338 | }
339 |
340 | #changelist .actions .button:focus, #changelist .actions .button:hover {
341 | border-color: #999;
342 | }
343 |
--------------------------------------------------------------------------------
/static_root/admin/js/urlify.js:
--------------------------------------------------------------------------------
1 | /*global XRegExp*/
2 | (function() {
3 | 'use strict';
4 |
5 | var LATIN_MAP = {
6 | 'À': 'A', 'Á': 'A', 'Â': 'A', 'Ã': 'A', 'Ä': 'A', 'Å': 'A', 'Æ': 'AE',
7 | 'Ç': 'C', 'È': 'E', 'É': 'E', 'Ê': 'E', 'Ë': 'E', 'Ì': 'I', 'Í': 'I',
8 | 'Î': 'I', 'Ï': 'I', 'Ð': 'D', 'Ñ': 'N', 'Ò': 'O', 'Ó': 'O', 'Ô': 'O',
9 | 'Õ': 'O', 'Ö': 'O', 'Ő': 'O', 'Ø': 'O', 'Ù': 'U', 'Ú': 'U', 'Û': 'U',
10 | 'Ü': 'U', 'Ű': 'U', 'Ý': 'Y', 'Þ': 'TH', 'Ÿ': 'Y', 'ß': 'ss', 'à': 'a',
11 | 'á': 'a', 'â': 'a', 'ã': 'a', 'ä': 'a', 'å': 'a', 'æ': 'ae', 'ç': 'c',
12 | 'è': 'e', 'é': 'e', 'ê': 'e', 'ë': 'e', 'ì': 'i', 'í': 'i', 'î': 'i',
13 | 'ï': 'i', 'ð': 'd', 'ñ': 'n', 'ò': 'o', 'ó': 'o', 'ô': 'o', 'õ': 'o',
14 | 'ö': 'o', 'ő': 'o', 'ø': 'o', 'ù': 'u', 'ú': 'u', 'û': 'u', 'ü': 'u',
15 | 'ű': 'u', 'ý': 'y', 'þ': 'th', 'ÿ': 'y'
16 | };
17 | var LATIN_SYMBOLS_MAP = {
18 | '©': '(c)'
19 | };
20 | var GREEK_MAP = {
21 | 'α': 'a', 'β': 'b', 'γ': 'g', 'δ': 'd', 'ε': 'e', 'ζ': 'z', 'η': 'h',
22 | 'θ': '8', 'ι': 'i', 'κ': 'k', 'λ': 'l', 'μ': 'm', 'ν': 'n', 'ξ': '3',
23 | 'ο': 'o', 'π': 'p', 'ρ': 'r', 'σ': 's', 'τ': 't', 'υ': 'y', 'φ': 'f',
24 | 'χ': 'x', 'ψ': 'ps', 'ω': 'w', 'ά': 'a', 'έ': 'e', 'ί': 'i', 'ό': 'o',
25 | 'ύ': 'y', 'ή': 'h', 'ώ': 'w', 'ς': 's', 'ϊ': 'i', 'ΰ': 'y', 'ϋ': 'y',
26 | 'ΐ': 'i', 'Α': 'A', 'Β': 'B', 'Γ': 'G', 'Δ': 'D', 'Ε': 'E', 'Ζ': 'Z',
27 | 'Η': 'H', 'Θ': '8', 'Ι': 'I', 'Κ': 'K', 'Λ': 'L', 'Μ': 'M', 'Ν': 'N',
28 | 'Ξ': '3', 'Ο': 'O', 'Π': 'P', 'Ρ': 'R', 'Σ': 'S', 'Τ': 'T', 'Υ': 'Y',
29 | 'Φ': 'F', 'Χ': 'X', 'Ψ': 'PS', 'Ω': 'W', 'Ά': 'A', 'Έ': 'E', 'Ί': 'I',
30 | 'Ό': 'O', 'Ύ': 'Y', 'Ή': 'H', 'Ώ': 'W', 'Ϊ': 'I', 'Ϋ': 'Y'
31 | };
32 | var TURKISH_MAP = {
33 | 'ş': 's', 'Ş': 'S', 'ı': 'i', 'İ': 'I', 'ç': 'c', 'Ç': 'C', 'ü': 'u',
34 | 'Ü': 'U', 'ö': 'o', 'Ö': 'O', 'ğ': 'g', 'Ğ': 'G'
35 | };
36 | var ROMANIAN_MAP = {
37 | 'ă': 'a', 'î': 'i', 'ș': 's', 'ț': 't', 'â': 'a',
38 | 'Ă': 'A', 'Î': 'I', 'Ș': 'S', 'Ț': 'T', 'Â': 'A'
39 | };
40 | var RUSSIAN_MAP = {
41 | 'а': 'a', 'б': 'b', 'в': 'v', 'г': 'g', 'д': 'd', 'е': 'e', 'ё': 'yo',
42 | 'ж': 'zh', 'з': 'z', 'и': 'i', 'й': 'j', 'к': 'k', 'л': 'l', 'м': 'm',
43 | 'н': 'n', 'о': 'o', 'п': 'p', 'р': 'r', 'с': 's', 'т': 't', 'у': 'u',
44 | 'ф': 'f', 'х': 'h', 'ц': 'c', 'ч': 'ch', 'ш': 'sh', 'щ': 'sh', 'ъ': '',
45 | 'ы': 'y', 'ь': '', 'э': 'e', 'ю': 'yu', 'я': 'ya',
46 | 'А': 'A', 'Б': 'B', 'В': 'V', 'Г': 'G', 'Д': 'D', 'Е': 'E', 'Ё': 'Yo',
47 | 'Ж': 'Zh', 'З': 'Z', 'И': 'I', 'Й': 'J', 'К': 'K', 'Л': 'L', 'М': 'M',
48 | 'Н': 'N', 'О': 'O', 'П': 'P', 'Р': 'R', 'С': 'S', 'Т': 'T', 'У': 'U',
49 | 'Ф': 'F', 'Х': 'H', 'Ц': 'C', 'Ч': 'Ch', 'Ш': 'Sh', 'Щ': 'Sh', 'Ъ': '',
50 | 'Ы': 'Y', 'Ь': '', 'Э': 'E', 'Ю': 'Yu', 'Я': 'Ya'
51 | };
52 | var UKRAINIAN_MAP = {
53 | 'Є': 'Ye', 'І': 'I', 'Ї': 'Yi', 'Ґ': 'G', 'є': 'ye', 'і': 'i',
54 | 'ї': 'yi', 'ґ': 'g'
55 | };
56 | var CZECH_MAP = {
57 | 'č': 'c', 'ď': 'd', 'ě': 'e', 'ň': 'n', 'ř': 'r', 'š': 's', 'ť': 't',
58 | 'ů': 'u', 'ž': 'z', 'Č': 'C', 'Ď': 'D', 'Ě': 'E', 'Ň': 'N', 'Ř': 'R',
59 | 'Š': 'S', 'Ť': 'T', 'Ů': 'U', 'Ž': 'Z'
60 | };
61 | var POLISH_MAP = {
62 | 'ą': 'a', 'ć': 'c', 'ę': 'e', 'ł': 'l', 'ń': 'n', 'ó': 'o', 'ś': 's',
63 | 'ź': 'z', 'ż': 'z',
64 | 'Ą': 'A', 'Ć': 'C', 'Ę': 'E', 'Ł': 'L', 'Ń': 'N', 'Ó': 'O', 'Ś': 'S',
65 | 'Ź': 'Z', 'Ż': 'Z'
66 | };
67 | var LATVIAN_MAP = {
68 | 'ā': 'a', 'č': 'c', 'ē': 'e', 'ģ': 'g', 'ī': 'i', 'ķ': 'k', 'ļ': 'l',
69 | 'ņ': 'n', 'š': 's', 'ū': 'u', 'ž': 'z',
70 | 'Ā': 'A', 'Č': 'C', 'Ē': 'E', 'Ģ': 'G', 'Ī': 'I', 'Ķ': 'K', 'Ļ': 'L',
71 | 'Ņ': 'N', 'Š': 'S', 'Ū': 'U', 'Ž': 'Z'
72 | };
73 | var ARABIC_MAP = {
74 | 'أ': 'a', 'ب': 'b', 'ت': 't', 'ث': 'th', 'ج': 'g', 'ح': 'h', 'خ': 'kh', 'د': 'd',
75 | 'ذ': 'th', 'ر': 'r', 'ز': 'z', 'س': 's', 'ش': 'sh', 'ص': 's', 'ض': 'd', 'ط': 't',
76 | 'ظ': 'th', 'ع': 'aa', 'غ': 'gh', 'ف': 'f', 'ق': 'k', 'ك': 'k', 'ل': 'l', 'م': 'm',
77 | 'ن': 'n', 'ه': 'h', 'و': 'o', 'ي': 'y'
78 | };
79 | var LITHUANIAN_MAP = {
80 | 'ą': 'a', 'č': 'c', 'ę': 'e', 'ė': 'e', 'į': 'i', 'š': 's', 'ų': 'u',
81 | 'ū': 'u', 'ž': 'z',
82 | 'Ą': 'A', 'Č': 'C', 'Ę': 'E', 'Ė': 'E', 'Į': 'I', 'Š': 'S', 'Ų': 'U',
83 | 'Ū': 'U', 'Ž': 'Z'
84 | };
85 | var SERBIAN_MAP = {
86 | 'ђ': 'dj', 'ј': 'j', 'љ': 'lj', 'њ': 'nj', 'ћ': 'c', 'џ': 'dz',
87 | 'đ': 'dj', 'Ђ': 'Dj', 'Ј': 'j', 'Љ': 'Lj', 'Њ': 'Nj', 'Ћ': 'C',
88 | 'Џ': 'Dz', 'Đ': 'Dj'
89 | };
90 | var AZERBAIJANI_MAP = {
91 | 'ç': 'c', 'ə': 'e', 'ğ': 'g', 'ı': 'i', 'ö': 'o', 'ş': 's', 'ü': 'u',
92 | 'Ç': 'C', 'Ə': 'E', 'Ğ': 'G', 'İ': 'I', 'Ö': 'O', 'Ş': 'S', 'Ü': 'U'
93 | };
94 | var GEORGIAN_MAP = {
95 | 'ა': 'a', 'ბ': 'b', 'გ': 'g', 'დ': 'd', 'ე': 'e', 'ვ': 'v', 'ზ': 'z',
96 | 'თ': 't', 'ი': 'i', 'კ': 'k', 'ლ': 'l', 'მ': 'm', 'ნ': 'n', 'ო': 'o',
97 | 'პ': 'p', 'ჟ': 'j', 'რ': 'r', 'ს': 's', 'ტ': 't', 'უ': 'u', 'ფ': 'f',
98 | 'ქ': 'q', 'ღ': 'g', 'ყ': 'y', 'შ': 'sh', 'ჩ': 'ch', 'ც': 'c', 'ძ': 'dz',
99 | 'წ': 'w', 'ჭ': 'ch', 'ხ': 'x', 'ჯ': 'j', 'ჰ': 'h'
100 | };
101 |
102 | var ALL_DOWNCODE_MAPS = [
103 | LATIN_MAP,
104 | LATIN_SYMBOLS_MAP,
105 | GREEK_MAP,
106 | TURKISH_MAP,
107 | ROMANIAN_MAP,
108 | RUSSIAN_MAP,
109 | UKRAINIAN_MAP,
110 | CZECH_MAP,
111 | POLISH_MAP,
112 | LATVIAN_MAP,
113 | ARABIC_MAP,
114 | LITHUANIAN_MAP,
115 | SERBIAN_MAP,
116 | AZERBAIJANI_MAP,
117 | GEORGIAN_MAP
118 | ];
119 |
120 | var Downcoder = {
121 | 'Initialize': function() {
122 | if (Downcoder.map) { // already made
123 | return;
124 | }
125 | Downcoder.map = {};
126 | Downcoder.chars = [];
127 | for (var i = 0; i < ALL_DOWNCODE_MAPS.length; i++) {
128 | var lookup = ALL_DOWNCODE_MAPS[i];
129 | for (var c in lookup) {
130 | if (lookup.hasOwnProperty(c)) {
131 | Downcoder.map[c] = lookup[c];
132 | }
133 | }
134 | }
135 | for (var k in Downcoder.map) {
136 | if (Downcoder.map.hasOwnProperty(k)) {
137 | Downcoder.chars.push(k);
138 | }
139 | }
140 | Downcoder.regex = new RegExp(Downcoder.chars.join('|'), 'g');
141 | }
142 | };
143 |
144 | function downcode(slug) {
145 | Downcoder.Initialize();
146 | return slug.replace(Downcoder.regex, function(m) {
147 | return Downcoder.map[m];
148 | });
149 | }
150 |
151 |
152 | function URLify(s, num_chars, allowUnicode) {
153 | // changes, e.g., "Petty theft" to "petty-theft"
154 | // remove all these words from the string before urlifying
155 | if (!allowUnicode) {
156 | s = downcode(s);
157 | }
158 | var removelist = [
159 | "a", "an", "as", "at", "before", "but", "by", "for", "from", "is",
160 | "in", "into", "like", "of", "off", "on", "onto", "per", "since",
161 | "than", "the", "this", "that", "to", "up", "via", "with"
162 | ];
163 | var r = new RegExp('\\b(' + removelist.join('|') + ')\\b', 'gi');
164 | s = s.replace(r, '');
165 | // if downcode doesn't hit, the char will be stripped here
166 | if (allowUnicode) {
167 | // Keep Unicode letters including both lowercase and uppercase
168 | // characters, whitespace, and dash; remove other characters.
169 | s = XRegExp.replace(s, XRegExp('[^-_\\p{L}\\p{N}\\s]', 'g'), '');
170 | } else {
171 | s = s.replace(/[^-\w\s]/g, ''); // remove unneeded chars
172 | }
173 | s = s.replace(/^\s+|\s+$/g, ''); // trim leading/trailing spaces
174 | s = s.replace(/[-\s]+/g, '-'); // convert spaces to hyphens
175 | s = s.toLowerCase(); // convert to lowercase
176 | return s.substring(0, num_chars); // trim to first num_chars chars
177 | }
178 | window.URLify = URLify;
179 | })();
180 |
--------------------------------------------------------------------------------
/static_root/admin/js/calendar.js:
--------------------------------------------------------------------------------
1 | /*global gettext, pgettext, get_format, quickElement, removeChildren, addEvent*/
2 | /*
3 | calendar.js - Calendar functions by Adrian Holovaty
4 | depends on core.js for utility functions like removeChildren or quickElement
5 | */
6 |
7 | (function() {
8 | 'use strict';
9 | // CalendarNamespace -- Provides a collection of HTML calendar-related helper functions
10 | var CalendarNamespace = {
11 | monthsOfYear: [
12 | gettext('January'),
13 | gettext('February'),
14 | gettext('March'),
15 | gettext('April'),
16 | gettext('May'),
17 | gettext('June'),
18 | gettext('July'),
19 | gettext('August'),
20 | gettext('September'),
21 | gettext('October'),
22 | gettext('November'),
23 | gettext('December')
24 | ],
25 | daysOfWeek: [
26 | pgettext('one letter Sunday', 'S'),
27 | pgettext('one letter Monday', 'M'),
28 | pgettext('one letter Tuesday', 'T'),
29 | pgettext('one letter Wednesday', 'W'),
30 | pgettext('one letter Thursday', 'T'),
31 | pgettext('one letter Friday', 'F'),
32 | pgettext('one letter Saturday', 'S')
33 | ],
34 | firstDayOfWeek: parseInt(get_format('FIRST_DAY_OF_WEEK')),
35 | isLeapYear: function(year) {
36 | return (((year % 4) === 0) && ((year % 100) !== 0 ) || ((year % 400) === 0));
37 | },
38 | getDaysInMonth: function(month, year) {
39 | var days;
40 | if (month === 1 || month === 3 || month === 5 || month === 7 || month === 8 || month === 10 || month === 12) {
41 | days = 31;
42 | }
43 | else if (month === 4 || month === 6 || month === 9 || month === 11) {
44 | days = 30;
45 | }
46 | else if (month === 2 && CalendarNamespace.isLeapYear(year)) {
47 | days = 29;
48 | }
49 | else {
50 | days = 28;
51 | }
52 | return days;
53 | },
54 | draw: function(month, year, div_id, callback, selected) { // month = 1-12, year = 1-9999
55 | var today = new Date();
56 | var todayDay = today.getDate();
57 | var todayMonth = today.getMonth() + 1;
58 | var todayYear = today.getFullYear();
59 | var todayClass = '';
60 |
61 | // Use UTC functions here because the date field does not contain time
62 | // and using the UTC function variants prevent the local time offset
63 | // from altering the date, specifically the day field. For example:
64 | //
65 | // ```
66 | // var x = new Date('2013-10-02');
67 | // var day = x.getDate();
68 | // ```
69 | //
70 | // The day variable above will be 1 instead of 2 in, say, US Pacific time
71 | // zone.
72 | var isSelectedMonth = false;
73 | if (typeof selected !== 'undefined') {
74 | isSelectedMonth = (selected.getUTCFullYear() === year && (selected.getUTCMonth() + 1) === month);
75 | }
76 |
77 | month = parseInt(month);
78 | year = parseInt(year);
79 | var calDiv = document.getElementById(div_id);
80 | removeChildren(calDiv);
81 | var calTable = document.createElement('table');
82 | quickElement('caption', calTable, CalendarNamespace.monthsOfYear[month - 1] + ' ' + year);
83 | var tableBody = quickElement('tbody', calTable);
84 |
85 | // Draw days-of-week header
86 | var tableRow = quickElement('tr', tableBody);
87 | for (var i = 0; i < 7; i++) {
88 | quickElement('th', tableRow, CalendarNamespace.daysOfWeek[(i + CalendarNamespace.firstDayOfWeek) % 7]);
89 | }
90 |
91 | var startingPos = new Date(year, month - 1, 1 - CalendarNamespace.firstDayOfWeek).getDay();
92 | var days = CalendarNamespace.getDaysInMonth(month, year);
93 |
94 | var nonDayCell;
95 |
96 | // Draw blanks before first of month
97 | tableRow = quickElement('tr', tableBody);
98 | for (i = 0; i < startingPos; i++) {
99 | nonDayCell = quickElement('td', tableRow, ' ');
100 | nonDayCell.className = "nonday";
101 | }
102 |
103 | function calendarMonth(y, m) {
104 | function onClick(e) {
105 | e.preventDefault();
106 | callback(y, m, django.jQuery(this).text());
107 | }
108 | return onClick;
109 | }
110 |
111 | // Draw days of month
112 | var currentDay = 1;
113 | for (i = startingPos; currentDay <= days; i++) {
114 | if (i % 7 === 0 && currentDay !== 1) {
115 | tableRow = quickElement('tr', tableBody);
116 | }
117 | if ((currentDay === todayDay) && (month === todayMonth) && (year === todayYear)) {
118 | todayClass = 'today';
119 | } else {
120 | todayClass = '';
121 | }
122 |
123 | // use UTC function; see above for explanation.
124 | if (isSelectedMonth && currentDay === selected.getUTCDate()) {
125 | if (todayClass !== '') {
126 | todayClass += " ";
127 | }
128 | todayClass += "selected";
129 | }
130 |
131 | var cell = quickElement('td', tableRow, '', 'class', todayClass);
132 | var link = quickElement('a', cell, currentDay, 'href', '#');
133 | addEvent(link, 'click', calendarMonth(year, month));
134 | currentDay++;
135 | }
136 |
137 | // Draw blanks after end of month (optional, but makes for valid code)
138 | while (tableRow.childNodes.length < 7) {
139 | nonDayCell = quickElement('td', tableRow, ' ');
140 | nonDayCell.className = "nonday";
141 | }
142 |
143 | calDiv.appendChild(calTable);
144 | }
145 | };
146 |
147 | // Calendar -- A calendar instance
148 | function Calendar(div_id, callback, selected) {
149 | // div_id (string) is the ID of the element in which the calendar will
150 | // be displayed
151 | // callback (string) is the name of a JavaScript function that will be
152 | // called with the parameters (year, month, day) when a day in the
153 | // calendar is clicked
154 | this.div_id = div_id;
155 | this.callback = callback;
156 | this.today = new Date();
157 | this.currentMonth = this.today.getMonth() + 1;
158 | this.currentYear = this.today.getFullYear();
159 | if (typeof selected !== 'undefined') {
160 | this.selected = selected;
161 | }
162 | }
163 | Calendar.prototype = {
164 | drawCurrent: function() {
165 | CalendarNamespace.draw(this.currentMonth, this.currentYear, this.div_id, this.callback, this.selected);
166 | },
167 | drawDate: function(month, year, selected) {
168 | this.currentMonth = month;
169 | this.currentYear = year;
170 |
171 | if(selected) {
172 | this.selected = selected;
173 | }
174 |
175 | this.drawCurrent();
176 | },
177 | drawPreviousMonth: function() {
178 | if (this.currentMonth === 1) {
179 | this.currentMonth = 12;
180 | this.currentYear--;
181 | }
182 | else {
183 | this.currentMonth--;
184 | }
185 | this.drawCurrent();
186 | },
187 | drawNextMonth: function() {
188 | if (this.currentMonth === 12) {
189 | this.currentMonth = 1;
190 | this.currentYear++;
191 | }
192 | else {
193 | this.currentMonth++;
194 | }
195 | this.drawCurrent();
196 | },
197 | drawPreviousYear: function() {
198 | this.currentYear--;
199 | this.drawCurrent();
200 | },
201 | drawNextYear: function() {
202 | this.currentYear++;
203 | this.drawCurrent();
204 | }
205 | };
206 | window.Calendar = Calendar;
207 | window.CalendarNamespace = CalendarNamespace;
208 | })();
209 |
--------------------------------------------------------------------------------
/static_root/admin/js/core.js:
--------------------------------------------------------------------------------
1 | // Core javascript helper functions
2 |
3 | // basic browser identification & version
4 | var isOpera = (navigator.userAgent.indexOf("Opera") >= 0) && parseFloat(navigator.appVersion);
5 | var isIE = ((document.all) && (!isOpera)) && parseFloat(navigator.appVersion.split("MSIE ")[1].split(";")[0]);
6 |
7 | // Cross-browser event handlers.
8 | function addEvent(obj, evType, fn) {
9 | 'use strict';
10 | if (obj.addEventListener) {
11 | obj.addEventListener(evType, fn, false);
12 | return true;
13 | } else if (obj.attachEvent) {
14 | var r = obj.attachEvent("on" + evType, fn);
15 | return r;
16 | } else {
17 | return false;
18 | }
19 | }
20 |
21 | function removeEvent(obj, evType, fn) {
22 | 'use strict';
23 | if (obj.removeEventListener) {
24 | obj.removeEventListener(evType, fn, false);
25 | return true;
26 | } else if (obj.detachEvent) {
27 | obj.detachEvent("on" + evType, fn);
28 | return true;
29 | } else {
30 | return false;
31 | }
32 | }
33 |
34 | function cancelEventPropagation(e) {
35 | 'use strict';
36 | if (!e) {
37 | e = window.event;
38 | }
39 | e.cancelBubble = true;
40 | if (e.stopPropagation) {
41 | e.stopPropagation();
42 | }
43 | }
44 |
45 | // quickElement(tagType, parentReference [, textInChildNode, attribute, attributeValue ...]);
46 | function quickElement() {
47 | 'use strict';
48 | var obj = document.createElement(arguments[0]);
49 | if (arguments[2]) {
50 | var textNode = document.createTextNode(arguments[2]);
51 | obj.appendChild(textNode);
52 | }
53 | var len = arguments.length;
54 | for (var i = 3; i < len; i += 2) {
55 | obj.setAttribute(arguments[i], arguments[i + 1]);
56 | }
57 | arguments[1].appendChild(obj);
58 | return obj;
59 | }
60 |
61 | // "a" is reference to an object
62 | function removeChildren(a) {
63 | 'use strict';
64 | while (a.hasChildNodes()) {
65 | a.removeChild(a.lastChild);
66 | }
67 | }
68 |
69 | // ----------------------------------------------------------------------------
70 | // Find-position functions by PPK
71 | // See http://www.quirksmode.org/js/findpos.html
72 | // ----------------------------------------------------------------------------
73 | function findPosX(obj) {
74 | 'use strict';
75 | var curleft = 0;
76 | if (obj.offsetParent) {
77 | while (obj.offsetParent) {
78 | curleft += obj.offsetLeft - ((isOpera) ? 0 : obj.scrollLeft);
79 | obj = obj.offsetParent;
80 | }
81 | // IE offsetParent does not include the top-level
82 | if (isIE && obj.parentElement) {
83 | curleft += obj.offsetLeft - obj.scrollLeft;
84 | }
85 | } else if (obj.x) {
86 | curleft += obj.x;
87 | }
88 | return curleft;
89 | }
90 |
91 | function findPosY(obj) {
92 | 'use strict';
93 | var curtop = 0;
94 | if (obj.offsetParent) {
95 | while (obj.offsetParent) {
96 | curtop += obj.offsetTop - ((isOpera) ? 0 : obj.scrollTop);
97 | obj = obj.offsetParent;
98 | }
99 | // IE offsetParent does not include the top-level
100 | if (isIE && obj.parentElement) {
101 | curtop += obj.offsetTop - obj.scrollTop;
102 | }
103 | } else if (obj.y) {
104 | curtop += obj.y;
105 | }
106 | return curtop;
107 | }
108 |
109 | //-----------------------------------------------------------------------------
110 | // Date object extensions
111 | // ----------------------------------------------------------------------------
112 | (function() {
113 | 'use strict';
114 | Date.prototype.getTwelveHours = function() {
115 | var hours = this.getHours();
116 | if (hours === 0) {
117 | return 12;
118 | }
119 | else {
120 | return hours <= 12 ? hours : hours - 12;
121 | }
122 | };
123 |
124 | Date.prototype.getTwoDigitMonth = function() {
125 | return (this.getMonth() < 9) ? '0' + (this.getMonth() + 1) : (this.getMonth() + 1);
126 | };
127 |
128 | Date.prototype.getTwoDigitDate = function() {
129 | return (this.getDate() < 10) ? '0' + this.getDate() : this.getDate();
130 | };
131 |
132 | Date.prototype.getTwoDigitTwelveHour = function() {
133 | return (this.getTwelveHours() < 10) ? '0' + this.getTwelveHours() : this.getTwelveHours();
134 | };
135 |
136 | Date.prototype.getTwoDigitHour = function() {
137 | return (this.getHours() < 10) ? '0' + this.getHours() : this.getHours();
138 | };
139 |
140 | Date.prototype.getTwoDigitMinute = function() {
141 | return (this.getMinutes() < 10) ? '0' + this.getMinutes() : this.getMinutes();
142 | };
143 |
144 | Date.prototype.getTwoDigitSecond = function() {
145 | return (this.getSeconds() < 10) ? '0' + this.getSeconds() : this.getSeconds();
146 | };
147 |
148 | Date.prototype.getHourMinute = function() {
149 | return this.getTwoDigitHour() + ':' + this.getTwoDigitMinute();
150 | };
151 |
152 | Date.prototype.getHourMinuteSecond = function() {
153 | return this.getTwoDigitHour() + ':' + this.getTwoDigitMinute() + ':' + this.getTwoDigitSecond();
154 | };
155 |
156 | Date.prototype.getFullMonthName = function() {
157 | return typeof window.CalendarNamespace === "undefined"
158 | ? this.getTwoDigitMonth()
159 | : window.CalendarNamespace.monthsOfYear[this.getMonth()];
160 | };
161 |
162 | Date.prototype.strftime = function(format) {
163 | var fields = {
164 | B: this.getFullMonthName(),
165 | c: this.toString(),
166 | d: this.getTwoDigitDate(),
167 | H: this.getTwoDigitHour(),
168 | I: this.getTwoDigitTwelveHour(),
169 | m: this.getTwoDigitMonth(),
170 | M: this.getTwoDigitMinute(),
171 | p: (this.getHours() >= 12) ? 'PM' : 'AM',
172 | S: this.getTwoDigitSecond(),
173 | w: '0' + this.getDay(),
174 | x: this.toLocaleDateString(),
175 | X: this.toLocaleTimeString(),
176 | y: ('' + this.getFullYear()).substr(2, 4),
177 | Y: '' + this.getFullYear(),
178 | '%': '%'
179 | };
180 | var result = '', i = 0;
181 | while (i < format.length) {
182 | if (format.charAt(i) === '%') {
183 | result = result + fields[format.charAt(i + 1)];
184 | ++i;
185 | }
186 | else {
187 | result = result + format.charAt(i);
188 | }
189 | ++i;
190 | }
191 | return result;
192 | };
193 |
194 | // ----------------------------------------------------------------------------
195 | // String object extensions
196 | // ----------------------------------------------------------------------------
197 | String.prototype.pad_left = function(pad_length, pad_string) {
198 | var new_string = this;
199 | for (var i = 0; new_string.length < pad_length; i++) {
200 | new_string = pad_string + new_string;
201 | }
202 | return new_string;
203 | };
204 |
205 | String.prototype.strptime = function(format) {
206 | var split_format = format.split(/[.\-/]/);
207 | var date = this.split(/[.\-/]/);
208 | var i = 0;
209 | var day, month, year;
210 | while (i < split_format.length) {
211 | switch (split_format[i]) {
212 | case "%d":
213 | day = date[i];
214 | break;
215 | case "%m":
216 | month = date[i] - 1;
217 | break;
218 | case "%Y":
219 | year = date[i];
220 | break;
221 | case "%y":
222 | year = date[i];
223 | break;
224 | }
225 | ++i;
226 | }
227 | // Create Date object from UTC since the parsed value is supposed to be
228 | // in UTC, not local time. Also, the calendar uses UTC functions for
229 | // date extraction.
230 | return new Date(Date.UTC(year, month, day));
231 | };
232 |
233 | })();
234 | // ----------------------------------------------------------------------------
235 | // Get the computed style for and element
236 | // ----------------------------------------------------------------------------
237 | function getStyle(oElm, strCssRule) {
238 | 'use strict';
239 | var strValue = "";
240 | if(document.defaultView && document.defaultView.getComputedStyle) {
241 | strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
242 | }
243 | else if(oElm.currentStyle) {
244 | strCssRule = strCssRule.replace(/\-(\w)/g, function(strMatch, p1) {
245 | return p1.toUpperCase();
246 | });
247 | strValue = oElm.currentStyle[strCssRule];
248 | }
249 | return strValue;
250 | }
251 |
--------------------------------------------------------------------------------
/static_root/admin/css/forms.css:
--------------------------------------------------------------------------------
1 | @import url('widgets.css');
2 |
3 | /* FORM ROWS */
4 |
5 | .form-row {
6 | overflow: hidden;
7 | padding: 10px;
8 | font-size: 13px;
9 | border-bottom: 1px solid #eee;
10 | }
11 |
12 | .form-row img, .form-row input {
13 | vertical-align: middle;
14 | }
15 |
16 | .form-row label input[type="checkbox"] {
17 | margin-top: 0;
18 | vertical-align: 0;
19 | }
20 |
21 | form .form-row p {
22 | padding-left: 0;
23 | }
24 |
25 | .hidden {
26 | display: none;
27 | }
28 |
29 | /* FORM LABELS */
30 |
31 | label {
32 | font-weight: normal;
33 | color: #666;
34 | font-size: 13px;
35 | }
36 |
37 | .required label, label.required {
38 | font-weight: bold;
39 | color: #333;
40 | }
41 |
42 | /* RADIO BUTTONS */
43 |
44 | form ul.radiolist li {
45 | list-style-type: none;
46 | }
47 |
48 | form ul.radiolist label {
49 | float: none;
50 | display: inline;
51 | }
52 |
53 | form ul.radiolist input[type="radio"] {
54 | margin: -2px 4px 0 0;
55 | padding: 0;
56 | }
57 |
58 | form ul.inline {
59 | margin-left: 0;
60 | padding: 0;
61 | }
62 |
63 | form ul.inline li {
64 | float: left;
65 | padding-right: 7px;
66 | }
67 |
68 | /* ALIGNED FIELDSETS */
69 |
70 | .aligned label {
71 | display: block;
72 | padding: 4px 10px 0 0;
73 | float: left;
74 | width: 160px;
75 | word-wrap: break-word;
76 | line-height: 1;
77 | }
78 |
79 | .aligned label:not(.vCheckboxLabel):after {
80 | content: '';
81 | display: inline-block;
82 | vertical-align: middle;
83 | height: 26px;
84 | }
85 |
86 | .aligned label + p {
87 | padding: 6px 0;
88 | margin-top: 0;
89 | margin-bottom: 0;
90 | margin-left: 170px;
91 | }
92 |
93 | .aligned ul label {
94 | display: inline;
95 | float: none;
96 | width: auto;
97 | }
98 |
99 | .aligned .form-row input {
100 | margin-bottom: 0;
101 | }
102 |
103 | .colMS .aligned .vLargeTextField, .colMS .aligned .vXMLLargeTextField {
104 | width: 350px;
105 | }
106 |
107 | form .aligned ul {
108 | margin-left: 160px;
109 | padding-left: 10px;
110 | }
111 |
112 | form .aligned ul.radiolist {
113 | display: inline-block;
114 | margin: 0;
115 | padding: 0;
116 | }
117 |
118 | form .aligned p.help {
119 | clear: left;
120 | margin-top: 0;
121 | margin-left: 160px;
122 | padding-left: 10px;
123 | }
124 |
125 | form .aligned label + p.help {
126 | margin-left: 0;
127 | padding-left: 0;
128 | }
129 |
130 | form .aligned p.help:last-child {
131 | margin-bottom: 0;
132 | padding-bottom: 0;
133 | }
134 |
135 | form .aligned input + p.help,
136 | form .aligned textarea + p.help,
137 | form .aligned select + p.help {
138 | margin-left: 160px;
139 | padding-left: 10px;
140 | }
141 |
142 | form .aligned ul li {
143 | list-style: none;
144 | }
145 |
146 | form .aligned table p {
147 | margin-left: 0;
148 | padding-left: 0;
149 | }
150 |
151 | .aligned .vCheckboxLabel {
152 | float: none;
153 | width: auto;
154 | display: inline-block;
155 | vertical-align: -3px;
156 | padding: 0 0 5px 5px;
157 | }
158 |
159 | .aligned .vCheckboxLabel + p.help {
160 | margin-top: -4px;
161 | }
162 |
163 | .colM .aligned .vLargeTextField, .colM .aligned .vXMLLargeTextField {
164 | width: 610px;
165 | }
166 |
167 | .checkbox-row p.help {
168 | margin-left: 0;
169 | padding-left: 0;
170 | }
171 |
172 | fieldset .field-box {
173 | float: left;
174 | margin-right: 20px;
175 | }
176 |
177 | /* WIDE FIELDSETS */
178 |
179 | .wide label {
180 | width: 200px;
181 | }
182 |
183 | form .wide p, form .wide input + p.help {
184 | margin-left: 200px;
185 | }
186 |
187 | form .wide p.help {
188 | padding-left: 38px;
189 | }
190 |
191 | .colM fieldset.wide .vLargeTextField, .colM fieldset.wide .vXMLLargeTextField {
192 | width: 450px;
193 | }
194 |
195 | /* COLLAPSED FIELDSETS */
196 |
197 | fieldset.collapsed * {
198 | display: none;
199 | }
200 |
201 | fieldset.collapsed h2, fieldset.collapsed {
202 | display: block;
203 | }
204 |
205 | fieldset.collapsed {
206 | border: 1px solid #eee;
207 | border-radius: 4px;
208 | overflow: hidden;
209 | }
210 |
211 | fieldset.collapsed h2 {
212 | background: #f8f8f8;
213 | color: #666;
214 | }
215 |
216 | fieldset .collapse-toggle {
217 | color: #fff;
218 | }
219 |
220 | fieldset.collapsed .collapse-toggle {
221 | background: transparent;
222 | display: inline;
223 | color: #447e9b;
224 | }
225 |
226 | /* MONOSPACE TEXTAREAS */
227 |
228 | fieldset.monospace textarea {
229 | font-family: "Bitstream Vera Sans Mono", Monaco, "Courier New", Courier, monospace;
230 | }
231 |
232 | /* SUBMIT ROW */
233 |
234 | .submit-row {
235 | padding: 12px 14px;
236 | margin: 0 0 20px;
237 | background: #f8f8f8;
238 | border: 1px solid #eee;
239 | border-radius: 4px;
240 | text-align: right;
241 | overflow: hidden;
242 | }
243 |
244 | body.popup .submit-row {
245 | overflow: auto;
246 | }
247 |
248 | .submit-row input {
249 | height: 35px;
250 | line-height: 15px;
251 | margin: 0 0 0 5px;
252 | }
253 |
254 | .submit-row input.default {
255 | margin: 0 0 0 8px;
256 | text-transform: uppercase;
257 | }
258 |
259 | .submit-row p {
260 | margin: 0.3em;
261 | }
262 |
263 | .submit-row p.deletelink-box {
264 | float: left;
265 | margin: 0;
266 | }
267 |
268 | .submit-row a.deletelink {
269 | display: block;
270 | background: #ba2121;
271 | border-radius: 4px;
272 | padding: 10px 15px;
273 | height: 15px;
274 | line-height: 15px;
275 | color: #fff;
276 | }
277 |
278 | .submit-row a.deletelink:focus,
279 | .submit-row a.deletelink:hover,
280 | .submit-row a.deletelink:active {
281 | background: #a41515;
282 | }
283 |
284 | /* CUSTOM FORM FIELDS */
285 |
286 | .vSelectMultipleField {
287 | vertical-align: top;
288 | }
289 |
290 | .vCheckboxField {
291 | border: none;
292 | }
293 |
294 | .vDateField, .vTimeField {
295 | margin-right: 2px;
296 | margin-bottom: 4px;
297 | }
298 |
299 | .vDateField {
300 | min-width: 6.85em;
301 | }
302 |
303 | .vTimeField {
304 | min-width: 4.7em;
305 | }
306 |
307 | .vURLField {
308 | width: 30em;
309 | }
310 |
311 | .vLargeTextField, .vXMLLargeTextField {
312 | width: 48em;
313 | }
314 |
315 | .flatpages-flatpage #id_content {
316 | height: 40.2em;
317 | }
318 |
319 | .module table .vPositiveSmallIntegerField {
320 | width: 2.2em;
321 | }
322 |
323 | .vTextField {
324 | width: 20em;
325 | }
326 |
327 | .vIntegerField {
328 | width: 5em;
329 | }
330 |
331 | .vBigIntegerField {
332 | width: 10em;
333 | }
334 |
335 | .vForeignKeyRawIdAdminField {
336 | width: 5em;
337 | }
338 |
339 | /* INLINES */
340 |
341 | .inline-group {
342 | padding: 0;
343 | margin: 0 0 30px;
344 | }
345 |
346 | .inline-group thead th {
347 | padding: 8px 10px;
348 | }
349 |
350 | .inline-group .aligned label {
351 | width: 160px;
352 | }
353 |
354 | .inline-related {
355 | position: relative;
356 | }
357 |
358 | .inline-related h3 {
359 | margin: 0;
360 | color: #666;
361 | padding: 5px;
362 | font-size: 13px;
363 | background: #f8f8f8;
364 | border-top: 1px solid #eee;
365 | border-bottom: 1px solid #eee;
366 | }
367 |
368 | .inline-related h3 span.delete {
369 | float: right;
370 | }
371 |
372 | .inline-related h3 span.delete label {
373 | margin-left: 2px;
374 | font-size: 11px;
375 | }
376 |
377 | .inline-related fieldset {
378 | margin: 0;
379 | background: #fff;
380 | border: none;
381 | width: 100%;
382 | }
383 |
384 | .inline-related fieldset.module h3 {
385 | margin: 0;
386 | padding: 2px 5px 3px 5px;
387 | font-size: 11px;
388 | text-align: left;
389 | font-weight: bold;
390 | background: #bcd;
391 | color: #fff;
392 | }
393 |
394 | .inline-group .tabular fieldset.module {
395 | border: none;
396 | }
397 |
398 | .inline-related.tabular fieldset.module table {
399 | width: 100%;
400 | }
401 |
402 | .last-related fieldset {
403 | border: none;
404 | }
405 |
406 | .inline-group .tabular tr.has_original td {
407 | padding-top: 2em;
408 | }
409 |
410 | .inline-group .tabular tr td.original {
411 | padding: 2px 0 0 0;
412 | width: 0;
413 | _position: relative;
414 | }
415 |
416 | .inline-group .tabular th.original {
417 | width: 0px;
418 | padding: 0;
419 | }
420 |
421 | .inline-group .tabular td.original p {
422 | position: absolute;
423 | left: 0;
424 | height: 1.1em;
425 | padding: 2px 9px;
426 | overflow: hidden;
427 | font-size: 9px;
428 | font-weight: bold;
429 | color: #666;
430 | _width: 700px;
431 | }
432 |
433 | .inline-group ul.tools {
434 | padding: 0;
435 | margin: 0;
436 | list-style: none;
437 | }
438 |
439 | .inline-group ul.tools li {
440 | display: inline;
441 | padding: 0 5px;
442 | }
443 |
444 | .inline-group div.add-row,
445 | .inline-group .tabular tr.add-row td {
446 | color: #666;
447 | background: #f8f8f8;
448 | padding: 8px 10px;
449 | border-bottom: 1px solid #eee;
450 | }
451 |
452 | .inline-group .tabular tr.add-row td {
453 | padding: 8px 10px;
454 | border-bottom: 1px solid #eee;
455 | }
456 |
457 | .inline-group ul.tools a.add,
458 | .inline-group div.add-row a,
459 | .inline-group .tabular tr.add-row td a {
460 | background: url(../img/icon-addlink.svg) 0 1px no-repeat;
461 | padding-left: 16px;
462 | font-size: 12px;
463 | }
464 |
465 | .empty-form {
466 | display: none;
467 | }
468 |
469 | /* RELATED FIELD ADD ONE / LOOKUP */
470 |
471 | .add-another, .related-lookup {
472 | margin-left: 5px;
473 | display: inline-block;
474 | vertical-align: middle;
475 | background-repeat: no-repeat;
476 | background-size: 14px;
477 | }
478 |
479 | .add-another {
480 | width: 16px;
481 | height: 16px;
482 | background-image: url(../img/icon-addlink.svg);
483 | }
484 |
485 | .related-lookup {
486 | width: 16px;
487 | height: 16px;
488 | background-image: url(../img/search.svg);
489 | }
490 |
491 | form .related-widget-wrapper ul {
492 | display: inline-block;
493 | margin-left: 0;
494 | padding-left: 0;
495 | }
496 |
497 | .clearable-file-input input {
498 | margin-top: 0;
499 | }
500 |
--------------------------------------------------------------------------------
|