diff options
author | Nick Isaacs <nick@endlessm.com> | 2013-08-15 14:40:09 -0700 |
---|---|---|
committer | Nick Isaacs <nick@endlessm.com> | 2013-08-21 14:29:05 -0700 |
commit | 34deb37e1a26cb8817bf86ddf23d3600285a4292 (patch) | |
tree | f827b8ab8735baea17ffd0d207375baad5f1be79 /wikipedia/presenters | |
parent | 973b40e1962fa462bc3d477ca2c6ef10588c8d24 (diff) |
Can add articles to the main category.
If there are articles for an app's main category, then it becomes clickable and acts like any other category.
If there are no articles for a category, it isn't cilckable and has no hover animations.
We no longer use the Title Label View since the main category is now a category button like any other.
[endlessm/eos-sdk#259]
Diffstat (limited to 'wikipedia/presenters')
-rw-r--r-- | wikipedia/presenters/domain_wiki_presenter.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/wikipedia/presenters/domain_wiki_presenter.js b/wikipedia/presenters/domain_wiki_presenter.js index 15229ce..b6b432a 100644 --- a/wikipedia/presenters/domain_wiki_presenter.js +++ b/wikipedia/presenters/domain_wiki_presenter.js @@ -46,8 +46,6 @@ const DomainWikiPresenter = new Lang.Class({ initFromJsonFile: function(filename) { let app_content = JSON.parse(Utils.load_file_from_resource(filename)); - this._application_name = app_content['app_name']; - this._image_uri = app_content['app_image_uri']; this._lang_code = filename.substring(0, 2); let categories = app_content['categories']; let cat_length = categories.length @@ -56,18 +54,24 @@ const DomainWikiPresenter = new Lang.Class({ let category = categories[i]; let categoryModel = this.initCategory(category); let articles = category['articles']; - categoryModel.addArticles(this.initArticleModels(articles)); + let articleModels = []; + if(!(articles.length == 0)) { + //if the category has no articles, then we cannot initialize them. + //This happens if the main category isn't clickable. + articleModels = this.initArticleModels(articles); + } + categoryModel.addArticles(articleModels); category_models.push(categoryModel); } this._domain_wiki_model.addCategories(category_models); - this._domain_wiki_view.set_front_page_info(this._application_name, this._image_uri); }, initCategory: function(category){ let image_uri = category['image_file']; let image_thumbnail_uri = category['image_thumb_uri']; let params = {description:category['content_text'], image_uri:image_uri, - image_thumbnail_uri:image_thumbnail_uri, title:category['category_name']}; + image_thumbnail_uri:image_thumbnail_uri, title:category['category_name'], + is_main_category:category['is_main_category']}; return new CategoryModel.CategoryModel(params); }, |