0.0
No commit activity in last 3 years
No release in over 3 years
The additional library for javaScript.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 3.0.0
>= 0
 Project Readme

Appjs::Rails

Gem Version Dependency Status

The additional library for javaScript

Installation

Add this line to your application's Gemfile:

gem 'appjs-rails'

And then execute:

$ bundle

Or install it yourself as:

$ gem install appjs-rails

The app file will be added to the asset pipeline when you in file app/assets/javascripts/application.js add this line:

//= require app

Usage

Creation new singleton without initialize

app._singleton.add('example', function() {
  return {
    toString: 'Class Example'
  }
} );
app.example.init();
app.example.toString; // 'Class Example'

Creation new singleton with initialize

app._singleton.init('example', function() {
  return {
    toString: 'Class Example'
  }
} );
app.example.toString; // 'Class Example'

Generation UUID

app._uuid(); //6b644386-6ccb-98af-1144-6b8de194387a

We can Extend Array object by using function

app._config.array()

Now all Array object has got functions

[1, 2, 3].equal('2, 3'); // false

[1, 2, 3].any(); // true

[1, 2, 3].empty(); // false

['1', '2', '3'].each(function(item) {console.log('item: ' + item)} );

['1', '2', '3'].erase(); // []

['1', '2', '3'].first(); // 1

[].first(); // undefined

['a', 'b'].last(); // 'b'

For Bootstrap 3

Adding a counter that counts how many characters left to use Use requires the following steps:

  • You must add initializer into script
  app._bootstrap.inputDownCounter();
  • Adding class 'js-input-down-counter-x' (where x is a limit to down count) into an input tag.

For Example

  <div class="form-group">
    <label class="col-lg-3 control-label">Name</label>
    <div class="controls">
      <input type='text' class='form-control js-input-down-counter-20" value='Example'>
    </div>
  </div>

License

appjs-rails uses the MIT license. Please check the LICENSE file for more details.