annotate app/helpers/application_helper.rb @ 472:b26dd8fa1c26 bootstrap-4

Update link to source
author nanaya <me@nanaya.pro>
date Sun, 23 Feb 2020 22:42:15 +0900
parents 68231013b01b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
1 module ApplicationHelper
26
a8b0775798c3 Added title.
Edho Arief <edho@myconan.net>
parents: 0
diff changeset
2 def html_title
331
7c7b7906ebd9 Some more coding style.
edogawaconan <me@myconan.net>
parents: 26
diff changeset
3 base_title = "Zeropaste"
26
a8b0775798c3 Added title.
Edho Arief <edho@myconan.net>
parents: 0
diff changeset
4 if content_for? :title
a8b0775798c3 Added title.
Edho Arief <edho@myconan.net>
parents: 0
diff changeset
5 "#{content_for(:title)} | #{h base_title}".html_safe
a8b0775798c3 Added title.
Edho Arief <edho@myconan.net>
parents: 0
diff changeset
6 else
a8b0775798c3 Added title.
Edho Arief <edho@myconan.net>
parents: 0
diff changeset
7 base_title
a8b0775798c3 Added title.
Edho Arief <edho@myconan.net>
parents: 0
diff changeset
8 end
a8b0775798c3 Added title.
Edho Arief <edho@myconan.net>
parents: 0
diff changeset
9 end
398
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 331
diff changeset
10
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 331
diff changeset
11 def error_class(object, attribute)
469
68231013b01b Now with more bootstrap than ever
nanaya <me@nanaya.pro>
parents: 437
diff changeset
12 "is-invalid" if object.errors.include? attribute
398
851432f21603 Nope, failing at redesigning.
nanaya <me@myconan.net>
parents: 331
diff changeset
13 end
437
d31fe32da7a0 Finish updating to rails 5
nanaya <me@myconan.net>
parents: 398
diff changeset
14
d31fe32da7a0 Finish updating to rails 5
nanaya <me@myconan.net>
parents: 398
diff changeset
15 def with_host(url)
d31fe32da7a0 Finish updating to rails 5
nanaya <me@myconan.net>
parents: 398
diff changeset
16 return url if url[0] != "/"
d31fe32da7a0 Finish updating to rails 5
nanaya <me@myconan.net>
parents: 398
diff changeset
17
d31fe32da7a0 Finish updating to rails 5
nanaya <me@myconan.net>
parents: 398
diff changeset
18 "#{request.protocol}#{request.host_with_port}#{url}"
d31fe32da7a0 Finish updating to rails 5
nanaya <me@myconan.net>
parents: 398
diff changeset
19 end
0
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
20 end