Initial commit
commit
c4d7a685a8
@ -0,0 +1,21 @@
|
|||||||
|
# EditorConfig helps developers define and maintain consistent
|
||||||
|
# coding styles between different editors and IDEs
|
||||||
|
# editorconfig.org
|
||||||
|
|
||||||
|
root = true
|
||||||
|
|
||||||
|
|
||||||
|
[*]
|
||||||
|
|
||||||
|
# Change these settings to your own preference
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
# We recommend you to keep these unchanged
|
||||||
|
end_of_line = lf
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
@ -0,0 +1 @@
|
|||||||
|
* text=auto
|
@ -0,0 +1,5 @@
|
|||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
.tmp
|
||||||
|
.sass-cache
|
||||||
|
app/components
|
@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"node": true,
|
||||||
|
"browser": true,
|
||||||
|
"es5": true,
|
||||||
|
"esnext": true,
|
||||||
|
"bitwise": true,
|
||||||
|
"camelcase": true,
|
||||||
|
"curly": true,
|
||||||
|
"eqeqeq": true,
|
||||||
|
"immed": true,
|
||||||
|
"indent": 2,
|
||||||
|
"latedef": true,
|
||||||
|
"newcap": true,
|
||||||
|
"noarg": true,
|
||||||
|
"quotmark": "single",
|
||||||
|
"regexp": true,
|
||||||
|
"undef": true,
|
||||||
|
"unused": true,
|
||||||
|
"strict": true,
|
||||||
|
"trailing": true,
|
||||||
|
"smarttabs": true,
|
||||||
|
"globals": {
|
||||||
|
"angular": false
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,69 @@
|
|||||||
|
# global module:false
|
||||||
|
|
||||||
|
module.exports = (grunt) ->
|
||||||
|
|
||||||
|
# Project configuration.
|
||||||
|
grunt.initConfig
|
||||||
|
# Metadata.
|
||||||
|
pkg: grunt.file.readJSON 'package.json'
|
||||||
|
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
|
||||||
|
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
|
||||||
|
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
|
||||||
|
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
|
||||||
|
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n'
|
||||||
|
meta:
|
||||||
|
src: 'src/'
|
||||||
|
test: 'test/'
|
||||||
|
target: 'dist/'
|
||||||
|
coffeelint: src:
|
||||||
|
files: src: ['<%= meta.src %>**/*.coffee']
|
||||||
|
options: max_line_length: level: 'warn'
|
||||||
|
coffee: src:
|
||||||
|
options: bare: true
|
||||||
|
files:
|
||||||
|
'<%= meta.target %>radians.js': [
|
||||||
|
'<%= meta.src %>**/*.coffee'
|
||||||
|
]
|
||||||
|
clean: target: src: ['<%= meta.target %>*js']
|
||||||
|
mochacli:
|
||||||
|
options:
|
||||||
|
require: ['should']
|
||||||
|
compilers: ['coffee:coffee-script']
|
||||||
|
reporter: 'spec'
|
||||||
|
coffee: ['test/*.coffee']
|
||||||
|
|
||||||
|
# Task configuration.
|
||||||
|
# concat:
|
||||||
|
# options:
|
||||||
|
# banner: '<%= banner %>'
|
||||||
|
# stripBanners: true
|
||||||
|
# dist:
|
||||||
|
# src: ['lib/<%= pkg.name %>.js']
|
||||||
|
# dest: 'dist/<%= pkg.name %>.js'
|
||||||
|
# uglify:
|
||||||
|
# options:
|
||||||
|
# banner: '<%= banner %>'
|
||||||
|
# dist:
|
||||||
|
# src: '<%= concat.dist.dest %>'
|
||||||
|
# dest: 'dist/<%= pkg.name %>.min.js'
|
||||||
|
# watch:
|
||||||
|
# gruntfile:
|
||||||
|
# files: '<%= jshint.gruntfile.src %>'
|
||||||
|
# tasks: ['jshint:gruntfile']
|
||||||
|
# lib_test:
|
||||||
|
# files: '<%= jshint.lib_test.src %>'
|
||||||
|
# tasks: ['jshint:lib_test', 'qunit']
|
||||||
|
|
||||||
|
# These plugins provide necessary tasks.
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-clean')
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-coffee')
|
||||||
|
grunt.loadNpmTasks('grunt-coffeelint')
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-watch')
|
||||||
|
grunt.loadNpmTasks('grunt-mocha-cli')
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-jshint')
|
||||||
|
|
||||||
|
|
||||||
|
grunt.registerTask 'test', ['mochacli']
|
||||||
|
grunt.registerTask 'lint', ['coffeelint']
|
||||||
|
grunt.registerTask 'build', ['clean', 'lint']
|
||||||
|
grunt.registerTask 'default', ['lint' , 'test', 'build', 'jshint']
|
@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
"name": "angular-radians",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"description": "angular extensions",
|
||||||
|
"main": "index.js",
|
||||||
|
"directories": {
|
||||||
|
"test": "test"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "grunt test"
|
||||||
|
},
|
||||||
|
"repository": "",
|
||||||
|
"keywords": [
|
||||||
|
"angular",
|
||||||
|
"extension"
|
||||||
|
],
|
||||||
|
"author": "Dmitri Akatov",
|
||||||
|
"license": "BSD",
|
||||||
|
"devDependencies": {
|
||||||
|
"grunt": "~0.4.1",
|
||||||
|
"grunt-contrib-concat": "~0.3.0",
|
||||||
|
"grunt-mocha-cli": "~1.0.6",
|
||||||
|
"should": "~1.2.2",
|
||||||
|
"grunt-coffee-redux": "~0.2.3",
|
||||||
|
"grunt-contrib-coffee": "~0.7.0",
|
||||||
|
"grunt-contrib-clean": "~0.4.1",
|
||||||
|
"grunt-contrib-watch": "~0.4.4",
|
||||||
|
"grunt-contrib-jshint": "~0.6.0",
|
||||||
|
"grunt-coffeelint": "0.0.6",
|
||||||
|
"coffee-script": "~1.6.3"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
angular.module('radians', ['radians.contenteditable'])
|
@ -0,0 +1,25 @@
|
|||||||
|
angular.module('radians.contenteditable', [])
|
||||||
|
.directive('contenteditable', ->
|
||||||
|
require: 'ngModel',
|
||||||
|
link: (scope, elm, attrs, ctrl) ->
|
||||||
|
# view -> model
|
||||||
|
elm.bind 'blur', ->
|
||||||
|
console.log elm
|
||||||
|
console.log "blur()"
|
||||||
|
scope.$apply ->
|
||||||
|
ctrl.$setViewValue elm.html()
|
||||||
|
|
||||||
|
elm.bind 'input', (e) ->
|
||||||
|
console.log 'input', e
|
||||||
|
t = elm.html()
|
||||||
|
console.log 'elm contents', t
|
||||||
|
scope.$apply ->
|
||||||
|
ctrl.$setViewValue t
|
||||||
|
|
||||||
|
# model -> view
|
||||||
|
ctrl.$render = (v) ->
|
||||||
|
console.log @
|
||||||
|
console.log "model: #{@$modelValue}, view: #{@$viewValue}"
|
||||||
|
console.log "$render()", v
|
||||||
|
elm.html ctrl.$viewValue
|
||||||
|
)
|
@ -0,0 +1,5 @@
|
|||||||
|
describe 'radians', ->
|
||||||
|
describe 'contenteditable', ->
|
||||||
|
it 'is nice', ->
|
||||||
|
console.log 'ohai'
|
||||||
|
1.should.equal 1
|
Reference in New Issue