mmr, This sounds like a good opportunity for a tutorial -- I think I'll make one for ya ;) Expect it later today.
Quick FYI: a "partial" is a Rails-ism for a fragment of display logic that you can "include" into whatever other views you want. Other frameworks usually have this and call it the same thing, for a nicer learning curve. On Jan 23, 9:35 am, mmr <[email protected]> wrote: > When I read between the lines in the haml tutorial, it's all about > unlearning bad habits obtained from using other frameworks, notably > erb. So, I come to you with no habits. Why send me off to learn some > bad ones before I can get the good ones? (and should I have to learn > Assembly before I learn C++?) > > For instance, I have no idea what a 'partial' is, and the > documentations just states that making one is easy without telling me > what it is. > > I'd really appreciate just a cookbook-style set of 'here's some really > simple haml, here's what you get'. > > And, because I'm using Sinatra, double bonus points for using Sinatra > as the server. > > One task that I have yet to solve is how to pass parameters to a haml > page. For instance, suppose I've stored the username in a session, > and I want to display the username on the page. I can either create > that page using Sinatra and write the text as part of a 'puts' > statement, but I'd hoped for a way to say to haml, 'replace this > variable string here with this particular string here'. I can see no > way to do that, and I looked for several hours. Can that task be > done? > > Thanks! > > On Jan 22, 6:49 pm, Michael Narciso <[email protected]> wrote: > > > Take a look at this script:http://github.com/narkeeso/haml-sass-file-watcher > > > I've branched from the original author and added some very basic features. > > > This will look for changes and saves in files with the extension .haml > > and .sass then convert them to .html and .css > > > The nice thing about using something like a watcher is that you can see > > where you made mistakes. haml and sass are pretty good about telling > > what is wrong with your file or syntax. It's great for learning. > > > I do think that you should refresh your HTML/CSS knowledge before diving > > into something like haml or sass though. > > > mmr wrote: > > > So I should have probably been more clear. > > > > The last time I coded html was in 1996. I do not remember it, > > > certainly not well enough to make forms or the like. > > > > Given my total lack of knowledge, how would I go about doing those > > > pretty straightforward tasks in haml? I've found tutorials for things > > > with %p and the like, but I'm needing something a bit more in-depth. > > > > Thanks! > > > > On Jan 22, 5:41 pm, Chris Eppstein<[email protected]> wrote: > > > >> Non-ruby folks will probably prefer the html-like attribute syntax: > > > >> %form(action="myaction" method="post") > > > >> %input(type="text" name="foo" value="bar" maxlength="100") > > > >> Chris > > > >> On Fri, Jan 22, 2010 at 5:15 PM, Amy L<[email protected]> wrote: > > > >>> Hi mmr, > > > >>> If you know HTML then picking up Haml is a no-brainer. Let's say you > > >>> want a > > >>> form and you're not using the form helper, instead of writing: > > > >>> <form action="..." method="post"> > > > >>> You write > > > >>> %form{:action => '...', :method => 'post'} > > > >>> For the stuff you would put inside the<form> tags just indent by 2 > > >>> spaces > > >>> in Haml. That's pretty much it. > > > >>> So you want a text field? Sure: > > > >>> %input{:type => 'text', :name => '...', :value => '...', :maxlength > > >>> => > > >>> '...'} > > > >>> That's it. > > > >>> On Fri, Jan 22, 2010 at 3:43 PM, mmr<[email protected]> wrote: > > > >>>> Hi all, > > > >>>> I'm putting together a web system basically as described here: > > > >>>>http://stackoverflow.com/questions/2112267/should-i-be-using-rails-or... > > > >>>> I've decided to go with sinatra, mainly because I don't need the db > > >>>> functionality of rails as that's already covered by a java environment > > >>>> that I have definitely working and debugged. > > > >>>> However, when I read the tutorials for haml and sass, they all > > >>>> reference erb and css. I have no knowledge of erb or css, so those > > >>>> tutorials are useless to me. > > > >>>> I've found this tutorial on making a login page (my next task): > > > >>>>http://visionmasterdesigns.com/tutorial-create-a-login-system-in-ruby... > > > >>>> But that's in erb and it's specifically for rails on top of mysql, > > >>>> which, again, I'm not doing. > > > >>>> Is there an equivalent tutorial for a simple login page? I'm talking > > >>>> just "here's a box in which to put text, and here's how to access that > > >>>> text in your ruby file", nothing particularly complicated. > > > >>>> Overall, a very useful listing for me would be how to: > > >>>> 1) write normal text (as in,<br>This is my text! Isn't it awesome! > > >>>> <br> > > >>>> 2) write a link > > >>>> 3) write a link bar across the top (or bottom) of a page, with say, > > >>>> five or six links to pages in the site > > >>>> 4) have a text entry field > > >>>> 5) have a button that does something when clicked > > > >>>> I think that would cover my needs for the moment. I just don't see > > >>>> any straightforward way to do these things, and any help would be > > >>>> appreciated. > > > >>>> Thanks! > > > >>>> -- > > >>>> You received this message because you are subscribed to the Google > > >>>> Groups > > >>>> "Haml" group. > > >>>> To post to this group, send email to [email protected]. > > >>>> To unsubscribe from this group, send email to > > >>>> [email protected]<haml%[email protected]>. > > >>>> For more options, visit this group at > > >>>>http://groups.google.com/group/haml?hl=en. > > > >>> -- > > >>> You received this message because you are subscribed to the Google > > >>> Groups > > >>> "Haml" group. > > >>> To post to this group, send email to [email protected]. > > >>> To unsubscribe from this group, send email to > > >>> [email protected]<haml%[email protected]>. > > >>> For more options, visit this group at > > >>>http://groups.google.com/group/haml?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Haml" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/haml?hl=en.
