Archive for June, 2011

Free Prestashop and WordPress E-Commerce Theme: Velvet Sky

Advertisement in Free Prestashop and WordPress E-Commerce Theme: Velvet Sky
 in Free Prestashop and WordPress E-Commerce Theme: Velvet Sky  in Free Prestashop and WordPress E-Commerce Theme: Velvet Sky  in Free Prestashop and WordPress E-Commerce Theme: Velvet Sky

In case you’ve been looking for a nice e-commerce theme for your website or any ongoing projects, today we’ve got something for you. We’re releasing yet another freebie — a Prestashop and WordPress e-commerce theme called “Velvet Sky” which has exclusively been developed by DapurPixel for Smashing Magazine and its readers. The warm, natural brown colours within the theme portray much comfort and will hopefully provide your customers with a very calm and engaging environment in which they can find the items they’re searching for in no time.

Release in Free Prestashop and WordPress E-Commerce Theme: Velvet Sky

Download the Theme for Free!

The Prestashop theme is released under Creative Commons; the WordPress theme is released under GPL. Both themes are free to use for private as well as commercial projects. There are no restrictions; you may modify the theme as you wish. Please link to this article if you want to spread the word!

Preview in Free Prestashop and WordPress E-Commerce Theme: Velvet Sky

Features

  • WordPress 3.1+ compatible
  • Prestashop 1.4.2.5 compatible
  • Custom homepage
  • Horizontal menu and submenu integration
  • Custom slideshow module
  • Combo slider on the homepage
  • One page checkout and guest checkout supported
  • Custom advertisement block module
  • IE7+, Safari, Opera, Firefox, Chrome compatible

Blog-1 in Free Prestashop and WordPress E-Commerce Theme: Velvet Sky
Blog-1 (large preview)

Blog-2 in Free Prestashop and WordPress E-Commerce Theme: Velvet Sky
Blog-2 (large preview)

Blog-3 in Free Prestashop and WordPress E-Commerce Theme: Velvet Sky
Blog-3 (large preview)

Checkout-1 in Free Prestashop and WordPress E-Commerce Theme: Velvet Sky
Checkout-1 (large preview)

Checkout-2 in Free Prestashop and WordPress E-Commerce Theme: Velvet Sky
Checkout-2 (large preview)

Checkout-3 in Free Prestashop and WordPress E-Commerce Theme: Velvet Sky
Checkout-3 (large preview)

Checkout-4 in Free Prestashop and WordPress E-Commerce Theme: Velvet Sky
Checkout-4 (large preview)

Checkout-5 in Free Prestashop and WordPress E-Commerce Theme: Velvet Sky
Checkout-5 (large preview)

Detail-1 in Free Prestashop and WordPress E-Commerce Theme: Velvet Sky
Detail-1 (large preview)

Detail-2 in Free Prestashop and WordPress E-Commerce Theme: Velvet Sky
Detail-2 (large preview)

Detail-3 in Free Prestashop and WordPress E-Commerce Theme: Velvet Sky
Detail-3 (large preview)

Detail-4 in Free Prestashop and WordPress E-Commerce Theme: Velvet Sky
Detail-4 (large preview)

Detail-5 in Free Prestashop and WordPress E-Commerce Theme: Velvet Sky
Detail-5 (large preview)

Detail-6 in Free Prestashop and WordPress E-Commerce Theme: Velvet Sky
Detail-6 (large preview)

Detail-7 in Free Prestashop and WordPress E-Commerce Theme: Velvet Sky
Detail-7 (large preview)

Home-1 in Free Prestashop and WordPress E-Commerce Theme: Velvet Sky
Home-1 (large preview)

Home-2 in Free Prestashop and WordPress E-Commerce Theme: Velvet Sky
Home page 1 (click for a large preview)

Home-3 in Free Prestashop and WordPress E-Commerce Theme: Velvet Sky
Home page 2 (click for a large preview)

Home-4 in Free Prestashop and WordPress E-Commerce Theme: Velvet Sky
Home page 3 (click for a large preview)

Behind the Design

As always, here are some insights from the designer:

“Attractive! Alluring! Beauty! Desire! Glamour is an impression that we wanted you to have by looking at this theme. Velvet Sky has become an e-commerce theme that provides an atmosphere full of charm. We did a lot of customization; the featured product on homepage, the category product page, the product details. Velvet Sky is our humble attempt to provide a feeling of comfort in shopping experience. We worked hard to make sure that customers can found the items needed without being confused. Support your customers well, and start out by building a personal relation between you and your customers. We hope that you’ll find the theme useful for your projects.”

Thank you, Arrie. We appreciate your work and your good intentions.

Related Post

You might be interested in the following related post:


© Smashing Editorial for Smashing Magazine, 2011.


Smashing Cartoons: June 2011

Advertisement in Smashing Cartoons: June 2011
 in Smashing Cartoons: June 2011  in Smashing Cartoons: June 2011  in Smashing Cartoons: June 2011

We all have our favorite client stories, embarrassing design flaws and never-ending user requests which are all just a part of what we, as designers and developers, encounter very often in our daily work routine. In this new post series on Smashing Magazine, we’d like to put some of these situations into the spotlight and discuss them with you. The cartoons are all dedicated to Web design and also have a comic twist about everything happening around the Web and latest trends.

The main character of the cartoons is Fleaty, a talented, hard-working designer with big ambitions yet not that much luck when it comes to clients. Hopefully, Fleaty will put a smile on your face and maybe remind all of us of the flaws we have, and help us finally get rid of them. The creative mind behind the Smashing Cartoons is our talented illustrator Ricardo Gimenes.

We’ll be adding a new cartoon every week; the latest cartoon is presented on the Smashing Magazine’s sidebar as well as on the Smashing Cartoons page. There you will also find all previous issues of the Smashing Cartoons series for your convenience.

Fleaty’s experience in June:

Making The Web A Better Place

Fleaty 11 Big in Smashing Cartoons: June 2011

Mobile First

Fleaty 12 BigC in Smashing Cartoons: June 2011

They Just Don’t Care

Fleaty 09 Big Colour in Smashing Cartoons: June 2011

Users Don’t Read, They Scan

Fleaty 10C in Smashing Cartoons: June 2011

Tell Us Your Story!

Have you experienced something similar to what Fleaty has experienced? What’s your ultimate client story? Share your story with us in the comment section below!

For previous cartoons, feel free to check our Smashing Cartoons Archive.


© Smashing Editorial for Smashing Magazine, 2011.


Digital Artwork Inspiration for the Weekend

Advertisement in Digital Artwork Inspiration for the Weekend
 in Digital Artwork Inspiration for the Weekend  in Digital Artwork Inspiration for the Weekend  in Digital Artwork Inspiration for the Weekend

In our continuing journey to offer our readers an artistic dose of inspiration to help carry them through the weekend and get them recharged and ready to go for the coming week ahead, we have put together another fantastic showcase to serve just such a purpose. This time around we have gone fully digital! Turning to that online hangout for artists who tend to walk the more anomalous path, we scoured through some of the freshest uploads over at Deviant Art recently to find some inspired pieces to pile into this imagination stirring post.

Given the volume of artwork being shared through the DA site, and the number of categories to sift through, for this inspirational installment we decided to narrow our focus and present our readers with only a slice of an expansive header like digital art. So for this post we have gathered some stunning fractals to kick things off, then we have a few vexels squeezed in, before we move on to wrap things up with a handful or two of digital paintings and airbrush pieces. Hopefully these will prove useful in reigniting your inspired fires so you can start your work week in the right frame of mind.

Fractal Art

We begin the showcase with a look at Fractal art. Fractals are an artform which uses algorithms to create and manipulate fractal objects represented by transforms that are assigned certain artistic properties by the artist. This complicated medium has been made more accessible for years now as the community has given rise to several fractal programs that while they may contain different levels of learning curves, they tend to be easier than working out the complex algorithms involved in the creations.

hyperben2

The first artist that we are featuring is hyperben2 on Deviant Art. An extremely talented fractal artist who manages to create pieces with such depth and an intricate nature that we could not put together this showcase without shining our spotlight on some of the pieces in their gallery.

Zen by: hyperben2

Zen By Hyperben21 in Digital Artwork Inspiration for the Weekend

Nether net by: hyperben2

Nether Net By Hyperben21 in Digital Artwork Inspiration for the Weekend

Node of Yesod by: hyperben2

Node Of Yesod By Hyperben21 in Digital Artwork Inspiration for the Weekend

krigl

Next up on the showcase, we have a few pieces from another fantastic fractal artist, krigl on Deviant Art. While most fractal work tends toward the abstract, these next pieces demonstrate how harmoniously these fractal elements can all be pulled together with a seemingly effortless ease to shape the abstract into something solid almost tangible.

Ivory Tower cracks by: krigl

Ivory Tower Cracks By Krigl1 in Digital Artwork Inspiration for the Weekend

Each-a-gweenz by: krigl

Each A Gweenz By Krigl1 in Digital Artwork Inspiration for the Weekend

Sister by: krigl

Sister By Krigl1 in Digital Artwork Inspiration for the Weekend

HalTenny

Speaking of a more tactile feeling to some fractal artists’ work, our next bunch of breathtaking pieces are from the gallery of HalTenny on Deviant Art. With Hal’s work, we find ourselves more inhabiting strange new worlds with landscapes unlike anything we have seen beyond the scope of science fiction.

Temple Of Doom by: HalTenny

Temple Of Doom By Haltenny1 in Digital Artwork Inspiration for the Weekend

Momma Spider Tending Egg by: HalTenny

Momma Spider Tending Egg By Haltenny1 in Digital Artwork Inspiration for the Weekend

Tree Tops by: HalTenny

Tree Tops By Haltenny1 in Digital Artwork Inspiration for the Weekend

Random Artist Fractals

