Newer
Older
# licensed under the Affero General Public License version 3 or later. See
Daniel Vincent Grippi
a validé
Arzumy MD
a validé
def how_long_ago(obj)
timeago(obj.created_at)
end
def timeago(time, options={})
options[:class] ||= "timeago"
content_tag(:abbr, time.to_s, options.merge(:title => time.iso8601)) if time
def bookmarklet
"javascript:(function(){f='#{AppConfig[:pod_url]}bookmarklet?url='+encodeURIComponent(window.location.href)+'&title='+encodeURIComponent(document.title)+'¬es='+encodeURIComponent(''+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text))+'&v=1&';a=function(){if(!window.open(f+'noui=1&jump=doclose','diasporav1','location=yes,links=no,scrollbars=no,toolbar=no,width=620,height=250'))location.href=f+'jump=yes'};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})()"
end
maxwell
a validé
def object_fields(object)
maxwell
a validé
end
def type_partial(post)
class_name = post.class.name.to_s.underscore
"#{class_name.pluralize}/#{class_name}"
end
link_to string, path, :rel => 'external'
danielvincent
a validé
def post_yield_tag(post)
(':' + post.id.to_s).to_sym
end
danielvincent
a validé
def info_text(text)
image_tag 'icons/monotone_question.png', :class => 'what_is_this', :title => text
danielvincent
a validé
end
def get_javascript_strings_for(language)
defaults = I18n.t('javascripts', :locale => DEFAULT_LANGUAGE)
if language != DEFAULT_LANGUAGE
translations = I18n.t('javascripts', :locale => language)
defaults.update(translations)
end
defaults
return '' unless string.respond_to?(:cleaned_is_rtl?)
MrZYX
a validé
string.cleaned_is_rtl? ? 'rtl' : 'ltr'
def rtl?
@rtl ||= RTL_LANGUAGES.include? I18n.locale
end
danielgrippi
a validé
def contacts_link
if current_user.contacts.size > 0
contacts_path
else
featured_users_path
end
end
def all_services_connected?
current_user.services.size == AppConfig[:configured_services].size
end