Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
ecommerce
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
ecommerce
Commits
596685ce
Commit
596685ce
authored
Jul 28, 2015
by
Clinton Blackburn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added course edit view
XCOM-520
parent
53a8b55b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
2 deletions
+46
-2
ecommerce/static/js/pages/course_edit_page.js
+31
-0
ecommerce/static/js/routers/course_router.js
+12
-2
ecommerce/static/js/views/course_create_edit_view.js
+3
-0
No files found.
ecommerce/static/js/pages/course_edit_page.js
0 → 100644
View file @
596685ce
define
([
'models/course_model'
,
'pages/page'
,
'views/course_create_edit_view'
],
function
(
Course
,
Page
,
CourseCreateEditView
)
{
'use strict'
;
return
Page
.
extend
({
title
:
function
()
{
return
this
.
model
.
get
(
'name'
)
+
' - '
+
gettext
(
'Edit Course'
);
},
initialize
:
function
(
options
)
{
this
.
model
=
Course
.
findOrCreate
({
id
:
options
.
id
});
this
.
view
=
new
CourseCreateEditView
({
editing
:
true
,
model
:
this
.
model
});
this
.
listenTo
(
this
.
model
,
'change sync'
,
this
.
render
);
this
.
model
.
fetch
({
data
:
{
include_products
:
true
}
});
}
});
}
);
ecommerce/static/js/routers/course_router.js
View file @
596685ce
...
@@ -4,14 +4,16 @@ define([
...
@@ -4,14 +4,16 @@ define([
'backbone.super'
,
'backbone.super'
,
'pages/course_list_page'
,
'pages/course_list_page'
,
'pages/course_detail_page'
,
'pages/course_detail_page'
,
'pages/course_create_page'
'pages/course_create_page'
,
'pages/course_edit_page'
],
],
function
(
Backbone
,
function
(
Backbone
,
BackboneRouteFilter
,
BackboneRouteFilter
,
BackboneSuper
,
BackboneSuper
,
CourseListPage
,
CourseListPage
,
CourseDetailPage
,
CourseDetailPage
,
CourseCreatePage
)
{
CourseCreatePage
,
CourseEditPage
)
{
'use strict'
;
'use strict'
;
return
Backbone
.
Router
.
extend
({
return
Backbone
.
Router
.
extend
({
...
@@ -47,6 +49,8 @@ define([
...
@@ -47,6 +49,8 @@ define([
// Custom routes, requiring RegExp or other complex placeholders, should be defined here
// Custom routes, requiring RegExp or other complex placeholders, should be defined here
this
.
route
(
new
RegExp
(
'^'
+
courseIdRegex
.
source
+
'(
\
/)?$'
),
'show'
);
this
.
route
(
new
RegExp
(
'^'
+
courseIdRegex
.
source
+
'(
\
/)?$'
),
'show'
);
this
.
route
(
new
RegExp
(
'^'
+
courseIdRegex
.
source
+
'/edit(
\
/)?$'
),
'edit'
);
},
},
/**
/**
...
@@ -105,6 +109,12 @@ define([
...
@@ -105,6 +109,12 @@ define([
var
page
=
new
CourseCreatePage
();
var
page
=
new
CourseCreatePage
();
this
.
currentView
=
page
;
this
.
currentView
=
page
;
this
.
$el
.
html
(
page
.
el
);
this
.
$el
.
html
(
page
.
el
);
},
edit
:
function
(
id
)
{
var
page
=
new
CourseEditPage
({
id
:
id
});
this
.
currentView
=
page
;
$
(
'#app'
).
html
(
page
.
el
);
}
}
});
});
}
}
...
...
ecommerce/static/js/views/course_create_edit_view.js
View file @
596685ce
...
@@ -49,6 +49,9 @@ define([
...
@@ -49,6 +49,9 @@ define([
// Render the complete view
// Render the complete view
this
.
$el
.
html
(
$html
);
this
.
$el
.
html
(
$html
);
// Activate the tooltips
this
.
$el
.
find
(
'[data-toggle="tooltip"]'
).
tooltip
();
return
this
;
return
this
;
}
}
...
...
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