dolt 0.29.0 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/dolt.gemspec +1 -1
- data/lib/dolt/sinatra/multi_repo_browser.rb +11 -31
- data/lib/dolt/sinatra/repo_browser.rb +47 -0
- data/lib/dolt/sinatra/single_repo_browser.rb +15 -29
- metadata +4 -75
- data/vendor/ui/.gitignore +0 -4
- data/vendor/ui/.gitmodules +0 -39
- data/vendor/ui/Makefile +0 -48
- data/vendor/ui/autolint.js +0 -13
- data/vendor/ui/buster.js +0 -31
- data/vendor/ui/css/gitorious.css +0 -660
- data/vendor/ui/css/syntax-highlight.css +0 -140
- data/vendor/ui/dist/gitorious3-capillary.min.js +0 -12
- data/vendor/ui/dist/gitorious3.min.css +0 -1
- data/vendor/ui/dist/gitorious3.min.js +0 -3
- data/vendor/ui/favicon.ico +0 -0
- data/vendor/ui/iconic/lock_stroke.svg +0 -17
- data/vendor/ui/images/f5f5f5-980x1.png +0 -0
- data/vendor/ui/images/gitorious.png +0 -0
- data/vendor/ui/images/gitorious2013.png +0 -0
- data/vendor/ui/images/powered-by.png +0 -0
- data/vendor/ui/images/white-980x1.png +0 -0
- data/vendor/ui/js/src/app.js +0 -20
- data/vendor/ui/js/src/cache.js +0 -27
- data/vendor/ui/js/src/capillary.js +0 -7
- data/vendor/ui/js/src/components/abbrev.js +0 -24
- data/vendor/ui/js/src/components/blob.js +0 -154
- data/vendor/ui/js/src/components/capillary.js +0 -51
- data/vendor/ui/js/src/components/clone-name-suggestion.js +0 -38
- data/vendor/ui/js/src/components/clone-url-selection.js +0 -35
- data/vendor/ui/js/src/components/collapse.js +0 -17
- data/vendor/ui/js/src/components/comments.js +0 -111
- data/vendor/ui/js/src/components/commit-linker.js +0 -26
- data/vendor/ui/js/src/components/dropdown.js +0 -74
- data/vendor/ui/js/src/components/ganalytics.js +0 -19
- data/vendor/ui/js/src/components/live-markdown-preview.js +0 -35
- data/vendor/ui/js/src/components/loading.js +0 -33
- data/vendor/ui/js/src/components/oid-ref-interpolator.js +0 -9
- data/vendor/ui/js/src/components/profile-menu.js +0 -36
- data/vendor/ui/js/src/components/rails-links.js +0 -24
- data/vendor/ui/js/src/components/ref-selector.js +0 -116
- data/vendor/ui/js/src/components/repository.js +0 -162
- data/vendor/ui/js/src/components/select-details.js +0 -20
- data/vendor/ui/js/src/components/slugify.js +0 -32
- data/vendor/ui/js/src/components/timeago.js +0 -38
- data/vendor/ui/js/src/components/tree-history.js +0 -140
- data/vendor/ui/js/src/components/url.js +0 -65
- data/vendor/ui/js/src/components/user-repo-view-state.js +0 -4
- data/vendor/ui/js/src/gitorious.js +0 -171
- data/vendor/ui/js/src/json-request.js +0 -6
- data/vendor/ui/js/src/logger.js +0 -84
- data/vendor/ui/js/src/spacer.js +0 -5
- data/vendor/ui/js/test-libs/jquery-1.9.1.min.js +0 -5
- data/vendor/ui/js/test/cache-test.js +0 -47
- data/vendor/ui/js/test/components/abbrev-test.js +0 -22
- data/vendor/ui/js/test/components/blob-test.js +0 -90
- data/vendor/ui/js/test/components/clone-name-suggestion-test.js +0 -37
- data/vendor/ui/js/test/components/clone-url-selection-test.js +0 -25
- data/vendor/ui/js/test/components/comments-test.js +0 -139
- data/vendor/ui/js/test/components/commit-linker-test.js +0 -46
- data/vendor/ui/js/test/components/live-markdown-preview-test.js +0 -37
- data/vendor/ui/js/test/components/profile-menu-test.js +0 -46
- data/vendor/ui/js/test/components/ref-selector-test.js +0 -140
- data/vendor/ui/js/test/components/repository-admin-test.js +0 -37
- data/vendor/ui/js/test/components/repository-watching-test.js +0 -74
- data/vendor/ui/js/test/components/timeago-test.js +0 -74
- data/vendor/ui/js/test/components/tree-history-test.js +0 -324
- data/vendor/ui/js/test/components/url-template-test.js +0 -65
- data/vendor/ui/js/test/test-helper.js +0 -2
- data/vendor/ui/lib/bootstrap/css/bootstrap-responsive.min.css +0 -9
- data/vendor/ui/lib/bootstrap/css/bootstrap.min.css +0 -9
- data/vendor/ui/lib/bootstrap/img/glyphicons-halflings-white.png +0 -0
- data/vendor/ui/lib/bootstrap/img/glyphicons-halflings.png +0 -0
- data/vendor/ui/lib/bootstrap/js/bootstrap.min.js +0 -6
- data/vendor/ui/package.json +0 -21
- data/vendor/ui/todo.org +0 -4
@@ -1,38 +0,0 @@
|
|
1
|
-
/*global cull, dome*/
|
2
|
-
this.gts = this.gts || {};
|
3
|
-
|
4
|
-
this.gts.cloneNameSuggestion = (function () {
|
5
|
-
function repoName(name, repo) {
|
6
|
-
var prefix = /s$/.test(name) ? name : name + "s";
|
7
|
-
return prefix + "-" + repo;
|
8
|
-
}
|
9
|
-
|
10
|
-
return function cloneNameSuggestion(form) {
|
11
|
-
var repo = dome.data.get("gts-repository-to-clone", form);
|
12
|
-
var userInput = dome.id("repository_owner_type_user");
|
13
|
-
var groupInput = dome.id("repository_owner_type_group");
|
14
|
-
var groupSelect = dome.id("repository_owner_id_group_select");
|
15
|
-
var nameInput = dome.id("repository_name");
|
16
|
-
|
17
|
-
var names = cull.reduce(function (memo, option) {
|
18
|
-
return memo.concat(repoName(option.innerHTML, repo));
|
19
|
-
}, [repoName(dome.data.get("gts-owner", userInput), repo)], groupSelect.options);
|
20
|
-
|
21
|
-
function setSuggestion() {
|
22
|
-
if (nameInput.value && cull.indexOf(nameInput.value, names) < 0) { return; }
|
23
|
-
if (userInput.checked) {
|
24
|
-
nameInput.value = names[0];
|
25
|
-
return;
|
26
|
-
}
|
27
|
-
if (groupInput.checked) {
|
28
|
-
var option = groupSelect.options[groupSelect.selectedIndex];
|
29
|
-
nameInput.value = repoName(option.innerHTML, repo);
|
30
|
-
}
|
31
|
-
}
|
32
|
-
|
33
|
-
dome.on(userInput, "click", setSuggestion);
|
34
|
-
dome.on(groupInput, "click", setSuggestion);
|
35
|
-
dome.on(groupSelect, "change", setSuggestion);
|
36
|
-
setSuggestion();
|
37
|
-
};
|
38
|
-
}());
|
@@ -1,35 +0,0 @@
|
|
1
|
-
/*global cull, dome*/
|
2
|
-
this.gts = this.gts || {};
|
3
|
-
|
4
|
-
/**
|
5
|
-
* When clicking clone URLs, copy them to the related input field.
|
6
|
-
*/
|
7
|
-
this.gts.cloneUrlSelection = (function () {
|
8
|
-
function selectCloneUrl(element, selected) {
|
9
|
-
var links = dome.byClass("gts-repo-url", element);
|
10
|
-
cull.doall(cull.partial(dome.cn.rm, "active"), links);
|
11
|
-
if (selected) {
|
12
|
-
dome.cn.add("active", selected);
|
13
|
-
var input = dome.byClass("gts-current-repo-url", element)[0];
|
14
|
-
input.value = selected.getAttribute("href").replace("ssh://", "");
|
15
|
-
input.focus();
|
16
|
-
}
|
17
|
-
}
|
18
|
-
|
19
|
-
function cloneUrlSelection(element) {
|
20
|
-
var input = element.getElementsByTagName("input")[0];
|
21
|
-
|
22
|
-
if (input) {
|
23
|
-
dome.on(input, "focus", function (e) { this.select(); });
|
24
|
-
}
|
25
|
-
|
26
|
-
dome.delegate.bycn("gts-repo-url", element, "click", function (e) {
|
27
|
-
e.preventDefault();
|
28
|
-
e.stopPropagation();
|
29
|
-
selectCloneUrl(element, e.target);
|
30
|
-
});
|
31
|
-
}
|
32
|
-
|
33
|
-
cloneUrlSelection.select = selectCloneUrl;
|
34
|
-
return cloneUrlSelection;
|
35
|
-
}());
|
@@ -1,17 +0,0 @@
|
|
1
|
-
/*global dome, gts*/
|
2
|
-
|
3
|
-
/**
|
4
|
-
* A very simplified version of bootstrap's collapse - toggles the "in" class on
|
5
|
-
* "collapse" elements when the associated trigger is clicked. Attaches a single
|
6
|
-
* click listener to the body.
|
7
|
-
*/
|
8
|
-
this.gts.collapse = function () {
|
9
|
-
dome.on(document.body, "click", function (e) {
|
10
|
-
if (dome.data.get("toggle", e.target) !== "collapse") { return; }
|
11
|
-
var target = dome.id(dome.data.get("target", e.target).slice(1));
|
12
|
-
if (!target) { return; }
|
13
|
-
dome.cn[dome.cn.has("in", target) ? "rm" : "add"]("in", target);
|
14
|
-
e.preventDefault();
|
15
|
-
e.stopPropagation();
|
16
|
-
});
|
17
|
-
};
|
@@ -1,111 +0,0 @@
|
|
1
|
-
/*global cull, dome, gts*/
|
2
|
-
this.gts = this.gts || {};
|
3
|
-
|
4
|
-
/**
|
5
|
-
* Create, display and edit comments.
|
6
|
-
*/
|
7
|
-
this.gts.comments = (function (el) {
|
8
|
-
function renderCommentDate(comment) {
|
9
|
-
var created = this.gts.timeago(el.span({ title: comment.createdAt }));
|
10
|
-
if (comment.createdAt === comment.updatedAt) { return created; }
|
11
|
-
return el.span([
|
12
|
-
created,
|
13
|
-
"(edited ",
|
14
|
-
this.gts.timeago(el.span({ title: comment.updatedAt })),
|
15
|
-
")"
|
16
|
-
]);
|
17
|
-
}
|
18
|
-
|
19
|
-
function renderEditForm(comment) {
|
20
|
-
console.log("Edit");
|
21
|
-
}
|
22
|
-
|
23
|
-
function renderEditLink(comment) {
|
24
|
-
if (!comment.editPath) { return ""; }
|
25
|
-
var link = el.a({
|
26
|
-
href: comment.editPath,
|
27
|
-
events: {
|
28
|
-
click: function (e) {
|
29
|
-
e.preventDefault();
|
30
|
-
e.stopPropagation();
|
31
|
-
renderEditForm(link.parentNode.parentNode);
|
32
|
-
}
|
33
|
-
}
|
34
|
-
}, "Edit comment");
|
35
|
-
|
36
|
-
return link;
|
37
|
-
}
|
38
|
-
|
39
|
-
/**
|
40
|
-
* Renders a comment object:
|
41
|
-
* {
|
42
|
-
* body: "string",
|
43
|
-
* createdAt: "YYYY-MM-DDTHH:MM:SS+HH:00",
|
44
|
-
* updatedAt: "YYYY-MM-DDTHH:MM:SS+HH:00",
|
45
|
-
* author: {
|
46
|
-
* avatarPath: "/some/path.png",
|
47
|
-
* profilePath: "/~user",
|
48
|
-
* name: "string",
|
49
|
-
* login: "string"
|
50
|
-
* },
|
51
|
-
* editPath: "/if/available/to/current/user"
|
52
|
-
* }
|
53
|
-
*/
|
54
|
-
function renderComment(comment) {
|
55
|
-
var author = comment.author;
|
56
|
-
return el.div({ className: "gts-comment" }, [
|
57
|
-
el.p({ innerHTML: comment.body }),
|
58
|
-
el.p([
|
59
|
-
el.img({ src: author.avatarPath }),
|
60
|
-
el.a({ href: author.profilePath }, author.name),
|
61
|
-
renderCommentDate(comment),
|
62
|
-
renderEditLink(comment)
|
63
|
-
])
|
64
|
-
]);
|
65
|
-
}
|
66
|
-
|
67
|
-
function renderComments(comments, container) {
|
68
|
-
if (comments.length === 0) { return; }
|
69
|
-
container.style.display = "block";
|
70
|
-
var inner = document.createElement("div");
|
71
|
-
container.appendChild(inner);
|
72
|
-
dome.setContent(cull.map(renderComment, comments), inner);
|
73
|
-
}
|
74
|
-
|
75
|
-
function zeroPad(num) {
|
76
|
-
return num < 10 ? "0" + num : num;
|
77
|
-
}
|
78
|
-
|
79
|
-
/**
|
80
|
-
* Personalizes an existing form with a user.
|
81
|
-
* {
|
82
|
-
* name: "Christian Johansen",
|
83
|
-
* login: "christian",
|
84
|
-
* unreadMessageCount: 5,
|
85
|
-
* dashboardPath: "/",
|
86
|
-
* profilePath: "/~christian",
|
87
|
-
* editPath: "/~christian/edit",
|
88
|
-
* messagesPath: "/messages",
|
89
|
-
* logoutPath: "/logout",
|
90
|
-
* avatarPath: "/some/avatar.png"
|
91
|
-
* }
|
92
|
-
*/
|
93
|
-
function personalizeForm(user, form) {
|
94
|
-
form.style.display = "block";
|
95
|
-
var ph = dome.byClass("gts-comment-author-ph", form)[0];
|
96
|
-
if (!ph) { return ph; }
|
97
|
-
var now = new Date();
|
98
|
-
|
99
|
-
return dome.replace(ph, el.p([
|
100
|
-
el.img({ src: user.avatarPath }),
|
101
|
-
el.a({ href: user.profilePath }, user.name),
|
102
|
-
" " + zeroPad(now.getHours()) + ":" + zeroPad(now.getMinutes())
|
103
|
-
]));
|
104
|
-
}
|
105
|
-
|
106
|
-
return {
|
107
|
-
renderComments: renderComments,
|
108
|
-
renderComment: renderComment,
|
109
|
-
personalizeForm: personalizeForm
|
110
|
-
};
|
111
|
-
}(dome.el));
|
@@ -1,26 +0,0 @@
|
|
1
|
-
/*global cull, dome*/
|
2
|
-
// The global, shared Gitorious namespace
|
3
|
-
var gts = this.gts || {};
|
4
|
-
|
5
|
-
/**
|
6
|
-
* Adds a live event handler to a root element that fires on any
|
7
|
-
* element with the class "gts-commit-oid". This is used to link
|
8
|
-
* commit oids from Dolt to commit pages in Gitorious.
|
9
|
-
*
|
10
|
-
* root - The root element where "gts-commit-oid" links are expected
|
11
|
-
* urlTemplate - The URL template to link to. Should be a URL with the
|
12
|
-
* #{oid} placeholder.
|
13
|
-
* handler - The function to call when a commit link is clicked. The
|
14
|
-
* handler will be called with the resolved URL as its only
|
15
|
-
* argument.
|
16
|
-
*/
|
17
|
-
(function (partial, d) {
|
18
|
-
gts.commitLinker = function (root, urlTemplate, handler) {
|
19
|
-
d.cn.add("gts-commit-linker", root);
|
20
|
-
d.delegate.bycn("gts-commit-oid", root, "click", function (e) {
|
21
|
-
handler(gts.url.render(urlTemplate, {
|
22
|
-
oid: dome.data.get("gts-commit-oid", this)
|
23
|
-
}));
|
24
|
-
});
|
25
|
-
};
|
26
|
-
}(cull.partial, dome));
|
@@ -1,74 +0,0 @@
|
|
1
|
-
/*global dome*/
|
2
|
-
/**
|
3
|
-
* A simplified version of the Bootstrap dropdown jQuery plugin. Uses dome
|
4
|
-
* instead of jQuery and does not support most features in the original code,
|
5
|
-
* only toggling the dropdown.
|
6
|
-
*
|
7
|
-
* Original license follows.
|
8
|
-
*
|
9
|
-
* ============================================================
|
10
|
-
* bootstrap-dropdown.js v2.3.2
|
11
|
-
* http://twitter.github.com/bootstrap/javascript.html#dropdowns
|
12
|
-
* ============================================================
|
13
|
-
* Copyright 2012 Twitter, Inc.
|
14
|
-
*
|
15
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
16
|
-
* you may not use this file except in compliance with the License.
|
17
|
-
* You may obtain a copy of the License at
|
18
|
-
*
|
19
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
20
|
-
*
|
21
|
-
* Unless required by applicable law or agreed to in writing, software
|
22
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
23
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
24
|
-
* See the License for the specific language governing permissions and
|
25
|
-
* limitations under the License.
|
26
|
-
* ===========================================================
|
27
|
-
*/
|
28
|
-
this.gts.dropdown = (function (D) {
|
29
|
-
return function dropdown(element) {
|
30
|
-
var backdrop, active = false;
|
31
|
-
|
32
|
-
function close() {
|
33
|
-
if (backdrop) {
|
34
|
-
backdrop.parentNode.removeChild(backdrop);
|
35
|
-
backdrop = null;
|
36
|
-
}
|
37
|
-
|
38
|
-
D.cn.rm("open", element);
|
39
|
-
active = false;
|
40
|
-
}
|
41
|
-
|
42
|
-
function toggle(element) {
|
43
|
-
if (active) { return close(); }
|
44
|
-
|
45
|
-
if (document.documentElement.hasOwnProperty("ontouchstart")) {
|
46
|
-
// if mobile we we use a backdrop because click events don't
|
47
|
-
// delegate
|
48
|
-
backdrop = D.el("div", {
|
49
|
-
className: "dropdown-backdrop",
|
50
|
-
events: { click: close }
|
51
|
-
});
|
52
|
-
element.insertBefore(backdrop, element);
|
53
|
-
}
|
54
|
-
D.cn.add("open", element);
|
55
|
-
active = true;
|
56
|
-
}
|
57
|
-
|
58
|
-
D.on(element, "click", function (e) {
|
59
|
-
var target = e.target.tagName === "A" ? e.target : e.target.parentNode;
|
60
|
-
if (!dome.cn.has("dropdown-toggle", target)) { return; }
|
61
|
-
toggle(this);
|
62
|
-
e.preventDefault();
|
63
|
-
e.stopPropagation();
|
64
|
-
});
|
65
|
-
|
66
|
-
D.on(document.body, "click", close);
|
67
|
-
D.on(document.body, "keydown", function (e) {
|
68
|
-
if (e.keyCode !== 27) { return; }
|
69
|
-
close();
|
70
|
-
e.preventDefault();
|
71
|
-
e.stopPropagation();
|
72
|
-
});
|
73
|
-
};
|
74
|
-
}(dome));
|
@@ -1,19 +0,0 @@
|
|
1
|
-
// The global, shared Gitorious namespace
|
2
|
-
var gts = this.gts || {};
|
3
|
-
|
4
|
-
gts.googleAnalytics = function (account, domainName) {
|
5
|
-
window._gaq = window._gaq || [];
|
6
|
-
window._gaq.push(["_setAccount", account]);
|
7
|
-
if (domainName) {
|
8
|
-
window._gaq.push(["_setDomainName", domainName]);
|
9
|
-
}
|
10
|
-
window._gaq.push(["_trackPageview"]);
|
11
|
-
var ga = document.createElement("script");
|
12
|
-
ga.type = "text/javascript";
|
13
|
-
ga.async = true;
|
14
|
-
ga.src = ("https:" === document.location.protocol ?
|
15
|
-
"https://ssl" :
|
16
|
-
"http://www") + ".google-analytics.com/ga.js";
|
17
|
-
(document.getElementsByTagName("head")[0] ||
|
18
|
-
document.getElementsByTagName("body")[0]).appendChild(ga);
|
19
|
-
};
|
@@ -1,35 +0,0 @@
|
|
1
|
-
/*global Showdown*/
|
2
|
-
|
3
|
-
/**
|
4
|
-
* Monitor a textarea and render a live preview of its content parsed as
|
5
|
-
* Markdown. The textarea needs to have the data attribute
|
6
|
-
* data-gts-preview-target set, and it should be an id of an element elsewhere
|
7
|
-
* in the document. The target element needs to contain at least a div element,
|
8
|
-
* which is where the preview will be rendered.
|
9
|
-
*
|
10
|
-
* When previewing, the target will be hidden when the textarea is empty, and
|
11
|
-
* shown with block display when there is content.
|
12
|
-
*/
|
13
|
-
this.gts.liveMarkdownPreview = function liveMarkdownPreview(textarea) {
|
14
|
-
var attr = textarea.getAttribute("data-gts-preview-target");
|
15
|
-
var target = document.getElementById(attr);
|
16
|
-
if (!target || typeof Showdown === "undefined") { return; }
|
17
|
-
var converter = new Showdown.converter();
|
18
|
-
var previous, content;
|
19
|
-
|
20
|
-
function setPreview(preview) {
|
21
|
-
target.style.display = preview ? "block" : "none";
|
22
|
-
target.getElementsByTagName("div")[0].innerHTML = preview;
|
23
|
-
}
|
24
|
-
|
25
|
-
function updatePreview() {
|
26
|
-
content = textarea.value;
|
27
|
-
if (content !== previous) {
|
28
|
-
previous = content;
|
29
|
-
setPreview(converter.makeHtml(content));
|
30
|
-
}
|
31
|
-
setTimeout(updatePreview, 20);
|
32
|
-
}
|
33
|
-
|
34
|
-
updatePreview();
|
35
|
-
};
|
@@ -1,33 +0,0 @@
|
|
1
|
-
/*global Spinner, dome*/
|
2
|
-
this.gts = this.gts || {};
|
3
|
-
|
4
|
-
/**
|
5
|
-
* Put a spinner in an element that's waiting to be loaded with some content.
|
6
|
-
*/
|
7
|
-
this.gts.loading = function (element, options) {
|
8
|
-
dome.cn.add("loading", element);
|
9
|
-
element.innerHTML = "";
|
10
|
-
options = options || {};
|
11
|
-
|
12
|
-
var spinner = new Spinner({
|
13
|
-
lines: options.hasOwnProperty("lines") ? options.lines : 8,
|
14
|
-
length: options.hasOwnProperty("length") ? options.length : 2,
|
15
|
-
width: options.hasOwnProperty("width") ? options.width : 2,
|
16
|
-
radius: options.hasOwnProperty("radius") ? options.radius : 3,
|
17
|
-
color: options.color || "#000",
|
18
|
-
speed: options.hasOwnProperty("speed") ? options.speed : 1,
|
19
|
-
trail: options.hasOwnProperty("trail") ? options.trail : 100,
|
20
|
-
shadow: options.hasOwnProperty("shadow") ? options.shadow : false
|
21
|
-
}).spin();
|
22
|
-
|
23
|
-
spinner.el.style.top = options.topPos || "10px";
|
24
|
-
element.appendChild(spinner.el);
|
25
|
-
|
26
|
-
var text = options.hasOwnProperty("text") ? options.text : "Loading...";
|
27
|
-
|
28
|
-
if (text) {
|
29
|
-
var textEl = document.createElement("span");
|
30
|
-
textEl.innerHTML = text;
|
31
|
-
element.appendChild(textEl);
|
32
|
-
}
|
33
|
-
};
|
@@ -1,9 +0,0 @@
|
|
1
|
-
this.gts = this.gts || {};
|
2
|
-
|
3
|
-
this.gts.oidRefInterpolator = function (element, refs, urlTemplate) {
|
4
|
-
var current = this.gts.refSelector.getCurrentRef("heads", element.innerHTML, refs);
|
5
|
-
if (current) {
|
6
|
-
element.title = current[1];
|
7
|
-
element.innerHTML = current[0];
|
8
|
-
}
|
9
|
-
};
|
@@ -1,36 +0,0 @@
|
|
1
|
-
/*global dome*/
|
2
|
-
// The global, shared Gitorious namespace
|
3
|
-
var gts = this.gts || {};
|
4
|
-
|
5
|
-
/**
|
6
|
-
* Builds the profile menu for the specified user and replaces the
|
7
|
-
* login button. If there is no user, nothing happens.
|
8
|
-
*/
|
9
|
-
(function (d, e) {
|
10
|
-
function button(text, path, icon) {
|
11
|
-
text = " " + text;
|
12
|
-
var content = icon ? [e.i({className: "icon-" + icon}), text] : [text];
|
13
|
-
return e.li(e.a({ href: path }, content));
|
14
|
-
}
|
15
|
-
|
16
|
-
gts.profileMenu = function (root, user) {
|
17
|
-
if (!user) { return; }
|
18
|
-
d.setContent([
|
19
|
-
e.a({ className: "btn btn-inverse", href: user.dashboardPath },
|
20
|
-
[e.i({ className: "icon-user icon-white" }), user.login]),
|
21
|
-
e.a({ className: "btn btn-inverse dropdown-toggle",
|
22
|
-
href: "#",
|
23
|
-
data: { toggle: "dropdown" }
|
24
|
-
}, e.span({ className: "caret" }, " ")),
|
25
|
-
e.ul({ className: "dropdown-menu" }, [
|
26
|
-
button("Edit", user.editPath, "pencil"),
|
27
|
-
button("Messages", user.messagesPath, "envelope"),
|
28
|
-
e.li({ className: "divider" }),
|
29
|
-
button("Dashboard", user.dashboardPath),
|
30
|
-
button("Public profile", user.profilePath),
|
31
|
-
button("Log out", user.logoutPath)
|
32
|
-
])
|
33
|
-
], root);
|
34
|
-
gts.dropdown(root);
|
35
|
-
};
|
36
|
-
}(dome, dome.el));
|