RailsApps / rails_layout

Generates Rails application layout files for various front-end frameworks.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

foundation 4 rails 4 slim-lang

chrishough opened this issue · comments

I have been hooked on slim for a bit now and thought I would post my variations of the included templates in case others are trying to convert their base setups. The code blocks below the links are what I am using for slim.

Thank you for all your help!!

https://github.com/RailsApps/rails_layout/blob/master/lib/generators/layout/templates/foundation4-navigation.html.erb

ul class="nav"
  li
    = link_to('Home', root_path)

https://github.com/RailsApps/rails_layout/blob/master/lib/generators/layout/templates/foundation4-messages.html.erb

- flash.each do |name, msg|
  - if msg.is_a?(String)
    div(data-alert class="alert-box round #{name == :notice ? "success" : "alert"}")
      = content_tag(:div,msg)
      a href="#" class="close" ×

https://github.com/RailsApps/rails_layout/blob/master/lib/generators/layout/templates/foundation4-application.html.erb

doctype html
== "<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->"
== "<!--[if lt IE 7 ]> <html class=\"ie6\" lang=\"en\"> <![endif]-->"
== "<!--[if IE 7 ]>    <html class=\"ie7\" lang=\"en\"> <![endif]-->"
== "<!--[if IE 8 ]>    <html class=\"ie8\" lang=\"en\"> <![endif]-->"
== "<!--[if IE 9 ]>    <html class=\"ie9\" lang=\"en\"> <![endif]-->"
== "<!--[if (gt IE 9)|!(IE)]><!--> <html lang=\"en\"> <!--<![endif]-->"

head
  meta charset="utf-8"
  meta name="viewport" content="width=device-width, initial-scale=1.0"
  link href="#{ENV["MY_CDN_IMG_URL"]}/images/Favicon.png" rel="shortcut icon"
  title
    | #{ENV['MY_APPLICATION_NAME']} : 
    = @page_sub_title || ENV['MY_APPLICATION_SLOGAN']
  == stylesheet_link_tag    "application", media: "all", "data-turbolinks-track" => true
  == javascript_include_tag 'application'
  == javascript_include_tag "data-turbolinks-track" => true
  == javascript_include_tag "vendor/custom.modernizr"
  == csrf_meta_tag

body
  header
    nav class="top-bar"
      ul class="title-area"
        li class="name" IMG
        li class="toggle-topbar menu-icon"
          a href="#"
            span Menu
      section class="top-bar-section"
        == render 'layouts/navigation'
  main role="main"
    div class="container"
      div class="content"
        div class="row"
          div class="twelve columns"
            == render 'layouts/messages'
            == yield
        footer
          == render template: 'utilities/analytics'

Thanks for expressing your interest in supporting Slim.

Would it be possible for you to convert the existing templates for "simple," Bootstrap 2, and Bootstrap 3, and Foundation 4 to Slim?

Your examples above are close to templates for Foundation 4 but it would be better to match the existing templates for consistency. People can always customize as needed after using the gem to generate their files.

Sure thing, glad to help. I can fork it, set those up and shoot you a pull request back. My examples differed slightly so the ones I create will match 1=1. Would that help?

Great! I'm glad you can add Slim support.

Yes, it's best to match 1=1. Yours have some nice features but best to stick with basics.

FYI, meta charset="utf-8" is not needed because Rails sets it in the HTTP header where it belongs.

#Planned

I will make those adjustments and ping you back on this ticket.

how is this issue going , i feel interest in the slim template, so maybe i can help to write some of the templates in slim.

I had to go out of town this past week, I was going to wrap that up for the project this weekend.

@chrishough when you finish, maybe @nickcen can test the templates

@DanielKehoe no problem.

I wanted to let you know that I did not forget about this and hope to get to it this week. My day gig is tied to the U.S. shopping season so things are nuts right now.

All good. Keep us posted.

I wanted to keep you posted, this is still on my radar, but it will take me a bit longer to get to it. I have one more s3 site to launch in front of this.

Closing this issue after merging the pull request from @benedictleejh:
6c7f108

@chrishough and @nickcen could you give the newest version a try and see if everything works?

Thank you @benedictleejh. Yes, I will give that a try @DanielKehoe asap. When your gig is directly tied to the American shopping season this time of year is completely crazy. I am terribly sorry I was not able to get to this in time.

No regrets @chrishough, you expressed an interest and got the ball rolling. I'm glad to see there was strong interest and someone stepped forward with the code.