enju_circulation 0.0.51 → 0.0.52

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.
@@ -16,7 +16,7 @@ class CheckoutsController < ApplicationController
16
16
  if icalendar_user.blank?
17
17
  raise ActiveRecord::RecordNotFound
18
18
  else
19
- checkouts = icalendar_user.checkouts.not_returned.order('checkouts.id DESC')
19
+ @checkouts = icalendar_user.checkouts.not_returned.order('checkouts.id DESC')
20
20
  end
21
21
  else
22
22
  unless current_user
@@ -24,10 +24,16 @@ class CheckoutsController < ApplicationController
24
24
  end
25
25
  end
26
26
 
27
+ if params[:format] == 'csv'
28
+ per_page = 65534
29
+ else
30
+ per_page = Checkout.per_page
31
+ end
32
+
27
33
  unless icalendar_user
28
34
  if current_user.try(:has_role?, 'Librarian')
29
35
  if @user
30
- checkouts = @user.checkouts.not_returned.order('checkouts.id DESC').page(params[:page])
36
+ @checkouts = @user.checkouts.not_returned.order('checkouts.id DESC').page(params[:page]).per_page(per_page)
31
37
  else
32
38
  if params[:view] == 'overdue'
33
39
  if params[:days_overdue]
@@ -35,9 +41,9 @@ class CheckoutsController < ApplicationController
35
41
  else
36
42
  date = 1.days.ago.beginning_of_day
37
43
  end
38
- checkouts = Checkout.overdue(date).order('checkouts.id DESC').page(params[:page])
44
+ @checkouts = Checkout.overdue(date).order('checkouts.id DESC').page(params[:page]).per_page(per_page)
39
45
  else
40
- checkouts = Checkout.not_returned.order('checkouts.id DESC').page(params[:page])
46
+ @checkouts = Checkout.not_returned.order('checkouts.id DESC').page(params[:page]).per_page(per_page)
41
47
  end
42
48
  end
43
49
  else
@@ -50,18 +56,13 @@ class CheckoutsController < ApplicationController
50
56
  access_denied
51
57
  return
52
58
  else
53
- checkouts = current_user.checkouts.not_returned.order('checkouts.id DESC').page(params[:page])
59
+ @checkouts = current_user.checkouts.not_returned.order('checkouts.id DESC').page(params[:page]).per_page(per_page)
54
60
  end
55
61
  end
56
62
  end
57
63
  end
58
64
 
59
65
  @days_overdue = params[:days_overdue] ||= 1
60
- if params[:format] == 'csv'
61
- @checkouts = checkouts
62
- else
63
- @checkouts = checkouts.page(params[:page])
64
- end
65
66
 
66
67
  respond_to do |format|
67
68
  format.html # index.html.erb
@@ -42,11 +42,11 @@
42
42
  </li>
43
43
  <%- else -%>
44
44
  <li>
45
- <%= link_to 'RSS', checkouts_path(:format => :rss) -%>
45
+ <%= link_to 'RSS', user_checkouts_path(:format => :rss) -%>
46
46
  <%= link_to (image_tag 'icons/feed.png', :size => '16x16', :alt => 'RSS', :class => 'icon'), user_checkouts_path(user, :format => :rss) -%>
47
47
  </li>
48
48
  <li>
49
- <%= link_to 'CSV', checkouts_path(:format => :csv, :locale => @locale.to_s) -%>
49
+ <%= link_to 'CSV', user_checkouts_path(:format => :csv, :locale => @locale.to_s) -%>
50
50
  <%= link_to (image_tag 'icons/page_white_excel.png', :size => '16x16', :alt => 'CSV', :class => 'icon'), user_checkouts_path(user, :format => :csv, :locale => @locale.to_s) -%>
51
51
  </li>
52
52
  <%- end -%>
@@ -1,3 +1,3 @@
1
1
  module EnjuCirculation
2
- VERSION = "0.0.51"
2
+ VERSION = "0.0.52"
3
3
  end
@@ -123,7 +123,7 @@ describe CheckoutsController do
123
123
  token = "AVRjefcBcey6f1WyYXDl"
124
124
  user = User.where(:checkout_icalendar_token => token).first
125
125
  get :index, :icalendar_token => token
126
- assigns(:checkouts).should eq user.checkouts.not_returned.order('checkouts.id DESC').page(1)
126
+ assigns(:checkouts).should eq user.checkouts.not_returned.order('checkouts.id DESC')
127
127
  response.should be_success
128
128
  end
129
129
 
@@ -131,7 +131,7 @@ describe CheckoutsController do
131
131
  token = "AVRjefcBcey6f1WyYXDl"
132
132
  user = User.where(:checkout_icalendar_token => token).first
133
133
  get :index, :icalendar_token => token, :format => :ics
134
- assigns(:checkouts).should eq user.checkouts.not_returned.order('checkouts.id DESC').page(1)
134
+ assigns(:checkouts).should eq user.checkouts.not_returned.order('checkouts.id DESC')
135
135
  response.should be_success
136
136
  end
137
137
  end
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enju_circulation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.51
4
+ version: 0.0.52
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-03 00:00:00.000000000 Z
12
+ date: 2012-06-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails