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
5ba3acb3
Commit
5ba3acb3
authored
May 28, 2014
by
Waheed Ahmed
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3847 from edx/waheed/cheatsheet-code-refactor
Cheatsheet visibility code refactored.
parents
b2656bb2
6ad6f77c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
29 deletions
+35
-29
cms/static/js/views/modals/edit_xblock.js
+12
-7
cms/static/sass/_shame.scss
+9
-0
common/lib/xmodule/xmodule/js/src/combinedopenended/edit.coffee
+7
-11
common/lib/xmodule/xmodule/js/src/problem/edit.coffee
+7
-11
No files found.
cms/static/js/views/modals/edit_xblock.js
View file @
5ba3acb3
...
...
@@ -132,17 +132,11 @@ define(["jquery", "underscore", "gettext", "js/views/modals/base_modal",
},
changeMode
:
function
(
event
)
{
this
.
removeCheatsheetVisibility
();
var
parent
=
$
(
event
.
target
.
parentElement
),
mode
=
parent
.
data
(
'mode'
);
event
.
preventDefault
();
this
.
selectMode
(
mode
);
var
$cheatsheet
=
$
(
'.simple-editor-cheatsheet'
);
if
(
$cheatsheet
.
length
==
0
){
$cheatsheet
=
$
(
'.simple-editor-open-ended-cheatsheet'
);
}
$
(
".CodeMirror"
).
css
({
"overflow"
:
"none"
});
$
(
".modal-content"
).
removeAttr
(
"style"
);
$cheatsheet
.
removeClass
(
'shown'
);
},
selectMode
:
function
(
mode
)
{
...
...
@@ -204,6 +198,17 @@ define(["jquery", "underscore", "gettext", "js/views/modals/base_modal",
mode
:
mode
,
displayName
:
displayName
}));
},
removeCheatsheetVisibility
:
function
()
{
var
cheatsheet
=
$
(
'article.simple-editor-open-ended-cheatsheet'
);
if
(
cheatsheet
.
length
===
0
)
{
cheatsheet
=
$
(
'article.simple-editor-cheatsheet'
);
}
if
(
cheatsheet
.
hasClass
(
'shown'
))
{
cheatsheet
.
removeClass
(
'shown'
);
$
(
'.modal-content'
).
removeClass
(
'cheatsheet-is-shown'
);
}
}
});
...
...
cms/static/sass/_shame.scss
View file @
5ba3acb3
...
...
@@ -74,3 +74,11 @@ body b {
* use the @include placeholder Bourbon mixin (http://bourbon.io/docs/#placeholder) for any placeholder styling
*/
.modal-content.cheatsheet-is-shown
{
overflow
:
visible
!
important
;
.CodeMirror
{
overflow
:
visible
!
important
;
}
}
\ No newline at end of file
common/lib/xmodule/xmodule/js/src/combinedopenended/edit.coffee
View file @
5ba3acb3
...
...
@@ -87,8 +87,9 @@ Write a persuasive essay to a newspaper reflecting your views on censorship in l
###
onShowXMLButton
:
(
e
)
=>
e
.
preventDefault
();
if
@
cheatsheet
!=
undefined
@
addRemoveCheatsheetCSS
()
if
@
cheatsheet
&&
@
cheatsheet
.
hasClass
(
'shown'
)
@
cheatsheet
.
toggleClass
(
'shown'
)
@
toggleCheatsheetVisibility
()
if
@
confirmConversionToXml
()
@
createXMLEditor
(
OpenEndedMarkdownEditingDescriptor
.
markdownToXml
(
@
markdown_editor
.
getValue
()))
# Need to refresh to get line numbers to display properly (and put cursor position to 0)
...
...
@@ -133,21 +134,16 @@ Write a persuasive essay to a newspaper reflecting your views on censorship in l
@
cheatsheet
=
$
(
$
(
'#simple-editor-open-ended-cheatsheet'
).
html
())
$
(
@
markdown_editor
.
getWrapperElement
()).
append
(
@
cheatsheet
)
@
addRemoveCheatsheetCSS
()
@
toggleCheatsheetVisibility
()
setTimeout
(
=>
@
cheatsheet
.
toggleClass
(
'shown'
)),
10
###
Function to
add/remove CSS for cheatsheet
.
Function to
toggle cheatsheet visibility
.
###
addRemoveCheatsheetCSS
:
()
=>
if
!
@
cheatsheet
.
hasClass
(
"shown"
)
$
(
".CodeMirror"
).
css
({
"overflow"
:
"visible"
})
$
(
".modal-content"
).
css
({
"overflow-y"
:
"visible"
,
"overflow-x"
:
"visible"
})
else
$
(
".CodeMirror"
).
css
({
"overflow"
:
""
})
$
(
".modal-content"
).
removeAttr
(
"style"
)
toggleCheatsheetVisibility
:
()
=>
$
(
'.modal-content'
).
toggleClass
(
'cheatsheet-is-shown'
)
###
...
...
common/lib/xmodule/xmodule/js/src/problem/edit.coffee
View file @
5ba3acb3
...
...
@@ -48,8 +48,9 @@ class @MarkdownEditingDescriptor extends XModule.Descriptor
###
onShowXMLButton
:
(
e
)
=>
e
.
preventDefault
();
if
@
cheatsheet
!=
undefined
@
addRemoveCheatsheetCSS
()
if
@
cheatsheet
&&
@
cheatsheet
.
hasClass
(
'shown'
)
@
cheatsheet
.
toggleClass
(
'shown'
)
@
toggleCheatsheetVisibility
()
if
@
confirmConversionToXml
()
@
createXMLEditor
(
MarkdownEditingDescriptor
.
markdownToXml
(
@
markdown_editor
.
getValue
()))
# Need to refresh to get line numbers to display properly (and put cursor position to 0)
...
...
@@ -96,21 +97,16 @@ class @MarkdownEditingDescriptor extends XModule.Descriptor
@
cheatsheet
=
$
(
$
(
'#simple-editor-cheatsheet'
).
html
())
$
(
@
markdown_editor
.
getWrapperElement
()).
append
(
@
cheatsheet
)
@
addRemoveCheatsheetCSS
()
@
toggleCheatsheetVisibility
()
setTimeout
(
=>
@
cheatsheet
.
toggleClass
(
'shown'
)),
10
###
Function to
add/remove CSS for cheatsheet
.
Function to
toggle cheatsheet visibility
.
###
addRemoveCheatsheetCSS
:
()
=>
if
!
@
cheatsheet
.
hasClass
(
"shown"
)
$
(
".CodeMirror"
).
css
({
"overflow"
:
"visible"
})
$
(
".modal-content"
).
css
({
"overflow-y"
:
"visible"
,
"overflow-x"
:
"visible"
})
else
$
(
".CodeMirror"
).
css
({
"overflow"
:
"none"
})
$
(
".modal-content"
).
removeAttr
(
"style"
)
toggleCheatsheetVisibility
:
()
=>
$
(
'.modal-content'
).
toggleClass
(
'cheatsheet-is-shown'
)
###
Stores the current editor and hides the one that is not displayed.
...
...
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