Sha256: 388f7964f8449b1c396c9a54a0740bbb16be122aec9ce3888f1691438a34f9e4

Contents?: true

Size: 658 Bytes

Versions: 20

Compression:

Stored size: 658 Bytes

Contents

# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
  
  def format_title(title)
    title_words = title.split(" ")
    
    if title_words.size >= 2
      f_half_loc = (title_words.size/2.0).ceil
      content = "<span class='first_half'>"
      (0..f_half_loc-1).each do |i|
        content += title_words[i]
      end
      content += "</span>"
      
      content += "<span class='second_half'>"
      (f_half_loc..title_words.size-1).each do |i|
        content += title_words[i]
      end
      content += "</span>"
      
    else
      content = title
    end
    return content
  end

end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
headstart-0.11.2 generators/headstart/templates/app/helpers/application_helper.rb
headstart-0.11.1 generators/headstart/templates/app/helpers/application_helper.rb
headstart-0.9.2 generators/headstart/templates/app/helpers/application_helper.rb
headstart-0.9.1 generators/headstart/templates/app/helpers/application_helper.rb
headstart-0.9.0 generators/headstart/templates/app/helpers/application_helper.rb
headstart-0.8.0 generators/headstart/templates/app/helpers/application_helper.rb
headstart-0.7.0 generators/headstart/templates/app/helpers/application_helper.rb
headstart-0.6.2 generators/headstart/templates/app/helpers/application_helper.rb
headstart-0.6.1 generators/headstart/templates/app/helpers/application_helper.rb
headstart-0.6.0 generators/headstart/templates/app/helpers/application_helper.rb
headstart-0.5.5 generators/headstart/templates/app/helpers/application_helper.rb
headstart-0.5.4 generators/headstart/templates/app/helpers/application_helper.rb
headstart-0.5.3 generators/headstart/templates/app/helpers/application_helper.rb
headstart-0.5.2 generators/headstart/templates/app/helpers/application_helper.rb
headstart-0.5.1 generators/headstart/templates/app/helpers/application_helper.rb
headstart-0.5.0 generators/headstart/templates/app/helpers/application_helper.rb
headstart-0.4.2 generators/headstart/templates/app/helpers/application_helper.rb
headstart-0.4.1 generators/headstart/templates/app/helpers/application_helper.rb
headstart-0.4.0 generators/headstart/templates/app/helpers/application_helper.rb
headstart-0.3.0 generators/headstart/templates/app/helpers/application_helper.rb