enju_circulation 0.0.59 → 0.0.60
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/checkouts_controller.rb +12 -8
- data/app/views/checkouts/_index_item.html.erb +29 -0
- data/app/views/checkouts/index.html.erb +14 -6
- data/config/routes.rb +1 -0
- data/lib/enju_circulation/version.rb +1 -1
- data/spec/controllers/checkouts_controller_spec.rb +6 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/solr/data/test/index/segments_1 +0 -0
- data/spec/dummy/solr/data/test/spellchecker/segments_1 +0 -0
- metadata +3 -2
@@ -3,7 +3,7 @@ class CheckoutsController < ApplicationController
|
|
3
3
|
load_and_authorize_resource :except => [:index, :remove_all]
|
4
4
|
authorize_resource :only => [:index, :remove_all]
|
5
5
|
before_filter :get_user, :only => [:index, :remove_all]
|
6
|
-
|
6
|
+
before_filter :get_item, :only => :index
|
7
7
|
after_filter :convert_charset, :only => :index
|
8
8
|
cache_sweeper :circulation_sweeper, :only => [:create, :update, :destroy]
|
9
9
|
|
@@ -35,15 +35,19 @@ class CheckoutsController < ApplicationController
|
|
35
35
|
if @user
|
36
36
|
@checkouts = @user.checkouts.not_returned.order('checkouts.id DESC').page(params[:page]).per_page(per_page)
|
37
37
|
else
|
38
|
-
if
|
39
|
-
|
40
|
-
|
38
|
+
if @item
|
39
|
+
@checkouts = @item.checkouts.order('checkouts.id DESC').page(params[:page]).per_page(per_page)
|
40
|
+
else
|
41
|
+
if params[:view] == 'overdue'
|
42
|
+
if params[:days_overdue]
|
43
|
+
date = params[:days_overdue].to_i.days.ago.beginning_of_day
|
44
|
+
else
|
45
|
+
date = 1.days.ago.beginning_of_day
|
46
|
+
end
|
47
|
+
@checkouts = Checkout.overdue(date).order('checkouts.id DESC').page(params[:page]).per_page(per_page)
|
41
48
|
else
|
42
|
-
|
49
|
+
@checkouts = Checkout.not_returned.order('checkouts.id DESC').page(params[:page]).per_page(per_page)
|
43
50
|
end
|
44
|
-
@checkouts = Checkout.overdue(date).order('checkouts.id DESC').page(params[:page]).per_page(per_page)
|
45
|
-
else
|
46
|
-
@checkouts = Checkout.not_returned.order('checkouts.id DESC').page(params[:page]).per_page(per_page)
|
47
51
|
end
|
48
52
|
end
|
49
53
|
else
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<div id="content_detail" class="ui-corner-all">
|
2
|
+
<h1 class="title"><%= t('page.listing', :model => t('activerecord.models.checkout')) -%></h1>
|
3
|
+
<div id="content_list">
|
4
|
+
<p id="notice"><%= notice %></p>
|
5
|
+
|
6
|
+
<h2><%= link_to item.item_identifier, item %></h2>
|
7
|
+
<p>(<%= link_to item.manifestation.original_title, item.manifestation %>)
|
8
|
+
|
9
|
+
<%= render 'list' -%>
|
10
|
+
|
11
|
+
<%- if @checkouts.size == 0 -%>
|
12
|
+
<p><%= t('checkout.no_checkout') -%></p>
|
13
|
+
<%- end -%>
|
14
|
+
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<div id="submenu" class="ui-corner-all">
|
19
|
+
<ul>
|
20
|
+
<li>
|
21
|
+
<%= link_to 'RSS', item_checkouts_path(item, :format => :rss) -%>
|
22
|
+
<%= link_to (image_tag 'icons/feed.png', :size => '16x16', :alt => 'RSS', :class => 'icon'), item_checkouts_path(item, :format => :rss) -%>
|
23
|
+
</li>
|
24
|
+
<li>
|
25
|
+
<%= link_to 'CSV', item_checkouts_path(item, :format => :csv, :locale => @locale.to_s) -%>
|
26
|
+
<%= link_to (image_tag 'icons/page_white_excel.png', :size => '16x16', :alt => 'CSV', :class => 'icon'), item_checkouts_path(item, :format => :csv, :locale => @locale.to_s) -%>
|
27
|
+
</li>
|
28
|
+
</ul>
|
29
|
+
</div>
|
@@ -1,11 +1,19 @@
|
|
1
|
-
<%- if
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
<%- if current_user.has_role?('Librarian') -%>
|
2
|
+
<%- if @user -%>
|
3
|
+
<%= render 'index_user', :user => @user -%>
|
4
|
+
<% elsif @item %>
|
5
|
+
<%= render 'index_item', :item => @item -%>
|
6
|
+
<% else %>
|
7
|
+
<%- if params[:view] == 'overdue' -%>
|
8
|
+
<%= render 'index_overdue' -%>
|
9
|
+
<%- else -%>
|
10
|
+
<%= render 'index' -%>
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
13
|
+
<% else %>
|
6
14
|
<%- if params[:view] == 'overdue' -%>
|
7
15
|
<%= render 'index_overdue' -%>
|
8
16
|
<%- else -%>
|
9
|
-
<%= render '
|
17
|
+
<%= render 'index_user', :user => current_user -%>
|
10
18
|
<%- end -%>
|
11
19
|
<%- end -%>
|
data/config/routes.rb
CHANGED
@@ -64,6 +64,12 @@ describe CheckoutsController do
|
|
64
64
|
response.should be_success
|
65
65
|
assigns(:checkouts).should eq users(:admin).checkouts.not_returned.order('checkouts.id DESC').page(1)
|
66
66
|
end
|
67
|
+
|
68
|
+
it "should get index with item_id" do
|
69
|
+
get :index, :item_id => 1
|
70
|
+
response.should be_success
|
71
|
+
assigns(:checkouts).should eq items(:item_00001).checkouts.order('checkouts.id DESC').page(1)
|
72
|
+
end
|
67
73
|
end
|
68
74
|
|
69
75
|
describe "When logged in as User" do
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
Binary file
|
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.
|
4
|
+
version: 0.0.60
|
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
|
+
date: 2012-06-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -408,6 +408,7 @@ files:
|
|
408
408
|
- app/views/checkout_types/show.html.erb
|
409
409
|
- app/views/checkouts/_form.html.erb
|
410
410
|
- app/views/checkouts/_index.html.erb
|
411
|
+
- app/views/checkouts/_index_item.html.erb
|
411
412
|
- app/views/checkouts/_index_overdue.html.erb
|
412
413
|
- app/views/checkouts/_index_user.html.erb
|
413
414
|
- app/views/checkouts/_list.html.erb
|