render: function()

in assets/app/views/editor/breadcrumb.js [21:63]


  render: function () {
    var self    = this,
        model   = this.model,
        owner   = this.model.get('owner'),
        repo    = this.model.get('repoName'),
        branch  = this.model.get('branch'),
        file    = this.model.get('file'),
        type    = (this.model.configFiles['_navigation.json'].present) ? 'pages' : 'files',
        filePath,
        defaultBranch = federalist.sites.findWhere({
          owner: owner,
          repository: repo
        }).get('defaultBranch');

    this.model.set('defaultBranch', defaultBranch);

    this.$el.empty();

    if (!file) return this;

    if (type === 'files') {
      this.$el.addClass('files');
      this.$el.append(html({
        text: 'All files',
        link: ['#edit', owner, repo, branch].join('/')
      }));

      filePath = file.split('/');
      filePath.forEach(function(file, i) {
        var repoHref = [owner, repo, branch].join('/');
        var fileHref = filePath.slice(0, i + 1).join('/');
        var link = ['#edit', repoHref, fileHref].join('/');
        self.$el.append(html({ text: file, link: link }));
      });
    }
    else {
      this.$el.append(html({
        text: 'All pages',
        link: ['#edit', owner, repo, defaultBranch].join('/')
      }));
    }
    return this;
  }