Skip to content

Commit

Permalink
chore(docs) docs wip
Browse files Browse the repository at this point in the history
  • Loading branch information
joaoneto committed Nov 16, 2014
1 parent f3fb4e0 commit b0cf25e
Show file tree
Hide file tree
Showing 13 changed files with 364 additions and 123 deletions.
18 changes: 18 additions & 0 deletions .editorconfig
@@ -0,0 +1,18 @@
# 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
2 changes: 2 additions & 0 deletions bower.json
Expand Up @@ -8,12 +8,14 @@
"license": "MIT",
"ignore": [
"**/.*",
"docs",
"node_modules",
"bower_components",
"components",
"test*",
"demo*",
"Gruntfile.js",
"gulpfile.js",
"package.json",
"CHANGELOG.md"
],
Expand Down
79 changes: 42 additions & 37 deletions demo/index.html
Expand Up @@ -6,43 +6,51 @@
<meta name="viewport" content="width=device-width">
<title>Angular bootstrap-select</title>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css">
<link rel="stylesheet" href="../bower_components/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="../bower_components/bootstrap-select/dist/css/bootstrap-select.min.css" rel="stylesheet">

<script src="../bower_components/jquery/dist/jquery.js"></script>
<script src="../bower_components/bootstrap-select/dist/js/bootstrap-select.js"></script>
<script src="../bower_components/angular/angular.js"></script>

<script src="../src/angular-bootstrap-select.js"></script>
</head>
<body>
<div role="main">
<div class="container">
<script>
(function () {
var selectDemoApp = angular.module('selectDemoApp', [
'angular-bootstrap-select',
'angular-bootstrap-select.extra'
]);
<!-- Extras -->
<section id="extras" ng-controller="ExtrasCtrl">
<h1>Extras</h1>
<div>
<h3>Not popup without dropdownToggle directive</h3>
<!-- This extra directive provide dropdown open and close without loading bootstrap.js -->
<select class="selectpicker">
<option value="">Select one</option>
<option>Mustard</option>
<option>Ketchup</option>
<option>Relish</option>
</select>

selectDemoApp.controller('SimpleUsageCtrl', function ($scope, $timeout) {
$scope.model = '';
$scope.colors = ['Mustard', 'Ketchup', 'Relish'];
$scope.repeater = [
{ title: 'one' },
{ title: 'two' },
{ title: 'three' }
];
$scope.selectWithOptionsIsVisible = true;
});
})();
</script>
<h3>Popup with dropdownToggle directive</h3>
<dropdown-toggle>
<select class="selectpicker">
<option value="">Select one</option>
<option>Mustard</option>
<option>Ketchup</option>
<option>Relish</option>
</select>
</dropdown-toggle>
</div>
</section>

<!-- Simple usage -->
<section id="simple-usage" ng-controller="SimpleUsageCtrl" dropdown-toggle>
<!-- <section id="simple-usage" ng-controller="SimpleUsageCtrl" class="dropdown-toggle">
<h1>Simple usage</h1>
<div>
<h3>Works with simple select</h3>
<div>Model value: <code>{{model || "''"}}</code></div>
<select selectpicker="" ng-model="model">
<option value="">Select one</option>
<option>Mustard</option>
<option>Ketchup</option>
<option>Relish</option>
</select>
<h3>Works with ngIf</h3>
<div>Model value: <code>{{model || "''"}}</code></div>
<div>Show/Hide <input type="checkbox" ng-model="selectWithOptionsIsVisible"></div>
Expand All @@ -56,15 +64,6 @@ <h3>Works with ngIf</h3>
</select>
</div>
<h3>Works without ngIf</h3>
<div>Model value: <code>{{model || "''"}}</code></div>
<select selectpicker="" ng-model="model">
<option value="">Select one</option>
<option>Mustard</option>
<option>Ketchup</option>
<option>Relish</option>
</select>

<h3>Works with optgroup</h3>
<div>
<select selectpicker ng-model="model">
Expand All @@ -85,7 +84,7 @@ <h3>Works with ngOptions</h3>
<select selectpicker ng-model="model" ng-options="c as c for c in colors">
<option value="">Select one</option>
</select>
<h3>Works with ngRepeat</h3>
<div ng-repeat="select in repeater">
<label>{{select.title}} {{model}}</label>
Expand All @@ -94,9 +93,15 @@ <h3>Works with ngRepeat</h3>
</select>
</div>
</div>
</section>
</section> -->
</div>
</div>

<script src="../bower_components/jquery/dist/jquery.js"></script>
<script src="../bower_components/bootstrap-select/dist/js/bootstrap-select.js"></script>
<script src="../bower_components/angular/angular.js"></script>

<script src="../src/angular-bootstrap-select.js"></script>
<script src="select-demo-app.js"></script>
</body>
</html>
19 changes: 19 additions & 0 deletions demo/select-demo-app.js
@@ -0,0 +1,19 @@
angular.module('selectDemoApp', [
'angular-bootstrap-select',
'angular-bootstrap-select.extra'
])

.controller('ExtrasCtrl', function ($scope, $timeout) {
$scope.model = 'Mustard';
})

.controller('SimpleUsageCtrl', function ($scope, $timeout) {
$scope.model = '';
$scope.colors = ['Mustard', 'Ketchup', 'Relish'];
$scope.repeater = [
{ title: 'one' },
{ title: 'two' },
{ title: 'three' }
];
$scope.selectWithOptionsIsVisible = true;
})
36 changes: 0 additions & 36 deletions demo/selectDemo.js

This file was deleted.

45 changes: 45 additions & 0 deletions docs/config/index.js
@@ -0,0 +1,45 @@
var path = require('canonical-path');
var Package = require('dgeni').Package;

