Remove unused web theme files

This commit is contained in:
Roberto Rosario
2014-10-11 02:52:40 -04:00
parent c0b5bbb9c2
commit 34af0ce3f6
29 changed files with 0 additions and 1584 deletions

View File

@@ -1,25 +0,0 @@
require "rubygems"
# require "cucumber/rake/task"
# require "spec/rake/spectask"
#
# Cucumber::Rake::Task.new
# Spec::Rake::SpecTask.new do |t|
# t.spec_files = FileList['test/**/*_spec.rb']
# end
# task :default => [:spec, :cucumber]
begin
require 'jeweler'
Jeweler::Tasks.new do |gemspec|
gemspec.name = "web-app-theme"
gemspec.summary = "Web app theme generator"
gemspec.description = "Web app theme generator for rails projects"
gemspec.email = "andrea@gravityblast.com"
gemspec.homepage = "http://github.com/pilu/web-app-theme"
gemspec.authors = ["Andrea Franz"]
end
rescue LoadError
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
end

View File

@@ -1,15 +0,0 @@
de:
web-app-theme:
save: Speichern
cancel: Abbrechen
list: Liste
edit: Bearbeiten
new: Neu
show: Anzeigen
delete: Löschen
confirm: Sind Sie sicher?
created_at: Erstellt am
all: Alle
profile: Benutzerkonto
settings: Einstellungen
logout: Abmelden

View File

@@ -1,12 +0,0 @@
pt_br:
web-app-theme:
save: Salvar
cancel: Cancelar
list: Listar
edit: Alterar
new: Novo
show: Exibir
delete: Excluir
confirm: Você tem certeza?
created_at: Criado em
all: Lista de

View File

@@ -1,59 +0,0 @@
Given /^I have a new rails app$/ do
generate_rails_app
end
Given /^I have no layouts$/ do
remove_layouts
end
Given /^I have no stylesheets$/ do
remove_stylesheets
end
Given /^I generate a theme$/ do
generate_layout
end
Given /^I generate a theme with name "([^\"]*)"$/ do |name|
generate_layout(name)
end
Given /^I generate a theme choosing the "([^\"]*)" theme$/ do |theme_name|
generate_layout(:theme => theme_name)
end
Then /^I should have a layout named "([^\"]*)"$/ do |filename|
layout_exists?(filename).should be_true
end
Then /^I should have a stylesheet named "([^\"]*)"$/ do |filename|
stylesheet_exists?(filename).should be_true
end
Then /^I should have an image named "([^\"]*)"$/ do |filename|
image_exists?(filename).should be_true
end
Given /^I generate a theme without layout choosing the "([^\"]*)" theme$/ do |theme_name|
generate_layout(:theme => theme_name, :no_layout => true )
end
Then /^I should not have any layouts$/ do
layouts_count.should == 0
end
Given /^I generate a theme with application name "([^\"]*)"$/ do |name|
generate_layout(:app_name => name )
end
Then /^the layout "([^\"]*)" should have "([^\"]*)" as page title$/ do |layout, title|
layout_title(layout).should == title
end
Given /^I generate a theme for signin and signup$/ do
generate_layout(:layout_type => :sign)
end
Then /^I should have a layout named "([^\"]*)" with just a box$/ do |layout|
layout_with_box?(layout).should be_true
end

View File

@@ -1,19 +0,0 @@
Given /^a model "([^\"]*)"$/ do |model_name|
generate_model(model_name)
end
Given /^I generate views for controller "([^\"]*)"$/ do |controller_path|
generate_views(controller_path)
end
When /^I generate views for controller "([^\"]*)" and model "([^\"]*)"$/ do |controller_path, model_name|
generate_views(controller_path, model_name)
end
When /^I generate text views for "([^\"]*)"/ do |controller_path|
generate_views(controller_path, :themed_type => :text)
end
Then /^I should have a view named "([^\"]*)"$/ do |view_path|
view_exists?(view_path).should be_true
end

View File

@@ -1,86 +0,0 @@
$:.unshift(File.dirname(__FILE__) + "/../../rails_generators")
require "rubygems"
require "rails_generator"
require 'rails_generator/scripts/generate'
require "fileutils"
require "theme/theme_generator"
web_app_theme_root = File.join(File.dirname(__FILE__), "/../../")
tmp_rails_app_name = "tmp_rails_app"
tmp_rails_app_root = File.join(web_app_theme_root, tmp_rails_app_name)
Rails::Generator::Base.append_sources(Rails::Generator::PathSource.new(:plugin, "#{web_app_theme_root}/rails_generators/"))
module GeneratorHelpers
def generate_rails_app
FileUtils.mkdir(File.join(@app_root))
end
def remove_layouts
FileUtils.rm_rf(File.join(@app_root, "app", "views", "layouts"))
end
def remove_stylesheets
FileUtils.rm_rf(File.join(@app_root, "public", "stylesheets"))
end
def generate(*args)
options = !args.empty? && args.last.is_a?(Hash) ? args.pop : {}
options.merge!({:destination => @app_root, :quiet => true})
Rails::Generator::Scripts::Generate.new.run(args, options)
end
def generate_layout(*args)
generate(:theme, *args)
end
def generate_views(*args)
generate(:themed, *args)
end
def generate_model(model_name)
Object.const_get(model_name)
rescue NameError
Object.const_set(model_name, Class.new)
klass = Object.const_get(model_name)
def klass.columns; []; end
end
def layouts_count
Dir[File.join(@app_root, "app", "views", "layouts", "**", "*.erb")].size
end
def layout_exists?(filename)
File.exists?(File.join(@app_root, "app", "views", "layouts", filename))
end
def view_exists?(view_path)
File.exists?(File.join(@app_root, "app", "views", view_path))
end
def image_exists?(image_path)
File.exists?(File.join(@app_root, "public", "images", image_path))
end
def stylesheet_exists?(relative_path)
File.exists?(File.join(@app_root, "public", "stylesheets", relative_path)).should be_true
end
def layout_title(layout)
File.open(File.join(@app_root, "app", "views", "layouts", layout), "r").read.match(/<title>([^<]*)<\/title>/)[1]
end
def layout_with_box?(layout)
File.open(File.join(@app_root, "app", "views", "layouts", layout), "r").read =~ %r|<div id="box">|
end
end
Before do
@app_root = tmp_rails_app_root
end
After do
FileUtils.rm_rf(tmp_rails_app_root)
end
World(GeneratorHelpers)

View File