Before we check out of the fractal headspace and move into another digital artistic medium, we have a handful of other awesome fractals that we felt should be featured in the post. Though we only have taken one piece from each of the artists below, their contributions are just as inspired as the other works that wound up filling the spotlight, and we wouldn’t have felt right about passing them by.

Mold by: insaine

Mold By Insaine1 in Digital Artwork Inspiration for the Weekend

Expanded mandelbulb virus by: carlahoon

Expanded Mandelbulb Virus By Carlahoon1 in Digital Artwork Inspiration for the Weekend

Cybernetika by: Complete-Loser

Cybernetika By Complete Loser1 in Digital Artwork Inspiration for the Weekend

Fractal 365: Day 172 by: wildekyote

Fractal 365 Day 172 By Wildekyote1 in Digital Artwork Inspiration for the Weekend

Silk Curtains by: kon16ov

Silk Curtains By Kon16ov1 in Digital Artwork Inspiration for the Weekend

Vexel Art

The next digital artform that we are going to explore on this inspirational journey, is Vexel art. No, not vector, vexel. Vexel art is an entirely pixel-based form of raster art that has the look and feel of being comprised of vectors. This mimicking of a vector graphics technique gives these pixel perfect pieces of art a much less whimsical tone than most of what we think of when we hear pixel art.

Pedro-92

The first vexel artist on our list today is Pedro-92 on Deviant Art. Pedro’s detailed face work, while maintaining a smidgen of that playful nature that one might expect from pixel work, combines an almost photo realistic contouring to give life to some spectacular examples of this artform.

Scarface 2 by: Pedro-92

Scarface 2 By Pedro 92 in Digital Artwork Inspiration for the Weekend

Desire by: Pedro-92

Desire By Pedro 92 in Digital Artwork Inspiration for the Weekend

Unidas by: Pedro-92

Unidas By Pedro 92 in Digital Artwork Inspiration for the Weekend

hextupleyoodot

The next artist on our showcase is another skilled vexel visionary who flawlessly gives life to three teens in vexel form. hextupleyoodot on Deviant Art breathes character into these three faces through this somewhat contoured artistic approach.

Becca by: hextupleyoodot

Becca By Hextupleyoodot1 in Digital Artwork Inspiration for the Weekend

Brady by: hextupleyoodot

Brady By Hextupleyoodot1 in Digital Artwork Inspiration for the Weekend

Amy by: hextupleyoodot

Amy By Hextupleyoodot1 in Digital Artwork Inspiration for the Weekend

Alvaro59

If it is the more whimsical works that you are looking for from your vexel viewing inspirational pleasure, then the work Alvaro59 on Deviant Art is right up your proverbial alley. With such vibrant and colorful work, Alvaro’s work taps brilliantly into the roots of the pixel art world.

My World by: Alvaro59

My World By Alvaro591 in Digital Artwork Inspiration for the Weekend

Be Happy by: Alvaro59

Be Happy By Alvaro591 in Digital Artwork Inspiration for the Weekend

Cookie Monster by: Alvaro59

Cookie Monster By Alvaro591 in Digital Artwork Inspiration for the Weekend

pai-thagoras

In keeping with the cute and fun theme we have going after our last vexel artist, the whimsy rolls on in a much more macabre way via the artistic creations of pai-thagoras on Deviant Art. While still maintaining the playfulness one might expect, the artist beautifully illustrates from a small corner of the darkside.

Zombie Head by: pai-thagoras

Zombie Head By Pai Thagoras1 in Digital Artwork Inspiration for the Weekend

Zombie Bride by: pai-thagoras

Zombie Bride By Pai Thagoras1 in Digital Artwork Inspiration for the Weekend

Mexican Wrestler: The Yeti by: pai-thagoras

Mexican Wrestler The Yeti By Pai Thagoras in Digital Artwork Inspiration for the Weekend

Random Artist Vexels

Once more we wanted to check in on a few more random pieces before we completely moved on to the next section of the post. So below are a few more examples of this artform being wonderfully explored and mastered. These final pieces further demonstrate the flexibility of this artistic arena.

Eye of Horus by: brobizzy

Eye Of Horus By Brobizzy1 in Digital Artwork Inspiration for the Weekend

Steam by: Kaesa

Steam By Kaesa1 in Digital Artwork Inspiration for the Weekend

Victory by: olivv

Victory By Olivv in Digital Artwork Inspiration for the Weekend

Digital Paintings and Airbrushings

The final category of digital artwork that we are going to dive into for an inspirational recharge is digital paintings and airbrushed works. This expansive, and often breathtaking medium produces some truly imaginative and inspired works, which will hopefully rub off on our readers just as we planned. We wanted to finish strong, and feel that we have found stumbled onto some works that will allow us to do just that.

Valadrel

The first artist we have featured in this section of the showcase is the immensely talented Valadrel on Deviant Art, whose intricately detailed digital paintings virtually come to life off of their digital canvases. An easy addition to this round-up for sure.

T-rex tiral by: Valadrel

T Rex Tiral By Valadrel in Digital Artwork Inspiration for the Weekend

