Click added to the news list page, it displays the selected news item now
This commit is contained in:
parent
2983493dbd
commit
d89720aabe
@ -11,7 +11,7 @@
|
|||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
const CACHE_VERSION = { 'version': '0.0.464' };
|
const CACHE_VERSION = { 'version': '0.0.477' };
|
||||||
const dataCacheName = 'jubileeData-v1';
|
const dataCacheName = 'jubileeData-v1';
|
||||||
const cacheName = 'jubilee-final-1';
|
const cacheName = 'jubilee-final-1';
|
||||||
const filesToCache = [
|
const filesToCache = [
|
||||||
|
@ -4,7 +4,6 @@ const Backbone = require('backbone');
|
|||||||
const request = require('request');
|
const request = require('request');
|
||||||
const { get } = require('lodash');
|
const { get } = require('lodash');
|
||||||
const { reduceEuronews } = require('./libs/reducers');
|
const { reduceEuronews } = require('./libs/reducers');
|
||||||
const TimeFormat = require('hh-mm-ss');
|
|
||||||
const { createPanel, addPanel } = require('./libs/panel');
|
const { createPanel, addPanel } = require('./libs/panel');
|
||||||
|
|
||||||
const NewsItem = Backbone.Model.extend({
|
const NewsItem = Backbone.Model.extend({
|
||||||
@ -39,14 +38,7 @@ const NewsItemView = Backbone.View.extend({
|
|||||||
|
|
||||||
'render': function() {
|
'render': function() {
|
||||||
this.$el.html(this.template(this.model.toJSON()));
|
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({
|
const NewsListModel = Backbone.Model.extend({
|
||||||
@ -64,7 +56,6 @@ const NewsListModel = Backbone.Model.extend({
|
|||||||
this.getNews();
|
this.getNews();
|
||||||
},
|
},
|
||||||
'getNews': function() {
|
'getNews': function() {
|
||||||
// const ll = this.get('llShort');
|
|
||||||
console.info('>> News:request');
|
console.info('>> News:request');
|
||||||
request({
|
request({
|
||||||
'url': `${window.loc}/news`,
|
'url': `${window.loc}/news`,
|
||||||
@ -99,8 +90,6 @@ const NewsListModel = Backbone.Model.extend({
|
|||||||
() => this.tick(),
|
() => this.tick(),
|
||||||
3.6e+6 + 1000
|
3.6e+6 + 1000
|
||||||
);
|
);
|
||||||
|
|
||||||
// console.log(this);
|
|
||||||
},
|
},
|
||||||
'tick': function() {
|
'tick': function() {
|
||||||
console.log('Set update');
|
console.log('Set update');
|
||||||
@ -113,11 +102,8 @@ const NewsListView = Backbone.View.extend({
|
|||||||
'initialize': function(options) {
|
'initialize': function(options) {
|
||||||
this.eventBus = options.eventBus;
|
this.eventBus = options.eventBus;
|
||||||
|
|
||||||
/* this.model.on('all', function(eventName) {
|
_.bindAll(this, 'doClick');
|
||||||
console.log(`${eventName } was triggered!`);
|
|
||||||
});*/
|
|
||||||
|
|
||||||
// this.model.bind('change:article', this.doRender, this);
|
|
||||||
this.model.newsCollection.bind('reset', this.render, this);
|
this.model.newsCollection.bind('reset', this.render, this);
|
||||||
this.eventBus.on('showNewsList', this.showNewsListPanel, this);
|
this.eventBus.on('showNewsList', this.showNewsListPanel, this);
|
||||||
},
|
},
|
||||||
@ -143,15 +129,13 @@ const NewsListView = Backbone.View.extend({
|
|||||||
'render' : function() {
|
'render' : function() {
|
||||||
console.log('>> Do render');
|
console.log('>> Do render');
|
||||||
|
|
||||||
console.log(this.model.newsCollection);
|
|
||||||
this.model.newsCollection.each(function(item) {
|
this.model.newsCollection.each(function(item) {
|
||||||
const niView = new NewsItemView({ 'model': item });
|
const niView = new NewsItemView({ 'model': item });
|
||||||
|
|
||||||
this.$el.append(niView.el);
|
this.$el.append(niView.el);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
console.log(this.$el);
|
this.$el.find('.newsItem').on('click', this.doClick);
|
||||||
console.log(this.el);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -31,7 +31,7 @@ const NewsCardModel = Backbone.Model.extend({
|
|||||||
// console.log(fsJSON);
|
// console.log(fsJSON);
|
||||||
|
|
||||||
this.set('article', fsJSON);
|
this.set('article', fsJSON);
|
||||||
console.log(body);
|
// console.log(body);
|
||||||
}
|
}
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user