mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-28 08:50:06 +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 intl = require('../intl');
|
||||
|
||||
var Graph = require('../graph');
|
||||
var Graph = require('../graph');
|
||||
var Errors = require('../util/errors');
|
||||
var CommandProcessError = Errors.CommandProcessError;
|
||||
var GitError = Errors.GitError;
|
||||
|
|
|
@ -14,6 +14,13 @@ var Graph = {
|
|||
objID,
|
||||
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]) {
|
||||
// base case
|
||||
return createdSoFar[objID];
|
||||
|
@ -82,7 +89,6 @@ var Graph = {
|
|||
parentObjs.push(this.getOrMakeRecursive(tree, createdSoFar, parentID));
|
||||
}, this);
|
||||
|
||||
var Commit = require('../git').Commit;
|
||||
var commit = new Commit(_.extend(
|
||||
commitJSON,
|
||||
{
|
||||
|
@ -121,8 +127,6 @@ var Graph = {
|
|||
},
|
||||
|
||||
getUpstreamSet: function(engine, ancestor) {
|
||||
invariant(typeof ancestor === 'string', 'pass in string');
|
||||
|
||||
var commit = engine.getCommitFromRef(ancestor);
|
||||
var ancestorID = commit.get('id');
|
||||
var queue = [commit];
|
||||
|
|
|
@ -596,6 +596,10 @@ var LevelToolbar = BaseView.extend({
|
|||
});
|
||||
|
||||
var HelperBar = BaseView.extend({
|
||||
getClassName: function() {
|
||||
return 'BaseHelperBar';
|
||||
},
|
||||
|
||||
tagName: 'div',
|
||||
className: 'helperBar transitionAll',
|
||||
template: _.template($('#helper-bar-template').html()),
|
||||
|
@ -655,6 +659,7 @@ var HelperBar = BaseView.extend({
|
|||
items: this.getItems()
|
||||
};
|
||||
this.render();
|
||||
this.$el.addClass(this.getClassName());
|
||||
this.setupChildren();
|
||||
|
||||
if (!options.wait) {
|
||||
|
@ -664,6 +669,10 @@ var HelperBar = BaseView.extend({
|
|||
});
|
||||
|
||||
var IntlHelperBar = HelperBar.extend({
|
||||
getClassName: function() {
|
||||
return 'IntlHelperBar';
|
||||
},
|
||||
|
||||
getItems: function() {
|
||||
return [{
|
||||
text: 'Git Branching',
|
||||
|
@ -726,10 +735,17 @@ var IntlHelperBar = HelperBar.extend({
|
|||
});
|
||||
|
||||
var CommandsHelperBar = HelperBar.extend({
|
||||
getClassName: function() {
|
||||
return 'CommandsHelperBar';
|
||||
},
|
||||
|
||||
getItems: function() {
|
||||
return [{
|
||||
text: 'Levels',
|
||||
id: 'levels'
|
||||
}, {
|
||||
text: 'Solution',
|
||||
id: 'solution'
|
||||
}, {
|
||||
text: 'Reset',
|
||||
id: 'reset'
|
||||
|
@ -753,6 +769,10 @@ var CommandsHelperBar = HelperBar.extend({
|
|||
HelperBar.prototype.fireCommand.apply(this, arguments);
|
||||
},
|
||||
|
||||
onSolutionClick: function() {
|
||||
this.fireCommand('show solution');
|
||||
},
|
||||
|
||||
onObjectiveClick: function() {
|
||||
this.fireCommand('objective');
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue