Skip to content

Commit b0cf25e

Browse files
committed
chore(docs) docs wip
1 parent f3fb4e0 commit b0cf25e

13 files changed

+364
-123
lines changed

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# EditorConfig helps developers define and maintain consistent
2+
# coding styles between different editors and IDEs
3+
# editorconfig.org
4+
5+
root = true
6+
7+
[*]
8+
# Change these settings to your own preference
9+
indent_style = space
10+
indent_size = 2
11+
# We recommend you to keep these unchanged
12+
end_of_line = lf
13+
charset = utf-8
14+
trim_trailing_whitespace = true
15+
insert_final_newline = true
16+
17+
[*.md]
18+
trim_trailing_whitespace = false

bower.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
"license": "MIT",
99
"ignore": [
1010
"**/.*",
11+
"docs",
1112
"node_modules",
1213
"bower_components",
1314
"components",
1415
"test*",
1516
"demo*",
1617
"Gruntfile.js",
18+
"gulpfile.js",
1719
"package.json",
1820
"CHANGELOG.md"
1921
],

demo/index.html

Lines changed: 42 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,43 +6,51 @@
66
<meta name="viewport" content="width=device-width">
77
<title>Angular bootstrap-select</title>
88

9-
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css">
9+
<link rel="stylesheet" href="../bower_components/bootstrap/dist/css/bootstrap.min.css">
1010
<link rel="stylesheet" href="../bower_components/bootstrap-select/dist/css/bootstrap-select.min.css" rel="stylesheet">
11-
12-
<script src="../bower_components/jquery/dist/jquery.js"></script>
13-
<script src="../bower_components/bootstrap-select/dist/js/bootstrap-select.js"></script>
14-
<script src="../bower_components/angular/angular.js"></script>
15-
16-
<script src="../src/angular-bootstrap-select.js"></script>
1711
</head>
1812
<body>
1913
<div role="main">
2014
<div class="container">
21-
<script>
22-
(function () {
23-
var selectDemoApp = angular.module('selectDemoApp', [
24-
'angular-bootstrap-select',
25-
'angular-bootstrap-select.extra'
26-
]);
15+
<!-- Extras -->
16+
<section id="extras" ng-controller="ExtrasCtrl">
17+
<h1>Extras</h1>
18+
<div>
19+
<h3>Not popup without dropdownToggle directive</h3>
20+
<!-- This extra directive provide dropdown open and close without loading bootstrap.js -->
21+
<select class="selectpicker">
22+
<option value="">Select one</option>
23+
<option>Mustard</option>
24+
<option>Ketchup</option>
25+
<option>Relish</option>
26+
</select>
2727

28-
selectDemoApp.controller('SimpleUsageCtrl', function ($scope, $timeout) {
29-
$scope.model = '';
30-
$scope.colors = ['Mustard', 'Ketchup', 'Relish'];
31-
$scope.repeater = [
32-
{ title: 'one' },
33-
{ title: 'two' },
34-
{ title: 'three' }
35-
];
36-
$scope.selectWithOptionsIsVisible = true;
37-
});
38-
})();
39-
</script>
28+
<h3>Popup with dropdownToggle directive</h3>
29+
<dropdown-toggle>
30+
<select class="selectpicker">
31+
<option value="">Select one</option>
32+
<option>Mustard</option>
33+
<option>Ketchup</option>
34+
<option>Relish</option>
35+
</select>
36+
</dropdown-toggle>
37+
</div>
38+
</section>
4039

4140
<!-- Simple usage -->
42-
<section id="simple-usage" ng-controller="SimpleUsageCtrl" dropdown-toggle>
41+
<!-- <section id="simple-usage" ng-controller="SimpleUsageCtrl" class="dropdown-toggle">
4342
<h1>Simple usage</h1>
4443
4544
<div>
45+
<h3>Works with simple select</h3>
46+
<div>Model value: <code>{{model || "''"}}</code></div>
47+
<select selectpicker="" ng-model="model">
48+
<option value="">Select one</option>
49+
<option>Mustard</option>
50+
<option>Ketchup</option>
51+
<option>Relish</option>
52+
</select>
53+
4654
<h3>Works with ngIf</h3>
4755
<div>Model value: <code>{{model || "''"}}</code></div>
4856
<div>Show/Hide <input type="checkbox" ng-model="selectWithOptionsIsVisible"></div>
@@ -56,15 +64,6 @@ <h3>Works with ngIf</h3>
5664
</select>
5765
</div>
5866
59-
<h3>Works without ngIf</h3>
60-
<div>Model value: <code>{{model || "''"}}</code></div>
61-
<select selectpicker="" ng-model="model">
62-
<option value="">Select one</option>
63-
<option>Mustard</option>
64-
<option>Ketchup</option>
65-
<option>Relish</option>
66-
</select>
67-
6867
<h3>Works with optgroup</h3>
6968
<div>
7069
<select selectpicker ng-model="model">
@@ -85,7 +84,7 @@ <h3>Works with ngOptions</h3>
8584
<select selectpicker ng-model="model" ng-options="c as c for c in colors">
8685
<option value="">Select one</option>
8786
</select>
88-
87+
8988
<h3>Works with ngRepeat</h3>
9089
<div ng-repeat="select in repeater">
9190
<label>{{select.title}} {{model}}</label>
@@ -94,9 +93,15 @@ <h3>Works with ngRepeat</h3>
9493
</select>
9594
</div>
9695
</div>
97-
</section>
96+
</section> -->
9897
</div>
9998
</div>
10099

100+
<script src="../bower_components/jquery/dist/jquery.js"></script>
101+
<script src="../bower_components/bootstrap-select/dist/js/bootstrap-select.js"></script>
102+
<script src="../bower_components/angular/angular.js"></script>
103+
104+
<script src="../src/angular-bootstrap-select.js"></script>
105+
<script src="select-demo-app.js"></script>
101106
</body>
102107
</html>

demo/select-demo-app.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
angular.module('selectDemoApp', [
2+
'angular-bootstrap-select',
3+
'angular-bootstrap-select.extra'
4+
])
5+
6+
.controller('ExtrasCtrl', function ($scope, $timeout) {
7+
$scope.model = 'Mustard';
8+
})
9+
10+
.controller('SimpleUsageCtrl', function ($scope, $timeout) {
11+
$scope.model = '';
12+
$scope.colors = ['Mustard', 'Ketchup', 'Relish'];
13+
$scope.repeater = [
14+
{ title: 'one' },
15+
{ title: 'two' },
16+
{ title: 'three' }
17+
];
18+
$scope.selectWithOptionsIsVisible = true;
19+
})

demo/selectDemo.js

Lines changed: 0 additions & 36 deletions
This file was deleted.

