0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-11-29 11:24:18 +01:00

fix up customizer js and classes; turn buttons into real buttons

This commit is contained in:
Mark Otto 2013-05-22 23:34:28 -07:00
parent 432d417ade
commit acc0875259
3 changed files with 29 additions and 25 deletions

View File

@ -97,6 +97,17 @@ body {
/* Customize and Download button
-------------------------------------------------- */
.bs-customizer {
}
.bs-customizer .toggle {
float: right;
}
.bs-customizer label {
margin-top: 10px;
}
.bs-customize-download {
text-align:center;
}

View File

@ -27,13 +27,6 @@
$('.bs-top').affix()
}, 100)
// add-ons
$('.add-on :checkbox').on('click', function () {
var $this = $(this)
, method = $this.attr('checked') ? 'addClass' : 'removeClass'
$(this).parents('.add-on')[method]('active')
})
// add tipsies to grid for scaffolding
if ($('#grid-system').length) {
$('#grid-system').tooltip({
@ -76,22 +69,22 @@
$('.bs-docs-carousel-example').carousel()
// javascript build logic
var inputsComponent = $("#components.download input")
, inputsPlugin = $("#plugins.download input")
, inputsVariables = $("#variables.download input")
var inputsComponent = $("#components input")
, inputsPlugin = $("#plugins input")
, inputsVariables = $("#variables input")
// toggle all plugin checkboxes
$('#components.download .toggle-all').on('click', function (e) {
$('#components .toggle').on('click', function (e) {
e.preventDefault()
inputsComponent.attr('checked', !inputsComponent.is(':checked'))
inputsComponent.prop('checked', !inputsComponent.is(':checked'))
})
$('#plugins.download .toggle-all').on('click', function (e) {
$('#plugins .toggle').on('click', function (e) {
e.preventDefault()
inputsPlugin.attr('checked', !inputsPlugin.is(':checked'))
inputsPlugin.prop('checked', !inputsPlugin.is(':checked'))
})
$('#variables.download .toggle-all').on('click', function (e) {
$('#variables .toggle').on('click', function (e) {
e.preventDefault()
inputsVariables.val('')
})
@ -99,16 +92,16 @@
// request built javascript
$('.download-btn .btn').on('click', function () {
var css = $("#components.download input:checked")
var css = $("#components input:checked")
.map(function () { return this.value })
.toArray()
, js = $("#plugins.download input:checked")
, js = $("#plugins input:checked")
.map(function () { return this.value })
.toArray()
, vars = {}
, img = ['glyphicons-halflings.png', 'glyphicons-halflings-white.png']
$("#variables.download input")
$("#variables input")
.each(function () {
$(this).val() && (vars[ $(this).prev().text() ] = $(this).val())
})

View File

@ -7,10 +7,10 @@ lead: Customize Bootstrap's components, LESS variables, and jQuery plugins to ge
<!-- Customize
================================================== -->
<form>
<form class="bs-customizer">
<div class="bs-docs-section" id="components">
<div class="page-header">
<a class="btn btn-default pull-right toggle-all" href="#">Toggle all</a>
<button class="btn btn-default toggle" type="button">Toggle all</button>
<h1>LESS components</h1>
</div>
<p class="lead">Choose which LESS files should be compiled into your custom stylesheets.</p>
@ -273,10 +273,10 @@ lead: Customize Bootstrap's components, LESS variables, and jQuery plugins to ge
</div>
</div>
</div>
<div class="bs-docs-section" id="plugins">
<div class="page-header">
<a class="btn btn-default pull-right toggle-all" href="#">Toggle all</a>
<button class="btn btn-default toggle" type="button">Toggle all</button>
<h1>jQuery plugins</h1>
</div>
<p class="lead">Choose which jQuery plugins should be included in your custom JavaScript files.</p>
@ -369,11 +369,11 @@ lead: Customize Bootstrap's components, LESS variables, and jQuery plugins to ge
<p>All checked plugins will be compiled into a single file, bootstrap.js. All plugins require the latest version of <a href="http://jquery.com/" target="_blank">jQuery</a> to be included.</p>
</div>
</div>
<div class="bs-docs-section" id="variables">
<div class="page-header">
<a class="btn btn-default pull-right toggle-all" href="#">Reset to defaults</a>
<button class="btn btn-default toggle" type="button">Reset to defaults</button>
<h1>LESS variables</h1>
</div>
<p class="lead">Customize LESS variables to define colors, sizes and more inside your custom CSS stylesheets.</p>