mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-26 07:58:34 +02:00
Better helper bar with float and more room for options
This commit is contained in:
parent
af12fe19f0
commit
17fda94aff
6 changed files with 49 additions and 9 deletions
|
@ -1,7 +1,7 @@
|
||||||
var _ = require('underscore');
|
var _ = require('underscore');
|
||||||
var intl = require('../intl');
|
var intl = require('../intl');
|
||||||
|
|
||||||
var Graph = require('../graph');
|
var Graph = require('../graph');
|
||||||
var Errors = require('../util/errors');
|
var Errors = require('../util/errors');
|
||||||
var CommandProcessError = Errors.CommandProcessError;
|
var CommandProcessError = Errors.CommandProcessError;
|
||||||
var GitError = Errors.GitError;
|
var GitError = Errors.GitError;
|
||||||
|
|
|
@ -14,6 +14,13 @@ var Graph = {
|
||||||
objID,
|
objID,
|
||||||
gitVisuals
|
gitVisuals
|
||||||
) {
|
) {
|
||||||
|
// circular dependency, should move these base models OUT of
|
||||||
|
// the git class to resolve this
|
||||||
|
var Git = require('../git');
|
||||||
|
var Commit = Git.Commit;
|
||||||
|
var Ref = Git.Ref;
|
||||||
|
var Branch = Git.Branch;
|
||||||
|
var Tag = Git.Tag;
|
||||||
if (createdSoFar[objID]) {
|
if (createdSoFar[objID]) {
|
||||||
// base case
|
// base case
|
||||||
return createdSoFar[objID];
|
return createdSoFar[objID];
|
||||||
|
@ -82,7 +89,6 @@ var Graph = {
|
||||||
parentObjs.push(this.getOrMakeRecursive(tree, createdSoFar, parentID));
|
parentObjs.push(this.getOrMakeRecursive(tree, createdSoFar, parentID));
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
var Commit = require('../git').Commit;
|
|
||||||
var commit = new Commit(_.extend(
|
var commit = new Commit(_.extend(
|
||||||
commitJSON,
|
commitJSON,
|
||||||
{
|
{
|
||||||
|
@ -121,8 +127,6 @@ var Graph = {
|
||||||
},
|
},
|
||||||
|
|
||||||
getUpstreamSet: function(engine, ancestor) {
|
getUpstreamSet: function(engine, ancestor) {
|
||||||
invariant(typeof ancestor === 'string', 'pass in string');
|
|
||||||
|
|
||||||
var commit = engine.getCommitFromRef(ancestor);
|
var commit = engine.getCommitFromRef(ancestor);
|
||||||
var ancestorID = commit.get('id');
|
var ancestorID = commit.get('id');
|
||||||
var queue = [commit];
|
var queue = [commit];
|
||||||
|
|
|
@ -596,6 +596,10 @@ var LevelToolbar = BaseView.extend({
|
||||||
});
|
});
|
||||||
|
|
||||||
var HelperBar = BaseView.extend({
|
var HelperBar = BaseView.extend({
|
||||||
|
getClassName: function() {
|
||||||
|
return 'BaseHelperBar';
|
||||||
|
},
|
||||||
|
|
||||||
tagName: 'div',
|
tagName: 'div',
|
||||||
className: 'helperBar transitionAll',
|
className: 'helperBar transitionAll',
|
||||||
template: _.template($('#helper-bar-template').html()),
|
template: _.template($('#helper-bar-template').html()),
|
||||||
|
@ -655,6 +659,7 @@ var HelperBar = BaseView.extend({
|
||||||
items: this.getItems()
|
items: this.getItems()
|
||||||
};
|
};
|
||||||
this.render();
|
this.render();
|
||||||
|
this.$el.addClass(this.getClassName());
|
||||||
this.setupChildren();
|
this.setupChildren();
|
||||||
|
|
||||||
if (!options.wait) {
|
if (!options.wait) {
|
||||||
|
@ -664,6 +669,10 @@ var HelperBar = BaseView.extend({
|
||||||
});
|
});
|
||||||
|
|
||||||
var IntlHelperBar = HelperBar.extend({
|
var IntlHelperBar = HelperBar.extend({
|
||||||
|
getClassName: function() {
|
||||||
|
return 'IntlHelperBar';
|
||||||
|
},
|
||||||
|
|
||||||
getItems: function() {
|
getItems: function() {
|
||||||
return [{
|
return [{
|
||||||
text: 'Git Branching',
|
text: 'Git Branching',
|
||||||
|
@ -726,10 +735,17 @@ var IntlHelperBar = HelperBar.extend({
|
||||||
});
|
});
|
||||||
|
|
||||||
var CommandsHelperBar = HelperBar.extend({
|
var CommandsHelperBar = HelperBar.extend({
|
||||||
|
getClassName: function() {
|
||||||
|
return 'CommandsHelperBar';
|
||||||
|
},
|
||||||
|
|
||||||
getItems: function() {
|
getItems: function() {
|
||||||
return [{
|
return [{
|
||||||
text: 'Levels',
|
text: 'Levels',
|
||||||
id: 'levels'
|
id: 'levels'
|
||||||
|
}, {
|
||||||
|
text: 'Solution',
|
||||||
|
id: 'solution'
|
||||||
}, {
|
}, {
|
||||||
text: 'Reset',
|
text: 'Reset',
|
||||||
id: 'reset'
|
id: 'reset'
|
||||||
|
@ -753,6 +769,10 @@ var CommandsHelperBar = HelperBar.extend({
|
||||||
HelperBar.prototype.fireCommand.apply(this, arguments);
|
HelperBar.prototype.fireCommand.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onSolutionClick: function() {
|
||||||
|
this.fireCommand('show solution');
|
||||||
|
},
|
||||||
|
|
||||||
onObjectiveClick: function() {
|
onObjectiveClick: function() {
|
||||||
this.fireCommand('objective');
|
this.fireCommand('objective');
|
||||||
},
|
},
|
||||||
|
|
|
@ -568,6 +568,8 @@ li.rebaseEntry,
|
||||||
border-right: 0;
|
border-right: 0;
|
||||||
box-shadow: -1px -1px 5px rgba(0,0,0,0.3);
|
box-shadow: -1px -1px 5px rgba(0,0,0,0.3);
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
max-width: 500px;
|
||||||
|
clear: both;
|
||||||
}
|
}
|
||||||
|
|
||||||
.helperBar i {
|
.helperBar i {
|
||||||
|
@ -581,6 +583,10 @@ li.rebaseEntry,
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.helperBar a.exit {
|
||||||
|
float: right
|
||||||
|
}
|
||||||
|
|
||||||
.helperBar a:after {
|
.helperBar a:after {
|
||||||
content: ' \b7';
|
content: ' \b7';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
|
@ -590,10 +596,15 @@ li.rebaseEntry,
|
||||||
padding-right: 10px;
|
padding-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.helperBar a:nth-last-child(2):after,
|
||||||
.helperBar a:last-child:after {
|
.helperBar a:last-child:after {
|
||||||
content: '';
|
content: '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.helperBar.BaseHelperBar a:nth-last-child(2):after {
|
||||||
|
content: ' \b7';
|
||||||
|
}
|
||||||
|
|
||||||
div.helperBar {
|
div.helperBar {
|
||||||
-webkit-transform: translate3d(150%,0,0);
|
-webkit-transform: translate3d(150%,0,0);
|
||||||
-moz-transform: translate3d(150%,0,0);
|
-moz-transform: translate3d(150%,0,0);
|
||||||
|
@ -608,6 +619,11 @@ div.helperBar.show {
|
||||||
-o-transform: translate3d(0,0,0);
|
-o-transform: translate3d(0,0,0);
|
||||||
-ms-transform: translate3d(0,0,0);
|
-ms-transform: translate3d(0,0,0);
|
||||||
transform: translate3d(0,0,0);
|
transform: translate3d(0,0,0);
|
||||||
|
height: 45px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.helperBar.show.BaseHelperBar {
|
||||||
|
height: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
#commandLineBar,
|
#commandLineBar,
|
||||||
|
|
|
@ -121,14 +121,14 @@
|
||||||
<script type="text/html" id="helper-bar-template">
|
<script type="text/html" id="helper-bar-template">
|
||||||
<% for(var i = 0; i < items.length; i++) { %>
|
<% for(var i = 0; i < items.length; i++) { %>
|
||||||
<% if (items[i].text) { %>
|
<% if (items[i].text) { %>
|
||||||
<a data-id="<%= items[i].id %>"><%= items[i].text %></a>
|
<a data-id="<%= items[i].id %>" class="<%=items[i].id%>"><%= items[i].text %></a>
|
||||||
<% } else if (items[i].newPageLink) { %>
|
<% } else if (items[i].newPageLink) { %>
|
||||||
<a data-id="<%= items[i].id %>"
|
<a data-id="<%= items[i].id %>"
|
||||||
target="_blank" href="<%= items[i].href %>">
|
target="_blank" href="<%= items[i].href %>"class="<%=items[i].id%>">
|
||||||
<i data-id="<%= items[i].id %>" class="icon-<%= items[i].icon %>"></i>
|
<i data-id="<%= items[i].id %>" class="icon-<%= items[i].icon %>"></i>
|
||||||
</a>
|
</a>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<a data-id="<%= items[i].id %>">
|
<a data-id="<%= items[i].id %>" class="<%=items[i].id%>">
|
||||||
<i data-id="<%= items[i].id %>" class="icon-<%= items[i].icon %>"></i>
|
<i data-id="<%= items[i].id %>" class="icon-<%= items[i].icon %>"></i>
|
||||||
</a>
|
</a>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
4
todo.txt
4
todo.txt
|
@ -10,8 +10,6 @@ Medium things:
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
[ ] figure out what to do with instant commands (and parse waterfall and the like)
|
[ ] figure out what to do with instant commands (and parse waterfall and the like)
|
||||||
[ ] disable git commands on hg levels (and vice versa)
|
[ ] disable git commands on hg levels (and vice versa)
|
||||||
[ ] make helper bar clickable with goal vis floating
|
|
||||||
[ ] make show solution easier
|
|
||||||
|
|
||||||
Small things to implement:
|
Small things to implement:
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
@ -28,6 +26,8 @@ Ideas for cleaning
|
||||||
Done things:
|
Done things:
|
||||||
(I only started this on Dec 17th 2012 to get a better sense of what was done)
|
(I only started this on Dec 17th 2012 to get a better sense of what was done)
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
[x] make show solution easier
|
||||||
|
[x] make helper bar clickable with goal vis floating
|
||||||
[x] huge update to level you wrote. that you said is true for
|
[x] huge update to level you wrote. that you said is true for
|
||||||
git fetch and git push (basically) but pull is not the same. basically
|
git fetch and git push (basically) but pull is not the same. basically
|
||||||
its going to ignore where you are during the fetch
|
its going to ignore where you are during the fetch
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue