Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions scripts/gh-book/app.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,6 @@ define [
mediaTypes.add BinaryFile, {mediaType:'image/png'}
mediaTypes.add BinaryFile, {mediaType:'image/jpeg'}

# set which media formats are allowed
# at the toplevel of the content
for type in EpubContainer::accept
mediaTypes.type(type)::toplevel = true

# Views use anchors with hrefs so catch the click and send it to Backbone
$(document).on 'click', 'a:not([data-bypass]):not([href="#"])', (e) ->
external = new RegExp('^((f|ht)tps?:)?//')
Expand Down
7 changes: 6 additions & 1 deletion scripts/views/layouts/workspace/sidebar.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ define [
# This is the Picker/Roots Sidebar
collection = new Backbone.FilteredCollection(null, {collection:collection})
collection.setFilter (content) -> return content.getChildren
@filteredMediaTypes.setFilter (type) -> return type.get('modelType')::toplevel
# TODO: Remove `topLevel` from all models
@filteredMediaTypes.setFilter (type) ->
# Filter the types to exclude Chapters and other non-loadable content.
# Written this way to support `gh-book` **and** `atc`; if something is loadable then it is creatable.
return type.get('modelType')::load
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this not reference EpubContainer::accept for the base set?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately EpubContainer only works for gh-book (not atc); I should probably add a comment explaining why it's written generic-ishly.



# TODO: Make the collection a FilteredCollection that only shows @model.accepts
@addContent.show(new AddView {context:model, collection:@filteredMediaTypes})
Expand Down
4 changes: 2 additions & 2 deletions scripts/views/workspace/menu/add.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ define [
# Only add Models to `allContent` if they can be saved.
#
# ToC Sections, for example, cannot be saved but do implement Saveable because OpfFile extends TocNode
# So we use `.id` instead.
if model.id
# So we use `.load` instead.
if model.load
allContent.add(model)

# Add the model to the context
Expand Down