aptible-rails 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/aptible-rails.gemspec +2 -2
- data/lib/aptible/rails/controller.rb +11 -3
- data/lib/aptible/rails/railtie.rb +5 -0
- data/lib/aptible/rails/url_helper.rb +11 -0
- data/lib/aptible/rails/version.rb +1 -1
- data/lib/aptible/rails/view_helper.rb +26 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1ce86f107ca7e84482a8448f394e8b135c8c35e
|
4
|
+
data.tar.gz: 3fd7be09ad266238abaab36355f53bfcc222a912
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75de1a55ddec9d4e12f3c37805965314d9ba41e069c1755474b5dbe0575bbd007281b42d4640103fcaa6fdb611c094cb1d9e1bf9c183906086a6be9f2e6f1668
|
7
|
+
data.tar.gz: 61a2cfe8049a4a6cd0b58420901bcb4bd165e22f316a403942bb4548f9127340a5b19b9093d69f7a6a865dba5f3d5f755211e4b8704c40c5dd5b3a9a615125c2
|
data/aptible-rails.gemspec
CHANGED
@@ -10,8 +10,8 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.version = Aptible::Rails::VERSION
|
11
11
|
spec.authors = ['Frank Macreery']
|
12
12
|
spec.email = ['frank@macreery.com']
|
13
|
-
spec.description =
|
14
|
-
spec.summary =
|
13
|
+
spec.description = 'Rails helpers for Aptible service applications'
|
14
|
+
spec.summary = 'Rails helpers for Aptible service applications'
|
15
15
|
spec.homepage = 'https://github.com/aptible/aptible-rails'
|
16
16
|
spec.license = 'MIT'
|
17
17
|
|
@@ -8,9 +8,9 @@ module Aptible
|
|
8
8
|
|
9
9
|
included do
|
10
10
|
helper_method :auth, :api, :current_aptible_user,
|
11
|
-
:current_organization, :subscribed?,
|
12
|
-
:
|
13
|
-
:
|
11
|
+
:current_organization, :subscribed?, :has_acccount?,
|
12
|
+
:email_verified?, :subscribed_and_verified?, :user_url,
|
13
|
+
:organization_url
|
14
14
|
end
|
15
15
|
|
16
16
|
def auth
|
@@ -106,6 +106,14 @@ module Aptible
|
|
106
106
|
rescue
|
107
107
|
token.serialize
|
108
108
|
end
|
109
|
+
|
110
|
+
def organization_url(id)
|
111
|
+
"#{dashboard_url}/organizations/#{id}"
|
112
|
+
end
|
113
|
+
|
114
|
+
def user_url(id = current_aptible_user.id)
|
115
|
+
"#{dashboard_url}/users/#{id}"
|
116
|
+
end
|
109
117
|
end
|
110
118
|
end
|
111
119
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'aptible/rails/controller'
|
2
2
|
require 'aptible/rails/url_helper'
|
3
|
+
require 'aptible/rails/view_helper'
|
3
4
|
|
4
5
|
module Aptible
|
5
6
|
module Rails
|
@@ -26,6 +27,10 @@ module Aptible
|
|
26
27
|
initializer 'aptible.rails.routes_helper' do
|
27
28
|
ActionController::Base.send :include, Aptible::Rails::UrlHelper
|
28
29
|
end
|
30
|
+
|
31
|
+
initializer 'aptible.rails.view_helpers' do
|
32
|
+
ActionView::Base.send :include, Aptible::Rails::ViewHelpers
|
33
|
+
end
|
29
34
|
end
|
30
35
|
end
|
31
36
|
end
|
@@ -15,15 +15,21 @@ module Aptible
|
|
15
15
|
|
16
16
|
register_url :about_url,
|
17
17
|
aptible_config.marketing_root_url + '/about'
|
18
|
+
register_url :apps_url,
|
19
|
+
aptible_config.dashboard_root_url + '/apps'
|
18
20
|
register_url :audits_url,
|
19
21
|
aptible_config.marketing_root_url + '/stressfree'
|
20
22
|
# Tumblr doesn't support HTTPS w/ our own domain
|
21
23
|
register_url :blog_url, 'http://blog.aptible.com'
|
22
24
|
register_url :compliance_url,
|
23
25
|
aptible_config.dashboard_root_url + '/compliance'
|
26
|
+
register_url :contact_support_url,
|
27
|
+
aptible_config.marketing_root_url + '/support'
|
24
28
|
register_url :contact_url,
|
25
29
|
aptible_config.marketing_root_url + '/contact'
|
26
30
|
register_url :dashboard_url, aptible_config.dashboard_root_url
|
31
|
+
register_url :databases_url,
|
32
|
+
aptible_config.dashboard_root_url + '/databases'
|
27
33
|
register_url :docs_url, aptible_config.marketing_root_url + '/docs'
|
28
34
|
register_url :edit_organization_url,
|
29
35
|
aptible_config.dashboard_root_url + '/organization'
|
@@ -34,11 +40,16 @@ module Aptible
|
|
34
40
|
register_url :legal_url, aptible_config.marketing_root_url + '/legal'
|
35
41
|
register_url :logout_url, aptible_config.dashboard_root_url + '/logout'
|
36
42
|
register_url :marketing_url, aptible_config.marketing_root_url
|
43
|
+
register_url :organizations_url,
|
44
|
+
aptible_config.dashboard_root_url + '/organizations'
|
37
45
|
register_url :policy_url, aptible_config.policy_root_url
|
38
46
|
register_url :pricing_url,
|
39
47
|
aptible_config.marketing_root_url + '/pricing'
|
40
48
|
register_url :privacy_url,
|
41
49
|
aptible_config.marketing_root_url + '/privacy'
|
50
|
+
register_url :responsible_disclosure_url,
|
51
|
+
aptible_config.marketing_root_url +
|
52
|
+
'/legal/responsible_disclosure.html'
|
42
53
|
register_url :risk_url, aptible_config.risk_root_url
|
43
54
|
register_url :roles_url, aptible_config.dashboard_root_url + '/roles'
|
44
55
|
register_url :security_url, aptible_config.security_root_url
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Aptible
|
2
|
+
module Rails
|
3
|
+
module ViewHelpers
|
4
|
+
def unix_to_formatted_date(unix_timestamp, format = '%m/%d/%Y')
|
5
|
+
Time.at(unix_timestamp).to_datetime.strftime(format)
|
6
|
+
end
|
7
|
+
|
8
|
+
def gravatar_url(email, size = 80)
|
9
|
+
digest = Digest::MD5.hexdigest(email.downcase)
|
10
|
+
"https://secure.gravatar.com/avatar/#{digest}?s=#{size}"
|
11
|
+
end
|
12
|
+
|
13
|
+
def auth_url(path = '/')
|
14
|
+
URI.join Aptible::Auth.configuration.root_url, path
|
15
|
+
end
|
16
|
+
|
17
|
+
def controller?(*controller)
|
18
|
+
controller.include?(params[:controller])
|
19
|
+
end
|
20
|
+
|
21
|
+
def action?(*action)
|
22
|
+
action.include?(params[:action])
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aptible-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frank Macreery
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_config
|
@@ -142,6 +142,7 @@ files:
|
|
142
142
|
- lib/aptible/rails/railtie.rb
|
143
143
|
- lib/aptible/rails/url_helper.rb
|
144
144
|
- lib/aptible/rails/version.rb
|
145
|
+
- lib/aptible/rails/view_helper.rb
|
145
146
|
- spec/spec_helper.rb
|
146
147
|
homepage: https://github.com/aptible/aptible-rails
|
147
148
|
licenses:
|