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
b16e17a2
Commit
b16e17a2
authored
May 17, 2013
by
cahrens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some i18n work and other minor cleanup.
parent
1c9ebbc9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
37 additions
and
56 deletions
+37
-56
cms/static/client_templates/metadata_editor.html
+1
-2
cms/static/coffee/src/views/module_edit.coffee
+7
-5
cms/static/js/models/metadata_editor.js
+0
-8
cms/static/js/views/metadata_editor_view.js
+12
-28
cms/templates/base.html
+0
-1
cms/templates/component.html
+9
-7
cms/templates/widgets/html-edit.html
+4
-2
cms/templates/widgets/metadata-edit.html
+3
-1
cms/templates/widgets/problem-edit.html
+1
-2
No files found.
cms/static/client_templates/metadata_editor.html
View file @
b16e17a2
...
...
@@ -3,4 +3,4 @@
<li
class=
"field comp-setting-entry metadata_entry"
id=
"settings-listing"
>
</li>
<
%
})
%
>
</ul>
\ No newline at end of file
</ul>
cms/static/coffee/src/views/module_edit.coffee
View file @
b16e17a2
...
...
@@ -26,7 +26,7 @@ class CMS.Views.ModuleEdit extends Backbone.View
metadataEditor
=
@
$el
.
find
(
'.metadata_edit'
)
@
metadataEditor
=
new
CMS
.
Views
.
Metadata
.
Editor
({
el
:
metadataEditor
,
model
:
new
CMS
.
Models
.
MetadataEditor
(
metadataEditor
.
data
(
'metadata'
))
model
:
new
Backbone
.
Model
(
metadataEditor
.
data
(
'metadata'
))
});
#Manually runs polyfill for input number types to correct for Firefox non-support
...
...
@@ -39,7 +39,10 @@ class CMS.Views.ModuleEdit extends Backbone.View
@
selectMode
(
@
editorMode
)
else
@
hideDataEditor
()
@
$el
.
find
(
'.component-name'
).
html
(
'<em>Editing:</em> '
+
@
metadataEditor
.
getDisplayName
())
title
=
interpolate
(
gettext
(
'<em>Editing:</em> %s'
),
[
@
metadataEditor
.
getDisplayName
()])
@
$el
.
find
(
'.component-name'
).
html
(
title
)
changedMetadata
:
->
return
@
metadataEditor
.
getModifiedMetadataValues
()
...
...
@@ -77,7 +80,7 @@ class CMS.Views.ModuleEdit extends Backbone.View
@
render
()
@
$el
.
removeClass
(
'editing'
)
).
fail
(
->
showToastMessage
(
"There was an error saving your changes. Please try again."
,
null
,
3
)
showToastMessage
(
gettext
(
"There was an error saving your changes. Please try again."
)
,
null
,
3
)
)
clickCancelButton
:
(
event
)
->
...
...
@@ -131,4 +134,4 @@ class CMS.Views.ModuleEdit extends Backbone.View
editorModeButtonParent
.
addClass
(
'inactive-mode'
)
editorModeButtonParent
.
removeClass
(
'active-mode'
)
@
$el
.
find
(
'.wrapper-comp-settings'
).
addClass
(
'is-active'
)
@
$el
.
find
(
'#settings-mode'
).
find
(
"a"
).
addClass
(
'is-set'
)
\ No newline at end of file
@
$el
.
find
(
'#settings-mode'
).
find
(
"a"
).
addClass
(
'is-set'
)
cms/static/js/models/metadata_editor.js
deleted
100644 → 0
View file @
1c9ebbc9
CMS
.
Models
.
MetadataEditor
=
Backbone
.
Model
.
extend
({
// This model class is not suited for restful operations and is considered just a server side initialized container
url
:
''
,
defaults
:
{
}
});
cms/static/js/views/metadata_editor_view.js
View file @
b16e17a2
...
...
@@ -22,22 +22,24 @@ CMS.Views.Metadata.Editor = Backbone.View.extend({
return
val
.
display_name
});
self
.
view
s
=
[];
self
.
model
s
=
[];
_
.
each
(
sortedObject
,
function
(
item
)
{
var
model
=
new
CMS
.
Models
.
Metadata
(
item
);
self
.
models
.
push
(
model
);
var
data
=
{
el
:
self
.
$el
.
find
(
'.metadata_entry'
)[
counter
++
],
model
:
new
CMS
.
Models
.
Metadata
(
item
)
model
:
model
};
if
(
item
.
type
===
'Select'
)
{
self
.
views
.
push
(
new
CMS
.
Views
.
Metadata
.
Option
(
data
)
);
new
CMS
.
Views
.
Metadata
.
Option
(
data
);
}
else
if
(
item
.
type
===
'Integer'
||
item
.
type
===
'Float'
)
{
self
.
views
.
push
(
new
CMS
.
Views
.
Metadata
.
Number
(
data
)
);
new
CMS
.
Views
.
Metadata
.
Number
(
data
);
}
else
{
self
.
views
.
push
(
new
CMS
.
Views
.
Metadata
.
String
(
data
)
);
new
CMS
.
Views
.
Metadata
.
String
(
data
);
}
});
}
...
...
@@ -46,10 +48,10 @@ CMS.Views.Metadata.Editor = Backbone.View.extend({
getModifiedMetadataValues
:
function
()
{
var
modified_values
=
{};
_
.
each
(
this
.
view
s
,
function
(
item
)
{
if
(
item
.
m
odified
())
{
modified_values
[
item
.
getFieldName
()]
=
item
.
getValue
();
_
.
each
(
this
.
model
s
,
function
(
model
)
{
if
(
model
.
isM
odified
())
{
modified_values
[
model
.
getFieldName
()]
=
model
.
getValue
();
}
}
);
...
...
@@ -118,19 +120,6 @@ CMS.Views.Metadata.AbstractEditor = Backbone.View.extend({
this
.
$el
.
find
(
'.setting-clear'
).
addClass
(
'inactive'
);
this
.
$el
.
find
(
'.setting-clear'
).
removeClass
(
'active'
);
}
},
modified
:
function
()
{
return
this
.
model
.
isModified
();
},
getValue
:
function
()
{
return
this
.
model
.
getValue
();
},
getFieldName
:
function
()
{
return
this
.
model
.
getFieldName
();
}
});
...
...
@@ -147,9 +136,7 @@ CMS.Views.Metadata.String = CMS.Views.Metadata.AbstractEditor.extend({
},
getValueFromEditor
:
function
()
{
var
val
=
this
.
$el
.
find
(
'#'
+
this
.
uniqueId
).
val
();
// TODO: not sure this is necessary. Trying to support empty value ("").
return
val
?
val
:
""
;
return
this
.
$el
.
find
(
'#'
+
this
.
uniqueId
).
val
();
},
setValueInEditor
:
function
(
value
)
{
...
...
@@ -244,6 +231,3 @@ CMS.Views.Metadata.Option = CMS.Views.Metadata.AbstractEditor.extend({
}).
prop
(
'selected'
,
true
);
}
});
cms/templates/base.html
View file @
b16e17a2
...
...
@@ -55,7 +55,6 @@
<!--TODO: not the right place-->
<script
type=
"text/javascript"
src=
"${static.url('js/models/metadata_model.js')}"
></script>
<script
type=
"text/javascript"
src=
"${static.url('js/models/metadata_editor.js')}"
></script>
<script
type=
"text/javascript"
src=
"${static.url('js/views/metadata_editor_view.js')}"
></script>
<script
type=
"text/javascript"
src=
"${static.url('js/template_loader.js')}"
></script>
<script
type=
"text/javascript"
>
...
...
cms/templates/component.html
View file @
b16e17a2
<
%!
from
django
.
utils
.
translation
import
ugettext
as
_
%
>
<div
class=
"wrapper wrapper-component-editor"
>
<div
class=
"component-editor"
>
<div
class=
"component-edit-header"
>
<span
class=
"component-name"
></span>
<ul
class=
"nav-edit-modes"
>
<li
id=
"editor-mode"
class=
"mode active-mode"
aria-controls=
"editor-tab"
role=
"tab"
>
<a
href=
"#"
>
Editor
</a>
<a
href=
"#"
>
${_("Editor")}
</a>
</li>
<li
id=
"settings-mode"
class=
"mode active-mode"
aria-controls=
"settings-tab"
role=
"tab"
>
<a
href=
"#"
>
Settings
</a>
<a
href=
"#"
>
${_("Settings")}
</a>
</li>
</ul>
</div>
<!-- Editor Header -->
...
...
@@ -18,16 +20,16 @@
</div>
</div>
<div
class=
"row module-actions"
>
<a
href=
"#"
class=
"save-button"
>
Save
</a>
<a
href=
"#"
class=
"cancel-button"
>
Cancel
</a>
<a
href=
"#"
class=
"save-button"
>
${_("Save")}
</a>
<a
href=
"#"
class=
"cancel-button"
>
${_("Cancel")}
</a>
</div>
<!-- Module Actions-->
</div>
</div>
<div
class=
"component-actions"
>
<a
href=
"#"
class=
"edit-button standard"
><span
class=
"edit-icon"
></span>
Edit
</a>
<a
href=
"#"
class=
"delete-button standard"
><span
class=
"delete-icon"
></span>
Delete
</a>
<a
href=
"#"
class=
"edit-button standard"
><span
class=
"edit-icon"
></span>
${_("Edit")}
</a>
<a
href=
"#"
class=
"delete-button standard"
><span
class=
"delete-icon"
></span>
${_("Delete")}
</a>
</div>
<a
data-tooltip=
"Drag to reorder"
href=
"#"
class=
"drag-handle"
></a>
<a
data-tooltip=
'${_("Drag to reorder")}'
href=
"#"
class=
"drag-handle"
></a>
${preview}
cms/templates/widgets/html-edit.html
View file @
b16e17a2
<
%!
from
django
.
utils
.
translation
import
ugettext
as
_
%
>
<div
class=
"wrapper-comp-editor"
id=
"editor-tab"
>
<section
class=
"html-editor editor"
>
<ul
class=
"editor-tabs"
>
<li><a
href=
"#"
class=
"visual-tab tab current"
data-tab=
"visual"
>
Visual
</a></li>
<li><a
href=
"#"
class=
"html-tab tab"
data-tab=
"advanced"
>
HTML
</a></li>
<li><a
href=
"#"
class=
"visual-tab tab current"
data-tab=
"visual"
>
${_("Visual")}
</a></li>
<li><a
href=
"#"
class=
"html-tab tab"
data-tab=
"advanced"
>
${_("HTML")}
</a></li>
</ul>
<div
class=
"row"
>
...
...
cms/templates/widgets/metadata-edit.html
View file @
b16e17a2
<
%!
from
django
.
utils
.
translation
import
ugettext
as
_
%
>
<
%
import
hashlib
import
copy
...
...
@@ -15,7 +17,7 @@
% if showHighLevelSource:
<div
class=
"launch-latex-compiler"
>
<a
href=
"#hls-modal-${hlskey}"
id=
"hls-trig-${hlskey}"
>
Launch Latex Source Compiler
</a>
<a
href=
"#hls-modal-${hlskey}"
id=
"hls-trig-${hlskey}"
>
${_("Launch Latex Source Compiler")}
</a>
</div>
<
%
include
file=
"source-edit.html"
/>
% endif
...
...
cms/templates/widgets/problem-edit.html
View file @
b16e17a2
...
...
@@ -106,4 +106,4 @@
<
/article
>
</script>
</div>
<
%
include
file=
"metadata-edit.html"
/>
\ No newline at end of file
<
%
include
file=
"metadata-edit.html"
/>
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