Trio-Piano by: Valadrel

Trio Piano By Valadrel1 in Digital Artwork Inspiration for the Weekend

Leviathan Vs Gabriel by: Valadrel

Leviathan Vs Gabriel By Valadrel in Digital Artwork Inspiration for the Weekend

translucid

Speaking of easy additions to the inspirational showcase, the fantastic work of translucid on Deviant Art quickly found this interesting artist’s voice a spot. Technically, the third piece is a photomanipulation, but it shows the dynamic reach of the artists voice so we added in.

Station Windows by: translucid

Station Windows By Translucid1 in Digital Artwork Inspiration for the Weekend

A million lights flicker by: translucid

A Million Lights Are Flickerin By Translucid in Digital Artwork Inspiration for the Weekend

60 by: translucid

60 By Translucid1 in Digital Artwork Inspiration for the Weekend

Hypa00

The next artist up on the showcase briefly takes us into space for a short journey through a fantastically rich verse in the gallery of Hypa00 on Deviant Art. With some spectacularly breathtaking scenery painted onto the digital canvas these looks beyond our world are inspiring to say the least.

Destroying planet and moon by: Hypa00

Destroying Planet And Moon By Hypa001 in Digital Artwork Inspiration for the Weekend

Earth Like by: Hypa00

Earth Like By Hypa001 in Digital Artwork Inspiration for the Weekend

A Cold World by: Hypa00

A Cold World By Hypa00 in Digital Artwork Inspiration for the Weekend

Vihola

Turning to somewhat of a darker place, at least in tone, we present the next artist on our showcase, Vihola on Deviant Art. The brilliant and bold artist’s brush breathes life into a much more sinister feeling world than we have come from, but does so with such grace it is hard not to admire the artistry.

Hideous Saber-Tooth Rat by: Vihola

Hideous Saber Tooth Rat By Vihola1 in Digital Artwork Inspiration for the Weekend

Death’s Diary by: Vihola

Death S Diary By Vihola1 in Digital Artwork Inspiration for the Weekend

Old Hero by: Vihola

Old Hero By Vihola in Digital Artwork Inspiration for the Weekend

nerdiesid

Lets keep this more macabre and somber train rolling as we unveil the work of the next artist in our showcase, nerdiesid on Deviant Art. This is another artist whose voice is so versatile and unique, even though it tends towards the dark, that we could not pass them by with our spotlight.

So Dead by: nerdiesid

So Dead By Nerdiesid1 in Digital Artwork Inspiration for the Weekend

Earth by: nerdiesid

Earth By Nerdiesid1 in Digital Artwork Inspiration for the Weekend

Kampung by: nerdiesid

Kampung By Nerdiesid1 in Digital Artwork Inspiration for the Weekend

Random Artist Paintings and Airbrushings

As we wind up the post here we figured we would throw a few more digital paintings and airbrushed works at you just for good measure. Below are several more noteworthy additions to the Deviant Art archives that fall under this artistic heading that we could not let slip by under our reader’s radars! Hopefully you got the inspirational recharge you needed and if not, then perhaps these final few works will help get you there.

Kiss the Rain by: BecPriestess

Kiss The Rain By Becpriestess in Digital Artwork Inspiration for the Weekend

Fire Mountains by: elvenfall

Fire Mountains By Elvenfall1 in Digital Artwork Inspiration for the Weekend

Venom by Broken-Orange

Venom By Broken Orange1 in Digital Artwork Inspiration for the Weekend

Peskett loses his head by: MayPylb

Peskett Loses His Head By Maypylb1 in Digital Artwork Inspiration for the Weekend

That is a Wrap

That does it for this showcase of digital art, we hope that it has helped to once again get your flames of inspiration raging through your imagination. If there are any of the works featured that really stand out and speak to you, please feel free to let us know in the comments which ones those were. Also feel free to hit us up with your thoughts on the various works overall, not just the ones that you were moved by. So it is with that in mind that we now turn the post over to you!

Consider Some of Our Previous Posts

(rb)


A Web Developer’s Guide To Adobe InDesign

Advertisement in A Web Developer’s Guide To Adobe InDesign
 in A Web Developer’s Guide To Adobe InDesign  in A Web Developer’s Guide To Adobe InDesign  in A Web Developer’s Guide To Adobe InDesign

Over the past several years, there has been a big divide between designers: those who work in print distribution and those in digital distribution. The irony is that, despite the disputes, name-calling and flat-out arguments between the two camps, their techniques and methods are far more common than many believe. Both sides of this communications field are heavily influenced by each other. Grid systems and typography now play a strong role in Web-based design, and usability and user experience play a big part in developing print material.

Adobe InDesign is the primary application of print designers for laying out multiple pages and assembling print documents. This article gives you, the Web-based developer, a look at some of the tools in InDesign that translate directly into what you currently use. We’ll look at how the terminology in the two fields compare and how to apply your expertise to this other industry.

Jumping Right In

Folder Structure

