Rails Create Label_tag and Link_to with multiple html elements in them



def entries_label
    label_tag '' do
      concat 'Show '
      concat content_tag(:select, options_for_select([25, 50, 100]),
        {name: 'listing_form[per_page]', id: "listing_form_per_page" , size: 1}
      )
      concat ' entries'
    end
end

Html Output -> Show [Select box] Entries

Creat link with multiple Html element:


def link_with_elements
 link_to root_url do
   concat 'Appatrip'
   concat content_tag(:span, 'v1.0')
 end
end

Html Output -> Appatripv1.0

Notice here: concat as it is used to glue html elements

Advertisements

I am Senior Software Engineer. I love reading, writing, sharing,developing, hiking, movies, trips, mountains, brooks, hills etc.

Tagged with: ,
Posted in Html, Ruby on Rails

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

StackOverFlow
Categories
Archives
%d bloggers like this: