-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Konstantin
committed
Dec 19, 2015
1 parent
72452d8
commit c6995b7
Showing
17 changed files
with
117 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const WindowView = require('./views/window'); | ||
|
||
module.exports = new WindowView(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
var ItemView = require('backbone.marionette').ItemView; | ||
var t = require('../../t'); | ||
|
||
var ItemView = ItemView.extend({ | ||
className: 'window-item', | ||
template: false, | ||
initialize(opts) { | ||
console.log('a', opts, this, this.model); | ||
}, | ||
modelEvents: { | ||
'change:active': 'showHide' | ||
}, | ||
showHide() { | ||
console.log('show hide'); | ||
}, | ||
onRender() { | ||
this.$el.append(this.model.get('readerView').$el); | ||
} | ||
}); | ||
|
||
module.exports = ItemView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const {CollectionView} = require('backbone.marionette'); | ||
const ItemView = require('./item'); | ||
|
||
const ItemsView = CollectionView.extend({ | ||
childView: ItemView | ||
}); | ||
|
||
module.exports = ItemsView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,27 @@ | ||
var CollectionView = require('backbone.marionette').CollectionView; | ||
const TabModel = require('../models/tab'); | ||
const App = require('../../app'); | ||
const TabView = require('./tab'); | ||
|
||
module.exports = CollectionView.extend({ | ||
const TabsView = CollectionView.extend({ | ||
childView: TabView, | ||
childEvents: { | ||
'select': 'select' | ||
}, | ||
initialize() { | ||
console.log('tabs view initialize >>> ', this); | ||
}, | ||
select(a, b) { | ||
this.collection.each((tab) => { | ||
tab.set('active', false); | ||
}) | ||
a.model.set('active', true); | ||
App.trigger('setContent', a.model.get('page').reader) | ||
}, | ||
add(Page) { | ||
const tab = new TabModel({title: Page.name, page: Page}); | ||
this.collection.add(tab); | ||
this.select({model: tab}); | ||
return tab; | ||
}, | ||
getCurrent() { | ||
const current = this.collection.where({active: true}); | ||
return current[0]; | ||
} | ||
}); | ||
|
||
module.exports = TabsView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const {LayoutView} = require('backbone.marionette'); | ||
const TabCollection = require('../collections/tabs'); | ||
|
||
const t = require('../../t'); | ||
|
||
const TabModel = require('../models/tab'); | ||
const ItemsView = require('./items'); | ||
const TabsView = require('./tabs'); | ||
|
||
const Window = LayoutView.extend({ | ||
template: t('common/window'), | ||
regions: { | ||
tabs: '.region-tabs', | ||
items: '.region-items' | ||
}, | ||
initialize(opts) { | ||
this.collection = new TabCollection([]);; | ||
}, | ||
add({name, fileModel, readerView}) { | ||
// asd | ||
const tab = new TabModel({title: name, fileModel, readerView}); | ||
this.collection.add(tab); | ||
}, | ||
onShow() { | ||
this.items.show(new ItemsView({collection: this.collection})); | ||
this.tabs.show(new TabsView({collection: this.collection})); | ||
} | ||
}); | ||
|
||
module.exports = Window; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.c-tabs.region-tabs | ||
.c-content.region-items |