mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Adding stubbed modal for recommending a feed.
This commit is contained in:
parent
55898e3aef
commit
9dc185d52b
5 changed files with 171 additions and 6 deletions
|
@ -3846,6 +3846,9 @@ background: transparent;
|
|||
.NB-menu-manage .NB-menu-manage-feed-train .NB-menu-manage-image {
|
||||
background: transparent url('../img/icons/silk/bricks.png') no-repeat 0 2px;
|
||||
}
|
||||
.NB-menu-manage .NB-menu-manage-feed-recommend .NB-menu-manage-image {
|
||||
background: transparent url('../img/icons/silk/award_star_bronze_3.png') no-repeat 0 1px;
|
||||
}
|
||||
.NB-menu-manage .NB-menu-manage-story-train .NB-menu-manage-image {
|
||||
background: transparent url('../img/icons/silk/bricks.png') no-repeat 0 2px;
|
||||
}
|
||||
|
|
77
media/js/newsblur/modal.js
Normal file
77
media/js/newsblur/modal.js
Normal file
|
@ -0,0 +1,77 @@
|
|||
NEWSBLUR.Modal = function(options) {
|
||||
var defaults = {};
|
||||
|
||||
this.options = $.extend({}, defaults, options);
|
||||
this.model = NEWSBLUR.AssetModel.reader();
|
||||
this.runner();
|
||||
};
|
||||
|
||||
NEWSBLUR.Modal.prototype = {
|
||||
|
||||
runner: 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-recommend NB-modal' }, [
|
||||
$.make('h2', { className: 'NB-modal-title' }, 'Recommend this Site'),
|
||||
$.make('form', { className: 'NB-recommend-form' }, [
|
||||
$.make('div', { className: 'NB-modal-submit' }, [
|
||||
$.make('input', { type: 'submit', className: 'NB-modal-submit-save NB-modal-submit-green', value: 'Recommend Site' }),
|
||||
' or ',
|
||||
$.make('a', { href: '#', className: 'NB-modal-cancel' }, 'cancel')
|
||||
])
|
||||
])
|
||||
]);
|
||||
},
|
||||
|
||||
open_modal: function() {
|
||||
var self = this;
|
||||
|
||||
this.$modal.modal({
|
||||
'minWidth': 600,
|
||||
'maxWidth': 600,
|
||||
'overlayClose': true,
|
||||
'onOpen': function (dialog) {
|
||||
dialog.overlay.fadeIn(200, function () {
|
||||
dialog.container.fadeIn(200);
|
||||
dialog.data.fadeIn(200);
|
||||
setTimeout(function() {
|
||||
$(window).resize();
|
||||
});
|
||||
});
|
||||
},
|
||||
'onShow': function(dialog) {
|
||||
$('#simplemodal-container').corner('6px');
|
||||
},
|
||||
'onClose': function(dialog) {
|
||||
dialog.data.hide().empty().remove();
|
||||
dialog.container.hide().empty().remove();
|
||||
dialog.overlay.fadeOut(200, function() {
|
||||
dialog.overlay.empty().remove();
|
||||
$.modal.close();
|
||||
});
|
||||
$('.NB-modal-holder').empty().remove();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// ===========
|
||||
// = Actions =
|
||||
// ===========
|
||||
|
||||
handle_click: function(elem, e) {
|
||||
var self = this;
|
||||
|
||||
$.targetIs(e, { tagSelector: '.NB-modal-cancel' }, function($t, $p) {
|
||||
e.preventDefault();
|
||||
$.modal.close();
|
||||
});
|
||||
}
|
||||
|
||||
};
|
|
@ -2947,6 +2947,10 @@
|
|||
NEWSBLUR.classifier = new NEWSBLUR.ReaderClassifierTrainer({'score': score});
|
||||
},
|
||||
|
||||
open_recommend_modal: function(feed_id) {
|
||||
NEWSBLUR.recommend_feed = new NEWSBLUR.ReaderRecommendFeed({'feed_id': feed_id});
|
||||
},
|
||||
|
||||
// ==========================
|
||||
// = Story Pane - Feed View =
|
||||
// ==========================
|
||||
|
@ -3623,13 +3627,11 @@
|
|||
$.make('div', { className: 'NB-menu-manage-title' }, 'Intelligence trainer'),
|
||||
$.make('div', { className: 'NB-menu-manage-subtitle' }, 'What you like and dislike.')
|
||||
]),
|
||||
(tab_unread_count && $.make('li', { className: 'NB-menu-separator' })),
|
||||
(tab_unread_count && $.make('li', { className: 'NB-menu-manage-feed NB-menu-manage-feed-unreadtabs' }, [
|
||||
$.make('li', { className: 'NB-menu-separator' }),
|
||||
$.make('li', { className: 'NB-menu-manage-feed NB-menu-manage-feed-recommend' }, [
|
||||
$.make('div', { className: 'NB-menu-manage-image' }),
|
||||
$.make('div', { className: 'NB-menu-manage-title' }, 'Open unreads in '+tab_unread_count+Inflector.pluralize(' tab', tab_unread_count))
|
||||
]).bind('click', _.bind(function(e) {
|
||||
this.open_unread_stories_in_tabs(feed_id);
|
||||
}, this))),
|
||||
$.make('div', { className: 'NB-menu-manage-title' }, 'Recommend this site')
|
||||
]),
|
||||
$.make('li', { className: 'NB-menu-separator' }),
|
||||
$.make('li', { className: 'NB-menu-manage-feed NB-menu-manage-rename NB-menu-manage-feed-rename' }, [
|
||||
$.make('div', { className: 'NB-menu-manage-image' }),
|
||||
|
@ -5089,6 +5091,11 @@
|
|||
self.open_feed_intelligence_modal(1, feed_id, false);
|
||||
}
|
||||
});
|
||||
$.targetIs(e, { tagSelector: '.NB-menu-manage-feed-recommend' }, function($t, $p){
|
||||
e.preventDefault();
|
||||
var feed_id = $t.parents('.NB-menu-manage').data('feed_id');
|
||||
self.open_recommend_modal(feed_id);
|
||||
});
|
||||
$.targetIs(e, { tagSelector: '.NB-menu-manage-story-train' }, function($t, $p){
|
||||
e.preventDefault();
|
||||
if (!$t.hasClass('NB-disabled')) {
|
||||
|
|
77
media/js/newsblur/reader_recommend_feed.js
Normal file
77
media/js/newsblur/reader_recommend_feed.js
Normal file
|
@ -0,0 +1,77 @@
|
|||
NEWSBLUR.ReaderRecommendFeed = function(options) {
|
||||
var defaults = {};
|
||||
|
||||
this.options = $.extend({}, defaults, options);
|
||||
this.model = NEWSBLUR.AssetModel.reader();
|
||||
this.runner();
|
||||
};
|
||||
|
||||
NEWSBLUR.ReaderRecommendFeed.prototype = {
|
||||
|
||||
runner: 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-recommend NB-modal' }, [
|
||||
$.make('h2', { className: 'NB-modal-title' }, 'Recommend this Site'),
|
||||
$.make('form', { className: 'NB-recommend-form' }, [
|
||||
$.make('div', { className: 'NB-modal-submit' }, [
|
||||
$.make('input', { type: 'submit', className: 'NB-modal-submit-save NB-modal-submit-green', value: 'Recommend Site' }),
|
||||
' or ',
|
||||
$.make('a', { href: '#', className: 'NB-modal-cancel' }, 'cancel')
|
||||
])
|
||||
])
|
||||
]);
|
||||
},
|
||||
|
||||
open_modal: function() {
|
||||
var self = this;
|
||||
|
||||
this.$modal.modal({
|
||||
'minWidth': 600,
|
||||
'maxWidth': 600,
|
||||
'overlayClose': true,
|
||||
'onOpen': function (dialog) {
|
||||
dialog.overlay.fadeIn(200, function () {
|
||||
dialog.container.fadeIn(200);
|
||||
dialog.data.fadeIn(200);
|
||||
setTimeout(function() {
|
||||
$(window).resize();
|
||||
});
|
||||
});
|
||||
},
|
||||
'onShow': function(dialog) {
|
||||
$('#simplemodal-container').corner('6px');
|
||||
},
|
||||
'onClose': function(dialog) {
|
||||
dialog.data.hide().empty().remove();
|
||||
dialog.container.hide().empty().remove();
|
||||
dialog.overlay.fadeOut(200, function() {
|
||||
dialog.overlay.empty().remove();
|
||||
$.modal.close();
|
||||
});
|
||||
$('.NB-modal-holder').empty().remove();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// ===========
|
||||
// = Actions =
|
||||
// ===========
|
||||
|
||||
handle_click: function(elem, e) {
|
||||
var self = this;
|
||||
|
||||
$.targetIs(e, { tagSelector: '.NB-modal-cancel' }, function($t, $p) {
|
||||
e.preventDefault();
|
||||
$.modal.close();
|
||||
});
|
||||
}
|
||||
|
||||
};
|
|
@ -126,6 +126,7 @@ COMPRESS_JS = {
|
|||
'js/newsblur/reader_statistics.js',
|
||||
'js/newsblur/reader_feed_exception.js',
|
||||
'js/newsblur/reader_keyboard.js',
|
||||
'js/newsblur/reader_recommend_feed.js',
|
||||
'js/newsblur/about.js',
|
||||
'js/newsblur/faq.js',
|
||||
),
|
||||
|
|
Loading…
Add table
Reference in a new issue