summaryrefslogtreecommitdiff
path: root/wikipedia/models/domain_wiki_model.js
blob: a387ff90077b8ceded6e54b8cb6f8f8d29b5a5cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const Endless = imports.gi.Endless;
const Gio = imports.gi.Gio;
const GObject = imports.gi.GObject;
const Lang = imports.lang;

// Local libraries
const CategoryModel = imports.wikipedia.models.category_model;
const Utils = imports.wikipedia.utils;

const DomainWikiModel = new Lang.Class({

    Name: "DomainWikiModel",
    Extends: GObject.Object,

    //params should have the image-uri for the app's image, and the application name.
    _init: function(params) {
        this.parent(params);
    },

    //categories should be a list of category models, already populated with article models.
    addCategories: function(categories){
        this._categories = categories;
    },

    getArticlesForCategoryIndex: function(index){
        let category = this.getCategories()[index];
        return category.getArticles();
    },

    getCategories: function() {
        return this._categories;
    }
});