48 lines
1.0 KiB
Ruby
48 lines
1.0 KiB
Ruby
|
|
module ApplicationHelper
|
|
include Merged::SharedHelper
|
|
|
|
def shorten(text , to = 100)
|
|
return "" if text.blank?
|
|
"#{text[0..to]} . . . ".html_safe
|
|
end
|
|
|
|
|
|
def main_app
|
|
Rails.application.routes.url_helpers
|
|
end
|
|
|
|
def button_classes
|
|
"mr-3 inline-block rounded-lg px-3 py-2 text-md font-medium border border-gray-500"
|
|
end
|
|
|
|
def image_for(someone , classes = "")
|
|
if someone.picture.blank?
|
|
image = asset_url("no_image.png")
|
|
else
|
|
image = someone.picture.url
|
|
end
|
|
image_tag(image , alt: someone.name , class: classes )
|
|
end
|
|
|
|
def main_menu
|
|
[["/retreats" , "Retreats"], ["/studios" , "Studios"],
|
|
["/makerspace" , "Makerspace"],["/coworking" , "Coworking"],
|
|
["/about" , "About"], ]
|
|
end
|
|
def member_memu
|
|
items =[ [main_app.settings_members_path , "Settings"]]
|
|
if !Rails.env.production?
|
|
items << [merged.pages_path(), "CMS" ]
|
|
end
|
|
items
|
|
end
|
|
def mobile_menu
|
|
if current_member
|
|
member_memu
|
|
else
|
|
[main_app.member_session_path, "Login"]
|
|
end
|
|
end
|
|
end
|