This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Files Codes

By: a guest on Sep 9th, 2013  |  syntax: Rails  |  size: 3.62 KB  |  views: 32  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. # --------------------------------- users_controller.rb---------------------------------
  2.  
  3.     def index
  4.         @users = User.search(params[:search], params[:page]).order(:username)
  5.     end
  6.  
  7.     def new
  8.         @habilitar_opciones = false
  9.         @user = User.new
  10.     end
  11.  
  12.     def edit
  13.         @habilitar_opciones = true
  14.     end
  15.  
  16. # --------------------------------- users_controller.rb---------------------------------
  17.  
  18. # --------------------------------- userscuentas_controller.rb---------------------------------
  19.  
  20.     def index
  21.         @userscuentas = @user.userscuentas.all
  22.     end
  23.  
  24.     def new
  25.         @userscuenta = Userscuenta.new
  26.     end
  27.  
  28.     def edit
  29.     end
  30.  
  31. # --------------------------------- userscuentas_controller.rb---------------------------------
  32.  
  33. # --------------------------------- app/views/users/layout_users.html.erb----------------------
  34.  
  35. <li><a href="#tab4" data-toggle="tab">Cuentas</a></li>
  36.  
  37.             <div class="tab-pane" id="tab4">
  38.                 <p>
  39.                     <%= render :file => "/userscuentas/index.html.erb" %>
  40.                 </p>
  41.             </div
  42.  
  43. # --------------------------------- app/views/users/layout_users.html.erb----------------------
  44.  
  45. # --------------------------------- app/views/users/new.html.erb----------------------
  46.  
  47. <%- model_class = User -%>
  48. <div class="page-header">
  49.         <h2>Nuevo Usuario</h2>
  50. </div>
  51. <%= render :partial => 'layout_users' %>
  52.  
  53. # --------------------------------- app/views/users/new.html.erb----------------------
  54.  
  55. # --------------------------------- app/views/users/edit.html.erb----------------------
  56.  
  57. <%- model_class = User -%>
  58. <div class="page-header">
  59.         <h2>Editar Usuario</h2>
  60. </div>
  61. <%= render :partial => 'layout_users' %>
  62.  
  63. # --------------------------------- app/views/users/edit.html.erb----------------------
  64.  
  65. # --------------------------------- app/views/users/form.html.erb----------------------
  66.  
  67. <%= javascript_include_tag "fecha" %>
  68. <%= simple_form_for @user, :html => {:multipart => true} do |f| %>
  69.     <% if @user.errors.any? %>
  70.         <div class="alert alert-error">
  71.             <h3>Error al Guardar los Cambios</h3>
  72.             <ul>
  73.                 <% for message in @user.errors.full_messages %>
  74.                     <li><%= message %></li>
  75.                 <% end %>
  76.             </ul>
  77.  
  78.         </div>
  79.     <% end %>
  80.  
  81.     <div class="panel">
  82.         <div class="panel-heading">
  83.             <b>Informacion Personal</b>
  84.         </div>
  85.  
  86.         the rest of the fields
  87.  
  88. <% end %>
  89.  
  90. # --------------------------------- app/views/users/form.html.erb----------------------
  91.  
  92. # --------------------------------- app/views/userscuentas/index.html.erb----------------------
  93.  
  94. <% @userscuentas.each do |userscuenta| %>
  95.       <tr>
  96.         <td><%= link_to userscuenta.id, userscuenta_path(userscuenta) %></td>
  97.         <td><%= userscuenta.nombre %></td>
  98.         <td><%= userscuenta.nro_cuenta %></td>
  99.         <td><%= userscuenta.tipo_cuenta %></td>
  100.         <td><%= userscuenta.user_id %></td>
  101.         <td><%=l userscuenta.created_at %></td>
  102.         <td>
  103.           <%= link_to t('.edit', :default => t("helpers.links.edit")),
  104.                       edit_userscuenta_path(userscuenta), :class => 'btn btn-mini' %>
  105.           <%= link_to t('.destroy', :default => t("helpers.links.destroy")),
  106.                       userscuenta_path(userscuenta),
  107.                       :method => :delete,
  108.                       :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) },
  109.                       :class => 'btn btn-mini btn-danger' %>
  110.         </td>
  111.       </tr>
  112.     <% end %>
clone this paste RAW Paste Data