Skip to content
This repository has been archived by the owner on May 21, 2021. It is now read-only.

Commit

Permalink
Merge branch 'release/0.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Burgmer committed Mar 5, 2014
2 parents 1ff6074 + 12268a2 commit 9ca6534
Show file tree
Hide file tree
Showing 13 changed files with 1,000 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# http://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
.idea
dist
w11k-select.iml
node_modules

.DS_Store
.sass-cache
bower_components
84 changes: 84 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
// Settings
"passfail" : false, // Stop on first error.
"maxerr" : 100, // Maximum errors before stopping.


// Predefined globals whom JSHint will ignore.
"browser" : false, // Standard browser globals e.g. `window`, `document`.
"node" : false,
"jquery" : true,

"predef" : [ // Extra globals.
// application code
"angular",
"_",
"lodash",

// test code
"beforeEach",
"afterEach",
"module",
"describe",
"expect",
"it",
"inject",
"jasmine",
"spyOn",
"browser",
"element"
],

// Development.
"debug" : false, // Allow debugger statements e.g. browser breakpoints.
"devel" : false, // Allow development statements e.g. `console.log();`.


// EcmaScript 5.
"strict" : true, // Require `use strict` pragma in every file.
"globalstrict" : true, // Allow global `use strict` syntax because build-system wraps all application code into a function


// The Good Parts.
"asi" : false, // Tolerate Automatic Semicolon Insertion (no semicolons).
"laxbreak" : false, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons.
"laxcomma" : true, // Tolerate line breaking before ','
"bitwise" : true, // Prohibit bitwise operators (&, |, ^, etc.).
"boss" : false, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments.
"curly" : true, // Require {} for every new block or scope.
"eqeqeq" : true, // Require triple equals i.e. `===`.
"eqnull" : false, // Tolerate use of `== null`.
"evil" : false, // Tolerate use of `eval`.
"expr" : false, // Tolerate `ExpressionStatement` as Programs.
"forin" : false, // Tolerate `for in` loops without `hasOwnPrototype`.
"immed" : true, // Require immediate invocations to be wrapped in parents e.g. `( function(){}() );`
"latedef" : true, // Prohibit variable use before definition.
"loopfunc" : false, // Allow functions to be defined within loops.
"noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`.
"regexp" : true, // Prohibit `.` and `[^...]` in regular expressions.
"regexdash" : false, // Tolerate unescaped last dash i.e. `[-...]`.
"scripturl" : true, // Tolerate script-targeted URLs.
"shadow" : false, // Allows re-define variables later in code e.g. `var x=1; x=2;`.
"supernew" : false, // Tolerate `new function () { ... };` and `new Object;`.
"undef" : true, // Require all non-global variables be declared before they are used.


