foldscaf 1.0.1 → 1.0.2

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.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## v1.0.2
2
+ * Eliminar! pasa a ser destroy (nuevo formato)
3
+ * Headers de Index, New y Edit con nuevo formato.
4
+ * disable_with y confirm ahora con :data => {}
5
+ * default_scope con nuevo formato
6
+
1
7
  ## v1.0.1
2
8
  * Eliminado método mensaje de admin_controller. (Está en ApplicationController de XaverTemplate >= 1.0.1)
3
9
 
@@ -35,7 +35,7 @@ class Admin::<%= @classes %>Controller < Admin::AdminController
35
35
 
36
36
  def destroy
37
37
  @id = @<%= @singular %>.id
38
- @<%= @singular %>.eliminar!
38
+ @<%= @singular %>.destroy
39
39
  notice = mensaje
40
40
 
41
41
  respond_to do |format|
@@ -7,10 +7,18 @@ class <%= @class %> < ActiveRecord::Base
7
7
  <%- atributos_con_referencia.each do |a| -%>
8
8
  belongs_to :<%= a.nombre %>
9
9
  <%- end -%>
10
- default_scope where(:es_activo => true)<%= ".order('#{@plural}.orden')" if @con_orden %>
10
+ default_scope -> { where{es_activo.eq true}<%= ".order('#{@plural}.orden')" if @con_orden %> }
11
11
 
12
- def eliminar!
13
- update_attributes! :es_activo => false
12
+ def se_puede_eliminar?
13
+ true
14
+ end
15
+
16
+ def destroy
17
+ if se_puede_eliminar?
18
+ run_callbacks :destroy do
19
+ update_attribute :es_activo, false
20
+ end
21
+ end
14
22
  end
15
23
 
16
24
  alias_attribute :to_s, :<%= @identificador %>
@@ -4,6 +4,6 @@
4
4
  <%- end -%>
5
5
 
6
6
  <div class="controls">
7
- <%%= f.button :submit, :name => nil, :disable_with => t("espere"), :class => 'btn btn-primary' %>
7
+ <%%= f.button :submit, :name => nil, :data => { :disable_with => t('espere') }, :class => 'btn btn-primary' %>
8
8
  </div>
9
9
  <%% end %>
@@ -1,10 +1,8 @@
1
1
  <div class="page-header">
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>
2
+ <nav class="pull-right">
3
+ <%%= link_to icono('arrow-left', :blanco) + ' Volver', <%= @plural_path %>, :class => 'btn btn-primary btn-large' %>
4
+ </nav>
5
+ <h1>Editar <%= @class %></h1>
8
6
  </div>
9
7
 
10
8
  <%%= render "form", :<%= @singular %> => @<%= @singular %>, :url => <%= @singular_path %>(@<%= @singular %>), :remote => false %>
@@ -1,8 +1,8 @@
1
1
  <div class="page-header">
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>
2
+ <nav class="pull-right">
3
+ <%%= link_to icono('plus', :blanco) + " Agregar <%= @singular %>", <%= @new_path %>, :class => 'btn btn-primary btn-large' %>
4
+ </nav>
5
+ <h1><%= @classes %></h1>
6
6
  </div>
7
7
 
8
8
  <%%= simple_form_for @q, :as => :q, :url => <%= @plural_path %>, :method => :get do |f| %>
@@ -1,10 +1,8 @@
1
1
  <div class="page-header">
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>
2
+ <nav class="pull-right">
3
+ <%%= link_to icono('arrow-left', :blanco) + ' Volver', <%= @plural_path %>, :class => 'btn btn-primary btn-large' %>
4
+ </nav>
5
+ <h1>Agregar <%= @class %>
8
6
  </div>
9
7
 
10
8
  <%%= content_tag :table, :id => nombre_tabla(<%= @class %>), :class => [:table, :"table-striped", :ordenable] do %>
@@ -5,6 +5,7 @@
5
5
  <%%= link_to icono('move', :black) + " Mover", "#", :class => 'btn btn-mini handle', :title => 'Mantenga click y arrastre para reordenar' %>
6
6
  <%- end -%>
7
7
  <%%= link_to 'Editar', <%= @edit_path %>(<%= @singular %>), :class => 'btn btn-mini' if can? :update, <%= @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
+ <%%= link_to 'Eliminar', <%= @singular_path %>(<%= @singular %>), :method => :delete, :data => { :confirm => t('confirmacion') }, :remote => true, :class => 'btn btn-mini btn-danger'
9
+ if <%= @singular %>.se_puede_eliminar? && can?(:destroy, <%= @singular %>) %>
9
10
  </td>
10
11
  <%% end %>
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Foldscaf
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
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: 1.0.1
4
+ version: 1.0.2
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-06-12 00:00:00.000000000Z
12
+ date: 2012-07-04 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Generadores adaptados a las necesidades de Xaver
15
15
  email:
@@ -59,7 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
59
59
  version: '0'
60
60
  requirements: []
61
61
  rubyforge_project: foldscaf
62
- rubygems_version: 1.8.10
62
+ rubygems_version: 1.8.15
63
63
  signing_key:
64
64
  specification_version: 3
65
65
  summary: Generadores adaptados a las necesidades de Xaver