atech 1.0.14 → 1.0.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,14 @@
1
+ class ActionController::TestCase
2
+ def assert_status(required)
3
+ assert_equal required, @response.status
4
+ end
5
+
6
+ def assert_json(&block)
7
+ decoded_json = ActiveSupport::JSON.decode(@response.body) rescue InvalidJsonObject.new
8
+ assert !decoded_json.is_a?(InvalidJsonObject)
9
+ block.call(decoded_json) if block_given?
10
+ end
11
+
12
+ end
13
+
14
+ class InvalidJsonObject; end
@@ -0,0 +1,39 @@
1
+ module Atech
2
+ module Helpers
3
+
4
+ ## Flash all flash messages which have been stored.
5
+ def display_flash
6
+ flashes = flash.collect do |key,msg|
7
+ content_tag :div, content_tag(:p, h(msg)), :id => "flash-#{key}"
8
+ end.join.html_safe
9
+ end
10
+
11
+ ## Insert an image tag for an icon from the 'public/images/icons' folder. If passed a symbol
12
+ ## it will automatically add '.png' to the end of the name, otherwise you need to pass the
13
+ ## full image file name.
14
+ def icon_tag(icon, text = '')
15
+ extension = (icon.is_a?(Symbol) ? ".png" : '')
16
+ image_tag "icons/#{icon.to_s}#{extension}", :alt => text, :title => text, :class => "icon #{icon}"
17
+ end
18
+
19
+ ## Alias 'c' to 'number_to_currency'
20
+ def c(*opts)
21
+ number_to_currency(*opts)
22
+ end
23
+
24
+ ## Insert a gravatar for a specified e-mail address.
25
+ def gravatar(email, options = {})
26
+ options[:size] ||= 35
27
+ options[:default] ||= 'identicon'
28
+ options[:rating] ||= 'PG'
29
+ options[:class] ||= 'gravatar'
30
+ options[:secure] ||= request.ssl?
31
+
32
+ host = (options[:secure] ? 'https://secure.gravatar.com' : 'http://gravatar.com')
33
+ path = "/avatar.php?gravatar_id=#{Digest::MD5.hexdigest(email)}&rating=#{options[:rating]}&size=#{options[:size]}&d=#{options[:default]}"
34
+
35
+ image_tag([host,path].join, :class => options[:class], :width => options[:size], :height => options[:size])
36
+ end
37
+
38
+ end
39
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atech
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 14
10
- version: 1.0.14
9
+ - 15
10
+ version: 1.0.15
11
11
  platform: ruby
12
12
  authors:
13
13
  - aTech Media
@@ -28,7 +28,9 @@ extensions: []
28
28
  extra_rdoc_files: []
29
29
 
30
30
  files:
31
- - lib/atech/seed_extensions.rb
31
+ - lib/atech/extensions/controller_tests.rb
32
+ - lib/atech/extensions/seeds.rb
33
+ - lib/atech/helpers.rb
32
34
  has_rdoc: true
33
35
  homepage: http://github.com/atech/atech
34
36
  licenses: []