foldscaf 0.0.8 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +8 -0
- data/README.md +2 -1
- data/lib/generators/fold/fold_generator.rb +1 -1
- data/lib/generators/fold/templates/admin_controller.erb +4 -2
- data/lib/generators/fold/templates/views/_form.erb +1 -1
- data/lib/generators/fold/templates/views/edit.erb +7 -6
- data/lib/generators/fold/templates/views/index.erb +12 -7
- data/lib/generators/fold/templates/views/new.erb +11 -5
- data/lib/version.rb +1 -1
- metadata +2 -6
- data/lib/generators/fold/templates/views/_mini_form.erb +0 -4
- data/lib/generators/mini_form/USAGE +0 -8
- data/lib/generators/mini_form/mini_form_generator.rb +0 -11
- data/lib/generators/mini_form/templates/mini_form.rb +0 -25
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## v1.0.0
|
2
|
+
* Eliminación de mini_form generator
|
3
|
+
* Eliminación de vista _mini_form.erb
|
4
|
+
* Index ahora tiene buscador y paginación
|
5
|
+
* Controller ahora usa Ordenable en lugar de Sortable
|
6
|
+
* Controller adaptado a buscador
|
7
|
+
* Botones importantes ahora a la derecha del titulo
|
8
|
+
|
1
9
|
## v0.0.7
|
2
10
|
* Mejorado boton para Ordenar
|
3
11
|
* Id de tablas ahora corresponde al tableize de la clase del elemento, en lugar de a :listado (esto permite trabajar con multiples tablas).
|
data/README.md
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
|
3
3
|
Incluye varios generadores adaptados a las necesidades de Xaver.
|
4
4
|
Debe usarse en conjunto con el template de Xaver.
|
5
|
-
|
5
|
+
Versión 1.0.0 Presenta incompatibilidades con versiones pasadas y con XaverTemplates <= 1.0.0
|
6
|
+
Con recaudos, puede usarse en versiones anteriores de XaverTemplate,
|
6
7
|
|
7
8
|
## Instalación
|
8
9
|
|
@@ -43,7 +43,7 @@ class FoldGenerator < Rails::Generators::Base
|
|
43
43
|
template 'controller.erb', "app/controllers/#{@plural}_controller.rb"
|
44
44
|
template 'admin_controller.erb', "app/controllers/admin/#{@plural}_controller.rb"
|
45
45
|
|
46
|
-
%w[_form
|
46
|
+
%w[_form edit index new].each do |action|
|
47
47
|
template "views/#{action}.erb", "app/views/admin/#{@plural}/#{action}.html.erb"
|
48
48
|
end
|
49
49
|
template "views/nombre.erb", "app/views/admin/#{@plural}/_#{@singular}.html.erb"
|
@@ -2,14 +2,16 @@
|
|
2
2
|
class Admin::<%= @classes %>Controller < Admin::AdminController
|
3
3
|
load_and_authorize_resource
|
4
4
|
<%- if @con_orden -%>
|
5
|
-
include
|
5
|
+
include Ordenable
|
6
6
|
<%- end -%>
|
7
7
|
|
8
8
|
def index
|
9
|
-
|
9
|
+
@q = <%= @class %>.search params[:q]
|
10
|
+
@<%= @plural %> = @q.relation.page(params[:page]).per(50)
|
10
11
|
end
|
11
12
|
|
12
13
|
def new
|
14
|
+
@<%= @plural %> = <%= @class %>.last(5)
|
13
15
|
end
|
14
16
|
|
15
17
|
def create
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%%= simple_form_for <%= @singular %>, :url => url, :html => { :class => 'form-horizontal' } do |f| %>
|
1
|
+
<%%= simple_form_for <%= @singular %>, :url => url, :remote => remote, :html => { :class => 'form-horizontal' } do |f| %>
|
2
2
|
<%- @atributos.each do |a| -%>
|
3
3
|
<%%= f.<%= a.clase == :references ? :association : :input %> :<%= a.nombre %> %>
|
4
4
|
<%- end -%>
|
@@ -1,9 +1,10 @@
|
|
1
1
|
<div class="page-header">
|
2
|
-
<
|
2
|
+
<div class="row">
|
3
|
+
<div class="span6"><h1>Editar <%= @class %></h1></div>
|
4
|
+
<div class="span3" style="text-align:right;">
|
5
|
+
<%%= link_to icono('arrow-left', :blanco) + ' Volver', <%= @plural_path %>, :class => 'btn btn-primary btn-large' %>
|
6
|
+
</div>
|
7
|
+
</div>
|
3
8
|
</div>
|
4
9
|
|
5
|
-
|
6
|
-
<%%= link_to "Volver", <%= @plural_path %>, :class => 'btn' %>
|
7
|
-
</nav>
|
8
|
-
|
9
|
-
<%%= render "form", :<%= @singular %> => @<%= @singular %>, :url => <%= @singular_path %>(@<%= @singular %>) %>
|
10
|
+
<%%= render "form", :<%= @singular %> => @<%= @singular %>, :url => <%= @singular_path %>(@<%= @singular %>), :remote => false %>
|
@@ -1,19 +1,24 @@
|
|
1
1
|
<div class="page-header">
|
2
|
-
<
|
2
|
+
<div class="row">
|
3
|
+
<div class="span6"><h1><%= @classes %></h1></div>
|
4
|
+
<div class="span3" style="text-align:right;"><%%= link_to icono('plus', :blanco) + " Agregar <%= @singular %>", <%= @new_path %>, :class => 'btn btn-primary btn-large' %></div>
|
5
|
+
</div>
|
3
6
|
</div>
|
4
7
|
|
5
|
-
|
6
|
-
<%%=
|
7
|
-
<%%=
|
8
|
-
|
8
|
+
<%%= simple_form_for @q, :as => :q, :url => <%= @plural_path %>, :method => :get do |f| %>
|
9
|
+
<%%= f.input :<%= @identificador %>_contains, :placeholder => '<%= @identificador.humanize %>', :required => false, :wrapper => :mini, :input_html => { :class => 'input-large search-query' }, :autofocus => true %>
|
10
|
+
<%%= f.button :submit, "Buscar", :name => nil, :disable_with => t("espere"), :class => 'btn btn-primary' %>
|
11
|
+
<%% end %>
|
9
12
|
|
10
|
-
<%%=
|
13
|
+
<%%= paginate @<%= @plural %>, :theme => :bootstrap %>
|
11
14
|
|
12
|
-
<%%= content_tag :table, :id =>
|
15
|
+
<%%= content_tag :table, :id => nombre_tabla(<%= @class %>), :class => [:table, :"table-striped", :ordenable] do %>
|
13
16
|
<%%= thead :<%= @identificador %> %>
|
14
17
|
<%%= content_tag :tbody, render(@<%= @plural %>) %>
|
15
18
|
<%% end %>
|
16
19
|
|
20
|
+
<%%= paginate @<%= @plural %>, :theme => :bootstrap %>
|
21
|
+
|
17
22
|
<%- if @con_orden -%>
|
18
23
|
<%%= hidden_field_tag :url, <%= @reordenar_path %>, :class => :url %>
|
19
24
|
<%- end -%>
|
@@ -1,9 +1,15 @@
|
|
1
1
|
<div class="page-header">
|
2
|
-
<
|
2
|
+
<div class="row">
|
3
|
+
<div class="span6"><h1>Agregar <%= @class %></h1></div>
|
4
|
+
<div class="span3" style="text-align:right;">
|
5
|
+
<%%= link_to icono('arrow-left', :blanco) + ' Volver', <%= @plural_path %>, :class => 'btn btn-primary btn-large' %>
|
6
|
+
</div>
|
7
|
+
</div>
|
3
8
|
</div>
|
4
9
|
|
5
|
-
|
6
|
-
<%%=
|
7
|
-
|
10
|
+
<%%= content_tag :table, :id => nombre_tabla(<%= @class %>), :class => [:table, :"table-striped", :ordenable] do %>
|
11
|
+
<%%= thead :<%= @identificador %> %>
|
12
|
+
<%%= content_tag :tbody, render(@<%= @plural %>) %>
|
13
|
+
<%% end %>
|
8
14
|
|
9
|
-
<%%= render "form", :<%= @singular %> => @<%= @singular %>, :url => <%= @plural_path
|
15
|
+
<%%= render "form", :<%= @singular %> => @<%= @singular %>, :url => <%= @plural_path %>, :remote => true %>
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foldscaf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-05-16 00:00:00.000000000Z
|
13
13
|
dependencies: []
|
14
14
|
description: Generadores adaptados a las necesidades de Xaver
|
15
15
|
email:
|
@@ -34,14 +34,10 @@ files:
|
|
34
34
|
- lib/generators/fold/templates/migration.erb
|
35
35
|
- lib/generators/fold/templates/model.erb
|
36
36
|
- lib/generators/fold/templates/views/_form.erb
|
37
|
-
- lib/generators/fold/templates/views/_mini_form.erb
|
38
37
|
- lib/generators/fold/templates/views/edit.erb
|
39
38
|
- lib/generators/fold/templates/views/index.erb
|
40
39
|
- lib/generators/fold/templates/views/new.erb
|
41
40
|
- lib/generators/fold/templates/views/nombre.erb
|
42
|
-
- lib/generators/mini_form/USAGE
|
43
|
-
- lib/generators/mini_form/mini_form_generator.rb
|
44
|
-
- lib/generators/mini_form/templates/mini_form.rb
|
45
41
|
- lib/version.rb
|
46
42
|
homepage: http://github.com/nicanorperera/foldscaf
|
47
43
|
licenses: []
|
@@ -1,4 +0,0 @@
|
|
1
|
-
<%%= mini_form_for <%= @singular %>, :url => url, :remote => true do |f| %>
|
2
|
-
<%%= f.input :<%= @identificador %>, :placeholder => '<%= @identificador.humanize %>' %>
|
3
|
-
<%%= f.button :submit, :name => nil, :disable_with => t("espere"), :class => 'btn btn-primary' %>
|
4
|
-
<%% end %>
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
class MiniFormGenerator < Rails::Generators::Base
|
3
|
-
source_root File.expand_path('../templates', __FILE__)
|
4
|
-
|
5
|
-
def initialize(*arguments, &block)
|
6
|
-
super
|
7
|
-
end
|
8
|
-
def body
|
9
|
-
copy_file 'mini_form.rb', 'lib/mini_form.rb'
|
10
|
-
end
|
11
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
module MiniForm
|
2
|
-
def mini_form_for(object, *args, &block)
|
3
|
-
args ||= []
|
4
|
-
options = args.extract_options!.merge!({:wrapper => :mini, :html => {:id => :mini, :class => 'collapse form-inline'}})
|
5
|
-
simple_form_for(object, *(args << options.merge(:builder => MiniFormBuilder)), &block)
|
6
|
-
end
|
7
|
-
|
8
|
-
class MiniFormBuilder < SimpleForm::FormBuilder
|
9
|
-
def input(attribute_name, options = {}, &block)
|
10
|
-
options[:input_html] = { :class => 'input-medium'}
|
11
|
-
super
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
# Wrapper para Mini Formularios
|
16
|
-
# TODO: encontrar la manera de cambiar la clase de todos los input por 'input-medium'
|
17
|
-
SimpleForm.setup do |config|
|
18
|
-
config.wrappers :mini, :tag => 'span' , :class => 'controls', :error_class => 'error' do |b|
|
19
|
-
b.use :html5
|
20
|
-
b.use :placeholder
|
21
|
-
b.use :input
|
22
|
-
b.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|