Skip to content

Instantly share code, notes, and snippets.

@ciscodesign
Created March 18, 2012 22:51
Show Gist options
  • Select an option

  • Save ciscodesign/2083659 to your computer and use it in GitHub Desktop.

Select an option

Save ciscodesign/2083659 to your computer and use it in GitHub Desktop.

Revisions

  1. Francesco Agnoletto revised this gist Mar 18, 2012. 1 changed file with 7 additions and 7 deletions.
    14 changes: 7 additions & 7 deletions Helper
    Original file line number Diff line number Diff line change
    @@ -1,26 +1,26 @@
    def icon(name, *options)
    def icon(name, size=1)
    #icon("camera-retro")
    #<i class="icon-camera-retro"></i>

    html = "<i class='icon-#{name}' "
    html += "style='font-size:#{options[0]}em' " if !options.empty?
    html += "style='font-size:#{size}em' "
    html += "></i>"
    html.html_safe
    end

    def button_icon(text, url, name, *options)
    #button_icon("Camera Retro button", "#","refresh")
    def button_icon(text, url, name, size=1.5, *options)
    #button_icon("Camera Retro button", "#","refresh",1)
    #<a class="button refresh" href="#"><i style="font-size:1.5em" class="icon-refresh"></i> Camera Retro button</a>
    class_to_add = "button #{name}"
    options.each { |opt| class_to_add += " #{opt}" } if !options.empty?
    link_to(url, html_options = { :class => class_to_add }) {icon(name, 1.5) + " " + text}
    end

    def link_icon(text, url, name, *options)
    #link_icon("Camera Retro button", "#","refresh")
    def link_icon(text, url, name, size=1, *options)
    #link_icon("Camera Retro button", "#","refresh",1)
    # <a class="refresh" href="#"><i style="font-size:1.5em" class="icon-refresh"></i> Camera Retro button</a>

    class_to_add = "#{name}"
    options.each { |opt| class_to_add += " #{opt}" } if !options.empty?
    link_to(url, html_options = { :class => class_to_add }) {icon(name) + " " + text}
    link_to(url, html_options = { :class => class_to_add }) {icon(name, size) + " " + text}
    end
  2. Francesco Agnoletto revised this gist Mar 18, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Helper
    Original file line number Diff line number Diff line change
    @@ -16,7 +16,7 @@
    link_to(url, html_options = { :class => class_to_add }) {icon(name, 1.5) + " " + text}
    end

    def link_icon(text, url, name, *option)
    def link_icon(text, url, name, *options)
    #link_icon("Camera Retro button", "#","refresh")
    # <a class="refresh" href="#"><i style="font-size:1.5em" class="icon-refresh"></i> Camera Retro button</a>

  3. Francesco Agnoletto revised this gist Mar 18, 2012. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions Helper
    Original file line number Diff line number Diff line change
    @@ -16,10 +16,11 @@
    link_to(url, html_options = { :class => class_to_add }) {icon(name, 1.5) + " " + text}
    end

    def link_icon(text, url, name)
    def link_icon(text, url, name, *option)
    #link_icon("Camera Retro button", "#","refresh")
    # <a class="refresh" href="#"><i style="font-size:1.5em" class="icon-refresh"></i> Camera Retro button</a>

    class_to_add = "#{name}"
    link_to(url, html_options = { :class => class_to_add }) {icon(name, 1.5) + " " + text}
    options.each { |opt| class_to_add += " #{opt}" } if !options.empty?
    link_to(url, html_options = { :class => class_to_add }) {icon(name) + " " + text}
    end
  4. Francesco Agnoletto created this gist Mar 18, 2012.
    25 changes: 25 additions & 0 deletions Helper
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    def icon(name, *options)
    #icon("camera-retro")
    #<i class="icon-camera-retro"></i>

    html = "<i class='icon-#{name}' "
    html += "style='font-size:#{options[0]}em' " if !options.empty?
    html += "></i>"
    html.html_safe
    end

    def button_icon(text, url, name, *options)
    #button_icon("Camera Retro button", "#","refresh")
    #<a class="button refresh" href="#"><i style="font-size:1.5em" class="icon-refresh"></i> Camera Retro button</a>
    class_to_add = "button #{name}"
    options.each { |opt| class_to_add += " #{opt}" } if !options.empty?
    link_to(url, html_options = { :class => class_to_add }) {icon(name, 1.5) + " " + text}
    end

    def link_icon(text, url, name)
    #link_icon("Camera Retro button", "#","refresh")
    # <a class="refresh" href="#"><i style="font-size:1.5em" class="icon-refresh"></i> Camera Retro button</a>

    class_to_add = "#{name}"
    link_to(url, html_options = { :class => class_to_add }) {icon(name, 1.5) + " " + text}
    end