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
437c806f
Commit
437c806f
authored
Feb 11, 2013
by
cahrens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable/disable new entry button.
parent
67a557d5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
cms/static/js/views/settings/advanced_view.js
+15
-0
No files found.
cms/static/js/views/settings/advanced_view.js
View file @
437c806f
...
@@ -105,6 +105,16 @@ CMS.Views.Settings.Advanced = CMS.Views.ValidatingView.extend({
...
@@ -105,6 +105,16 @@ CMS.Views.Settings.Advanced = CMS.Views.ValidatingView.extend({
this
.
buttonsEnabled
=
false
;
this
.
buttonsEnabled
=
false
;
},
},
toggleNewButton
:
function
(
enable
)
{
var
newButton
=
this
.
$el
.
find
(
".new-button"
);
if
(
enable
)
{
newButton
.
removeClass
(
'disabled'
);
}
else
{
newButton
.
addClass
(
'disabled'
);
}
},
deleteEntry
:
function
(
event
)
{
deleteEntry
:
function
(
event
)
{
event
.
preventDefault
();
event
.
preventDefault
();
// find out which entry
// find out which entry
...
@@ -154,6 +164,7 @@ CMS.Views.Settings.Advanced = CMS.Views.ValidatingView.extend({
...
@@ -154,6 +164,7 @@ CMS.Views.Settings.Advanced = CMS.Views.ValidatingView.extend({
var
policyValueDivs
=
this
.
$el
.
find
(
'#'
+
this
.
new_key
).
closest
(
'li'
).
find
(
'.json'
);
var
policyValueDivs
=
this
.
$el
.
find
(
'#'
+
this
.
new_key
).
closest
(
'li'
).
find
(
'.json'
);
// only 1 but hey, let's take advantage of the context mechanism
// only 1 but hey, let's take advantage of the context mechanism
_
.
each
(
policyValueDivs
,
this
.
attachJSONEditor
,
this
);
_
.
each
(
policyValueDivs
,
this
.
attachJSONEditor
,
this
);
this
.
toggleNewButton
(
false
);
this
.
showMessage
(
this
.
unsaved_changes
);
this
.
showMessage
(
this
.
unsaved_changes
);
},
},
updateKey
:
function
(
event
)
{
updateKey
:
function
(
event
)
{
...
@@ -205,6 +216,10 @@ CMS.Views.Settings.Advanced = CMS.Views.ValidatingView.extend({
...
@@ -205,6 +216,10 @@ CMS.Views.Settings.Advanced = CMS.Views.ValidatingView.extend({
this
.
model
.
deleteKeys
.
push
(
oldKey
);
this
.
model
.
deleteKeys
.
push
(
oldKey
);
this
.
model
.
unset
(
oldKey
)
;
this
.
model
.
unset
(
oldKey
)
;
}
}
else
{
// id for the new entry will now be the key value. Enable new entry button.
this
.
toggleNewButton
(
true
);
}
// check for newkey being the name of one which was previously deleted in this session
// check for newkey being the name of one which was previously deleted in this session
var
wasDeleting
=
this
.
model
.
deleteKeys
.
indexOf
(
newKey
);
var
wasDeleting
=
this
.
model
.
deleteKeys
.
indexOf
(
newKey
);
...
...
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