Skip to content

Commit 511ed98

Browse files
committed
docs(*) update examples and automate build
- Converts previous example pages to invidual html partials which are wrapped in standard header and footer as part of a docs build process - Updates all examples to angular v1.5 making use of controllerAs syntax - Standardises the look and feel across examples - Creates dedicated github pages page (docs/index.html) which has links to all examples - Adds an "edit in plunkr" button to launch the example in a plunkr session - Automates the deployment to github pages using travis ci whenever the master branch is built. - General tidy up of README and index docs Closes angular-ui#112
1 parent 710375d commit 511ed98

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1556
-1758
lines changed

.travis.yml

+19-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ language: node_js
22
node_js:
33
- "5.9"
44
env:
5-
- CXX=g++-4.8
5+
global:
6+
- CXX=g++-4.8
7+
- GH_REF: github.com/angular-ui/ui-select.git
8+
- GH_PAGES_BRANCH: gh-pages
9+
- secure: "PkIhXXwrR5fHh7fH+2WizaY0MmK1l1Dr7PCqs112PkEimVPcntRJeA5pjTwGRwHm+RSkFVtfo38EY/GUwzhLSRTO7WZ+id+vIMGQLgiofqrOwi0nq93esG6qI8Jg5K0GUt8mzg5m9B2tgm2I91RAojEhIukKcbsDsq3hNAUy71Y="
10+
611
addons:
712
apt:
813
sources:
@@ -16,6 +21,19 @@ before_script:
1621
- npm install --quiet -g gulp
1722

1823
script: "gulp test"
24+
25+
after_success:
26+
- "gulp docs"
27+
28+
deploy:
29+
skip_cleanup: true
30+
provider: "script"
31+
script: "bash ./deploy-docs.sh"
32+
on:
33+
all_branches: true
34+
# on:
35+
# tags: true
36+
1937
sudo: false
2038

2139
git:

README.md

+19-28
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,43 @@
1-
# AngularJS ui-select [![Build Status](https://travis-ci.org/angular-ui/ui-select.svg?branch=master)](https://travis-ci.org/angular-ui/ui-select)
1+
# AngularJS ui-select [![Build Status](https://travis-ci.org/angular-ui/ui-select.svg?branch=master)](https://travis-ci.org/angular-ui/ui-select) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/angular-ui/ui-select?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
22

