Skip to content

Commit

Permalink
prepare 1.5.1; fix improperly resolved urls of content types; fix bro…
Browse files Browse the repository at this point in the history
…ken image loader url; update the jquery version to 1.11.12; fancy checkboxes (take less space) using jquery multiple-select;
  • Loading branch information
barseghyanartur committed Mar 15, 2015
1 parent 3c56b65 commit 226d6c0
Show file tree
Hide file tree
Showing 17 changed files with 861 additions and 43 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
Release history
=====================================
1.5.1
-------------------------------------
2015-03-16

- Fix improperly resolved URLs of the content types.
- Fix broken image loader URL.
- Replace checkboxes with jQuery multiple-select plugin checkboxes.
- Update the jQuery version used to 1.11.12.

1.5
-------------------------------------
2015-03-15
Expand Down
5 changes: 3 additions & 2 deletions TODOS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ Must haves
+ Filter by content type (multi-select).
+ Python 2.6.8 support
+ Make sure the admin URL are fetched in a proper way.
- Heroku demo.
- Filter by date range.
+ Heroku demo.
+ Replace checkboxes with nice selects.

Should haves
------------------------------------------
- Filter by date range.

Could haves
------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
static_dir = "src/admin_timeline/static"
static_files = [os.path.join(static_dir, f) for f in os.listdir(static_dir)]

version = '1.5'
version = '1.5.1'

setup(
name = 'django-admin-timeline',
Expand Down
4 changes: 2 additions & 2 deletions src/admin_timeline/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
__title__ = 'django-admin-timeline'
__version__ = '1.5'
__build__ = 0x00000f
__version__ = '1.5.1'
__build__ = 0x000010
__author__ = 'Artur Barseghyan <[email protected]>'
__copyright__ = 'Copyright (c) 2013-2015 Artur Barseghyan'
__license__ = 'GPL 2.0/LGPL 2.1'
4 changes: 2 additions & 2 deletions src/admin_timeline/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ def __init__(self, *args, **kwargs):

self.fields['users'] = forms.MultipleChoiceField(
choices = users(data),
widget = forms.CheckboxSelectMultiple,
#widget = forms.CheckboxSelectMultiple,
required = False
)
self.fields['content_types'] = forms.MultipleChoiceField(
choices = content_types(data),
widget = forms.CheckboxSelectMultiple,
#widget = forms.CheckboxSelectMultiple,
required = False
)
6 changes: 0 additions & 6 deletions src/admin_timeline/static/admin/js/jquery-1.10.2.min.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
color: #555;
}

.admin-timeline-filter-form button {
.admin-timeline-filter-form button[type="submit"] {
padding: 0 16px;
background: none no-repeat scroll right top #999999;
border: 2px solid #999999;
Expand All @@ -111,12 +111,17 @@
border-radius: 12px;
line-height: 13px;
}
.admin-timeline-filter-form button:hover {
.admin-timeline-filter-form button[type="submit"]:hover {
background: none no-repeat scroll right top #5b80b2;
border: 2px solid #5b80b2;
cursor: pointer;
}

.admin-timeline-filter-form .ms-parent button[type="button"].ms-choice {
margin: 0 0 10px 0;
border-radius: 0;
}

.admin-timeline-filter-form ul {
display: block;
margin: 5px 0 10px 0;
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,14 @@ DjangoAdminTimeline.prototype = {
url: '',

/**
* Static URL (STATIC_URL).
* Static URL of the admin.
*/
static_url: '/static/',
staticURL: '/static/admin/',

/**
* Static URL to the loader image.
*/
loaderImageURL: '/static/admin/loader.gif',

/**
* List/array of configurable properties (to avoid accidental mistakes).
Expand All @@ -66,7 +71,8 @@ DjangoAdminTimeline.prototype = {
'startDate',
'endDate',
'url',
'static_url'
'staticURL',
'loaderImageURL'
],

/**
Expand Down Expand Up @@ -98,6 +104,9 @@ DjangoAdminTimeline.prototype = {

// Run
this.run();

// Init fancy selects
this.initSelects();
},

/**
Expand All @@ -106,33 +115,48 @@ DjangoAdminTimeline.prototype = {
loadOnScroll: function(ev) {
var self = ev.data.context;
// If the current scroll position is past out cutoff point...
if (django.jQuery(window).scrollTop() > django.jQuery(document).height() - (django.jQuery(window).height() * 3)) {
if (jQuery(window).scrollTop() > jQuery(document).height() - (jQuery(window).height() * 3)) {
self.loadItems();
}
},

/**
* Runs the app.
*/
run: function() {
django.jQuery(window).bind('scroll', {context: this}, this.loadOnScroll);
// Bind <this.loadOnScroll> to the "scroll" event of <window>
jQuery(window).bind('scroll', {context: this}, this.loadOnScroll);
},

/**
* Init selects.
*/
initSelects: function() {
jQuery('.admin-timeline-filter-form select').multipleSelect({
filter: true,
//multiple: true,
width: '100%'
});
},

/**
*
*/
showPreloader: function(stream) {
django.jQuery(stream).append(
jQuery(stream).append(
'<l' +
'i class="preloader" style="text-align:center;"><i' +
'mg class="preloader" src="' +
this.static_url +
'images/loading.gif" /></l' +
this.loaderImageURL +
'" /></l' +
'i>');
},

/**
*
*/
hidePreloader: function(stream) {
django.jQuery(stream).find('.preloader').remove();
jQuery(stream).find('.preloader').remove();
},

/**
Expand All @@ -150,14 +174,14 @@ DjangoAdminTimeline.prototype = {
// Configure the url we're about to hit
this.showPreloader("ul#admin-timeline");

django.jQuery.post(
jQuery.post(
this.url,
{'page': this.pageNum, 'last_date': this.lastDate,
'users': this.users, 'content_types': this.contentTypes,
'start_date': this.startDate, 'end_date': this.endDate},
function(data) {
try {
jsonData = django.jQuery.parseJSON(data);
jsonData = jQuery.parseJSON(data);
} catch(err) {
jsonData = {success: 0};
}
Expand All @@ -167,7 +191,7 @@ DjangoAdminTimeline.prototype = {
self.hidePreloader("ul#admin-timeline");

// Pop all our items out into the page
django.jQuery("ul#admin-timeline").append(jsonData.html);
jQuery("ul#admin-timeline").append(jsonData.html);
self.lastDate = jsonData.last_date;
self.loading = false;
} else {
Expand Down

Large diffs are not rendered by default.

Loading

0 comments on commit 226d6c0

Please sign in to comment.