ultimate-base 0.2.4 → 0.3.0.alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. data/.gitignore +4 -1
  2. data/.rvmrc +0 -1
  3. data/.rvmrc.example +0 -1
  4. data/Gemfile +6 -0
  5. data/Gemfile.lock +113 -1
  6. data/app/assets/javascripts/ultimate/backbone/base.js.coffee +14 -2
  7. data/app/assets/javascripts/ultimate/backbone/extra/jquery-plugin-adapter.js.coffee +1 -1
  8. data/app/assets/javascripts/ultimate/backbone/model.js.coffee +6 -0
  9. data/app/assets/javascripts/ultimate/backbone/view.js.coffee +5 -4
  10. data/app/assets/javascripts/ultimate/backbone/views/slider.js.coffee +4 -1
  11. data/app/assets/javascripts/ultimate/helpers/asset_tag.js.coffee +71 -54
  12. data/app/assets/javascripts/ultimate/helpers/base.js.coffee +3 -0
  13. data/app/assets/javascripts/ultimate/helpers/decor.js.coffee +19 -14
  14. data/app/assets/javascripts/ultimate/helpers/number.js.coffee +600 -0
  15. data/app/assets/javascripts/ultimate/helpers/record_tag.js.coffee +66 -0
  16. data/app/assets/javascripts/ultimate/helpers/tag.js.coffee +77 -0
  17. data/app/assets/javascripts/ultimate/helpers/url.js.coffee +49 -0
  18. data/app/assets/javascripts/ultimate/helpers.js.coffee +39 -66
  19. data/app/assets/javascripts/ultimate/{devise.js.coffee → improves/devise.js.coffee} +0 -0
  20. data/app/assets/javascripts/ultimate/improves/i18n-lite.js.coffee +18 -12
  21. data/app/assets/javascripts/ultimate/improves/magic-radios.js.coffee +2 -0
  22. data/app/assets/javascripts/ultimate/improves/typed-fields.js.coffee +13 -14
  23. data/app/assets/javascripts/ultimate/{base.js.coffee → jquery.base.js.coffee} +24 -37
  24. data/app/assets/javascripts/ultimate/{experimental/_inflections → underscore}/underscore.inflection.js +19 -18
  25. data/app/assets/javascripts/ultimate/underscore/underscore.outcasts.js.coffee +123 -0
  26. data/app/assets/javascripts/ultimate/underscore/underscore.string.js +16 -6
  27. data/config/routes.rb +2 -0
  28. data/lib/{ultimate-base → ultimate/base}/engine.rb +1 -0
  29. data/lib/{ultimate-base → ultimate/base}/version.rb +1 -1
  30. data/lib/ultimate/base.rb +10 -0
  31. data/lib/{ultimate-base → ultimate}/extensions/directive_processor.rb +0 -0
  32. data/lib/{ultimate-base → ultimate}/extensions/sass_script_functions.rb +0 -0
  33. data/scripts/rails +8 -0
  34. data/test/dummy/Rakefile +7 -0
  35. data/test/dummy/_emfile +18 -0
  36. data/{app/assets/javascripts/ultimate/helpers/forms.js.coffee → test/dummy/app/assets/images/.gitkeep} +0 -0
  37. data/test/dummy/app/assets/javascripts/application.js +3 -0
  38. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  39. data/test/dummy/app/assets/stylesheets/global/forms.css.scss +65 -0
  40. data/test/dummy/app/assets/stylesheets/global/layout/footer.scss +18 -0
  41. data/test/dummy/app/assets/stylesheets/global/layout/header.scss +13 -0
  42. data/test/dummy/app/assets/stylesheets/global/layout/main-menu.scss +68 -0
  43. data/test/dummy/app/assets/stylesheets/global/layout.css.scss +46 -0
  44. data/test/dummy/app/assets/stylesheets/global/reserved.css.scss +79 -0
  45. data/test/dummy/app/assets/stylesheets/global/reset.css.scss +85 -0
  46. data/test/dummy/app/assets/stylesheets/global/structures.css.scss +9 -0
  47. data/test/dummy/app/assets/stylesheets/import/base.scss +34 -0
  48. data/test/dummy/app/assets/stylesheets/plugins/qunit.css.scss +3 -0
  49. data/test/dummy/app/controllers/application_controller.rb +4 -0
  50. data/test/dummy/app/controllers/main_controller.rb +8 -0
  51. data/test/dummy/app/helpers/application_helper.rb +2 -0
  52. data/test/dummy/app/mailers/.gitkeep +0 -0
  53. data/test/dummy/app/models/.gitkeep +0 -0
  54. data/test/dummy/app/views/application/_footer.html.haml +3 -0
  55. data/test/dummy/app/views/application/_header.html.haml +4 -0
  56. data/test/dummy/app/views/application/_main_menu.html.haml +11 -0
  57. data/test/dummy/app/views/layouts/application.html.haml +24 -0
  58. data/test/dummy/app/views/main/index.html.haml +13 -0
  59. data/test/dummy/app/views/main/qunit.html.haml +7 -0
  60. data/test/dummy/config/application.rb +59 -0
  61. data/test/dummy/config/boot.rb +10 -0
  62. data/test/dummy/config/database.yml +25 -0
  63. data/test/dummy/config/environment.rb +5 -0
  64. data/test/dummy/config/environments/development.rb +40 -0
  65. data/test/dummy/config/environments/production.rb +67 -0
  66. data/test/dummy/config/environments/test.rb +37 -0
  67. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  68. data/test/dummy/config/initializers/inflections.rb +15 -0
  69. data/test/dummy/config/initializers/mime_types.rb +5 -0
  70. data/test/dummy/config/initializers/qunit-rails.rb +1 -0
  71. data/test/dummy/config/initializers/secret_token.rb +7 -0
  72. data/test/dummy/config/initializers/session_store.rb +8 -0
  73. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  74. data/test/dummy/config/locales/en.yml +5 -0
  75. data/test/dummy/config/routes.rb +63 -0
  76. data/test/dummy/config.ru +4 -0
  77. data/test/dummy/log/.gitkeep +0 -0
  78. data/test/dummy/public/404.html +26 -0
  79. data/test/dummy/public/422.html +26 -0
  80. data/test/dummy/public/500.html +25 -0
  81. data/test/dummy/public/favicon.ico +0 -0
  82. data/test/dummy/script/rails +6 -0
  83. data/test/javascripts/all_tests.js.coffee +13 -0
  84. data/test/javascripts/test_helper.js.coffee +3 -0
  85. data/test/javascripts/tests/base_test.js.coffee +42 -0
  86. data/test/javascripts/tests/helpers/asset_tag_test.js.coffee +51 -0
  87. data/test/javascripts/tests/helpers/number_test.js.coffee +250 -0
  88. data/test/javascripts/tests/helpers/record_tag_test.js.coffee +56 -0
  89. data/test/javascripts/tests/helpers/tag_test.js.coffee +33 -0
  90. data/test/javascripts/tests/helpers/url_test.js.coffee +28 -0
  91. data/test/javascripts/tests/helpers_test.js.coffee +47 -0
  92. data/test/javascripts/tests/improves/i18n-lite_test.js.coffee +25 -0
  93. data/test/javascripts/tests/underscore/underscore.outcasts.test.js.coffee +38 -0
  94. data/test/stylesheets/test_helper.css +4 -0
  95. data/ultimate-base.gemspec +4 -4
  96. metadata +116 -24
  97. data/app/assets/javascripts/ultimate/bus.js.coffee +0 -57
  98. data/app/assets/javascripts/ultimate/experimental/_inflections/dzone.inflections.js +0 -154
  99. data/app/assets/javascripts/ultimate/helpers/array.js.coffee +0 -63
  100. data/app/assets/javascripts/ultimate/helpers/tags.js.coffee +0 -73
  101. data/app/assets/javascripts/ultimate/widgets/dock.js.coffee +0 -70
  102. data/app/assets/javascripts/ultimate/widgets/gear.js.coffee +0 -84
  103. data/app/assets/javascripts/ultimate/widgets/jquery-ext.js.coffee +0 -104
  104. data/app/assets/javascripts/ultimate/widgets/jquery.adapter.js.coffee +0 -62
  105. data/app/assets/javascripts/ultimate/widgets/widget.js.coffee +0 -115
  106. data/lib/ultimate-base.rb +0 -10
data/.gitignore CHANGED
@@ -1,5 +1,8 @@
1
1
  *.gem
2
2
  .bundle
3
3
  pkg/*
4
- /vendors/assets/javascripts/jquery-1*
5
4
  .idea/
5
+ test/dummy/db/*.sqlite3
6
+ test/dummy/log/*.log
7
+ test/dummy/tmp/
8
+ test/dummy/.sass-cache
data/.rvmrc CHANGED
@@ -1,2 +1 @@
1
1
  rvm 1.9.3@ultimate
2
-
data/.rvmrc.example CHANGED
@@ -1,2 +1 @@
1
1
  rvm 1.9.3@ultimate
2
-
data/Gemfile CHANGED
@@ -2,3 +2,9 @@ source "http://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in ultimate-base.gemspec
4
4
  gemspec
5
+
6
+ gem "quiet_assets"
7
+ gem "haml-rails"
8
+ gem "sass-rails", "~> 3.2.3"
9
+ gem "qunit-rails"
10
+ gem "jquery-rails"
data/Gemfile.lock CHANGED
@@ -1,14 +1,126 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ultimate-base (0.2.4)
4
+ ultimate-base (0.3.0.alpha)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
8
8
  specs:
9
+ actionmailer (3.2.8)
10
+ actionpack (= 3.2.8)
11
+ mail (~> 2.4.4)
12
+ actionpack (3.2.8)
13
+ activemodel (= 3.2.8)
14
+ activesupport (= 3.2.8)
15
+ builder (~> 3.0.0)
16
+ erubis (~> 2.7.0)
17
+ journey (~> 1.0.4)
18
+ rack (~> 1.4.0)
19
+ rack-cache (~> 1.2)
20
+ rack-test (~> 0.6.1)
21
+ sprockets (~> 2.1.3)
22
+ activemodel (3.2.8)
23
+ activesupport (= 3.2.8)
24
+ builder (~> 3.0.0)
25
+ activerecord (3.2.8)
26
+ activemodel (= 3.2.8)
27
+ activesupport (= 3.2.8)
28
+ arel (~> 3.0.2)
29
+ tzinfo (~> 0.3.29)
30
+ activeresource (3.2.8)
31
+ activemodel (= 3.2.8)
32
+ activesupport (= 3.2.8)
33
+ activesupport (3.2.8)
34
+ i18n (~> 0.6)
35
+ multi_json (~> 1.0)
36
+ arel (3.0.2)
37
+ builder (3.0.0)
38
+ coffee-rails (3.2.2)
39
+ coffee-script (>= 2.2.0)
40
+ railties (~> 3.2.0)
41
+ coffee-script (2.2.0)
42
+ coffee-script-source
43
+ execjs
44
+ coffee-script-source (1.3.3)
45
+ erubis (2.7.0)
46
+ execjs (1.4.0)
47
+ multi_json (~> 1.0)
48
+ haml (3.1.4)
49
+ haml-rails (0.3.4)
50
+ actionpack (~> 3.0)
51
+ activesupport (~> 3.0)
52
+ haml (~> 3.0)
53
+ railties (~> 3.0)
54
+ hike (1.2.1)
55
+ i18n (0.6.0)
56
+ journey (1.0.4)
57
+ jquery-rails (2.1.1)
58
+ railties (>= 3.1.0, < 5.0)
59
+ thor (~> 0.14)
60
+ json (1.7.5)
61
+ mail (2.4.4)
62
+ i18n (>= 0.4.0)
63
+ mime-types (~> 1.16)
64
+ treetop (~> 1.4.8)
65
+ mime-types (1.19)
66
+ multi_json (1.3.6)
67
+ polyglot (0.3.3)
68
+ quiet_assets (1.0.0)
69
+ rails (~> 3.1)
70
+ qunit-rails (0.0.2)
71
+ railties (~> 3.2.3)
72
+ rack (1.4.1)
73
+ rack-cache (1.2)
74
+ rack (>= 0.4)
75
+ rack-ssl (1.3.2)
76
+ rack
77
+ rack-test (0.6.1)
78
+ rack (>= 1.0)
79
+ rails (3.2.8)
80
+ actionmailer (= 3.2.8)
81
+ actionpack (= 3.2.8)
82
+ activerecord (= 3.2.8)
83
+ activeresource (= 3.2.8)
84
+ activesupport (= 3.2.8)
85
+ bundler (~> 1.0)
86
+ railties (= 3.2.8)
87
+ railties (3.2.8)
88
+ actionpack (= 3.2.8)
89
+ activesupport (= 3.2.8)
90
+ rack-ssl (~> 1.3.2)
91
+ rake (>= 0.8.7)
92
+ rdoc (~> 3.4)
93
+ thor (>= 0.14.6, < 2.0)
94
+ rake (0.9.2.2)
95
+ rdoc (3.12)
96
+ json (~> 1.4)
97
+ sass (3.1.14)
98
+ sass-rails (3.2.4)
99
+ railties (~> 3.2.0)
100
+ sass (>= 3.1.10)
101
+ tilt (~> 1.3)
102
+ sprockets (2.1.3)
103
+ hike (~> 1.2)
104
+ rack (~> 1.0)
105
+ tilt (~> 1.1, != 1.3.0)
106
+ sqlite3 (1.3.6)
107
+ thor (0.16.0)
108
+ tilt (1.3.3)
109
+ treetop (1.4.10)
110
+ polyglot
111
+ polyglot (>= 0.3.1)
112
+ tzinfo (0.3.33)
9
113
 
10
114
  PLATFORMS
11
115
  ruby
12
116
 
13
117
  DEPENDENCIES
118
+ coffee-rails (~> 3.2.1)
119
+ haml-rails
120
+ jquery-rails
121
+ quiet_assets
122
+ qunit-rails
123
+ rails (~> 3.2.8)
124
+ sass-rails (~> 3.2.3)
125
+ sqlite3
14
126
  ultimate-base!
@@ -1,6 +1,12 @@
1
+ # require:
2
+ # jquery ~> 1.7.0
3
+ # underscore ~> 1.3.0
4
+
1
5
  #= require ultimate/helpers
2
6
 
3
- (@Ultimate ||= {}).Backbone =
7
+ @Ultimate ||= {}
8
+
9
+ @Ultimate.Backbone =
4
10
 
5
11
  debugMode: false
6
12
 
@@ -10,6 +16,12 @@
10
16
  Array::push.apply a, arguments if arguments.length > 0
11
17
  cout.apply @, a
12
18
 
13
- isView: (viewClass) -> viewClass instanceof Backbone.View
19
+ isView: (view) -> view instanceof Backbone.View
14
20
 
15
21
  isViewClass: (viewClass) -> (viewClass::) instanceof Backbone.View
22
+
23
+ isModel: (model) -> model instanceof Backbone.Model
24
+
25
+ isCollection: (collection) -> collection instanceof Backbone.Collection
26
+
27
+ isRouter: (router) -> router instanceof Backbone.Router
@@ -27,7 +27,7 @@ do ($ = jQuery) ->
27
27
  return jContainer unless argsLength
28
28
  command = "_configure"
29
29
  if view[command]
30
- return getValue(view, command)
30
+ return _.result(view, command)
31
31
  else
32
32
  $.error "Command [#{command}] does not exist on jQuery.#{pluginName}()"
33
33
  else
@@ -1,3 +1,5 @@
1
+ # * Require ./../underscore/underscore.string
2
+ # * Require ./../underscore/underscore.inflection
1
3
  #= require ./base
2
4
 
3
5
  class Ultimate.Backbone.Model extends Backbone.Model
@@ -14,3 +16,7 @@ class Ultimate.Backbone.Model extends Backbone.Model
14
16
  @fetch success: (=> @readyDeferred.resolve()), silent: true
15
17
  else
16
18
  callback.apply context, [@]
19
+
20
+ singular: ->
21
+ _.singularize(_.string.underscored(constructor.name))
22
+ (@className or @constructor.name or 'Model')
@@ -1,3 +1,4 @@
1
+ # * Require ./../underscore/underscore.outcasts
1
2
  #= require ./base
2
3
 
3
4
  class Ultimate.Backbone.View extends Backbone.View
@@ -47,7 +48,7 @@ class Ultimate.Backbone.View extends Backbone.View
47
48
  _isObject = _.isObject(selector)
48
49
  if _isObject
49
50
  nestedNodes = selector
50
- selector = _delete(nestedNodes, "selector")
51
+ selector = _.outcasts.delete(nestedNodes, "selector")
51
52
  jNodes[nodeName] = @[nodeName] = jRoot.find(selector)
52
53
  if _isObject
53
54
  _.extend jNodes, @findNodes(jNodes[nodeName], nestedNodes)
@@ -66,12 +67,12 @@ class Ultimate.Backbone.View extends Backbone.View
66
67
  delegateEventSplitter = /^(\S+)\s*(.*)$/
67
68
 
68
69
  normalizeEvents: (events) ->
69
- events = getValue(@, "events") unless events
70
+ events = _.result(@, "events") unless events
70
71
  if events
71
72
  normalizedEvents = {}
72
73
  for key, method of events
73
74
  [[], eventName, selector] = key.match(delegateEventSplitter)
74
- selector = getValue(@, selector)
75
+ selector = _.result(@, selector)
75
76
  selector = selector.selector if selector instanceof jQuery
76
77
  if _.isString(selector)
77
78
  key = "#{eventName} #{selector}"
@@ -87,7 +88,7 @@ class Ultimate.Backbone.View extends Backbone.View
87
88
  @initTranslations()
88
89
  @reflectOptions()
89
90
 
90
- reflectOptions: (viewOptions = getValue(@, "viewOptions"), options = @options) ->
91
+ reflectOptions: (viewOptions = _.result(@, "viewOptions"), options = @options) ->
91
92
  @[attr] = options[attr] for attr in viewOptions when typeof options[attr] isnt "undefined"
92
93
  @[attr] = value for attr, value of options when typeof @[attr] isnt "undefined"
93
94
  @
@@ -1,3 +1,6 @@
1
+ # TODO timeout without cycling, maybe bouce effect
2
+ # TODO mousewheel
3
+
1
4
  Ultimate.Backbone.Views ||= {}
2
5
 
3
6
  class Ultimate.Backbone.Views.Slider extends Ultimate.Backbone.View
@@ -39,7 +42,7 @@ class Ultimate.Backbone.Views.Slider extends Ultimate.Backbone.View
39
42
  if @totalItems
40
43
  @jItems.each (index) -> $(@).attr "data-slide-index", index
41
44
  jFirstItem = @jItems.first()
42
- @itemSize = jFirstItem[_.camelize("outer-#{@sizeAttr}")](true)
45
+ @itemSize = jFirstItem[_.string.camelize("outer-#{@sizeAttr}")](true)
43
46
  needSize = @totalItems * @itemSize
44
47
  @jLine[@sizeAttr](needSize) if @jLine[@sizeAttr]() < needSize
45
48
  @displayItems = Math.round(@jDisplay[@sizeAttr]() / @itemSize)
@@ -1,63 +1,80 @@
1
+ #= require ./base
2
+ #= require ./tag
1
3
 
2
- @is_uri = (path) ->
3
- /^[-a-z]+:\/\/|^cid:|^\/\//.test path
4
-
5
- @without_extension = (source) ->
6
- source.replace /^(.+)(\.\w+)$/, '$1'
7
-
8
- @rewrite_extension = (source, ext) =>
9
- "#{@without_extension source}.#{ext}"
10
-
11
- @ASSET_ID = ''
12
- @asset_ids_cache = {}
13
- # Use the ASSET_ID inscope variable or the random hash as its cache-busting asset id.
14
- @asset_id = (source) =>
15
- if _.isString @ASSET_ID
16
- @ASSET_ID
17
- else
18
- @asset_ids_cache[source] or (@asset_ids_cache[source] = 10000000 + Math.floor(Math.random() * 90000000))
19
-
20
- # Break out the asset path rewrite in case plugins wish to put the asset id
21
- # someplace other than the query string.
22
- @rewrite_asset_path = (source, dir) =>
23
- source = "/#{dir}/#{source}" unless source[0] is '/'
24
- if id = @asset_id(source)
25
- "#{source}?#{id}"
26
- else
27
- source
4
+ @Ultimate.Helpers.AssetTag =
5
+
6
+ favicon_link_tag: (source = 'favicon.ico', options = {}) ->
7
+ tag 'link', _.extend {},
8
+ rel: 'shortcut icon'
9
+ type: 'image/vnd.microsoft.icon'
10
+ href: @path_to_image(source)
11
+ , options
12
+
13
+ image_path: (source) ->
14
+ if source then @compute_public_path(source, 'images') else ''
15
+
16
+ path_to_image: (args...) -> @image_path args... # aliased to avoid conflicts with an image_path named route
17
+
18
+ image_tag: (source, options = {}) ->
19
+ src = options['src'] = @path_to_image(source)
20
+ if _.isUndefined(options['alt']) and src and not /^(?:cid|data):/.test(src)
21
+ options['alt'] = @image_alt(src)
22
+ if size = _.outcasts.delete(options, 'size')
23
+ if matches = size.match(/^(\d+)x(\d+)$/)
24
+ options['width'] = matches[1]
25
+ options['height'] = matches[2]
26
+ Ultimate.Helpers.Tag.tag 'img', options
27
+
28
+ image_alt: (src) ->
29
+ _.string.capitalize @without_extension(@basename(src)).replace(/-[A-Fa-f0-9]{32}/, '')
28
30
 
29
- @rewrite_relative_url_root = (source, relative_url_root) ->
30
- if relative_url_root and not _.startsWith(source, "#{relative_url_root}/")
31
- "#{relative_url_root}#{source}"
32
- else
33
- source
34
31
 
35
- @RELATIVE_URL_ROOT = ''
36
32
 
37
- @compute_public_path = (source, dir, options = {}) =>
38
- return source if is_uri(source)
39
- source = @rewrite_extension(source, options['ext']) if options['ext']
40
- source = @rewrite_asset_path(source, dir)
41
- source = @rewrite_relative_url_root(source, @RELATIVE_URL_ROOT)
42
- source
33
+ # ===================== AssetPaths =====================
34
+
35
+ URI_REGEXP: /^[-a-z]+:\/\/|^(?:cid|data):|^\/\//
36
+
37
+ is_uri: (path) ->
38
+ @URI_REGEXP.test(path)
39
+
40
+ RELATIVE_URL_ROOT: ''
41
+
42
+ compute_public_path: (source, dir, options = {}) ->
43
+ return source if @is_uri(source)
44
+ source = @rewrite_extension(source, options['ext']) if options['ext']
45
+ source = @rewrite_asset_path(source, dir)
46
+ source = @rewrite_relative_url_root(source, @RELATIVE_URL_ROOT)
47
+ source
48
+
49
+ rewrite_extension: (source, ext) ->
50
+ "#{@without_extension source}.#{ext}"
43
51
 
44
- @image_path = (source) =>
45
- @compute_public_path(source, 'images')
52
+ without_extension: (source) ->
53
+ source.replace /^(.+)(\.\w+)$/, '$1'
46
54
 
47
- @path_to_image = @image_path # aliased to avoid conflicts with an image_path named route
55
+ ASSET_ID: ''
56
+ asset_ids_cache: {}
57
+ # Use the ASSET_ID inscope variable or the random hash as its cache-busting asset id.
58
+ asset_id: (source) ->
59
+ if _.isString @ASSET_ID
60
+ @ASSET_ID
61
+ else
62
+ @asset_ids_cache[source] or (@asset_ids_cache[source] = 10000000 + Math.floor(Math.random() * 90000000))
48
63
 
49
- @basename = (source) =>
50
- source = matches[2] if matches = source.match /^(.*\/)?(.+)?$/
64
+ # Break out the asset path rewrite in case plugins wish to put the asset id
65
+ # someplace other than the query string.
66
+ rewrite_asset_path: (source, dir) ->
67
+ source = "/#{dir}/#{source}" unless source[0] is '/'
68
+ if id = @asset_id(source)
69
+ "#{source}?#{id}"
70
+ else
71
+ source
51
72
 
52
- @image_alt = (src) =>
53
- _.capitalize @without_extension(@basename(src))
73
+ rewrite_relative_url_root: (source, relative_url_root) ->
74
+ if relative_url_root and not _.startsWith(source, "#{relative_url_root}/")
75
+ "#{relative_url_root}#{source}"
76
+ else
77
+ source
54
78
 
55
- @image_tag = (source, options = {}) =>
56
- src = options['src'] = @path_to_image source
57
- unless options['alt'] or /^cid:/.test src
58
- options['alt'] = @image_alt(src)
59
- if size = _delete(options, 'size')
60
- if matches = size.match /^(\d+)x(\d+)$/
61
- options['width'] = matches[1]
62
- options['height'] = matches[2]
63
- tag 'img', options
79
+ basename: (source) ->
80
+ source = matches[2] if matches = source.match(/^(.*\/)?(.+)?$/)
@@ -0,0 +1,3 @@
1
+ @Ultimate ||= {}
2
+
3
+ @Ultimate.Helpers ||= {}
@@ -1,14 +1,19 @@
1
- @g_decor_body = (tag, inner) =>
2
- @content_tag(tag, '', class: 'left') +
3
- @content_tag(tag, '', class: 'right') +
4
- @content_tag(tag, inner, class: 'fill')
5
-
6
- @g_star_decor_body = (tag, inner) =>
7
- @content_tag(tag, inner, class: 'wrapper') +
8
- @content_tag(tag, '', class: 'corner left top') +
9
- @content_tag(tag, '', class: 'corner right top') +
10
- @content_tag(tag, '', class: 'corner left bottom') +
11
- @content_tag(tag, '', class: 'corner right bottom')
12
-
13
- @g_wrapper_decor_body = (tag, inner) =>
14
- @content_tag tag, inner, class: 'wrapper'
1
+ #= require ./base
2
+ #= require ./tag
3
+
4
+ @Ultimate.Helpers.Decor =
5
+
6
+ g_decor_body: (tag, inner) ->
7
+ content_tag(tag, '', class: 'left') +
8
+ content_tag(tag, '', class: 'right') +
9
+ content_tag(tag, inner, class: 'fill')
10
+
11
+ g_star_decor_body: (tag, inner) ->
12
+ content_tag(tag, inner, class: 'wrapper') +
13
+ content_tag(tag, '', class: 'corner left top') +
14
+ content_tag(tag, '', class: 'corner right top') +
15
+ content_tag(tag, '', class: 'corner left bottom') +
16
+ content_tag(tag, '', class: 'corner right bottom')
17
+
18
+ g_wrapper_decor_body: (tag, inner) ->
19
+ content_tag tag, inner, class: 'wrapper'