Sha256: 4719ddf554892203711ff5cad5066153c3024c6c5293f152d65149297472cda0

Contents?: true

Size: 1.1 KB

Versions: 62

Compression:

Stored size: 1.1 KB

Contents

module ActiveAdmin
  module Views

    class SiteTitle < Component

      def tag_name
        'h1'
      end

      def build(namespace)
        super(:id => "site_title")
        @namespace = namespace

        if site_title_link?
          text_node site_title_with_link
        else
          text_node site_title_content
        end
      end

      def site_title_link?
        @namespace.site_title_link.present?
      end

      def site_title_image?
        @namespace.site_title_image.present?
      end

      private

      def site_title_with_link
        helpers.link_to(site_title_content, @namespace.site_title_link)
      end

      def site_title_content
        if site_title_image?
          title_image
        else
          title_text
        end
      end

      def title_text
        helpers.render_or_call_method_or_proc_on(self, @namespace.site_title)
      end

      def title_image
        path = helpers.render_or_call_method_or_proc_on(self, @namespace.site_title_image)
        helpers.image_tag(path, :id => "site_title_image", :alt => @namespace.site_title)
      end

    end

  end
end

Version data entries

62 entries across 62 versions & 4 rubygems

Version Path
lalala-4.0.0.dev.128 vendor/deps/active_admin/lib/active_admin/views/components/site_title.rb
lalala-4.0.0.dev.126 vendor/deps/active_admin/lib/active_admin/views/components/site_title.rb
lalala-4.0.0.dev.125 vendor/deps/active_admin/lib/active_admin/views/components/site_title.rb
lalala-4.0.0.dev.124 vendor/deps/active_admin/lib/active_admin/views/components/site_title.rb
lalala-4.0.0.dev.123 vendor/deps/active_admin/lib/active_admin/views/components/site_title.rb
lalala-4.0.0.dev.118 vendor/deps/active_admin/lib/active_admin/views/components/site_title.rb
lalala-4.0.0.dev.116 vendor/deps/active_admin/lib/active_admin/views/components/site_title.rb
lalala-4.0.0.dev.114 vendor/deps/active_admin/lib/active_admin/views/components/site_title.rb
lalala-4.0.0.dev.113 vendor/deps/active_admin/lib/active_admin/views/components/site_title.rb
lalala-4.0.0.dev.111 vendor/deps/active_admin/lib/active_admin/views/components/site_title.rb
lalala-4.0.0.dev.109 vendor/deps/active_admin/lib/active_admin/views/components/site_title.rb
lalala-4.0.0.dev.107 vendor/deps/active_admin/lib/active_admin/views/components/site_title.rb
lalala-4.0.0.dev.94 vendor/deps/active_admin/lib/active_admin/views/components/site_title.rb
lalala-4.0.0.dev.92 vendor/deps/active_admin/lib/active_admin/views/components/site_title.rb
lalala-4.0.0.dev.90 vendor/deps/active_admin/lib/active_admin/views/components/site_title.rb
lalala-4.0.0.dev.84 vendor/deps/active_admin/lib/active_admin/views/components/site_title.rb
lalala-4.0.0.dev.80 vendor/deps/active_admin/lib/active_admin/views/components/site_title.rb
lalala-4.0.0.dev.79 vendor/deps/active_admin/lib/active_admin/views/components/site_title.rb
lalala-4.0.0.dev.78 vendor/deps/active_admin/lib/active_admin/views/components/site_title.rb
lalala-4.0.0.dev.77 vendor/deps/active_admin/lib/active_admin/views/components/site_title.rb