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
c907cf75
Commit
c907cf75
authored
Feb 07, 2013
by
cahrens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ACE Editors.
parent
1e68834e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
10 deletions
+12
-10
cms/static/client_templates/advanced_entry.html
+1
-1
cms/static/js/views/settings/advanced_view.js
+11
-9
No files found.
cms/static/client_templates/advanced_entry.html
View file @
c907cf75
...
...
@@ -10,7 +10,7 @@
<div
class=
"value"
>
<label
for=
"course-advanced-policy-value"
>
Policy Value:
</label>
<div
class=
"field"
>
<
textarea
class=
"ace text"
id=
"course-advanced-policy-value"
><
%=
value
%
></textarea
>
<
div
class=
"ace text"
id=
"course-advanced-policy-value"
><
%=
value
%
></div
>
</div>
</div>
</div>
<a
href=
"#"
class=
"delete-button standard remove-item advanced-policy-data"
>
...
...
cms/static/js/views/settings/advanced_view.js
View file @
c907cf75
...
...
@@ -42,16 +42,18 @@ CMS.Views.Settings.Advanced = CMS.Views.ValidatingView.extend({
var
self
=
this
;
_
.
each
(
_
.
sortBy
(
_
.
keys
(
this
.
model
.
attributes
),
_
.
identity
),
function
(
key
)
{
// TODO: working here
var
newEl
=
self
.
template
({
key
:
key
,
value
:
self
.
model
.
get
(
key
)});
listEle$
.
append
(
newEl
);
listEle$
.
append
(
self
.
template
({
key
:
key
,
value
:
JSON
.
stringify
(
self
.
model
.
get
(
key
))}));
self
.
fieldToSelectorMap
[
key
]
=
key
;
});
// var editor = ace.edit('course-advanced-policy-1-value');
// editor.setTheme("ace/theme/chrome");
// editor.getSession().setMode("ace/mode/json");
// Swap in ACE Editor for all the value (JSON) fields.
var
policyValueDivs
=
listEle$
.
find
(
'.ace'
);
_
.
each
(
policyValueDivs
,
function
(
div
)
{
var
editor
=
ace
.
edit
(
div
);
editor
.
setTheme
(
"ace/theme/chrome"
);
editor
.
getSession
().
setMode
(
"ace/mode/json"
);
editor
.
setHighlightActiveLine
(
false
);
});
return
this
;
},
...
...
@@ -106,7 +108,7 @@ CMS.Views.Settings.Advanced = CMS.Views.ValidatingView.extend({
var
newKey
=
$
(
event
.
currentTarget
).
val
();
console
.
log
(
'update '
,
oldKey
,
newKey
);
// TODO: REMOVE ME
if
(
oldKey
!==
newKey
)
{
//
may erase other errors but difficult to just remove these
//
TODO: is it OK to erase other validation messages?
this
.
clearValidationErrors
();
if
(
!
this
.
validateKey
(
oldKey
,
newKey
))
return
;
...
...
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