Sha256: 320480959606289360db25c0a0c43e365c93f68d362f73447e57108ee758f82a

Contents?: true

Size: 1.09 KB

Versions: 25

Compression:

Stored size: 1.09 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

25 entries across 25 versions & 5 rubygems

Version Path
activeadmin_addons-1.1.2 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-a5a53c3f2b8f/lib/active_admin/views/components/site_title.rb
activeadmin_addons-1.1.1 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/lib/active_admin/views/components/site_title.rb
yousty-activeadmin-1.0.17.pre lib/active_admin/views/components/site_title.rb
yousty-activeadmin-1.0.16.pre lib/active_admin/views/components/site_title.rb
activeadmin_addons-1.1.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/lib/active_admin/views/components/site_title.rb
activeadmin_addons-1.0.1 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/lib/active_admin/views/components/site_title.rb
activeadmin_addons-1.0.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/lib/active_admin/views/components/site_title.rb
yousty-activeadmin-1.0.15.pre lib/active_admin/views/components/site_title.rb
yousty-activeadmin-1.0.14.pre lib/active_admin/views/components/site_title.rb
yousty-activeadmin-1.0.13.pre lib/active_admin/views/components/site_title.rb
yousty-activeadmin-1.0.12.pre lib/active_admin/views/components/site_title.rb
yousty-activeadmin-1.0.11.pre lib/active_admin/views/components/site_title.rb
yousty-activeadmin-1.0.10.pre lib/active_admin/views/components/site_title.rb
yousty-activeadmin-1.0.9.pre lib/active_admin/views/components/site_title.rb
yousty-activeadmin-1.0.8.pre lib/active_admin/views/components/site_title.rb
activeadmin-1.0.0.pre2 lib/active_admin/views/components/site_title.rb
activeadmin-1.0.0.pre1 lib/active_admin/views/components/site_title.rb
yousty-activeadmin-1.0.7.pre lib/active_admin/views/components/site_title.rb
yousty-activeadmin-1.0.6.pre lib/active_admin/views/components/site_title.rb
yousty-activeadmin-1.0.5.pre lib/active_admin/views/components/site_title.rb