As with any Web development project, organizing from the start ensures that you will have minimal problems with the files later on. Similar to many website root folders, InDesign gives you a main document folder and a resources folder:

Folder-Structures in A Web Developer’s Guide To Adobe InDesign

Above on the left is my folder structure for InDesign, and on the right the folder structure for my website. They are so similar that, if not for the different file extensions (.indd and .html), they would be practically the same.

Setting Up the Document

Setting up an InDesign document is similar to setting up a mobile website. You specify the height, width and purpose of the document. For print-based items, set the “Intent� to “Print.� If you will be using the file for an eBook or digital publication, then specify “Web.� If you will be using the document for both, then specify “Print� to ensure that the colors are maintained properly.

InDesign-New-Document in A Web Developer’s Guide To Adobe InDesign

The margins in InDesign are guidelines that are positioned on the page and are not like Web margins that affect objects on the page.

Your Main Tools

If you’re familiar with Photoshop and Illustrator, then you are used to finding the main group of tools on the left side of the workspace, at least by default. InDesign is the same. The way you interact with and build objects on the page, though, works slightly different than Adobe’s other design software. Containers are needed in order to place images, vector objects and textual content on the page.

You can import vector objects directly into the document, but you will usually be importing files into content boxes that you position in the layout. This should come easily to you because Web design operates on the same principle: creating DOMs that contain images or text, and then positioning them in the layout. The one major difference is that, while objects are positioned in a Web document relative to their structure (unless otherwise styled), objects on an InDesign layout are always given an x and y position based on the overall page (by default, the top-left corner, similar to absolute positioning).

Because we are working with a vector- and object-based layout, one of the main tools you will use for the majority of your editing is the Selection tool Tool Selection in A Web Developer’s Guide To Adobe InDesign, which gives you control of position and size. It also is used to select an object in order to change its properties. This is quite different from Photoshop, in which you edit individual layers. To change the color of an object, you need to select it first using the Selection tool, and then adjust it using one of the various ways to change color.

These content boxes can be created with various tools. The Type tool Tool Text in A Web Developer’s Guide To Adobe InDesign enables you to create a box for text. The Rectangle Frame tool Tool Frame in A Web Developer’s Guide To Adobe InDesign creates a box to add an image or linked resource. The Rectangle tool Tool Rect in A Web Developer’s Guide To Adobe InDesign is not assigned to any particular kind of content. These three frame types allow you to build the layout any way you want.

In spite of both the Rectangle and Rectangle Frame tools, many designers who were trained on older software use only the Frame tool. The one difference between them is that the Frame tool shows a placeholder (an x). The Rectangle tool merely allows for a cleaner workspace but does not affect the final output.

Context-Bars in A Web Developer’s Guide To Adobe InDesign

The context bars and option panes help you style the content. As in Photoshop, various objects will open up a context-sensitive toolbar at the top, allowing for quick editing based on the type of object(s) selected and the tool selected.

Also like in Photoshop and Illustrator, a multitude of panes are available to control the values associated with an object. Again, they apply only to selected objects. Selecting an option from a pane when an object is not selected will not cause any objects to change.

Style Sheets And Their Origins

CSS did not originate with the Web. The model of defining a set of instructions in order to style content was originally built for desktop publishing applications. In InDesign, this takes the form of object styles, paragraph styles and character styles. There are also table styles, row styles and cell styles for designing table objects, but we’ll stay away from these in this lesson.

Styles in InDesign work similar to Web-based CSS but have one major difference: you cannot group multiple style sheets of the same type. For example, you cannot apply multiple paragraph styles to one paragraph. However, you can apply a character style sheet to content in a paragraph that already has a style sheet applied to it.

Shortcuts and menu locations for the panes are given below. But the panes will already be open on the right side of your workspace if you have selected Window → Workspace → Advanced or have selected the “Typography� option. These function exactly like the panes in Illustrator and Photoshop: you can snap them together and arrange them to your liking, and they contract to icon format.

Object Style Sheets

Draw a content box on the page using the Rectangle tool. With the box selected, you can modify the content box — including the border, background and corner effects — as you would a div object. If you give it, say, a background color, a drop shadow and rounded corners, you can save that style by selecting a new “Object Style� in the Object Style pane when the object is selected (Window → Styles → Object Styles, or Command/Control + F7). You can give the style a name (much like a class name) and modify any of the style properties you’ve assigned.

After saving this new style, you’ll still need to apply it to the object. This may sound redundant; however, you’ve only created a new style based on the properties of the selected object. By clicking on the new style with the object selected, you will apply that style. Think of it like adding class="object_style" to an HTML element after you’ve set up the CSS.

Paragraph Style Sheets

Select the Text tool, and click in the newly styled box. Add a few paragraphs of content (you can cheat by going to Type → Fill With Placeholder Text). With your cursor in the first paragraph, you can start changing some of the properties of what, in Web terms, would be the <p> tag by using the Paragraph pane (Window → Type & Tables → Paragraph, or Command/Control + Alt + T).

