From a0be09f79fb2a8f15c37cab3e0136dbf05508b9d Mon Sep 17 00:00:00 2001 From: = Date: Tue, 13 Oct 2015 16:21:16 -0700 Subject: [PATCH] initial commit --- .gitignore | 4 + .travis.yml | 8 + Gruntfile.js | 194 +++++++++++++++++++++++ README.markdown | 33 ++++ package.json | 38 +++++ setup.py | 47 ++++++ xblockfreetext/__init__.py | 1 + xblockfreetext/private/edit.html | 38 +++++ xblockfreetext/private/edit.js | 37 +++++ xblockfreetext/private/edit.less | 3 + xblockfreetext/private/view.html | 4 + xblockfreetext/private/view.js | 11 ++ xblockfreetext/private/view.less | 3 + xblockfreetext/public/edit.html | 1 + xblockfreetext/public/edit.js | 37 +++++ xblockfreetext/public/edit.js.min.js | 2 + xblockfreetext/public/edit.js.min.js.map | 1 + xblockfreetext/public/edit.less | 3 + xblockfreetext/public/edit.less.min.css | 0 xblockfreetext/public/view.html | 1 + xblockfreetext/public/view.js | 11 ++ xblockfreetext/public/view.js.min.js | 2 + xblockfreetext/public/view.js.min.js.map | 1 + xblockfreetext/public/view.less | 3 + xblockfreetext/public/view.less.min.css | 0 xblockfreetext/xblockfreetext.py | 131 +++++++++++++++ 26 files changed, 614 insertions(+) create mode 100644 .gitignore create mode 100644 .travis.yml create mode 100644 Gruntfile.js create mode 100644 README.markdown create mode 100644 package.json create mode 100644 setup.py create mode 100644 xblockfreetext/__init__.py create mode 100644 xblockfreetext/private/edit.html create mode 100644 xblockfreetext/private/edit.js create mode 100644 xblockfreetext/private/edit.less create mode 100644 xblockfreetext/private/view.html create mode 100644 xblockfreetext/private/view.js create mode 100644 xblockfreetext/private/view.less create mode 100644 xblockfreetext/public/edit.html create mode 100644 xblockfreetext/public/edit.js create mode 100644 xblockfreetext/public/edit.js.min.js create mode 100644 xblockfreetext/public/edit.js.min.js.map create mode 100644 xblockfreetext/public/edit.less create mode 100644 xblockfreetext/public/edit.less.min.css create mode 100644 xblockfreetext/public/view.html create mode 100644 xblockfreetext/public/view.js create mode 100644 xblockfreetext/public/view.js.min.js create mode 100644 xblockfreetext/public/view.js.min.js.map create mode 100644 xblockfreetext/public/view.less create mode 100644 xblockfreetext/public/view.less.min.css create mode 100644 xblockfreetext/xblockfreetext.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..46bedff2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.egg-info/ +node_modules/ +*.pyc +*.sw[op] diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..2f170d3d --- /dev/null +++ b/.travis.yml @@ -0,0 +1,8 @@ +language: node_js +node_js: + - "0.11" + - "0.10" +before_install: + - npm install -g grunt-cli +install: + - npm install diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 00000000..187ebb9d --- /dev/null +++ b/Gruntfile.js @@ -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', + ]); +}; diff --git a/README.markdown b/README.markdown new file mode 100644 index 00000000..4f133fd2 --- /dev/null +++ b/README.markdown @@ -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 `
` 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 `
  • ` entries to `