dev-master
9999999-dev https://github.com/fightmaster/FightmasterBootstrapBundle
MIT
The Requires
- php >=5.3.3
- symfony/framework-bundle >=2.0,<2.2-dev
by Dmitry Petrov aka fightmaster
bootstrap symfony twitter
These are the high-level design rules which guide the development of Bootstrap's plugin apis., (*1)
We believe you should be able to use all plugins provided by Bootstrap purely through the markup API without writing a single line of JavaScript. This is Bootstrap's first class API., (*2)
We acknowledge that this isn't always the most performant and it may sometimes be desirable to turn this functionality off altogether. Therefore, as of 2.0 we provide the ability to disable the data attribute API by unbinding all events on the body namespaced with 'data-api'
. This looks like this:, (*3)
$('body').off('.data-api')
To target a specific plugin, just include the plugins name as a namespace along with the data-api namespace like this:, (*4)
$('body').off('.alert.data-api')
We also believe you should be able to use all plugins provided by Bootstrap purely through the JavaScript API., (*5)
All public APIs should be single, chainable methods, and return the collection acted upon., (*6)
$(".btn.danger").button("toggle").addClass("fat")
All methods should accept an optional options object, a string which targets a particular method, or null which initiates the default behavior:, (*7)
$("#myModal").modal() // initialized with defaults $("#myModal").modal({ keyboard: false }) // initialized with no keyboard $("#myModal").modal('show') // initializes and invokes show immediately
Options should be sparse and add universal value. We should pick the right defaults., (*8)
All plugins should have a default object which can be modified to affect all instances' default options. The defaults object should be available via $.fn.plugin.defaults
., (*9)
$.fn.modal.defaults = { … }
An options definition should take the following form:, (*10)
*noun*: *adjective* - describes or modifies a quality of an instance
Examples:, (*11)
backdrop: true keyboard: false placement: 'top'
All events should have an infinitive and past participle form. The infinitive is fired just before an action takes place, the past participle on completion of the action., (*12)
show | shown hide | hidden
All infinitive events should provide preventDefault functionality. This provides the abililty to stop the execution of an action., (*13)
$('#myModal').on('show', function (e) { if (!data) return e.preventDefault() // stops modal from being shown })
Each plugin should expose its raw constructor on a Constructor
property -- accessed in the following way:, (*14)
$.fn.popover.Constructor
Each plugin stores a copy of the invoked class on an object. This class instance can be accessed directly through jQuery's data API like this:, (*15)
$('[rel=popover]').data('popover') instanceof $.fn.popover.Constructor
Data attributes should take the following form:, (*16)
Examples:, (*17)
// control other targets data-toggle="modal" data-target="#foo" data-toggle="collapse" data-target="#foo" data-parent="#bar" // defined on element they control data-spy="scroll" data-dismiss="modal" data-dismiss="alert" data-toggle="dropdown" data-toggle="button" data-toggle="buttons-checkbox" data-toggle="buttons-radio"
MIT
bootstrap symfony twitter