flexi_generators 0.2.10 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +29 -0
- data/Rakefile +2 -16
- data/flexi_generators.gemspec +17 -114
- data/lib/flexi_generators.rb +11 -0
- data/lib/generators/flexi/config/config_generator.rb +25 -0
- data/lib/generators/flexi/config/templates/field_error.rb +9 -0
- data/lib/generators/flexi/config/templates/inflector_portuguese.rb +62 -0
- data/lib/generators/flexi/config/templates/pt-BR.yml +224 -0
- data/lib/generators/flexi/config/templates/will_paginate.rb +26 -0
- data/lib/generators/flexi/install/install_generator.rb +28 -0
- data/lib/generators/flexi/install/templates/application.css +15 -0
- data/lib/generators/flexi/install/templates/application.js +16 -0
- data/lib/generators/flexi/layout/layout_generator.rb +46 -0
- data/lib/generators/flexi/layout/templates/_flash.html.erb +4 -0
- data/lib/generators/flexi/layout/templates/_navbar.html.erb +6 -0
- data/lib/generators/flexi/layout/templates/_sidebar.html.erb +16 -0
- data/lib/generators/flexi/layout/templates/_user_dropdown.html.erb +11 -0
- data/lib/generators/flexi/layout/templates/application.css +16 -0
- data/lib/generators/flexi/layout/templates/dashboard.html.erb +49 -0
- data/lib/generators/flexi/layout/templates/error_messages_helper.rb +33 -0
- data/lib/generators/flexi/layout/templates/layout.css +8 -0
- data/lib/generators/flexi/layout/templates/layout.html.erb +76 -0
- data/lib/generators/flexi/layout/templates/layout_helper.rb +47 -0
- data/lib/generators/flexi/scaffold/scaffold_generator.rb +24 -109
- data/lib/generators/flexi/scaffold/templates/_form.html.erb +22 -0
- data/lib/generators/flexi/scaffold/templates/edit.html.erb +1 -0
- data/lib/generators/flexi/scaffold/templates/index.html.erb +36 -0
- data/lib/generators/flexi/scaffold/templates/new.html.erb +1 -0
- data/lib/generators/flexi/scaffold/templates/show.html.erb +21 -0
- data/lib/twitter-bootstrap/engine.rb +6 -0
- data/lib/twitter-bootstrap/railtie.rb +6 -0
- data/lib/twitter-bootstrap/version.rb +5 -0
- data/lib/version.rb +3 -0
- data/vendor/assets/images/glyphicons-halflings-white.png +0 -0
- data/vendor/assets/images/glyphicons-halflings.png +0 -0
- data/vendor/assets/javascripts/bootstrap.js +1825 -0
- data/vendor/assets/stylesheets/bootstrap-responsive.css +815 -0
- data/vendor/assets/stylesheets/bootstrap.css +4983 -0
- metadata +51 -89
- data/README.textile +0 -64
- data/VERSION +0 -1
- data/lib/generators/flexi.rb +0 -16
- data/lib/generators/flexi/auth/USAGE +0 -5
- data/lib/generators/flexi/auth/auth_generator.rb +0 -122
- data/lib/generators/flexi/auth/templates/authentication.rb +0 -55
- data/lib/generators/flexi/auth/templates/authlogic_session.rb +0 -2
- data/lib/generators/flexi/auth/templates/fixtures.yml +0 -24
- data/lib/generators/flexi/auth/templates/migration.rb +0 -16
- data/lib/generators/flexi/auth/templates/sessions_controller.rb +0 -26
- data/lib/generators/flexi/auth/templates/sessions_helper.rb +0 -2
- data/lib/generators/flexi/auth/templates/tests/testunit/sessions_controller.rb +0 -20
- data/lib/generators/flexi/auth/templates/tests/testunit/user.rb +0 -4
- data/lib/generators/flexi/auth/templates/tests/testunit/users_controller.rb +0 -23
- data/lib/generators/flexi/auth/templates/user.rb +0 -3
- data/lib/generators/flexi/auth/templates/users_controller.rb +0 -43
- data/lib/generators/flexi/auth/templates/users_helper.rb +0 -2
- data/lib/generators/flexi/auth/templates/views/erb/_error_messages.html.erb +0 -11
- data/lib/generators/flexi/auth/templates/views/erb/_menu.html.erb +0 -16
- data/lib/generators/flexi/auth/templates/views/erb/application.html.erb +0 -39
- data/lib/generators/flexi/auth/templates/views/erb/edit.html.erb +0 -24
- data/lib/generators/flexi/auth/templates/views/erb/index.html.erb +0 -27
- data/lib/generators/flexi/auth/templates/views/erb/login.html.erb +0 -22
- data/lib/generators/flexi/auth/templates/views/erb/new.html.erb +0 -24
- data/lib/generators/flexi/auth/templates/views/erb/show.html.erb +0 -16
- data/lib/generators/flexi/prepare/USAGE +0 -6
- data/lib/generators/flexi/prepare/prepare_generator.rb +0 -68
- data/lib/generators/flexi/prepare/templates/add.png +0 -0
- data/lib/generators/flexi/prepare/templates/admin_home_controller.rb +0 -6
- data/lib/generators/flexi/prepare/templates/admin_home_index.html.erb +0 -16
- data/lib/generators/flexi/prepare/templates/application.css +0 -279
- data/lib/generators/flexi/prepare/templates/application_helper.rb +0 -44
- data/lib/generators/flexi/prepare/templates/back.png +0 -0
- data/lib/generators/flexi/prepare/templates/bg.png +0 -0
- data/lib/generators/flexi/prepare/templates/bg2.png +0 -0
- data/lib/generators/flexi/prepare/templates/boxheader.gif +0 -0
- data/lib/generators/flexi/prepare/templates/btn-bg-hover.png +0 -0
- data/lib/generators/flexi/prepare/templates/btn-bg.png +0 -0
- data/lib/generators/flexi/prepare/templates/custom_field_error.rb +0 -12
- data/lib/generators/flexi/prepare/templates/delete.png +0 -0
- data/lib/generators/flexi/prepare/templates/edit.png +0 -0
- data/lib/generators/flexi/prepare/templates/inflector_portuguese.rb +0 -60
- data/lib/generators/flexi/prepare/templates/login.css +0 -142
- data/lib/generators/flexi/prepare/templates/login.html.erb +0 -26
- data/lib/generators/flexi/prepare/templates/logo.png +0 -0
- data/lib/generators/flexi/prepare/templates/menu.png +0 -0
- data/lib/generators/flexi/prepare/templates/messages/Thumbs.db +0 -0
- data/lib/generators/flexi/prepare/templates/messages/error.png +0 -0
- data/lib/generators/flexi/prepare/templates/messages/info.png +0 -0
- data/lib/generators/flexi/prepare/templates/messages/success.png +0 -0
- data/lib/generators/flexi/prepare/templates/messages/tip.png +0 -0
- data/lib/generators/flexi/prepare/templates/messages/warning.png +0 -0
- data/lib/generators/flexi/prepare/templates/pt-BR.yml +0 -206
- data/lib/generators/flexi/prepare/templates/routes.rb +0 -3
- data/lib/generators/flexi/prepare/templates/show.png +0 -0
- data/lib/generators/flexi/prepare/templates/site.css +0 -72
- data/lib/generators/flexi/prepare/templates/site.html.erb +0 -20
- data/lib/generators/flexi/prepare/templates/site_controller.rb +0 -9
- data/lib/generators/flexi/prepare/templates/site_helper.rb +0 -2
- data/lib/generators/flexi/prepare/templates/site_index.html.erb +0 -27
- data/lib/generators/flexi/prepare/templates/users.png +0 -0
- data/lib/generators/flexi/scaffold/USAGE +0 -5
- data/lib/generators/flexi/scaffold/templates/controller.rb +0 -43
- data/lib/generators/flexi/scaffold/templates/fixtures.yml +0 -9
- data/lib/generators/flexi/scaffold/templates/helper.rb +0 -2
- data/lib/generators/flexi/scaffold/templates/migration.rb +0 -14
- data/lib/generators/flexi/scaffold/templates/model.rb +0 -3
- data/lib/generators/flexi/scaffold/templates/tests/controller.rb +0 -50
- data/lib/generators/flexi/scaffold/templates/tests/helper.rb +0 -4
- data/lib/generators/flexi/scaffold/templates/tests/model.rb +0 -8
- data/lib/generators/flexi/scaffold/templates/views/erb/_error_messages.html.erb +0 -11
- data/lib/generators/flexi/scaffold/templates/views/erb/_form.html.erb +0 -13
- data/lib/generators/flexi/scaffold/templates/views/erb/edit.html.erb +0 -3
- data/lib/generators/flexi/scaffold/templates/views/erb/index.html.erb +0 -29
- data/lib/generators/flexi/scaffold/templates/views/erb/new.html.erb +0 -3
- data/lib/generators/flexi/scaffold/templates/views/erb/show.html.erb +0 -15
- data/template.rb +0 -15
@@ -1,14 +0,0 @@
|
|
1
|
-
class Create<%= plural_class_name %> < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
create_table :<%= plural_name %> do |t|
|
4
|
-
<%- for attribute in model_attributes -%>
|
5
|
-
t.<%= attribute.type %> :<%= attribute.name %>
|
6
|
-
<%- end -%>
|
7
|
-
t.timestamps
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.down
|
12
|
-
drop_table :<%= plural_name %>
|
13
|
-
end
|
14
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class <%= plural_class_name %>ControllerTest < ActionController::TestCase
|
4
|
-
setup do
|
5
|
-
@<%= singular_name %> = <%= plural_name %>(:one)
|
6
|
-
end
|
7
|
-
|
8
|
-
test "should get index" do
|
9
|
-
get :index
|
10
|
-
assert_response :success
|
11
|
-
assert_not_nil assigns(:<%= plural_name %>)
|
12
|
-
end
|
13
|
-
|
14
|
-
test "should get new" do
|
15
|
-
get :new
|
16
|
-
assert_response :success
|
17
|
-
end
|
18
|
-
|
19
|
-
test "should create <%= singular_name %>" do
|
20
|
-
assert_difference('<%= class_name %>.count') do
|
21
|
-
post :create, :<%= singular_name %> => @<%= singular_name %>.attributes
|
22
|
-
end
|
23
|
-
|
24
|
-
assert_redirected_to admin_<%= singular_name %>_path(assigns(:<%= singular_name %>))
|
25
|
-
end
|
26
|
-
|
27
|
-
test "should show <%= singular_name %>" do
|
28
|
-
get :show, :id => @<%= singular_name %>.to_param
|
29
|
-
assert_response :success
|
30
|
-
end
|
31
|
-
|
32
|
-
test "should get edit" do
|
33
|
-
get :edit, :id => @<%= singular_name %>.to_param
|
34
|
-
assert_response :success
|
35
|
-
end
|
36
|
-
|
37
|
-
test "should update post" do
|
38
|
-
put :update, :id => @<%= singular_name %>.to_param, :<%= singular_name %> => @<%= singular_name %>.attributes
|
39
|
-
assert_redirected_to admin_<%= singular_name %>_path(assigns(:<%= singular_name %>))
|
40
|
-
end
|
41
|
-
|
42
|
-
test "should destroy <%= singular_name %>" do
|
43
|
-
assert_difference('<%= class_name %>.count', -1) do
|
44
|
-
delete :destroy, :id => @<%= singular_name %>.to_param
|
45
|
-
end
|
46
|
-
|
47
|
-
assert_redirected_to admin_<%= plural_name %>_path
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
@@ -1,11 +0,0 @@
|
|
1
|
-
<%% if resource.errors.any? %>
|
2
|
-
<div class="flash_messages error_explanation">
|
3
|
-
<h2>Não foi possível gravar: <%%= pluralize(resource.errors.count, "erro") %></h2>
|
4
|
-
|
5
|
-
<ul>
|
6
|
-
<%% resource.errors.full_messages.each do |msg| %>
|
7
|
-
<li><%%= msg %></li>
|
8
|
-
<%% end %>
|
9
|
-
</ul>
|
10
|
-
</div>
|
11
|
-
<%% end %>
|
@@ -1,13 +0,0 @@
|
|
1
|
-
<%%= form_for([:admin, @<%= singular_name %>]) do |f| %>
|
2
|
-
<%%= render "shared/error_messages", :resource => @<%= singular_name %> %>
|
3
|
-
|
4
|
-
<%- for attribute in model_attributes -%>
|
5
|
-
<div class="field">
|
6
|
-
<%%= f.label :<%= attribute.name %> %><br />
|
7
|
-
<%%= f.<%= attribute.field_type %> :<%= attribute.name %> %>
|
8
|
-
</div>
|
9
|
-
<%- end -%>
|
10
|
-
<div id="control_box">
|
11
|
-
<%%= f.submit "Salvar", :class => "button medium blue" %> | <%%= link_to("Cancelar", admin_<%= plural_name %>_path, :class => "button medium red") %>
|
12
|
-
</div>
|
13
|
-
<%% end %>
|
@@ -1,29 +0,0 @@
|
|
1
|
-
<%% title("<%= plural_name.titleize %>") %>
|
2
|
-
|
3
|
-
<div id="new_box">
|
4
|
-
<%%= link_to 'Adicionar', new_admin_<%= singular_name %>_path, :class => 'button medium green' %>
|
5
|
-
</div>
|
6
|
-
|
7
|
-
<table cellspacing="0" cellpadding="2">
|
8
|
-
<tr>
|
9
|
-
<%- for attribute in model_attributes -%>
|
10
|
-
<th><%= attribute.human_name.titleize %></th>
|
11
|
-
<%- end -%>
|
12
|
-
<th></th>
|
13
|
-
</tr>
|
14
|
-
<%% @<%= plural_name %>.each do |<%= singular_name %>| %>
|
15
|
-
<tr>
|
16
|
-
<%- for attribute in model_attributes -%>
|
17
|
-
<td><%%= <%= singular_name %>.<%= attribute.name %> %></td>
|
18
|
-
<%- end -%>
|
19
|
-
<td width="11%">
|
20
|
-
<ul class="actions">
|
21
|
-
<li><%%= link_to( image_tag("show.png"), [:admin, <%= singular_name %>], :title => "Mostrar" ) %></li>
|
22
|
-
<li><%%= link_to( image_tag("edit.png"), edit_admin_<%= singular_name %>_path(<%= singular_name %>), :title => "Editar" ) %></li>
|
23
|
-
<li><%%= link_to( image_tag("delete.png"), [:admin, <%= singular_name %>], :confirm => 'Tem certeza que deseja excluir?', :method => :delete, :title => "Excluir" ) %></li>
|
24
|
-
</ul>
|
25
|
-
</td>
|
26
|
-
</tr>
|
27
|
-
<%% end %>
|
28
|
-
</table>
|
29
|
-
<%%= will_paginate @<%= plural_name %>, :previous_label=>'« Anterior', :next_label=>'Próximo »' %>
|
@@ -1,15 +0,0 @@
|
|
1
|
-
<%% title "<%= singular_name.titleize %>" %>
|
2
|
-
|
3
|
-
<%- for attribute in model_attributes -%>
|
4
|
-
<p>
|
5
|
-
<b><%= attribute.human_name.titleize %>:</b>
|
6
|
-
<%%= @<%= singular_name %>.<%= attribute.name %> %>
|
7
|
-
</p>
|
8
|
-
<%- end -%>
|
9
|
-
|
10
|
-
<div id="control_box">
|
11
|
-
<%%= link_to( image_tag("back.png"), admin_<%= plural_name %>_path, :title => "Voltar" ) %> |
|
12
|
-
<%%= link_to( image_tag("edit.png"), edit_admin_<%= singular_name %>_path(@<%= singular_name %>), :title => "Editar" ) %> |
|
13
|
-
<%%= link_to( image_tag("delete.png"), [:admin, @<%= singular_name %>], :confirm => 'Tem certeza que deseja excluir?', :method => :delete, :title => "Exlcuir" ) %>
|
14
|
-
</div>
|
15
|
-
|
data/template.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
# Check prerequisites
|
2
|
-
%w{bundler flexi_generators}.each do |component|
|
3
|
-
unless Gem.available?(component)
|
4
|
-
run "gem install #{component}"
|
5
|
-
Gem.refresh
|
6
|
-
Gem.activate(component)
|
7
|
-
end
|
8
|
-
end
|
9
|
-
# Add flexi_generators to Gemfile
|
10
|
-
gem "flexi_generators", "0.2.10"
|
11
|
-
# Flexi Genertors
|
12
|
-
generate 'flexi:prepare'
|
13
|
-
generate 'flexi:auth'
|
14
|
-
# Bundle
|
15
|
-
run "bundle install"
|