@@ -1,55 +0,0 @@
Feature: Layout generation
In order to create a great application
I should be able to generate a layout with Web App Theme
# script/generate theme
Scenario: Generate a layout
Given I have a new rails app
And I have no layouts
And I have no stylesheets
When I generate a theme
Then I should have a layout named "application.html.erb"
And I should have a stylesheet named "web_app_theme.css"
And I should have a stylesheet named "web_app_theme_override.css"
And I should have a stylesheet named "themes/default/style.css"
And I should have an image named "web-app-theme/cross.png"
And I should have an image named "web-app-theme/key.png"
And I should have an image named "web-app-theme/tick.png"
And I should have an image named "web-app-theme/application_edit.png"
# script/generate theme admin
Scenario: Generate a layout with a name
Given I have a new rails app
And I have no layouts
And I generate a theme with name "admin"
Then I should have a layout named "admin.html.erb"
# script/generate theme --theme="drastic-dark"
Scenario: Generate a layout choosing a theme
Given I have a new rails app
And I have no stylesheets
And I generate a theme choosing the "drastic-dark" theme
Then I should have a stylesheet named "themes/drastic-dark/style.css"
# script/generate theme --theme=bec --no_layout
Scenario: Generate only stylesheets without layout
Given I have a new rails app
And I have no layouts
And I generate a theme without layout choosing the "bec" theme
Then I should have a stylesheet named "themes/bec/style.css"
But I should not have any layouts
# script/generate theme --app_name="My New Application"
Scenario: Generate layout with application name
Given I have a new rails app
And I have no layouts
And I generate a theme with application name "My New Application"
Then the layout "application.html.erb" should have "My New Application" as page title
# script/generate theme --type=sign
Scenario: Generate layout for signin and signup
Given I have a new rails app
And I have no layouts
And I generate a theme for signin and signup
Then I should have a layout named "sign.html.erb"
And I should have a layout named "sign.html.erb" with just a box

View File

@@ -1,52 +0,0 @@
Feature: Theme generation
In order to create a great application
I should be able to creare theme after creating a layout
# script/generate themed posts
Scenario: Creating CRUD views with controller path
Given I have a new rails app
And a model "Post"
When I generate views for controller "posts"
Then I should have a view named "posts/index.html.erb"
And I should have a view named "posts/new.html.erb"
And I should have a view named "posts/show.html.erb"
And I should have a view named "posts/edit.html.erb"
# script/generate themed items Post
Scenario: Creating CRUD views with controller path and model name
Given I have a new rails app
And a model "Post"
When I generate views for controller "items" and model "Post"
Then I should have a view named "items/index.html.erb"
And I should have a view named "items/new.html.erb"
And I should have a view named "items/show.html.erb"
And I should have a view named "items/edit.html.erb"
# script/generate themed admin/items Post
Scenario: Creating CRUD views with controller path "admin/items" and model name
Given I have a new rails app
And a model "Post"
When I generate views for controller "admin/items" and model "Post"
Then I should have a view named "admin/items/index.html.erb"
And I should have a view named "admin/items/new.html.erb"
And I should have a view named "admin/items/show.html.erb"
And I should have a view named "admin/items/edit.html.erb"
# script/generate themed admin/gallery_pictures
Scenario: Creating CRUD views with controller path "admin/gallery_pictures"
Given I have a new rails app
And a model "GalleryPicture"
When I generate views for controller "admin/gallery_pictures"
Then I should have a view named "admin/gallery_pictures/index.html.erb"
And I should have a view named "admin/gallery_pictures/new.html.erb"
And I should have a view named "admin/gallery_pictures/show.html.erb"
And I should have a view named "admin/gallery_pictures/edit.html.erb"
# script/generate themed homes --type=text
Scenario: Creating text theme
Given I have a new rails app
When I generate text views for "homes"
Then I should have a view named "homes/show.html.erb"
And I should have a view named "homes/_sidebar.html.erb"

View File

