Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
5836286f
Commit
5836286f
authored
Jun 24, 2013
by
David Baumgold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PDF textbooks: unified naming conventions
parent
c45dbca7
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
36 additions
and
46 deletions
+36
-46
cms/static/coffee/fixtures/chapter.underscore
+0
-2
cms/static/coffee/fixtures/edit-chapter.underscore
+2
-0
cms/static/coffee/fixtures/edit-textbook.underscore
+2
-0
cms/static/coffee/fixtures/show-textbook.underscore
+2
-0
cms/static/coffee/fixtures/textbook-edit.underscore
+0
-2
cms/static/coffee/fixtures/textbook-show.underscore
+0
-2
cms/static/coffee/spec/views/textbook_spec.coffee
+17
-17
cms/static/js/models/textbook.js
+1
-1
cms/static/js/views/textbook.js
+8
-8
cms/templates/js/edit-chapter.underscore
+0
-0
cms/templates/js/edit-textbook.underscore
+0
-0
cms/templates/js/show-textbook.underscore
+0
-0
cms/templates/textbooks.html
+4
-14
No files found.
cms/static/coffee/fixtures/chapter.underscore
deleted
120000 → 0
View file @
c45dbca7
../../../templates/js/chapter.underscore
\ No newline at end of file
cms/static/coffee/fixtures/edit-chapter.underscore
0 → 120000
View file @
5836286f
../../../templates/js/edit-chapter.underscore
\ No newline at end of file
cms/static/coffee/fixtures/edit-textbook.underscore
0 → 120000
View file @
5836286f
../../../templates/js/edit-textbook.underscore
\ No newline at end of file
cms/static/coffee/fixtures/show-textbook.underscore
0 → 120000
View file @
5836286f
../../../templates/js/show-textbook.underscore
\ No newline at end of file
cms/static/coffee/fixtures/textbook-edit.underscore
deleted
120000 → 0
View file @
c45dbca7
../../../templates/js/textbook-edit.underscore
\ No newline at end of file
cms/static/coffee/fixtures/textbook-show.underscore
deleted
120000 → 0
View file @
c45dbca7
../../../templates/js/textbook-show.underscore
\ No newline at end of file
cms/static/coffee/spec/views/textbook_spec.coffee
View file @
5836286f
...
...
@@ -10,9 +10,9 @@ beforeEach ->
else
return
trimmedText
.
indexOf
(
text
)
!=
-
1
;
describe
"CMS.Views.
TextbookShow
"
,
->
describe
"CMS.Views.
ShowTextbook
"
,
->
describe
"Basic"
,
->
tpl
=
readFixtures
(
'
textbook-show
.underscore'
)
tpl
=
readFixtures
(
'
show-textbook
.underscore'
)
beforeEach
->
setFixtures
(
$
(
"<script>"
,
{
id
:
"show-textbook-tpl"
,
type
:
"text/template"
}).
text
(
tpl
))
...
...
@@ -23,7 +23,7 @@ describe "CMS.Views.TextbookShow", ->
@
collection
=
new
CMS
.
Collections
.
TextbookSet
()
spyOn
(
@
collection
,
'save'
)
@
collection
.
add
(
@
model
)
@
view
=
new
CMS
.
Views
.
TextbookShow
({
model
:
@
model
})
@
view
=
new
CMS
.
Views
.
ShowTextbook
({
model
:
@
model
})
it
"should render properly"
,
->
@
view
.
render
()
...
...
@@ -66,14 +66,14 @@ describe "CMS.Views.TextbookShow", ->
describe
"CMS.Views.
TextbookEdit
"
,
->
describe
"CMS.Views.
EditTextbook
"
,
->
describe
"Basic"
,
->
tpl
=
readFixtures
(
'
textbook-edit
.underscore'
)
chapterTpl
=
readFixtures
(
'chapter.underscore'
)
tpl
=
readFixtures
(
'
edit-textbook
.underscore'
)
chapterTpl
=
readFixtures
(
'
edit-
chapter.underscore'
)
beforeEach
->
setFixtures
(
$
(
"<script>"
,
{
id
:
"
new
-textbook-tpl"
,
type
:
"text/template"
}).
text
(
tpl
))
appendSetFixtures
(
$
(
"<script>"
,
{
id
:
"
new
-chapter-tpl"
,
type
:
"text/template"
}).
text
(
chapterTpl
))
setFixtures
(
$
(
"<script>"
,
{
id
:
"
edit
-textbook-tpl"
,
type
:
"text/template"
}).
text
(
tpl
))
appendSetFixtures
(
$
(
"<script>"
,
{
id
:
"
edit
-chapter-tpl"
,
type
:
"text/template"
}).
text
(
chapterTpl
))
appendSetFixtures
(
$
(
"<script>"
,
{
id
:
"system-feedback-tpl"
,
type
:
"text/template"
}).
text
(
feedbackTpl
))
appendSetFixtures
(
sandbox
({
id
:
"page-notification"
}))
appendSetFixtures
(
sandbox
({
id
:
"page-prompt"
}))
...
...
@@ -82,7 +82,7 @@ describe "CMS.Views.TextbookEdit", ->
spyOn
(
@
collection
,
'save'
)
@
collection
.
add
(
@
model
)
@
collection
.
editing
=
@
model
@
view
=
new
CMS
.
Views
.
TextbookEdit
({
model
:
@
model
})
@
view
=
new
CMS
.
Views
.
EditTextbook
({
model
:
@
model
})
spyOn
(
@
view
,
'render'
).
andCallThrough
()
it
"should render properly"
,
->
...
...
@@ -137,12 +137,12 @@ describe "CMS.Views.ListTextbooks", ->
beforeEach
->
setFixtures
(
$
(
"<script>"
,
{
id
:
"no-textbooks-tpl"
,
type
:
"text/template"
}).
text
(
noTextbooksTpl
))
appendSetFixtures
(
$
(
"<script>"
,
{
id
:
"system-feedback-tpl"
,
type
:
"text/template"
}).
text
(
feedbackTpl
))
@
showSpies
=
spyOnConstructor
(
CMS
.
Views
,
"
TextbookShow
"
,
[
"render"
])
@
showSpies
=
spyOnConstructor
(
CMS
.
Views
,
"
ShowTextbook
"
,
[
"render"
])
@
showSpies
.
render
.
andReturn
(
@
showSpies
)
# equivalent of `return this`
showEl
=
$
(
"<li>"
)
@
showSpies
.
$el
=
showEl
@
showSpies
.
el
=
showEl
.
get
(
0
)
@
editSpies
=
spyOnConstructor
(
CMS
.
Views
,
"
TextbookEdit
"
,
[
"render"
])
@
editSpies
=
spyOnConstructor
(
CMS
.
Views
,
"
EditTextbook
"
,
[
"render"
])
editEl
=
$
(
"<li>"
)
@
editSpies
.
render
.
andReturn
(
@
editSpies
)
@
editSpies
.
$el
=
editEl
...
...
@@ -158,7 +158,7 @@ describe "CMS.Views.ListTextbooks", ->
expect
(
@
showSpies
.
constructor
).
not
.
toHaveBeenCalled
()
expect
(
@
editSpies
.
constructor
).
not
.
toHaveBeenCalled
()
it
"should render
TextbookShow
views by default if no textbook is being edited"
,
->
it
"should render
ShowTextbook
views by default if no textbook is being edited"
,
->
# add three empty textbooks to the collection
@
collection
.
add
([{},
{},
{}])
# reset spies due to re-rendering on collection modification
...
...
@@ -173,7 +173,7 @@ describe "CMS.Views.ListTextbooks", ->
expect
(
@
showSpies
.
constructor
.
calls
.
length
).
toEqual
(
3
);
expect
(
@
editSpies
.
constructor
).
not
.
toHaveBeenCalled
()
it
"should render a
TextbookEdit
view for a textbook being edited"
,
->
it
"should render a
n EditTextbook
view for a textbook being edited"
,
->
# add three empty textbooks to the collection
@
collection
.
add
([{},
{},
{}])
# mark the second one as being edited
...
...
@@ -208,18 +208,18 @@ describe "CMS.Views.ListTextbooks", ->
expect
(
@
view
.
$el
).
not
.
toContain
(
@
showSpies
.
$el
)
describe
"CMS.Views.
ChapterEdit
"
,
->
tpl
=
readFixtures
(
"chapter.underscore"
)
describe
"CMS.Views.
EditChapter
"
,
->
tpl
=
readFixtures
(
"
edit-
chapter.underscore"
)
beforeEach
->
setFixtures
(
$
(
"<script>"
,
{
id
:
"
new
-chapter-tpl"
,
type
:
"text/template"
}).
text
(
tpl
))
setFixtures
(
$
(
"<script>"
,
{
id
:
"
edit
-chapter-tpl"
,
type
:
"text/template"
}).
text
(
tpl
))
appendSetFixtures
(
$
(
"<script>"
,
{
id
:
"system-feedback-tpl"
,
type
:
"text/template"
}).
text
(
feedbackTpl
))
@
model
=
new
CMS
.
Models
.
Chapter
name
:
"Chapter 1"
asset_path
:
"/ch1.pdf"
@
collection
=
new
CMS
.
Collections
.
ChapterSet
()
@
collection
.
add
(
@
model
)
@
view
=
new
CMS
.
Views
.
ChapterEdit
({
model
:
@
model
})
@
view
=
new
CMS
.
Views
.
EditChapter
({
model
:
@
model
})
spyOn
(
@
view
,
"remove"
).
andCallThrough
()
window
.
UPLOAD_ASSET_CALLBACK_URL
=
"/upload"
window
.
section
=
new
CMS
.
Models
.
Section
({
name
:
"abcde"
})
...
...
cms/static/js/models/textbook.js
View file @
5836286f
...
...
@@ -9,7 +9,7 @@ CMS.Models.Textbook = Backbone.AssociatedModel.extend({
relations
:
[{
type
:
Backbone
.
Many
,
key
:
"chapters"
,
relatedModel
:
"CMS.Models.Chapter"
,
relatedModel
:
"CMS.Models.
Edit
Chapter"
,
collectionType
:
"CMS.Collections.ChapterSet"
}],
isEmpty
:
function
()
{
...
...
cms/static/js/views/textbook.js
View file @
5836286f
CMS
.
Views
.
TextbookShow
=
Backbone
.
View
.
extend
({
CMS
.
Views
.
ShowTextbook
=
Backbone
.
View
.
extend
({
initialize
:
function
()
{
this
.
template
=
_
.
template
(
$
(
"#show-textbook-tpl"
).
text
());
this
.
listenTo
(
this
.
model
,
"change"
,
this
.
render
);
...
...
@@ -62,9 +62,9 @@ CMS.Views.TextbookShow = Backbone.View.extend({
this
.
model
.
set
(
'showChapters'
,
false
);
}
});
CMS
.
Views
.
TextbookEdit
=
Backbone
.
View
.
extend
({
CMS
.
Views
.
EditTextbook
=
Backbone
.
View
.
extend
({
initialize
:
function
()
{
this
.
template
=
_
.
template
(
$
(
"#
new
-textbook-tpl"
).
text
());
this
.
template
=
_
.
template
(
$
(
"#
edit
-textbook-tpl"
).
text
());
var
chapters
=
this
.
model
.
get
(
'chapters'
);
this
.
listenTo
(
chapters
,
"add"
,
this
.
addOne
);
this
.
listenTo
(
chapters
,
"reset"
,
this
.
addAll
);
...
...
@@ -92,7 +92,7 @@ CMS.Views.TextbookEdit = Backbone.View.extend({
"click .action-add-chapter"
:
"createChapter"
},
addOne
:
function
(
chapter
)
{
var
view
=
new
CMS
.
Views
.
ChapterEdit
({
model
:
chapter
});
var
view
=
new
CMS
.
Views
.
EditChapter
({
model
:
chapter
});
this
.
$
(
"ol.chapters"
).
append
(
view
.
render
().
el
);
return
this
;
},
...
...
@@ -177,9 +177,9 @@ CMS.Views.ListTextbooks = Backbone.View.extend({
textbooks
.
each
(
function
(
textbook
)
{
var
view
;
if
(
textbook
===
textbooks
.
editing
)
{
view
=
new
CMS
.
Views
.
TextbookEdit
({
model
:
textbook
});
view
=
new
CMS
.
Views
.
EditTextbook
({
model
:
textbook
});
}
else
{
view
=
new
CMS
.
Views
.
TextbookShow
({
model
:
textbook
});
view
=
new
CMS
.
Views
.
ShowTextbook
({
model
:
textbook
});
}
$el
.
append
(
view
.
render
().
el
);
});
...
...
@@ -198,9 +198,9 @@ CMS.Views.ListTextbooks = Backbone.View.extend({
this
.
collection
.
trigger
(
"editOne"
,
m
);
}
});
CMS
.
Views
.
ChapterEdit
=
Backbone
.
View
.
extend
({
CMS
.
Views
.
EditChapter
=
Backbone
.
View
.
extend
({
initialize
:
function
()
{
this
.
template
=
_
.
template
(
$
(
"#
new
-chapter-tpl"
).
text
());
this
.
template
=
_
.
template
(
$
(
"#
edit
-chapter-tpl"
).
text
());
this
.
listenTo
(
this
.
model
,
"change"
,
this
.
render
);
},
tagName
:
"li"
,
...
...
cms/templates/js/chapter.underscore
→
cms/templates/js/
edit-
chapter.underscore
View file @
5836286f
File moved
cms/templates/js/
textbook-edit
.underscore
→
cms/templates/js/
edit-textbook
.underscore
View file @
5836286f
File moved
cms/templates/js/
textbook-show
.underscore
→
cms/templates/js/
show-textbook
.underscore
View file @
5836286f
File moved
cms/templates/textbooks.html
View file @
5836286f
...
...
@@ -7,21 +7,11 @@
<
%
block
name=
"bodyclass"
>
is-signedin course textbooks
</
%
block>
<
%
block
name=
"header_extras"
>
<script
type=
"text/template"
id=
"new-textbook-tpl"
>
<%
static
:
include
path
=
"js/textbook-edit.underscore"
/>
</script>
<script
type=
"text/template"
id=
"show-textbook-tpl"
>
<%
static
:
include
path
=
"js/textbook-show.underscore"
/>
</script>
<script
type=
"text/template"
id=
"new-chapter-tpl"
>
<%
static
:
include
path
=
"js/chapter.underscore"
/>
</script>
<script
type=
"text/template"
id=
"no-textbooks-tpl"
>
<%
static
:
include
path
=
"js/no-textbooks.underscore"
/>
</script>
<script
type=
"text/template"
id=
"upload-dialog-tpl"
>
<%
static
:
include
path
=
"js/upload-dialog.underscore"
/>
% for template_name in ["edit-textbook", "show-textbook", "edit-chapter", "no-textbooks", "upload-dialog"]:
<script
type=
"text/template"
id=
"${template_name}-tpl"
>
<%
static
:
include
path
=
"js/${template_name}.underscore"
/>
</script>
% endfor
</
%
block>
<
%
block
name=
"jsextra"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment