modularity-rails 0.29.0 → 0.30.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 65f2ce39342e4c93961f900aabf4c03b62feec63
4
- data.tar.gz: 23b288aaa60b08f814f664ede4605487cb69fe51
3
+ metadata.gz: 25dba21d976b604a2e44399fdd2b3898188bf33c
4
+ data.tar.gz: 5586725cd3912c2f899c79ad2b29818b2f34719d
5
5
  SHA512:
6
- metadata.gz: 7c6c1e2a371e3003c401780f624d3792890ccd92521a8de5741380496596c60dfd248f0ca07148b4ee68caa4d1cd00b8aea03822cdb74a72f1bebe77fc1541db
7
- data.tar.gz: 42576e03b20368447a62be4e6df4f475e79b7336ac346f642d59f39efde7bad459b4ba49323272a98462b2190932d34e14231b59b7f84bbe12aeac3aec249a99
6
+ metadata.gz: 4736d3136725af8ae0d42c42790ba52a994972c1dfc24c64edf3437d65c70b6a7fc0a9fb364732173bfe49976811dd124587bc3bfa493952be4b499bbf92595c
7
+ data.tar.gz: 5eee9530eb0a24a2f43b122985d89740ec4b391e09548575377897c6f2788b1e2454388e2d6144325a665b78323251ead8104c0f3ea8692ca9e8e98b0bc5f276
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Modularity::Rails [![Build Status](https://travis-ci.org/kevgo/modularity-rails.png?branch=master)](https://travis-ci.org/kevgo/modularity-rails) [![Dependency Status](https://gemnasium.com/kevgo/modularity-rails.png)](https://gemnasium.com/kevgo/modularity-rails)
2
2
 
3
- Makes the [Modularity CoffeeScript](http://github.com/kevgo/modularity-coffeescript) library and related modules available to
4
- Rails 3.1 applications.
3
+ Makes the [modularity.js](http://github.com/kevgo/modularity.js) library
4
+ available to Rails 3.1 applications.
5
5
 
6
6
  Modularity is a framework for lightweight component-oriented CoffeeScript.
7
7
  It allows to compose functionally rich web pages in a clean, intuitive, and testable way
data/Rakefile CHANGED
@@ -9,4 +9,3 @@ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
9
9
  load 'rails/tasks/engine.rake'
10
10
 
11
11
  Bundler::GemHelper.install_tasks
12
- task :default => 'app:konacha:run'
@@ -0,0 +1,3 @@
1
+ /*! modularity.js 0.30.0, copyright 2014 Kevin Goslar, see https://github.com/kevgo/modularity.js */
2
+ (function(){var a=function(a,b){return function(){return a.apply(b,arguments)}},b=[].slice;window.modularity={assert:function(a,b){return a&&0!==(null!=a?a.length:void 0)?!0:(alert(b),!1)},bind_global_event:function(a,b){return modularity.assert("string"==typeof a,"modularity.bind_global_event: parameter 'event_type' is empty")?"function"!=typeof b?alert("modularity.bind_global_event: parameter 'callback' must be a function, "+b+" ("+typeof b+") given."):modularity.global_event_container().bind(a,b):void 0},fire_global_event:function(a,b){return modularity.assert(a,"Module.fire_global_event: You must provide the event type to fire."),"string"!=typeof a?alert("Module.fire_global_event: Event type must be a string, "+a+" ("+typeof a+") given."):modularity.global_event_container().trigger(a,null!=b?b:b={})},global_event_container:function(){return modularity.global_event_container_cache||(modularity.global_event_container_cache=$(window))}},window.modularity.bindGlobalEvent=window.modularity.bind_global_event,window.modularity.fireGlobalEvent=window.modularity.fire_global_event,window.modularity.Module=function(){function c(b){this.trigger=a(this.trigger,this),this.on=a(this.on,this);var c,d,e,f,g,h,i,j,k,l,m=this;if("string"==typeof b&&"testing"!==b&&(b=$(b)),this.container=b,null==this.container)return alert("Error in Module constructor: No container given.");if("testing"!==b){if("string"!=typeof b.jquery)return alert("Error in Module constructor: The given container must be a jQuery object.");if(!(null!=b&&b.length>0))return alert("Error in Module constructor: The given container ('"+b.selector+"') is empty.");if(null==b||1!==b.length)return alert("Error in Module constructor: The given container ('"+b.selector+"') has more than one element.")}if(null!=this.mixins)for(i=this.mixins,g=0,h=i.length;h>g;g++){e=i[g],j=e.mixin,f=function(a,b){return m[a]?void 0:m[a]=function(){return b.apply(m,arguments)}};for(d in j)c=j[d],f(d,c);null!=(k=e.mixin)&&null!=(l=k.constructor)&&l.apply(this,arguments)}}return c.prototype.$=function(a,b){var c;return null==b&&(b={reportEmptyResults:!0}),c=this.container.find(a),0===c.length&&b.reportEmptyResults?alert("@$: element not found: "+c.selector):c},c.prototype.autobind=function(){var a,b,c,d,e,f,g,h,i,j;f=[],e=[];for(b in this)switch(typeof this[b]){case"object":f.push(b);break;case"function":modularity.string_starts_with(b,"on_")&&e.push(b)}for(g=0,i=f.length;i>g;g++)for(d=f[g],h=0,j=e.length;j>h;h++)a=e[h],modularity.string_starts_with(a,"on_"+d+"_")&&(c=a.substring(4+d.length),this[d].on(c,this[a]));return!1},c.prototype.on=function(a,b){return modularity.assert("string"==typeof a,"Module.bind_event: parameter 'event_type' is empty")?"function"!=typeof b?alert("Module.bind_event: parameter 'callback' must be a function, "+b+" ("+typeof b+") given."):this.container.bind(a,b):void 0},c.prototype.bindEvent=c.prototype.bind_event,c.prototype.bind_event=c.prototype.bind_event,c.prototype.trigger=function(a,b){return modularity.assert(a,"Module.fire_event: You must provide the event type to fire."),"string"!=typeof a?alert("Module.fire_event: Event type must be a string, "+a+" ("+typeof a+") given."):this.container.trigger(a,null!=b?b:b={})},c.prototype.fireEvent=c.prototype.fire_event,c.prototype.fire_event=c.prototype.fire_event,c.prototype.hide=function(){return this.container.hide(),this.container.trigger("hide")},c.mixin=function(){var a,c,d;return a=arguments[0],c=2<=arguments.length?b.call(arguments,1):[],a||alert("mixin not found"),(d=this.prototype).mixins||(d.mixins=[]),this.prototype.mixins.push({mixin:a,params:c})},c.prototype.show=function(){return this.container.show(),this.container.trigger("show")},c.prototype.visible=function(){return this.container.is(":visible")},c}(),window.modularity.string_starts_with=function(a,b){return a.substring(0,b.length)===b}}).call(this);
3
+
@@ -1,3 +1,3 @@
1
1
  module ModularityRails
2
- VERSION = '0.29.0'
2
+ VERSION = '0.30.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modularity-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.29.0
4
+ version: 0.30.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Goslar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-30 00:00:00.000000000 Z
11
+ date: 2014-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -24,91 +24,7 @@ dependencies:
24
24
  - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.1.0
27
- - !ruby/object:Gem::Dependency
28
- name: coffee-rails
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - '>='
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - '>='
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: jquery-rails
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - '>='
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - '>='
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: guard-livereload
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - '>='
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: konacha
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - '>='
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - '>='
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: selenium-webdriver
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - '>='
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - '>='
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: sqlite3
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - '>='
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - '>='
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- description: Makes the modularity-coffee framework available to Ruby on Rails applications.
27
+ description: Makes the modularity.js framework available to Ruby on Rails applications.
112
28
  email:
113
29
  - kevin.goslar@gmail.com
114
30
  executables: []
@@ -117,12 +33,9 @@ extra_rdoc_files: []
117
33
  files:
118
34
  - app/assets/javascripts/modularity/mixins/clickable.coffee
119
35
  - app/assets/javascripts/modularity/mixins/closable.coffee
120
- - app/assets/javascripts/modularity/modularity.coffee
121
36
  - app/assets/javascripts/modularity/modules/autogrow_textarea.coffee
122
37
  - app/assets/javascripts/modularity/modules/button.coffee
123
- - app/assets/javascripts/modularity/tools/array_tools.coffee
124
- - app/assets/javascripts/modularity/tools/object_tools.coffee
125
- - app/assets/javascripts/modularity/tools/string_tools.coffee
38
+ - app/assets/javascripts/modularity.min.js
126
39
  - lib/modularity-rails/engine.rb
127
40
  - lib/modularity-rails/version.rb
128
41
  - lib/modularity-rails.rb
@@ -151,6 +64,6 @@ rubyforge_project:
151
64
  rubygems_version: 2.0.14
152
65
  signing_key:
153
66
  specification_version: 4
154
- summary: A lightweight, object- and component-oriented CoffeeScript framework for
155
- Ruby on Rails applications.
67
+ summary: A lightweight, object- and component-oriented JavaScript framework for Ruby
68
+ on Rails applications.
156
69
  test_files: []
@@ -1,139 +0,0 @@
1
- #= require_self
2
- #= require ./tools/string_tools
3
-
4
- # The Modularity framework written specificially for CoffeeScript.
5
- #
6
- # Use UglifyJS (http://github.com/mishoo/UglifyJS) for compression.
7
- #
8
- # Please see https://github.com/kevgo/modularity for more information on Modularity,
9
- # and https://github.com/kevgo/modularity-rails for Rails integration.
10
-
11
-
12
- @modularity = {
13
-
14
- # Checks whether the given condition is true.
15
- # Shows an alert with the given message if not.
16
- assert: (condition, message) ->
17
- if !condition or condition?.length == 0
18
- alert message
19
- return false
20
- true
21
-
22
-
23
- # GLOBAL EVENTS.
24
-
25
- # Subscribes to the given global event,
26
- # i.e. calls the given function when the given global event type happens.
27
- bind_global_event: (event_type, callback) ->
28
- return unless modularity.assert typeof event_type == 'string', "modularity.bind_global_event: parameter 'event_type' is empty"
29
- return alert "modularity.bind_global_event: parameter 'callback' must be a function, #{callback} (#{typeof callback}) given." unless typeof callback == 'function'
30
- modularity.global_event_container().bind event_type, callback
31
-
32
- # Fires the given global event with the given data payload.
33
- fire_global_event: (event_type, data) ->
34
- modularity.assert event_type, 'Module.fire_global_event: You must provide the event type to fire.'
35
- return alert("Module.fire_global_event: Event type must be a string, #{event_type} (#{typeof event_type}) given.") unless typeof event_type == 'string'
36
- modularity.global_event_container().trigger event_type, data ?= []
37
-
38
- # Returns the DOM object that is used to fire global events on.
39
- global_event_container: -> modularity.global_event_container_cache or= $(window)
40
- }
41
- @modularity.bindGlobalEvent = @modularity.bind_global_event
42
- @modularity.fireGlobalEvent = @modularity.fire_global_event
43
-
44
-
45
- class @modularity.Module
46
-
47
- # The container variable is required. Provide 'testing' in tests.
48
- constructor: (container) ->
49
- container = $(container) if (typeof container == 'string') and container != 'testing'
50
- @container = container
51
-
52
- return alert 'Error in Module constructor: No container given.' unless @container?
53
- if container != 'testing'
54
- return alert 'Error in Module constructor: The given container must be a jQuery object.' unless typeof container.jquery == 'string'
55
- return alert "Error in Module constructor: The given container ('#{container.selector}') is empty." unless container? and container.length > 0
56
- return alert "Error in Module constructor: The given container ('#{container.selector}') has more than one element." unless container? and container.length == 1
57
-
58
-
59
- # Attach mixins.
60
- if @mixins?
61
- for mixin_data in @mixins
62
-
63
- # Attach all properties from mixin to the prototype.
64
- for methodName, method of mixin_data.mixin
65
- do (methodName, method) => unless @[methodName]
66
- @[methodName] = => method.apply(@, arguments)
67
-
68
- # Call constructor function from mixin.
69
- mixin_data.mixin?.constructor?.apply(@, arguments)
70
-
71
-
72
- # Runs the given query within the container element.
73
- $: (query, options = { reportEmptyResults: yes }) ->
74
- result = @container.find query
75
- return alert "@$: element not found: #{result.selector}" if result.length == 0 and options['reportEmptyResults']
76
- result
77
-
78
-
79
- # MODULE EVENTS.
80
-
81
- # Automatically binds events to member elements.
82
- autobind: ->
83
- my_fields = []
84
- my_callbacks = []
85
- for element of @
86
- switch typeof @[element]
87
- when 'object'
88
- my_fields.push element
89
- when 'function'
90
- my_callbacks.push(element) if modularity.string_starts_with element, 'on_'
91
- for field in my_fields
92
- for callback in my_callbacks
93
- if modularity.string_starts_with callback, "on_#{field}_"
94
- event_name = callback.substring 4 + field.length
95
- @[field].on event_name, @[callback]
96
- false
97
-
98
-
99
- # Calls the given function when this widget fires the given local event.
100
- on: (event_type, callback) =>
101
- return unless modularity.assert typeof event_type == 'string', "Module.bind_event: parameter 'event_type' is empty"
102
- return alert "Module.bind_event: parameter 'callback' must be a function, #{callback} (#{typeof callback}) given." unless typeof callback == 'function'
103
- @container.bind event_type, callback
104
- bindEvent: Module::bind_event
105
- bind_event: Module::bind_event
106
-
107
-
108
- # Fires the given local event with the given data payload.
109
- trigger: (event_type, data) =>
110
- modularity.assert event_type, 'Module.fire_event: You must provide the event type to fire.'
111
- return alert("Module.fire_event: Event type must be a string, #{event_type} (#{typeof event_type}) given.") unless typeof event_type == 'string'
112
- @container.trigger event_type, data ?= {}
113
- fireEvent: Module::fire_event
114
- fire_event: Module::fire_event
115
-
116
-
117
- # Hides this module.
118
- hide: ->
119
- @container.hide()
120
- @container.trigger 'hide'
121
-
122
-
123
- # mixin = constructor of Draggable
124
- # self = Card
125
- @mixin: (mixin, p...) ->
126
- alert("mixin not found") unless mixin
127
- @prototype.mixins or= []
128
- @prototype.mixins.push({mixin: mixin, params: p})
129
-
130
-
131
- # Shows this module.
132
- show: ->
133
- @container.show()
134
- @container.trigger 'show'
135
-
136
-
137
- # Returns whether this module is currently visible.
138
- visible: ->
139
- @container.is ':visible'
@@ -1,6 +0,0 @@
1
- # Returns a copy of the given array with duplicates removed.
2
- modularity.array_unique = (array) ->
3
- output = {}
4
- output[array[i]] = array[i] for i in [0...array.length]
5
- value for key, value of output
6
-
@@ -1,31 +0,0 @@
1
- # Returns a replica of the given hash.
2
- # Don't use this method for real objects with superclasses, prototypes, and stuff.
3
- modularity.clone_hash = (obj) ->
4
- result = {}
5
- result[key] = value for own key, value of obj
6
- result
7
-
8
-
9
- # Returns an object that contains only the attributes
10
- # that are different between obj_1 and obj_2.
11
- # Only looks for changed attributes, not missing attributes.
12
- modularity.object_diff = (obj_1, obj_2) ->
13
- result = {}
14
- for own key, value_2 of obj_2
15
- do (key, value_2) ->
16
- value_1 = obj_1[key]
17
- result[key] = value_2 if value_1 != value_2
18
- result
19
-
20
-
21
- # Returns the number of attributes of the given object.
22
- # NOTE(KG): This doesn't work in IE8.
23
- modularity.object_length = (obj) ->
24
- Object.keys(obj).length
25
-
26
-
27
- # Allows to populate the given object through a callback.
28
- modularity.tap = (obj, callback) ->
29
- callback obj
30
- obj
31
-
@@ -1,3 +0,0 @@
1
- modularity.string_starts_with = (string, start) ->
2
- string.substring(0, start.length) == start
3
-