55. /*****************************************************************************
*
* UI » Flyout
*
* Flyouts are those UI components that look like tooltip, and
* are activated when the user clicks on a link. The flyout window
* opens text to the link, like those present on the iPad.
*
* **Usage**
*
* <div class="flyout-container">
* <div class="flyout [vertical-position]-[horizontal-position]-flyout">
* Flyout content
* </div>
* </div>
*
*****************************************************************************/
.flyout-container {
position: relative;
z-index: 100; // may be adjusted as needed through a context
}
.flyout {
@include box-sizing(border-box);
background: #f9f9f9;
border-radius: 2px;
border: 1px solid #d5d5d5;
box-shadow: 0 2px 0 rgba(0, 0, 0, .1);
display: none;
position: absolute;
// tip
&:after {
content: "";
display: block;
width: 40px;
height: 22px;
background: sprite($icon-sprite, tooltip_top_large_gray) no-repeat;
position: absolute;
}
}
...
101. Define namespaces e coloca
açúcar sintático na definição
de funções construtoras.
102. window.EDEN = window.EDEN || {};
EDEN.forms = EDEN.forms || {};
EDEN.forms.AddressForm = function (el) {
this.element = $(el);
this.init();
}
$.extend(EDEN.forms.AddressForm.prototype, {
// Public methods
// --------------
// Inits the instance
init : function () {
// Do something
}
});
var shippingAddressForm = new EDEN.forms.AddressForm($("#shipping-address"));
103. Module("EDEN.forms.AddressForm", function (AddressForm) {
AddressForm.fn.initialize = function (el) {
this.element = $(el);
// Do form stuff
}
});
var shippingAddressForm = Module.run("EDEN.forms.AddressForm", $("#shipping-address"));
// or
var shippingAddressForm = new EDEN.forms.AddressForm($("#shipping-address"));
111. MEDIATOR
Mediator, saiu um eppy novo
de Game of Thrones.
Subscribers, saiu um eppy
novo de Game of Thrones!
Ae, vou baixar, acho
que vai ser feliz e tal
=D
112. MEDIATOR
Mediator, saiu um eppy novo
de Mythbusters.
Subscribers, saiu um eppy
novo de Mythbusters!
Ae, vou baixar!
119. describe("EDEN.ui.Loader", function () {
var Loader = EDEN.ui.Loader;
beforeEach(function () {
loadFixtures("loader.html");
});
afterEach(function () {
$("body").find(".loader").remove();
});
it("accepts instance creation without new operator", function () {
var newLoader = Loader();
expect(newLoader).toBeInstanceOf(Loader);
});
it("appends the loader to body as a default", function () {
var loader = new Loader();
expect($("body").find(".loader").length).toEqual(1);
});
it("appends the loader through an argument function", function () {
var loader = new Loader(function ($loader) {
$("#loader-placeholder").append($loader);
});
expect($("#loader-placeholder").find(".loader").length).toEqual(1);
});
});
120. "Mas se eu escrever teste
de JavaScript, eu não
entrego o projeto!"
121.
122. (e os testes de JavaScript quebram o build do CI.)
180. Alta performance client-side
Interface facilmente modificável
Componentes portáveis entre diferentes aplicações
Bulletproof web design
Tipografia e grids flexíveis, responsive-ready
Baixa barreira de entrada para outros
desenvolvedores