transponder 0.0.1 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/assets/javascripts/transponder.coffee +11 -0
- data/lib/transponder.rb +4 -2
- metadata +20 -19
- data/.gitignore +0 -17
- data/Gemfile +0 -4
- data/Rakefile +0 -1
- data/lib/transponder/engine.rb +0 -6
- data/lib/transponder/version.rb +0 -3
- data/transponder.gemspec +0 -19
- data/vendor/assets/javascripts/.DS_Store +0 -0
- data/vendor/assets/javascripts/error.coffee +0 -12
- data/vendor/assets/javascripts/init.coffee +0 -11
- data/vendor/assets/javascripts/presenter.coffee +0 -64
- data/vendor/assets/javascripts/request.coffee +0 -13
- data/vendor/assets/javascripts/service.coffee +0 -0
- data/vendor/assets/javascripts/setup.coffee +0 -1
- data/vendor/assets/javascripts/transponder.coffee +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d094cd6ef47d3bc712d1647d17b4b5c68011ff10
|
4
|
+
data.tar.gz: 9b13bddf38ff70a3fe0c4f737c49ed70f8a8aebe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce68924a068a7bf1ea96c5c481c3e679e8c593d0e55515d2c4dbfda76c0dc5a75649c96a1adabdc80da5446909748e701b4a4f5c5b4eda9e455e8d5eb1d7865b
|
7
|
+
data.tar.gz: d712bb28e15ab17f64d4a3e32bbd0cbaf8e930ee0e04ca8568c3fec8cd0dfea9f748da9a8b3ea8cd88573fb3ef910d90b5bb15a905735519593ca0cc91eb2127
|
data/lib/transponder.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: transponder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zack Siri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
12
|
-
dependencies:
|
11
|
+
date: 2013-05-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: coffee-rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
description: A Cleaner way of working with rails frontend code
|
14
28
|
email:
|
15
29
|
- zack@artellectual.com
|
@@ -17,23 +31,10 @@ executables: []
|
|
17
31
|
extensions: []
|
18
32
|
extra_rdoc_files: []
|
19
33
|
files:
|
20
|
-
- .
|
21
|
-
- Gemfile
|
22
|
-
- LICENSE.txt
|
23
|
-
- README.md
|
24
|
-
- Rakefile
|
34
|
+
- lib/assets/javascripts/transponder.coffee
|
25
35
|
- lib/transponder.rb
|
26
|
-
-
|
27
|
-
-
|
28
|
-
- transponder.gemspec
|
29
|
-
- vendor/assets/javascripts/.DS_Store
|
30
|
-
- vendor/assets/javascripts/error.coffee
|
31
|
-
- vendor/assets/javascripts/init.coffee
|
32
|
-
- vendor/assets/javascripts/presenter.coffee
|
33
|
-
- vendor/assets/javascripts/request.coffee
|
34
|
-
- vendor/assets/javascripts/service.coffee
|
35
|
-
- vendor/assets/javascripts/setup.coffee
|
36
|
-
- vendor/assets/javascripts/transponder.coffee
|
36
|
+
- README.md
|
37
|
+
- LICENSE.txt
|
37
38
|
homepage: http://github.com/zacksiri/transponder
|
38
39
|
licenses: []
|
39
40
|
metadata: {}
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
data/lib/transponder/engine.rb
DELETED
data/lib/transponder/version.rb
DELETED
data/transponder.gemspec
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'transponder/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |gem|
|
7
|
-
gem.name = "transponder"
|
8
|
-
gem.version = Transponder::VERSION
|
9
|
-
gem.authors = ["Zack Siri"]
|
10
|
-
gem.email = ["zack@artellectual.com"]
|
11
|
-
gem.description = %q{A Cleaner way of working with rails frontend code}
|
12
|
-
gem.summary = %q{This library gives you more control over rails ujs, it compliments turbolinks, and any other library you use. It is opinionated and helps you clean up your client side code in many ways.}
|
13
|
-
gem.homepage = "http://github.com/zacksiri/transponder"
|
14
|
-
|
15
|
-
gem.files = `git ls-files`.split($/)
|
16
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
-
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
-
gem.require_paths = ["lib"]
|
19
|
-
end
|
Binary file
|
@@ -1,12 +0,0 @@
|
|
1
|
-
class Transponder.Error
|
2
|
-
response: null
|
3
|
-
|
4
|
-
constructor: ->
|
5
|
-
doc = $(document)
|
6
|
-
doc.ajaxError(@handleError)
|
7
|
-
|
8
|
-
handleError: (event, xhr, settings, error) ->
|
9
|
-
unless xhr.responseText is ""
|
10
|
-
@response = JSON.parse(xhr.responseText)
|
11
|
-
eventType = Transponder.buildEvent ['ujs', @response.namespace, @response.controller, @response.action]
|
12
|
-
$(document).trigger(eventType, @response)
|
@@ -1,64 +0,0 @@
|
|
1
|
-
class Transponder.Presenter
|
2
|
-
defaultActions: ['new', 'index', 'show', 'update', 'edit', 'create', 'destroy']
|
3
|
-
params: {}
|
4
|
-
|
5
|
-
presenterName: null
|
6
|
-
nameSpace: null
|
7
|
-
modelName: null
|
8
|
-
|
9
|
-
element: null
|
10
|
-
response: null
|
11
|
-
|
12
|
-
constructor: (options = {}) ->
|
13
|
-
options.presenterName = @presenterName unless options.presenterName
|
14
|
-
options.nameSpace = @nameSpace unless options.nameSpace
|
15
|
-
options.actions = @defaultActions unless options.actions
|
16
|
-
|
17
|
-
doc = $(document)
|
18
|
-
events = []
|
19
|
-
for action in options.actions
|
20
|
-
events.push(Transponder.buildEvent(['ujs', options.nameSpace, options.presenterName, action]))
|
21
|
-
doc.on(events.join(' '), @runAction)
|
22
|
-
|
23
|
-
elify: (event, response) ->
|
24
|
-
if @response.errors
|
25
|
-
if @response.id then "##{@modelName}_#{@response.id}" else "#new_#{@modelName}"
|
26
|
-
else
|
27
|
-
"#{event.target.localName}##{event.target.id}"
|
28
|
-
|
29
|
-
beforeFilter: (event, response) ->
|
30
|
-
@response = response
|
31
|
-
@element = @elify(event, response)
|
32
|
-
@params = Transponder.req.objectifyParams()
|
33
|
-
|
34
|
-
runAction: (event, response) =>
|
35
|
-
@beforeFilter(event, response)
|
36
|
-
if @response.errors
|
37
|
-
@errorOut()
|
38
|
-
else
|
39
|
-
@[event.type.split(':').pop()]()
|
40
|
-
@afterFilter(event, response)
|
41
|
-
|
42
|
-
afterFilter: (event, response) ->
|
43
|
-
|
44
|
-
|
45
|
-
triggerEmpty: (eventName) ->
|
46
|
-
console.log "#{eventName} triggered! Override this action in your own controller"
|
47
|
-
|
48
|
-
errorOut: ->
|
49
|
-
console.log "an error has occured!"
|
50
|
-
|
51
|
-
index: ->
|
52
|
-
@triggerEmpty('Index')
|
53
|
-
show: ->
|
54
|
-
@triggerEmpty('Show')
|
55
|
-
new: ->
|
56
|
-
@triggerEmpty('New')
|
57
|
-
edit: ->
|
58
|
-
@triggerEmpty('Edit')
|
59
|
-
update: ->
|
60
|
-
@triggerEmpty('Update')
|
61
|
-
create: ->
|
62
|
-
@triggerEmpty('Create')
|
63
|
-
destroy: ->
|
64
|
-
@triggerEmpty('Destroy')
|
@@ -1,13 +0,0 @@
|
|
1
|
-
class Transponder.Request
|
2
|
-
url: ''
|
3
|
-
|
4
|
-
constructor: ->
|
5
|
-
$(document).on 'ajax:beforeSend', (event, xhr, settings) =>
|
6
|
-
@url = ''
|
7
|
-
@url = settings.url
|
8
|
-
|
9
|
-
objectifyParams: ->
|
10
|
-
if @url.split('?').length is 2
|
11
|
-
JSON.parse('{"' + @url.split('?')[1].replace(/&/g, "\",\"").replace(/\=/g,"\":\"") + '"}')
|
12
|
-
else
|
13
|
-
{}
|
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
window.Transponder = {}
|