- Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathapplication_helper.rb
83 lines (70 loc) · 2 KB
/
application_helper.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
moduleApplicationHelper
defshow_ads?
ENV['SHOW_ADS'] == 'true' || Rails.env.development?
end
defdarkened_bg_image(filename)
transparency='0.60'
"background-image: linear-gradient(to bottom, rgba(0,0,0,#{transparency}) 0%,rgba(0,0,0,#{transparency}) 100%), url(#{asset_path(filename)});"
end
deftime_ago_in_words_with_ceiling(time)
iftime < 1.year.ago
'over 1 year'
else
time_ago_in_words(time)
end
end
defhide_on_profile
return'hide'ifparams[:controller] == 'users'
end
defhide_on_auth
ifparams[:controller] == 'clearance/sessions' ||
params[:controller] == 'clearance/users' ||
params[:controller] == 'clearance/passwords' ||
params[:page] == 'not_found' ||
params[:page] == 'server_error' ||
params[:finish_signup].present?
return'hide'
end
end
defdefault_meta_tags
{
charset: 'UTF-8',
viewport: 'width=device-width,initial-scale=1',
description: "Programming tips, tools, and projects from our developer community.",
keywords: 'prgramming tips, coderwall, learn to program, code, coding, open source programming, OSS, developers, programmers',
og: {
title: :title,
url: :canonical,
site_name: 'Coderwall',
description: :description,
type: 'website'
},
twitter: {
title: :title,
url: :canonical,
site_name: 'Coderwall',
site: '@coderwall',
card: 'summary'
}
}
end
defmeta(meta_tags)
set_meta_tags(meta_tags)
end
defmeta_person_schema_url
'https://schema.org/Person'
end
defmeta_address_schema_url
'https://schema.org/Address'
end
defmeta_article_schema_url
'https://schema.org/TechArticle'
end
defmeta_comment_schema_url
'https://schema.org/Comment'
end
defnext_lunch_and_learn
day=Stream.next_weekly_lunch_and_learn
day.strftime("%A %B #{day.day.ordinalize}")
end
end