diff --git a/app/templates/i18n/i18n-home-view.jade b/app/templates/i18n/i18n-home-view.jade index 6feb08cec..c0604e32b 100644 --- a/app/templates/i18n/i18n-home-view.jade +++ b/app/templates/i18n/i18n-home-view.jade @@ -1,6 +1,9 @@ extends /templates/base block content + .progress + .progress-bar.progress-bar-info(role="progressbar" aria-valuenow=progress aria-valuemin="0" aria-valuemax="100" style="width: "+progress+"%")= progress+"%" + table.table.table-condensed tr th diff --git a/app/views/i18n/I18NHomeView.coffee b/app/views/i18n/I18NHomeView.coffee index 7f933e644..66be39cc1 100644 --- a/app/views/i18n/I18NHomeView.coffee +++ b/app/views/i18n/I18NHomeView.coffee @@ -23,6 +23,11 @@ module.exports = class I18NHomeView extends RootView #- @aggregateModels = new Backbone.Collection() + @aggregateModels.comparator = (m) -> + return 2 if m.specificallyCovered + return 1 if m.generallyCovered + return 0 + project = ['name', 'components.original', 'i18nCoverage', 'slug'] @thangTypes = new CocoCollection([], { url: '/db/thang.type?view=i18n-coverage', project: project, model: ThangType }) @@ -58,6 +63,11 @@ module.exports = class I18NHomeView extends RootView c.languages = languages c.selectedLanguage = @selectedLanguage c.collection = @aggregateModels + + covered = (m for m in @aggregateModels.models when m.specificallyCovered).length + total = @aggregateModels.models.length + c.progress = if total then parseInt(100 * covered / total) else 100 + c updateCoverage: -> @@ -66,7 +76,8 @@ module.exports = class I18NHomeView extends RootView for model in @aggregateModels.models @updateCoverageForModel(model, relatedLanguages) model.generallyCovered = true if @selectedLanguage.startsWith 'en' - + @aggregateModels.sort() + updateCoverageForModel: (model, relatedLanguages) -> model.specificallyCovered = true model.generallyCovered = true