mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-29 09:20:03 +02:00
nice modal view
This commit is contained in:
parent
41429e0ce6
commit
277f4f9209
9 changed files with 507 additions and 19 deletions
48
src/js/views/index.js
Normal file
48
src/js/views/index.js
Normal file
|
@ -0,0 +1,48 @@
|
|||
var GitError = require('../util/errors').GitError;
|
||||
var _ = require('underscore');
|
||||
// horrible hack to get localStorage Backbone plugin
|
||||
var Backbone = (!require('../util').isBrowser()) ? require('backbone') : window.Backbone;
|
||||
|
||||
var ModalView = Backbone.View.extend({
|
||||
tagName: 'div',
|
||||
className: 'modalView box horizontal center transitionOpacity',
|
||||
template: _.template($('#modal-view-template').html()),
|
||||
|
||||
initialize: function(options) {
|
||||
this.render();
|
||||
},
|
||||
|
||||
render: function() {
|
||||
// add ourselves to the DOM
|
||||
this.$el.html(this.template({}));
|
||||
$('body').append(this.el);
|
||||
console.log(this.el);
|
||||
var _this = this;
|
||||
setTimeout(function() {
|
||||
_this.show();
|
||||
}, 1050);
|
||||
},
|
||||
|
||||
show: function() {
|
||||
this.display(true);
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
this.display(false);
|
||||
},
|
||||
|
||||
getInsideElement: function() {
|
||||
return this.$('.contentHolder');
|
||||
},
|
||||
|
||||
display: function(value) {
|
||||
this.$el.toggleClass('show', value);
|
||||
},
|
||||
|
||||
tearDown: function() {
|
||||
this.hide();
|
||||
}
|
||||
});
|
||||
|
||||
exports.ModalView = ModalView;
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue