Skip to content
This repository has been archived by the owner on Oct 18, 2020. It is now read-only.

Commit

Permalink
Paginate screencasts
Browse files Browse the repository at this point in the history
  • Loading branch information
hostsamurai committed Mar 30, 2011
1 parent ec9026e commit 215e39d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 16 deletions.
22 changes: 14 additions & 8 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

this.raise_errors = true;

// Initialize storage
//this.store('pagination');

// Helpers
this.helpers({
fancyDates: function () {
Expand Down Expand Up @@ -99,7 +96,6 @@
}
});


this.post('#/new', function(ctx) {
var form = ctx.target,
data = ctx.params,
Expand Down Expand Up @@ -140,10 +136,11 @@
this.bind('show-more', function(e, data) {
var ctx = this,
$parent = data.parent,
view = data.view,
sel = data.selector,
lastKey = $parent.data('last-key');
//keys = $parent.data('last-key').split(',', 2);

var s = ctx.loadBlurbs('latest_articles', '#articles', {
var s = ctx.loadBlurbs(view, sel, {
limit: 15,
rows: 3,
cols: 5,
Expand Down Expand Up @@ -284,10 +281,19 @@
$('.more').live('click', function(e) {
e.preventDefault();

var $parent = $(this).parents('.content');
var $parent = $(this).parents('.content'),
selector,
match,
view;

selector = '#' + $(this).parent('section').attr('id');
match = /(articles|screencasts|scripts)$/.exec(selector);
view = 'latest_' + match[1];

$(this).remove();
// TODO: show loading gif
ctx.trigger('show-more', { parent: $parent });

ctx.trigger('show-more', { parent: $parent, selector: selector, view: view });
});
});
});
Expand Down
22 changes: 14 additions & 8 deletions js/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -13543,9 +13543,6 @@ Hyphenator.languages['en-us'] = Hyphenator.languages['en'] = {

this.raise_errors = true;

// Initialize storage
//this.store('pagination');

// Helpers
this.helpers({
fancyDates: function () {
Expand Down Expand Up @@ -13634,7 +13631,6 @@ Hyphenator.languages['en-us'] = Hyphenator.languages['en'] = {
}
});


this.post('#/new', function(ctx) {
var form = ctx.target,
data = ctx.params,
Expand Down Expand Up @@ -13675,10 +13671,11 @@ Hyphenator.languages['en-us'] = Hyphenator.languages['en'] = {
this.bind('show-more', function(e, data) {
var ctx = this,
$parent = data.parent,
view = data.view,
sel = data.selector,
lastKey = $parent.data('last-key');
//keys = $parent.data('last-key').split(',', 2);

var s = ctx.loadBlurbs('latest_articles', '#articles', {
var s = ctx.loadBlurbs(view, sel, {
limit: 15,
rows: 3,
cols: 5,
Expand Down Expand Up @@ -13819,10 +13816,19 @@ Hyphenator.languages['en-us'] = Hyphenator.languages['en'] = {
$('.more').live('click', function(e) {
e.preventDefault();

var $parent = $(this).parents('.content');
var $parent = $(this).parents('.content'),
selector,
match,
view;

selector = '#' + $(this).parent('section').attr('id');
match = /(articles|screencasts|scripts)$/.exec(selector);
view = 'latest_' + match[1];

$(this).remove();
// TODO: show loading gif
ctx.trigger('show-more', { parent: $parent });

ctx.trigger('show-more', { parent: $parent, selector: selector, view: view });
});
});
});
Expand Down

0 comments on commit 215e39d

Please sign in to comment.