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
OpenEdx
edx-platform
Commits
f5e95e49
Commit
f5e95e49
authored
Sep 27, 2017
by
Adam Palay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
render barebone nudge
parent
fd67c387
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
3 deletions
+15
-3
cms/djangoapps/contentstore/views/component.py
+1
-1
cms/static/js/views/components/add_xblock.js
+14
-1
cms/templates/js/add-xblock-component-nudge.underscore
+0
-1
No files found.
cms/djangoapps/contentstore/views/component.py
View file @
f5e95e49
...
...
@@ -44,7 +44,7 @@ ADVANCED_PROBLEM_TYPES = settings.ADVANCED_PROBLEM_TYPES
CONTAINER_TEMPLATES
=
[
"basic-modal"
,
"modal-button"
,
"edit-xblock-modal"
,
"editor-mode-button"
,
"upload-dialog"
,
"add-xblock-component"
,
"add-xblock-component-button"
,
"add-xblock-component-menu"
,
"add-xblock-component"
,
"add-xblock-component-
nudge"
,
"add-xblock-component-
button"
,
"add-xblock-component-menu"
,
"add-xblock-component-support-legend"
,
"add-xblock-component-support-level"
,
"add-xblock-component-menu-problem"
,
"xblock-string-field-editor"
,
"xblock-access-editor"
,
"publish-xblock"
,
"publish-history"
,
"unit-outline"
,
"container-message"
,
"container-access"
,
"license-selector"
,
...
...
cms/static/js/views/components/add_xblock.js
View file @
f5e95e49
...
...
@@ -17,6 +17,7 @@ define(['jquery', 'underscore', 'gettext', 'js/views/baseview', 'common/js/compo
BaseView
.
prototype
.
initialize
.
call
(
this
,
options
);
that
=
this
;
this
.
template
=
this
.
loadTemplate
(
'add-xblock-component'
);
this
.
nudgeTemplate
=
this
.
loadTemplate
(
'add-xblock-component-nudge'
);
this
.
model
.
set
({
number_children
:
$
(
'.level-element'
).
length
});
// this.model.on('change:number_children', function(model){
// console.log('number of children changed!');
...
...
@@ -25,7 +26,11 @@ define(['jquery', 'underscore', 'gettext', 'js/views/baseview', 'common/js/compo
this
.
model
.
on
(
'change:number_children'
,
this
.
render
,
this
);
},
render
:
function
()
{
renderNudge
:
function
()
{
this
.
$el
.
html
(
this
.
nudgeTemplate
());
},
renderNormal
:
function
()
{
var
that
=
this
;
this
.
$el
.
html
(
this
.
template
({
numberChildren
:
that
.
model
.
get
(
'number_children'
)}));
this
.
collection
.
each
(
...
...
@@ -41,6 +46,14 @@ define(['jquery', 'underscore', 'gettext', 'js/views/baseview', 'common/js/compo
);
},
render
:
function
()
{
if
(
this
.
model
.
get
(
'number_children'
)
>
3
)
{
this
.
renderNudge
();
}
else
{
this
.
renderNormal
();
}
},
showComponentTemplates
:
function
(
event
)
{
var
type
;
event
.
preventDefault
();
...
...
cms/templates/js/add-xblock-component-nudge.underscore
View file @
f5e95e49
<div class="new-component">
<h5>This is the nudge</h5>
<p>There are <%= numberChildren %> components in this vertical</p>
<ul class="new-component-type">
</ul>
</div>
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