Amptools.Net

simplify your life.

name

Asp.Net Mvc Add Css Classes To The Body Element

No Gravatar

Using the css classes on the body tag/element, you can open a door to having finer control over the layout of your site. Its one of the few decent tricks that bigger Content/Course Management Software like drupal or moodle provides.

In Asp.Net Mvc this can be done in the master page, outside of the head tags. What makes this nice is using the controller and action name to isolate the page and section of the site you are int.

</head>
<%
        var values = Html.ViewContext.RouteData.Values;
        var bodyClasses = values["controller"] + " " +
                        values["action"];
%>
// in the master page
<body class="<%= bodyClasses %>"> 

// what should be rendered for the url: /blog/edit/5
<body class="blog edit">

As you can see above, it would pay off to stick to using the controller and action keywords in your routing. You could adjust the above for adding the modules/areas name.

.blog aside.column {
        display: none;
}

.blog.edit  footer {
        margin-top: 20px;
        background: transparent(images/egg.png) no-repeat;
}

You can now target certain aspects of the layout and change it depending what section of the site you are in.

Tags: , , , , , , , ,

Thursday, October 15th, 2009 Blog Comments

Top Ten Worst Opensource Names

No Gravatar

The top 10 offenders of opensource projects for bad or offensive naming and branding their software.  Viral? Ignorance? Offensive? Bad? Genius? You decide.

The Top Ten Worst Names

10. Gnome – What does bigfoot have to do with a hobbit like creature?  There is not even an a clippy version of a gnome on the desktop.  Not that I’m a clippy advocate.

9. The Gimp – Derogatory term and it sounds like the software is inept.  A good reason not to use GNU as part of your name. Imp is cooler.

8. GNU/Linux - Having to type GNU in front of Linux is both time consuming and pointless. Which is on par with anything from Mr. Stallman these days.

7. openSuse – um. Is it still a mystery why there are not as many women as men in software development?  Open in front of any one’s name is probably never a good idea.

6. Mono – In Spanish it is a monkey, in English it is a disease.

5. Tomboy – Who is going to go around admitting to using this aloud?

4. Yum – I don’t know which is worse. A food related acronym?  Or that it stands for is yellowdog updater modified.

3. PHP – Recursive acronym? “PHP: Hypertext Preprocessor”?  Why? Just why?  This is the same  evil as made-up words used by the press like “athleticism”, then having it added to the dictionary. ick.

2.  god – A ruby plugin.  It brings shame that developers fight over software tools and languages like it is politics or religion. Ridiculous, I know. Then someone  just had to bring religion into it?

1. Sperm Reports – I’m thinking someone was either downing pints at a bar, or lost a bet. I really don’t want to even think about other reasons for this name.

Honorable Mentions.

Any web 2.0 project like drupal or joomla. Netoops (.net object oriented portal) or Xoops (extensible object oriented portal).  Scrum & Scum Master. PR nightmare.

Feel free to add more below.

Tags: , , , , , ,

Tuesday, September 29th, 2009 Blog Comments