WARNING! DEPRECATED!
PLEASE, STUDY FOLLOWING SOLUTIONS: https://github.com/data-role-block
===
TheDataRoleBlockRails
Mix of data-role, data-block solutions from:
Gem provide
marker @ for data-role and marker @@ for data-block for SLIM and HAML
@hello-world
| Hello World
@@some-block
| WebBrickand JQ methods for data-role and data-block items
$ ->
$('@hello-world').addRole 'sunshine'
$('@hello-world').removeRole 'sunshine'
$('@hello-world').toggleRole 'sunshine'
$('@@some-block').addBlock 'stone'
$('@@some-block').removeBlock 'stone'
$('@@some-block').toggleBlock 'stone'DATA-ATTRIBUTES notice
I use
-
data-blockaka@@for containers -
data-roleaka@for items with handlers or for items with values
for example
SLIM
button@btn-action
@@home
| Hello World
a#bird(href='#') Tweet
a#cat(href='#') Meow
a#dog(href='#') WoofJS (CoffeeScript)
$ ->
$('@btn-action').on 'click', (e) ->
$('@@home a').addClass 'pet'
false
$('@@home a').on 'click', (e) ->
link = $ e.target
console.log link.text()
falseInstallation
Add this line to your application's Gemfile:
gem 'the_data_role_block_rails'And then execute:
bundle
Usage
app/assets/javascripts/application.js
//= require jquery.data-role-block