Skip to content

Commit 6cad9dc

Browse files
committed
docs: jsdoc template improvements + content reorganizing
1 parent 1eb92eb commit 6cad9dc

31 files changed

+479
-433
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ and then building the code using `npm run build`.
4343
<a href="https://github.com/farbelous/bootstrap-colorpicker/tree/v2.x">v2.x</a> <br>
4444
<a href="https://farbelous.github.io/bootstrap-colorpicker/v2">Documentation</a>
4545
</td>
46-
<td>Bootstrap 3 & 4</td>
46+
<td>(any)</td>
4747
<td>
4848
<ul>
4949
<li>jQuery >= 1.10</li>

src/docs/example.hbs

+6-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@
1414
</div>
1515
</div>
1616
<div class="card-footer">
17-
<div class="card-footer--legend">Code</div>
18-
<pre class="example-code prettyprint lang-html">
19-
{{~#code}}{{~#block "code"}}{{~/block}}{{~/code}}</pre>
17+
<button class="btn btn-outline-secondary btn-sm example-code-trigger">Show code</button>
18+
<div class="example-code-container">
19+
<div class="card-footer--legend">Code</div>
20+
<pre class="example-code prettyprint lang-html">
21+
{{~#code}}{{~#block "code"}}{{~/block}}{{~/code}}</pre>
22+
</div>
2023
</div>
2124
</div>
2225
</div>

src/docs/examples.json

+7-22
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,19 @@
22
"Basics": {
33
"title": "Getting started"
44
},
5-
"Bootstrap": {
6-
"title": "Bootstrap integration"
5+
"p02_Advanced_Examples": {
6+
"title": "Advanced examples"
77
},
8-
"ColorApi": {
9-
"title": "Color manipulation"
8+
"p03_Colorpicker_Events": {
9+
"title": "Events"
1010
},
11-
"ColorSwatches": {
12-
"title": "Color swatches"
13-
},
14-
"CustomSize": {
15-
"title": "Custom size"
16-
},
17-
"CustomTemplate": {
18-
"title": "Custom template"
19-
},
20-
"DebugMode": {
21-
"title": "Debug mode"
22-
},
23-
"Events": {
24-
"title": "Event handling"
25-
},
26-
"ExtensionApi": {
11+
"p04_Colorpicker_Extensions": {
2712
"title": "Extensions"
2813
},
29-
"legacy_docs": {
14+
"p05_OlderVersions": {
3015
"title": "Older versions"
3116
},
32-
"project_donations": {
17+
"p06_SupportUs": {
3318
"title": "Support this project"
3419
}
3520
}

src/docs/examples/Basics.hbs

+72-11
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@
22
{{#content "description"}}
33
<p>
44
Get started with these basic examples, showcasing the different plugin options.
5-
You can also view the whole list of <a href="options.js.html">default options here.</a>
6-
<br>
7-
Note that all examples are using Bootstrap 4.1.x.
8-
<br>
9-
To make them work with Bootstrap 3.x, you basically need to tweak the HTML code by replacing
10-
`input-group-append` with `input-group-addon`.
5+
You can also view the whole list of <a href="module-options.html">default options here.</a>
116
</p>
127
{{/content}}
138
{{#content "body"}}
@@ -91,8 +86,8 @@
9186
<p>
9287
Whenever the <code>format</code> option is <var>'auto'</var>, the first parsed color format will be
9388
detected and used as default, but when the option equals <var>null</var> (default),
94-
the format is recalculated every time. You can see the differences here, when trying to adjust the alpha
95-
channel:
89+
the format is recalculated every time.
90+
You can see the differences here, one of them allowing you to adjust the alpha channel:
9691
</p>
9792
{{/content}}
9893
{{#content "code"}}
@@ -137,7 +132,7 @@
137132
<script>
138133
$(function () {
139134
$('#cp5c').colorpicker({
140-
format: "rgba"
135+
format: "rgb"
141136
});
142137
});
143138
</script>
@@ -277,7 +272,7 @@
277272

278273

279274
{{#extend "example"}}
280-
{{#content "title"}} Custom fallback color {{/content}}
275+
{{#content "title"}} Use a custom fallback color {{/content}}
281276
{{#content "description"}}
282277
<p>
283278
Use a predefined fallback color with the <code>fallbackColor</code> option,
@@ -303,7 +298,7 @@
303298

304299

305300
{{#extend "example"}}
306-
{{#content "title"}} Invalid color auto-replacement {{/content}}
301+
{{#content "title"}} Disable invalid color auto replacement {{/content}}
307302
{{#content "description"}}
308303
<p>
309304
By default, the <code>autoInputFallback</code> option is enabled, meaning that
@@ -336,6 +331,72 @@
336331
{{/content}}
337332
{{/extend}}
338333

334+
{{#extend "example"}}
335+
{{#content "title"}} Adjust the popover options{{/content}}
336+
{{#content "description"}}
337+
<p>
338+
You can use any Bootstrap Popover options (except: trigger, content and html) using the "popover"
339+
property in the colorpicker options.
340+
</p>
341+
{{/content}}
342+
{{#content "code"}}
343+
<div id="cp14" class="input-group">
344+
<input type="text" class="form-control input-lg" value="hsl(103, 70%, 64%)"/>
345+
<span class="input-group-append">
346+
<span class="input-group-text colorpicker-input-addon"><i></i></span>
347+
</span>
348+
</div>
349+
<script>
350+
$(function () {
351+
$('#cp14').colorpicker({
352+
popover: {
353+
title: 'Adjust the color',
354+
placement: 'top'
355+
}
356+
});
357+
});
358+
</script>
359+
{{/content}}
360+
{{/extend}}
361+
362+
{{#extend "example"}}
363+
{{#content "title"}} Use a color picker inside a modal {{/content}}
364+
{{#content "description"}}{{/content}}
365+
{{#content "code"}}
366+
<!-- Button trigger modal -->
367+
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
368+
Launch demo modal
369+
</button>
370+
371+
<!-- Modal -->
372+
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog"
373+
aria-labelledby="exampleModalLabel" aria-hidden="true">
374+
<div class="modal-dialog" role="document">
375+
<div class="modal-content">
376+
<div class="modal-header">
377+
<h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
378+
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
379+
<span aria-hidden="true">&times;</span>
380+
</button>
381+
</div>
382+
<div class="modal-body">
383+
<input id="cp15" type="text" class="form-control input-lg" value="rgb(130, 44, 29)"/>
384+
</div>
385+
<div class="modal-footer">
386+
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
387+
<button type="button" class="btn btn-primary">Save changes</button>
388+
</div>
389+
</div>
390+
</div>
391+
</div>
392+
<script>
393+
$(function () {
394+
$('#cp15').colorpicker();
395+
});
396+
</script>
397+
{{/content}}
398+
{{/extend}}
399+
339400

340401
{{/content}}
341402
{{/extend}}

src/docs/examples/Bootstrap.hbs

-80
This file was deleted.

src/docs/examples/ColorApi.hbs

-62
This file was deleted.

src/docs/examples/ColorSwatches.hbs

-48
This file was deleted.

0 commit comments

Comments
 (0)