Created
March 23, 2019 04:12
-
-
Save yasuhito/2b2e3dfd8742e1029d28c7b9be3b55dd to your computer and use it in GitHub Desktop.
タイトルのヘルパ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module TitleHelper | |
def title(text: nil, size: nil, url: nil, spaced: false, &block) | |
body = text || capture(&block) || raise('Text is a mandatory.') | |
klass = CssClassString::Helper.new('title', "is-#{size}" => size, 'is-spaced' => spaced).to_s | |
if url | |
link_to body, url, class: klass | |
else | |
tag.__send__ "h#{size || 3}", body, class: klass | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment