coyote 1.0.0.beta1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest +22 -1
- data/coyote.gemspec +4 -4
- data/lib/coyote.rb +2 -2
- data/lib/coyote.rb.orig +79 -0
- data/test/src/public/assets/javascripts/app/application/interface.coffee +10 -0
- data/test/src/public/assets/javascripts/app/application/main.coffee +14 -0
- data/test/src/public/assets/javascripts/app/application/pages/home.coffee +9 -0
- data/test/src/public/assets/javascripts/app/boot.coffee +1 -0
- data/test/src/public/assets/javascripts/lib/imulus.coffee +7 -0
- data/test/src/public/assets/javascripts/lib/imulus/forms.coffee +46 -0
- data/test/src/public/assets/javascripts/lib/imulus/maps/infowindow.coffee +37 -0
- data/test/src/public/assets/javascripts/lib/imulus/maps/map.coffee +51 -0
- data/test/src/public/assets/javascripts/lib/imulus/maps/marker.coffee +66 -0
- data/test/src/public/assets/javascripts/lib/imulus/maps/point.coffee +5 -0
- data/test/src/public/assets/javascripts/lib/imulus/maps/results.coffee +117 -0
- data/test/src/public/assets/javascripts/lib/imulus/tables.coffee +11 -0
- data/test/src/public/assets/javascripts/lib/imulus/triggers.coffee +26 -0
- data/test/src/public/assets/javascripts/scripts.coffee +14 -0
- data/test/src/public/assets/javascripts/vendor/jquery.js +18 -0
- data/test/src/public/assets/javascripts/vendor/jquery/jquery.cookie.js +89 -0
- data/test/src/public/assets/javascripts/vendor/jquery/jquery.cycle.js +21 -0
- data/test/src/public/assets/javascripts/vendor/jquery/jquery.query.js +224 -0
- data/test/src/public/assets/javascripts/vendor/swfobject.js +4 -0
- data/test/src/public/scripts/scripts.combine +18 -0
- data/test/src/public/scripts/scripts.js +944 -0
- metadata +35 -12
data/Manifest
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
README.md
|
2
2
|
Rakefile
|
3
3
|
bin/coyote
|
4
|
-
coyote.gemspec
|
5
4
|
lib/coyote.rb
|
5
|
+
lib/coyote.rb.orig
|
6
6
|
lib/coyote/asset.rb
|
7
7
|
lib/coyote/assets/coffeescript.rb
|
8
8
|
lib/coyote/assets/javascript.rb
|
@@ -23,4 +23,25 @@ test/scripts/lib/input5.coffee
|
|
23
23
|
test/scripts/lib/input6.js
|
24
24
|
test/scripts/lib/keystone/input7.js
|
25
25
|
test/scripts/vendor/input8.coffee
|
26
|
+
test/src/public/assets/javascripts/app/application/interface.coffee
|
27
|
+
test/src/public/assets/javascripts/app/application/main.coffee
|
28
|
+
test/src/public/assets/javascripts/app/application/pages/home.coffee
|
29
|
+
test/src/public/assets/javascripts/app/boot.coffee
|
30
|
+
test/src/public/assets/javascripts/lib/imulus.coffee
|
31
|
+
test/src/public/assets/javascripts/lib/imulus/forms.coffee
|
32
|
+
test/src/public/assets/javascripts/lib/imulus/maps/infowindow.coffee
|
33
|
+
test/src/public/assets/javascripts/lib/imulus/maps/map.coffee
|
34
|
+
test/src/public/assets/javascripts/lib/imulus/maps/marker.coffee
|
35
|
+
test/src/public/assets/javascripts/lib/imulus/maps/point.coffee
|
36
|
+
test/src/public/assets/javascripts/lib/imulus/maps/results.coffee
|
37
|
+
test/src/public/assets/javascripts/lib/imulus/tables.coffee
|
38
|
+
test/src/public/assets/javascripts/lib/imulus/triggers.coffee
|
39
|
+
test/src/public/assets/javascripts/scripts.coffee
|
40
|
+
test/src/public/assets/javascripts/vendor/jquery.js
|
41
|
+
test/src/public/assets/javascripts/vendor/jquery/jquery.cookie.js
|
42
|
+
test/src/public/assets/javascripts/vendor/jquery/jquery.cycle.js
|
43
|
+
test/src/public/assets/javascripts/vendor/jquery/jquery.query.js
|
44
|
+
test/src/public/assets/javascripts/vendor/swfobject.js
|
45
|
+
test/src/public/scripts/scripts.combine
|
46
|
+
test/src/public/scripts/scripts.js
|
26
47
|
Manifest
|
data/coyote.gemspec
CHANGED
@@ -2,17 +2,17 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{coyote}
|
5
|
-
s.version = "1.0.0
|
5
|
+
s.version = "1.0.0"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Imulus"]
|
9
|
-
s.date = %q{2012-02-
|
9
|
+
s.date = %q{2012-02-14}
|
10
10
|
s.default_executable = %q{coyote}
|
11
11
|
s.description = %q{An intelligent command-line tool for combining, compressing and compiling your JavaScript and CoffeeScript files.}
|
12
12
|
s.email = %q{developer@imulus.com}
|
13
13
|
s.executables = ["coyote"]
|
14
|
-
s.extra_rdoc_files = ["README.md", "bin/coyote", "lib/coyote.rb", "lib/coyote/asset.rb", "lib/coyote/assets/coffeescript.rb", "lib/coyote/assets/javascript.rb", "lib/coyote/bundle.rb", "lib/coyote/closure_compiler.rb", "lib/coyote/configuration.rb", "lib/coyote/fs_listener.rb", "lib/coyote/fs_listeners/darwin.rb", "lib/coyote/fs_listeners/linux.rb", "lib/coyote/fs_listeners/polling.rb", "lib/coyote/fs_listeners/windows.rb", "lib/coyote/notifications.rb"]
|
15
|
-
s.files = ["README.md", "Rakefile", "bin/coyote", "coyote.
|
14
|
+
s.extra_rdoc_files = ["README.md", "bin/coyote", "lib/coyote.rb", "lib/coyote.rb.orig", "lib/coyote/asset.rb", "lib/coyote/assets/coffeescript.rb", "lib/coyote/assets/javascript.rb", "lib/coyote/bundle.rb", "lib/coyote/closure_compiler.rb", "lib/coyote/configuration.rb", "lib/coyote/fs_listener.rb", "lib/coyote/fs_listeners/darwin.rb", "lib/coyote/fs_listeners/linux.rb", "lib/coyote/fs_listeners/polling.rb", "lib/coyote/fs_listeners/windows.rb", "lib/coyote/notifications.rb"]
|
15
|
+
s.files = ["README.md", "Rakefile", "bin/coyote", "lib/coyote.rb", "lib/coyote.rb.orig", "lib/coyote/asset.rb", "lib/coyote/assets/coffeescript.rb", "lib/coyote/assets/javascript.rb", "lib/coyote/bundle.rb", "lib/coyote/closure_compiler.rb", "lib/coyote/configuration.rb", "lib/coyote/fs_listener.rb", "lib/coyote/fs_listeners/darwin.rb", "lib/coyote/fs_listeners/linux.rb", "lib/coyote/fs_listeners/polling.rb", "lib/coyote/fs_listeners/windows.rb", "lib/coyote/notifications.rb", "test/scripts/input1.js", "test/scripts/input2.js", "test/scripts/input3.js", "test/scripts/input4.js", "test/scripts/lib/input5.coffee", "test/scripts/lib/input6.js", "test/scripts/lib/keystone/input7.js", "test/scripts/vendor/input8.coffee", "test/src/public/assets/javascripts/app/application/interface.coffee", "test/src/public/assets/javascripts/app/application/main.coffee", "test/src/public/assets/javascripts/app/application/pages/home.coffee", "test/src/public/assets/javascripts/app/boot.coffee", "test/src/public/assets/javascripts/lib/imulus.coffee", "test/src/public/assets/javascripts/lib/imulus/forms.coffee", "test/src/public/assets/javascripts/lib/imulus/maps/infowindow.coffee", "test/src/public/assets/javascripts/lib/imulus/maps/map.coffee", "test/src/public/assets/javascripts/lib/imulus/maps/marker.coffee", "test/src/public/assets/javascripts/lib/imulus/maps/point.coffee", "test/src/public/assets/javascripts/lib/imulus/maps/results.coffee", "test/src/public/assets/javascripts/lib/imulus/tables.coffee", "test/src/public/assets/javascripts/lib/imulus/triggers.coffee", "test/src/public/assets/javascripts/scripts.coffee", "test/src/public/assets/javascripts/vendor/jquery.js", "test/src/public/assets/javascripts/vendor/jquery/jquery.cookie.js", "test/src/public/assets/javascripts/vendor/jquery/jquery.cycle.js", "test/src/public/assets/javascripts/vendor/jquery/jquery.query.js", "test/src/public/assets/javascripts/vendor/swfobject.js", "test/src/public/scripts/scripts.combine", "test/src/public/scripts/scripts.js", "Manifest", "coyote.gemspec"]
|
16
16
|
s.homepage = %q{http://github.com/imulus/coyote}
|
17
17
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Coyote", "--main", "README.md"]
|
18
18
|
s.require_paths = ["lib"]
|
data/lib/coyote.rb
CHANGED
@@ -7,7 +7,7 @@ include Coyote::Notifications
|
|
7
7
|
|
8
8
|
module Coyote
|
9
9
|
|
10
|
-
VERSION = '1.0.0
|
10
|
+
VERSION = '1.0.0'
|
11
11
|
|
12
12
|
def self.run(input_path, output_path, options = {})
|
13
13
|
@@input_path = input_path
|
@@ -43,7 +43,7 @@ module Coyote
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
notify "Watching for changes to your bundle. CTRL+C to stop."
|
46
|
+
notify "#{Time.new.strftime("%I:%M:%S")} Watching for changes to your bundle. CTRL+C to stop."
|
47
47
|
listener.start
|
48
48
|
end
|
49
49
|
end
|
data/lib/coyote.rb.orig
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
require 'coyote/configuration'
|
2
|
+
require 'coyote/bundle'
|
3
|
+
require 'coyote/fs_listener'
|
4
|
+
require 'coyote/notifications'
|
5
|
+
include Coyote::Notifications
|
6
|
+
|
7
|
+
|
8
|
+
module Coyote
|
9
|
+
<<<<<<< HEAD
|
10
|
+
APP_NAME = "Coyote"
|
11
|
+
VERSION = "0.7.0"
|
12
|
+
ROOT_PATH = Dir.pwd
|
13
|
+
CONFIG_PATH = File.expand_path(File.dirname(__FILE__) + "/../config")
|
14
|
+
CONFIG_FILENAME = "coyote.yaml"
|
15
|
+
CONFIG_ICON = "coyote-icon.png"
|
16
|
+
USAGE_FILENAME = "coyote-usage.txt"
|
17
|
+
|
18
|
+
module Defaults
|
19
|
+
OUTPUT = "coyote.js"
|
20
|
+
=======
|
21
|
+
|
22
|
+
VERSION = '1.0.0'
|
23
|
+
|
24
|
+
def self.run(input_path, output_path, options = {})
|
25
|
+
@@input_path = input_path
|
26
|
+
@@output_path = output_path
|
27
|
+
@@options = options
|
28
|
+
bundle = Coyote::Bundle.new(input_path, output_path)
|
29
|
+
build bundle
|
30
|
+
watch bundle if @@options[:watch]
|
31
|
+
>>>>>>> develop
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.options
|
35
|
+
['compress', 'watch', 'quiet']
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.build(bundle)
|
39
|
+
notify bundle.manifest unless @@options[:quiet]
|
40
|
+
bundle.compress! if @@options[:compress]
|
41
|
+
bundle.save
|
42
|
+
notify "#{Time.new.strftime("%I:%M:%S")} Saved bundle to #{@@output_path} [#{bundle.files.length} files]", :success
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
def self.watch(bundle)
|
47
|
+
listener = Coyote::FSListener.select_and_init
|
48
|
+
|
49
|
+
<<<<<<< HEAD
|
50
|
+
inputs = config.inputs.values.collect do |script|
|
51
|
+
script.relative_path
|
52
|
+
end
|
53
|
+
|
54
|
+
listener.on_change do |files|
|
55
|
+
if files.include? config.source
|
56
|
+
Coyote::Notification.new "Config file (#{config.source}) changed. Reading it in.\n", "warning"
|
57
|
+
config.load_from_yaml! config.source
|
58
|
+
self.build config
|
59
|
+
else
|
60
|
+
changed_watched_files = inputs & files
|
61
|
+
if changed_watched_files.length > 0
|
62
|
+
self.build config
|
63
|
+
end
|
64
|
+
=======
|
65
|
+
listener.on_change do |changed_files|
|
66
|
+
changed_files = bundle.files & changed_files
|
67
|
+
|
68
|
+
if changed_files.length > 0
|
69
|
+
notify "#{Time.new.strftime("%I:%M:%S")} Detected change, recompiling...", :warning
|
70
|
+
bundle.update! changed_files
|
71
|
+
build bundle
|
72
|
+
>>>>>>> develop
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
notify "#{Time.new.strftime("%I:%M:%S")} Watching for changes to your bundle. CTRL+C to stop."
|
77
|
+
listener.start
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
@module "Application", ->
|
2
|
+
|
3
|
+
@main = ->
|
4
|
+
new Application.Interface
|
5
|
+
|
6
|
+
initializers = $('body').attr('data-js-init')
|
7
|
+
|
8
|
+
Application.initializers = if initializers? then initializers.replace(" ","").split(",") else []
|
9
|
+
|
10
|
+
for initializer in Application.initializers
|
11
|
+
segments = initializer.split(".")
|
12
|
+
method = window
|
13
|
+
method = method[segment] for segment in segments
|
14
|
+
do method if method?
|
@@ -0,0 +1 @@
|
|
1
|
+
$ -> Application.main()
|
@@ -0,0 +1,46 @@
|
|
1
|
+
@module "Imulus", ->
|
2
|
+
class @Forms
|
3
|
+
constructor: ($form)->
|
4
|
+
do @build
|
5
|
+
|
6
|
+
build: ->
|
7
|
+
if not Imulus.elementSupportsAttribute 'input', 'placeholder'
|
8
|
+
$('input[placeholder]').each ->
|
9
|
+
$input = $(this)
|
10
|
+
placeholder = $input.attr 'placeholder'
|
11
|
+
$input.val(placeholder).addClass 'inactive'
|
12
|
+
$input.bind
|
13
|
+
focus : ->
|
14
|
+
if $input.val() is placeholder
|
15
|
+
$input.val('').removeClass 'inactive'
|
16
|
+
blur : ->
|
17
|
+
if $input.val() is ''
|
18
|
+
$input.val(placeholder).addClass 'inactive'
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
$('fieldset.overlay .row').each ->
|
23
|
+
|
24
|
+
$label = $(this).find 'label'
|
25
|
+
$input = $(this).find 'input'
|
26
|
+
|
27
|
+
if $input.val() isnt ""
|
28
|
+
$label.hide()
|
29
|
+
|
30
|
+
$label.click -> $input.focus()
|
31
|
+
|
32
|
+
$input.bind
|
33
|
+
focus: ->
|
34
|
+
if $input.val() is ""
|
35
|
+
$label.addClass 'faded'
|
36
|
+
|
37
|
+
blur: ->
|
38
|
+
if $input.val() is ""
|
39
|
+
$label.fadeIn().removeClass 'faded'
|
40
|
+
|
41
|
+
change: ->
|
42
|
+
if $input.val() isnt ""
|
43
|
+
$label.fadeOut().removeClass 'faded'
|
44
|
+
|
45
|
+
keypress: ->
|
46
|
+
$label.hide().removeClass 'faded'
|
@@ -0,0 +1,37 @@
|
|
1
|
+
@module "Imulus", ->
|
2
|
+
@module "Maps", ->
|
3
|
+
class @InfoWindow
|
4
|
+
|
5
|
+
# Class variable
|
6
|
+
@windows: []
|
7
|
+
|
8
|
+
constructor : (@map, @marker, params)->
|
9
|
+
Imulus.Maps.InfoWindow.windows.push this
|
10
|
+
{@title, @body} = params
|
11
|
+
do @build
|
12
|
+
|
13
|
+
settings : {}
|
14
|
+
|
15
|
+
build : ->
|
16
|
+
content = "<div class='infowindow-content'>"
|
17
|
+
if @title then content += "<div class='title'>#{@title}</div>"
|
18
|
+
if @body then content += "<div class='body'>#{@body}</div>"
|
19
|
+
content += "</div>";
|
20
|
+
|
21
|
+
@settings.content = content
|
22
|
+
|
23
|
+
@window = new google.maps.InfoWindow @settings
|
24
|
+
|
25
|
+
|
26
|
+
open : ->
|
27
|
+
do @closeAll
|
28
|
+
@window.open @map.canvas, @marker
|
29
|
+
|
30
|
+
|
31
|
+
close : ->
|
32
|
+
@window.close()
|
33
|
+
|
34
|
+
|
35
|
+
closeAll : ->
|
36
|
+
_window.close() for _window in Imulus.Maps.InfoWindow.windows
|
37
|
+
|
@@ -0,0 +1,51 @@
|
|
1
|
+
@module "Imulus", ->
|
2
|
+
@module "Maps", ->
|
3
|
+
class @Map
|
4
|
+
|
5
|
+
settings:
|
6
|
+
panControl : true
|
7
|
+
zoomControl : true
|
8
|
+
mapTypeControl : false
|
9
|
+
scaleControl : false
|
10
|
+
streetViewControl : false
|
11
|
+
overviewMapControl : false
|
12
|
+
mapTypeControl : false
|
13
|
+
|
14
|
+
constructor: (params, @element)->
|
15
|
+
@canvas = null
|
16
|
+
@center = new Imulus.Maps.Point params.lat, params.lng
|
17
|
+
@markers = {}
|
18
|
+
@settings.center = @center.latLng
|
19
|
+
@settings.mapTypeId = google.maps.MapTypeId[params.type] or google.maps.MapTypeId['TERRAIN']
|
20
|
+
@settings.zoom = parseInt params.zoom or 10
|
21
|
+
@setCanvas @element if @element
|
22
|
+
@addMarkers params.markers if params.markers
|
23
|
+
|
24
|
+
setCanvas: (element)-> @canvas = new google.maps.Map document.getElementById(element), @settings
|
25
|
+
|
26
|
+
setCenter: (lat, lng) ->
|
27
|
+
@center = new Imulus.Maps.Point params.lat, params.lng
|
28
|
+
do @recenter
|
29
|
+
|
30
|
+
recenter: -> @canvas.setCenter @center
|
31
|
+
|
32
|
+
reset: ->
|
33
|
+
do @recenter
|
34
|
+
@canvas.setZoom parseInt @settings.zoom
|
35
|
+
|
36
|
+
addMarkers: (markers)->
|
37
|
+
@addMarker marker for marker in markers
|
38
|
+
|
39
|
+
addMarker: (params)->
|
40
|
+
marker = new Imulus.Maps.Marker this, params
|
41
|
+
@markers[marker.id] = marker
|
42
|
+
return marker
|
43
|
+
|
44
|
+
hideMarkers : (deleteMarkers)->
|
45
|
+
marker.hide() for index, marker of @markers
|
46
|
+
if deleteMarkers
|
47
|
+
do @deleteMarkers
|
48
|
+
|
49
|
+
deleteMarkers : ->
|
50
|
+
for marker, index of @markers
|
51
|
+
delete marker
|
@@ -0,0 +1,66 @@
|
|
1
|
+
@module "Imulus", ->
|
2
|
+
@module "Maps", ->
|
3
|
+
class @Marker
|
4
|
+
|
5
|
+
constructor: (@map, params)->
|
6
|
+
@hidden = false
|
7
|
+
{@id} = params
|
8
|
+
@center = new Imulus.Maps.Point params.lat, params.lng
|
9
|
+
@infoWindow = null
|
10
|
+
@fill_color = params.fill_color or Marker::fill_color or '#F0F'
|
11
|
+
@text_color = params.text_color or Marker::text_color or '#000'
|
12
|
+
@index = params.index
|
13
|
+
@letter = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'][@index] or ""
|
14
|
+
|
15
|
+
shadow = new google.maps.MarkerImage 'http://chart.apis.google.com/chart?chst=d_map_pin_shadow',
|
16
|
+
new google.maps.Size(40, 37), new google.maps.Point(0,0), new google.maps.Point(0, 37)
|
17
|
+
|
18
|
+
@marker = new google.maps.Marker
|
19
|
+
position : @center.latLng
|
20
|
+
map : @map.canvas
|
21
|
+
shadow : shadow
|
22
|
+
|
23
|
+
@setColor @fill_color
|
24
|
+
@setInfoWindow params.infoWindow if params.infoWindow
|
25
|
+
do @show
|
26
|
+
do @observe
|
27
|
+
|
28
|
+
|
29
|
+
observe : ->
|
30
|
+
if @infoWindow isnt null
|
31
|
+
google.maps.event.addListener @marker, 'click', =>
|
32
|
+
@infoWindow.open @marker
|
33
|
+
|
34
|
+
show : ->
|
35
|
+
@marker.setMap @map.canvas
|
36
|
+
@hidden = false
|
37
|
+
|
38
|
+
|
39
|
+
hide : ->
|
40
|
+
@marker.setMap null
|
41
|
+
@infoWindow.closeAll() if @infoWindow?
|
42
|
+
@hidden = true
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
setColor : (color)->
|
49
|
+
@fill_color = color
|
50
|
+
@image_url = "http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=#{@letter}|#{@fill_color.substring(1)}|#{@text_color.substring(1)}"
|
51
|
+
width = 21
|
52
|
+
height = 34
|
53
|
+
|
54
|
+
icon = new google.maps.MarkerImage(@image_url,
|
55
|
+
new google.maps.Size(width, height),
|
56
|
+
new google.maps.Point(0,0),
|
57
|
+
new google.maps.Point(0, height))
|
58
|
+
|
59
|
+
@marker.setOptions icon: icon
|
60
|
+
|
61
|
+
|
62
|
+
setInfoWindow : (params)->
|
63
|
+
@infoWindow = new Imulus.Maps.InfoWindow @map, @marker, params
|
64
|
+
do @observe
|
65
|
+
|
66
|
+
|
@@ -0,0 +1,117 @@
|
|
1
|
+
@module "Imulus", ->
|
2
|
+
@module "Maps", ->
|
3
|
+
class @Results
|
4
|
+
|
5
|
+
constructor: (@$table, @data)->
|
6
|
+
@$head = @$table.find('thead')
|
7
|
+
@$body = @$table.find('tbody')
|
8
|
+
@$foot = @$table.find('tfoot')
|
9
|
+
@$prev = null
|
10
|
+
@$next = null
|
11
|
+
@proto = []
|
12
|
+
@limit = 25
|
13
|
+
@total = 0
|
14
|
+
@sets = []
|
15
|
+
@active_set = 0
|
16
|
+
@paginated = false
|
17
|
+
do @build
|
18
|
+
|
19
|
+
build: ->
|
20
|
+
# Build the <thead>
|
21
|
+
col = 0
|
22
|
+
$row = $('<tr />')
|
23
|
+
for column in @data.table
|
24
|
+
@proto.push column.Key
|
25
|
+
col++
|
26
|
+
$cell = $('<th />').attr('class', "col-#{col}").html(column.Value)
|
27
|
+
$row.append($cell)
|
28
|
+
@$head.append $row
|
29
|
+
|
30
|
+
# Build the <tfoot>
|
31
|
+
$row = $('<tr />')
|
32
|
+
for num in [1..@proto.length]
|
33
|
+
value = ""
|
34
|
+
if num is 1
|
35
|
+
@$prev = $("<a />").attr({"href": "#", "class": "prev"}).html("« Previous").hide()
|
36
|
+
value = @$prev
|
37
|
+
if num is @proto.length
|
38
|
+
@$next = $("<a />").attr({"href": "#", "class": "next"}).html("Next »").hide()
|
39
|
+
value = @$next
|
40
|
+
$cell = $('<td />').html value
|
41
|
+
$row.append($cell)
|
42
|
+
@$foot.append $row
|
43
|
+
|
44
|
+
|
45
|
+
reset: ->
|
46
|
+
@$body.empty()
|
47
|
+
@total = 0
|
48
|
+
@sets = []
|
49
|
+
@active_set = 0
|
50
|
+
@$foot.hide()
|
51
|
+
|
52
|
+
add: (node)->
|
53
|
+
@total++
|
54
|
+
index = @sets.length - 1
|
55
|
+
|
56
|
+
if @total % @limit is 1
|
57
|
+
index = index + 1
|
58
|
+
if @total <= @limit
|
59
|
+
index = 0
|
60
|
+
|
61
|
+
@sets[index] = [] if not @sets[index]?
|
62
|
+
@sets[index].push node
|
63
|
+
|
64
|
+
if @total is @limit then @loadSet(0)
|
65
|
+
if @total > @limit and not @paginated then @paginate()
|
66
|
+
|
67
|
+
|
68
|
+
paginate: ->
|
69
|
+
@paginated = true
|
70
|
+
|
71
|
+
@$foot.show()
|
72
|
+
|
73
|
+
@$prev.show().click (event) =>
|
74
|
+
event.preventDefault()
|
75
|
+
if @active_set > 0
|
76
|
+
new_set_index = @active_set - 1
|
77
|
+
else
|
78
|
+
new_set_index = @sets.length - 1
|
79
|
+
@loadSet new_set_index
|
80
|
+
|
81
|
+
@$next.show().click (event) =>
|
82
|
+
event.preventDefault()
|
83
|
+
if @active_set < @sets.length - 1
|
84
|
+
new_set_index = @active_set + 1
|
85
|
+
else
|
86
|
+
new_set_index = 0
|
87
|
+
@loadSet new_set_index
|
88
|
+
|
89
|
+
observe : (action, callback) ->
|
90
|
+
@$body.find('tr').live action, ->
|
91
|
+
id = $(this).attr 'data-marker-id'
|
92
|
+
callback id
|
93
|
+
|
94
|
+
|
95
|
+
loadSet: (index) ->
|
96
|
+
@$body.empty()
|
97
|
+
@active_set = index
|
98
|
+
@addRow node for node in @sets[@active_set]
|
99
|
+
|
100
|
+
|
101
|
+
addRow: (node)->
|
102
|
+
$row = $('<tr />').attr 'data-marker-id', node.id
|
103
|
+
|
104
|
+
for column in @proto
|
105
|
+
for property in node.customProperties
|
106
|
+
if property.Key is column
|
107
|
+
$row.append $('<td />').html property.Value
|
108
|
+
|
109
|
+
@$body.append $row
|
110
|
+
|
111
|
+
|
112
|
+
none: (text)->
|
113
|
+
if text
|
114
|
+
$row = $('<tr />')
|
115
|
+
$row.append $('<td />').html text
|
116
|
+
@$body.append $row
|
117
|
+
|