Click added to the news list page, it displays the selected news item now

This commit is contained in:
Martin 2018-03-21 20:54:59 +00:00
parent 2983493dbd
commit d89720aabe
3 changed files with 4 additions and 20 deletions

View File

@ -11,7 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
const CACHE_VERSION = { 'version': '0.0.464' };
const CACHE_VERSION = { 'version': '0.0.477' };
const dataCacheName = 'jubileeData-v1';
const cacheName = 'jubilee-final-1';
const filesToCache = [

View File

@ -4,7 +4,6 @@ const Backbone = require('backbone');
const request = require('request');
const { get } = require('lodash');
const { reduceEuronews } = require('./libs/reducers');
const TimeFormat = require('hh-mm-ss');
const { createPanel, addPanel } = require('./libs/panel');
const NewsItem = Backbone.Model.extend({
@ -39,14 +38,7 @@ const NewsItemView = Backbone.View.extend({
'render': function() {
this.$el.html(this.template(this.model.toJSON()));
}, 'events': {
'click': 'doClick'
}, 'doclick':function(d) {
console.log('>>> HERE');
console.lg(d);
}
});
const NewsListModel = Backbone.Model.extend({
@ -64,7 +56,6 @@ const NewsListModel = Backbone.Model.extend({
this.getNews();
},
'getNews': function() {
// const ll = this.get('llShort');
console.info('>> News:request');
request({
'url': `${window.loc}/news`,
@ -99,8 +90,6 @@ const NewsListModel = Backbone.Model.extend({
() => this.tick(),
3.6e+6 + 1000
);
// console.log(this);
},
'tick': function() {
console.log('Set update');
@ -113,11 +102,8 @@ const NewsListView = Backbone.View.extend({
'initialize': function(options) {
this.eventBus = options.eventBus;
/* this.model.on('all', function(eventName) {
console.log(`${eventName } was triggered!`);
});*/
_.bindAll(this, 'doClick');
// this.model.bind('change:article', this.doRender, this);
this.model.newsCollection.bind('reset', this.render, this);
this.eventBus.on('showNewsList', this.showNewsListPanel, this);
},
@ -143,15 +129,13 @@ const NewsListView = Backbone.View.extend({
'render' : function() {
console.log('>> Do render');
console.log(this.model.newsCollection);
this.model.newsCollection.each(function(item) {
const niView = new NewsItemView({ 'model': item });
this.$el.append(niView.el);
}, this);
console.log(this.$el);
console.log(this.el);
this.$el.find('.newsItem').on('click', this.doClick);
}
});

View File

@ -31,7 +31,7 @@ const NewsCardModel = Backbone.Model.extend({
// console.log(fsJSON);
this.set('article', fsJSON);
console.log(body);
// console.log(body);
}
}.bind(this));
}