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
7f69e45b
Commit
7f69e45b
authored
May 08, 2013
by
David Baumgold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
whitespace changes
parent
ec79ebd4
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
83 additions
and
93 deletions
+83
-93
cms/static/js/base.js
+1
-2
cms/static/js/hesitate.js
+6
-7
cms/static/js/main.js
+1
-1
cms/static/js/models/course_info.js
+8
-9
cms/static/js/models/course_relative.js
+3
-4
cms/static/js/models/module_info.js
+2
-3
cms/static/js/models/settings/advanced.js
+2
-2
cms/static/js/models/settings/course_details.js
+1
-1
cms/static/js/models/settings/course_grading_policy.js
+4
-5
cms/static/js/views/checklists_view.js
+1
-2
cms/static/js/views/course_info_edit.js
+24
-25
cms/static/js/views/grader-select-view.js
+6
-7
cms/static/js/views/overview.js
+20
-20
cms/static/js/views/server_error.js
+1
-2
cms/static/js/views/validating_view.js
+3
-3
No files found.
cms/static/js/base.js
View file @
7f69e45b
...
@@ -895,4 +895,4 @@ function saveSetSectionScheduleDate(e) {
...
@@ -895,4 +895,4 @@ function saveSetSectionScheduleDate(e) {
hideModal
();
hideModal
();
});
});
}
}
\ No newline at end of file
cms/static/js/hesitate.js
View file @
7f69e45b
...
@@ -2,13 +2,13 @@
...
@@ -2,13 +2,13 @@
* Create a HesitateEvent and assign it as the event to execute:
* Create a HesitateEvent and assign it as the event to execute:
* $(el).on('mouseEnter', CMS.HesitateEvent( expand, 'mouseLeave').trigger);
* $(el).on('mouseEnter', CMS.HesitateEvent( expand, 'mouseLeave').trigger);
* It calls the executeOnTimeOut function with the event.currentTarget after the configurable timeout IFF the cancelSelector event
* It calls the executeOnTimeOut function with the event.currentTarget after the configurable timeout IFF the cancelSelector event
* did not occur on the event.currentTarget.
* did not occur on the event.currentTarget.
*
*
* More specifically, when trigger is called (triggered by the event you bound it to), it starts a timer
* More specifically, when trigger is called (triggered by the event you bound it to), it starts a timer
* which the cancelSelector event will cancel or if the timer finished, it executes the executeOnTimeOut function
* which the cancelSelector event will cancel or if the timer finished, it executes the executeOnTimeOut function
* passing it the original event (whose currentTarget s/b the specific ele). It never accumulates events; however, it doesn't hurt for your
* passing it the original event (whose currentTarget s/b the specific ele). It never accumulates events; however, it doesn't hurt for your
* code to minimize invocations of trigger by binding to mouseEnter v mouseOver and such.
* code to minimize invocations of trigger by binding to mouseEnter v mouseOver and such.
*
*
* NOTE: if something outside of this wants to cancel the event, invoke cachedhesitation.untrigger(null | anything);
* NOTE: if something outside of this wants to cancel the event, invoke cachedhesitation.untrigger(null | anything);
*/
*/
...
@@ -25,7 +25,7 @@ CMS.HesitateEvent.DURATION = 800;
...
@@ -25,7 +25,7 @@ CMS.HesitateEvent.DURATION = 800;
CMS
.
HesitateEvent
.
prototype
.
trigger
=
function
(
event
)
{
CMS
.
HesitateEvent
.
prototype
.
trigger
=
function
(
event
)
{
if
(
event
.
data
.
timeoutEventId
==
null
)
{
if
(
event
.
data
.
timeoutEventId
==
null
)
{
event
.
data
.
timeoutEventId
=
window
.
setTimeout
(
event
.
data
.
timeoutEventId
=
window
.
setTimeout
(
function
()
{
event
.
data
.
fireEvent
(
event
);
},
function
()
{
event
.
data
.
fireEvent
(
event
);
},
CMS
.
HesitateEvent
.
DURATION
);
CMS
.
HesitateEvent
.
DURATION
);
event
.
data
.
originalEvent
=
event
;
event
.
data
.
originalEvent
=
event
;
$
(
event
.
data
.
originalEvent
.
delegateTarget
).
on
(
event
.
data
.
cancelSelector
,
event
.
data
,
event
.
data
.
untrigger
);
$
(
event
.
data
.
originalEvent
.
delegateTarget
).
on
(
event
.
data
.
cancelSelector
,
event
.
data
,
event
.
data
.
untrigger
);
...
@@ -45,4 +45,4 @@ CMS.HesitateEvent.prototype.untrigger = function(event) {
...
@@ -45,4 +45,4 @@ CMS.HesitateEvent.prototype.untrigger = function(event) {
$
(
event
.
data
.
originalEvent
.
delegateTarget
).
off
(
event
.
data
.
cancelSelector
,
event
.
data
.
untrigger
);
$
(
event
.
data
.
originalEvent
.
delegateTarget
).
off
(
event
.
data
.
cancelSelector
,
event
.
data
.
untrigger
);
}
}
event
.
data
.
timeoutEventId
=
null
;
event
.
data
.
timeoutEventId
=
null
;
};
};
\ No newline at end of file
cms/static/js/main.js
View file @
7f69e45b
...
@@ -80,6 +80,6 @@ $(document).ready(function(){
...
@@ -80,6 +80,6 @@ $(document).ready(function(){
$
(
'section.problem-edit'
).
show
();
$
(
'section.problem-edit'
).
show
();
return
false
;
return
false
;
});
});
});
});
cms/static/js/models/course_info.js
View file @
7f69e45b
// single per course holds the updates and handouts
// single per course holds the updates and handouts
CMS
.
Models
.
CourseInfo
=
Backbone
.
Model
.
extend
({
CMS
.
Models
.
CourseInfo
=
Backbone
.
Model
.
extend
({
// This model class is not suited for restful operations and is considered just a server side initialized container
// This model class is not suited for restful operations and is considered just a server side initialized container
url
:
''
,
url
:
''
,
defaults
:
{
defaults
:
{
"courseId"
:
""
,
// the location url
"courseId"
:
""
,
// the location url
"updates"
:
null
,
// UpdateCollection
"updates"
:
null
,
// UpdateCollection
"handouts"
:
null
// HandoutCollection
"handouts"
:
null
// HandoutCollection
},
},
idAttribute
:
"courseId"
idAttribute
:
"courseId"
});
});
// course update -- biggest kludge here is the lack of a real id to map updates to originals
// course update -- biggest kludge here is the lack of a real id to map updates to originals
CMS
.
Models
.
CourseUpdate
=
Backbone
.
Model
.
extend
({
CMS
.
Models
.
CourseUpdate
=
Backbone
.
Model
.
extend
({
defaults
:
{
defaults
:
{
...
@@ -26,11 +26,11 @@ CMS.Models.CourseUpdate = Backbone.Model.extend({
...
@@ -26,11 +26,11 @@ CMS.Models.CourseUpdate = Backbone.Model.extend({
*/
*/
CMS
.
Models
.
CourseUpdateCollection
=
Backbone
.
Collection
.
extend
({
CMS
.
Models
.
CourseUpdateCollection
=
Backbone
.
Collection
.
extend
({
url
:
function
()
{
return
this
.
urlbase
+
"course_info/updates/"
;},
url
:
function
()
{
return
this
.
urlbase
+
"course_info/updates/"
;},
model
:
CMS
.
Models
.
CourseUpdate
model
:
CMS
.
Models
.
CourseUpdate
});
});
\ No newline at end of file
cms/static/js/models/course_relative.js
View file @
7f69e45b
...
@@ -16,7 +16,7 @@ CMS.Models.Location = Backbone.Model.extend({
...
@@ -16,7 +16,7 @@ CMS.Models.Location = Backbone.Model.extend({
},
},
_tagPattern
:
/
[^
:
]
+/g
,
_tagPattern
:
/
[^
:
]
+/g
,
_fieldPattern
:
new
RegExp
(
'[^/]+'
,
'g'
),
_fieldPattern
:
new
RegExp
(
'[^/]+'
,
'g'
),
parse
:
function
(
payload
)
{
parse
:
function
(
payload
)
{
if
(
_
.
isArray
(
payload
))
{
if
(
_
.
isArray
(
payload
))
{
return
{
return
{
...
@@ -25,7 +25,7 @@ CMS.Models.Location = Backbone.Model.extend({
...
@@ -25,7 +25,7 @@ CMS.Models.Location = Backbone.Model.extend({
course
:
payload
[
2
],
course
:
payload
[
2
],
category
:
payload
[
3
],
category
:
payload
[
3
],
name
:
payload
[
4
]
name
:
payload
[
4
]
}
}
;
}
}
else
if
(
_
.
isString
(
payload
))
{
else
if
(
_
.
isString
(
payload
))
{
this
.
_tagPattern
.
lastIndex
=
0
;
// odd regex behavior requires this to be reset sometimes
this
.
_tagPattern
.
lastIndex
=
0
;
// odd regex behavior requires this to be reset sometimes
...
@@ -65,4 +65,4 @@ CMS.Models.CourseRelative = Backbone.Model.extend({
...
@@ -65,4 +65,4 @@ CMS.Models.CourseRelative = Backbone.Model.extend({
CMS
.
Models
.
CourseRelativeCollection
=
Backbone
.
Collection
.
extend
({
CMS
.
Models
.
CourseRelativeCollection
=
Backbone
.
Collection
.
extend
({
model
:
CMS
.
Models
.
CourseRelative
model
:
CMS
.
Models
.
CourseRelative
});
});
\ No newline at end of file
cms/static/js/models/module_info.js
View file @
7f69e45b
...
@@ -6,5 +6,5 @@ CMS.Models.ModuleInfo = Backbone.Model.extend({
...
@@ -6,5 +6,5 @@ CMS.Models.ModuleInfo = Backbone.Model.extend({
"data"
:
null
,
"data"
:
null
,
"metadata"
:
null
,
"metadata"
:
null
,
"children"
:
null
"children"
:
null
},
}
});
});
\ No newline at end of file
cms/static/js/models/settings/advanced.js
View file @
7f69e45b
...
@@ -11,7 +11,7 @@ CMS.Models.Settings.Advanced = Backbone.Model.extend({
...
@@ -11,7 +11,7 @@ CMS.Models.Settings.Advanced = Backbone.Model.extend({
validate
:
function
(
attrs
)
{
validate
:
function
(
attrs
)
{
// Keys can no longer be edited. We are currently not validating values.
// Keys can no longer be edited. We are currently not validating values.
},
},
save
:
function
(
attrs
,
options
)
{
save
:
function
(
attrs
,
options
)
{
// wraps the save call w/ the deletion of the removed keys after we know the saved ones worked
// wraps the save call w/ the deletion of the removed keys after we know the saved ones worked
options
=
options
?
_
.
clone
(
options
)
:
{};
options
=
options
?
_
.
clone
(
options
)
:
{};
...
@@ -23,7 +23,7 @@ CMS.Models.Settings.Advanced = Backbone.Model.extend({
...
@@ -23,7 +23,7 @@ CMS.Models.Settings.Advanced = Backbone.Model.extend({
};
};
Backbone
.
Model
.
prototype
.
save
.
call
(
this
,
attrs
,
options
);
Backbone
.
Model
.
prototype
.
save
.
call
(
this
,
attrs
,
options
);
},
},
afterSave
:
function
(
self
)
{
afterSave
:
function
(
self
)
{
// remove deleted attrs
// remove deleted attrs
if
(
!
_
.
isEmpty
(
self
.
deleteKeys
))
{
if
(
!
_
.
isEmpty
(
self
.
deleteKeys
))
{
...
...
cms/static/js/models/settings/course_details.js
View file @
7f69e45b
...
@@ -66,7 +66,7 @@ CMS.Models.Settings.CourseDetails = Backbone.Model.extend({
...
@@ -66,7 +66,7 @@ CMS.Models.Settings.CourseDetails = Backbone.Model.extend({
save_videosource
:
function
(
newsource
)
{
save_videosource
:
function
(
newsource
)
{
// newsource either is <video youtube="speed:key, *"/> or just the "speed:key, *" string
// newsource either is <video youtube="speed:key, *"/> or just the "speed:key, *" string
// returns the videosource for the preview which iss the key whose speed is closest to 1
// returns the videosource for the preview which iss the key whose speed is closest to 1
if
(
_
.
isEmpty
(
newsource
)
&&
!
_
.
isEmpty
(
this
.
get
(
'intro_video'
)))
this
.
save
({
'intro_video'
:
null
});
if
(
_
.
isEmpty
(
newsource
)
&&
!
_
.
isEmpty
(
this
.
get
(
'intro_video'
)))
this
.
save
({
'intro_video'
:
null
});
// TODO remove all whitespace w/in string
// TODO remove all whitespace w/in string
else
{
else
{
if
(
this
.
get
(
'intro_video'
)
!==
newsource
)
this
.
save
(
'intro_video'
,
newsource
);
if
(
this
.
get
(
'intro_video'
)
!==
newsource
)
this
.
save
(
'intro_video'
,
newsource
);
...
...
cms/static/js/models/settings/course_grading_policy.js
View file @
7f69e45b
if
(
!
CMS
.
Models
[
'Settings'
])
CMS
.
Models
.
Settings
=
new
Object
();
if
(
!
CMS
.
Models
[
'Settings'
])
CMS
.
Models
.
Settings
=
new
Object
();
CMS
.
Models
.
Settings
.
CourseGradingPolicy
=
Backbone
.
Model
.
extend
({
CMS
.
Models
.
Settings
.
CourseGradingPolicy
=
Backbone
.
Model
.
extend
({
defaults
:
{
defaults
:
{
course_location
:
null
,
course_location
:
null
,
graders
:
null
,
// CourseGraderCollection
graders
:
null
,
// CourseGraderCollection
grade_cutoffs
:
null
,
// CourseGradeCutoff model
grade_cutoffs
:
null
,
// CourseGradeCutoff model
grace_period
:
null
// either null or { hours: n, minutes: m, ...}
grace_period
:
null
// either null or { hours: n, minutes: m, ...}
},
},
...
@@ -54,7 +54,7 @@ CMS.Models.Settings.CourseGrader = Backbone.Model.extend({
...
@@ -54,7 +54,7 @@ CMS.Models.Settings.CourseGrader = Backbone.Model.extend({
"type"
:
""
,
// must be unique w/in collection (ie. w/in course)
"type"
:
""
,
// must be unique w/in collection (ie. w/in course)
"min_count"
:
1
,
"min_count"
:
1
,
"drop_count"
:
0
,
"drop_count"
:
0
,
"short_label"
:
""
,
// what to use in place of type if space is an issue
"short_label"
:
""
,
// what to use in place of type if space is an issue
"weight"
:
0
// int 0..100
"weight"
:
0
// int 0..100
},
},
parse
:
function
(
attrs
)
{
parse
:
function
(
attrs
)
{
...
@@ -125,4 +125,4 @@ CMS.Models.Settings.CourseGraderCollection = Backbone.Collection.extend({
...
@@ -125,4 +125,4 @@ CMS.Models.Settings.CourseGraderCollection = Backbone.Collection.extend({
sumWeights
:
function
()
{
sumWeights
:
function
()
{
return
this
.
reduce
(
function
(
subtotal
,
grader
)
{
return
subtotal
+
grader
.
get
(
'weight'
);
},
0
);
return
this
.
reduce
(
function
(
subtotal
,
grader
)
{
return
subtotal
+
grader
.
get
(
'weight'
);
},
0
);
}
}
});
});
\ No newline at end of file
cms/static/js/views/checklists_view.js
View file @
7f69e45b
...
@@ -93,4 +93,4 @@ CMS.Views.Checklists = Backbone.View.extend({
...
@@ -93,4 +93,4 @@ CMS.Views.Checklists = Backbone.View.extend({
error
:
CMS
.
ServerError
error
:
CMS
.
ServerError
});
});
}
}
});
});
\ No newline at end of file
cms/static/js/views/course_info_edit.js
View file @
7f69e45b
...
@@ -32,7 +32,7 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({
...
@@ -32,7 +32,7 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({
"click .post-actions > .edit-button"
:
"onEdit"
,
"click .post-actions > .edit-button"
:
"onEdit"
,
"click .post-actions > .delete-button"
:
"onDelete"
"click .post-actions > .delete-button"
:
"onDelete"
},
},
initialize
:
function
()
{
initialize
:
function
()
{
var
self
=
this
;
var
self
=
this
;
// instantiates an editor template for each update in the collection
// instantiates an editor template for each update in the collection
...
@@ -41,13 +41,13 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({
...
@@ -41,13 +41,13 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({
"/static/client_templates/course_info_update.html"
,
"/static/client_templates/course_info_update.html"
,
function
(
raw_template
)
{
function
(
raw_template
)
{
self
.
template
=
_
.
template
(
raw_template
);
self
.
template
=
_
.
template
(
raw_template
);
self
.
render
();
self
.
render
();
}
}
);
);
// when the client refetches the updates as a whole, re-render them
// when the client refetches the updates as a whole, re-render them
this
.
listenTo
(
this
.
collection
,
'reset'
,
this
.
render
);
this
.
listenTo
(
this
.
collection
,
'reset'
,
this
.
render
);
},
},
render
:
function
()
{
render
:
function
()
{
// iterate over updates and create views for each using the template
// iterate over updates and create views for each using the template
var
updateEle
=
this
.
$el
.
find
(
"#course-update-list"
);
var
updateEle
=
this
.
$el
.
find
(
"#course-update-list"
);
...
@@ -66,14 +66,14 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({
...
@@ -66,14 +66,14 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({
this
.
$el
.
find
(
'.date'
).
datepicker
({
'dateFormat'
:
'MM d, yy'
});
this
.
$el
.
find
(
'.date'
).
datepicker
({
'dateFormat'
:
'MM d, yy'
});
return
this
;
return
this
;
},
},
onNew
:
function
(
event
)
{
onNew
:
function
(
event
)
{
event
.
preventDefault
();
event
.
preventDefault
();
var
self
=
this
;
var
self
=
this
;
// create new obj, insert into collection, and render this one ele overriding the hidden attr
// create new obj, insert into collection, and render this one ele overriding the hidden attr
var
newModel
=
new
CMS
.
Models
.
CourseUpdate
();
var
newModel
=
new
CMS
.
Models
.
CourseUpdate
();
this
.
collection
.
add
(
newModel
,
{
at
:
0
});
this
.
collection
.
add
(
newModel
,
{
at
:
0
});
var
$newForm
=
$
(
this
.
template
({
updateModel
:
newModel
}));
var
$newForm
=
$
(
this
.
template
({
updateModel
:
newModel
}));
var
updateEle
=
this
.
$el
.
find
(
"#course-update-list"
);
var
updateEle
=
this
.
$el
.
find
(
"#course-update-list"
);
...
@@ -87,7 +87,7 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({
...
@@ -87,7 +87,7 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({
lineWrapping
:
true
,
lineWrapping
:
true
,
});
});
}
}
$newForm
.
addClass
(
'editing'
);
$newForm
.
addClass
(
'editing'
);
this
.
$currentPost
=
$newForm
.
closest
(
'li'
);
this
.
$currentPost
=
$newForm
.
closest
(
'li'
);
...
@@ -99,21 +99,21 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({
...
@@ -99,21 +99,21 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({
$
(
'.date'
).
datepicker
(
'destroy'
);
$
(
'.date'
).
datepicker
(
'destroy'
);
$
(
'.date'
).
datepicker
({
'dateFormat'
:
'MM d, yy'
});
$
(
'.date'
).
datepicker
({
'dateFormat'
:
'MM d, yy'
});
},
},
onSave
:
function
(
event
)
{
onSave
:
function
(
event
)
{
event
.
preventDefault
();
event
.
preventDefault
();
var
targetModel
=
this
.
eventModel
(
event
);
var
targetModel
=
this
.
eventModel
(
event
);
targetModel
.
set
({
date
:
this
.
dateEntry
(
event
).
val
(),
content
:
this
.
$codeMirror
.
getValue
()
});
targetModel
.
set
({
date
:
this
.
dateEntry
(
event
).
val
(),
content
:
this
.
$codeMirror
.
getValue
()
});
// push change to display, hide the editor, submit the change
// push change to display, hide the editor, submit the change
targetModel
.
save
({},
{
error
:
CMS
.
ServerError
});
targetModel
.
save
({},
{
error
:
CMS
.
ServerError
});
this
.
closeEditor
(
this
);
this
.
closeEditor
(
this
);
analytics
.
track
(
'Saved Course Update'
,
{
analytics
.
track
(
'Saved Course Update'
,
{
'course'
:
course_location_analytics
,
'course'
:
course_location_analytics
,
'date'
:
this
.
dateEntry
(
event
).
val
()
'date'
:
this
.
dateEntry
(
event
).
val
()
});
});
},
},
onCancel
:
function
(
event
)
{
onCancel
:
function
(
event
)
{
event
.
preventDefault
();
event
.
preventDefault
();
// change editor contents back to model values and hide the editor
// change editor contents back to model values and hide the editor
...
@@ -121,13 +121,13 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({
...
@@ -121,13 +121,13 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({
var
targetModel
=
this
.
eventModel
(
event
);
var
targetModel
=
this
.
eventModel
(
event
);
this
.
closeEditor
(
this
,
!
targetModel
.
id
);
this
.
closeEditor
(
this
,
!
targetModel
.
id
);
},
},
onEdit
:
function
(
event
)
{
onEdit
:
function
(
event
)
{
event
.
preventDefault
();
event
.
preventDefault
();
var
self
=
this
;
var
self
=
this
;
this
.
$currentPost
=
$
(
event
.
target
).
closest
(
'li'
);
this
.
$currentPost
=
$
(
event
.
target
).
closest
(
'li'
);
this
.
$currentPost
.
addClass
(
'editing'
);
this
.
$currentPost
.
addClass
(
'editing'
);
$
(
this
.
editor
(
event
)).
show
();
$
(
this
.
editor
(
event
)).
show
();
var
$textArea
=
this
.
$currentPost
.
find
(
".new-update-content"
).
first
();
var
$textArea
=
this
.
$currentPost
.
find
(
".new-update-content"
).
first
();
if
(
this
.
$codeMirror
==
null
)
{
if
(
this
.
$codeMirror
==
null
)
{
...
@@ -154,13 +154,13 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({
...
@@ -154,13 +154,13 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({
analytics
.
track
(
'Deleted Course Update'
,
{
analytics
.
track
(
'Deleted Course Update'
,
{
'course'
:
course_location_analytics
,
'course'
:
course_location_analytics
,
'date'
:
this
.
dateEntry
(
event
).
val
()
'date'
:
this
.
dateEntry
(
event
).
val
()
});
});
var
targetModel
=
this
.
eventModel
(
event
);
var
targetModel
=
this
.
eventModel
(
event
);
this
.
modelDom
(
event
).
remove
();
this
.
modelDom
(
event
).
remove
();
var
cacheThis
=
this
;
var
cacheThis
=
this
;
targetModel
.
destroy
({
success
:
function
(
model
,
response
)
{
targetModel
.
destroy
({
success
:
function
(
model
,
response
)
{
cacheThis
.
collection
.
fetch
({
success
:
function
()
{
cacheThis
.
render
();},
cacheThis
.
collection
.
fetch
({
success
:
function
()
{
cacheThis
.
render
();},
error
:
CMS
.
ServerError
});
error
:
CMS
.
ServerError
});
},
},
...
@@ -192,17 +192,17 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({
...
@@ -192,17 +192,17 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({
this
.
$codeMirror
=
null
;
this
.
$codeMirror
=
null
;
self
.
$currentPost
.
find
(
'.CodeMirror'
).
remove
();
self
.
$currentPost
.
find
(
'.CodeMirror'
).
remove
();
},
},
// Dereferencing from events to screen elements
// Dereferencing from events to screen elements
eventModel
:
function
(
event
)
{
eventModel
:
function
(
event
)
{
// not sure if it should be currentTarget or delegateTarget
// not sure if it should be currentTarget or delegateTarget
return
this
.
collection
.
get
(
$
(
event
.
currentTarget
).
attr
(
"name"
));
return
this
.
collection
.
get
(
$
(
event
.
currentTarget
).
attr
(
"name"
));
},
},
modelDom
:
function
(
event
)
{
modelDom
:
function
(
event
)
{
return
$
(
event
.
currentTarget
).
closest
(
"li"
);
return
$
(
event
.
currentTarget
).
closest
(
"li"
);
},
},
editor
:
function
(
event
)
{
editor
:
function
(
event
)
{
var
li
=
$
(
event
.
currentTarget
).
closest
(
"li"
);
var
li
=
$
(
event
.
currentTarget
).
closest
(
"li"
);
if
(
li
)
return
$
(
li
).
find
(
"form"
).
first
();
if
(
li
)
return
$
(
li
).
find
(
"form"
).
first
();
...
@@ -216,7 +216,7 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({
...
@@ -216,7 +216,7 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({
contentEntry
:
function
(
event
)
{
contentEntry
:
function
(
event
)
{
return
$
(
event
.
currentTarget
).
closest
(
"li"
).
find
(
".new-update-content"
).
first
();
return
$
(
event
.
currentTarget
).
closest
(
"li"
).
find
(
".new-update-content"
).
first
();
},
},
dateDisplay
:
function
(
event
)
{
dateDisplay
:
function
(
event
)
{
return
$
(
event
.
currentTarget
).
closest
(
"li"
).
find
(
"#date-display"
).
first
();
return
$
(
event
.
currentTarget
).
closest
(
"li"
).
find
(
"#date-display"
).
first
();
},
},
...
@@ -224,7 +224,7 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({
...
@@ -224,7 +224,7 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({
contentDisplay
:
function
(
event
)
{
contentDisplay
:
function
(
event
)
{
return
$
(
event
.
currentTarget
).
closest
(
"li"
).
find
(
".update-contents"
).
first
();
return
$
(
event
.
currentTarget
).
closest
(
"li"
).
find
(
".update-contents"
).
first
();
}
}
});
});
// the handouts view is dumb right now; it needs tied to a model and all that jazz
// the handouts view is dumb right now; it needs tied to a model and all that jazz
...
@@ -245,7 +245,7 @@ CMS.Views.ClassInfoHandoutsView = Backbone.View.extend({
...
@@ -245,7 +245,7 @@ CMS.Views.ClassInfoHandoutsView = Backbone.View.extend({
"/static/client_templates/course_info_handouts.html"
,
"/static/client_templates/course_info_handouts.html"
,
function
(
raw_template
)
{
function
(
raw_template
)
{
self
.
template
=
_
.
template
(
raw_template
);
self
.
template
=
_
.
template
(
raw_template
);
self
.
render
();
self
.
render
();
}
}
);
);
},
},
...
@@ -253,8 +253,8 @@ CMS.Views.ClassInfoHandoutsView = Backbone.View.extend({
...
@@ -253,8 +253,8 @@ CMS.Views.ClassInfoHandoutsView = Backbone.View.extend({
}
}
);
);
},
},
render
:
function
()
{
render
:
function
()
{
var
updateEle
=
this
.
$el
;
var
updateEle
=
this
.
$el
;
var
self
=
this
;
var
self
=
this
;
this
.
$el
.
html
(
this
.
$el
.
html
(
...
@@ -313,4 +313,4 @@ CMS.Views.ClassInfoHandoutsView = Backbone.View.extend({
...
@@ -313,4 +313,4 @@ CMS.Views.ClassInfoHandoutsView = Backbone.View.extend({
self
.
$form
.
find
(
'.CodeMirror'
).
remove
();
self
.
$form
.
find
(
'.CodeMirror'
).
remove
();
this
.
$codeMirror
=
null
;
this
.
$codeMirror
=
null
;
}
}
});
});
\ No newline at end of file
cms/static/js/views/grader-select-view.js
View file @
7f69e45b
...
@@ -16,7 +16,7 @@ CMS.Models.AssignmentGrade = Backbone.Model.extend({
...
@@ -16,7 +16,7 @@ CMS.Models.AssignmentGrade = Backbone.Model.extend({
urlRoot
:
function
()
{
urlRoot
:
function
()
{
if
(
this
.
has
(
'location'
))
{
if
(
this
.
has
(
'location'
))
{
var
location
=
this
.
get
(
'location'
);
var
location
=
this
.
get
(
'location'
);
return
'/'
+
location
.
get
(
'org'
)
+
"/"
+
location
.
get
(
'course'
)
+
'/'
+
location
.
get
(
'category'
)
+
'/'
return
'/'
+
location
.
get
(
'org'
)
+
"/"
+
location
.
get
(
'course'
)
+
'/'
+
location
.
get
(
'category'
)
+
'/'
+
location
.
get
(
'name'
)
+
'/gradeas/'
;
+
location
.
get
(
'name'
)
+
'/gradeas/'
;
}
}
else
return
""
;
else
return
""
;
...
@@ -37,14 +37,14 @@ CMS.Views.OverviewAssignmentGrader = Backbone.View.extend({
...
@@ -37,14 +37,14 @@ CMS.Views.OverviewAssignmentGrader = Backbone.View.extend({
'<a data-tooltip="Mark/unmark this subsection as graded" class="menu-toggle" href="#">'
+
'<a data-tooltip="Mark/unmark this subsection as graded" class="menu-toggle" href="#">'
+
'<% if (!hideSymbol) {%><span class="ss-icon ss-standard">✓</span><%};%>'
+
'<% if (!hideSymbol) {%><span class="ss-icon ss-standard">✓</span><%};%>'
+
'</a>'
+
'</a>'
+
'<ul class="menu">'
+
'<ul class="menu">'
+
'<% graders.each(function(option) { %>'
+
'<% graders.each(function(option) { %>'
+
'<li><a <% if (option.get("type") == assignmentType) {%>class="is-selected" <%}%> href="#"><%= option.get("type") %></a></li>'
+
'<li><a <% if (option.get("type") == assignmentType) {%>class="is-selected" <%}%> href="#"><%= option.get("type") %></a></li>'
+
'<% }) %>'
+
'<% }) %>'
+
'<li><a class="gradable-status-notgraded" href="#">Not Graded</a></li>'
+
'<li><a class="gradable-status-notgraded" href="#">Not Graded</a></li>'
+
'</ul>'
);
'</ul>'
);
this
.
assignmentGrade
=
new
CMS
.
Models
.
AssignmentGrade
({
this
.
assignmentGrade
=
new
CMS
.
Models
.
AssignmentGrade
({
assignmentUrl
:
this
.
$el
.
closest
(
'.id-holder'
).
data
(
'id'
),
assignmentUrl
:
this
.
$el
.
closest
(
'.id-holder'
).
data
(
'id'
),
graderType
:
this
.
$el
.
data
(
'initial-status'
)});
graderType
:
this
.
$el
.
data
(
'initial-status'
)});
// TODO throw exception if graders is null
// TODO throw exception if graders is null
this
.
graders
=
this
.
options
[
'graders'
];
this
.
graders
=
this
.
options
[
'graders'
];
...
@@ -78,13 +78,13 @@ CMS.Views.OverviewAssignmentGrader = Backbone.View.extend({
...
@@ -78,13 +78,13 @@ CMS.Views.OverviewAssignmentGrader = Backbone.View.extend({
},
},
selectGradeType
:
function
(
e
)
{
selectGradeType
:
function
(
e
)
{
e
.
preventDefault
();
e
.
preventDefault
();
this
.
removeMenu
(
e
);
this
.
removeMenu
(
e
);
// TODO I'm not happy with this string fetch via the html for what should be an id. I'd rather use the id attr
// TODO I'm not happy with this string fetch via the html for what should be an id. I'd rather use the id attr
// of the CourseGradingPolicy model or null for Not Graded (NOTE, change template's if check for is-selected accordingly)
// of the CourseGradingPolicy model or null for Not Graded (NOTE, change template's if check for is-selected accordingly)
this
.
assignmentGrade
.
save
(
'graderType'
,
$
(
e
.
target
).
text
());
this
.
assignmentGrade
.
save
(
'graderType'
,
$
(
e
.
target
).
text
());
this
.
render
();
this
.
render
();
}
}
})
})
\ No newline at end of file
cms/static/js/views/overview.js
View file @
7f69e45b
...
@@ -6,26 +6,26 @@ $(document).ready(function() {
...
@@ -6,26 +6,26 @@ $(document).ready(function() {
$
(
'.unit'
).
draggable
({
$
(
'.unit'
).
draggable
({
axis
:
'y'
,
axis
:
'y'
,
handle
:
'.drag-handle'
,
handle
:
'.drag-handle'
,
zIndex
:
999
,
zIndex
:
999
,
start
:
initiateHesitate
,
start
:
initiateHesitate
,
// left 2nd arg in as inert selector b/c i was uncertain whether we'd try to get the shove up/down
// left 2nd arg in as inert selector b/c i was uncertain whether we'd try to get the shove up/down
// to work in the future
// to work in the future
drag
:
generateCheckHoverState
(
'.collapsed'
,
''
),
drag
:
generateCheckHoverState
(
'.collapsed'
,
''
),
stop
:
removeHesitate
,
stop
:
removeHesitate
,
revert
:
"invalid"
revert
:
"invalid"
});
});
// Subsection reordering
// Subsection reordering
$
(
'.id-holder'
).
draggable
({
$
(
'.id-holder'
).
draggable
({
axis
:
'y'
,
axis
:
'y'
,
handle
:
'.section-item .drag-handle'
,
handle
:
'.section-item .drag-handle'
,
zIndex
:
999
,
zIndex
:
999
,
start
:
initiateHesitate
,
start
:
initiateHesitate
,
drag
:
generateCheckHoverState
(
'.courseware-section.collapsed'
,
''
),
drag
:
generateCheckHoverState
(
'.courseware-section.collapsed'
,
''
),
stop
:
removeHesitate
,
stop
:
removeHesitate
,
revert
:
"invalid"
revert
:
"invalid"
});
});
// Section reordering
// Section reordering
$
(
'.courseware-section'
).
draggable
({
$
(
'.courseware-section'
).
draggable
({
axis
:
'y'
,
axis
:
'y'
,
...
@@ -33,8 +33,8 @@ $(document).ready(function() {
...
@@ -33,8 +33,8 @@ $(document).ready(function() {
stack
:
'.courseware-section'
,
stack
:
'.courseware-section'
,
revert
:
"invalid"
revert
:
"invalid"
});
});
$
(
'.sortable-unit-list'
).
droppable
({
$
(
'.sortable-unit-list'
).
droppable
({
accept
:
'.unit'
,
accept
:
'.unit'
,
greedy
:
true
,
greedy
:
true
,
...
@@ -50,7 +50,7 @@ $(document).ready(function() {
...
@@ -50,7 +50,7 @@ $(document).ready(function() {
drop
:
onSubsectionReordered
,
drop
:
onSubsectionReordered
,
greedy
:
true
greedy
:
true
});
});
// Section reordering
// Section reordering
$
(
'.courseware-overview'
).
droppable
({
$
(
'.courseware-overview'
).
droppable
({
accept
:
'.courseware-section'
,
accept
:
'.courseware-section'
,
...
@@ -58,7 +58,7 @@ $(document).ready(function() {
...
@@ -58,7 +58,7 @@ $(document).ready(function() {
drop
:
onSectionReordered
,
drop
:
onSectionReordered
,
greedy
:
true
greedy
:
true
});
});
// stop clicks on drag bars from doing their thing w/o stopping drag
// stop clicks on drag bars from doing their thing w/o stopping drag
$
(
'.drag-handle'
).
click
(
function
(
e
)
{
e
.
preventDefault
();
});
$
(
'.drag-handle'
).
click
(
function
(
e
)
{
e
.
preventDefault
();
});
...
@@ -87,7 +87,7 @@ function computeIntersection(droppable, uiHelper, y) {
...
@@ -87,7 +87,7 @@ function computeIntersection(droppable, uiHelper, y) {
$
.
extend
(
droppable
,
{
offset
:
$
(
droppable
).
offset
()});
$
.
extend
(
droppable
,
{
offset
:
$
(
droppable
).
offset
()});
var
t
=
droppable
.
offset
.
top
,
var
t
=
droppable
.
offset
.
top
,
b
=
t
+
droppable
.
proportions
.
height
;
b
=
t
+
droppable
.
proportions
.
height
;
if
(
t
===
b
)
{
if
(
t
===
b
)
{
...
@@ -118,10 +118,10 @@ function generateCheckHoverState(selectorsToOpen, selectorsToShove) {
...
@@ -118,10 +118,10 @@ function generateCheckHoverState(selectorsToOpen, selectorsToShove) {
this
[
c
===
"isout"
?
"isover"
:
"isout"
]
=
false
;
this
[
c
===
"isout"
?
"isover"
:
"isout"
]
=
false
;
$
(
this
).
trigger
(
c
===
"isover"
?
"dragEnter"
:
"dragLeave"
);
$
(
this
).
trigger
(
c
===
"isover"
?
"dragEnter"
:
"dragLeave"
);
});
});
$
(
selectorsToShove
).
each
(
function
()
{
$
(
selectorsToShove
).
each
(
function
()
{
var
intersectsBottom
=
computeIntersection
(
this
,
ui
.
helper
,
(
draggable
.
positionAbs
||
draggable
.
position
.
absolute
).
top
);
var
intersectsBottom
=
computeIntersection
(
this
,
ui
.
helper
,
(
draggable
.
positionAbs
||
draggable
.
position
.
absolute
).
top
);
if
(
$
(
this
).
hasClass
(
'ui-dragging-pushup'
))
{
if
(
$
(
this
).
hasClass
(
'ui-dragging-pushup'
))
{
if
(
!
intersectsBottom
)
{
if
(
!
intersectsBottom
)
{
console
.
log
(
'not up'
,
$
(
this
).
data
(
'id'
));
console
.
log
(
'not up'
,
$
(
this
).
data
(
'id'
));
...
@@ -132,10 +132,10 @@ function generateCheckHoverState(selectorsToOpen, selectorsToShove) {
...
@@ -132,10 +132,10 @@ function generateCheckHoverState(selectorsToOpen, selectorsToShove) {
console
.
log
(
'up'
,
$
(
this
).
data
(
'id'
));
console
.
log
(
'up'
,
$
(
this
).
data
(
'id'
));
$
(
this
).
addClass
(
'ui-dragging-pushup'
);
$
(
this
).
addClass
(
'ui-dragging-pushup'
);
}
}
var
intersectsTop
=
computeIntersection
(
this
,
ui
.
helper
,
var
intersectsTop
=
computeIntersection
(
this
,
ui
.
helper
,
(
draggable
.
positionAbs
||
draggable
.
position
.
absolute
).
top
+
draggable
.
helperProportions
.
height
);
(
draggable
.
positionAbs
||
draggable
.
position
.
absolute
).
top
+
draggable
.
helperProportions
.
height
);
if
(
$
(
this
).
hasClass
(
'ui-dragging-pushdown'
))
{
if
(
$
(
this
).
hasClass
(
'ui-dragging-pushdown'
))
{
if
(
!
intersectsTop
)
{
if
(
!
intersectsTop
)
{
console
.
log
(
'not down'
,
$
(
this
).
data
(
'id'
));
console
.
log
(
'not down'
,
$
(
this
).
data
(
'id'
));
...
@@ -146,7 +146,7 @@ function generateCheckHoverState(selectorsToOpen, selectorsToShove) {
...
@@ -146,7 +146,7 @@ function generateCheckHoverState(selectorsToOpen, selectorsToShove) {
console
.
log
(
'down'
,
$
(
this
).
data
(
'id'
));
console
.
log
(
'down'
,
$
(
this
).
data
(
'id'
));
$
(
this
).
addClass
(
'ui-dragging-pushdown'
);
$
(
this
).
addClass
(
'ui-dragging-pushdown'
);
}
}
});
});
}
}
}
}
...
@@ -159,20 +159,20 @@ function removeHesitate(event, ui) {
...
@@ -159,20 +159,20 @@ function removeHesitate(event, ui) {
}
}
function
expandSection
(
event
)
{
function
expandSection
(
event
)
{
$
(
event
.
delegateTarget
).
removeClass
(
'collapsed'
,
400
);
$
(
event
.
delegateTarget
).
removeClass
(
'collapsed'
,
400
);
// don't descend to icon's on children (which aren't under first child) only to this element's icon
// don't descend to icon's on children (which aren't under first child) only to this element's icon
$
(
event
.
delegateTarget
).
children
().
first
().
find
(
'.expand-collapse-icon'
).
removeClass
(
'expand'
,
400
).
addClass
(
'collapse'
);
$
(
event
.
delegateTarget
).
children
().
first
().
find
(
'.expand-collapse-icon'
).
removeClass
(
'expand'
,
400
).
addClass
(
'collapse'
);
}
}
function
onUnitReordered
(
event
,
ui
)
{
function
onUnitReordered
(
event
,
ui
)
{
// a unit's been dropped on this subsection,
// a unit's been dropped on this subsection,
// figure out where it came from and where it slots in.
// figure out where it came from and where it slots in.
_handleReorder
(
event
,
ui
,
'subsection-id'
,
'li:.leaf'
);
_handleReorder
(
event
,
ui
,
'subsection-id'
,
'li:.leaf'
);
}
}
function
onSubsectionReordered
(
event
,
ui
)
{
function
onSubsectionReordered
(
event
,
ui
)
{
// a subsection has been dropped on this section,
// a subsection has been dropped on this section,
// figure out where it came from and where it slots in.
// figure out where it came from and where it slots in.
_handleReorder
(
event
,
ui
,
'section-id'
,
'li:.branch'
);
_handleReorder
(
event
,
ui
,
'section-id'
,
'li:.branch'
);
}
}
...
@@ -182,7 +182,7 @@ function onSectionReordered(event, ui) {
...
@@ -182,7 +182,7 @@ function onSectionReordered(event, ui) {
}
}
function
_handleReorder
(
event
,
ui
,
parentIdField
,
childrenSelector
)
{
function
_handleReorder
(
event
,
ui
,
parentIdField
,
childrenSelector
)
{
// figure out where it came from and where it slots in.
// figure out where it came from and where it slots in.
var
subsection_id
=
$
(
event
.
target
).
data
(
parentIdField
);
var
subsection_id
=
$
(
event
.
target
).
data
(
parentIdField
);
var
_els
=
$
(
event
.
target
).
children
(
childrenSelector
);
var
_els
=
$
(
event
.
target
).
children
(
childrenSelector
);
var
children
=
_els
.
map
(
function
(
idx
,
el
)
{
return
$
(
el
).
data
(
'id'
);
}).
get
();
var
children
=
_els
.
map
(
function
(
idx
,
el
)
{
return
$
(
el
).
data
(
'id'
);
}).
get
();
...
...
cms/static/js/views/server_error.js
View file @
7f69e45b
CMS
.
ServerError
=
function
(
model
,
error
)
{
CMS
.
ServerError
=
function
(
model
,
error
)
{
// this handler is for the client:server communication not the validation errors which handleValidationError catches
// this handler is for the client:server communication not the validation errors which handleValidationError catches
window
.
alert
(
"Server Error: "
+
error
.
responseText
);
window
.
alert
(
"Server Error: "
+
error
.
responseText
);
};
};
\ No newline at end of file
cms/static/js/views/validating_view.js
View file @
7f69e45b
CMS
.
Views
.
ValidatingView
=
Backbone
.
View
.
extend
({
CMS
.
Views
.
ValidatingView
=
Backbone
.
View
.
extend
({
// Intended as an abstract class which catches validation errors on the model and
// Intended as an abstract class which catches validation errors on the model and
// decorates the fields. Needs wiring per class, but this initialization shows how
// decorates the fields. Needs wiring per class, but this initialization shows how
// either have your init call this one or copy the contents
// either have your init call this one or copy the contents
initialize
:
function
()
{
initialize
:
function
()
{
this
.
listenTo
(
this
.
model
,
'error'
,
CMS
.
ServerError
);
this
.
listenTo
(
this
.
model
,
'error'
,
CMS
.
ServerError
);
...
@@ -15,7 +15,7 @@ CMS.Views.ValidatingView = Backbone.View.extend({
...
@@ -15,7 +15,7 @@ CMS.Views.ValidatingView = Backbone.View.extend({
"change textarea"
:
"clearValidationErrors"
"change textarea"
:
"clearValidationErrors"
},
},
fieldToSelectorMap
:
{
fieldToSelectorMap
:
{
// Your subclass must populate this w/ all of the model keys and dom selectors
// Your subclass must populate this w/ all of the model keys and dom selectors
// which may be the subjects of validation errors
// which may be the subjects of validation errors
},
},
_cacheValidationErrors
:
[],
_cacheValidationErrors
:
[],
...
...
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