Skip to content
Extraits de code Groupes Projets
application_helper.rb 2,1 ko
Newer Older
  • Learn to ignore specific revisions
  • Raphael's avatar
    Raphael a validé
    #   Copyright (c) 2010, Diaspora Inc.  This file is
    
    Raphael's avatar
    Raphael a validé
    #   licensed under the Affero General Public License version 3 or later.  See
    
    Raphael's avatar
    Raphael a validé
    #   the COPYRIGHT file.
    
    Raphael Sofaer's avatar
    Raphael Sofaer a validé
    module ApplicationHelper
    
        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)+'&notes='+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
    
    
        object.attributes.keys
    
      def type_partial(post)
        class_name = post.class.name.to_s.underscore
        "#{class_name.pluralize}/#{class_name}"
      end
    
    maxwell's avatar
    maxwell a validé
      def hard_link(string, path)
    
        link_to string, path, :rel => 'external'
    
    maxwell's avatar
    maxwell a validé
      end
    
      def post_yield_tag(post)
        (':' + post.id.to_s).to_sym
      end
    
        image_tag 'icons/monotone_question.png', :class => 'what_is_this', :title => text
    
    
      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
    
    MrZYX's avatar
    MrZYX a validé
      def direction_for(string)
    
        return '' unless string.respond_to?(:cleaned_is_rtl?)
    
    
      def rtl?
        @rtl ||= RTL_LANGUAGES.include? I18n.locale
      end
    
      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
    
    Raphael Sofaer's avatar
    Raphael Sofaer a validé
    end