// Personal styling preferences.
"newcap" : true, // Require capitalization of all constructor functions e.g. `new F()`.
"noempty" : true, // Prohibit use of empty blocks.
"nonew" : true, // Prohibit use of constructors for side-effects.
"nomen" : true, // Prohibit use of initial or trailing underbars in names.
"onevar" : false, // Allow only one `var` statement per function.
"plusplus" : false, // Prohibit use of `++` & `--`.
"sub" : false, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`.
"trailing" : true, // Prohibit trailing whitespaces.
"white" : true, // Check against strict whitespace and indentation rules.

"indent": 2,
"camelcase": true,
"quotmark": "single",
"unused": true,
"smarttabs": false
}


12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<a name="0.1.0"></a>
## 0.1.0 (2014-03-03)

#### Features

* **options:** parse options given via attribute as ```"value" [as "label"] for "item" in "collection"```
* **ng-model:** use ngModelController to expose selected options and support validation
* **multiple:** support single- and multiple-select mode
* **disabled:** support disabled attribute to prevent change of selected options
* **placeholder:** support placeholder texts for dropdown header and filter box
* **template:** make template url configurable via config constant
* **selected-message:** support customisable text for toggle-area
134 changes: 134 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
'use strict';

module.exports = function (grunt) {

var pkg = require('./package.json');

grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-html2js');
grunt.loadNpmTasks('grunt-bump');
grunt.loadNpmTasks('grunt-conventional-changelog');

var bowerrc = grunt.file.exists('./.bowerrc') ? grunt.file.readJSON('./.bowerrc'){ 'json': 'bower.json' };

var bumpFiles = [ 'package.json', '../w11k-select-bower/package.json' ];
if (grunt.file.exists(bowerrc.json)) {
bumpFiles.push(bowerrc.json);
}

grunt.initConfig({
pkg: pkg,
meta: {
banner:
'/**\n' +
' * <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
' * <%= pkg.homepage %>\n' +
' *\n' +
' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>\n' +
' */\n'
},

clean: {
dist: 'dist/*'
},
jshint: {
src: {
options: {
jshintrc: '.jshintrc'
},
files: [{
expand: true,
cwd: 'src',
src: '**.js'
}]
}
},
sass: {
dist: {
options: {
style: 'expanded'
},
files: {
'dist/w11k-select.css': 'src/w11k-select.scss'
}
}
},
copy: {
template: {
src: 'src/w11k-select.tpl.html',
dest: 'dist/w11k-select.tpl.html'
},
release: {
files: [
{
expand: true,
cwd: 'dist/',
src: '*',
dest: '../w11k-select-bower/dist/'
},
{
src: 'bower.json',
dest: '../w11k-select-bower/'
}
]
}
},
html2js: {
template: {
options: {
base: 'src/',
module: 'w11k.select.template',
quoteChar: '\'',
htmlmin: {
collapseWhitespace: true
}
},
files: {
'dist/w11k-select.tpl.js': 'src/w11k-select.tpl.html'
}
}
},
uglify: {
options: {
banner: '<%= meta.banner %>'
},
code: {
options: {
mangle: false,
compress: false,
beautify: true
},
files: {
'dist/w11k-select.js': 'src/w11k-select.js'
}
},
codeMinified: {
files: [{
'dist/w11k-select.min.js': 'src/w11k-select.js'
}]
}
},
bump: {
options: {
files: bumpFiles,
commit: true,
commitMessage: 'chore(project): bump version to %VERSION%',
commitFiles: ['-a'],
createTag: false,
push: false
}
}
});


grunt.registerTask('default', ['build']);

grunt.registerTask('build', ['clean', 'jshint:src', 'sass', 'copy:template', 'html2js', 'uglify']);

grunt.registerTask('release', ['build', 'copy:release']);

};
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,43 @@

w11k-select is an AngularJS directive created to replace the default HTML select element which has a poor usability for most use cases particularly in desktop browsers.

Features:

* Single- and multi-select
* High performance and usability even with hundreds of options
* Filter options to find the right one quickly
* Uses Twitter Bootstrap markup / styling, comes with default css but easy to adjust / override
* Disabled state and required-validation
* Customisable texts (placeholders and selected representation)


## Getting Started

### Installation

* Install via Bower (w11k-select) or download manually from our release repository (https://github.com/w11k/w11k-select-bower)
* Include scripts into your application (w11k-select and dependencies):
* jQuery
* AngularJS
* bind-once
* w11k-dropdownToggle
* w11k-select
* Add dependency to w11k-select to your angular module

### Usage

<div w11k-select multiple="options.multiple"
disabled="!options.enabled"
required="options.required"
ng-model="selected.data"
options="option.value as option.label for option in options.data"
placeholder="'All'"
filter-placeholder="'Filter'"
>
</div>

Attention: ```placeholder``` and ```filter-placeholder``` are expressions but for a better preformance they are evaluated only once. So you can not change the placeholder and filter-placeholder text dynamically at runtime via data-binding but e.g. you can use expressions like ```'common.filter.placeholder' | translate``` to read the text form a translation file.


## Roadmap

Expand Down
15 changes: 15 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "w11k-select",
"version": "0.1.0",

"dependencies": {
"jquery": "1.11.x",
"angular": "1.2.x",
"w11k-dropdownToggle": "0.1.x",
"angular-bindonce": "0.3.x",
"font-awesome": "4.0.x"
},
"devDependencies": {
"bootstrap": "3.1.0"
}
}
38 changes: 38 additions & 0 deletions demo/demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html ng-app="demo">
<head>
<script type="text/javascript" src="../bower_components/jquery/dist/jquery.js"></script>
<script type="text/javascript" src="../bower_components/angular/angular.js"></script>
<script type="text/javascript" src="../bower_components/w11k-dropdownToggle/dist/w11k-dropdownToggle.js"></script>
<script type="text/javascript" src="../bower_components/angular-bindonce/bindonce.js"></script>
<script type="text/javascript" src="../dist/w11k-select.js"></script>
<script type="text/javascript" src="../dist/w11k-select.tpl.js"></script>
<script type="text/javascript" src="demo.js"></script>

<link rel="stylesheet" href="../bower_components/bootstrap/dist/css/bootstrap.css"/>
<link rel="stylesheet" href="../dist/w11k-select.css"/>
<link rel="stylesheet" href="../bower_components/font-awesome/css/font-awesome.css"/>

<style type="text/css">
body {
padding: 2em;
}
</style>
</head>
<body ng-controller="DemoCtrl">
<div class="row">
<div class="col-sm-6">
<div w11k-select multiple="true"
ng-model="selected.data"
options="option.value as option.label for option in options.data"
placeholder="'All'"
filter-placeholder="'Filter'"
>
</div>
</div>
<div class="col-sm-6">

</div>
</div>
</body>
</html>
7 changes: 7 additions & 0 deletions demo/demo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';

angular.module("demo", ["w11k.select", "w11k.select.template"]);

angular.module("demo").controller("DemoCtrl", function ($scope) {

});
Loading

0 comments on commit 9ca6534

Please sign in to comment.