fetty-generators 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -0
- data/LICENSE +20 -0
- data/README.rdoc +69 -0
- data/Rakefile +3 -0
- data/lib/generators/fetty/layout/USAGE +26 -0
- data/lib/generators/fetty/layout/layout_generator.rb +44 -0
- data/lib/generators/fetty/layout/templates/application.js +55 -0
- data/lib/generators/fetty/layout/templates/error_messages_helper.rb +23 -0
- data/lib/generators/fetty/layout/templates/layout.html.erb +32 -0
- data/lib/generators/fetty/layout/templates/layout.html.haml +34 -0
- data/lib/generators/fetty/layout/templates/layout_helper.rb +22 -0
- data/lib/generators/fetty/layout/templates/no-devise-links-layout.html.erb +23 -0
- data/lib/generators/fetty/layout/templates/no-devise-links-layout.html.haml +23 -0
- data/lib/generators/fetty/layout/templates/stylesheet.css +166 -0
- data/lib/generators/fetty/layout/templates/stylesheet.sass +163 -0
- data/lib/generators/fetty/scaffold/USAGE +53 -0
- data/lib/generators/fetty/scaffold/scaffold_generator.rb +370 -0
- data/lib/generators/fetty/scaffold/templates/actions/create.rb +8 -0
- data/lib/generators/fetty/scaffold/templates/actions/destroy.rb +5 -0
- data/lib/generators/fetty/scaffold/templates/actions/edit.rb +3 -0
- data/lib/generators/fetty/scaffold/templates/actions/index.rb +10 -0
- data/lib/generators/fetty/scaffold/templates/actions/new.rb +3 -0
- data/lib/generators/fetty/scaffold/templates/actions/show.rb +3 -0
- data/lib/generators/fetty/scaffold/templates/actions/update.rb +8 -0
- data/lib/generators/fetty/scaffold/templates/controller.rb +7 -0
- data/lib/generators/fetty/scaffold/templates/fixtures.yml +9 -0
- data/lib/generators/fetty/scaffold/templates/helper.rb +2 -0
- data/lib/generators/fetty/scaffold/templates/migration.rb +16 -0
- data/lib/generators/fetty/scaffold/templates/model.rb +7 -0
- data/lib/generators/fetty/scaffold/templates/tests/rspec/actions/create.rb +11 -0
- data/lib/generators/fetty/scaffold/templates/tests/rspec/actions/destroy.rb +6 -0
- data/lib/generators/fetty/scaffold/templates/tests/rspec/actions/edit.rb +4 -0
- data/lib/generators/fetty/scaffold/templates/tests/rspec/actions/index.rb +4 -0
- data/lib/generators/fetty/scaffold/templates/tests/rspec/actions/new.rb +4 -0
- data/lib/generators/fetty/scaffold/templates/tests/rspec/actions/show.rb +4 -0
- data/lib/generators/fetty/scaffold/templates/tests/rspec/actions/update.rb +11 -0
- data/lib/generators/fetty/scaffold/templates/tests/rspec/controller.rb +8 -0
- data/lib/generators/fetty/scaffold/templates/tests/rspec/model.rb +7 -0
- data/lib/generators/fetty/scaffold/templates/tests/shoulda/actions/create.rb +13 -0
- data/lib/generators/fetty/scaffold/templates/tests/shoulda/actions/destroy.rb +8 -0
- data/lib/generators/fetty/scaffold/templates/tests/shoulda/actions/edit.rb +6 -0
- data/lib/generators/fetty/scaffold/templates/tests/shoulda/actions/index.rb +6 -0
- data/lib/generators/fetty/scaffold/templates/tests/shoulda/actions/new.rb +6 -0
- data/lib/generators/fetty/scaffold/templates/tests/shoulda/actions/show.rb +6 -0
- data/lib/generators/fetty/scaffold/templates/tests/shoulda/actions/update.rb +13 -0
- data/lib/generators/fetty/scaffold/templates/tests/shoulda/controller.rb +5 -0
- data/lib/generators/fetty/scaffold/templates/tests/shoulda/model.rb +7 -0
- data/lib/generators/fetty/scaffold/templates/tests/testunit/actions/create.rb +11 -0
- data/lib/generators/fetty/scaffold/templates/tests/testunit/actions/destroy.rb +6 -0
- data/lib/generators/fetty/scaffold/templates/tests/testunit/actions/edit.rb +4 -0
- data/lib/generators/fetty/scaffold/templates/tests/testunit/actions/index.rb +4 -0
- data/lib/generators/fetty/scaffold/templates/tests/testunit/actions/new.rb +4 -0
- data/lib/generators/fetty/scaffold/templates/tests/testunit/actions/show.rb +4 -0
- data/lib/generators/fetty/scaffold/templates/tests/testunit/actions/update.rb +11 -0
- data/lib/generators/fetty/scaffold/templates/tests/testunit/controller.rb +5 -0
- data/lib/generators/fetty/scaffold/templates/tests/testunit/model.rb +7 -0
- data/lib/generators/fetty/scaffold/templates/views/erb/_form.html.erb +22 -0
- data/lib/generators/fetty/scaffold/templates/views/erb/_table.html.erb +50 -0
- data/lib/generators/fetty/scaffold/templates/views/erb/edit.html.erb +12 -0
- data/lib/generators/fetty/scaffold/templates/views/erb/index.html.erb +13 -0
- data/lib/generators/fetty/scaffold/templates/views/erb/index.js.erb +1 -0
- data/lib/generators/fetty/scaffold/templates/views/erb/new.html.erb +9 -0
- data/lib/generators/fetty/scaffold/templates/views/erb/show.html.erb +26 -0
- data/lib/generators/fetty/scaffold/templates/views/haml/_form.html.haml +8 -0
- data/lib/generators/fetty/scaffold/templates/views/haml/_table.html.haml +33 -0
- data/lib/generators/fetty/scaffold/templates/views/haml/edit.html.haml +14 -0
- data/lib/generators/fetty/scaffold/templates/views/haml/index.html.haml +12 -0
- data/lib/generators/fetty/scaffold/templates/views/haml/index.js.haml +1 -0
- data/lib/generators/fetty/scaffold/templates/views/haml/new.html.haml +8 -0
- data/lib/generators/fetty/scaffold/templates/views/haml/show.html.haml +23 -0
- data/lib/generators/fetty/setup/USAGE +22 -0
- data/lib/generators/fetty/setup/setup_generator.rb +80 -0
- data/lib/generators/fetty/setup/templates/ability.rb +29 -0
- data/lib/generators/fetty.rb +38 -0
- metadata +137 -0
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 Fajri Fachriansyah
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
= Fetty Generators
|
2
|
+
|
3
|
+
If you are a fan of railscast.com by Ryan Bates, you could found so many useful plugins / gems that ryan covers to us how to use it,
|
4
|
+
and if you familiar with nifty_scaffold by ryanb, or always working with it alongside Devise + CanCan for authetication and authorization,
|
5
|
+
you may try to use this generators to build your basic Rails application quickly up-and-running.
|
6
|
+
This generators are inherited from nifty-generators, but change a little-bit in the result of scaffolding.
|
7
|
+
|
8
|
+
fetty (as i choose the name as a brother of nifty) have a little extra features like :
|
9
|
+
- using simple_form as a default generated form.
|
10
|
+
- add some extra AJAX features to search and sorting using meta_search, and pagination in your index page.
|
11
|
+
- using Devise(josevalim) for authentication and CanCan(ryanb) for authorizations [optional].
|
12
|
+
- giving the default checking abilities like ( can? :read ) in your views for authorizations.
|
13
|
+
- closable flash message.
|
14
|
+
- alow you pass custom field:type such as paperclip / tinymce in scaffolding.
|
15
|
+
|
16
|
+
it also provides for ERB and HAML template. Ups sorry this generators only works for Rails 3
|
17
|
+
|
18
|
+
== Setup
|
19
|
+
|
20
|
+
=== Rails 3
|
21
|
+
|
22
|
+
require gems to be install first.
|
23
|
+
|
24
|
+
gem install meta_where meta_search simple_form will_paginate jquery-rails devise cancan paperclip tinymce
|
25
|
+
|
26
|
+
And add the gem to your Gemfile.
|
27
|
+
|
28
|
+
gem "fetty-generators", :group => :development
|
29
|
+
|
30
|
+
generate the setup first before you can generate layout / scaffolding
|
31
|
+
|
32
|
+
rails generate fetty:setup
|
33
|
+
|
34
|
+
Then you can run layout generator to generate your application layout.
|
35
|
+
|
36
|
+
rails generate fetty:layout
|
37
|
+
|
38
|
+
And then you just simply type the command "fetty:scaffold" for scaffolding
|
39
|
+
|
40
|
+
rails g fetty:scaffold Post title:string content:text
|
41
|
+
|
42
|
+
after that simply run the migration "rake db:migrate" and start your server "rails s"
|
43
|
+
|
44
|
+
== Additional field type
|
45
|
+
|
46
|
+
You could also passing custom field type in your arguments, 'for example you want to use paperclip for handle your attachment
|
47
|
+
and you also want to use tinymce for editor in your textarea'
|
48
|
+
|
49
|
+
rails g fetty:scaffold Post title:string content:tinymce photo:paperclip
|
50
|
+
|
51
|
+
this will generate the required column names for paperclip into your migration file and also configured the model, controller and views.
|
52
|
+
|
53
|
+
== Included Generators
|
54
|
+
|
55
|
+
* fetty:layout: generates generic layout, stylesheet, and helper files.
|
56
|
+
* fetty:scaffold: generates a controller and optional model/migration.
|
57
|
+
* fetty:setup: configure your gems needed by fetty-generators.
|
58
|
+
|
59
|
+
To view the README for each generator, run it with the +help+ option.
|
60
|
+
|
61
|
+
rails g fetty:layout --help
|
62
|
+
|
63
|
+
|
64
|
+
== Found a bug?
|
65
|
+
|
66
|
+
This is stil under development mode, if you are regularly work with ERB template, this generators will works fine,
|
67
|
+
But if you are having some problem with Fetty Generators, please submit an issue here.
|
68
|
+
|
69
|
+
http://github.com/fajrif/fetty-generators/issues
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
Description:
|
2
|
+
The fetty_layout generator creates a basic layout, stylesheet and
|
3
|
+
helper which will give some structure to a starting Rails app.
|
4
|
+
|
5
|
+
The generator takes one argument which will be the name of the
|
6
|
+
layout and stylesheet files. If no argument is passed then it defaults
|
7
|
+
to "application".
|
8
|
+
|
9
|
+
The helper module includes some methods which can be called in any
|
10
|
+
template or partial to set variables to be used in the layout, such as
|
11
|
+
page title, javascript/stylesheet and also includes Devise SignIn and SignUp
|
12
|
+
link buttons.
|
13
|
+
|
14
|
+
Examples:
|
15
|
+
rails generate fetty:layout
|
16
|
+
|
17
|
+
Layout: app/views/layouts/application.html.erb
|
18
|
+
Stylesheet: public/stylesheets/application.css
|
19
|
+
Helper: app/helpers/layout_helper.rb
|
20
|
+
|
21
|
+
|
22
|
+
rails generate fetty:layout --haml
|
23
|
+
|
24
|
+
Layout: app/views/layouts/application.html.haml
|
25
|
+
Stylesheet: public/stylesheets/sass/application.sass
|
26
|
+
Helper: app/helpers/layout_helper.rb
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'generators/fetty'
|
2
|
+
|
3
|
+
module Fetty
|
4
|
+
module Generators
|
5
|
+
class LayoutGenerator < Base
|
6
|
+
argument :layout_name, :type => :string, :default => 'application', :banner => 'layout_name'
|
7
|
+
|
8
|
+
class_option :haml, :desc => 'Generate HAML for view, and SASS for stylesheet.', :type => :boolean
|
9
|
+
class_option :with_devise_links, :desc => 'Generate Devise links in your application layout.', :type => :boolean, :default => true
|
10
|
+
|
11
|
+
def create_layout
|
12
|
+
%w( "app/views/layouts/application.html.erb" "app/views/layouts/#{file_name}.html.haml" "app/views/layouts/#{file_name}.html.erb" ).each do |path|
|
13
|
+
FileUtils.rm path if file_exists?(path)
|
14
|
+
end
|
15
|
+
|
16
|
+
if options.haml?
|
17
|
+
if options.with_devise_links?
|
18
|
+
template 'layout.html.haml', "app/views/layouts/#{file_name}.html.haml"
|
19
|
+
else
|
20
|
+
template 'no-devise-links-layout.html.haml', "app/views/layouts/#{file_name}.html.haml"
|
21
|
+
end
|
22
|
+
copy_file 'stylesheet.sass', "public/stylesheets/sass/#{file_name}.sass"
|
23
|
+
else
|
24
|
+
if options.with_devise_links?
|
25
|
+
template 'layout.html.erb', "app/views/layouts/#{file_name}.html.erb"
|
26
|
+
else
|
27
|
+
template 'no-devise-links-layout.html.erb', "app/views/layouts/#{file_name}.html.erb"
|
28
|
+
end
|
29
|
+
copy_file 'stylesheet.css', "public/stylesheets/#{file_name}.css"
|
30
|
+
end
|
31
|
+
copy_file 'layout_helper.rb', 'app/helpers/layout_helper.rb'
|
32
|
+
copy_file 'error_messages_helper.rb', 'app/helpers/error_messages_helper.rb'
|
33
|
+
copy_file 'application.js', 'public/javascripts/application.js'
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def file_name
|
39
|
+
layout_name.underscore
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
// Place your application-specific JavaScript functions and classes here
|
2
|
+
// This file is automatically included by javascript_include_tag :defaults
|
3
|
+
|
4
|
+
// jQuery Input Hints plugin
|
5
|
+
jQuery.fn.inputHints=function() {
|
6
|
+
// show the display text
|
7
|
+
$(this).each(function(i) {
|
8
|
+
$(this).val($(this).attr('title'))
|
9
|
+
.addClass('hint');
|
10
|
+
});
|
11
|
+
|
12
|
+
// hook up the blur & focus
|
13
|
+
return $(this).focus(function() {
|
14
|
+
if ($(this).val() == $(this).attr('title'))
|
15
|
+
$(this).val('')
|
16
|
+
.removeClass('hint');
|
17
|
+
}).blur(function() {
|
18
|
+
if ($(this).val() == '')
|
19
|
+
$(this).val($(this).attr('title'))
|
20
|
+
.addClass('hint');
|
21
|
+
});
|
22
|
+
};
|
23
|
+
|
24
|
+
$(function() {
|
25
|
+
|
26
|
+
// add hints on input text search
|
27
|
+
$('input[title]').inputHints();
|
28
|
+
// closable link for message
|
29
|
+
$('.closelink').click(function() {
|
30
|
+
$('div.flash').fadeOut(500, function() {
|
31
|
+
$('div.flash').hide();
|
32
|
+
});
|
33
|
+
});
|
34
|
+
|
35
|
+
|
36
|
+
if (history && history.pushState) {
|
37
|
+
// handle index sort and pagination using ajax
|
38
|
+
$("#index_table th a, #index_table .pagination a").live("click", function(e) {
|
39
|
+
$.getScript(this.href);
|
40
|
+
history.pushState(null, document.title, this.href);
|
41
|
+
e.preventDefault();
|
42
|
+
});
|
43
|
+
// handle index input search keyup using ajax
|
44
|
+
$("#index_search input").keyup(function(e) {
|
45
|
+
$.get($("#index_search").attr("action"), $("#index_search").serialize(), null, "script");
|
46
|
+
history.replaceState(null, document.title, $("#index_search").attr("action") + "?" + $("#index_search").serialize());
|
47
|
+
e.preventDefault();
|
48
|
+
});
|
49
|
+
//bind window for postate
|
50
|
+
$(window).bind("popstate", function() {
|
51
|
+
$.getScript(location.href);
|
52
|
+
});
|
53
|
+
}
|
54
|
+
|
55
|
+
});
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module ErrorMessagesHelper
|
2
|
+
# Render error messages for the given objects. The :message and :header_message options are allowed.
|
3
|
+
def error_messages_for(*objects)
|
4
|
+
options = objects.extract_options!
|
5
|
+
options[:header_message] ||= I18n.t(:"activerecord.errors.header", :default => "Invalid Fields")
|
6
|
+
options[:message] ||= I18n.t(:"activerecord.errors.message", :default => "Correct the following errors and try again.")
|
7
|
+
messages = objects.compact.map { |o| o.errors.full_messages }.flatten
|
8
|
+
unless messages.empty?
|
9
|
+
content_tag(:div, :class => "error_messages") do
|
10
|
+
list_items = messages.map { |msg| content_tag(:li, msg) }
|
11
|
+
content_tag(:h2, options[:header_message]) + content_tag(:p, options[:message]) + content_tag(:ul, list_items.join.html_safe)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
module FormBuilderAdditions
|
17
|
+
def error_messages(options = {})
|
18
|
+
@template.error_messages_for(@object, options)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
ActionView::Helpers::FormBuilder.send(:include, ErrorMessagesHelper::FormBuilderAdditions)
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title><%%= content_for?(:title) ? yield(:title) : "Untitled" %></title>
|
5
|
+
<%%= stylesheet_link_tag "<%= file_name %>" %>
|
6
|
+
<%%= javascript_include_tag :defaults %>
|
7
|
+
<%%= csrf_meta_tag %>
|
8
|
+
<%%= yield(:head) %>
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
<div id="container">
|
12
|
+
<%% flash.each do |name, msg| %>
|
13
|
+
<%%= content_tag(:div, :id => "flash_#{name}", :class => "flash closable") do %>
|
14
|
+
<%%=h msg %>
|
15
|
+
<%%= content_tag(:span, "[close]", :title => "close", :class => "closelink") %>
|
16
|
+
<%% end %>
|
17
|
+
<%% end %>
|
18
|
+
|
19
|
+
<div id="loginbox">
|
20
|
+
<%% if user_signed_in? %>
|
21
|
+
Signed in as <%%= current_user.email %> Not You?
|
22
|
+
<%%= link_to "Sign out", destroy_user_session_path %>
|
23
|
+
<%% else %>
|
24
|
+
<%%= link_to "Sign up", new_user_registration_path %> or <%%= link_to "sign in", new_user_session_path %>
|
25
|
+
<%% end %>
|
26
|
+
</div>
|
27
|
+
|
28
|
+
<%%= content_tag :h1, yield(:title) if show_title? %>
|
29
|
+
<%%= yield %>
|
30
|
+
</div>
|
31
|
+
</body>
|
32
|
+
</html>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
!!!
|
2
|
+
%html
|
3
|
+
|
4
|
+
%head
|
5
|
+
%title
|
6
|
+
= yield(:title) || "Untitled"
|
7
|
+
%meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/
|
8
|
+
= stylesheet_link_tag "application"
|
9
|
+
= javascript_include_tag :defaults
|
10
|
+
= csrf_meta_tag
|
11
|
+
= yield(:head)
|
12
|
+
|
13
|
+
%body
|
14
|
+
#container
|
15
|
+
- flash.each do |name, msg|
|
16
|
+
%div{:id => "flash_#{name}", :class => "flash closable"}
|
17
|
+
=h msg
|
18
|
+
= content_tag :span, "[close]", :title => "close", :class => "closelink"
|
19
|
+
|
20
|
+
#loginbox
|
21
|
+
- if user_signed_in?
|
22
|
+
Signed in as
|
23
|
+
= current_user.email
|
24
|
+
Not You?
|
25
|
+
= link_to "Sign out", destroy_user_session_path
|
26
|
+
- else
|
27
|
+
= link_to "Sign up", new_user_registration_path
|
28
|
+
or
|
29
|
+
= link_to "sign in", new_user_session_path
|
30
|
+
|
31
|
+
- if show_title?
|
32
|
+
%h1= yield(:title)
|
33
|
+
|
34
|
+
= yield
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# These helper methods can be called in your template to set variables to be used in the layout
|
2
|
+
# This module should be included in all views globally,
|
3
|
+
# to do so you may need to add this line to your ApplicationController
|
4
|
+
# helper :layout
|
5
|
+
module LayoutHelper
|
6
|
+
def title(page_title, show_title = true)
|
7
|
+
content_for(:title) { h(page_title.to_s) }
|
8
|
+
@show_title = show_title
|
9
|
+
end
|
10
|
+
|
11
|
+
def show_title?
|
12
|
+
@show_title
|
13
|
+
end
|
14
|
+
|
15
|
+
def stylesheet(*args)
|
16
|
+
content_for(:head) { stylesheet_link_tag(*args) }
|
17
|
+
end
|
18
|
+
|
19
|
+
def javascript(*args)
|
20
|
+
content_for(:head) { javascript_include_tag(*args) }
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title><%%= content_for?(:title) ? yield(:title) : "Untitled" %></title>
|
5
|
+
<%%= stylesheet_link_tag "<%= file_name %>" %>
|
6
|
+
<%%= javascript_include_tag :defaults %>
|
7
|
+
<%%= csrf_meta_tag %>
|
8
|
+
<%%= yield(:head) %>
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
<div id="container">
|
12
|
+
<%% flash.each do |name, msg| %>
|
13
|
+
<%%= content_tag(:div, :id => "flash_#{name}", :class => "flash closable") do %>
|
14
|
+
<%%=h msg %>
|
15
|
+
<%%= content_tag(:span, "[close]", :title => "close", :class => "closelink") %>
|
16
|
+
<%% end %>
|
17
|
+
<%% end %>
|
18
|
+
|
19
|
+
<%%= content_tag :h1, yield(:title) if show_title? %>
|
20
|
+
<%%= yield %>
|
21
|
+
</div>
|
22
|
+
</body>
|
23
|
+
</html>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
!!!
|
2
|
+
%html
|
3
|
+
|
4
|
+
%head
|
5
|
+
%title
|
6
|
+
= yield(:title) || "Untitled"
|
7
|
+
%meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/
|
8
|
+
= stylesheet_link_tag "application"
|
9
|
+
= javascript_include_tag :defaults
|
10
|
+
= csrf_meta_tag
|
11
|
+
= yield(:head)
|
12
|
+
|
13
|
+
%body
|
14
|
+
#container
|
15
|
+
- flash.each do |name, msg|
|
16
|
+
%div{:id => "flash_#{name}", :class => "flash closable"}
|
17
|
+
=h msg
|
18
|
+
= content_tag :span, "[close]", :title => "close", :class => "closelink"
|
19
|
+
|
20
|
+
- if show_title?
|
21
|
+
%h1= yield(:title)
|
22
|
+
|
23
|
+
= yield
|
@@ -0,0 +1,166 @@
|
|
1
|
+
body {
|
2
|
+
background-color: #D0D0D0;
|
3
|
+
font-family: Verdana, Helvetica, Arial;
|
4
|
+
font-size: 14px;
|
5
|
+
}
|
6
|
+
|
7
|
+
a img {
|
8
|
+
border: none;
|
9
|
+
}
|
10
|
+
|
11
|
+
a {
|
12
|
+
color: #0000FF;
|
13
|
+
}
|
14
|
+
|
15
|
+
input.hint {
|
16
|
+
color: #999;
|
17
|
+
font-style :italic;
|
18
|
+
}
|
19
|
+
|
20
|
+
.clear {
|
21
|
+
clear: both;
|
22
|
+
height: 0;
|
23
|
+
overflow: hidden;
|
24
|
+
}
|
25
|
+
|
26
|
+
#container {
|
27
|
+
width: 75%;
|
28
|
+
margin: 0 auto;
|
29
|
+
background-color: #FFF;
|
30
|
+
padding: 20px 40px;
|
31
|
+
border: solid 1px black;
|
32
|
+
margin-top: 20px;
|
33
|
+
}
|
34
|
+
|
35
|
+
#loginbox {
|
36
|
+
float: right;
|
37
|
+
}
|
38
|
+
|
39
|
+
#flash_notice {
|
40
|
+
background-color: #CCEECC;
|
41
|
+
color: #006600;
|
42
|
+
text-shadow: 1px 1px 1px #FFFFFF;
|
43
|
+
}
|
44
|
+
|
45
|
+
#flash_error {
|
46
|
+
background-color: #FFFFD7;
|
47
|
+
color: #555555;
|
48
|
+
text-shadow: 1px 1px 1px #FFFFFF;
|
49
|
+
}
|
50
|
+
|
51
|
+
#flash_alert {
|
52
|
+
background-color: #F7E1DF;
|
53
|
+
color: #B81010;
|
54
|
+
text-shadow: 1px 1px 1px #FCF4F3;
|
55
|
+
}
|
56
|
+
|
57
|
+
.flash {
|
58
|
+
border: 1px solid #D5D5D5;
|
59
|
+
color: #555555;
|
60
|
+
font-size: 13px;
|
61
|
+
font-weight: bold;
|
62
|
+
margin: 10px 0;
|
63
|
+
padding: 10px;
|
64
|
+
}
|
65
|
+
|
66
|
+
.closable {
|
67
|
+
position: relative;
|
68
|
+
}
|
69
|
+
.closable .closelink {
|
70
|
+
cursor: pointer;
|
71
|
+
height: 16px;
|
72
|
+
margin-top: -4px;
|
73
|
+
opacity: 0.3;
|
74
|
+
position: absolute;
|
75
|
+
right: 8px;
|
76
|
+
top: 15px;
|
77
|
+
}
|
78
|
+
.closelink:hover {
|
79
|
+
opacity: 1;
|
80
|
+
}
|
81
|
+
|
82
|
+
|
83
|
+
.fieldWithErrors {
|
84
|
+
display: inline;
|
85
|
+
}
|
86
|
+
|
87
|
+
.error_messages {
|
88
|
+
width: 400px;
|
89
|
+
border: 2px solid #CF0000;
|
90
|
+
padding: 0px;
|
91
|
+
padding-bottom: 12px;
|
92
|
+
margin-bottom: 20px;
|
93
|
+
background-color: #f0f0f0;
|
94
|
+
font-size: 12px;
|
95
|
+
}
|
96
|
+
|
97
|
+
.error_messages h2 {
|
98
|
+
text-align: left;
|
99
|
+
font-weight: bold;
|
100
|
+
padding: 5px 10px;
|
101
|
+
font-size: 12px;
|
102
|
+
margin: 0;
|
103
|
+
background-color: #c00;
|
104
|
+
color: #fff;
|
105
|
+
}
|
106
|
+
|
107
|
+
.error_messages p {
|
108
|
+
margin: 8px 10px;
|
109
|
+
}
|
110
|
+
|
111
|
+
.error_messages ul {
|
112
|
+
margin: 0;
|
113
|
+
}
|
114
|
+
|
115
|
+
/* pretty-table */
|
116
|
+
table.pretty {
|
117
|
+
border-collapse: collapse;
|
118
|
+
}
|
119
|
+
|
120
|
+
.pretty td, .pretty th {
|
121
|
+
padding: 4px 10px;
|
122
|
+
border: solid 1px #AAA;
|
123
|
+
}
|
124
|
+
|
125
|
+
/* simple-form */
|
126
|
+
.simple_form label {
|
127
|
+
float: left;
|
128
|
+
width: 100px;
|
129
|
+
text-align: right;
|
130
|
+
margin: 2px 10px;
|
131
|
+
}
|
132
|
+
|
133
|
+
.simple_form div.input {
|
134
|
+
margin-bottom: 10px;
|
135
|
+
}
|
136
|
+
|
137
|
+
.simple_form div.boolean, .simple_form input[type='submit'] {
|
138
|
+
margin-left: 120px;
|
139
|
+
}
|
140
|
+
|
141
|
+
.simple_form div.boolean label, .simple_form label.collection_radio {
|
142
|
+
float: none;
|
143
|
+
margin: 0;
|
144
|
+
}
|
145
|
+
|
146
|
+
.simple_form label.collection_radio {
|
147
|
+
margin-right: 10px;
|
148
|
+
margin-left: 2px;
|
149
|
+
}
|
150
|
+
|
151
|
+
.simple_form .error {
|
152
|
+
clear: left;
|
153
|
+
margin-left: 120px;
|
154
|
+
font-size: 12px;
|
155
|
+
color: #D00;
|
156
|
+
display: block;
|
157
|
+
}
|
158
|
+
|
159
|
+
.simple_form .hint {
|
160
|
+
clear: left;
|
161
|
+
margin-left: 120px;
|
162
|
+
font-size: 12px;
|
163
|
+
color: #555;
|
164
|
+
display: block;
|
165
|
+
font-style: italic;
|
166
|
+
}
|