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
5331ae05
Commit
5331ae05
authored
Nov 27, 2012
by
Don Mitchell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Got time change hooked up but gained a spurious call to change on date
change.
parent
d165da3f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
16 deletions
+25
-16
cms/static/js/views/settings/main_settings_view.js
+18
-9
cms/templates/settings.html
+4
-4
common/djangoapps/models/settings/course_details.py
+1
-2
common/djangoapps/util/converters.py
+2
-1
No files found.
cms/static/js/views/settings/main_settings_view.js
View file @
5331ae05
...
@@ -91,10 +91,10 @@ CMS.Views.Settings.Details = Backbone.View.extend({
...
@@ -91,10 +91,10 @@ CMS.Views.Settings.Details = Backbone.View.extend({
},
},
render
:
function
()
{
render
:
function
()
{
this
.
setupDatePicker
(
'#course-start
-date
'
,
'start_date'
);
this
.
setupDatePicker
(
'#course-start'
,
'start_date'
);
this
.
setupDatePicker
(
'#course-end
-date
'
,
'end_date'
);
this
.
setupDatePicker
(
'#course-end'
,
'end_date'
);
this
.
setupDatePicker
(
'#
course-enrollment-start-date
'
,
'enrollment_start'
);
this
.
setupDatePicker
(
'#
enrollment-start
'
,
'enrollment_start'
);
this
.
setupDatePicker
(
'#
course-enrollment-end-date
'
,
'enrollment_end'
);
this
.
setupDatePicker
(
'#
enrollment-end
'
,
'enrollment_end'
);
if
(
this
.
model
.
has
(
'syllabus'
))
{
if
(
this
.
model
.
has
(
'syllabus'
))
{
this
.
$el
.
find
(
'.current-course-syllabus .doc-filename'
).
html
(
this
.
$el
.
find
(
'.current-course-syllabus .doc-filename'
).
html
(
...
@@ -123,11 +123,20 @@ CMS.Views.Settings.Details = Backbone.View.extend({
...
@@ -123,11 +123,20 @@ CMS.Views.Settings.Details = Backbone.View.extend({
setupDatePicker
:
function
(
elementName
,
fieldName
)
{
setupDatePicker
:
function
(
elementName
,
fieldName
)
{
var
cacheModel
=
this
.
model
;
var
cacheModel
=
this
.
model
;
var
picker
=
this
.
$el
.
find
(
elementName
);
var
div
=
this
.
$el
.
find
(
elementName
);
picker
.
datepicker
({
onSelect
:
function
(
newVal
)
{
var
datefield
=
$
(
div
).
find
(
".date"
);
cacheModel
.
save
(
fieldName
,
new
Date
(
newVal
));
var
timefield
=
$
(
div
).
find
(
".time"
);
}});
var
savefield
=
function
(
event
)
{
picker
.
datepicker
(
'setDate'
,
this
.
model
.
get
(
fieldName
));
cacheModel
.
save
(
fieldName
,
new
Date
(
datefield
.
datepicker
(
'getDate'
).
getTime
()
+
timefield
.
timepicker
(
"getSecondsFromMidnight"
)
*
1000
));
};
// FIXME being called 2x on each change. Was trapping datepicker onSelect b4 but change to datepair broke that
datefield
.
on
(
'change'
,
savefield
);
timefield
.
on
(
'changeTime'
,
savefield
);
datefield
.
datepicker
(
'setDate'
,
this
.
model
.
get
(
fieldName
));
timefield
.
timepicker
(
'setTime'
,
this
.
model
.
get
(
fieldName
));
},
},
updateModel
:
function
(
event
)
{
updateModel
:
function
(
event
)
{
...
...
cms/templates/settings.html
View file @
5331ae05
...
@@ -220,7 +220,7 @@ from contentstore import utils
...
@@ -220,7 +220,7 @@ from contentstore import utils
<h4
class=
"label"
>
Course Dates:
</h4>
<h4
class=
"label"
>
Course Dates:
</h4>
<div
class=
"field datepair"
>
<div
class=
"field datepair"
>
<div
class=
"input multi multi-inline"
>
<div
class=
"input multi multi-inline"
id=
"course-start"
>
<div
class=
"group"
>
<div
class=
"group"
>
<label
for=
"course-start-date"
>
Start Date
</label>
<label
for=
"course-start-date"
>
Start Date
</label>
<input
type=
"text"
class=
"start-date date"
id=
"course-start-date"
placeholder=
"MM/DD/YYYY"
autocomplete=
"off"
>
<input
type=
"text"
class=
"start-date date"
id=
"course-start-date"
placeholder=
"MM/DD/YYYY"
autocomplete=
"off"
>
...
@@ -236,7 +236,7 @@ from contentstore import utils
...
@@ -236,7 +236,7 @@ from contentstore import utils
</div>
</div>
<div
class=
"field field-additional datepair"
>
<div
class=
"field field-additional datepair"
>
<div
class=
"input multi multi-inline"
>
<div
class=
"input multi multi-inline"
id=
"course-end"
>
<div
class=
"group"
>
<div
class=
"group"
>
<label
for=
"course-end-date"
>
End Date
</label>
<label
for=
"course-end-date"
>
End Date
</label>
<input
type=
"text"
class=
"end-date date"
id=
"course-end-date"
placeholder=
"MM/DD/YYYY"
autocomplete=
"off"
>
<input
type=
"text"
class=
"end-date date"
id=
"course-end-date"
placeholder=
"MM/DD/YYYY"
autocomplete=
"off"
>
...
@@ -256,7 +256,7 @@ from contentstore import utils
...
@@ -256,7 +256,7 @@ from contentstore import utils
<h4
class=
"label"
>
Enrollment Dates:
</h4>
<h4
class=
"label"
>
Enrollment Dates:
</h4>
<div
class=
"field datepair"
>
<div
class=
"field datepair"
>
<div
class=
"input multi multi-inline"
>
<div
class=
"input multi multi-inline"
id=
"enrollment-start"
>
<div
class=
"group"
>
<div
class=
"group"
>
<label
for=
"course-enrollment-start-date"
>
Start Date
</label>
<label
for=
"course-enrollment-start-date"
>
Start Date
</label>
<input
type=
"text"
class=
"start-date date"
id=
"course-enrollment-start-date"
placeholder=
"MM/DD/YYYY"
>
<input
type=
"text"
class=
"start-date date"
id=
"course-enrollment-start-date"
placeholder=
"MM/DD/YYYY"
>
...
@@ -272,7 +272,7 @@ from contentstore import utils
...
@@ -272,7 +272,7 @@ from contentstore import utils
</div>
</div>
<div
class=
"field field-additional datepair"
>
<div
class=
"field field-additional datepair"
>
<div
class=
"input multi multi-inline"
>
<div
class=
"input multi multi-inline"
id=
"enrollment-end"
>
<div
class=
"group"
>
<div
class=
"group"
>
<label
for=
"course-enrollment-end-date"
>
Start Date
</label>
<label
for=
"course-enrollment-end-date"
>
Start Date
</label>
<input
type=
"text"
class=
"start-end date"
id=
"course-enrollment-end-date"
placeholder=
"MM/DD/YYYY"
>
<input
type=
"text"
class=
"start-end date"
id=
"course-enrollment-end-date"
placeholder=
"MM/DD/YYYY"
>
...
...
common/djangoapps/models/settings/course_details.py
View file @
5331ae05
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.django
import
modulestore
from
xmodule.course_module
import
CourseDescriptor
from
xmodule.modulestore
import
Location
from
xmodule.modulestore
import
Location
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
import
json
import
json
from
json.encoder
import
JSONEncoder
from
json.encoder
import
JSONEncoder
import
time
import
time
from
util.converters
import
time_to_date
,
jsdate_to_tim
e
from
util.converters
import
jsdate_to_time
,
time_to_dat
e
class
CourseDetails
:
class
CourseDetails
:
def
__init__
(
self
,
location
):
def
__init__
(
self
,
location
):
...
...
common/djangoapps/util/converters.py
View file @
5331ae05
import
time
,
datetime
import
time
,
datetime
import
re
import
re
import
calendar
def
time_to_date
(
time_obj
):
def
time_to_date
(
time_obj
):
"""
"""
Convert a time.time_struct to a true universal time (can pass to js Date constructor)
Convert a time.time_struct to a true universal time (can pass to js Date constructor)
"""
"""
return
time
.
mktime
(
time_obj
)
*
1000
return
calendar
.
timegm
(
time_obj
)
*
1000
def
jsdate_to_time
(
field
):
def
jsdate_to_time
(
field
):
"""
"""
...
...
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