Notice that options for modifying font size, letter spacing and weight are not available. This is because these aspects relate to the characters of the paragraph. While a paragraph style can and most likely will include instructions for these values, the Paragraph pane does not provide access to them.

Let’s create a paragraph style via the Paragraph Style pane (Window → Styles → Paragraph Styles, or Command/Control + F11). This opens a new window that gives you God-like control over all aspects of the text. Name your style, and jump to the “Basic Character Formats� option on the left.

Paragraph-Styles-Window in A Web Developer’s Guide To Adobe InDesign

This is what I meant when I said that character properties could be defined in the paragraph style. Change the font size, weight and spacing here, and click “OK.� As you did with the object styles, you will still need to apply it to the paragraph you are working with. To do this, put your cursor in the paragraph text or select a portion of it, and then click on the paragraph style’s name. If you have selected the entire object using the Selection tool, then the paragraph style will be applied to all of the content.

Character Style Sheets

With the Type tool still selected and your cursor in the paragraph, highlight a portion of the text. Using the Character pane (Window → Type & Tables → Character, or Command/Control + T), adjust the properties of the characters. You can add italics or bold or change the font family.

Once more, let’s create a style that incorporates these modifications. In the Character Styles pane (Window → Styles → Character Styles), create a new “class.� Name it something relevant, save it, and then apply it to the highlighted text. This would be akin to adding a little <span> tag to some text in a paragraph, which allows you to apply styles to that text independent of the parent element.

CSS vs. Style Sheets

We’ve just gone over a lot here. The reason we went over these three things is to illustrate that, unlike CSS styling, I cannot add a second style sheet of the same type to an element. In CSS, I can do something like this:

<div class="orange_box rounded"></div>

This would apply two styles to the same object (the orange box). InDesign attributes of a given type (whether object, paragraph or character) must be contained in a single style. Higher-level styles are overwritten by child items. For example, character styles overwrite paragraph styles, which in turn overwrite object styles; but you cannot apply multiple styles to a single object, etc.

As in CSS, I could overwrite an object manually. For instance, I could apply a style sheet that gives a paragraph a font size of 11 points and a leading (line height) of 14 points, but then manually change the leading to 16 points by adjusting it in the Character pane. This would result in Web code like:

<p class="standard_body" style="line-height: 16px;"></p>

As you can see, we end up with code that would be considered poor practice by most people. However, it does allow us to customize as issues arise.

Play Around With The Tools

Now that you’ve been introduced to how set up a document, start playing around with the tools, using what you already know of Photoshop or Flash. Position elements on the page, modify their color and font face, and create the layout for a product that you’ve already built.

In the next lesson, we’ll dive head first into learning how to create consistent layouts with some advanced style sheet options, and we’ll examine how to build a page structure from scratch. So, don’t forget your towel.

Additional Resources

For some more tools to help you build an initial layout and to learn the basics of building a document, please see the following:

(al) (il)


© Matthew Potter for Smashing Magazine, 2011.


A Guide To Starting Your Own Rails Engine Gem

Advertisement in A Guide To Starting Your Own Rails Engine Gem
 in A Guide To Starting Your Own Rails Engine Gem  in A Guide To Starting Your Own Rails Engine Gem  in A Guide To Starting Your Own Rails Engine Gem

Since Rails 3 was released, developers have been writing Rails engines in a new clean style that can be packaged as RubyGems. A Rails engine is a prepackaged application that is able to be run or mounted within another Rails application. An engine can have its own models, views, controllers, generators and publicly served static files.

Ruby-screenshot in A Guide To Starting Your Own Rails Engine Gem
(Image: maicos)

Now, unless you like writing a lot of code, this is great news, because it means you can write an engine once and use it over and over again. Let’s say you build a lot of websites for small businesses. A common requirement for such websites is a page listing all of the employees at a company and some basic information about them. This is a great candidate for a Rails engine gem because the functionality will change very little and can be abstracted to a common set of requirements.

In this post, we’ll walk through the process of creating an engine gem that you would use to create a database-backed team page displaying a list of employees.

Enginex

Jose Valim, a core Rails contributor, has created a tool named Enginex, which scaffolds Rails 3-compatible engine gems. This tool protects you from many of the gotchas that engine gem developers face. It provides basic set-up, including a test Rails application, which you’ll need to get started.

To begin, run the following from the command line in your standard projects directory:

gem install enginex
enginex team_page

With this, you will end up with a project in the team_page directory containing the standard Enginex scaffolding.

Set-Up

To set up our gem, we’ll modify a few files. First, our team_page.gemspec and our Gemfile need a little love.

# CURRENT FILE :: team_page.gemspec
require File.expand_path("../lib/team_page/version", __FILE__)

