duffy 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/duffy/duffy_helper.rb +32 -0
- data/lib/duffy/railtie.rb +10 -0
- data/lib/duffy/version.rb +1 -1
- data/lib/duffy.rb +4 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63abea13ed8baf2db1aa51531dc80cf3513a161b
|
4
|
+
data.tar.gz: cbdb314e0fccd5048db224cffa94caec2de2dd29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
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.
|
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:
|
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.
|
97
|
+
rubygems_version: 2.4.3
|
96
98
|
signing_key:
|
97
99
|
specification_version: 4
|
98
100
|
summary: Library of things
|