Sha256: 42efa0f5863cbee599957e3b0cecd1ba815ad4e050b805700a30d962fd140ff1

Contents?: true

Size: 1.33 KB

Versions: 7

Compression:

Stored size: 1.33 KB

Contents

/*global dome*/
// The global, shared Gitorious namespace
var gts = this.gts || {};

/**
 * Builds the profile menu for the specified user and replaces the
 * login button. If there is no user, nothing happens.
 */
(function (d, e) {
    function button(text, path, icon) {
        text = " " + text;
        var content = icon ? [e.i({className: "icon-" + icon}), text] : [text];
        return e.li(e.a({ href: path }, content));
    }

    gts.profileMenu = function (root, user) {
        if (!user) { return; }
        d.setContent([
            e.a({ className: "btn btn-inverse", href: user.dashboardPath },
                [e.i({ className: "icon-user icon-white" }), user.login]),
            e.a({ className: "btn btn-inverse dropdown-toggle",
                  href: "#",
                  data: { toggle: "dropdown" }
                }, e.span({ className: "caret" }, " ")),
            e.ul({ className: "dropdown-menu" }, [
                button("Edit", user.editPath, "pencil"),
                button("Messages", user.messagesPath, "envelope"),
                e.li({ className: "divider" }),
                button("Dashboard", user.dashboardPath),
                button("Public profile", user.profilePath),
                button("Log out", user.logoutPath)
            ])
        ], root);
        gts.dropdown(root);
    };
}(dome, dome.el));

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
dolt-0.29.0 vendor/ui/js/src/components/profile-menu.js
dolt-0.28.1 vendor/ui/js/src/components/profile-menu.js
dolt-0.28.0 vendor/ui/js/src/components/profile-menu.js
dolt-0.27.0 vendor/ui/js/src/components/profile-menu.js
dolt-0.26.0 vendor/ui/js/src/components/profile-menu.js
dolt-0.25.0 vendor/ui/js/src/components/profile-menu.js
dolt-0.24.0 vendor/ui/js/src/components/profile-menu.js