Stubbing out entire feed settings modal. Needs duplicate feed list. Also needs backend splitting of subscriptions.

This commit is contained in:
Samuel Clay 2011-11-12 18:19:57 -08:00
parent 2bb8b9751d
commit 7a2fd622a4
13 changed files with 125 additions and 100 deletions

View file

@ -212,24 +212,6 @@ reader, and feed importer. To run the test suite:
./manage.py test --settings=utils.test-settings
## Roadmap
### Recently completed ###
* River of News - completed
* Starred stories - completed
### Summer 2011 ###
* iPhone app
* Mobile web app - [http://www.newsblur.com/m](http://www.newsblur.com/m)
### Fall 2011 ###
* Social features
* Implicit sorting in River of News
## Author
* Created by [Samuel Clay](http://www.samuelclay.com).

View file

@ -5,6 +5,7 @@ urlpatterns = patterns('',
url(r'^feed_autocomplete', views.feed_autocomplete, name='feed-autocomplete'),
url(r'^search_feed', views.search_feed, name='search-feed'),
url(r'^statistics/(?P<feed_id>\d+)', views.load_feed_statistics, name='feed-statistics'),
url(r'^feed_settings/(?P<feed_id>\d+)', views.load_feed_settings, name='feed-settings'),
url(r'^feed/(?P<feed_id>\d+)', views.load_single_feed, name='feed-info'),
url(r'^exception_retry', views.exception_retry, name='exception-retry'),
url(r'^exception_change_feed_address', views.exception_change_feed_address, name='exception-change-feed-address'),

View file

@ -105,6 +105,17 @@ def load_feed_statistics(request, feed_id):
return stats
@json.json_view
def load_feed_settings(request, feed_id):
stats = dict()
feed = get_object_or_404(Feed, pk=feed_id)
stats['duplicate_addresses'] = feed.duplicate_addresses.all()
stats['feed_fetch_history'] = MFeedFetchHistory.feed_history(feed_id)
stats['page_fetch_history'] = MPageFetchHistory.feed_history(feed_id)
return stats
@json.json_view
def exception_retry(request):
user = get_user(request)

4
fabfile.py vendored
View file

@ -120,27 +120,23 @@ def staging_full():
run('curl -s http://dev.newsblur.com/m/ > /dev/null')
compress_media()
@roles('task')
def celery():
with cd(env.NEWSBLUR_PATH):
run('git pull')
celery_stop()
celery_start()
@roles('task')
def celery_stop():
with cd(env.NEWSBLUR_PATH):
run('sudo supervisorctl stop celery')
with settings(warn_only=True):
run('./utils/kill_celery.sh')
@roles('task')
def celery_start():
with cd(env.NEWSBLUR_PATH):
run('sudo supervisorctl start celery')
run('tail logs/newsblur.log')
@roles('task')
def kill_celery():
with cd(env.NEWSBLUR_PATH):
run('ps aux | grep celeryd | egrep -v grep | awk \'{print $2}\' | sudo xargs kill -9')

View file

@ -268,11 +268,11 @@
.NB-modal .NB-modal-feed-chooser-container {
float: right;
margin: 16px 0 0;
margin: 3px 0 12px;
}
.NB-modal .NB-modal-feed-chooser-container .NB-modal-feed-chooser {
width: 250px;
margin: 0 0 12px;
}
/* ===================== */

View file

@ -4434,12 +4434,6 @@ background: transparent;
width: 524px;
height: 180px;
}
.NB-modal.NB-modal-statistics .NB-modal-feed-chooser-container {
margin: 3px 0 12px;
}
.NB-modal.NB-modal-statistics .NB-modal-feed-chooser-container .NB-modal-feed-chooser {
margin: 0 0 12px;
}
.NB-modal-statistics .NB-modal-loading {
margin: 6px 8px 0;
@ -4546,12 +4540,6 @@ background: transparent;
/* = Feed Recommendation Modal = */
/* ============================= */
.NB-modal.NB-modal-recommend .NB-modal-feed-chooser-container {
margin: 3px 0 12px;
}
.NB-modal.NB-modal-recommend .NB-modal-feed-chooser-container .NB-modal-feed-chooser {
margin: 0 0 12px;
}
.NB-modal-recommend .NB-modal-loading {
margin: 6px 8px 0;
}
@ -4826,6 +4814,16 @@ background: transparent;
/* = Feed Exceptions Modal = */
/* ========================= */
.NB-modal-exception .NB-exception-only {
display: inline;
}
.NB-modal-exception .NB-exception-block-only {
display: block;
}
.NB-modal-exception.NB-modal-feed-settings .NB-exception-only,
.NB-modal-exception.NB-modal-feed-settings .NB-exception-block-only {
display: none;
}
.NB-modal-exception .NB-exception-explanation {
color: #606060;
font-size: 12px;

View file

@ -806,6 +806,13 @@ NEWSBLUR.AssetModel.Reader.prototype = {
});
},
get_feed_settings: function(feed_id, callback) {
this.make_request('/rss_feeds/feed_settings/'+feed_id, {}, callback, callback, {
'ajax_group': 'statistics',
'request_type': 'GET'
});
},
start_import_from_google_reader: function(callback) {
this.make_request('/import/import_from_google_reader/', {}, callback);
},

View file

@ -55,6 +55,36 @@ NEWSBLUR.Modal.prototype = {
close: function(callback) {
$('.NB-modal-loading', this.$modal).removeClass('NB-active');
$.modal.close(callback);
},
make_feed_chooser: function() {
var $chooser = $.make('select', { name: 'feed', className: 'NB-modal-feed-chooser' });
this.feeds = this.feeds || this.model.get_feeds();
for (var f in this.feeds) {
var feed = this.feeds[f];
var $option = $.make('option', { value: feed.id }, feed.feed_title);
$option.appendTo($chooser);
if (feed.id == this.feed_id) {
$option.attr('selected', true);
}
}
$('option', $chooser).tsort();
return $chooser;
},
initialize_feed: function(feed_id) {
this.feed_id = feed_id;
this.feed = this.model.get_feed(feed_id);
$('.NB-modal-subtitle .NB-modal-feed-image', this.$modal).attr('src', $.favicon(this.feed.favicon));
$('.NB-modal-subtitle .NB-modal-feed-title', this.$modal).html(this.feed['feed_title']);
$('.NB-modal-subtitle .NB-modal-feed-subscribers', this.$modal).html(Inflector.commas(this.feed.num_subscribers) + Inflector.pluralize(' subscriber', this.feed.num_subscribers));
}
};

View file

@ -4120,7 +4120,7 @@
]),
$.make('li', { className: 'NB-menu-manage-feed NB-menu-manage-feed-settings' }, [
$.make('div', { className: 'NB-menu-manage-image' }),
$.make('div', { className: 'NB-menu-manage-title' }, 'Feed settings')
$.make('div', { className: 'NB-menu-manage-title' }, 'Site settings')
]),
$.make('li', { className: 'NB-menu-separator' }),
$.make('li', { className: 'NB-menu-manage-feed NB-menu-manage-feed-train' }, [

View file

@ -19,24 +19,59 @@ _.extend(NEWSBLUR.ReaderFeedException.prototype, {
this.show_recommended_options_meta();
this.handle_cancel();
this.open_modal();
this.initialize_feed(this.feed_id);
_.delay(_.bind(function() {
this.get_feed_settings();
}, this), 50);
this.$modal.bind('click', $.rescope(this.handle_click, this));
this.$modal.bind('change', $.rescope(this.handle_change, this));
},
initialize_feed: function(feed_id) {
NEWSBLUR.Modal.prototype.initialize_feed.call(this, feed_id);
$('input[name=feed_link]', this.$modal).val(this.feed.feed_link);
$('input[name=feed_address]', this.$modal).val(this.feed.feed_address);
if (this.feed.exception_type) {
this.$modal.removeClass('NB-modal-feed-settings');
} else {
this.$modal.addClass('NB-modal-feed-settings');
}
},
get_feed_settings: function() {
var $loading = $('.NB-modal-loading', this.$modal);
$loading.addClass('NB-active');
this.model.get_feed_settings(this.feed_id, _.bind(this.populate_settings, this));
},
populate_settings: function() {
var $submit = $('.NB-modal-submit-save', this.$modal);
var $loading = $('.NB-modal-loading', this.$modal);
$loading.removeClass('NB-active');
},
make_modal: function() {
var self = this;
this.$modal = $.make('div', { className: 'NB-modal-exception NB-modal' }, [
$.make('div', { className: 'NB-modal-feed-chooser-container'}, [
this.make_feed_chooser()
]),
$.make('div', { className: 'NB-modal-loading' }),
$.make('h2', { className: 'NB-modal-title' }, 'Fix a misbehaving site'),
$.make('h2', { className: 'NB-modal-subtitle' }, [
$.make('img', { className: 'NB-modal-feed-image feed_favicon', src: $.favicon(this.feed.favicon) }),
$.make('span', { className: 'NB-modal-feed-title' }, this.feed.feed_title)
]),
$.make('div', { className: 'NB-fieldset NB-exception-option NB-exception-option-retry NB-modal-submit' }, [
$.make('div', { className: 'NB-fieldset NB-exception-option NB-exception-option-retry NB-modal-submit NB-exception-block-only' }, [
$.make('h5', [
$.make('div', { className: 'NB-exception-option-meta' }),
$.make('span', { className: 'NB-exception-option-option' }, 'Option 1:'),
$.make('span', { className: 'NB-exception-option-option NB-exception-only' }, 'Option 1:'),
'Retry'
]),
$.make('div', { className: 'NB-fieldset-fields' }, [
@ -50,7 +85,7 @@ _.extend(NEWSBLUR.ReaderFeedException.prototype, {
$.make('div', { className: 'NB-fieldset NB-exception-option NB-exception-option-page NB-modal-submit' }, [
$.make('h5', [
$.make('div', { className: 'NB-exception-option-meta' }),
$.make('span', { className: 'NB-exception-option-option' }, 'Option 2:'),
$.make('span', { className: 'NB-exception-option-option NB-exception-only' }, 'Option 2:'),
'Change Website Address'
]),
$.make('div', { className: 'NB-fieldset-fields' }, [
@ -71,7 +106,7 @@ _.extend(NEWSBLUR.ReaderFeedException.prototype, {
$.make('div', { className: 'NB-fieldset NB-exception-option NB-exception-option-feed NB-modal-submit' }, [
$.make('h5', [
$.make('div', { className: 'NB-exception-option-meta' }),
$.make('span', { className: 'NB-exception-option-option' }, 'Option 3:'),
$.make('span', { className: 'NB-exception-option-option NB-exception-only' }, 'Option 3:'),
'Change RSS Feed Address'
]),
$.make('div', { className: 'NB-fieldset-fields' }, [
@ -91,7 +126,7 @@ _.extend(NEWSBLUR.ReaderFeedException.prototype, {
]),
$.make('div', { className: 'NB-fieldset NB-exception-option NB-exception-option-delete NB-modal-submit' }, [
$.make('h5', [
$.make('span', { className: 'NB-exception-option-option' }, 'Option 4:'),
$.make('span', { className: 'NB-exception-option-option NB-exception-only' }, 'Option 4:'),
'Just Delete This Feed'
]),
$.make('div', { className: 'NB-fieldset-fields' }, [
@ -231,6 +266,17 @@ _.extend(NEWSBLUR.ReaderFeedException.prototype, {
self.change_feed_link();
});
},
handle_change: function(elem, e) {
var self = this;
$.targetIs(e, { tagSelector: '.NB-modal-feed-chooser' }, function($t, $p){
var feed_id = $t.val();
self.first_load = false;
self.initialize_feed(feed_id);
self.get_feed_settings();
});
}
});

View file

@ -10,8 +10,11 @@ NEWSBLUR.ReaderRecommendFeed = function(feed_id, options) {
this.runner();
};
NEWSBLUR.ReaderRecommendFeed.prototype = {
NEWSBLUR.ReaderRecommendFeed.prototype = new NEWSBLUR.Modal;
NEWSBLUR.ReaderRecommendFeed.prototype.constructor = NEWSBLUR.ReaderRecommendFeed;
_.extend(NEWSBLUR.ReaderRecommendFeed.prototype, {
runner: function() {
this.make_modal();
this.open_modal();
@ -59,23 +62,6 @@ NEWSBLUR.ReaderRecommendFeed.prototype = {
]);
},
make_feed_chooser: function() {
var $chooser = $.make('select', { name: 'feed', className: 'NB-modal-feed-chooser' });
for (var f in this.feeds) {
var feed = this.feeds[f];
var $option = $.make('option', { value: feed.id }, feed.feed_title);
$option.appendTo($chooser);
if (feed.id == this.feed_id) {
$option.attr('selected', true);
}
}
$('option', $chooser).tsort();
return $chooser;
},
get_tagline: function() {
var $loading = $('.NB-modal-loading', this.$modal);
$loading.addClass('NB-active');
@ -97,15 +83,6 @@ NEWSBLUR.ReaderRecommendFeed.prototype = {
}
},
initialize_feed: function(feed_id) {
this.feed_id = feed_id;
this.feed = this.model.get_feed(feed_id);
$('.NB-modal-subtitle .NB-modal-feed-image', this.$modal).attr('src', $.favicon(this.feed.favicon));
$('.NB-modal-subtitle .NB-modal-feed-title', this.$modal).html(this.feed['feed_title']);
$('.NB-modal-subtitle .NB-modal-feed-subscribers', this.$modal).html(Inflector.commas(this.feed.num_subscribers) + Inflector.pluralize(' subscriber', this.feed.num_subscribers));
},
open_modal: function() {
var self = this;
@ -181,4 +158,4 @@ NEWSBLUR.ReaderRecommendFeed.prototype = {
});
}
};
});

View file

@ -10,7 +10,10 @@ NEWSBLUR.ReaderStatistics = function(feed_id, options) {
this.runner();
};
NEWSBLUR.ReaderStatistics.prototype = {
NEWSBLUR.ReaderStatistics.prototype = new NEWSBLUR.Modal;
NEWSBLUR.ReaderStatistics.prototype.constructor = NEWSBLUR.ReaderStatistics;
_.extend(NEWSBLUR.ReaderStatistics.prototype, {
runner: function() {
var self = this;
@ -50,15 +53,6 @@ NEWSBLUR.ReaderStatistics.prototype = {
$('.NB-modal-statistics-info', this.$modal).replaceWith($stats);
},
initialize_feed: function(feed_id) {
this.feed_id = feed_id;
this.feed = this.model.get_feed(feed_id);
$('.NB-modal-subtitle .NB-modal-feed-image', this.$modal).attr('src', $.favicon(this.feed.favicon));
$('.NB-modal-subtitle .NB-modal-feed-title', this.$modal).html(this.feed['feed_title']);
$('.NB-modal-subtitle .NB-modal-feed-subscribers', this.$modal).html(Inflector.commas(this.feed.num_subscribers) + Inflector.pluralize(' subscriber', this.feed.num_subscribers));
},
open_modal: function() {
var self = this;
@ -89,23 +83,6 @@ NEWSBLUR.ReaderStatistics.prototype = {
});
},
make_feed_chooser: function() {
var $chooser = $.make('select', { name: 'feed', className: 'NB-modal-feed-chooser' });
for (var f in this.feeds) {
var feed = this.feeds[f];
var $option = $.make('option', { value: feed.id }, feed.feed_title);
$option.appendTo($chooser);
if (feed.id == this.feed_id) {
$option.attr('selected', true);
}
}
$('option', $chooser).tsort();
return $chooser;
},
get_stats: function() {
var $loading = $('.NB-modal-loading', this.$modal);
$loading.addClass('NB-active');
@ -290,4 +267,4 @@ NEWSBLUR.ReaderStatistics.prototype = {
});
}
};
});

View file

@ -243,7 +243,7 @@ $(document).ready(function() {
<table class="NB-howitworks-page-description">
<tr>
<td>
{% filter typogrify %}Use the iPhone app, available in Summer 2011.{% endfilter %}
{% filter typogrify %}Use the iPhone app, available on the App Store.{% endfilter %}
</td>
</tr>
</table>