foldscaf 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,8 @@
1
1
  class Admin::<%= @classes %>Controller < Admin::AdminController
2
- <%= "include Sortable" if @con_orden %>
3
2
  load_and_authorize_resource
3
+ <%- if @con_orden -%>
4
+ include Sortable
5
+ <%- end -%>
4
6
 
5
7
  def index
6
8
  @<%= @singular %> = <%= @class %>.new
@@ -13,8 +15,9 @@ class Admin::<%= @classes %>Controller < Admin::AdminController
13
15
  @<%= @singular %> = <%= @class %>.new params[:<%= @singular %>]
14
16
  @<%= @singular %>.save!
15
17
  notice = mensaje
18
+
16
19
  respond_to do |format|
17
- format.html { redirect_to <%= @plural_path %>, notice: mensaje }
20
+ format.html { redirect_to <%= @plural_path %>, notice: notice }
18
21
  format.js { @elemento = @<%= @singular %> }
19
22
  end
20
23
  end
@@ -31,8 +34,9 @@ class Admin::<%= @classes %>Controller < Admin::AdminController
31
34
  @id = @<%= @singular %>.id
32
35
  @<%= @singular %>.eliminar!
33
36
  notice = mensaje
37
+
34
38
  respond_to do |format|
35
- format.html { redirect_to <%= @plural_path %>, notice: mensaje }
39
+ format.html { redirect_to <%= @plural_path %>, notice: notice }
36
40
  format.js
37
41
  end
38
42
  end
@@ -42,9 +46,11 @@ class Admin::<%= @classes %>Controller < Admin::AdminController
42
46
  def mensaje
43
47
  flash.now.notice = t("notice.#{action_name}")
44
48
  end
45
- <%- if @con_orden -%>
49
+ <%- if @con_orden -%>
50
+
46
51
  def sort_coleccion
47
52
  <%= @class %>.all
48
53
  end
49
- <%- end -%>
54
+ <%- end -%>
55
+
50
56
  end
@@ -2,17 +2,17 @@ class Create<%= @classes %> < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :<%= @plural %> do |t|
4
4
  <%- @atributos.each do |a| -%>
5
- t.<%= a.clase %> :<%= a.nombre %> <%= ", :default => #{a.default}" if (a.default && a.ejemplo) %>
5
+ t.<%= a.clase %> :<%= a.nombre %><%= ", :default => #{a.default}" if (a.default && a.ejemplo) %>
6
6
  <%- end -%>
7
-
7
+
8
8
  <%- if @con_slug -%>
9
9
  t.string :slug
10
- <%- end -%>
10
+ <%- end -%>
11
11
  <%- if @con_orden -%>
12
12
  t.integer :orden
13
13
  <%- end -%>
14
+
14
15
  t.boolean :es_activo, :default => true
15
-
16
16
  t.timestamps
17
17
  end
18
18
  <%- if @con_slug -%>
@@ -1,24 +1,16 @@
1
1
  class <%= @class %> < ActiveRecord::Base
2
- <%= 'before_create :set_orden' if @con_orden %>
3
- <%- if @con_slug -%>
2
+ <%- if @con_slug -%>
4
3
  extend FriendlyId
5
- friendly_id :<%= @identificador %>, use: :slugged
6
- <%- end -%>
7
- <%- atributos_con_referencia.each do |a| -%>
4
+ friendly_id
5
+ <%- end -%>
6
+ <%- atributos_con_referencia.each do |a| -%>
8
7
  belongs_to :<%= a.nombre %>
9
- <%- end -%>
10
-
8
+ <%- end -%>
11
9
  default_scope where(:es_activo => true)<%= ".order('#{@plural}.orden')" if @con_orden %>
12
10
 
13
11
  def eliminar!
14
- update_attributes :es_activo => false
12
+ update_attributes! :es_activo => false
15
13
  end
16
14
 
17
15
  alias_attribute :to_s, :<%= @identificador %>
18
- <%- if @con_orden -%>
19
- private
20
- def set_orden
21
- self.orden = self.id
22
- end
23
- <%- end -%>
24
16
  end
@@ -1,6 +1,14 @@
1
- <%%= simple_form_for <%= @singular %>, :url => url, :html => { :class => 'form-vertical' } do |f| %>
1
+ <div class="page-header">
2
+ <h1><%= @classes %></h1>
3
+ </div>
4
+
5
+ <%%= simple_form_for <%= @singular %>, :url => url, :html => { :class => 'form-horizontal' } do |f| %>
2
6
  <%- @atributos.each do |a| -%>
3
7
  <%%= f.<%= a.clase == :references ? :association : :input %> :<%= a.nombre %> %>
4
8
  <%- end -%>
5
- <div class="controls"><%%= f.button :submit, :name => nil, :disable_with => t("espere") %></div>
6
- <%%- end -%>
9
+
10
+ <div class="controls">
11
+ <%%= f.button :submit, :name => nil, :disable_with => t("espere"), :class => 'btn btn-primary' %>
12
+ <%%= link_to "Cancelar", <%= @plural_path %>, :class => 'btn' %>
13
+ </div>
14
+ <%% end %>
@@ -1,4 +1,4 @@
1
1
  <%%= mini_form_for <%= @singular %>, :url => url, :remote => true do |f| %>
2
- <%%= f.input :<%= @identificador %>, :placeholder => '<%= @identificador %>' %>
3
- <%%= f.button :submit, :name => nil, :disable_with => t("espere") %>
4
- <%%- end -%>
2
+ <%%= f.input :<%= @identificador %>, :placeholder => '<%= @identificador.humanize %>' %>
3
+ <%%= f.button :submit, :name => nil, :disable_with => t("espere"), :class => 'btn btn-primary' %>
4
+ <%% end %>
@@ -1,5 +1 @@
1
- <div class="page-header">
2
- <h1>Editar <%= @singular %></h1>
3
- </div>
4
- <%%= link_to "Volver", <%= @plural_path %> %>
5
- <%%= render "form", :<%= @singular %> => @<%= @singular %>, :url => <%= @singular_path %>(@<%= @singular %>)%>
1
+ <%%= render "form", :<%= @singular %> => @<%= @singular %>, :url => <%= @singular_path %>(@<%= @singular %>) %>
@@ -3,17 +3,17 @@
3
3
  </div>
4
4
 
5
5
  <nav class="well">
6
- <button class="btn" data-toggle="collapse" data-target="#mini"><%%= icono('zoom-in') %> Mostrar formulario</button>
7
- <%%= link_to icono('plus', :blanco)+" Agregar <%= @singular %> ", <%= @new_path %>, :class => 'btn btn-primary' %>
6
+ <%%= button_tag icono('zoom-in') + " Mostrar formulario", :class => :btn, :data => { :toggle => :collapse, :target => '#mini'} %>
7
+ <%%= link_to icono('plus', :blanco) + " Agregar <%= @singular %>", <%= @new_path %>, :class => 'btn btn-primary' %>
8
8
  </nav>
9
9
 
10
10
  <%%= render "mini_form", :<%= @singular %> => @<%= @singular %>, :url => <%= @plural_path %> %>
11
11
 
12
- <table id="ordenable" class="table table-striped ordenable">
13
- <%%= thead(:<%= @identificador %>) %>
14
- <tbody>
15
- <%%= render @<%= @plural %> %>
16
- </tbody>
17
- </table>
12
+ <%%= content_tag :table, :id => :listado, :class => [:table, :"table-striped", :ordenable] do %>
13
+ <%%= thead :<%= @identificador %> %>
14
+ <%%= content_tag :tbody, render(@<%= @plural %>) %>
15
+ <%% end %>
18
16
 
19
- <%= "<%= hidden_field_tag :url, #{@reordenar_path} , :class => :url %\>" if @con_orden %>
17
+ <%- if @con_orden -%>
18
+ <%%= hidden_field_tag :url, <%= @reordenar_path %>, :class => :url %>
19
+ <%- end -%>
@@ -1,5 +1 @@
1
- <div class="page-header">
2
- <h1>Crear <%= @singular %></h1>
3
- </div>
4
- <%%= link_to "Volver", <%= @plural_path %> %>
5
- <%%= render "form", :<%= @singular %> => @<%= @singular %>, :url => <%= @plural_path %> %>
1
+ <%%= render "form", :<%= @singular %> => @<%= @singular %>, :url => <%= @plural_path %> %>
@@ -1,9 +1,10 @@
1
- <%%- clase ||= 'elemento' -%>
2
- <%%= content_tag :tr, :class => clase, :id => "elementos_#{<%= @singular %>.id}" do %>
1
+ <%%= content_tag :tr, :id => "elementos_#{<%= @singular %>.id}" do %>
3
2
  <td><%%= <%= @singular %>.<%= @identificador %> %></td>
4
- <td style="text-align:right">
5
- <%= "<%= content_tag :i, '',:class => 'handle icon-move', :title => 'Mantenga click y arrastre para reordenar' %\>" if @con_orden %>
6
- <%%= link_to 'Editar' , <%= @edit_path %>(<%= @singular %>), :class => 'btn btn-mini' if can? :editar, <%= @singular %> %>
7
- <%%= link_to "Eliminar", <%= @singular_path %>(<%= @singular %>), :method => :delete, :confirm => t("confirmacion"), :remote => true, :class => 'btn btn-mini btn-danger' %>
3
+ <td>
4
+ <%- if @con_orden -%>
5
+ <%%= content_tag :i, '', :class => [:handle, :"icon-move"], :title => 'Mantenga click y arrastre para reordenar' %>
6
+ <%- end -%>
7
+ <%%= link_to 'Editar', <%= @edit_path %>(<%= @singular %>), :class => 'btn btn-mini' if can? :editar, <%= @singular %> %>
8
+ <%%= link_to "Eliminar", <%= @singular_path %>(<%= @singular %>), :method => :delete, :confirm => t("confirmacion"), :remote => true, :class => 'btn btn-mini btn-danger' if can? :destroy, <%= @singular %> %>
8
9
  </td>
9
- <%% end %>
10
+ <%% end %>
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Foldscaf
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
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.3
4
+ version: 0.0.4
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-03-10 00:00:00.000000000 Z
12
+ date: 2012-03-20 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Generadores adaptados a las necesidades de Xaver
15
15
  email: