<commit_before>/** @jsx m */

"use strict";
require("./UserBar.scss");

var _ = require("underscore");

var OnUnload = require("../utils/OnUnload.js");
var Dropdown = require("./Dropdown.js");

var UserBar = {};

UserBar.controller = function(options) {
  OnUnload(this);
  this.user = options.user;

  if (this.user) {
    this.controllers.dropdown = new Dropdown.controller({
      className: "user",
      label: this.user.get("email")
    });
  }
};

UserBar.view = function(ctrl) {
  var user = ctrl.user;
  if (!user) {
    return <ul className="UserBar"/>;
  }

  var extras = [];
  if (user.canInvite()) {
    extras.push(routeLi("/invite", "Invite a friend"));
  }

  if (user.canEdit()) {
    extras.push(routeLi("/articles/new", "Add an article"));
  }

  var adminExtras = []
  if (user.get("admin")) {
    adminExtras.push(routeLi("/admin", "Admin"));<commit_msg>UserBar: link to the new author page<commit_after>/** @jsx m */

"use strict";
require("./UserBar.scss");

var _ = require("underscore");

var OnUnload = require("../utils/OnUnload.js");
var Dropdown = require("./Dropdown.js");

var UserBar = {};

UserBar.controller = function(options) {
  OnUnload(this);
  this.user = options.user;

  if (this.user) {
    this.controllers.dropdown = new Dropdown.controller({
      className: "user",
      label: this.user.get("email")
    });
  }
};

UserBar.view = function(ctrl) {
  var user = ctrl.user;
  if (!user) {
    return <ul className="UserBar"/>;
  }

  var extras = [];
  if (user.canInvite()) {
    extras.push(routeLi("/invite", "Invite a friend"));
  }

  if (user.canEdit()) {
    extras.push(routeLi("/articles/new", "Add an article"));
    extras.push(routeLi("/authors/new", "Add an author"));
  }

  var adminExtras = []
  if (user.get("admin")) {
    adminExtras.push(routeLi("/admin", "Admin"));
{'fraction_non_alphanumeric': 0.1984732824427481, 'fraction_numerical': 0.0, 'mean_word_length': 3.453883495145631, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1754419', 'n_tokens_mistral': 657, 'n_tokens_neox': 641, 'n_words': 129}