mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Fixing intelligence classifiers to allow tags with an & in the tag. Also changing color of feed view story tags to match intelligence. Also updates dynamically on training.
This commit is contained in:
parent
3419adecc1
commit
354ffe98b9
3 changed files with 38 additions and 13 deletions
|
@ -1655,7 +1655,7 @@ background: transparent;
|
|||
float: left;
|
||||
font-weight: normal;
|
||||
font-size: 9px;
|
||||
padding: 0px 4px;
|
||||
padding: 0px 4px 1px;
|
||||
margin: 0 2px 2px;
|
||||
background-color: #DBDBDB;
|
||||
color: #9D9A95;
|
||||
|
@ -1664,6 +1664,18 @@ background: transparent;
|
|||
-moz-border-radius: 4px;
|
||||
-webkit-border-radius: 4px;
|
||||
}
|
||||
#story_pane .NB-feed-story-tag.NB-score-1 {
|
||||
background-color: #34912E;
|
||||
color: white;
|
||||
text-shadow: 0 1px 0 #000;
|
||||
opacity: .4;
|
||||
}
|
||||
#story_pane .NB-feed-story-tag.NB-score--1 {
|
||||
background-color: #A90103;
|
||||
color: white;
|
||||
text-shadow: 0 1px 0 #000;
|
||||
opacity: .4;
|
||||
}
|
||||
#story_pane .NB-feed-story-header .NB-feed-story-date {
|
||||
position: absolute;
|
||||
right: 28px;
|
||||
|
|
|
@ -2492,6 +2492,7 @@
|
|||
} else if (score < 0) {
|
||||
$story.addClass('NB-story-negative');
|
||||
}
|
||||
$('.NB-feed-story-tags', $story).replaceWith(this.make_story_feed_tags(story));
|
||||
}, this);
|
||||
|
||||
_.each(this.cache.feed_view_stories, _.bind(function($story, story_id) {
|
||||
|
@ -2963,10 +2964,7 @@
|
|||
$.make('div', { className: 'NB-feed-story-header-info' }, [
|
||||
(story.story_authors &&
|
||||
$.make('div', { className: 'NB-feed-story-author' }, story.story_authors)),
|
||||
(story.story_tags && story.story_tags.length && $.make('div', { className: 'NB-feed-story-tags' },
|
||||
_.map(story.story_tags, function(tag) {
|
||||
return $.make('div', { className: 'NB-feed-story-tag' }, tag);
|
||||
}))),
|
||||
(story.story_tags && story.story_tags.length && this.make_story_feed_tags(story)),
|
||||
$.make('div', { className: 'NB-feed-story-title-container' }, [
|
||||
$.make('div', { className: 'NB-feed-story-sentiment' }),
|
||||
$.make('div', { className: 'NB-feed-story-manage-icon' }),
|
||||
|
@ -3025,6 +3023,18 @@
|
|||
this.show_stories_preference_in_feed_view(true);
|
||||
},
|
||||
|
||||
make_story_feed_tags: function(story) {
|
||||
var feed_tags = this.model.classifiers.tags;
|
||||
|
||||
return $.make('div', { className: 'NB-feed-story-tags' },
|
||||
_.map(story.story_tags, function(tag) {
|
||||
var score = feed_tags[tag];
|
||||
return $.make('div', {
|
||||
className: 'NB-feed-story-tag ' + (!!score && 'NB-score-'+score || '')
|
||||
}, tag);
|
||||
}));
|
||||
},
|
||||
|
||||
show_correct_feed_in_feed_title_floater: function(story) {
|
||||
var $story, $header;
|
||||
|
||||
|
|
|
@ -826,21 +826,24 @@ var classifier_prototype = {
|
|||
},
|
||||
|
||||
serialize_classifier: function() {
|
||||
var data = [];
|
||||
var data = {};
|
||||
$('.NB-classifier', this.$modal).each(function() {
|
||||
var value = $('.NB-classifier-input-like', this).val();
|
||||
if ($('.NB-classifier-input-like, .NB-classifier-input-dislike', this).is(':checked')) {
|
||||
data.push([$('input:checked', this).attr('name'), $('.NB-classifier-input-like', this).val()]);
|
||||
var name = $('input:checked', this).attr('name');
|
||||
if (!data[name]) data[name] = [];
|
||||
data[name].push(value);
|
||||
} else {
|
||||
data.push(['remove_'+$('.NB-classifier-input-like', this).attr('name'), $('.NB-classifier-input-like', this).val()]);
|
||||
var name = 'remove_'+$('.NB-classifier-input-like', this).attr('name');
|
||||
if (!data[name]) data[name] = [];
|
||||
data[name].push(value);
|
||||
}
|
||||
});
|
||||
data.push(['feed_id', this.feed_id]);
|
||||
|
||||
data['feed_id'] = this.feed_id;
|
||||
if (this.story_id) {
|
||||
data.push(['story_id', this.story_id]);
|
||||
data['story_id'] = this.story_id;
|
||||
}
|
||||
data = _.map(data, function(c) {
|
||||
return [c[0], '=', c[1]].join('');
|
||||
}).join('&');
|
||||
return data;
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue