coyote 0.6.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. data/Manifest +22 -36
  2. data/coyote.gemspec +3 -3
  3. data/lib/coyote.rb +6 -2
  4. data/lib/coyote/script.rb +3 -1
  5. data/test/src/public/assets/javascripts/app/application/interface.coffee +10 -0
  6. data/test/src/public/assets/javascripts/app/application/main.coffee +14 -0
  7. data/test/src/public/assets/javascripts/app/application/pages/home.coffee +9 -0
  8. data/test/src/public/assets/javascripts/app/boot.coffee +1 -0
  9. data/test/{assets/javascripts/lib/keystone → src/public/assets/javascripts/lib}/extensions.coffee +0 -0
  10. data/test/src/public/assets/javascripts/lib/imulus.coffee +7 -0
  11. data/test/src/public/assets/javascripts/lib/imulus/forms.coffee +46 -0
  12. data/test/src/public/assets/javascripts/lib/imulus/maps/infowindow.coffee +37 -0
  13. data/test/src/public/assets/javascripts/lib/imulus/maps/map.coffee +51 -0
  14. data/test/src/public/assets/javascripts/lib/imulus/maps/marker.coffee +66 -0
  15. data/test/src/public/assets/javascripts/lib/imulus/maps/point.coffee +5 -0
  16. data/test/src/public/assets/javascripts/lib/imulus/maps/results.coffee +117 -0
  17. data/test/src/public/assets/javascripts/lib/imulus/tables.coffee +11 -0
  18. data/test/src/public/assets/javascripts/lib/imulus/triggers.coffee +26 -0
  19. data/test/src/public/assets/javascripts/scripts.coffee +14 -0
  20. data/test/src/public/assets/javascripts/vendor/jquery.js +18 -0
  21. data/test/src/public/assets/javascripts/vendor/jquery/jquery.cookie.js +89 -0
  22. data/test/src/public/assets/javascripts/vendor/jquery/jquery.cycle.js +21 -0
  23. data/test/src/public/assets/javascripts/vendor/jquery/jquery.query.js +224 -0
  24. data/test/src/public/assets/javascripts/vendor/swfobject.js +4 -0
  25. data/test/src/public/scripts/scripts.combine +18 -0
  26. data/test/src/public/scripts/scripts.js +944 -0
  27. metadata +36 -50
  28. data/test/assets/javascripts/app/confio.coffee +0 -2
  29. data/test/assets/javascripts/app/confio/interface.coffee +0 -8
  30. data/test/assets/javascripts/app/confio/main.coffee +0 -4
  31. data/test/assets/javascripts/lib/keystone/forms.coffee +0 -19
  32. data/test/assets/javascripts/lib/keystone/utilities.coffee +0 -2
  33. data/test/assets/stylesheets/app/_confio.scss +0 -4
  34. data/test/assets/stylesheets/app/confio/_ie.scss +0 -39
  35. data/test/assets/stylesheets/app/confio/_mobile.scss +0 -28
  36. data/test/assets/stylesheets/app/confio/_print.scss +0 -129
  37. data/test/assets/stylesheets/app/confio/_screen.scss +0 -624
  38. data/test/assets/stylesheets/lib/_keystone.scss +0 -4
  39. data/test/assets/stylesheets/lib/keystone/_css3.scss +0 -6
  40. data/test/assets/stylesheets/lib/keystone/_scaffolding.scss +0 -2
  41. data/test/assets/stylesheets/lib/keystone/_typography.scss +0 -3
  42. data/test/assets/stylesheets/lib/keystone/_utilities.scss +0 -3
  43. data/test/assets/stylesheets/lib/keystone/css3/_background-clip.scss +0 -5
  44. data/test/assets/stylesheets/lib/keystone/css3/_border-radius.scss +0 -5
  45. data/test/assets/stylesheets/lib/keystone/css3/_box-shadow.scss +0 -5
  46. data/test/assets/stylesheets/lib/keystone/css3/_box-sizing.scss +0 -5
  47. data/test/assets/stylesheets/lib/keystone/css3/_opacity.scss +0 -6
  48. data/test/assets/stylesheets/lib/keystone/css3/_transition.scss +0 -5
  49. data/test/assets/stylesheets/lib/keystone/scaffolding/_reset.scss +0 -75
  50. data/test/assets/stylesheets/lib/keystone/scaffolding/_structure.scss +0 -23
  51. data/test/assets/stylesheets/lib/keystone/typography/_links.scss +0 -66
  52. data/test/assets/stylesheets/lib/keystone/typography/_lists.scss +0 -38
  53. data/test/assets/stylesheets/lib/keystone/typography/_replacement.scss +0 -12
  54. data/test/assets/stylesheets/lib/keystone/utilities/_alignment.scss +0 -3
  55. data/test/assets/stylesheets/lib/keystone/utilities/_autoclear.scss +0 -11
  56. data/test/assets/stylesheets/lib/keystone/utilities/_hoverbox.scss +0 -32
  57. data/test/assets/stylesheets/styles.scss +0 -58
  58. data/test/assets/stylesheets/vendor/_vendor.scss +0 -0
  59. data/test/public/scripts/coyote.js +0 -93
  60. data/test/public/scripts/jquery.js +0 -4
  61. data/test/public/scripts/scripts.combine +0 -6
  62. data/test/public/scripts/scripts.js +0 -91
data/Manifest CHANGED
@@ -19,40 +19,26 @@ lib/coyote/script.rb
19
19
  lib/coyote/scripts/coffeescript.rb
20
20
  lib/coyote/scripts/combine.rb
21
21
  lib/coyote/scripts/javascript.rb
22
- test/assets/javascripts/app/confio.coffee
23
- test/assets/javascripts/app/confio/interface.coffee
24
- test/assets/javascripts/app/confio/main.coffee
25
- test/assets/javascripts/lib/keystone/extensions.coffee
26
- test/assets/javascripts/lib/keystone/forms.coffee
27
- test/assets/javascripts/lib/keystone/utilities.coffee
28
- test/assets/stylesheets/app/_confio.scss
29
- test/assets/stylesheets/app/confio/_ie.scss
30
- test/assets/stylesheets/app/confio/_mobile.scss
31
- test/assets/stylesheets/app/confio/_print.scss
32
- test/assets/stylesheets/app/confio/_screen.scss
33
- test/assets/stylesheets/lib/_keystone.scss
34
- test/assets/stylesheets/lib/keystone/_css3.scss
35
- test/assets/stylesheets/lib/keystone/_scaffolding.scss
36
- test/assets/stylesheets/lib/keystone/_typography.scss
37
- test/assets/stylesheets/lib/keystone/_utilities.scss
38
- test/assets/stylesheets/lib/keystone/css3/_background-clip.scss
39
- test/assets/stylesheets/lib/keystone/css3/_border-radius.scss
40
- test/assets/stylesheets/lib/keystone/css3/_box-shadow.scss
41
- test/assets/stylesheets/lib/keystone/css3/_box-sizing.scss
42
- test/assets/stylesheets/lib/keystone/css3/_opacity.scss
43
- test/assets/stylesheets/lib/keystone/css3/_transition.scss
44
- test/assets/stylesheets/lib/keystone/scaffolding/_reset.scss
45
- test/assets/stylesheets/lib/keystone/scaffolding/_structure.scss
46
- test/assets/stylesheets/lib/keystone/typography/_links.scss
47
- test/assets/stylesheets/lib/keystone/typography/_lists.scss
48
- test/assets/stylesheets/lib/keystone/typography/_replacement.scss
49
- test/assets/stylesheets/lib/keystone/utilities/_alignment.scss
50
- test/assets/stylesheets/lib/keystone/utilities/_autoclear.scss
51
- test/assets/stylesheets/lib/keystone/utilities/_hoverbox.scss
52
- test/assets/stylesheets/styles.scss
53
- test/assets/stylesheets/vendor/_vendor.scss
54
- test/public/scripts/coyote.js
55
- test/public/scripts/jquery.js
56
- test/public/scripts/scripts.combine
57
- test/public/scripts/scripts.js
22
+ test/src/public/assets/javascripts/app/application/interface.coffee
23
+ test/src/public/assets/javascripts/app/application/main.coffee
24
+ test/src/public/assets/javascripts/app/application/pages/home.coffee
25
+ test/src/public/assets/javascripts/app/boot.coffee
26
+ test/src/public/assets/javascripts/lib/extensions.coffee
27
+ test/src/public/assets/javascripts/lib/imulus.coffee
28
+ test/src/public/assets/javascripts/lib/imulus/forms.coffee
29
+ test/src/public/assets/javascripts/lib/imulus/maps/infowindow.coffee
30
+ test/src/public/assets/javascripts/lib/imulus/maps/map.coffee
31
+ test/src/public/assets/javascripts/lib/imulus/maps/marker.coffee
32
+ test/src/public/assets/javascripts/lib/imulus/maps/point.coffee
33
+ test/src/public/assets/javascripts/lib/imulus/maps/results.coffee
34
+ test/src/public/assets/javascripts/lib/imulus/tables.coffee
35
+ test/src/public/assets/javascripts/lib/imulus/triggers.coffee
36
+ test/src/public/assets/javascripts/scripts.coffee
37
+ test/src/public/assets/javascripts/vendor/jquery.js
38
+ test/src/public/assets/javascripts/vendor/jquery/jquery.cookie.js
39
+ test/src/public/assets/javascripts/vendor/jquery/jquery.cycle.js
40
+ test/src/public/assets/javascripts/vendor/jquery/jquery.query.js
41
+ test/src/public/assets/javascripts/vendor/swfobject.js
42
+ test/src/public/scripts/scripts.combine
43
+ test/src/public/scripts/scripts.js
58
44
  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 = "0.6.1"
5
+ s.version = "0.7.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{2011-12-13}
9
+ s.date = %q{2012-01-18}
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
14
  s.extra_rdoc_files = ["README.md", "bin/coyote", "lib/coyote.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/generator.rb", "lib/coyote/notification.rb", "lib/coyote/script.rb", "lib/coyote/scripts/coffeescript.rb", "lib/coyote/scripts/combine.rb", "lib/coyote/scripts/javascript.rb"]
15
- s.files = ["README.md", "Rakefile", "bin/coyote", "config/coyote-icon.png", "config/coyote-usage.txt", "config/coyote.yaml", "coyote.gemspec", "lib/coyote.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/generator.rb", "lib/coyote/notification.rb", "lib/coyote/script.rb", "lib/coyote/scripts/coffeescript.rb", "lib/coyote/scripts/combine.rb", "lib/coyote/scripts/javascript.rb", "test/assets/javascripts/app/confio.coffee", "test/assets/javascripts/app/confio/interface.coffee", "test/assets/javascripts/app/confio/main.coffee", "test/assets/javascripts/lib/keystone/extensions.coffee", "test/assets/javascripts/lib/keystone/forms.coffee", "test/assets/javascripts/lib/keystone/utilities.coffee", "test/assets/stylesheets/app/_confio.scss", "test/assets/stylesheets/app/confio/_ie.scss", "test/assets/stylesheets/app/confio/_mobile.scss", "test/assets/stylesheets/app/confio/_print.scss", "test/assets/stylesheets/app/confio/_screen.scss", "test/assets/stylesheets/lib/_keystone.scss", "test/assets/stylesheets/lib/keystone/_css3.scss", "test/assets/stylesheets/lib/keystone/_scaffolding.scss", "test/assets/stylesheets/lib/keystone/_typography.scss", "test/assets/stylesheets/lib/keystone/_utilities.scss", "test/assets/stylesheets/lib/keystone/css3/_background-clip.scss", "test/assets/stylesheets/lib/keystone/css3/_border-radius.scss", "test/assets/stylesheets/lib/keystone/css3/_box-shadow.scss", "test/assets/stylesheets/lib/keystone/css3/_box-sizing.scss", "test/assets/stylesheets/lib/keystone/css3/_opacity.scss", "test/assets/stylesheets/lib/keystone/css3/_transition.scss", "test/assets/stylesheets/lib/keystone/scaffolding/_reset.scss", "test/assets/stylesheets/lib/keystone/scaffolding/_structure.scss", "test/assets/stylesheets/lib/keystone/typography/_links.scss", "test/assets/stylesheets/lib/keystone/typography/_lists.scss", "test/assets/stylesheets/lib/keystone/typography/_replacement.scss", "test/assets/stylesheets/lib/keystone/utilities/_alignment.scss", "test/assets/stylesheets/lib/keystone/utilities/_autoclear.scss", "test/assets/stylesheets/lib/keystone/utilities/_hoverbox.scss", "test/assets/stylesheets/styles.scss", "test/assets/stylesheets/vendor/_vendor.scss", "test/public/scripts/coyote.js", "test/public/scripts/jquery.js", "test/public/scripts/scripts.combine", "test/public/scripts/scripts.js", "Manifest"]
15
+ s.files = ["README.md", "Rakefile", "bin/coyote", "config/coyote-icon.png", "config/coyote-usage.txt", "config/coyote.yaml", "coyote.gemspec", "lib/coyote.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/generator.rb", "lib/coyote/notification.rb", "lib/coyote/script.rb", "lib/coyote/scripts/coffeescript.rb", "lib/coyote/scripts/combine.rb", "lib/coyote/scripts/javascript.rb", "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/extensions.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"]
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
@@ -11,7 +11,7 @@ include Term::ANSIColor
11
11
 
12
12
  module Coyote
13
13
  APP_NAME = "Coyote"
14
- VERSION = "0.6.1"
14
+ VERSION = "0.7.0"
15
15
  ROOT_PATH = Dir.pwd
16
16
  CONFIG_PATH = File.expand_path(File.dirname(__FILE__) + "/../config")
17
17
  CONFIG_FILENAME = "coyote.yaml"
@@ -54,13 +54,17 @@ module Coyote
54
54
 
55
55
  listener = Coyote::FSListener.select_and_init
56
56
 
57
+ inputs = config.inputs.values.collect do |script|
58
+ script.relative_path
59
+ end
60
+
57
61
  listener.on_change do |files|
58
62
  if files.include? config.source
59
63
  Coyote::Notification.new "Config file (#{config.source}) changed. Reading it in.\n", "warning"
60
64
  config.load_from_yaml! config.source
61
65
  self.build config
62
66
  else
63
- changed_watched_files = config.inputs & files
67
+ changed_watched_files = inputs & files
64
68
  if changed_watched_files.length > 0
65
69
  self.build config
66
70
  end
data/lib/coyote/script.rb CHANGED
@@ -4,7 +4,8 @@ module Coyote
4
4
  autoload :Combine, 'coyote/scripts/combine'
5
5
 
6
6
  class Script
7
- attr_accessor :filename, :contents
7
+ attr_reader :filename, :relative_path
8
+ attr_accessor :contents
8
9
 
9
10
  # Class method
10
11
  # Determine the type of file base on the file extension
@@ -21,6 +22,7 @@ module Coyote
21
22
 
22
23
  def initialize(filename, contents = "")
23
24
  @filename = filename
25
+ @relative_path = @filename.gsub("#{Dir.pwd}/", '')
24
26
  @directory = File.dirname(@filename)
25
27
 
26
28
  if contents.empty? and File.exists? @filename
@@ -0,0 +1,10 @@
1
+ @module "Application", ->
2
+
3
+ class @Interface
4
+ constructor: ->
5
+ do @build
6
+
7
+ build: ->
8
+ new Imulus.Forms
9
+ new Imulus.Tables
10
+ new Imulus.Triggers
@@ -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,9 @@
1
+ @module "Application.Pages", ->
2
+
3
+ @home = ->
4
+ $('#slides').cycle({
5
+ fx : 'fade',
6
+ speed : 1000,
7
+ timeout : 5000,
8
+ pager : "#slides-nav"
9
+ });
@@ -0,0 +1 @@
1
+ $ -> Application.main()
@@ -0,0 +1,7 @@
1
+ @module "Imulus", ->
2
+
3
+ @VERSION = '0.1.0'
4
+
5
+ @elementSupportsAttribute = (element, attribute)->
6
+ attribute of document.createElement element
7
+
@@ -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,5 @@
1
+ @module "Imulus", ->
2
+ @module "Maps", ->
3
+ class @Point
4
+ constructor: (@lat, @lng) ->
5
+ @latLng = new google.maps.LatLng parseFloat(@lat), parseFloat(@lng)
@@ -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("&laquo; Previous").hide()
36
+ value = @$prev
37
+ if num is @proto.length
38
+ @$next = $("<a />").attr({"href": "#", "class": "next"}).html("Next &raquo;").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
+