Showing posts with label Twitter Bootstrap. Show all posts
Showing posts with label Twitter Bootstrap. Show all posts

Sunday, February 5, 2012

Still working on taming Emacs

I find that I often get tripped up by little things when it comes to programming. For example, I was going through that haml tutorial I posted about a couple of days ago, and I wondered exactly how Rails would know to use the haml file instead of the old erb file. After all, I'd already installed the gem and listed it in the Gemfile.

It turns out I didn't have to do anything else. I could have just renamed the .erb file to use a .haml extension. Luckily this didn't take long to figure out, but I've got a history of overlooking things like this that should be fairly obvious.

haml itself is easy enough to understand. Take those dirty div tags for example!

<div class="content">AWESOME CONTENT</div>


Is magically transformed into

.content AWESOME CONTENT


EDIT: Corrected this information, thanks to Joel. In haml, a . signifies a class, whereas a # signifies an id.

There's more to haml than this, but it's an abstraction of XHTML which makes writing code easier and less tedious. I was thinking of taking the time to do a more in-depth tutorial for haml, but instead I'm going to incorporate it into this Twitter Bootstrap for Rails 3.1 tutorial series my buddy Joel sent my way.

I hope you guys like reading about Twitter Bootstrap, because that's absolutely what I'll be blogging about this week.

I've also made some progress with Emacs, and no longer feel lost when trying to do basic things like open recent files. I've definitely got some work to do before I feel really comfortable coding with Emacs, but I don't think it'll take long to get the basics down. I went through the notes I made at Fort Behavior last week and threw them into a .txt file, so I'll just have that open when using Emacs until I don't need it.

Thursday, January 26, 2012

Using Twitter Bootstrap to Render Partials with Tabs

It's been a good week for coding. I've done some pair programming, interviewed at iGoDigital, and dug into Twitter Bootstrap.

Which is actually the topic of this post! WEIRD!

Anyone ever tried using those sexy little tabs to render partials? Basically I'm working on Chorenivore again, and I want a tabbed view of the days of the week, with each tab containing items that are supposed to be done that day. I'm currently thinking of a separate partial for each day, though this could probably be reduced to one partial that simply renders each chore that's been tagged with the day of the week, but I thought I'd make it stupid before I made it clean.

Here's the specific code I'm talking about:

Twitter Bootstrap Tabs

I understand how to switch through actual links just fine using these tabs, but how would you do the same thing with partials? I found this question on StackOverflow that seems to address this, but I couldn't get his example to work.

Here's a link to Chorenivore on Git:

Chorenivore on GitHub

A couple other things. First off, I haven't really used Rails in the last four or five months and it feels so BULKY compared to Sinatra. I'm all "WTF, how do I link to a new view and actually make it do right?"

And does anyone know where I'd find Why's Poignant Guide to Ruby? I feel a book report coming on.