Mercurial > zeropaste
annotate app/helpers/application_helper.rb @ 504:aaf58c17694b
Move out custom application config
| author | nanaya <me@nanaya.net> |
|---|---|
| date | Mon, 16 Dec 2024 01:34:05 +0900 |
| parents | 68231013b01b |
| children |
| rev | line source |
|---|---|
| 0 | 1 module ApplicationHelper |
| 26 | 2 def html_title |
| 331 | 3 base_title = "Zeropaste" |
| 26 | 4 if content_for? :title |
| 5 "#{content_for(:title)} | #{h base_title}".html_safe | |
| 6 else | |
| 7 base_title | |
| 8 end | |
| 9 end | |
| 398 | 10 |
| 11 def error_class(object, attribute) | |
| 469 | 12 "is-invalid" if object.errors.include? attribute |
| 398 | 13 end |
| 437 | 14 |
| 15 def with_host(url) | |
| 16 return url if url[0] != "/" | |
| 17 | |
| 18 "#{request.protocol}#{request.host_with_port}#{url}" | |
| 19 end | |
| 0 | 20 end |
