Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
azimpradhan committed Oct 13, 2015
0 parents commit a0be09f
Show file tree
Hide file tree
Showing 26 changed files with 614 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.egg-info/
node_modules/
*.pyc
*.sw[op]
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
language: node_js
node_js:
- "0.11"
- "0.10"
before_install:
- npm install -g grunt-cli
install:
- npm install
194 changes: 194 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
module.exports = function (grunt) {
'use strict';

var jshintrc = '.jshintrc';
var gruntFile = 'Gruntfile.js';
var directoryPackage = './xblockfreetext';
var directoryPrivate = directoryPackage + '/private';
var directoryPublic = directoryPackage + '/public';
var directoryPrivateJsAll = directoryPrivate + '/**/*.js';
var directoryPrivateLessAll = directoryPrivate + '/**/*.less';
var directoryPrivateHtmlAll = directoryPrivate + '/**/*.html';
var directoryPublicCssAll = directoryPublic + '/**/*.css';

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
clean: [
'node_modules/',
'**/*.pyc',
],
concat: {
options: {
separator: ';\n',
},
jsView: {
src: [
directoryPrivate + '/view.js',
],
dest: directoryPublic + '/view.js',
},
jsEdit: {
src: [
directoryPrivate + '/edit.js',
],
dest: directoryPublic + '/edit.js',
},
cssView: {
src: [
directoryPrivate + '/view.less',
],
dest: directoryPublic + '/view.less',
},
cssEdit: {
src: [
directoryPrivate + '/edit.less',
],
dest: directoryPublic + '/edit.less',
},
},
copy: {
images: {
files: [
{
expand: true,
src: [
directoryPrivate + '/**/*.jpg',
directoryPrivate + '/**/*.png',
directoryPrivate + '/**/*.gif',
],
dest: directoryPublic + '/',
},
],
},
},
csslint: {
dist: {
src: [
directoryPublicCssAll,
],
},
},
cssmin: {
combine: {
files: [{
footer: '\n',
expand: true,
cwd: directoryPublic,
src: [
'*.css',
'!*.min.css',
],
dest: directoryPublic,
ext: '.min.css',
}],
},
},
htmlmin: {
all: {
options: {
removeComments: true,
removeCommentsFromCDATA: true,
collapseWhitespace: true,
collapseBooleanAttributes: true,
removeRedundantAttributes: true,
removeEmptyAttributes: true,
},
files: {
'xblockfreetext/public/edit.html': directoryPrivate + '/edit.html',
'xblockfreetext/public/view.html': directoryPrivate + '/view.html',
},
},
},
jshint: {
options: {
ignores: [
],
},
dist: [
gruntFile,
directoryPrivateJsAll,
],
},
less: {
view: {
options: {
sourceMap: true,
sourceMapFilename: 'xblockfreetext/public/view.less.min.css.map',
outputSourceFiles: true,
cleancss: true,
compress: true,
},
files: {
'xblockfreetext/public/view.less.min.css':
directoryPublic + '/view.less',
},
},
edit: {
options: {
sourceMap: true,
sourceMapFilename: 'xblockfreetext/public/edit.less.min.css.map',
outputSourceFiles: true,
cleancss: true,
compress: true,
},
files: {
'xblockfreetext/public/edit.less.min.css':
directoryPublic + '/edit.less',
},
},
},
uglify: {
options: {
footer: '\n',
sourceMap: true,
},
combine: {
files: [{
expand: true,
cwd: directoryPublic + '/',
src: [
'*.js',
'!*.min.js',
],
dest: directoryPublic + '/',
ext: '.js.min.js',
}],
},
},
watch: {
dist: {
files: [
jshintrc,
gruntFile,
directoryPrivateJsAll,
directoryPrivateLessAll,
directoryPrivateHtmlAll,
],
tasks: [
'default',
],
},
},
});

grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-csslint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-htmlmin');

grunt.registerTask('default', [
'jshint',
'concat',
'copy',
'less',
'csslint',
'uglify',
'htmlmin',
]);
};
33 changes: 33 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# FreeText XBlock
Enables instructors to create questions with free-text responses.

