summaryrefslogtreecommitdiff
path: root/wikipedia/presenters
diff options
context:
space:
mode:
authorRory MacQueen <rorymacqueen@gmail.com>2013-08-30 12:56:56 -0700
committerRory MacQueen <rorymacqueen@gmail.com>2013-09-03 09:28:53 -0700
commitd64a015003167262875aec3aed7a5ffe64c0882b (patch)
tree4e56dc1222099a8971c93efa734ab9708b8bd529 /wikipedia/presenters
parent0837dd9c1a8c7ed772bd1f763c9e8e70cc31cf4f (diff)
Allowed links in domain specific apps
These are the changes to the wikipedia SDK to allow for certain showable links in the domain specific apps. The JSON file will specify which links can be clickable across all articles. [endlessm/eos-sdk#282]
Diffstat (limited to 'wikipedia/presenters')
-rw-r--r--wikipedia/presenters/domain_wiki_presenter.js19
1 files changed, 13 insertions, 6 deletions
diff --git a/wikipedia/presenters/domain_wiki_presenter.js b/wikipedia/presenters/domain_wiki_presenter.js
index b6b432a..2ddaa5d 100644
--- a/wikipedia/presenters/domain_wiki_presenter.js
+++ b/wikipedia/presenters/domain_wiki_presenter.js
@@ -18,21 +18,23 @@ const DomainWikiPresenter = new Lang.Class({
Name: "DomainWikiPresenter",
Extends: GObject.Object,
- _init: function(model, view, filename) {
+ _init: function(model, view, app_filename, linked_articles_filename) {
this._domain_wiki_model = model;
this._domain_wiki_view = view;
this._domain_wiki_view.set_presenter(this)
this._domain_wiki_view.connect('category-chosen', Lang.bind(this, this._onCategoryClicked));
this._domain_wiki_view.connect('article-chosen', Lang.bind(this, this._onArticleClicked));
- this.initFromJsonFile(filename);
+ this.initAppInfoFromJsonFile(app_filename);
+ this.initPageRankFromJsonFile(linked_articles_filename);
- let categories = this._domain_wiki_model.getCategories();
+ this._domain_wiki_view.set_categories(this._domain_wiki_model.getCategories());
- this._domain_wiki_view.set_categories(categories);
+ let linked_articles = this._domain_wiki_model.getLinkedArticles();
+ let to_show = linked_articles["app_articles"].concat(linked_articles["extra_linked_articles"]);
+ this._domain_wiki_view.set_showable_links(to_show);
},
-
initArticleModels: function(articles) {
let _articles = new Array();
for(let i = 0; i < articles.length; i++) {
@@ -44,7 +46,12 @@ const DomainWikiPresenter = new Lang.Class({
return _articles;
},
- initFromJsonFile: function(filename) {
+ initPageRankFromJsonFile: function(filename){
+ let articles = JSON.parse(Utils.load_file_from_resource(filename));
+ this._domain_wiki_model.setLinkedArticles(articles);
+ },
+
+ initAppInfoFromJsonFile: function(filename) {
let app_content = JSON.parse(Utils.load_file_from_resource(filename));
this._lang_code = filename.substring(0, 2);
let categories = app_content['categories'];