Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
AudioXBlock
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
AudioXBlock
Commits
e27df938
Commit
e27df938
authored
Apr 13, 2015
by
TJ Keemon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added studio view to edit audio source
parent
1fbf19cc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
0 deletions
+53
-0
audio/audio.py
+22
-0
audio/static/html/audio_edit.html
+15
-0
audio/static/js/src/audio_edit.js
+16
-0
No files found.
audio/audio.py
View file @
e27df938
...
@@ -35,6 +35,28 @@ class AudioXBlock(XBlock):
...
@@ -35,6 +35,28 @@ class AudioXBlock(XBlock):
frag
.
add_css
(
self
.
resource_string
(
"static/css/audio.css"
))
frag
.
add_css
(
self
.
resource_string
(
"static/css/audio.css"
))
return
frag
return
frag
def
studio_view
(
self
,
context
):
"""
The view for editing the AudioXBlock parameters inside Studio.
"""
html
=
self
.
resource_string
(
"static/html/audio_edit.html"
)
frag
=
Fragment
(
html
.
format
(
src
=
self
.
src
))
js
=
self
.
resource_string
(
"static/js/src/audio_edit.js"
)
frag
.
add_javascript
(
js
)
frag
.
initialize_js
(
'AudioEditBlock'
)
return
frag
@XBlock.json_handler
def
studio_submit
(
self
,
data
,
suffix
=
''
):
"""
Called when submitting the form in Studio.
"""
self
.
src
=
data
.
get
(
'src'
)
return
{
'result'
:
'success'
}
# TO-DO: change this to create the scenarios you'd like to see in the
# TO-DO: change this to create the scenarios you'd like to see in the
# workbench while developing your XBlock.
# workbench while developing your XBlock.
@staticmethod
@staticmethod
...
...
audio/static/html/audio_edit.html
0 → 100644
View file @
e27df938
<div
class=
"wrapper-comp-settings is-active editor-with-buttons"
id=
"settings-tab"
>
<ul
class=
"list-input settings-list"
>
<li
class=
"field comp-setting-entry is-set"
>
<div
class=
"wrapper-comp-setting"
>
<label
class=
"label setting-label"
for=
"audio_src"
>
Audio Source Location
</label>
<input
class=
"input setting-input"
name=
"audio_src"
id=
"audio_src"
value=
"{src}"
type=
"text"
/>
</div>
</li>
</ul>
<div
class=
"row module-actions"
>
<a
href=
"#"
class=
"save-button action-primary action"
>
Save
</a>
<a
href=
"#"
class=
"cancel-button action-secondary action"
>
Cancel
</a>
</div>
</div>
\ No newline at end of file
audio/static/js/src/audio_edit.js
0 → 100644
View file @
e27df938
function
AudioEditBlock
(
runtime
,
element
)
{
$
(
element
).
find
(
'.save-button'
).
bind
(
'click'
,
function
()
{
var
handlerUrl
=
runtime
.
handlerUrl
(
element
,
'studio_submit'
);
var
data
=
{
src
:
$
(
element
).
find
(
'input[name=audio_src]'
).
val
()
};
$
.
post
(
handlerUrl
,
JSON
.
stringify
(
data
)).
done
(
function
(
response
)
{
window
.
location
.
reload
(
false
);
});
});
$
(
element
).
find
(
'.cancel-button'
).
bind
(
'click'
,
function
()
{
runtime
.
notify
(
'cancel'
,
{});
});
}
\ No newline at end of file
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