## TODO List:
- [ ] Write tests
- [ ] Update the `student_view`
- [ ] `./xblockfreetext/private/view.html`
- Add content to `<div class="xblockfreetext_block"></div>` element
- [ ] `./xblockfreetext/private/view.js`
- Add logic to `XblockFreetextView` function
- [ ] `./xblockfreetext/private/view.less`
- Add styles to `.xblockfreetext_block { }` block
- [ ] `./xblockfreetext/xblockfreetext.py`
- Add back-end logic to `student_view` method
- [ ] Update the `studio_view`
- [ ] `./xblockfreetext/private/edit.html`
- Add `<LI>` entries to `<ul class="list-input settings-list">` for each new field
- [ ] `./xblockfreetext/private/edit.js`
- Add entry for each field to `XblockFreetextEdit`
- [ ] `./xblockfreetext/private/edit.less`
- Add styles to `.xblockfreetext_edit { }` block (if needed)
- [ ] `./xblockfreetext/xblockfreetext.py`
- Add entry for each field to `studio_view_save`
- [ ] Update package metadata
- [ ] `./package.json`
- https://www.npmjs.org/doc/files/package.json.html
- [ ] `./setup.py`
- https://docs.python.org/2/distutils/setupscript.html#additional-meta-data
- [ ] Update `./Gruntfile.js`
- http://gruntjs.com/getting-started
- [ ] Update `./README.markdown`
- [ ] Write documentation
- [ ] Publish on PyPi
38 changes: 38 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "xblock-freetext",
"title": "FreeText XBlock",
"description": "Enables instructors to create questions with free-text responses.",
"version": "0.1.0",
"homepage": "https://github.com/Stanford-Online/xblock-freetext",
"author": {
"name": "Azim Pradhan",
"email": "[email protected]"
},
"repository": {
"type": "git",
"url": "https://github.com/Stanford-Online/xblock-freetext.git"
},
"bugs": {
"url": "https://github.com/Stanford-Online/xblock-freetext/issues"
},
"scripts": {
"test": "grunt --verbose"
},
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-jshint": "^0.10.0",
"grunt-contrib-concat": "^0.5.0",
"grunt-contrib-uglify": "^0.6.0",
"grunt-contrib-less": "^0.11.4",
"grunt-contrib-csslint": "^0.3.1",
"grunt-contrib-cssmin": "^0.10.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-contrib-copy": "^0.6.0",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-htmlmin": "^0.3.0"
},
"keywords": [
"openedx",
"xblock"
]
}
47 changes: 47 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import json
import setuptools


package_json_file = open('package.json', 'r')
package_json = json.load(package_json_file)

setuptools.setup(
name=package_json.get('name', 'xblock-test'),
version=package_json.get('version', '0.1.0'),
description=package_json.get('description'),
long_description=package_json.get('description'),
author=package_json.get('author', {}).get('name'),
author_email=package_json.get('author', {}).get('email'),
url=package_json.get('homepage'),
license='AGPL-3.0',
packages=[
'xblockfreetext',
],
install_requires=[
'XBlock',
],
entry_points={
'xblock.v1': [
'xblockfreetext = xblockfreetext:XblockFreetext',
],
},
package_dir={
'xblockfreetext': 'xblockfreetext',
},
package_data={
"xblockfreetext": [
'public/*',
],
},
classifiers=[
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
'Intended Audience :: Developers',
'Intended Audience :: Education',
'License :: OSI Approved :: GNU Affero General Public License v3',
'Operating System :: OS Independent',
'Programming Language :: JavaScript',
'Programming Language :: Python',
'Topic :: Education',
'Topic :: Internet :: WWW/HTTP',
],
)
1 change: 1 addition & 0 deletions xblockfreetext/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .xblockfreetext import XblockFreetext
38 changes: 38 additions & 0 deletions xblockfreetext/private/edit.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<div class="wrapper-comp-settings is-active editor-with-buttons xblockfreetext_edit" id="settings-tab">
<ul class="list-input settings-list">
<!-- TODO: Add an entry here for each field -->
<li class="field comp-setting-entry is-set">
<div class="wrapper-comp-setting">
<label
class="label setting-label"
for="xblock_xblockfreetext_name"
>
Name
</label>
<input
class="input setting-input"
id="xblock_xblockfreetext_name"
value="{self.name}"
type="text"
tabindex="1"
>
</div>
<span
class="tip setting-help"
>
This name appears in the horizontal navigation at the top
of the page.
</span>
</li>
</ul>
<div class="xblock-actions">
<ul>
<li class="action-item">
<a href="#" tabindex="2" class="button action-primary save-button">Save</a>
</li>
<li class="action-item">
<a href="" tabindex="3" class="button cancel-button">Cancel</a>
</li>
</ul>
</div>
</div>
Loading

0 comments on commit a0be09f

Please sign in to comment.