enju_biblio 0.0.9 → 0.1.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/accepts_controller.rb +83 -0
- data/app/controllers/items_controller.rb +2 -2
- data/app/controllers/manifestations_controller.rb +8 -8
- data/app/controllers/patrons_controller.rb +18 -4
- data/app/controllers/series_has_manifestations_controller.rb +1 -1
- data/app/controllers/series_statements_controller.rb +2 -5
- data/app/models/accept.rb +36 -0
- data/app/models/create.rb +0 -4
- data/app/models/donate.rb +0 -4
- data/app/models/exemplify.rb +0 -4
- data/app/models/import_request.rb +0 -4
- data/app/models/item.rb +2 -4
- data/app/models/manifestation.rb +5 -8
- data/app/models/own.rb +0 -3
- data/app/models/patron.rb +2 -4
- data/app/models/picture_file.rb +0 -4
- data/app/models/produce.rb +0 -4
- data/app/models/realize.rb +0 -4
- data/app/models/series_has_manifestation.rb +1 -3
- data/app/models/series_statement.rb +2 -4
- data/app/views/accepts/_form.html.erb +11 -0
- data/app/views/accepts/_list.html.erb +31 -0
- data/app/views/accepts/edit.html.erb +13 -0
- data/app/views/accepts/index.csv.erb +4 -0
- data/app/views/accepts/index.html.erb +49 -0
- data/app/views/accepts/index.js.erb +1 -0
- data/app/views/accepts/new.html.erb +14 -0
- data/app/views/accepts/show.html.erb +31 -0
- data/app/views/countries/index.html.erb +1 -1
- data/app/views/creates/_index.html.erb +1 -1
- data/app/views/creates/_index_patron.html.erb +1 -1
- data/app/views/creates/_index_work.html.erb +1 -1
- data/app/views/donates/index.html.erb +1 -1
- data/app/views/exemplifies/index.html.erb +1 -1
- data/app/views/extents/index.html.erb +1 -1
- data/app/views/import_requests/index.html.erb +1 -1
- data/app/views/items/index.html.erb +1 -1
- data/app/views/items/index.mobile.erb +1 -1
- data/app/views/languages/index.html.erb +1 -1
- data/app/views/licenses/index.html.erb +1 -1
- data/app/views/manifestations/_list.html.erb +2 -2
- data/app/views/manifestations/_manifestation.html.erb +1 -1
- data/app/views/manifestations/_question_list.html.erb +2 -2
- data/app/views/manifestations/_tab_list.html.erb +1 -1
- data/app/views/manifestations/index.html.erb +2 -2
- data/app/views/manifestations/index.mobile.erb +1 -1
- data/app/views/medium_of_performances/index.html.erb +1 -1
- data/app/views/owns/index.html.erb +1 -1
- data/app/views/patron_import_files/index.html.erb +1 -1
- data/app/views/patron_import_results/index.html.erb +1 -1
- data/app/views/patrons/_expression_list.html.erb +2 -2
- data/app/views/patrons/_index.html.erb +1 -1
- data/app/views/patrons/_index_expression.html.erb +1 -1
- data/app/views/patrons/_index_manifestation.html.erb +1 -1
- data/app/views/patrons/_index_patron.html.erb +1 -1
- data/app/views/patrons/_index_patron_merge_list.html.erb +1 -1
- data/app/views/patrons/_index_work.html.erb +1 -1
- data/app/views/patrons/_manifestation_list.html.erb +2 -2
- data/app/views/patrons/_work_list.html.erb +2 -2
- data/app/views/patrons/index.mobile.erb +1 -1
- data/app/views/picture_files/_index.html.erb +1 -1
- data/app/views/picture_files/_index_event.html.erb +1 -1
- data/app/views/picture_files/_index_manifestation.html.erb +1 -1
- data/app/views/picture_files/_index_patron.html.erb +1 -1
- data/app/views/picture_files/_index_shelf.html.erb +1 -1
- data/app/views/produces/_index.html.erb +1 -1
- data/app/views/produces/_index_manifestation.html.erb +1 -1
- data/app/views/produces/_index_patron.html.erb +1 -1
- data/app/views/realizes/_index.html.erb +1 -1
- data/app/views/realizes/_index_expression.html.erb +1 -1
- data/app/views/realizes/_index_patron.html.erb +1 -1
- data/app/views/resource_import_files/index.html.erb +1 -1
- data/app/views/resource_import_results/index.html.erb +1 -1
- data/app/views/series_has_manifestations/index.html.erb +1 -1
- data/app/views/series_statements/_index.html.erb +1 -1
- data/app/views/series_statements/_index_manifestation.html.erb +1 -1
- data/app/views/series_statements/_index_series_statement_merge_list.html.erb +1 -1
- data/app/views/series_statements/_manifestation_list.html.erb +2 -2
- data/{spec/dummy/db → db}/migrate/120_create_baskets.rb +0 -0
- data/{spec/dummy/db → db}/migrate/20120319173203_create_accepts.rb +0 -0
- data/lib/enju_biblio.rb +4 -0
- data/lib/enju_biblio/engine.rb +0 -3
- data/lib/enju_biblio/version.rb +1 -1
- data/lib/generators/enju_biblio/views_generator.rb +51 -0
- data/spec/controllers/accepts_controller_spec.rb +304 -0
- data/spec/dummy/app/models/ability.rb +2 -0
- data/spec/dummy/config/application.rb +9 -1
- data/spec/dummy/config/initializers/kaminari_config.rb +9 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/lib/plugins/ext.rb +0 -2
- data/spec/dummy/tmp/cache/4F7/F90/default_role +0 -0
- data/spec/dummy/tmp/cache/6E4/420/search_engine_all +0 -0
- data/spec/factories/accepts.rb +9 -0
- data/spec/factories/basket.rb +5 -0
- data/spec/models/accept_spec.rb +22 -0
- data/spec/requests/accepts_spec.rb +11 -0
- data/spec/routing/accepts_routing_spec.rb +27 -0
- data/spec/views/accepts/edit.html.erb_spec.rb +18 -0
- data/spec/views/accepts/index.html.erb_spec.rb +25 -0
- data/spec/views/accepts/new.html.erb_spec.rb +29 -0
- data/spec/views/accepts/show.html.erb_spec.rb +17 -0
- data/spec/views/creates/index.html.erb_spec.rb +2 -2
- data/spec/views/exemplifies/index.html.erb_spec.rb +2 -2
- data/spec/views/owns/index.html.erb_spec.rb +2 -2
- data/spec/views/produces/index.html.erb_spec.rb +2 -2
- data/spec/views/realizes/index.html.erb_spec.rb +2 -2
- data/spec/views/series_has_manifestations/index.html.erb_spec.rb +2 -2
- metadata +50 -42
- data/app/views/resource_import_files/_show_object_list.html.erb +0 -26
- data/spec/dummy/lib/enju_leaf.rb +0 -9
- data/spec/dummy/lib/enju_leaf/calculate_stat.rb +0 -30
- data/spec/dummy/lib/plugins/ext/will_paginate.rb +0 -64
@@ -1,5 +1,5 @@
|
|
1
1
|
<div id="manifestation">
|
2
|
-
<%=
|
2
|
+
<%= paginate(@manifestations, :param_name => :manifestation_list_page, :remote => true) -%>
|
3
3
|
<ul>
|
4
4
|
<%- @manifestations.each do |manifestation| -%>
|
5
5
|
<li>
|
@@ -15,5 +15,5 @@
|
|
15
15
|
</li>
|
16
16
|
<%- end -%>
|
17
17
|
</ul>
|
18
|
-
<%=
|
18
|
+
<%= paginate(@manifestations, :param_name => :manifestation_list_page, :remote => true) -%>
|
19
19
|
</div>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<div id="work">
|
2
|
-
<%=
|
2
|
+
<%= paginate(@works, :param_name => :work_list_page, :remote => true -%>
|
3
3
|
<ul>
|
4
4
|
<%- @works.each do |work| -%>
|
5
5
|
<li>
|
@@ -9,6 +9,6 @@
|
|
9
9
|
</li>
|
10
10
|
<%- end -%>
|
11
11
|
</ul>
|
12
|
-
<%=
|
12
|
+
<%= paginate(@works, :param_name => :work_list_page, :remote => true) -%>
|
13
13
|
</div>
|
14
14
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<div id="manifestation">
|
2
|
-
<%=
|
2
|
+
<%= paginate(@manifestations, :param_name => :manifestation_page, :remote => true) -%>
|
3
3
|
<table class="table table-striped index">
|
4
4
|
<%- @manifestations.each do |manifestation| -%>
|
5
5
|
<% next if manifestation.periodical_master? %>
|
@@ -13,5 +13,5 @@
|
|
13
13
|
</tr>
|
14
14
|
<%- end -%>
|
15
15
|
</table>
|
16
|
-
<%=
|
16
|
+
<%= paginate(@manifestations, :param_name => :manifestation_page, :remote => true) -%>
|
17
17
|
</div>
|
File without changes
|
File without changes
|
data/lib/enju_biblio.rb
CHANGED
@@ -50,6 +50,10 @@ module EnjuBiblio
|
|
50
50
|
def get_series_statement
|
51
51
|
@series_statement = SeriesStatement.find(params[:series_statement_id]) if params[:series_statement_id]
|
52
52
|
end
|
53
|
+
|
54
|
+
def get_basket
|
55
|
+
@basket = Basket.find(params[:basket_id]) if params[:basket_id]
|
56
|
+
end
|
53
57
|
end
|
54
58
|
end
|
55
59
|
|
data/lib/enju_biblio/engine.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
require 'enju_core'
|
2
|
-
require 'enju_export'
|
3
2
|
require 'inherited_resources'
|
4
3
|
require 'paper_trail'
|
5
|
-
require 'configatron'
|
6
4
|
require 'paperclip'
|
7
5
|
require 'state_machine'
|
8
6
|
require 'validates_timeliness'
|
@@ -11,7 +9,6 @@ require 'has_scope'
|
|
11
9
|
require 'enju_ndl'
|
12
10
|
require 'dynamic_form'
|
13
11
|
require 'simple_form'
|
14
|
-
require 'will_paginate/array'
|
15
12
|
require 'resque_mailer'
|
16
13
|
|
17
14
|
module EnjuBiblio
|
data/lib/enju_biblio/version.rb
CHANGED
@@ -0,0 +1,51 @@
|
|
1
|
+
module EnjuBiblio
|
2
|
+
module Generators
|
3
|
+
class ViewsGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path('../../../../app/views', __FILE__)
|
5
|
+
|
6
|
+
def copy_files
|
7
|
+
directories = %w(
|
8
|
+
accepts
|
9
|
+
carrier_types
|
10
|
+
content_types
|
11
|
+
countries
|
12
|
+
create_types
|
13
|
+
creates
|
14
|
+
donates
|
15
|
+
exemplifies
|
16
|
+
extents
|
17
|
+
form_of_works
|
18
|
+
frequencies
|
19
|
+
import_requests
|
20
|
+
items
|
21
|
+
languages
|
22
|
+
licenses
|
23
|
+
manifestation_relationship_types
|
24
|
+
manifestation_relationships
|
25
|
+
manifestations
|
26
|
+
medium_of_performances
|
27
|
+
owns
|
28
|
+
patron_import_files
|
29
|
+
patron_import_results
|
30
|
+
patron_relationship_types
|
31
|
+
patron_relationships
|
32
|
+
patron_types
|
33
|
+
patrons
|
34
|
+
picture_files
|
35
|
+
produce_types
|
36
|
+
produces
|
37
|
+
realize_types
|
38
|
+
realizes
|
39
|
+
resource_import_files
|
40
|
+
resource_import_results
|
41
|
+
series_has_manifestations
|
42
|
+
series_statements
|
43
|
+
)
|
44
|
+
|
45
|
+
directories.each do |dir|
|
46
|
+
directory dir, "app/views/#{dir}"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,304 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe AcceptsController do
|
4
|
+
fixtures :all
|
5
|
+
|
6
|
+
def mock_user(stubs={})
|
7
|
+
(@mock_user ||= mock_model(Accept).as_null_object).tap do |user|
|
8
|
+
user.stub(stubs) unless stubs.empty?
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "GET index" do
|
13
|
+
describe "When logged in as Administrator" do
|
14
|
+
login_fixture_admin
|
15
|
+
|
16
|
+
it "assigns all accepts as @accepts" do
|
17
|
+
get :index
|
18
|
+
assigns(:accepts).should_not be_nil
|
19
|
+
response.should be_success
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "When basket_id is specified" do
|
23
|
+
it "assigns all accepts as @accepts" do
|
24
|
+
get :index, :basket_id => 10
|
25
|
+
assigns(:accepts).should eq Basket.find(10).accepts.page(1)
|
26
|
+
response.should be_success
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe "When logged in as Librarian" do
|
32
|
+
login_fixture_librarian
|
33
|
+
|
34
|
+
it "assigns all accepts as @accepts" do
|
35
|
+
get :index
|
36
|
+
assigns(:accepts).should_not be_nil
|
37
|
+
response.should be_success
|
38
|
+
end
|
39
|
+
|
40
|
+
describe "When basket_id is specified" do
|
41
|
+
it "assigns all accepts as @accepts" do
|
42
|
+
get :index, :basket_id => 9
|
43
|
+
assigns(:accepts).should eq Basket.find(9).accepts.page(1)
|
44
|
+
response.should be_success
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe "When logged in as User" do
|
50
|
+
login_fixture_user
|
51
|
+
|
52
|
+
it "should not assign all accepts as @accepts" do
|
53
|
+
get :index
|
54
|
+
assigns(:accepts).should be_nil
|
55
|
+
response.should be_forbidden
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe "GET show" do
|
61
|
+
describe "When logged in as Administrator" do
|
62
|
+
login_fixture_admin
|
63
|
+
|
64
|
+
it "assigns the requested accept as @accept" do
|
65
|
+
accept = FactoryGirl.create(:accept)
|
66
|
+
get :show, :id => accept.id
|
67
|
+
assigns(:accept).should eq(accept)
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should not show missing accept" do
|
71
|
+
get :show, :id => 'missing'
|
72
|
+
response.should be_missing
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
describe "When logged in as Librarian" do
|
77
|
+
login_fixture_librarian
|
78
|
+
|
79
|
+
it "assigns the requested accept as @accept" do
|
80
|
+
accept = FactoryGirl.create(:accept)
|
81
|
+
get :show, :id => accept.id
|
82
|
+
assigns(:accept).should eq(accept)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
describe "When logged in as User" do
|
87
|
+
login_fixture_user
|
88
|
+
|
89
|
+
it "assigns the requested accept as @accept" do
|
90
|
+
accept = FactoryGirl.create(:accept)
|
91
|
+
get :show, :id => accept.id
|
92
|
+
assigns(:accept).should eq(accept)
|
93
|
+
response.should be_forbidden
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
describe "When not logged in" do
|
98
|
+
it "assigns the requested accept as @accept" do
|
99
|
+
accept = FactoryGirl.create(:accept)
|
100
|
+
get :show, :id => accept.id
|
101
|
+
assigns(:accept).should eq(accept)
|
102
|
+
response.should redirect_to new_user_session_url
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
describe "GET new" do
|
108
|
+
describe "When logged in as Administrator" do
|
109
|
+
login_fixture_admin
|
110
|
+
|
111
|
+
it "assigns the requested accept as @accept" do
|
112
|
+
get :new
|
113
|
+
assigns(:accept).should_not be_valid
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
describe "When logged in as Librarian" do
|
118
|
+
login_fixture_librarian
|
119
|
+
|
120
|
+
it "assigns the requested accept as @accept" do
|
121
|
+
get :new
|
122
|
+
assigns(:accept).should_not be_valid
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
describe "When logged in as User" do
|
127
|
+
login_fixture_user
|
128
|
+
|
129
|
+
it "should not assign the requested accept as @accept" do
|
130
|
+
get :new
|
131
|
+
assigns(:accept).should_not be_valid
|
132
|
+
response.should be_forbidden
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
describe "When not logged in" do
|
137
|
+
it "should not assign the requested accept as @accept" do
|
138
|
+
get :new
|
139
|
+
assigns(:accept).should_not be_valid
|
140
|
+
response.should redirect_to(new_user_session_url)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
describe "POST create" do
|
146
|
+
before(:each) do
|
147
|
+
@attrs = {:item_identifier => '00003'}
|
148
|
+
@invalid_attrs = {:item_identifier => 'invalid'}
|
149
|
+
end
|
150
|
+
|
151
|
+
describe "When logged in as Administrator" do
|
152
|
+
login_fixture_admin
|
153
|
+
|
154
|
+
describe "with valid params" do
|
155
|
+
it "assigns a newly created accept as @accept" do
|
156
|
+
post :create, :accept => @attrs
|
157
|
+
assigns(:accept).should_not be_valid
|
158
|
+
end
|
159
|
+
|
160
|
+
it "should not create a new accept without basket_id" do
|
161
|
+
post :create, :accept => @attrs
|
162
|
+
response.should be_forbidden
|
163
|
+
end
|
164
|
+
|
165
|
+
describe "When basket_id is specified" do
|
166
|
+
it "redirects to the created accept" do
|
167
|
+
post :create, :accept => @attrs, :basket_id => 9
|
168
|
+
response.should redirect_to(basket_accepts_url(assigns(:accept).basket))
|
169
|
+
assigns(:accept).item.circulation_status.name.should eq 'Available On Shelf'
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
describe "with invalid params" do
|
175
|
+
it "assigns a newly created but unsaved accept as @accept" do
|
176
|
+
post :create, :accept => @invalid_attrs
|
177
|
+
assigns(:accept).should_not be_valid
|
178
|
+
end
|
179
|
+
|
180
|
+
it "should be forbidden" do
|
181
|
+
post :create, :accept => @invalid_attrs
|
182
|
+
response.should be_forbidden
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
it "should not create accept without item_id" do
|
187
|
+
post :create, :accept => {:item_identifier => nil}, :basket_id => 9
|
188
|
+
assigns(:accept).should_not be_valid
|
189
|
+
response.should be_success
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
describe "When logged in as Librarian" do
|
194
|
+
login_fixture_librarian
|
195
|
+
|
196
|
+
describe "with valid params" do
|
197
|
+
it "assigns a newly created accept as @accept" do
|
198
|
+
post :create, :accept => @attrs
|
199
|
+
assigns(:accept).should_not be_valid
|
200
|
+
end
|
201
|
+
|
202
|
+
it "should not create a new accept without basket_id" do
|
203
|
+
post :create, :accept => @attrs
|
204
|
+
response.should be_forbidden
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
describe "When logged in as User" do
|
210
|
+
login_fixture_user
|
211
|
+
|
212
|
+
describe "with valid params" do
|
213
|
+
it "assigns a newly created accept as @accept" do
|
214
|
+
post :create, :accept => @attrs
|
215
|
+
assigns(:accept).should_not be_valid
|
216
|
+
end
|
217
|
+
|
218
|
+
it "should be forbidden" do
|
219
|
+
post :create, :accept => @attrs
|
220
|
+
response.should be_forbidden
|
221
|
+
end
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
describe "When not logged in" do
|
226
|
+
before(:each) do
|
227
|
+
@attrs = {:item_identifier => '00003'}
|
228
|
+
@invalid_attrs = {:item_identifier => 'invalid'}
|
229
|
+
end
|
230
|
+
|
231
|
+
describe "with valid params" do
|
232
|
+
it "assigns a newly created accept as @accept" do
|
233
|
+
post :create, :accept => @attrs
|
234
|
+
end
|
235
|
+
|
236
|
+
it "should redirect to new session url" do
|
237
|
+
post :create, :accept => @attrs
|
238
|
+
response.should redirect_to new_user_session_url
|
239
|
+
end
|
240
|
+
end
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
describe "DELETE destroy" do
|
245
|
+
before(:each) do
|
246
|
+
@accept = FactoryGirl.create(:accept)
|
247
|
+
end
|
248
|
+
|
249
|
+
describe "When logged in as Administrator" do
|
250
|
+
login_fixture_admin
|
251
|
+
|
252
|
+
it "destroys the requested accept" do
|
253
|
+
delete :destroy, :id => @accept.id
|
254
|
+
end
|
255
|
+
|
256
|
+
it "redirects to the accepts list" do
|
257
|
+
delete :destroy, :id => @accept.id
|
258
|
+
response.should redirect_to(accepts_url)
|
259
|
+
end
|
260
|
+
|
261
|
+
it "should not destroy missing accept" do
|
262
|
+
delete :destroy, :id => 'missing'
|
263
|
+
response.should be_missing
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
describe "When logged in as Librarian" do
|
268
|
+
login_fixture_librarian
|
269
|
+
|
270
|
+
it "destroys the requested accept" do
|
271
|
+
delete :destroy, :id => @accept.id
|
272
|
+
end
|
273
|
+
|
274
|
+
it "redirects to the accepts list" do
|
275
|
+
delete :destroy, :id => @accept.id
|
276
|
+
response.should redirect_to(accepts_url)
|
277
|
+
end
|
278
|
+
end
|
279
|
+
|
280
|
+
describe "When logged in as User" do
|
281
|
+
login_fixture_user
|
282
|
+
|
283
|
+
it "destroys the requested accept" do
|
284
|
+
delete :destroy, :id => @accept.id
|
285
|
+
end
|
286
|
+
|
287
|
+
it "should be forbidden" do
|
288
|
+
delete :destroy, :id => @accept.id
|
289
|
+
response.should be_forbidden
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
describe "When not logged in" do
|
294
|
+
it "destroys the requested accept" do
|
295
|
+
delete :destroy, :id => @accept.id
|
296
|
+
end
|
297
|
+
|
298
|
+
it "should be forbidden" do
|
299
|
+
delete :destroy, :id => @accept.id
|
300
|
+
response.should redirect_to(new_user_session_url)
|
301
|
+
end
|
302
|
+
end
|
303
|
+
end
|
304
|
+
end
|