spud_core 0.9.4 → 0.9.5

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.
@@ -285,6 +285,28 @@ div.field_with_errors label {
285
285
  background: #FAE7D9;
286
286
  }
287
287
 
288
+ .admin-table th .current {
289
+ padding-right: 12px;
290
+ background-repeat: no-repeat;
291
+ background-position: right center;
292
+ }
293
+ .admin-table th a, .admin-table th a:visited {
294
+ color:#fff;
295
+ }
296
+
297
+ .admin-table th a:hover {
298
+ text-decoration: none;
299
+ }
300
+
301
+ .admin-table th .asc {
302
+ background-image: url(/assets/spud/admin/up_arrow.gif);
303
+ }
304
+
305
+ .admin-table th .desc {
306
+ background-image: url(/assets/spud/admin/down_arrow.gif);
307
+ }
308
+
309
+
288
310
  .info_card {
289
311
  width:400px;
290
312
  padding:0 10px;
@@ -4,6 +4,7 @@ class Spud::Admin::ApplicationController < Spud::ApplicationController
4
4
  add_breadcrumb "Dashboard", :spud_admin_root_path
5
5
  layout 'spud/admin/application'
6
6
  respond_to :html,:json,:xml,:js
7
+ helper_method :sort_column, :sort_direction
7
8
  unloadable
8
9
 
9
10
  def current_admin_site
@@ -15,7 +16,16 @@ class Spud::Admin::ApplicationController < Spud::ApplicationController
15
16
 
16
17
  end
17
18
 
18
- private
19
+ private
20
+
21
+ def sort_column
22
+ params[:sort]
23
+ end
24
+
25
+ def sort_direction
26
+ %w[asc desc].include?(params[:direction]) ? params[:direction] : "asc"
27
+ end
28
+
19
29
  def require_admin_user
20
30
  return false if !require_user
21
31
  if !@current_user.super_admin && current_user_permissions.count == 0
@@ -7,7 +7,15 @@ class Spud::Admin::UsersController < Spud::Admin::ApplicationController
7
7
  before_filter :load_user,:only => [:edit,:update,:show,:destroy]
8
8
 
9
9
  def index
10
- @users = SpudUser.order(:login).paginate :page => params[:page]
10
+ sort_order = "login asc"
11
+ if sort_column
12
+ if sort_column == 'first_name'
13
+ sort_order = "first_name #{sort_direction}, last_name #{sort_direction}"
14
+ else
15
+ sort_order = "#{sort_column} #{sort_direction}"
16
+ end
17
+ end
18
+ @users = SpudUser.order(sort_order).paginate :page => params[:page]
11
19
  respond_with @users
12
20
  end
13
21
 
@@ -49,4 +49,6 @@ module Spud::Admin::ApplicationHelper
49
49
  return content.html_safe
50
50
 
51
51
  end
52
+
53
+
52
54
  end
@@ -12,4 +12,11 @@ module Spud::ApplicationHelper
12
12
  return config[:site_id] unless config.blank?
13
13
  end
14
14
 
15
+ def sortable(column, title = nil)
16
+ title ||= column.titleize
17
+ css_class = column == sort_column ? "current #{sort_direction}" : nil
18
+ direction = column == sort_column && sort_direction == "asc" ? "desc" : "asc"
19
+ link_to title, {:sort => column, :direction => direction}, {:class => css_class}
20
+ end
21
+
15
22
  end
@@ -6,12 +6,12 @@
6
6
  <thead>
7
7
  <tr>
8
8
 
9
- <th>Login</th>
10
- <th>Email</th>
11
- <th>Name</th>
9
+ <th><%= sortable "login"%></th>
10
+ <th><%= sortable "email"%></th>
11
+ <th><%= sortable "first_name", "Name"%></th>
12
12
 
13
- <th>Last Login</th>
14
- <th>Date Created</th>
13
+ <th><%= sortable "last_login_at", "Last Login"%></th>
14
+ <th><%= sortable "created_at", "Date Created"%></th>
15
15
  <th></th>
16
16
  </tr>
17
17
  </thead>
@@ -1,5 +1,5 @@
1
1
  module Spud
2
2
  module Core
3
- VERSION = "0.9.4"
3
+ VERSION = "0.9.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spud_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 0.9.5
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-11-16 00:00:00.000000000 Z
12
+ date: 2012-11-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -268,6 +268,7 @@ files:
268
268
  - app/assets/images/sort_both.png
269
269
  - app/assets/images/sort_desc.png
270
270
  - app/assets/images/sort_desc_disabled.png
271
+ - app/assets/images/spud/admin/down_arrow.gif
271
272
  - app/assets/images/spud/admin/flick/ui-bg_flat_0_aaaaaa_40x100.png
272
273
  - app/assets/images/spud/admin/flick/ui-bg_flat_0_eeeeee_40x100.png
273
274
  - app/assets/images/spud/admin/flick/ui-bg_flat_55_ffffff_40x100.png
@@ -283,6 +284,7 @@ files:
283
284
  - app/assets/images/spud/admin/flick/ui-icons_ffffff_256x240.png
284
285
  - app/assets/images/spud/admin/spud_logo.png
285
286
  - app/assets/images/spud/admin/spud_logo@2x.png
287
+ - app/assets/images/spud/admin/up_arrow.gif
286
288
  - app/assets/images/spud/admin/users_thumb.png
287
289
  - app/assets/javascripts/spud/admin/application.js
288
290
  - app/assets/javascripts/spud/admin/dashboard.js
@@ -608,7 +610,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
608
610
  version: '0'
609
611
  segments:
610
612
  - 0
611
- hash: -1527295184139763898
613
+ hash: -2922898483743288928
612
614
  required_rubygems_version: !ruby/object:Gem::Requirement
613
615
  none: false
614
616
  requirements:
@@ -617,7 +619,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
617
619
  version: '0'
618
620
  segments:
619
621
  - 0
620
- hash: -1527295184139763898
622
+ hash: -2922898483743288928
621
623
  requirements: []
622
624
  rubyforge_project:
623
625
  rubygems_version: 1.8.24