3-
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/angular-ui/ui-select?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
3+
AngularJS-native version of [Select2](http://ivaynberg.github.io/select2/) and [Selectize](http://brianreavis.github.io/selectize.js/). [http://angular-ui.github.io/ui-select/](http://angular-ui.github.io/ui-select/)
44

5-
AngularJS-native version of [Select2](http://ivaynberg.github.io/select2/) and [Selectize](http://brianreavis.github.io/selectize.js/).
5+
[Getting Started](https://github.com/angular-ui/ui-select/wiki/Getting-Started)
66

7-
[Getting Started](https://github.com/angular-ui/ui-select/wiki/Getting-Started) `bower install angular-ui-select`
8-
9-
- [Demo](http://plnkr.co/edit/a3KlK8dKH3wwiiksDSn2?p=preview)
10-
- [Demo Multiselect](http://plnkr.co/edit/juqoNOt1z1Gb349XabQ2?p=preview)
11-
- [Examples](https://github.com/angular-ui/ui-select/blob/master/examples)
7+
- [Examples](http://angular-ui.github.io/ui-select/#examples)
8+
- [Examples Source](./docs/examples)
129
- [Documentation](https://github.com/angular-ui/ui-select/wiki)
1310

14-
## Last Changes
11+
## Latest Changes
1512

1613
- Check [CHANGELOG.md](/CHANGELOG.md)
1714

1815
## Features
1916

20-
- Search, Select, and Multi-select
21-
- Themes: Bootstrap, Select2 and Selectize
17+
- Search, Select, Multi-select and Tagging
18+
- Multiple Themes: Bootstrap, Select2 and Selectize
2219
- Keyboard support
23-
- jQuery not required (except for old browsers)
20+
- No jQuery required (except for old browsers)
2421
- Small code base: 4.57KB min/gzipped vs 20KB for select2
2522

2623
For the roadmap, check [issue #3](https://github.com/angular-ui/ui-select/issues/3) and the [Wiki page](https://github.com/angular-ui/ui-select/wiki/Roadmap).
2724

28-
## Installation using [Composer](http://getcomposer.org/)
29-
30-
Make sure composer is install globally before we proceed. After that we need to add below piece of code in `composer.json` file located inside your project root folder.
25+
## Installation Methods
3126

27+
### npm
3228
```
33-
{
34-
"require": {
35-
"components/ui-select": "dev-master"
36-
}
37-
}
29+
$ npm install angular-ui-select
30+
```
31+
### bower
32+
```
33+
$ bower install angular-ui-select
3834
```
39-
40-
- Run `composer update` and composer will install the component.
41-
- Inside your HTML add below script and link tags.
42-
- select.js: `<script src="components/ui-select/dist/select.min.js"></script>`
43-
- select.css: `<link rel="stylesheet" href="components/ui-select/dist/select.min.css">`
44-
4535

4636
## Development
4737

4838
### Prepare your environment
4939
* Install [Node.js](http://nodejs.org/) and NPM (should come with)
50-
* Install global dev dependencies: `npm install -g bower gulp`
40+
* Install global dev dependencies: `npm install -g gulp`
5141
* Install local dev dependencies: `npm install` in repository directory
5242

5343
### Development Commands
@@ -56,11 +46,12 @@ Make sure composer is install globally before we proceed. After that we need to
5646
* `gulp build` to jshint and build
5747
* `gulp test` for one-time test with karma (also build and jshint)
5848
* `gulp watch` to watch src files to jshint, build and test when changed
49+
* `gulp docs` build docs and examples
5950

6051
## Contributing
6152

6253
- Check [CONTRIBUTING.md](/CONTRIBUTING.md)
6354
- Run the tests
64-
- Try the [examples](https://github.com/angular-ui/ui-select/blob/master/examples)
55+
- Try the [examples](./docs/examples)
6556

6657
When issuing a pull request, please exclude changes from the "dist" folder to avoid merge conflicts.

deploy-docs.sh

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
set -e
3+
4+
[[ $TRAVIS_SECURE_ENV_VARS == "true" ]] || { echo "No github key avaliable, aborting publishing"; exit 0; }
5+
6+
ID_REF="$(git rev-parse --short HEAD)"
7+
8+
git clone "https://${GH_KEY}@${GH_REF}" ./docs-out -b ${GH_PAGES_BRANCH} --single-branch --depth=1
9+
10+
cd docs-out
11+
12+
# clear out everything
13+
git rm -rf .
14+
git clean -fxd
15+
16+
# get new content
17+
cp ../docs-built/* . -R
18+
19+
git add .
20+
21+
# inside this git repo we'll pretend to be a new user
22+
git config user.name "Travis CI"
23+
git config user.email "[email protected]"
24+
25+
# The first and only commit to this new Git repo contains all the
26+
# files present with the commit message "Deploy to GitHub Pages".
27+
git commit -m "docs(*): new deploy (angular-ui/ui-select@${ID_REF})"
28+
29+
30+
git push origin --quiet
31+
#> /dev/null 2>&1

docs/assets/app.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
var module = angular.module('ui.select.pages', ['plunkr']);

examples/demo.js docs/assets/demo.js

+56-54
Original file line numberDiff line numberDiff line change
@@ -40,37 +40,39 @@ app.filter('propsFilter', function() {
4040
};
4141
});
4242

43-
app.controller('DemoCtrl', function($scope, $http, $timeout, $interval) {
44-
$scope.disabled = undefined;
45-
$scope.searchEnabled = undefined;
43+
app.controller('DemoCtrl', function ($scope, $http, $timeout, $interval) {
44+
var vm = this;
4645

47-
$scope.setInputFocus = function (){
46+
vm.disabled = undefined;
47+
vm.searchEnabled = undefined;
48+
49+
vm.setInputFocus = function (){
4850
$scope.$broadcast('UiSelectDemo1');
4951
};
5052

51-
$scope.enable = function() {
52-
$scope.disabled = false;
53+
vm.enable = function() {
54+
vm.disabled = false;
5355
};
5456

55-
$scope.disable = function() {
56-
$scope.disabled = true;
57+
vm.disable = function() {
58+
vm.disabled = true;
5759
};
5860

59-
$scope.enableSearch = function() {
60-
$scope.searchEnabled = true;
61+
vm.enableSearch = function() {
62+
vm.searchEnabled = true;
6163
};
6264

63-
$scope.disableSearch = function() {
64-
$scope.searchEnabled = false;
65+
vm.disableSearch = function() {
66+
vm.searchEnabled = false;
6567
};
6668

67-
$scope.clear = function() {
68-
$scope.person.selected = undefined;
69-
$scope.address.selected = undefined;
70-
$scope.country.selected = undefined;
69+
vm.clear = function() {
70+
vm.person.selected = undefined;
71+
vm.address.selected = undefined;
72+
vm.country.selected = undefined;
7173
};
7274

73-
$scope.someGroupFn = function (item){
75+
vm.someGroupFn = function (item){
7476

7577
if (item.name[0] >= 'A' && item.name[0] <= 'M')
7678
return 'From A - M';
@@ -80,19 +82,19 @@ app.controller('DemoCtrl', function($scope, $http, $timeout, $interval) {
8082

8183
};
8284

83-
$scope.firstLetterGroupFn = function (item){
85+
vm.firstLetterGroupFn = function (item){
8486
return item.name[0];
8587
};
8688

87-
$scope.reverseOrderFilterFn = function(groups) {
89+
vm.reverseOrderFilterFn = function(groups) {
8890
return groups.reverse();
8991
};
9092

91-
$scope.personAsync = {selected : "[email protected]"};
92-
$scope.peopleAsync = [];
93+
vm.personAsync = {selected : "[email protected]"};
94+
vm.peopleAsync = [];
9395

9496
$timeout(function(){
95-
$scope.peopleAsync = [
97+
vm.peopleAsync = [
9698
{ name: 'Adam', email: '[email protected]', age: 12, country: 'United States' },
9799
{ name: 'Amalie', email: '[email protected]', age: 12, country: 'Argentina' },
98100
{ name: 'Estefanía', email: '[email protected]', age: 21, country: 'Argentina' },
@@ -106,20 +108,20 @@ app.controller('DemoCtrl', function($scope, $http, $timeout, $interval) {
106108
];
107109
},3000);
108110

109-
$scope.counter = 0;
110-
$scope.onSelectCallback = function (item, model){
111-
$scope.counter++;
112-
$scope.eventResult = {item: item, model: model};
111+
vm.counter = 0;
112+
vm.onSelectCallback = function (item, model){
113+
vm.counter++;
114+
vm.eventResult = {item: item, model: model};
113115
};
114116

115-
$scope.removed = function (item, model) {
116-
$scope.lastRemoved = {
117+
vm.removed = function (item, model) {
118+
vm.lastRemoved = {
117119
item: item,
118120
model: model
119121
};
120122
};
121123

122-
$scope.tagTransform = function (newTag) {
124+
vm.tagTransform = function (newTag) {
123125
var item = {
124126
name: newTag,
125127
email: newTag.toLowerCase()+'@email.com',
@@ -130,7 +132,7 @@ app.controller('DemoCtrl', function($scope, $http, $timeout, $interval) {
130132
return item;
131133
};
132134

133-
$scope.peopleObj = {
135+
vm.peopleObj = {
134136
'1' : { name: 'Adam', email: '[email protected]', age: 12, country: 'United States' },
135137
'2' : { name: 'Amalie', email: '[email protected]', age: 12, country: 'Argentina' },
136138
'3' : { name: 'Estefanía', email: '[email protected]', age: 21, country: 'Argentina' },
@@ -143,13 +145,13 @@ app.controller('DemoCtrl', function($scope, $http, $timeout, $interval) {
143145
'10' : { name: 'Nicolás', email: '[email protected]', age: 43, country: 'Colombia' }
144146
};
145147

146-
$scope.person = {};
148+
vm.person = {};
147149

148-
$scope.person.selectedValue = $scope.peopleObj[3];
149-
$scope.person.selectedSingle = 'Samantha';
150-
$scope.person.selectedSingleKey = '5';
150+
vm.person.selectedValue = vm.peopleObj[3];
151+
vm.person.selectedSingle = 'Samantha';
152+
vm.person.selectedSingleKey = '5';
151153

152-
$scope.people = [
154+
vm.people = [
153155
{ name: 'Adam', email: '[email protected]', age: 12, country: 'United States' },
154156
{ name: 'Amalie', email: '[email protected]', age: 12, country: 'Argentina' },
155157
{ name: 'Estefanía', email: '[email protected]', age: 21, country: 'Argentina' },
@@ -162,23 +164,23 @@ app.controller('DemoCtrl', function($scope, $http, $timeout, $interval) {
162164
{ name: 'Nicolás', email: '[email protected]', age: 43, country: 'Colombia' }
163165
];
164166

165-
$scope.availableColors = ['Red','Green','Blue','Yellow','Magenta','Maroon','Umbra','Turquoise'];
167+
vm.availableColors = ['Red','Green','Blue','Yellow','Magenta','Maroon','Umbra','Turquoise'];
166168

167-
$scope.singleDemo = {};
168-
$scope.singleDemo.color = '';
169-
$scope.multipleDemo = {};
170-
$scope.multipleDemo.colors = ['Blue','Red'];
171-
$scope.multipleDemo.colors2 = ['Blue','Red'];
172-
$scope.multipleDemo.selectedPeople = [$scope.people[5], $scope.people[4]];
173-
$scope.multipleDemo.selectedPeople2 = $scope.multipleDemo.selectedPeople;
174-
$scope.multipleDemo.selectedPeopleWithGroupBy = [$scope.people[8], $scope.people[6]];
175-
$scope.multipleDemo.selectedPeopleSimple = ['[email protected]','[email protected]'];
169+
vm.singleDemo = {};
170+
vm.singleDemo.color = '';
171+
vm.multipleDemo = {};
172+
vm.multipleDemo.colors = ['Blue','Red'];
173+
vm.multipleDemo.colors2 = ['Blue','Red'];
174+
vm.multipleDemo.selectedPeople = [vm.people[5], vm.people[4]];
175+
vm.multipleDemo.selectedPeople2 = vm.multipleDemo.selectedPeople;
176+
vm.multipleDemo.selectedPeopleWithGroupBy = [vm.people[8], vm.people[6]];
177+
vm.multipleDemo.selectedPeopleSimple = ['[email protected]','[email protected]'];
176178

177-
$scope.appendToBodyDemo = {
179+
vm.appendToBodyDemo = {
178180
remainingToggleTime: 0,
179181
present: true,
180182
startToggleTimer: function() {
181-
var scope = $scope.appendToBodyDemo;
183+
var scope = vm.appendToBodyDemo;
182184
var promise = $interval(function() {
183185
if (scope.remainingTime < 1000) {
184186
$interval.cancel(promise);
@@ -192,26 +194,26 @@ app.controller('DemoCtrl', function($scope, $http, $timeout, $interval) {
192194
}
193195
};
194196

195-
$scope.address = {};
196-
$scope.refreshAddresses = function(address) {
197+
vm.address = {};
198+
vm.refreshAddresses = function(address) {
197199
var params = {address: address, sensor: false};
198200
return $http.get(
199201
'http://maps.googleapis.com/maps/api/geocode/json',
200202
{params: params}
201203
).then(function(response) {
202-
$scope.addresses = response.data.results;
204+
vm.addresses = response.data.results;
203205
});
204206
};
205207

206-
$scope.addPerson = function(item, model){
208+
vm.addPerson = function(item, model){
207209
if(item.hasOwnProperty('isTag')) {
208210
delete item.isTag;
209-
$scope.people.push(item);
211+
vm.people.push(item);
210212
}
211213
}
212214

213-
$scope.country = {};
214-
$scope.countries = [ // Taken from https://gist.github.com/unceus/6501985
215+
vm.country = {};
216+
vm.countries = [ // Taken from https://gist.github.com/unceus/6501985
215217
{name: 'Afghanistan', code: 'AF'},
216218
{name: 'Åland Islands', code: 'AX'},
217219
{name: 'Albania', code: 'AL'},

0 commit comments

Comments
 (0)