Project

vertebra

0.0
Low commit activity in last 3 years
No release in over a year
Mico-JS Framework based on the Backbone.View API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 3.1, <= 8.0
 Project Readme

Vertebra

Micro Coffeescript framework for use instead of Backbone.View to avoid requiring underscore and the whole backbone framework.

Supported Backbone.View features :

  • DOM Events delegation (with prototype.events property)
  • Class-level events API (listenTo / stopListening / on / off / trigger)
  • Automatic element assignation (this.$el) and scoped finders (this.$(selector))

Installation

Add to your Gemfile and bundle :

gem 'vertebra'

Require the framework :

//= require vertebra

Usage

Here's a simple example API usage covering most of the Vertebra supported features.

class MyPanel extends Vertebra.View
  events:
    'click .trigger-button': 'buttonClicked'

  # Like for Backbone, use the `#initialize` method isteand of `#constructor`
  # to hook into class instanciation
  #
  initialize: ->
    @form = new MyForm(el: @$('form'))
    # Class-level events API
    @listenTo(@form, 'submit', @onFormSubmit)

  buttonClicked: ->
    # Button clicked here

  onFormSubmit: ->
    # Form submitted here


class MyButton extends Vertebra.View
  events:
    'submit': 'onSubmit'

  onSubmit: ->
    @trigger('submit')

Licence

This project rocks and uses MIT-LICENSE.