docs/config/index.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
var path = require('canonical-path');
2+
var Package = require('dgeni').Package;
3+
4+
var paths = {
5+
src: path.resolve(__dirname, '../../src'),
6+
docs: path.resolve(__dirname, '..'),
7+
};
8+
9+
var files = {
10+
scripts: path.join(paths.src, '**', '*.js'),
11+
exclude_scripts: '',
12+
};
13+
14+
module.exports = new Package('angular-bootstrap-select', [
15+
require('dgeni-packages/ngdoc'),
16+
require('dgeni-packages/nunjucks'),
17+
])
18+
19+
.factory(function gitData() {
20+
return {
21+
version: {
22+
isSnapshot: true,
23+
branch: 'master',
24+
raw: 'v0.0.4',
25+
},
26+
versions: ['v0.0.2', 'v0.0.3', 'v0.0.4'],
27+
info: {
28+
owner: 'joaoneto',
29+
repo: 'angular-bootstrap-select',
30+
}
31+
};
32+
})
33+
.config(function (templateFinder, renderDocsProcessor, gitData) {
34+
renderDocsProcessor.extraData.git = gitData;
35+
})
36+
37+
.config(function (templateFinder, readFilesProcessor, writeFilesProcessor) {
38+
readFilesProcessor.basePath = path.resolve(__dirname, '../..');
39+
readFilesProcessor.sourceFiles = [{
40+
include: files.scripts,
41+
basePath: paths.src
42+
}];
43+
templateFinder.templateFolders.unshift(path.resolve(__dirname, 'templates'));
44+
writeFilesProcessor.outputFolder = paths.docs;
45+
});
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{% extends "base.template.html" %}
2+
3+
{% block content %}
4+
<h1>
5+
{% if doc.title %}{$ doc.title | marked $}{% else %}{$ doc.name | code $}{% endif %}
6+
</h1>
7+
8+
{$ doc.description | marked $}
9+
10+
{% if doc.name != 'ng' and doc.name != 'auto' %}
11+
<h2>Installation</h2>
12+
13+
<p>First include <code>angular-bootstrap-select</code> in your HTML:</p>
14+
15+
{% code %}
16+
<script src="angular.js">
17+
<script src="angular-bootstrap-select.js">
18+
{% endcode %}
19+
20+
<p>You can download this file from the following places:</p>
21+
<ul>
22+
<li>
23+
<a href="https://github.com/joaoneto/angular-bootstrap-select/releases">Github</a><br>
24+
e.g. {$ ("https://github.com/joaoneto/angular-bootstrap-select/archive/vX.Y.Z.zip") | code $}
25+
</li>
26+
<li>
27+
<a href="http://bower.io">Bower</a><br>
28+
e.g. <code>bower install angular-bootstrap-select@X.Y.Z</code>
29+
</li>
30+
</ul>
31+
<p>where X.Y.Z is the angular-bootstrap-select.js version you are running.</p>
32+
<p>Then load the module in your application by adding it as a dependent module:</p>
33+
{% code %}
34+
angular.module('app', ['{$ doc.name $}']);
35+
{% endcode %}
36+
37+
<p>With that you&apos;re ready to get started!</p>
38+
{% endif %}
39+
40+
<div class="component-breakdown">
41+
<h2>Module Components</h2>
42+
{% for componentGroup in doc.componentGroups %}
43+
<div>
44+
<h3 class="component-heading" id="{$ componentGroup.groupType | dashCase $}">{$ componentGroup.groupType | title $}</h3>
45+
<table class="definition-table">
46+
<tr>
47+
<th>Name</th>
48+
<th>Description</th>
49+
</tr>
50+
{% for component in componentGroup.components %}
51+
<tr>
52+
<td>{$ component.id | link(component.name, component) $}</td>
53+
<td>{$ component.description | firstParagraph | marked $}</td>
54+
</tr>
55+
{% endfor %}
56+
</table>
57+
</div>
58+
{% endfor %}
59+
</div>
60+
61+
{% if doc.usage %}
62+
<h2>Usage</h2>
63+
{$ doc.usage | marked $}
64+
{% endif %}
65+
66+
{% endblock %}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<a href='https://github.com/joaoneto/angular-bootstrap-select/edit/{$ git.version.branch $}/{$ doc.fileInfo.projectRelativePath $}?message=docs({$ (doc.area != "api") and (doc.area + "%2F") or "" $}{$ doc.name $})%3A%20describe%20your%20change...{$ (doc.area == "api") and ("#L" + doc.startingLine) or "" $}' class='improve-docs btn btn-primary'><i class="glyphicon glyphicon-edit">&nbsp;</i>Improve this Doc</a>
2+
3+
{% block content %}
4+
{% endblock %}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<h1>{{ doc.codeName }} ({{ doc.outputPath }})</h1>
2+
<p>{{ doc.description }}</p>
3+
4+
{% if doc.params %}
5+
<h2>Params</h2>
6+
<ul>
7+
{% for param in doc.params %}
8+
<li>
9+
<strong>{{ param.name }}</strong> { {{ param.typeList }} } - {{ param.description }}
10+
</li>
11+
{% endfor %}
12+
</ul>
13+
{% endif %}
14+
15+
{% if doc.returns %}
16+
<h2>Returns</h2>
17+
<p>
18+
{ {{ doc.returns.typeList }} } - {{ doc.returns.description }}
19+
</p>
20+
{% endif %}

docs/gulpfile.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
var path = require('canonical-path');
2+
var Dgeni = require('dgeni');
3+
var gulp = require('gulp');
4+
5+
gulp.task('docs', function () {
6+
var dgeni = new Dgeni([require('./config')]);
7+
return dgeni.generate();
8+
});

0 commit comments

Comments
 (0)