summaryrefslogtreecommitdiff
path: root/wikipedia
diff options
context:
space:
mode:
authorWill <ifnspifn@gmail.com>2013-11-15 13:32:27 -0800
committerWill <ifnspifn@gmail.com>2013-11-15 15:36:55 -0800
commit2ca91aeee6715ce25bfc23eb68dc5b727cd2e41a (patch)
treeb43b75c2378c2715fb75780b569892fb8c5ce4ab /wikipedia
parenta18690dc897ea81adfb68ab41f77e088069583dd (diff)
Domain specific apps no longer must specify links
Refactored the process of settings which articles should be linked such that, if no linked articles JSON is specified, the view will behave as if hide_links were set to true [endlessm/eos-sdk#402]
Diffstat (limited to 'wikipedia')
-rw-r--r--wikipedia/WikipediaWebView.js2
-rw-r--r--wikipedia/models/domain_wiki_model.js8
-rw-r--r--wikipedia/presenters/domain_wiki_presenter.js9
3 files changed, 12 insertions, 7 deletions
diff --git a/wikipedia/WikipediaWebView.js b/wikipedia/WikipediaWebView.js
index 9f2818a..4fd6ee6 100644
--- a/wikipedia/WikipediaWebView.js
+++ b/wikipedia/WikipediaWebView.js
@@ -116,7 +116,7 @@ const WikipediaWebView = new Lang.Class({
setAllowedLinks: function(){
// If you want to show all links, then
// no point in showing some subset of them as well
- if(!this.hide_links){
+ if(!this.hide_links || this._links_to_show.length === 0){
return;
}
let str = JSON.stringify(this._links_to_show);
diff --git a/wikipedia/models/domain_wiki_model.js b/wikipedia/models/domain_wiki_model.js
index b5ced4e..ef41d3e 100644
--- a/wikipedia/models/domain_wiki_model.js
+++ b/wikipedia/models/domain_wiki_model.js
@@ -16,6 +16,7 @@ const DomainWikiModel = new Lang.Class({
_init: function(params) {
this._articles = [];
this._mainCategory = null;
+ this._linked_articles = undefined;
this._categories = {};
this.parent(params);
},
@@ -90,7 +91,10 @@ const DomainWikiModel = new Lang.Class({
},
getLinkedArticles:function(){
- return this._linked_articles;
+ if(this._linked_articles !== undefined)
+ return this._linked_articles["app_articles"].concat(this._linked_articles["extra_linked_articles"]);
+ else
+ return [];
},
/**
@@ -152,4 +156,4 @@ const DomainWikiModel = new Lang.Class({
getMainCategory: function () {
return this._mainCategory;
}
-}); \ No newline at end of file
+});
diff --git a/wikipedia/presenters/domain_wiki_presenter.js b/wikipedia/presenters/domain_wiki_presenter.js
index 3e59a01..b348825 100644
--- a/wikipedia/presenters/domain_wiki_presenter.js
+++ b/wikipedia/presenters/domain_wiki_presenter.js
@@ -42,14 +42,15 @@ const DomainWikiPresenter = new Lang.Class({
Lang.bind(this, this._onArticleBackClicked));
this.initAppInfoFromJsonFile(app_filename);
- this.initPageRankFromJsonFile(linked_articles_filename);
+
+ if(linked_articles_filename !== '')
+ this.initPageRankFromJsonFile(linked_articles_filename);
let firstLevel = this._model.getMainCategory().getSubcategories();
firstLevel.push(this._model.getMainCategory());
this._view.set_categories(firstLevel);
- let linked_articles = this._model.getLinkedArticles();
- let to_show = linked_articles["app_articles"].concat(linked_articles["extra_linked_articles"]);
+ let to_show = this._model.getLinkedArticles();
this._view.set_showable_links(to_show);
let app_name = _pathnameToAppName(app_filename);
@@ -94,4 +95,4 @@ const DomainWikiPresenter = new Lang.Class({
_onArticleBackClicked: function(button) {
this._view.show_category_page();
}
-}); \ No newline at end of file
+});