2022-12-25 22:32:34 +01:00
|
|
|
|
2022-11-21 11:10:04 +01:00
|
|
|
module ApplicationHelper
|
2023-01-15 20:24:05 +01:00
|
|
|
include Merged::SharedHelper
|
2022-12-25 22:32:34 +01:00
|
|
|
|
2023-01-15 13:59:06 +01:00
|
|
|
def shorten(text , to = 100)
|
|
|
|
return "" if text.blank?
|
|
|
|
"#{text[0..to]} . . . ".html_safe
|
|
|
|
end
|
|
|
|
|
2022-12-25 22:32:34 +01:00
|
|
|
|
2022-12-20 23:34:11 +01:00
|
|
|
def main_app
|
|
|
|
Rails.application.routes.url_helpers
|
|
|
|
end
|
2023-01-03 18:38:04 +01:00
|
|
|
|
2023-01-10 21:23:56 +01:00
|
|
|
def button_classes
|
|
|
|
"mr-3 inline-block rounded-lg px-3 py-2 text-md font-medium border border-gray-500"
|
|
|
|
end
|
|
|
|
|
2023-01-15 13:59:06 +01:00
|
|
|
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
|
|
|
|
|
2023-01-21 19:25:58 +01:00
|
|
|
def main_menu
|
|
|
|
[["/retreats" , "Retreats"], ["/studios" , "Studios"],
|
|
|
|
["/makerspace" , "Makerspace"],["/coworking" , "Coworking"],
|
|
|
|
["/about" , "About"], ]
|
|
|
|
end
|
|
|
|
def member_memu
|
2023-04-19 13:40:49 +02:00
|
|
|
items =[ [main_app.settings_members_path , "Settings"]]
|
2023-01-29 12:19:14 +01:00
|
|
|
if !Rails.env.production?
|
2023-01-21 19:25:58 +01:00
|
|
|
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
|
2022-11-21 11:10:04 +01:00
|
|
|
end
|