Commit e1d854be by Piotr Mitros

Initializing repo

parent 78a3f7cb
TemplateXBlock
DoneXBlock
==============
This is a simple template for an XBlock. It will play audio files as
an HTML5 audio element. If unavailable, it will fall back to an embed
element.
Lets a student mark they've finished an activity
Usage:
<template src="http://server.tld/static/song.mp3" />
FutureLearn uses this kind of thing to great effect. Students can
read text, watch videos, etc., and mark when their done. Honor
code grading, and convenient progress indication.
......@@ -2,16 +2,16 @@
#
# Step 1: Come up with a short name for your XBlock. For example, if
# your XBlock plays audio files, 'audio' is a good name.
short-name : audio
short-name : done
# Step 2: Create a repository on github for your XBlock. In the above
# case, I strongly recommend the short name, followed by 'XBlock,' in
# camelcase. Do not initialize this repo. We'll do it for you
github : git@github.com:pmitros/AudioXBlock.git
github : git@github.com:pmitros/DoneXBlock.git
# Step 3: Give a short description of this XBlock
description : Plays an audio file as an embed element
description : Lets a student mark they've finished an activity
# Step 4: Give a multiline description. Keep the 2 line indent, please.
overview : |
This XBlock plays an audio file as an HTML5 audio element. If
the audio element is not present, it will fall back to an
embed element.
# Once you're done, hit save, and watch the magic happen!
\ No newline at end of file
FutureLearn uses this kind of thing to great effect. Students can
read text, watch videos, etc., and mark when their done. Honor
code grading, and convenient progress indication.
# Once you're done, hit save, and watch the magic happen!
from .done import DoneXBlock
\ No newline at end of file
......@@ -7,7 +7,7 @@ from xblock.fields import Scope, Integer, String
from xblock.fragment import Fragment
class TemplateXBlock(XBlock):
class DoneXBlock(XBlock):
"""
This XBlock will play an MP3 file as an HTML5 audio element.
"""
......@@ -27,16 +27,16 @@ class TemplateXBlock(XBlock):
# TO-DO: change this view to display your data your own way.
def student_view(self, context=None):
"""
The primary view of the TemplateXBlock, shown to students
The primary view of the DoneXBlock, shown to students
when viewing courses.
"""
html = self.resource_string("static/html/template.html")
html = self.resource_string("static/html/done.html")
print self.src
print html.format
frag = Fragment(html.format(src = self.src))
frag.add_css(self.resource_string("static/css/template.css"))
frag.add_javascript(self.resource_string("static/js/src/template.js"))
frag.initialize_js('TemplateXBlock')
frag.add_css(self.resource_string("static/css/done.css"))
frag.add_javascript(self.resource_string("static/js/src/done.js"))
frag.initialize_js('DoneXBlock')
print self.xml_text_content()
return frag
......@@ -46,11 +46,11 @@ class TemplateXBlock(XBlock):
def workbench_scenarios():
"""A canned scenario for display in the workbench."""
return [
("TemplateXBlock",
("DoneXBlock",
"""<vertical_demo>
<template src="http://localhost/Ikea.mp3"> </template>
<template src="http://localhost/skull.mp3"> </template>
<template src="http://localhost/monkey.mp3"> </template>
<done src="http://localhost/Ikea.mp3"> </done>
<done src="http://localhost/skull.mp3"> </done>
<done src="http://localhost/monkey.mp3"> </done>
</vertical_demo>
"""),
]
/* CSS for TemplateXBlock */
/* CSS for DoneXBlock */
.template_block .count {
.done_block .count {
font-weight: bold;
}
.template_block p {
.done_block p {
cursor: pointer;
}
\ No newline at end of file
<div class="template_block">
<div class="done_block">
<audio controls preload>
<source src="{src}">
<embed height="50" width="100" src="{src}">
......
"""Setup for template XBlock."""
"""Setup for done XBlock."""
import os
from setuptools import setup
......@@ -15,19 +15,19 @@ def package_data(pkg, root):
setup(
name='template-xblock',
name='done-xblock',
version='0.1',
description='template XBlock', # TODO: write a better description.
description='done XBlock', # TODO: write a better description.
packages=[
'template',
'done',
],
install_requires=[
'XBlock',
],
entry_points={
'xblock.v1': [
'template = template:TemplateXBlock',
'done = done:DoneXBlock',
]
},
package_data=package_data("template", "static"),
package_data=package_data("done", "static"),
)
\ No newline at end of file
from .template import TemplateXBlock
\ No newline at end of file
......@@ -3,14 +3,14 @@ import yaml
import os
commands = '''
git mv ./template/template.py ./template/{shortname}.py
git mv ./template/static/html/template.html ./template/static/html/{shortname}.html
git mv ./template/static/css/template.css ./template/static/css/{shortname}.css
git mv ./template/static/js/src/template.js ./template/static/js/src/{shortname}.js
git mv template {shortname}
find . -type f | grep -v git | xargs sed -i 's/template/{shortname}/g'
find . -type f | grep -v git | xargs sed -i 's/Template/{Shortname}/g'
git mv ./done/done.py ./done/{shortname}.py
git mv ./done/static/html/done.html ./done/static/html/{shortname}.html
git mv ./done/static/css/done.css ./done/static/css/{shortname}.css
git mv ./done/static/js/src/done.js ./done/static/js/src/{shortname}.js
git mv done {shortname}
find . -type f | grep -v git | xargs sed -i 's/done/{shortname}/g'
find . -type f | grep -v git | xargs sed -i 's/Done/{Shortname}/g'
git remote rm origin
git remote add origin {github}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment