duffy 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 32f797814de513e32b0d6ab202ce1d4704c49154
4
- data.tar.gz: fa5bd5c0df2c08682a5ab792d9f2a4e62563e12c
3
+ metadata.gz: 63abea13ed8baf2db1aa51531dc80cf3513a161b
4
+ data.tar.gz: cbdb314e0fccd5048db224cffa94caec2de2dd29
5
5
  SHA512:
6
- metadata.gz: ada0c0e31369e669a578562d10a467a7bf1e2526cdb26bb0d7f1827047203d7f1d744b91bd956428c26b7f1cc1fdb1bdd08f606adec6c6027a79ac3bd792cff9
7
- data.tar.gz: 4ae480a462fe7fcdb94ef1474548b7e50e5181dafac6652271b9d661e9926820c167c136abb0d076d8a6030bc54311140132373f5956fb54c5d015a7a5f09806
6
+ metadata.gz: a39fba887145bbd46ea4b13570aa99c1354164efc4d0de8fece95701598674727e9e7e5460fa6baee6af1d7156fcf223a89c4660383fd9eec15d29f597d051c6
7
+ data.tar.gz: 99434d1e26ab9d2a2dacb1e9b727fe00313f9f981d722398ddead077ceeb0309c9b2c8fa81d0ad143d207c0a2f0f118d399fbe54162bbc0d1f1135e20b6db461
@@ -0,0 +1,32 @@
1
+ module DuffyHelper
2
+
3
+ def menu_tag( title, link, options = {})
4
+ link_to(content_tag(:li, title, options), link)
5
+ end
6
+
7
+ def excel_icon(link = params.merge(:format => "xlsx"))
8
+ # Create Excel icon in consistent location
9
+ content_for :excel do
10
+ link_to(image_tag('excel.png', :width => 40, :height => 40), link)
11
+ end
12
+ end
13
+
14
+ def icon(title, link, options = {})
15
+ begin
16
+ options[:id] = "icon_#{link.parameterize("_")}"
17
+ options[:class] = [:icon] << options[:class]
18
+ options[:class] << "favorite" if defined?(current_user) and (current_user.person.details.where(key: "favorite_#{options[:id]}").any? rescue false)
19
+ link_to(title, link, options)
20
+ rescue Exception => e
21
+ Rails.env.development? ? content_tag(:p, e) : nil
22
+ end
23
+ end
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+ end
@@ -0,0 +1,10 @@
1
+ # http://stackoverflow.com/questions/5791211/how-do-i-extract-rails-view-helpers-into-a-gem
2
+
3
+ require File.dirname(__FILE__) + "/duffy_helper"
4
+ module Duffy
5
+ class Railtie < Rails::Railtie
6
+ initializer "duffy_helper" do
7
+ ActiveSupport.on_load( :action_view ){ include DuffyHelper }
8
+ end
9
+ end
10
+ end
data/lib/duffy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Duffy
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
data/lib/duffy.rb CHANGED
@@ -1,3 +1,6 @@
1
1
  require File.dirname(__FILE__) + "/duffy/version"
2
2
  require File.dirname(__FILE__) + "/duffy/git"
3
- require File.dirname(__FILE__) + "/duffy/string"
3
+ require File.dirname(__FILE__) + "/duffy/string"
4
+
5
+ # Helper LazyLoaded:
6
+ require File.dirname(__FILE__) + "/duffy/railtie" if defined?(Rails)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: duffy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacob Duffy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-19 00:00:00.000000000 Z
11
+ date: 2015-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -67,7 +67,9 @@ files:
67
67
  - Rakefile
68
68
  - duffy.gemspec
69
69
  - lib/duffy.rb
70
+ - lib/duffy/duffy_helper.rb
70
71
  - lib/duffy/git.rb
72
+ - lib/duffy/railtie.rb
71
73
  - lib/duffy/string.rb
72
74
  - lib/duffy/version.rb
73
75
  - spec/spec_helper.rb
@@ -92,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
94
  version: '0'
93
95
  requirements: []
94
96
  rubyforge_project:
95
- rubygems_version: 2.2.2
97
+ rubygems_version: 2.4.3
96
98
  signing_key:
97
99
  specification_version: 4
98
100
  summary: Library of things