@@ -1,475 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Web App Theme</title>
<link rel="stylesheet" href="stylesheets/base.css" type="text/css" media="screen" />
<link rel="stylesheet" id="current-theme" href="stylesheets/themes/default/style.css" type="text/css" media="screen" />
<script type="text/javascript" charset="utf-8" src="javascripts/jquery-1.3.min.js"></script>
<script type="text/javascript" charset="utf-8" src="javascripts/jquery.scrollTo.js"></script>
<script type="text/javascript" charset="utf-8" src="javascripts/jquery.localscroll.js"></script>
<script type="text/javascript" charset="utf-8">
// <![CDATA[
var Theme = {
activate: function(name) {
window.location.hash = 'themes/' + name
Theme.loadCurrent();
},
loadCurrent: function() {
var hash = window.location.hash;
if (hash.length > 0) {
matches = hash.match(/^#themes\/([a-z0-9\-_]+)$/);
if (matches && matches.length > 1) {
$('#current-theme').attr('href', 'stylesheets/themes/' + matches[1] + '/style.css');
} else {
alert('theme not valid');
}
}
}
}
$(document).ready(function() {
Theme.loadCurrent();
$.localScroll();
$('.table :checkbox.toggle').each(function(i, toggle) {
$(toggle).change(function(e) {
$(toggle).parents('table:first').find(':checkbox:not(.toggle)').each(function(j, checkbox) {
checkbox.checked = !checkbox.checked;
})
});
});
});
// ]]>
</script>
</head>
<body>
<div id="container">
<div id="header">
<h1><a href="index.html">Web App Theme</a></h1>
<div id="user-navigation">
<ul class="wat-cf">
<li><a href="#">Profile</a></li>
<li><a href="#">Settings</a></li>
<li><a class="logout" href="#">Logout</a></li>
</ul>
</div>
<div id="main-navigation">
<ul class="wat-cf">
<li class="first"><a href="#block-text">Main Page</a></li>
<li class="active"><a href="#block-text">Active</a></li>
<li><a href="#block-login">Login</a></li>
<li><a href="#block-signup">Signup</a></li>
</ul>
</div>
</div>
<div id="wrapper" class="wat-cf">
<div id="main">
<div class="block" id="block-text">
<div class="secondary-navigation">
<ul class="wat-cf">
<li class="active first"><a href="#block-text">Text</a></li>
<li><a href="#block-tables">Tables</a></li>
<li><a href="#block-forms">Forms</a></li>
<li><a href="#block-messages">Messages</a></li>
<li><a href="#block-forms-2">2 Columns Forms</a></li>
<li><a href="#block-lists">Lists</a></li>
</ul>
</div>
<div class="content">
<h2 class="title">Text</h2>
<div class="inner">
<p class="first">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. <span class="hightlight">Excepteur sint occaecat cupidatat non proident</span>, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
<p> <span class="small">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore</span></p>
<p> <span class="gray">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore</span></p>
<hr />
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. <span class="hightlight">Excepteur sint occaecat cupidatat non proident</span>, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</div>
</div>
</div>
<div class="block" id="block-tables">
<div class="secondary-navigation">
<ul class="wat-cf">
<li class="first"><a href="#block-text">Text</a></li>
<li class="active"><a href="#block-tables">Tables</a></li>
<li><a href="#block-forms">Forms</a></li>
<li><a href="#block-messages">Messages</a></li>
<li><a href="#block-forms-2">2 Columns Forms</a></li>
<li><a href="#block-lists">Lists</a></li>
</ul>
</div>
<div class="content">
<h2 class="title">Tables</h2>
<div class="inner">
<form action="#" class="form">
<table class="table">
<tr>
<th class="first"><input type="checkbox" class="checkbox toggle" /></th>
<th>ID</th>
<th>Login</th>
<th>Name</th>
<th>Surname</th>
<th class="last">&nbsp;</th>
</tr>
<tr class="odd">
<td><input type="checkbox" class="checkbox" name="id" value="1" /></td><td>1</td><td>hulk</td><td>Hulk</td><td>Hogan</td><td class="last"><a href="#">show</a> | <a href="#">edit</a> | <a href="#">destroy</a></td>
</tr>
<tr class="even">
<td><input type="checkbox" class="checkbox" name="id" value="1" /></td><td>2</td><td>ultimate</td><td>Ultimate</td><td>Warrior</td><td class="last"><a href="#">show</a> | <a href="#">edit</a> | <a href="#">destroy</a></td>
</tr>
<tr class="odd">
<td><input type="checkbox" class="checkbox" name="id" value="1" /></td><td>3</td><td>andre</td><td>Andre</td><td>The Giant</td><td class="last"><a href="#">show</a> | <a href="#">edit</a> | <a href="#">destroy</a></td>
</tr>
<tr class="even">
<td><input type="checkbox" class="checkbox" name="id" value="1" /></td><td>4</td><td>machoman</td><td>Macho Man</td><td>Randy Savage</td><td class="last"><a href="#">show</a> | <a href="#">edit</a> | <a href="#">destroy</a></td>
</tr>
</table>
<div class="actions-bar wat-cf">
<div class="actions">
<button class="button" type="submit">
<img src="images/icons/cross.png" alt="Delete" /> Delete
</button>
</div>
<div class="pagination">
<span class="disabled prev_page">« Previous</span><span class="current">1</span><a rel="next" href="#">2</a><a href="#">3</a><a href="#">4</a><a href="#">5</a><a href="#">6</a><a href="#">7</a><a href="#">8</a><a href="#">9</a><a href="#">10</a><a href="#">11</a><a rel="next" class="next_page" href="#">Next »</a>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="block" id="block-forms">
<div class="secondary-navigation">
<ul class="wat-cf">
<li class="first"><a href="#block-text">Text</a></li>
<li><a href="#block-tables">Tables</a></li>
<li class="active"><a href="#block-forms">Forms</a></li>
<li><a href="#block-messages">Messages</a></li>
<li><a href="#block-forms-2">2 Columns Forms</a></li>
<li><a href="#block-lists">Lists</a></li>
</ul>
</div>
<div class="content">
<h2 class="title">Forms</h2>
<div class="inner">
<form action="#" method="get" class="form">
<div class="group">
<label class="label">Text field</label>
<input type="text" class="text_field" />
<span class="description">Ex: a simple text</span>
</div>
<div class="group">
<div class="fieldWithErrors">
<label class="label" for="post_title">Title</label>
<span class="error">can't be blank</span>
</div>
<input type="text" class="text_field" />
<span class="description">Ex: a simple text</span>
</div>
<div class="group">
<label class="label">Text area</label>
<textarea class="text_area" rows="10" cols="80"></textarea>
<span class="description">Write here a long text</span>
</div>
<div class="group navform wat-cf">
<button class="button" type="submit">
<img src="images/icons/tick.png" alt="Save" /> Save
</button>
<span class="text_button_padding">or</span>
<a class="text_button_padding link_button" href="#header">Cancel</a>
</div>
</form>
</div>
</div>
</div>
<div class="block" id="block-messages">
<div class="secondary-navigation">
<ul class="wat-cf">
<li class="first"><a href="#block-text">Text</a></li>
<li><a href="#block-tables">Tables</a></li>
<li><a href="#block-forms">Forms</a></li>
<li class="active"><a href="#block-messages">Messages</a></li>
<li><a href="#block-forms-2">2 Columns Forms</a></li>
<li><a href="#block-lists">Lists</a></li>
</ul>
</div>
<div class="content">
<h2 class="title">Messages</h2>
<div class="inner">
<div class="flash">
<div class="message error">
<p>Error message</p>
</div>
<div class="message warning">
<p>Warning message</p>
</div>
<div class="message notice">
<p>Notice message</p>
</div>
</div>
</div>
</div>
</div>
<div class="block" id="block-forms-2">
<div class="secondary-navigation">
<ul class="wat-cf">
<li class="first"><a href="#block-text">Text</a></li>
<li><a href="#block-tables">Tables</a></li>
<li><a href="#block-forms">Forms</a></li>
<li><a href="#block-messages">Messages</a></li>
<li class="active"><a href="#block-forms-2">2 Columns Forms</a></li>
<li><a href="#block-lists">Lists</a></li>
</ul>
</div>
<div class="content">
<h2 class="title">2 columns forms</h2>
<div class="inner">
<form action="#" method="get" class="form">
<div class="columns wat-cf">
<div class="column left">
<div class="group">
<label class="label">Text field</label>
<input type="text" class="text_field" />
</div>
<div class="group">
<label class="label">Text area</label>
<textarea class="text_area" rows="10" cols="80"></textarea>
</div>
</div>
<div class="column right">
<div class="group">
<label class="label">Select</label>
<select><option value="1">Choose...</option></select>
</div>
<div class="group">
<label class="label">Check box</label>
<div>
<input type="checkbox" name="checkbox" id="checkbox_1" class="checkbox" value="1" /> <label for="checkbox_1" class="checkbox">Option 1</label>
</div>
<div>
<input type="checkbox" name="checkbox" id="checkbox_2" class="checkbox" value="2" /> <label for="checkbox_2" class="checkbox">Option 2</label>
</div>
</div>
<div class="group">
<label class="label">Radio</label>
<div>
<input type="radio" name="radio" id="radio_1" class="checkbox" value="1" /> <label for="radio_1" class="radio">Option 1</label>
</div>
<div>
<input type="radio" name="radio" id="radio_2" class="checkbox" value="2" /> <label for="radio_2" class="radio">Option 2</label>
</div>
</div>
</div>
</div>
<div class="group navform wat-cf">
<button class="button" type="submit">
<img src="images/icons/tick.png" alt="Save" /> Save
</button>
<span class="text_button_padding">or</span>
<a class="text_button_padding link_button" href="#header">Cancel</a>
</div>
</form>
</div>
</div>
</div>
<div class="block" id="block-lists">
<div class="secondary-navigation">
<ul class="wat-cf">
<li class="first"><a href="#block-text">Text</a></li>
<li><a href="#block-tables">Tables</a></li>
<li><a href="#block-forms">Forms</a></li>
<li><a href="#block-messages">Messages</a></li>
<li><a href="#block-forms-2">2 Columns Forms</a></li>
<li class="active"><a href="#block-lists">Lists</a></li>
</ul>
</div>
<div class="content">
<h2 class="title">Lists</h2>
<div class="inner">
<ul class="list">
<li>
<div class="left">
<a href="#"><img class="avatar" src="images/avatar.png" alt="avatar" /></a>
</div>
<div class="item">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
</li>
<li>
<div class="left">
<a href="#"><img class="avatar" src="images/avatar.png" alt="avatar" /></a>
</div>
<div class="item">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
</li>
<li>
<div class="left">
<a href="#"><img class="avatar" src="images/avatar.png" alt="avatar" /></a>
</div>
<div class="item">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
</li>
</ul>
</div>
</div>
</div>
<div id="footer">
<div class="block">
<p>Copyright &copy; 2010 Your Site.</p>
</div>
</div>
</div>
<div id="sidebar">
<div class="block">
<h3>Simple Block</h3>
<div class="content">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</div>
</div>
<div class="block">
<h3>Switch Theme</h3>
<ul class="navigation">
<li><a href="#" onclick="Theme.activate('default'); return false;">Default</a></li>
<li><a href="#" onclick="Theme.activate('activo'); return false;">Activo 2</a></li>
<li><a href="#" onclick="Theme.activate('red'); return false;">Red</a></li>
<li><a href="#" onclick="Theme.activate('amro'); return false;">Amro</a></li>
<li><a href="#" onclick="Theme.activate('bec'); return false;">Bec</a></li>
<li><a href="#" onclick="Theme.activate('bec-green'); return false;">Bec-Green</a></li>
<li><a href="#" onclick="Theme.activate('blue'); return false;">Blue</a></li>
<li><a href="#" onclick="Theme.activate('djime-cerulean'); return false;">Djime-Cerulean</a></li>
<li><a href="#" onclick="Theme.activate('drastic-dark'); return false;">Drastic Dark</a></li>
<li><a href="#" onclick="Theme.activate('kathleene'); return false;">Kathleene</a></li>
<li><a href="#" onclick="Theme.activate('olive'); return false;">Olive</a></li>
<li><a href="#" onclick="Theme.activate('orange'); return false;">Orange</a></li>
<li><a href="#" onclick="Theme.activate('reidb-greenish'); return false;">Greenish</a></li>
<li><a href="#" onclick="Theme.activate('warehouse'); return false;">Warehouse</a></li>
</ul>
</div>
<div class="block">
<h3>Sidebar</h3>
<ul class="navigation">
<li><a href="#block-text">Text</a></li>
<li><a href="#block-tables">Tables</a></li>
<li><a href="#block-forms">Forms</a></li>
<li><a href="#block-messages">Messages</a></li>
<li><a href="#block-forms-2">2 Columns Forms</a></li>
<li><a href="#block-lists">Lists</a></li>
</ul>
</div>
<div class="block notice">
<h4>Notice Title</h4>
<p>Morbi posuere urna vitae nunc. Curabitur ultrices, lorem ac aliquam blandit, lectus eros hendrerit eros, at eleifend libero ipsum hendrerit urna. Suspendisse viverra. Morbi ut magna. Praesent id ipsum. Sed feugiat ipsum ut felis. Fusce vitae nibh sed risus commodo pulvinar. Duis ut dolor. Cras ac erat pulvinar tortor porta sodales. Aenean tempor venenatis dolor.</p>
</div>
<div class="block">
<div class="sidebar-block">
<h4>Sidebar Inner block Title</h4>
<p>Morbi posuere urna vitae nunc. Curabitur ultrices, lorem ac <a href="#">aliquam blandit</a>, lectus eros hendrerit eros, at eleifend libero ipsum hendrerit urna. Suspendisse viverra. Morbi ut magna. Praesent id ipsum. Sed feugiat ipsum ut felis. Fusce vitae nibh sed risus commodo pulvinar. Duis ut dolor. Cras ac erat pulvinar tortor porta sodales. Aenean tempor venenatis dolor.</p>
</div>
</div>
</div>
</div>
<div id="box">
<h1>Web App Theme</h1>
<div class="block" id="block-login">
<h2>Login Box</h2>
<div class="content login">
<div class="flash">
<div class="message notice">
<p>Logged in successfully</p>
</div>
</div>
<form action="#" class="form login">
<div class="group wat-cf">
<div class="left">
<label class="label right">Login</label>
</div>
<div class="right">
<input type="text" class="text_field" />
</div>
</div>
<div class="group wat-cf">
<div class="left">
<label class="label right">Password</label>
</div>
<div class="right">
<input type="password" class="text_field" />
</div>
</div>
<div class="group navform wat-cf">
<div class="right">
<button class="button" type="submit">
<img src="images/icons/key.png" alt="Save" /> Login
</button>
</div>
</div>
</form>
</div>
</div>
<div class="block" id="block-signup">
<h2>Sign up</h2>
<div class="content">
<form action="#" class="form">
<div class="group wat-cf">
<div class="left">
<label class="label">Login</label>
</div>
<div class="right">
<input type="text" class="text_field" />
<span class="description">Ex: web-app-theme</span>
</div>
</div>
<div class="group wat-cf">
<div class="left">
<label class="label">Email</label>
</div>
<div class="right">
<input type="text" class="text_field" />
<span class="description">Ex: test@example.com</span>
</div>
</div>
<div class="group wat-cf">
<div class="left">
<label class="label">Password</label>
</div>
<div class="right">
<input type="password" class="text_field" />
<span class="description">Must contains the word 'yeah'</span>
</div>
</div>
<div class="group">
<label class="label">Text field</label>
<input type="text" class="text_field" />
<span class="description">Ex: a simple text</span>
</div>
<div class="group">
<label class="label">Text field</label>
<input type="text" class="text_field" />
<span class="description">Ex: a simple text</span>
</div>
<div class="group navform wat-cf">
<button class="button" type="submit">
<img src="images/icons/tick.png" alt="Save" /> Signup
</button>
</div>
</form>
</div>
</div>
</div>
</div>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,46 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title><%= options.app_name %></title>
<%%= stylesheet_link_tag "web-app-theme/base", "web-app-theme/themes/<%= options.theme %>/style", "web-app-theme/override", :cache => true %>
<%%= javascript_include_tag :defaults, :cache => true %>
<%%= csrf_meta_tag %>
</head>
<body>
<div id="container">
<div id="header">
<h1><a href="/"><%= options.app_name %></a></h1>
<div id="user-navigation">
<ul class="wat-cf">
<li><a href="#"><%%= t("web-app-theme.profile", :default => "Profile") %></a></li>
<li><a href="#"><%%= t("web-app-theme.settings", :default => "Settings") %></a></li>
<li><a href="/logout" class="logout"><%%= t("web-app-theme.logout", :default => "Logout") %></a></li>
</ul>
</div>
<div id="main-navigation">
<ul class="wat-cf"></ul>
</div>
</div>
<div id="wrapper" class="wat-cf">
<div class="flash">
<%% flash.each do |type, message| -%>
<div class="message <%%= type %>">
<p><%%= message %></p>
</div>
<%% end -%>
</div>
<div id="main">
<%%= yield %>
<div id="footer">
<div class="block">
<p>Copyright &copy; <%%= Time.now.year %> <%= options.app_name %>.</p>
</div>
</div>
</div>
<div id="sidebar">
<%%= yield :sidebar %>
</div>
</div>
</div>
</body>
</html>

View File

@@ -1,15 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title><%= options.app_name %></title>
<%%= stylesheet_link_tag "web-app-theme/base", "web-app-theme/themes/<%= options.theme %>/style", "web-app-theme/override", :cache => true %>
<%%= csrf_meta_tag %>
</head>
<body>
<div id="container">
<div id="box">
<%%= yield %>
</div>
</div>
</body>
</html>

View File

@@ -1,61 +0,0 @@
module WebAppTheme
class ThemeGenerator < Rails::Generators::Base
source_root File.expand_path('../templates', __FILE__)
argument :layout_name, :type => :string, :default => 'application'
class_option :theme, :type => :string, :default => :default, :desc => 'Specify the layout theme'
class_option :app_name, :type => :string, :default => 'Web App', :desc => 'Specify the application name'
class_option :engine, :type => :string, :default => 'erb', :desc => 'Specify the template engine'
class_option :no_layout, :type => :boolean, :default => false, :desc => 'Use this option if you want to generate only stylesheets'
class_option :layout_type, :type => :string, :default => 'admin', :desc => 'Layout type, admin or sign'
def copy_layout
return if options.no_layout
admin_layout_name = options.layout_type == 'sign' ? "layout_sign.html.erb" : "layout_admin.html.erb"
case options.engine
when 'erb'
template admin_layout_name, "app/views/layouts/#{layout_name.underscore}.html.erb"
when 'haml'
generate_haml_layout(admin_layout_name)
end
end
def copy_base_stylesheets
copy_file "#{stylesheets_path}/base.css", "public/stylesheets/web-app-theme/base.css"
copy_file "#{stylesheets_path}/override.css", "public/stylesheets/web-app-theme/override.css"
end
def copy_theme_stylesheets
directory "#{stylesheets_path}/themes/#{options.theme}", "public/stylesheets/web-app-theme/themes/#{options.theme}"
end
def copy_images
directory "#{images_path}", "public/images/web-app-theme"
end
protected
def stylesheets_path
"../../../../../stylesheets"
end
def images_path
"../../../../../images"
end
def generate_haml_layout(admin_layout_name)
require 'haml'
Dir.mktmpdir('web-app-theme-haml') do |haml_root|
tmp_html_path = "#{haml_root}/#{admin_layout_name}"
tmp_haml_path = "#{haml_root}/#{admin_layout_name}.haml"
template admin_layout_name, tmp_html_path, :verbose => false
`html2haml --erb --xhtml #{tmp_html_path} #{tmp_haml_path}`
copy_file tmp_haml_path, "app/views/layouts/#{layout_name.underscore}.html.haml"
end
rescue LoadError
say "HAML is not installed, or it is not specified in your Gemfile."
exit
end
end
end

View File

@@ -1,19 +0,0 @@
<div class="block">
<div class="secondary-navigation">
<ul class="wat-cf">
<li class="first"><%%= link_to "#{t("web-app-theme.list", :default => "List")}", <%= controller_routing_path %>_path %></li>
<li><%%= link_to "#{t("web-app-theme.new", :default => "New")}", new_<%= singular_controller_routing_path %>_path %></li>
<li class="active"><%%= link_to "#{t("web-app-theme.edit", :default => "Edit")}", edit_<%= singular_controller_routing_path %>_path %></li>
</ul>
</div>
<div class="content">
<h2 class="title"><%%= t("web-app-theme.edit", :default => "Edit") %> <%= model_name %></h2>
<div class="inner">
<%%= form_for @<%= model_name.underscore %>, :url => <%= singular_controller_routing_path %>_path(@<%= resource_name %>), :html => { :class => :form } do |f| -%>
<%%= render :partial => "form", :locals => {:f => f} %>
<%% end -%>
</div>
</div>
</div>
<%% content_for :sidebar, render(:partial => 'sidebar') -%>

View File

@@ -1,14 +0,0 @@
<% columns.each do |column| %>
<div class="group">
<%%= f.label :<%= column.name %>, t("activerecord.attributes.<%= model_name.underscore %>.<%= column.name %>", :default => "<%= column.name.humanize %>"), :class => :label %>
<%%= f.<%= column.field_type %> :<%= column.name %>, :class => '<%= column.field_type %>' %>
<span class="description">Ex: a simple text</span>
</div>
<%- end -%>
<div class="group navform wat-cf">
<button class="button" type="submit">
<%%= image_tag("web-app-theme/icons/tick.png", :alt => "#{t("web-app-theme.save", :default => "Save")}") %> <%%= t("web-app-theme.save", :default => "Save") %>
</button>
<span class="text_button_padding"><%%= t("web-app-theme.or", :default => "or") %></span>
<%%= link_to t("web-app-theme.cancel", :default => "Cancel"), <%= controller_routing_path %>_path, :class => "text_button_padding link_button" %>
</div>

View File

@@ -1,18 +0,0 @@
<div class="block">
<div class="secondary-navigation">
<ul class="wat-cf">
<li class="first"><%%= link_to "#{t("web-app-theme.list", :default => "List")}", <%= controller_routing_path %>_path %></li>
<li class="active"><%%= link_to "#{t("web-app-theme.new", :default => "New")}", new_<%= singular_controller_routing_path %>_path %></li>
</ul>
</div>
<div class="content">
<h2 class="title"><%%= t("web-app-theme.new", :default => "New")%> <%= model_name %></h2>
<div class="inner">
<%%= form_for :<%= model_name.underscore %>, :url => <%= controller_routing_path %>_path, :html => { :class => :form } do |f| -%>
<%%= render :partial => "form", :locals => {:f => f} %>
<%% end -%>
</div>
</div>
</div>
<%% content_for :sidebar, render(:partial => 'sidebar') -%>

View File

@@ -1,25 +0,0 @@
<div class="block">
<div class="secondary-navigation">
<ul class="wat-cf">
<li class="first"><%%= link_to "#{t("web-app-theme.list", :default => "List")}", <%= controller_routing_path %>_path %></li>
<li><%%= link_to "#{t("web-app-theme.new", :default => "New")}", new_<%= singular_controller_routing_path %>_path %></li>
<li class="active"><%%= link_to "#{t("web-app-theme.show", :default => "Show")}", <%= singular_controller_routing_path %>_path %></li>
</ul>
</div>
<div class="content">
<div class="inner">
<% columns.each do |column| %>
<p>
<b><%%= t("activerecord.attributes.<%= singular_controller_routing_path %>.<%= column.name %>", :default => t("activerecord.labels.<%= column.name %>", :default => "<%= column.name.humanize %>")) %>:</b>
<%%= @<%= resource_name %>.<%= column.name %> %>
</p>
<%- end -%>
<div class="wat-cf">
<%%= link_to image_tag("web-app-theme/icons/application_edit.png", :alt => "#{t("web-app-theme.edit", :default=> "Edit")}") + " " + t("web-app-theme.edit", :default=> "Edit"), edit_<%= singular_controller_routing_path %>_path(@<%= resource_name %>), :class => "button" %>
<%%= link_to image_tag("web-app-theme/icons/cross.png", :alt => "#{t("web-app-theme.delete", :default=> "Delete")}") + " " + t("web-app-theme.delete", :default => "Delete"), <%= singular_controller_routing_path %>_path(@<%= resource_name %>), :method => "delete", :class => "button", :confirm => "#{t("web-app-theme.confirm", :default => "Are you sure?")}" %>
</div>
</div>
</div>
</div>
<%% content_for :sidebar, render(:partial => 'sidebar') -%>

View File

@@ -1,13 +0,0 @@
<div class="block notice">
<h3>Simple Block</h3>
<div class="content">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</div>
</div>
<div class="block">
<h3>Links</h3>
<ul class="navigation">
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
</ul>
</div>

View File

@@ -1,36 +0,0 @@
<h1><%= options[:app_name] %></h1>
<div class="block" id="block-login">
<h2>Login Box</h2>
<div class="content login">
<div class="flash">
<%% flash.each do |type, message| -%>
<div class="message <%%= type %>">
<p><%%= message %></p>
</div>
<%% end -%>
</div>
<%% form_tag({:action => :create}, :class => 'form login') do -%>
<div class="group wat-cf">
<div class="left">
<label class="label right">Login</label>
</div>
<div class="right">
<%%= text_field_tag :login, @login, :class => 'text_field' %>
</div>
</div>
<div class="group wat-cf">
<div class="left">
<label class="label right">Password</label>
</div>
<div class="right">
<%%= password_field_tag :password, nil, :class => 'text_field' %>
</div>
</div>
<div class="group navform wat-cf">
<div class="right">
<input type="submit" class="button" value="Sign in" />
</div>
</div>
<%% end -%>
</div>
</div>

View File

@@ -1,52 +0,0 @@
<h1><%= options[:app_name] %></h1>
<div class="block" id="block-signup">
<h2>Sign up</h2>
<div class="content">
<div class="flash">
<%% flash.each do |type, message| -%>
<div class="message <%%= type %>">
<p><%%= message %></p>
</div>
<%% end -%>
</div>
<%% form_for :<%= resource_name %>, :url => <%= controller_routing_path %>_path, :html => { :class => 'form' } do |f| -%>
<div class="group wat-cf">
<div class="left">
<label class="label">Login</label>
</div>
<div class="right">
<%%= f.text_field :login, :class => 'text_field' %>
</div>
</div>
<div class="group wat-cf">
<div class="left">
<label class="label">Email</label>
</div>
<div class="right">
<%%= f.text_field :email, :class => 'text_field' %>
</div>
</div>
<div class="group wat-cf">
<div class="left">
<label class="label">Password</label>
</div>
<div class="right">
<%%= f.password_field :password, :class => 'text_field' %>
</div>
</div>
<div class="group">
<div class="left wat-cf">
<label class="label">Password</label>
</div>
<div class="right">
<%%= f.password_field :password_confirmation, :class => 'text_field' %>
</div>
</div>
<div class="group navform">
<input type="submit" class="button" value="Sign up" />
</div>
<%% end -%>
</div>
</div>

View File

@@ -1,54 +0,0 @@
<div class="block">
<div class="secondary-navigation">
<ul class="wat-cf">
<li class="first active"><%%= link_to "#{t("web-app-theme.list", :default => "List")}", <%= controller_routing_path %>_path %></li>
<li><%%= link_to "#{t("web-app-theme.new", :default => "New")}", new_<%= singular_controller_routing_path %>_path %></li>
</ul>
</div>
<div class="content">
<h2 class="title"><%%= t("web-app-theme.all", :default => "All") %> <%= plural_model_name %></h2>
<div class="inner">
<table class="table">
<tr>
<th class="first">ID</th>
<% unless columns.empty? -%>
<th>
<%%= t("activerecord.attributes.<%= singular_controller_routing_path %>.<%= columns.first.name %>", :default => t("activerecord.labels.<%= columns.first.name %>", :default => "<%= columns.first.name.capitalize %>")) %>
</th>
<% end -%>
<th><%%= t("web-app-theme.created_at", :default => "Created at") %></th>
<th class="last">&nbsp;</th>
</tr>
<%% @<%= plural_resource_name %>.each do |<%= resource_name %>| -%>
<tr class="<%%= cycle("odd", "even") %>">
<td>
<%%= <%= resource_name %>.id %>
</td>
<% unless columns.empty? -%>
<td>
<%%= link_to <%= resource_name %>.<%= columns.first.name %>, <%= singular_controller_routing_path %>_path(<%= resource_name %>) %>
</td>
<% end -%>
<td>
<%%= <%= resource_name %>.created_at %>
</td>
<td class="last">
<%%= link_to "#{t("web-app-theme.show", :default => "Show")}", <%= singular_controller_routing_path %>_path(<%= resource_name %>) %> |
<%%= link_to "#{t("web-app-theme.edit", :default => "Edit")}", edit_<%= singular_controller_routing_path %>_path(<%= resource_name %>) %> |
<%%= link_to "#{t("web-app-theme.delete", :default => "Delete")}", <%= singular_controller_routing_path %>_path(<%= resource_name %>), :method => :delete, :confirm => "#{t("web-app-theme.confirm", :default => "Are you sure?")}" %>
</td>
</tr>
<%% end -%>
</table>
<div class="actions-bar wat-cf">
<div class="actions">
</div>
<% if options.will_paginate %>
<%%= will_paginate @<%= plural_resource_name %> %>
<% end %>
</div>
</div>
</div>
</div>
<%% content_for :sidebar, render(:partial => 'sidebar') -%>

View File

@@ -1,18 +0,0 @@
<div class="block" id="block-text">
<div class="content">
<h2 class="title"><%= resource_name.capitalize %></h2>
<div class="inner">
<p class="first">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. <span class="hightlight">Excepteur sint occaecat cupidatat non proident</span>, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
<p> <span class="small">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore</span></p>
<p> <span class="gray">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore</span></p>
<hr />
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. <span class="hightlight">Excepteur sint occaecat cupidatat non proident</span>, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</div>
</div>
</div>
<%% content_for :sidebar, render(:partial => 'sidebar') -%>

View File

@@ -1,137 +0,0 @@
require 'rails/generators/generated_attribute'
module WebAppTheme
class ThemedGenerator < Rails::Generators::Base
source_root File.expand_path('../templates', __FILE__)
argument :controller_path, :type => :string
argument :model_name, :type => :string, :required => false
class_option :layout, :type => :string, :desc => 'Specify the layout name'
class_option :engine, :type => :string, :default => 'erb', :desc => 'Specify the template engine'
class_option :will_paginate, :type => :boolean, :default => false, :desc => 'Specify if you use will_paginate'
class_option :themed_type, :type => :string, :default => 'crud', :desc => 'Specify the themed type, crud or text. Default is crud'
def initialize(args, *options)
super(args, *options)
initialize_views_variables
end
def copy_views
generate_views
unless options.layout.blank?
if options.engine =~ /erb/
gsub_file(File.join('app/views/layouts', "#{options[:layout]}.html.#{options.engine}"), /\<div\s+id=\"main-navigation\">.*\<\/ul\>/mi) do |match|
match.gsub!(/\<\/ul\>/, "")
%|#{match} <li class="<%= controller.controller_path == '#{@controller_file_path}' ? 'active' : '' %>"><a href="<%= #{controller_routing_path}_path %>">#{plural_model_name}</a></li></ul>|
end
elsif options.engine =~ /haml/
gsub_file(File.join('app/views/layouts', "#{options[:layout]}.html.#{options.engine}"), /#main-navigation.*#wrapper.wat-cf/mi) do |match|
match.gsub!(/ #wrapper.wat-cf/, "")
%|#{match}| +
" "*6 + %|%li{:class => controller.controller_path == '#{@controller_file_path}' ? 'active' : '' }\n| +
" "*7 + %|%a{:href => #{controller_routing_path}_path} #{plural_model_name}\n| +
" "*3 + %|#wrapper.wat-cf|
end
end
end
end
protected
def initialize_views_variables
@base_name, @controller_class_path, @controller_file_path, @controller_class_nesting, @controller_class_nesting_depth = extract_modules(controller_path)
@controller_routing_path = @controller_file_path.gsub(/\//, '_')
@model_name = @base_name.singularize unless @model_name
@model_name = @model_name.camelize
end
def controller_routing_path
@controller_routing_path
end
def singular_controller_routing_path
@controller_routing_path.singularize
end
def model_name
@model_name
end
def plural_model_name
@model_name.pluralize
end
def resource_name
@model_name.underscore
end
def plural_resource_name
resource_name.pluralize
end
##
# Attempts to call #columns on the model's class
# If the (Active Record) #columns method does not exist, it attempts to
# perform the (Mongoid) #fields method instead
def columns
begin
excluded_column_names = %w[id created_at updated_at]
Kernel.const_get(@model_name).columns.reject{|c| excluded_column_names.include?(c.name) }.collect{|c| Rails::Generators::GeneratedAttribute.new(c.name, c.type)}
rescue NoMethodError
Kernel.const_get(@model_name).fields.collect{|c| c[1]}.reject{|c| excluded_column_names.include?(c.name) }.collect{|c| Rails::Generators::GeneratedAttribute.new(c.name, c.type.to_s)}
end
end
def extract_modules(name)
modules = name.include?('/') ? name.split('/') : name.split('::')
name = modules.pop
path = modules.map { |m| m.underscore }
file_path = (path + [name.underscore]).join('/')
nesting = modules.map { |m| m.camelize }.join('::')
[name, path, file_path, nesting, modules.size]
end
def generate_views
views = {
'crud' => {
'view_tables.html.erb' => File.join('app/views', @controller_file_path, "index.html.#{options.engine}"),
'view_new.html.erb' => File.join('app/views', @controller_file_path, "new.html.#{options.engine}"),
'view_edit.html.erb' => File.join('app/views', @controller_file_path, "edit.html.#{options.engine}"),
'view_form.html.erb' => File.join('app/views', @controller_file_path, "_form.html.#{options.engine}"),
'view_show.html.erb' => File.join('app/views', @controller_file_path, "show.html.#{options.engine}"),
'view_sidebar.html.erb' => File.join('app/views', @controller_file_path, "_sidebar.html.#{options.engine}")
},
'text' => {
'view_text.html.erb' => File.join('app/views', @controller_file_path, "show.html.#{options.engine}"),
'view_sidebar.html.erb' => File.join('app/views', @controller_file_path, "_sidebar.html.#{options.engine}")
}
}
selected_views = views[options.themed_type]
options.engine == 'haml' ? generate_haml_views(selected_views) : generate_erb_views(selected_views)
end
def generate_erb_views(views)
views.each do |template_name, output_path|
template template_name, output_path
end
end
def generate_haml_views(views)
require 'haml'
Dir.mktmpdir('web-app-theme-haml') do |haml_root|
views.each do |template_name, output_path|
tmp_html_path = "#{haml_root}/#{template_name}"
tmp_haml_path = "#{haml_root}/#{template_name}.haml"
template template_name, tmp_html_path, :verbose => false
`html2haml --erb --xhtml #{tmp_html_path} #{tmp_haml_path}`
copy_file tmp_haml_path, output_path
end
end
rescue LoadError
say "HAML is not installed, or it is not specified in your Gemfile."
exit
end
end
end

View File

@@ -1,2 +0,0 @@
module WebAppTheme
end

View File

@@ -1,5 +0,0 @@
require "rubygems"
require "spec"
require "rails_generator"
require "rails_generator/scripts/generate"
require File.dirname(__FILE__) + "/../rails_generators/themed/themed_generator"

View File

@@ -1,115 +0,0 @@
require File.dirname(__FILE__) + "/spec_helper"
describe ThemedGenerator, "with 'script/generate themed posts'" do
before do
Post = Class.new
Post.stub!(:columns).and_return([])
options = {:destination => File.dirname(__FILE__), :quiet => true, :source => File.dirname(__FILE__)}
@generator = ThemedGenerator.new(["posts", "post"], options)
@generator.manifest
end
after do
Object::send(:remove_const, :Post)
end
it "should set the right controller_routing_path" do
@generator.instance_variable_get("@controller_routing_path").should == "posts"
end
it "should set the right singular_controller_routing_path" do
@generator.instance_variable_get("@singular_controller_routing_path").should == "post"
end
it "should set the right model_name" do
@generator.instance_variable_get("@model_name").should == "Post"
end
it "should set the right plural_model_name" do
@generator.instance_variable_get("@plural_model_name").should == "Posts"
end
it "should set the right resource_name" do
@generator.instance_variable_get("@resource_name").should == "post"
end
it "should set the right plural_resource_name" do
@generator.instance_variable_get("@plural_resource_name").should == "posts"
end
end
describe ThemedGenerator, "with 'script/generate themed admin/gallery_items'" do
before do
GalleryItem = Class.new
GalleryItem.stub!(:columns).and_return([])
options = {:destination => File.dirname(__FILE__), :quiet => true, :source => File.dirname(__FILE__)}
@generator = ThemedGenerator.new(["admin/gallery_items"], options)
@generator.manifest
end
after do
Object::send(:remove_const, :GalleryItem)
end
it "should set the right controller_routing_path" do
@generator.instance_variable_get("@controller_routing_path").should == "admin_gallery_items"
end
it "should set the right singular_controller_routing_path" do
@generator.instance_variable_get("@singular_controller_routing_path").should == "admin_gallery_item"
end
it "should set the right model_name" do
@generator.instance_variable_get("@model_name").should == "GalleryItem"
end
it "should set the right plural_model_name" do
@generator.instance_variable_get("@plural_model_name").should == "GalleryItems"
end
it "should set the right resource_name" do
@generator.instance_variable_get("@resource_name").should == "gallery_item"
end
it "should set the right plural_resource_name" do
@generator.instance_variable_get("@plural_resource_name").should == "gallery_items"
end
end
describe ThemedGenerator, "with 'script/generate themed admin/gallery_items pictures'" do
before do
Picture = Class.new
Picture.stub!(:columns).and_return([])
options = {:destination => File.dirname(__FILE__), :quiet => true, :source => File.dirname(__FILE__)}
@generator = ThemedGenerator.new(["admin/gallery_items", "picture"], options)
@generator.manifest
end
after do
Object::send(:remove_const, :Picture)
end
it "should set the right controller_routing_path" do
@generator.instance_variable_get("@controller_routing_path").should == "admin_gallery_items"
end
it "should set the right singular_controller_routing_path" do
@generator.instance_variable_get("@singular_controller_routing_path").should == "admin_gallery_item"
end
it "should set the right model_name" do
@generator.instance_variable_get("@model_name").should == "Picture"
end
it "should set the right plural_model_name" do
@generator.instance_variable_get("@plural_model_name").should == "Pictures"
end
it "should set the right resource_name" do
@generator.instance_variable_get("@resource_name").should == "picture"
end
it "should set the right plural_resource_name" do
@generator.instance_variable_get("@plural_resource_name").should == "pictures"
end
end

View File

@@ -1,117 +0,0 @@
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{web-app-theme}
s.version = "0.7.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Andrea Franz"]
s.date = %q{2011-07-25}
s.description = %q{Web app theme generator for rails projects}
s.email = %q{andrea@gravityblast.com}
s.extra_rdoc_files = [
"LICENSE",
"README.md"
]
s.files = [
"LICENSE",
"README.md",
"Rakefile",
"VERSION",
"config/locales/de_de.yml",
"config/locales/pt_br.yml",
"features/step_definitions/layout_steps.rb",
"features/step_definitions/themed_steps.rb",
"features/support/env.rb",
"features/theme_generator.feature",
"features/themed_generator.feature",
"images/avatar.png",
"images/icons/application_edit.png",
"images/icons/cross.png",
"images/icons/key.png",
"images/icons/tick.png",
"index.html",
"javascripts/jquery-1.3.min.js",
"javascripts/jquery.localscroll.js",
"javascripts/jquery.scrollTo.js",
"lib/generators/web_app_theme/theme/templates/layout_admin.html.erb",
"lib/generators/web_app_theme/theme/templates/layout_sign.html.erb",
"lib/generators/web_app_theme/theme/theme_generator.rb",
"lib/generators/web_app_theme/themed/templates/view_edit.html.erb",
"lib/generators/web_app_theme/themed/templates/view_form.html.erb",
"lib/generators/web_app_theme/themed/templates/view_new.html.erb",
"lib/generators/web_app_theme/themed/templates/view_show.html.erb",
"lib/generators/web_app_theme/themed/templates/view_sidebar.html.erb",
"lib/generators/web_app_theme/themed/templates/view_signin.html.erb",
"lib/generators/web_app_theme/themed/templates/view_signup.html.erb",
"lib/generators/web_app_theme/themed/templates/view_tables.html.erb",
"lib/generators/web_app_theme/themed/templates/view_text.html.erb",
"lib/generators/web_app_theme/themed/themed_generator.rb",
"lib/web_app_theme.rb",
"stylesheets/base.css",
"stylesheets/override.css",
"stylesheets/themes/activo/images/arrow.png",
"stylesheets/themes/activo/images/boxbar-background.png",
"stylesheets/themes/activo/images/button-background-active.png",
"stylesheets/themes/activo/images/button-background.png",
"stylesheets/themes/activo/images/menubar-background.png",
"stylesheets/themes/activo/style.css",
"stylesheets/themes/amro/style.css",
"stylesheets/themes/bec-green/style.css",
"stylesheets/themes/bec/style.css",
"stylesheets/themes/blue/style.css",
"stylesheets/themes/default/fonts/museo700-regular-webfont.eot",
"stylesheets/themes/default/fonts/museo700-regular-webfont.svg",
"stylesheets/themes/default/fonts/museo700-regular-webfont.ttf",
"stylesheets/themes/default/fonts/museo700-regular-webfont.woff",
"stylesheets/themes/default/fonts/museosans_500-webfont.eot",
"stylesheets/themes/default/fonts/museosans_500-webfont.svg",
"stylesheets/themes/default/fonts/museosans_500-webfont.ttf",
"stylesheets/themes/default/fonts/museosans_500-webfont.woff",
"stylesheets/themes/default/fonts/museosans_500_italic-webfont.eot",
"stylesheets/themes/default/fonts/museosans_500_italic-webfont.svg",
"stylesheets/themes/default/fonts/museosans_500_italic-webfont.ttf",
"stylesheets/themes/default/fonts/museosans_500_italic-webfont.woff",
"stylesheets/themes/default/images/arrow.png",
"stylesheets/themes/default/images/bgd.jpg",
"stylesheets/themes/default/images/boxbar-background.png",
"stylesheets/themes/default/images/button-background-active.png",
"stylesheets/themes/default/images/button-background.png",
"stylesheets/themes/default/images/messages/error.png",
"stylesheets/themes/default/images/messages/notice.png",
"stylesheets/themes/default/images/messages/warning.png",
"stylesheets/themes/default/style.css",
"stylesheets/themes/djime-cerulean/style.css",
"stylesheets/themes/drastic-dark/style.css",
"stylesheets/themes/kathleene/style.css",
"stylesheets/themes/olive/style.css",
"stylesheets/themes/orange/style.css",
"stylesheets/themes/red/style.css",
"stylesheets/themes/reidb-greenish/style.css",
"stylesheets/themes/warehouse/style.css",
"test/spec_helper.rb",
"test/themed_generator_spec.rb",
"web-app-theme.gemspec"
]
s.homepage = %q{http://github.com/pilu/web-app-theme}
s.require_paths = ["lib"]
s.rubygems_version = %q{1.5.0}
s.summary = %q{Web app theme generator}
s.test_files = [
"test/spec_helper.rb",
"test/themed_generator_spec.rb"
]
if s.respond_to? :specification_version then
s.specification_version = 3
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
else
end
else
end
end