No commit activity in last 3 years
No release in over 3 years
Mix of `data-role`, `data-block` solutions from AI and kossnocorp for JQ, SLIM, HAML
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7
~> 10.0

Runtime

>= 0
 Project Readme

WARNING! DEPRECATED!

PLEASE, STUDY FOLLOWING SOLUTIONS: https://github.com/data-role-block

===

TheDataRoleBlockRails

Mix of data-role, data-block solutions from:

  1. https://github.com/ai/evil-blocks
  2. https://github.com/kossnocorp/role

Gem provide

marker @ for data-role and marker @@ for data-block for SLIM and HAML

@hello-world
  | Hello World

@@some-block
  | WebBrick

and 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

  1. data-block aka @@ for containers
  2. data-role aka @ 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='#') Woof

JS (CoffeeScript)

$ ->
  $('@btn-action').on 'click', (e) ->
    $('@@home a').addClass 'pet'
    false
    
  $('@@home a').on 'click', (e) ->
    link = $ e.target
    console.log link.text()
    false

Installation

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

MIT license