# Provide a simple gemspec so that you can easily use your
# Enginex project in your Rails apps through Git.
Gem::Specification.new do |s|F
  s.name                      = "team_page"
  s.version                   = TeamPage::VERSION
  s.platform                  = Gem::Platform::RUBY
  s.authors                   = [ "Your Name" ]
  s.email                     = [ "your@email.com" ]
  s.homepage                  = "http://yourwebsite.com"
  s.description               = "A simple Rails 3 engine gem that adds a team page to any Rails 3 application."
  s.summary                   = "team_page-#{s.version}"

  s.rubyforge_project         = "team_page"
  s.required_rubygems_version = "> 1.3.6"

  s.add_dependency "activesupport" , "~> 3.0.7"
  s.add_dependency "rails"         , "~> 3.0.7"

  s.files = `git ls-files`.split("\n")
  s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
  s.require_path = 'lib'
end
# CURRENT FILE :: Gemfile
source "http://rubygems.org"
# Specify any dependencies in the gemspec
gemspec

This sets up our gemspec to automatically use files we have committed with Git, and any executables we may add in the future, and to use the VERSION constant that we’ll specify in our gem.

Also, by calling gemspec in our Gemfile, running bundle install will load dependencies from our team_page.gemspec, which is the convention.

Next, to turn our gem into a Rails engine, let’s add or modify three files. First, our top-level team page file:

# CURRENT FILE :: lib/team_page.rb
# Requires
require "active_support/dependencies"

module TeamPage

  # Our host application root path
  # We set this when the engine is initialized
  mattr_accessor :app_root

  # Yield self on setup for nice config blocks
  def self.setup
    yield self
  end

end

# Require our engine
require "team_page/engine"

To use the mattr functions, our ActiveSupport dependencies are required. We also set up a nice way to configure our gem with the self.setup method. The engine is required at the end of our file so that we can be sure that any dependencies are specified first.

Secondly, our version file:

# CURRENT FILE :: lib/team_page/version.rb
module TeamPage
  VERSION = "0.0.1"
end

Lastly, our engine file:

# CURRENT FILE :: lib/team_page/engine.rb
module TeamPage

  class Engine < Rails::Engine

    initialize "team_page.load_app_instance_data" do |app|
      TeamPage.setup do |config|
        config.app_root = app.root
      end
    end

    initialize "team_page.load_static_assets" do |app|
      app.middleware.use ::ActionDispatch::Static, "#{root}/public"
    end

  end

end

This defines two Rails initialize blocks that clue us into the root directory of our host Rails application, as well as serve up any files in the root public directory of our gem.

Data Model

To add a model in our gem, we first need to specify a migration and a generator class to copy it over to the host Rails application. Although this process will become much more transparent in Rails 3.1, we now need to build some generator classes. A great resource for this can be found over at Nepal on Rails.

First, let’s add our generators class:

# CURRENT FILE :: lib/generators/team_page/team_page_generator.rb
# Requires
require 'rails/generators'
require 'rails/generators/migration'

class TeamPageGenerator < Rails::Generators::Base
  include Rails::Generators::Migration
  def self.source_root
    @source_root ||= File.join(File.dirname(__FILE__), 'templates')
  end

  def self.next_migration_number(dirname)
    if ActiveRecord::Base.timestamped_migrations
      Time.new.utc.strftime("%Y%m%d%H%M%S")
    else
      "%.3d" % (current_migration_number(dirname) + 1)
    end
  end

  def create_migration_file
    migration_template 'migration.rb', 'db/migrate/create_team_members_table.rb'
  end
end

Adding this will allow developers to run rails g team_page from within their Rails application and to create the necessary migration file to power our team page.

Next, we’ll put together a sample migration:

# CURRENT FILE :: lib/generators/team_page/templates/migration.rb
class CreateTeamMembers < ActiveRecord::Migration
  def self.up
    create_table :team_members do |t|
      t.string :name
      t.string :twitter_url
      t.string :bio
      t.string :image_url
      t.timestamps
    end
  end

  def self.down
    drop_table :team_members
  end
end

Finally, we can create a sample model namespaced to our gem.

# CURRENT FILE :: app/models/team_page/team_member.rb
module TeamPage
  class TeamMember < ActiveRecord::Base
    attr_accessible :name , :twitter_url , :bio , :image_url
  end
end

What we’ve done so far is walked through the steps for bootstrapping a Rails 3 engine gem. It has been configured as an engine, given its own migration generator, and supplied with an ActiveRecord model.

Now, let’s set up our gem with a route, controller and view that any host Rails application can use.

The Route

Rails engines gems, when set up properly, automatically load the config and app directories of our project. This is handy because it enables us to set up our code with exactly the same structure as a full Rails application.

So, to set up our route, create a routes.rb file in the config directory of our project. To have it match on the team route, let’s do the following:

# CURRENT FILE :: config/routes.rb
Rails.application.routes.draw do
  get "team" => "team_page/team#index" , :as => :team_page
end

A bit of pain can be avoided by examining what we’ve done here. First, we’re going to match the /team route from any requests to our host Rails app.

Secondly, we’ve told Rails to send requests to the index route of the namespaced controller that we’re going to create in our engine. Namespacing our controller is best practice because it isolates our engine code from any application that it’s included in.

