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
674bfc4f
Commit
674bfc4f
authored
Dec 18, 2014
by
Andy Armstrong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use edx namespace for Backbone classes
parent
5ea7ced9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
69 additions
and
46 deletions
+69
-46
lms/static/js/collections/cohort.js
+0
-11
lms/static/js/groups/collections/cohort.js
+16
-0
lms/static/js/groups/models/cohort.js
+7
-3
lms/static/js/groups/views/cohort_editor.js
+7
-3
lms/static/js/groups/views/cohorts.js
+11
-4
lms/static/js/spec/groups/views/cohorts_spec.js
+1
-1
lms/static/js/spec/main.js
+21
-18
lms/templates/instructor/instructor_dashboard_2/instructor_dashboard_2.html
+4
-4
lms/templates/instructor/instructor_dashboard_2/membership.html
+2
-2
No files found.
lms/static/js/collections/cohort.js
deleted
100644 → 0
View file @
5ea7ced9
(
function
(
Backbone
)
{
var
CohortCollection
=
Backbone
.
Collection
.
extend
({
model
:
this
.
CohortModel
,
comparator
:
"name"
,
parse
:
function
(
response
)
{
return
response
.
cohorts
;
}
});
this
.
CohortCollection
=
CohortCollection
;
}).
call
(
this
,
Backbone
);
lms/static/js/groups/collections/cohort.js
0 → 100644
View file @
674bfc4f
var
edx
=
edx
||
{};
(
function
(
Backbone
,
CohortModel
)
{
'use strict'
;
edx
.
groups
=
edx
.
groups
||
{};
edx
.
groups
.
CohortCollection
=
Backbone
.
Collection
.
extend
({
model
:
CohortModel
,
comparator
:
"name"
,
parse
:
function
(
response
)
{
return
response
.
cohorts
;
}
});
}).
call
(
this
,
Backbone
,
edx
.
groups
.
CohortModel
);
lms/static/js/models/cohort.js
→
lms/static/js/
groups/
models/cohort.js
View file @
674bfc4f
var
edx
=
edx
||
{};
(
function
(
Backbone
)
{
var
CohortModel
=
Backbone
.
Model
.
extend
({
'use strict'
;
edx
.
groups
=
edx
.
groups
||
{};
edx
.
groups
.
CohortModel
=
Backbone
.
Model
.
extend
({
idAttribute
:
'id'
,
defaults
:
{
name
:
''
,
...
...
@@ -20,6 +26,4 @@
group_id
:
null
}
});
this
.
CohortModel
=
CohortModel
;
}).
call
(
this
,
Backbone
);
lms/static/js/views/cohort_editor.js
→
lms/static/js/
groups/
views/cohort_editor.js
View file @
674bfc4f
var
edx
=
edx
||
{};
(
function
(
Backbone
,
_
,
$
,
gettext
,
ngettext
,
interpolate_text
,
NotificationModel
,
NotificationView
)
{
var
CohortEditorView
=
Backbone
.
View
.
extend
({
'use strict'
;
edx
.
groups
=
edx
.
groups
||
{};
edx
.
groups
.
CohortEditorView
=
Backbone
.
View
.
extend
({
events
:
{
"submit .cohort-management-group-add-form"
:
"addStudents"
},
...
...
@@ -202,6 +208,4 @@
}
}
});
this
.
CohortEditorView
=
CohortEditorView
;
}).
call
(
this
,
Backbone
,
_
,
$
,
gettext
,
ngettext
,
interpolate_text
,
NotificationModel
,
NotificationView
);
lms/static/js/views/cohorts.js
→
lms/static/js/
groups/
views/cohorts.js
View file @
674bfc4f
(
function
(
$
,
_
,
Backbone
,
gettext
,
interpolate_text
,
CohortEditorView
,
NotificationModel
,
NotificationView
,
FileUploaderView
)
{
var
edx
=
edx
||
{};
(
function
(
$
,
_
,
Backbone
,
gettext
,
interpolate_text
,
CohortEditorView
,
NotificationModel
,
NotificationView
,
FileUploaderView
)
{
'use strict'
;
var
hiddenClass
=
'is-hidden'
,
disabledClass
=
'is-disabled'
;
this
.
CohortsView
=
Backbone
.
View
.
extend
({
edx
.
groups
=
edx
.
groups
||
{};
edx
.
groups
.
CohortsView
=
Backbone
.
View
.
extend
({
events
:
{
'change .cohort-select'
:
'onCohortSelected'
,
'click .action-create'
:
'showAddCohortForm'
,
...
...
@@ -226,6 +233,6 @@
getSectionCss
:
function
(
section
)
{
return
".instructor-nav .nav-item a[data-section='"
+
section
+
"']"
;
}
});
}).
call
(
this
,
$
,
_
,
Backbone
,
gettext
,
interpolate_text
,
CohortEditorView
,
NotificationModel
,
NotificationView
,
FileUploaderView
);
}).
call
(
this
,
$
,
_
,
Backbone
,
gettext
,
interpolate_text
,
edx
.
groups
.
CohortEditorView
,
NotificationModel
,
NotificationView
,
FileUploaderView
);
lms/static/js/spec/views/cohorts_spec.js
→
lms/static/js/spec/
groups/
views/cohorts_spec.js
View file @
674bfc4f
define
([
'backbone'
,
'jquery'
,
'js/common_helpers/ajax_helpers'
,
'js/common_helpers/template_helpers'
,
'js/
views/cohorts'
,
'j
s/collections/cohort'
,
'string_utils'
],
'js/
groups/views/cohorts'
,
'js/group
s/collections/cohort'
,
'string_utils'
],
function
(
Backbone
,
$
,
AjaxHelpers
,
TemplateHelpers
,
CohortsView
,
CohortCollection
)
{
describe
(
"Cohorts View"
,
function
()
{
var
catLoversInitialCount
=
123
,
dogLoversInitialCount
=
456
,
unknownUserMessage
,
...
...
lms/static/js/spec/main.js
View file @
674bfc4f
...
...
@@ -61,13 +61,13 @@
'js/staff_debug_actions'
:
'js/staff_debug_actions'
,
// Backbone classes loaded explicitly until they are converted to use RequireJS
'js/models/notification'
:
'js/models/notification'
,
'js/views/file_uploader'
:
'js/views/file_uploader'
,
'js/models/cohort'
:
'js/models/cohort'
,
'js/collections/cohort'
:
'js/collections/cohort'
,
'js/views/cohort_editor'
:
'js/views/cohort_editor'
,
'js/views/cohorts'
:
'js/views/cohorts'
,
'js/views/notification'
:
'js/views/notification'
,
'js/models/notification'
:
'js/models/notification'
,
'js/groups/models/cohort'
:
'js/groups/models/cohort'
,
'js/groups/collections/cohort'
:
'js/groups/collections/cohort'
,
'js/groups/views/cohort_editor'
:
'js/groups/views/cohort_editor'
,
'js/groups/views/cohorts'
:
'js/groups/views/cohorts'
,
'js/student_account/account'
:
'js/student_account/account'
,
'js/student_account/views/FormView'
:
'js/student_account/views/FormView'
,
'js/student_account/models/LoginModel'
:
'js/student_account/models/LoginModel'
,
...
...
@@ -280,23 +280,25 @@
exports
:
'edx.instructor_dashboard.ecommerce.ExpiryCouponView'
,
deps
:
[
'backbone'
,
'jquery'
,
'underscore'
]
},
'js/models/cohort'
:
{
exports
:
'CohortModel'
,
'js/
groups/
models/cohort'
:
{
exports
:
'
edx.groups.
CohortModel'
,
deps
:
[
'backbone'
]
},
'js/collections/cohort'
:
{
exports
:
'CohortCollection'
,
deps
:
[
'backbone'
,
'js/models/cohort'
]
'js/
groups/
collections/cohort'
:
{
exports
:
'
edx.groups.
CohortCollection'
,
deps
:
[
'backbone'
,
'js/
groups/
models/cohort'
]
},
'js/views/cohort_editor'
:
{
exports
:
'CohortsEditor'
,
deps
:
[
'backbone'
,
'jquery'
,
'underscore'
,
'js/views/notification'
,
'js/models/notification'
,
'js/groups/views/cohort_editor'
:
{
exports
:
'edx.groups.CohortsEditor'
,
deps
:
[
'backbone'
,
'jquery'
,
'underscore'
,
'js/views/notification'
,
'js/models/notification'
,
'string_utils'
]
},
'js/views/cohorts'
:
{
exports
:
'CohortsView'
,
deps
:
[
'jquery'
,
'underscore'
,
'backbone'
,
'gettext'
,
'string_utils'
,
'js/views/cohort_editor'
,
'js/groups/views/cohorts'
:
{
exports
:
'edx.groups.CohortsView'
,
deps
:
[
'jquery'
,
'underscore'
,
'backbone'
,
'gettext'
,
'string_utils'
,
'js/groups/views/cohort_editor'
,
'js/views/notification'
,
'js/models/notification'
,
'js/views/file_uploader'
]
},
...
...
@@ -310,7 +312,8 @@
},
'js/views/file_uploader'
:
{
exports
:
'FileUploaderView'
,
deps
:
[
'backbone'
,
'jquery'
,
'underscore'
,
'gettext'
,
'string_utils'
,
'js/views/notification'
,
deps
:
[
'backbone'
,
'jquery'
,
'underscore'
,
'gettext'
,
'string_utils'
,
'js/views/notification'
,
'js/models/notification'
,
'jquery.fileupload'
]
},
...
...
@@ -505,12 +508,12 @@
// TODO: why do these need 'lms/include' at the front but the CMS equivalent logic doesn't?
define
([
// Run the LMS tests
'lms/include/js/spec/views/cohorts_spec.js'
,
'lms/include/js/spec/photocapture_spec.js'
,
'lms/include/js/spec/staff_debug_actions_spec.js'
,
'lms/include/js/spec/views/notification_spec.js'
,
'lms/include/js/spec/views/file_uploader_spec.js'
,
'lms/include/js/spec/dashboard/donation.js'
,
'lms/include/js/spec/groups/views/cohorts_spec.js'
,
'lms/include/js/spec/shoppingcart/shoppingcart_spec.js'
,
'lms/include/js/spec/instructor_dashboard/ecommerce_spec.js'
,
'lms/include/js/spec/student_account/account_spec.js'
,
...
...
lms/templates/instructor/instructor_dashboard_2/instructor_dashboard_2.html
View file @
674bfc4f
...
...
@@ -57,10 +57,10 @@
<script
type=
"text/javascript"
src=
"${static.url('js/models/notification.js')}"
></script>
<script
type=
"text/javascript"
src=
"${static.url('js/views/notification.js')}"
></script>
<script
type=
"text/javascript"
src=
"${static.url('js/views/file_uploader.js')}"
></script>
<script
type=
"text/javascript"
src=
"${static.url('js/models/cohort.js')}"
></script>
<script
type=
"text/javascript"
src=
"${static.url('js/collections/cohort.js')}"
></script>
<script
type=
"text/javascript"
src=
"${static.url('js/views/cohort_editor.js')}"
></script>
<script
type=
"text/javascript"
src=
"${static.url('js/views/cohorts.js')}"
></script>
<script
type=
"text/javascript"
src=
"${static.url('js/
groups/
models/cohort.js')}"
></script>
<script
type=
"text/javascript"
src=
"${static.url('js/
groups/
collections/cohort.js')}"
></script>
<script
type=
"text/javascript"
src=
"${static.url('js/
groups/
views/cohort_editor.js')}"
></script>
<script
type=
"text/javascript"
src=
"${static.url('js/
groups/
views/cohorts.js')}"
></script>
</
%
block>
## Include Underscore templates
...
...
lms/templates/instructor/instructor_dashboard_2/membership.html
View file @
674bfc4f
...
...
@@ -258,9 +258,9 @@
$
(
document
).
ready
(
function
()
{
var
cohortManagementElement
=
$
(
'.cohort-management'
);
if
(
cohortManagementElement
.
length
>
0
)
{
var
cohorts
=
new
CohortCollection
();
var
cohorts
=
new
edx
.
groups
.
CohortCollection
();
cohorts
.
url
=
cohortManagementElement
.
data
(
'ajax_url'
);
var
cohortsView
=
new
CohortsView
({
var
cohortsView
=
new
edx
.
groups
.
CohortsView
({
el
:
cohortManagementElement
,
model
:
cohorts
,
advanced_settings_url
:
cohortManagementElement
.
data
(
'advanced-settings-url'
),
...
...
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