forked from sxswdemo/github-book
-
Notifications
You must be signed in to change notification settings - Fork 27
Atc Picker uses Singleton instead of using topLevel #107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
207cec4
make workspace sidebar use a singleton instead of inferring
philschatz 89456e2
add code to hide Book Picker title
philschatz e59a0f3
if model does not have .findDescendantDFS then use the original model
philschatz f0a1a25
for pointer events splice in the pointer model
philschatz 1985fbf
remove unused (and poorly defined) trigger
philschatz b191511
Merge branch 'master' into atc-root-singleton
philschatz a90f546
Merge branch 'master' into atc-root-singleton
philschatz ef8e3cd
Merge remote-tracking branch 'origin/master' into atc-root-singleton
izak 6672d7f
add fix so new Modules are added properly to the Workspace
philschatz 16efe78
TocPointerNode.getRoot() returns the OPF file instead of the EPUBCont…
philschatz f7895ed
look up the root node when calling addChild
philschatz 0dbbffa
merge from master
philschatz cdab413
update version of less
philschatz 7b36e15
fix adding a new book. no longer throws an error
philschatz 61c900e
disable save when new book is added
philschatz 5dde62b
fix: do not mark book as dirty when it is selected
philschatz 918ea15
add singleton instance getter to epub-container
TomWoodward b406647
remove crufy code in sidebar.coffee
TomWoodward 0402168
fix removing book
TomWoodward 8d88562
fix: clicking a module in a book in the picker opens the book in the …
philschatz f860dae
Merge branch 'atc-root-singleton' of github.com:oerpub/github-bookedi…
philschatz c0da2c8
Merge branch 'master' into atc-root-singleton
philschatz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,29 @@ | ||
| define [ | ||
| 'backbone' | ||
| 'cs!models/content/inherits/saveable' | ||
| 'cs!mixins/tree' | ||
| 'cs!models/content/book' | ||
| 'cs!models/content/module' | ||
| 'cs!models/content/folder' | ||
| 'cs!collections/content' | ||
| 'filtered-collection' | ||
| ], (Backbone, Saveable, treeMixin, Book, Module, Folder, allContent) -> | ||
|
|
||
| return new class WorkspaceRoot extends Saveable.extend(treeMixin) | ||
| accept: [Book::mediaType, Module::mediaType, Folder::mediaType] | ||
| initialize: (options) -> | ||
| super(options) | ||
|
|
||
| content = new Backbone.FilteredCollection(null, {collection:allContent}) | ||
|
|
||
| # Allow `.add` to be called on filtered collections (for new Books) | ||
| content.add = allContent.add.bind(allContent) | ||
|
|
||
| # Filter the Workspace sidebar to only contain Book and Folder | ||
| content.setFilter (model) => return model.mediaType in [Book::mediaType, Folder::mediaType] | ||
|
|
||
| @_initializeTreeHandlers {root:@, children:content} | ||
|
|
||
| # Just return the node; for a Book this would return options.model wrapped in a TocPointerNode | ||
| newNode: (options) -> | ||
| return options.model |
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just
return new EpubContainer()at the end of this module? (instead of returning theEpubContainerclass)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thats what i originally did, but ran into some issue that i forget about and ended up doing it this way. could probably get it rejiggered without too much more effort but i'm not sure if its worth it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just mention it because other singletons in the codebase are written that way (not that I like it; it's difficult to extend a class but it's consistent). routing, app, media-types, allContent are a few examples off the top of my head