Lastly, our route is named so that we can use link helpers elsewhere in our application.

The Controller

Our controllers will live in the app directory, just as we’re used to. One caveat is that we’ll want to place them in a team_page directory, just as we did with our model. It simply needs to load all of our team members to be displayed on the page.

# CURRENT FILE :: app/controllers/team_page/team_controller.rb
module TeamPage
  class TeamController < ::ApplicationController
    def index
      @team_members = TeamMember.all
    end
  end
end

As you can see, we’ve subclassed our top-level ::ApplicationController, which lives in the host Rails application.

The View

To finish off, we need a view to render. By default, it will use the main application layout from our host Rails application, since we didn’t specify a different layout in the controller.

Just as we did with our model and controller, we’ll nest our view in a team_page directory. Because we want to minimize external dependencies, we’ll write our views in ERB instead of something like HAML.

<!-- CURRENT FILE :: app/views/team_page/index.html.erb -->
<ul class="team-member-list">
  <% @team_members.each do |team_member| %>
  <li class="team-member">
    <span class="team-member-name">
      <%= link_to @team_member.name , @team_member.twitter_url %>
    </span>
    <%= @team_member.bio %>
    <%= image_tag @team_member.image_url , :class => "team-member-image" %>
  </li>
  <% end %>
</ul>

Getting Started With Tests

Obviously, we haven’t yet written any unit or integration tests here to cover the gem that we created. Completing this exercise will improve your understanding of Rails 3 engine gems. The enginex tool we used automatically creates a test directory for you with a basic Rails application.

Let’s start by making sure our test_helper.rb file is up to snuff.

# CURRENT FILE :: test/test_helper.rb
# Configure Rails Environment
ENV["RAILS_ENV"] = "test"
ENV["RAILS_ROOT"] = File.expand_path("../dummy",  __FILE__)

require File.expand_path("../dummy/config/environment.rb",  __FILE__)
require "rails/test_help"

ActionMailer::Base.delivery_method = :test
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.default_url_options[:host] = "test.com"

Rails.backtrace_cleaner.remove_silencers!

# Run any available migration
ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)

# Load support files
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }

One thing to notice, which is unusual for a testing set-up helper, is that we aren’t requiring our local gem code anywhere in the test helper. Because we’re using Bundler, our gem is actually required in the dummy Rails app via our Gemfile at test/dummy/config/application.rb. Other than that, we’re setting up our Rails environment, booting the application and running any available migrations. Here’s a glance at a sample unit test.

# CURRENT FILE :: test/team_page_test.rb
require 'test_helper'

class TeamPageTest < ActiveSupport::TestCase

  test "truth" do
    assert_kind_of Module, TeamPage
  end

  test 'setup block yields self' do
    TeamPage.setup do |config|
      assert_equal TeamPage, config
    end
  end

end

To continue playing around with how engine testing and integration in a Rails app work, head to the test/dummy/ Rails app and boot the server or play in the console. Everything should work in there as well as it would in any other Rails application.

Resources And Tips

Here are a few helpers to make sure you’re on the right track. The following represents what you would expect the directory structure to look like for your engine gem after following the code examples in this article.

## DIRECTORY STRUCTURE
#

- team_page/
  - app/
    - controllers/
      - team_page/
        + team_controller.rb
    - models/
      - team_page/
        + team_member.rb
    - views/
      - team_page/
        + index.html.erb
  - config/
    + routes.rb
  - lib/
    - team_page.rb
    - generators/
      - team_page/
        + team_page_generator.rb
        - templates/
          + migration.rb
    - team_page/
      + engine.rb
      + version.rb
  - test/
    + team_page_test.rb
    + test_helper.rb
  + team_page.gemspec
  + Gemfile
  + Gemfile.lock

Here’s a simple script to load some team members into your database.

## DATA SEED
#
# => Method 1
# Copy the code into your application's db/seeds.rb file.
#
# => Method 2
# If you would like to run this code in the engine that you are
# developing, place it in the seeds file inside of the dummy app
# contained in your integration tests.
#
# With either of the above methods, be sure to run the following from
# your command line…
#
#     rake db:seed
#

5.times do |i|

  TeamPage::TeamMember.create!( {
    :name        => "Team Member #{i}",
    :twitter_url => "http://twitter.com/team_member_#{i}",
    :bio         => "A really fancy team member!",
    :image_url   => "http://bit.ly/muSWki"
  } )

end

Some External Resources

Conclusion

The goal of this post was to demonstrate how straightforward it is to create a Rails engine packaged as a Ruby gem.

To recap, we’ve boostrapped our gem, added a model and migration generator, set up a route to hit our controller, created a sample view, and wrote some example tests. This process can be used for any engine gem you feel you need, and it can speed up development time and improve the reliability and maintainability of your code bases. The possibilities are endless. What will you build?

(al)


© Ryan Cook for Smashing Magazine, 2011.


  •   
  • Copyright © 1996-2010 BlogmyQuery - BMQ. All rights reserved.
    iDream theme by Templates Next | Powered by WordPress