-
Notifications
You must be signed in to change notification settings - Fork 0
leandronunes/design
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
= Design
Design is a Rails plugin that helps you to set different, custom designs for
your Rails application, or event letting your users do so.
== On what we mean by 'design'
By 'design', we mean a set of elements that are taken together to built
your application's visual identity. In this plugin, you'll work with the
following elements:
* *template* - definition of the how much boxes the visual identity will have, together with their sizes and positions.
* *theme* - CSS definition for fonts, colors, backgrounds and
* *icon_theme* - set of icons to be used as action buttons in your application.
== Declaring and using usign in controllers
(the settings names are fictional)
class MyController < ActionController::Base
box1 = Design::Box.new(:number => 1)
box1.blocks << Design::Block.new(:position => 1) do
"Welcome to my website!"
end
box2 = Design::Box.new(:number => 2)
box2.blocks << Design::MainBlock.new(:position => 1)
box3 = Design::Box.new(:number => 3)
box3.blocks << Design::Block.new(:position => 1) do
"This in my footer"
end
design :fixed => {
:template => 'header_main_footer',
:theme => 'green_fields',
:icon_theme => 'discrete',
:boxes => [ box1, box2, box3 ]
}
end
Design will then know that your design has three boxes, each one with a block inside it. To use Design as your layout
generator, you just add something like this in aplicattion's layout:
<%= design_display(yield) %>
The argument do +design_display_boxes()+ is the content you want to be the main
content. Almost always you'll want to pass +yield+ (the resulting content for
the current action) there, but you can pass anything you want.
== Generating the migration file
This plugin needs the definition of some database tables. To create this table run the command
./script/generate design_migration
This command will generate the migration file needed by plugin.
Run this migration to create the database with the command:
rake db:migrate
== Controller subclassing and design
Designs are inherited through the inheritance tree. This way you can for
example declare the use of a design in ApplicationController and let the other
controllers abstract that fact that they are using design.
== Storing design information in ActiveRecord models: +acts_as_design+
You can also use ActiveRecord objects
== Creating a Block
The blocks must to be created on a folder with the name of the block inside the folder 'app/design_blocks' by default.
Imagine we wanna create a block that keep all your favorite links.
To do that we do the steps:
- mkdir 'app/design_root' #FIXME the plugin can create this folder on instalation
- ./script/generate design_block favorite_links. This will generate the block favorite_links on folder
'app/design_blocks'.
- Change the template generated. Everything it's fine now ;)
Notes: You can change the design_blocks root folder on your environment config file ' config/environment.rb' adding the
line.
DesignConfiguration.design_blocks_root= 'folder_of_design_blocks_root'
== Suggestions, Bug reports and Patches
Send them to leandronunes@gmail.com and terceiro@colivre.coop.br
== License
design - a web design composer and editor plugin for Rails
Copyright (C) 2007 Colivre <http://www.colivre.coop.br>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Please see the file +COPYING+ (distributed together with the plugin) for
the full terms of distribution.
About
Design Plugin
Resources
License
GPL-3.0, MIT licenses found
Licenses found
GPL-3.0
COPYING
MIT
MIT-LICENSE
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published