2016-02-12 23:52:43 +08:00
|
|
|
module OrganizationsHelper
|
2016-10-11 22:46:30 +08:00
|
|
|
# resets the current organization if needed
|
2016-10-11 22:16:48 +08:00
|
|
|
def current_organization_switch(org)
|
|
|
|
if org != current_organization
|
|
|
|
current_user.current_organization_id = org.id
|
|
|
|
current_user.save
|
|
|
|
end
|
|
|
|
end
|
2016-10-17 15:47:36 +08:00
|
|
|
|
|
|
|
def truncate_organization_name(name, len = Constants::NAME_TRUNCATION_LENGTH)
|
|
|
|
if name.length > len
|
|
|
|
"<div class='modal-tooltip'>#{truncate(name, length: len)}
|
|
|
|
<span class='modal-tooltiptext'>#{name}</span></div>".html_safe
|
|
|
|
else
|
|
|
|
name
|
|
|
|
end
|
|
|
|
end
|
2016-02-12 23:52:43 +08:00
|
|
|
end
|