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
9c3c72ad
Commit
9c3c72ad
authored
Nov 09, 2012
by
Tom Giannattasio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
discussion editor and preview added; string response glitch fixed
parent
daea87eb
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
104 additions
and
7 deletions
+104
-7
cms/static/coffee/src/views/unit.coffee
+4
-0
cms/static/img/new-post-icon.png
+0
-0
cms/static/img/show-hide-discussion-icon.png
+0
-0
cms/static/js/html-editor.js
+7
-4
cms/static/js/speed-editor.js
+2
-2
cms/static/sass/_unit.scss
+70
-1
cms/templates/unit.html
+21
-0
No files found.
cms/static/coffee/src/views/unit.coffee
View file @
9c3c72ad
...
...
@@ -98,6 +98,9 @@ class CMS.Views.UnitEdit extends Backbone.View
@
$editor
=
$
(
$
(
'#html-editor'
).
html
())
$preview
=
$
(
'<div class="html-preview">'
)
initHTMLEditor
(
@
$editor
,
$preview
)
when
'discussion'
@
$editor
=
$
(
$
(
'#discussion-editor'
).
html
())
$preview
=
$
(
$
(
'#discussion-preview'
).
html
())
@
$editor
.
find
(
'.save-button, .cancel-button'
).
bind
(
'click'
,
=>
@
$componentItem
.
removeClass
(
'editing'
)
...
...
@@ -108,6 +111,7 @@ class CMS.Views.UnitEdit extends Backbone.View
@
$componentItem
.
append
(
@
$editor
)
@
$componentItem
.
append
(
$preview
)
@
$componentItem
.
append
(
$componentActions
)
@
$componentItem
.
hide
()
@
$newComponentItem
.
before
(
@
$componentItem
)
...
...
cms/static/img/new-post-icon.png
0 → 100644
View file @
9c3c72ad
1.14 KB
cms/static/img/show-hide-discussion-icon.png
0 → 100644
View file @
9c3c72ad
1.57 KB
cms/static/js/html-editor.js
View file @
9c3c72ad
...
...
@@ -5,7 +5,6 @@ var htmlEditor;
function
initHTMLEditor
(
$editor
,
$prev
)
{
$htmlEditor
=
$editor
;
console
.
log
(
$editor
.
find
(
'.edit-box'
));
htmlEditor
=
CodeMirror
.
fromTextArea
(
$editor
.
find
(
'.edit-box'
)[
0
],
{
lineWrapping
:
true
,
mode
:
'xml'
,
...
...
@@ -15,9 +14,13 @@ function initHTMLEditor($editor, $prev) {
currentEditor
=
htmlEditor
;
$
(
htmlEditor
.
getWrapperElement
()).
css
(
'background'
,
'#fff'
);
$
(
htmlEditor
.
getWrapperElement
()).
bind
(
'click'
,
setFocus
);
$
(
htmlEditor
.
getWrapperElement
()).
css
({
'background'
:
'#fff'
});
$
(
htmlEditor
.
getWrapperElement
()).
bind
(
'click'
,
function
()
{
$
(
htmlEditor
).
focus
();
});
$
(
htmlEditor
).
focus
();
$htmlPreview
=
$prev
;
}
...
...
cms/static/js/speed-editor.js
View file @
9c3c72ad
...
...
@@ -155,7 +155,7 @@ function updateXML() {
xml
=
xml
.
replace
(
/
\{\{
video
\s(
.*
)\}\}
/g
,
'<video youtube="1.0:$1" />
\
n
\
n'
);
// replace string and numerical
xml
=
xml
.
replace
(
/
\=\s
*
(
.*
)
/g
,
function
(
match
,
p
)
{
xml
=
xml
.
replace
(
/
(?:\n
|^
)
\=\s
*
(
.*
)
/g
,
function
(
match
,
p
)
{
var
string
;
var
params
=
/
(
.*
)\+\-\s
*
(
.*
)
/
.
exec
(
p
);
if
(
parseFloat
(
p
))
{
...
...
@@ -251,7 +251,7 @@ function updatePreview() {
return
groupString
;
});
html
=
html
.
replace
(
/
\=\s
*
(
.*
)
/g
,
function
(
match
,
p
)
{
html
=
html
.
replace
(
/
(?:\n
|^
)
\=\s
*
(
.*
)
/g
,
function
(
match
,
p
)
{
var
value
=
p
.
replace
(
/
\+\-
.*/g
,
''
);
var
string
=
'<input type="text" name="" id="" value="'
+
value
+
'" size="20">
\
n'
;
return
string
;
...
...
cms/static/sass/_unit.scss
View file @
9c3c72ad
...
...
@@ -374,10 +374,79 @@
}
}
.html-preview
{
.html-preview
,
.discussion-preview
{
padding
:
20px
30px
;
}
.discussion-id-field
{
width
:
350px
;
}
.discussion-module
{
position
:
relative
;
margin
:
20px
0
;
padding
:
20px
;
height
:
40px
;
background
:
#f6f6f6
!
important
;
border-radius
:
3px
;
.discussion-show
{
position
:
relative
;
top
:
3px
;
font-size
:
14px
;
text-align
:
center
;
color
:
#3c3c3c
;
&
.shown
{
.show-hide-discussion-icon
{
background-position
:
0
0
;
}
}
.show-hide-discussion-icon
{
display
:
inline-block
;
position
:
relative
;
top
:
5px
;
margin-right
:
6px
;
width
:
21px
;
height
:
19px
;
background
:
url(../img/show-hide-discussion-icon.png)
no-repeat
;
background-position
:
-21px
0
;
}
}
.new-post-btn
{
display
:
inline-block
;
float
:
right
;
height
:
35px
;
padding
:
0
15px
;
border-radius
:
3px
;
border
:
1px
solid
#2d81ad
;
@include
linear-gradient
(
top
,
#6dccf1
,
#38a8e5
);
font-size
:
13px
;
font-weight
:
700
;
line-height
:
32px
;
color
:
#fff
;
text-shadow
:
0
1px
0
rgba
(
0
,
0
,
0
,
.3
);
box-shadow
:
0
1px
0
rgba
(
255
,
255
,
255
,
0
.4
)
inset
,
0
1px
1px
rgba
(
0
,
0
,
0
,
.15
);
&
:hover
{
border-color
:
#297095
;
@include
linear-gradient
(
top
,
#4fbbe4
,
#2090d0
);
}
}
.new-post-icon
{
display
:
block
;
float
:
left
;
width
:
16px
;
height
:
17px
;
margin
:
7px
7px
0
0
;
background
:
url(../img/new-post-icon.png)
no-repeat
;
}
}
.component-editor
{
@include
edit-box
;
display
:
none
;
...
...
cms/templates/unit.html
View file @
9c3c72ad
...
...
@@ -155,6 +155,27 @@
<
/div>
</script>
<script
type=
"text/template"
id=
"discussion-editor"
>
<
div
class
=
"discussion-editor editor"
>
<
div
class
=
"row"
>
<
label
>
Category
Name
:
<
/label
>
<
input
type
=
"text"
value
=
"Discussion Topic"
class
=
"discussion-id-field"
>
<
/div>
<
div
class
=
"row"
>
<
a
href
=
"#"
class
=
"save-button"
>
Save
<
/a><a href="#" class="cancel-button">Cancel</
a
>
<
/div
>
<
/div
>
</script>
<script
type=
"text/template"
id=
"discussion-preview"
>
<
div
class
=
"discussion-preview"
>
<
div
class
=
"discussion-module"
data
-
discussion
-
id
=
""
>
<
a
class
=
"discussion-show control-button"
href
=
"#"
data
-
discussion
-
id
=
""
><
span
class
=
"show-hide-discussion-icon"
><
/span><span class="button-text">Show Discussion</
span
><
/a
>
<
a
href
=
"#"
class
=
"new-post-btn"
><
span
class
=
"new-post-icon"
><
/span>New Post</
a
>
<
/div
>
<
/div
>
</script>
<script
type=
"text/template"
id=
"video-editor"
>
<
div
class
=
"video-editor editor"
>
<
div
class
=
"row"
>
...
...
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