var paths = {
src: path.resolve(__dirname, '../../src'),
docs: path.resolve(__dirname, '..'),
};

var files = {
scripts: path.join(paths.src, '**', '*.js'),
exclude_scripts: '',
};

module.exports = new Package('angular-bootstrap-select', [
require('dgeni-packages/ngdoc'),
require('dgeni-packages/nunjucks'),
])

.factory(function gitData() {
return {
version: {
isSnapshot: true,
branch: 'master',
raw: 'v0.0.4',
},
versions: ['v0.0.2', 'v0.0.3', 'v0.0.4'],
info: {
owner: 'joaoneto',
repo: 'angular-bootstrap-select',
}
};
})
.config(function (templateFinder, renderDocsProcessor, gitData) {
renderDocsProcessor.extraData.git = gitData;
})

.config(function (templateFinder, readFilesProcessor, writeFilesProcessor) {
readFilesProcessor.basePath = path.resolve(__dirname, '../..');
readFilesProcessor.sourceFiles = [{
include: files.scripts,
basePath: paths.src
}];
templateFinder.templateFolders.unshift(path.resolve(__dirname, 'templates'));
writeFilesProcessor.outputFolder = paths.docs;
});
66 changes: 66 additions & 0 deletions docs/config/templates/api/module.template.html
@@ -0,0 +1,66 @@
{% extends "base.template.html" %}

{% block content %}
<h1>
{% if doc.title %}{$ doc.title | marked $}{% else %}{$ doc.name | code $}{% endif %}
</h1>

{$ doc.description | marked $}

{% if doc.name != 'ng' and doc.name != 'auto' %}
<h2>Installation</h2>

<p>First include <code>angular-bootstrap-select</code> in your HTML:</p>

{% code %}
<script src="angular.js">
<script src="angular-bootstrap-select.js">
{% endcode %}

<p>You can download this file from the following places:</p>
<ul>
<li>
<a href="https://github.com/joaoneto/angular-bootstrap-select/releases">Github</a><br>
e.g. {$ ("https://github.com/joaoneto/angular-bootstrap-select/archive/vX.Y.Z.zip") | code $}
</li>
<li>
<a href="http://bower.io">Bower</a><br>
e.g. <code>bower install angular-bootstrap-select@X.Y.Z</code>
</li>
</ul>
<p>where X.Y.Z is the angular-bootstrap-select.js version you are running.</p>
<p>Then load the module in your application by adding it as a dependent module:</p>
{% code %}
angular.module('app', ['{$ doc.name $}']);
{% endcode %}

<p>With that you&apos;re ready to get started!</p>
{% endif %}

<div class="component-breakdown">
<h2>Module Components</h2>
{% for componentGroup in doc.componentGroups %}
<div>
<h3 class="component-heading" id="{$ componentGroup.groupType | dashCase $}">{$ componentGroup.groupType | title $}</h3>
<table class="definition-table">
<tr>
<th>Name</th>
<th>Description</th>
</tr>
{% for component in componentGroup.components %}
<tr>
<td>{$ component.id | link(component.name, component) $}</td>
<td>{$ component.description | firstParagraph | marked $}</td>
</tr>
{% endfor %}
</table>
</div>
{% endfor %}
</div>

{% if doc.usage %}
<h2>Usage</h2>
{$ doc.usage | marked $}
{% endif %}

{% endblock %}
4 changes: 4 additions & 0 deletions docs/config/templates/base.template.html
@@ -0,0 +1,4 @@
<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>

{% block content %}
{% endblock %}
20 changes: 20 additions & 0 deletions docs/config/templates/common.template.html
@@ -0,0 +1,20 @@
<h1>{{ doc.codeName }} ({{ doc.outputPath }})</h1>
<p>{{ doc.description }}</p>

{% if doc.params %}
<h2>Params</h2>
<ul>
{% for param in doc.params %}
<li>
<strong>{{ param.name }}</strong> { {{ param.typeList }} } - {{ param.description }}
</li>
{% endfor %}
</ul>
{% endif %}

{% if doc.returns %}
<h2>Returns</h2>
<p>
{ {{ doc.returns.typeList }} } - {{ doc.returns.description }}
</p>
{% endif %}
8 changes: 8 additions & 0 deletions docs/gulpfile.js
@@ -0,0 +1,8 @@
var path = require('canonical-path');
var Dgeni = require('dgeni');
var gulp = require('gulp');

gulp.task('docs', function () {
var dgeni = new Dgeni([require('./config')]);
return dgeni.generate();
});
3 changes: 1 addition & 2 deletions gulpfile.js
Expand Up @@ -7,10 +7,10 @@ var paths = {
dist: 'dist',
demo: 'demo',
test: 'test',
scripts: path.join('src', '**', '*.js'),
};

var files = {
scripts: path.join(paths.src, '**', '*.js'),
demo: path.join(paths.demo, '**', '*'),
};

Expand All @@ -23,4 +23,3 @@ gulp.task('watch:demo', function () {
gulp.task('serve', ['watch:demo'], function () {
connect.server({ livereload: true });
});

3 changes: 3 additions & 0 deletions package.json
Expand Up @@ -3,7 +3,10 @@
"version": "0.0.4",
"description": "Directive to wrap bootstrap-select",
"devDependencies": {
"canonical-path": "0.0.2",
"dgeni": "^0.4.1",
"dgeni-markdown": "0.0.3",
"dgeni-packages": "^0.10.6",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-copy": "~0.4.1",
"grunt-contrib-uglify": "~0.2.2",
Expand Down

0 comments on commit b0cf25e

Please sign in to comment.