templates/admin/users.rb in prologue-0.1.0 vs templates/admin/users.rb in prologue-0.1.1
- old
+ new
@@ -8,12 +8,11 @@
FILE
end
inject_into_file 'app/controllers/admin/users_controller.rb', :after => "def index\n" do
<<-'FILE'
- @sortable = SortIndex::Sortable.new(params, INDEX_SORT)
- @users = User.paginate :page => params[:page], :order => @sortable.order, :per_page => 2
+ @users = User.paginate :page => params[:page], :per_page => 50
FILE
end
inject_into_file 'app/controllers/admin/users_controller.rb', :after => "def new\n" do
<<-'FILE'
@@ -55,22 +54,11 @@
gsub_file 'app/controllers/admin/users_controller.rb', /ApplicationController/, 'Admin::BaseController'
inject_into_file 'app/controllers/admin/users_controller.rb', :after => "class Admin::UsersController < Admin::BaseController\n" do
<<-'FILE'
before_filter :find_user, :only => [:edit, :update, :destroy]
-
- INDEX_SORT = SortIndex::Config.new(
- {'name' => 'name'},
- {
- 'email' => 'email',
- 'login' => 'login',
- 'roles_mask' => 'roles_mask',
- 'last_login_at' => 'last_login_at'
- }
- #, optionally SortIndex::SORT_KEY_ASC
- )
-
+
def find_user
@user = User.find(params[:id])
end
FILE
@@ -115,22 +103,22 @@
<<-FILE
- if !@users.blank?
%table
%thead
%tr
- %th= @sortable.header_link('name', 'Name')
- %th= @sortable.header_link('email', 'Email')
+ %th Name
+ %th Email
%th
%th
%tbody
- for user in @users
%tr
%td= user.name
%td= user.email
%td= link_to "Edit", edit_admin_user_path(user), :class => 'edit_link'
%td
- if user.id != current_user.id
- = link_to "Delete", admin_user_path(user), :confirm => t('forms.confirm'), :method => :delete, :class => 'delete_link'
+ = link_to "Delete", admin_user_path(user), :confirm => 'Are you sure?', :method => :delete, :class => 'delete_link'
- else
That's you!
= will_paginate @users
- else
%p No users