From 5068ca5c0d88694ec1c25dce81c747d5cfa6b54e Mon Sep 17 00:00:00 2001 From: Adam Mathes Date: Fri, 27 Apr 2018 15:52:00 -0700 Subject: separator for scrape --- static/ui.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'static/ui.js') diff --git a/static/ui.js b/static/ui.js index 0c60630..4e6d7e0 100644 --- a/static/ui.js +++ b/static/ui.js @@ -208,7 +208,7 @@ var ControlsView = Backbone.View.extend({ var Item = Backbone.Model.extend({ idAttribute: "_id", - url: '/item/', + url: '/item', initialize: function() { var p_url = this.get('url'); @@ -252,6 +252,16 @@ var Item = Backbone.Model.extend({ full: function() { this.set({'full': !(this.get('full'))} ); + // this should just use this.fetch() but + // it kept GETing from /item instead of /item/id + // so just hacking this in for now + + if(this.get('full_content') == "") { + $.getJSON('/item/' + this.get('_id'), function(data) { + var i = App.items.get(data['_id']) + i.set('full_content', data['full_content']); + }); + } } }); @@ -259,6 +269,8 @@ var Item = Backbone.Model.extend({ var ItemCollection = Backbone.Collection.extend({ model: Item, + url: '/item', + initialize: function() { _.bindAll(this, 'boot', 'reboot'); }, -- cgit v1.2.3