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
|
module ApplicationHelper
VIDEOS=[
"bs_Ej32IYgo",
"txuWGoZF3ew",
"ua8oObEPptQ",
]
def gravatar_for(user, size: 260)
secure_host = "https://secure.gravatar.com/avatar"
options = "s=#{size}&d=mm"
image_tag "#{secure_host}/#{user.gravatar_id}?#{options}",
alt: user.username,
class: "gravatar"
end
def search_form(
id: "search-form",
path: @search_path || dashboard_path,
remote: @remote_search
)
form_tag path, id: id, method: :get, remote: remote do
search_field_tag :q, params[:q], placeholder: t(:search), class: 'input'
end
end
def random_video
video = VIDEOS.sample
iframe = content_tag(:iframe, "", width: 560, height: 315, src: "https://www.youtube-nocookie.com/embed/#{video}", frameborder: 0, allowfullscreen: true)
content_tag(:div, iframe, class: "flex-video")
end
def current_layout
controller.send(:_layout, []) || :application
end
def class_for_flash(type)
case type.to_sym
when :notice
"is-info"
when :error
"is-danger"
when :warning
"is-warning"
when :success
"is-success"
end
end
end
|