Adding Organizer skeleton.

This commit is contained in:
Samuel Clay 2014-07-07 13:22:56 -04:00
parent 127a6a01c6
commit 1fc9eeff5b
6 changed files with 117 additions and 0 deletions

View file

@ -6741,6 +6741,10 @@ form.opml_import_form input {
.NB-menu-manage .NB-menu-manage-feedchooser .NB-menu-manage-image {
background: transparent url('/media/embed/icons/silk/color_swatch.png') no-repeat 1px 2px;
}
.NB-menu-manage .NB-menu-manage-organizer .NB-menu-manage-image {
background: transparent url('/media/embed/icons/circular/menu_icn_book.png') no-repeat 0 0;
background-size: 18px;
}
.NB-menu-manage .NB-menu-manage-premium .NB-menu-manage-image {
background: transparent url('/media/embed/icons/circular/g_icn_greensun.png') no-repeat 0 0px;
background-size: 18px;
@ -10692,6 +10696,15 @@ form.opml_import_form input {
cursor: pointer;
}
/* ============= */
/* = Organizer = */
/* ============= */
.NB-modal-organizer .NB-modal-title .NB-icon {
background: transparent url('/media/embed/icons/circular/g_modal_book.png');
background-size: 28px;
}
/* ================= */
/* = Feed Selector = */
/* ================= */

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 938 B

View file

@ -2843,6 +2843,10 @@
NEWSBLUR.feedchooser = new NEWSBLUR.ReaderFeedchooser(options);
},
open_organizer_modal: function(options) {
NEWSBLUR.organizer = new NEWSBLUR.ReaderOrganizer(options);
},
open_feed_exception_modal: function(feed_id) {
feed_id = feed_id || this.active_feed;
@ -2960,6 +2964,11 @@
$.make('div', { className: 'NB-menu-manage-title' }, 'Mute Sites'),
$.make('div', { className: 'NB-menu-manage-subtitle' }, 'Temporarily turn off feeds.')
])),
$.make('li', { className: 'NB-menu-item NB-menu-manage-organizer' }, [
$.make('div', { className: 'NB-menu-manage-image' }),
$.make('div', { className: 'NB-menu-manage-title' }, 'Organize Sites'),
$.make('div', { className: 'NB-menu-manage-subtitle' }, 'Move, delete, and batch actions.')
]),
(show_chooser && $.make('li', { className: 'NB-menu-item NB-menu-manage-premium' }, [
$.make('div', { className: 'NB-menu-manage-image' }),
$.make('div', { className: 'NB-menu-manage-title' }, 'Upgrade to premium')
@ -5670,6 +5679,14 @@
});
}
});
$.targetIs(e, { tagSelector: '.NB-menu-manage-organizer' }, function($t, $p){
e.preventDefault();
if (!$t.hasClass('NB-disabled')) {
$.modal.close(function() {
self.open_organizer_modal();
});
}
});
$.targetIs(e, { tagSelector: '.NB-menu-manage-premium' }, function($t, $p){
e.preventDefault();
if (!$t.hasClass('NB-disabled')) {

View file

@ -0,0 +1,87 @@
NEWSBLUR.ReaderOrganizer = function(user_id, options) {
var defaults = {
width: 800
};
this.options = $.extend({}, defaults, options);
this.model = NEWSBLUR.assets;
this.init();
};
NEWSBLUR.ReaderOrganizer.prototype = new NEWSBLUR.Modal;
_.extend(NEWSBLUR.ReaderOrganizer.prototype, {
init: function() {
this.make_modal();
this.open_modal();
this.$modal.bind('click', $.rescope(this.handle_click, this));
},
make_modal: function() {
var self = this;
this.$modal = $.make('div', { className: 'NB-modal NB-modal-organizer' }, [
$.make('h2', { className: 'NB-modal-title' }, [
$.make('div', { className: 'NB-modal-loading' }),
$.make('div', { className: 'NB-icon' }),
'Organize sites'
]),
this.make_feeds()
]);
},
// =============
// = Feed list =
// =============
make_feeds: function() {
var feeds = this.model.feeds;
this.feed_count = _.unique(NEWSBLUR.assets.folders.feed_ids_in_folder()).length;
var $feeds = new NEWSBLUR.Views.FeedList({
feed_chooser: true
}).make_feeds().$el;
if ($feeds.data('sortable')) $feeds.data('sortable').disable();
// Expand collapsed folders
$('.NB-folder-collapsed', $feeds).css({
'display': 'block',
'opacity': 1
}).removeClass('NB-folder-collapsed');
// Pretend unfetched feeds are fine
$('.NB-feed-unfetched', $feeds).removeClass('NB-feed-unfetched');
// Make sure all folders are visible
$('.NB-folder.NB-hidden', $feeds).removeClass('NB-hidden');
$('.unread_count_positive', $feeds).text('On');
$('.unread_count_negative', $feeds).text('Off');
return $feeds;
},
// ===========
// = Actions =
// ===========
handle_click: function(elem, e) {
var self = this;
$.targetIs(e, { tagSelector: '.feed' }, _.bind(function($t, $p) {
e.preventDefault();
var feed_id = parseInt($t.attr('data-id'), 10);
if (_.contains(this.approve_list, feed_id)) {
this.add_feed_to_decline(feed_id, true);
} else {
this.add_feed_to_approve(feed_id, true);
}
}, this));
}
});