enju_question 0.1.0.pre8 → 0.1.0.pre9
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.
- checksums.yaml +4 -4
- data/lib/enju_question/version.rb +1 -1
- data/spec/controllers/answers_controller_spec.rb +12 -6
- data/spec/controllers/questions_controller_spec.rb +16 -8
- data/spec/dummy/app/controllers/application_controller.rb +2 -97
- data/spec/dummy/config/application.rb +1 -2
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/{001_create_patrons.rb → 001_create_agents.rb} +8 -8
- data/spec/dummy/db/migrate/012_create_owns.rb +2 -2
- data/spec/dummy/db/migrate/015_create_creates.rb +2 -2
- data/spec/dummy/db/migrate/047_create_produces.rb +2 -2
- data/spec/dummy/db/migrate/080_create_library_groups.rb +18 -0
- data/spec/dummy/db/migrate/125_create_donates.rb +2 -2
- data/spec/dummy/db/migrate/20080830154109_create_realizes.rb +2 -2
- data/spec/dummy/db/migrate/{20080905191442_create_patron_types.rb → 20080905191442_create_agent_types.rb} +2 -2
- data/spec/dummy/db/migrate/20081028083142_create_agent_import_files.rb +22 -0
- data/spec/dummy/db/migrate/{20090812151902_create_patron_relationship_types.rb → 20090812151902_create_agent_relationship_types.rb} +2 -2
- data/spec/dummy/db/migrate/20091012101112_add_dcndl_schema.rb +2 -2
- data/spec/dummy/db/migrate/20100211105551_add_admin_networks_to_library_group.rb +9 -0
- data/spec/dummy/db/migrate/20100606073747_create_agent_relationships.rb +13 -0
- data/spec/dummy/db/migrate/20100814091104_add_position_to_agent_relationship.rb +11 -0
- data/spec/dummy/db/migrate/20100925074559_create_agent_import_results.rb +12 -0
- data/spec/dummy/db/migrate/20110222073537_add_url_to_library_group.rb +9 -0
- data/spec/dummy/db/migrate/20110301121550_add_birth_date_and_death_date_to_agent.rb +11 -0
- data/spec/dummy/db/migrate/20120413161403_add_fingerprint_to_agent_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20120413170720_add_error_message_to_agent_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20120511072422_add_agent_identifier_to_agent.rb +6 -0
- data/spec/dummy/db/migrate/20120602141129_add_edit_mode_to_agent_import_file.rb +5 -0
- data/spec/dummy/db/schema.rb +156 -140
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/solr/data/test/index/{_63.fdt → _9l.fdt} +0 -0
- data/spec/dummy/solr/data/test/index/{_63.fdx → _9l.fdx} +0 -0
- data/spec/dummy/solr/data/test/index/{_63.fnm → _9l.fnm} +0 -0
- data/spec/dummy/solr/data/test/index/{_63.frq → _9l.frq} +0 -0
- data/spec/dummy/solr/data/test/index/{_63.nrm → _9l.nrm} +0 -0
- data/spec/dummy/solr/data/test/index/{_63.prx → _9l.prx} +0 -0
- data/spec/dummy/solr/data/test/index/{_63.tii → _9l.tii} +0 -0
- data/spec/dummy/solr/data/test/index/{_63.tis → _9l.tis} +0 -0
- data/spec/dummy/solr/data/test/index/segments.gen +0 -0
- data/spec/dummy/solr/data/test/index/segments_j7 +0 -0
- data/spec/fixtures/library_groups.yml +34 -0
- metadata +64 -64
- data/spec/dummy/app/models/role.rb +0 -5
- data/spec/dummy/app/models/user_group.rb +0 -2
- data/spec/dummy/app/models/user_has_role.rb +0 -4
- data/spec/dummy/db/migrate/20081028083142_create_patron_import_files.rb +0 -22
- data/spec/dummy/db/migrate/20100606073747_create_patron_relationships.rb +0 -13
- data/spec/dummy/db/migrate/20100814091104_add_position_to_patron_relationship.rb +0 -11
- data/spec/dummy/db/migrate/20100925074559_create_patron_import_results.rb +0 -12
- data/spec/dummy/db/migrate/20110301121550_add_birth_date_and_death_date_to_patron.rb +0 -11
- data/spec/dummy/db/migrate/20110918161853_rename_series_statement_manifestation_id_to_root_manifestation_id.rb +0 -13
- data/spec/dummy/db/migrate/20120413161403_add_fingerprint_to_patron_import_file.rb +0 -5
- data/spec/dummy/db/migrate/20120413170720_add_error_message_to_patron_import_file.rb +0 -5
- data/spec/dummy/db/migrate/20120415060323_rename_patron_import_file_imported_at_to_executed_at.rb +0 -9
- data/spec/dummy/db/migrate/20120602141129_add_edit_mode_to_patron_import_file.rb +0 -5
- data/spec/dummy/solr/data/test/index/segments_c7 +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7187a0a2ebbef688248050d34bf2c1a832b1a50
|
4
|
+
data.tar.gz: 7aad139e0eaa05284c87a33ac0e1021812a79c84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9249b4aeb8a1251633d8645655ef5c3a63f0b365421d97fe2fd9f93edf1fda84ffa64f7de7c23bd5a63bb1b3c37855293950342a659e160caecd07042e9054bd
|
7
|
+
data.tar.gz: f36cbb87970d4847309cd608cc76e7de868d02f00e0c919bb0359cab524bd8d0a952016d911eef14f53d336a932807d0e144c9645f09549ca3cbc1a41d180605
|
@@ -145,8 +145,10 @@ describe AnswersController do
|
|
145
145
|
end
|
146
146
|
|
147
147
|
it "should not show missing answer" do
|
148
|
-
|
149
|
-
|
148
|
+
lambda{
|
149
|
+
get :show, :id => 'missing', :user_id => users(:user1).username, :question_id => 1
|
150
|
+
}.should raise_error(ActiveRecord::RecordNotFound)
|
151
|
+
#response.should be_missing
|
150
152
|
end
|
151
153
|
|
152
154
|
it "should not show answer with other user's user_id" do
|
@@ -270,8 +272,10 @@ describe AnswersController do
|
|
270
272
|
end
|
271
273
|
|
272
274
|
it "should not edit missing answer" do
|
273
|
-
|
274
|
-
|
275
|
+
lambda{
|
276
|
+
get :edit, :id => 100, :user_id => users(:user1).username, :question_id => 1
|
277
|
+
}.should raise_error(ActiveRecord::RecordNotFound)
|
278
|
+
#response.should be_missing
|
275
279
|
end
|
276
280
|
|
277
281
|
it "should edit my answer" do
|
@@ -431,8 +435,10 @@ describe AnswersController do
|
|
431
435
|
end
|
432
436
|
|
433
437
|
it "should not update missing answer" do
|
434
|
-
|
435
|
-
|
438
|
+
lambda{
|
439
|
+
put :update, :id => 'missing', :answer => { }, :user_id => users(:user1).username
|
440
|
+
}.should raise_error(ActiveRecord::RecordNotFound)
|
441
|
+
#response.should be_missing
|
436
442
|
end
|
437
443
|
|
438
444
|
it "should not update other user's answer" do
|
@@ -122,8 +122,10 @@ describe QuestionsController do
|
|
122
122
|
end
|
123
123
|
|
124
124
|
it "should not show missing question" do
|
125
|
-
|
126
|
-
|
125
|
+
lambda{
|
126
|
+
get :show, :id => 'missing'
|
127
|
+
}.should raise_error(ActiveRecord::RecordNotFound)
|
128
|
+
#response.should be_missing
|
127
129
|
end
|
128
130
|
|
129
131
|
it "should show my question" do
|
@@ -227,8 +229,10 @@ describe QuestionsController do
|
|
227
229
|
end
|
228
230
|
|
229
231
|
it "should not edit missing question" do
|
230
|
-
|
231
|
-
|
232
|
+
lambda{
|
233
|
+
get :edit, :id => 'missing'
|
234
|
+
}.should raise_error(ActiveRecord::RecordNotFound)
|
235
|
+
#response.should be_missing
|
232
236
|
end
|
233
237
|
|
234
238
|
it "should edit my question" do
|
@@ -401,8 +405,10 @@ describe QuestionsController do
|
|
401
405
|
end
|
402
406
|
|
403
407
|
it "should not update missing question" do
|
404
|
-
|
405
|
-
|
408
|
+
lambda{
|
409
|
+
put :update, :id => 'missing', :question => { }
|
410
|
+
}.should raise_error(ActiveRecord::RecordNotFound)
|
411
|
+
#response.should be_missing
|
406
412
|
end
|
407
413
|
end
|
408
414
|
|
@@ -506,8 +512,10 @@ describe QuestionsController do
|
|
506
512
|
end
|
507
513
|
|
508
514
|
it "should not destroy missing question" do
|
509
|
-
|
510
|
-
|
515
|
+
lambda{
|
516
|
+
delete :destroy, :id => 'missing'
|
517
|
+
}.should raise_error(ActiveRecord::RecordNotFound)
|
518
|
+
#response.should be_missing
|
511
519
|
end
|
512
520
|
end
|
513
521
|
|
@@ -1,102 +1,7 @@
|
|
1
1
|
class ApplicationController < ActionController::Base
|
2
2
|
protect_from_forgery
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
before_filter :set_locale
|
8
|
-
|
4
|
+
enju_leaf
|
5
|
+
enju_library
|
9
6
|
enju_question
|
10
|
-
|
11
|
-
private
|
12
|
-
def render_403
|
13
|
-
return if performed?
|
14
|
-
if user_signed_in?
|
15
|
-
respond_to do |format|
|
16
|
-
format.html {render :template => 'page/403', :status => 403}
|
17
|
-
format.mobile {render :template => 'page/403', :status => 403}
|
18
|
-
format.xml {render :template => 'page/403', :status => 403}
|
19
|
-
format.json
|
20
|
-
end
|
21
|
-
else
|
22
|
-
respond_to do |format|
|
23
|
-
format.html {redirect_to new_user_session_url}
|
24
|
-
format.mobile {redirect_to new_user_session_url}
|
25
|
-
format.xml {render :template => 'page/403', :status => 403}
|
26
|
-
format.json
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def render_404
|
32
|
-
return if performed?
|
33
|
-
respond_to do |format|
|
34
|
-
format.html {render :template => 'page/404', :status => 404}
|
35
|
-
format.mobile {render :template => 'page/404', :status => 404}
|
36
|
-
format.xml {render :template => 'page/404', :status => 404}
|
37
|
-
format.json
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def set_locale
|
42
|
-
if params[:locale]
|
43
|
-
unless I18n.available_locales.include?(params[:locale].to_s.intern)
|
44
|
-
raise InvalidLocaleError
|
45
|
-
end
|
46
|
-
end
|
47
|
-
if user_signed_in?
|
48
|
-
locale = params[:locale] || session[:locale] || current_user.locale.try(:to_sym)
|
49
|
-
else
|
50
|
-
locale = params[:locale] || session[:locale]
|
51
|
-
end
|
52
|
-
if locale
|
53
|
-
I18n.locale = @locale = session[:locale] = locale.to_sym
|
54
|
-
else
|
55
|
-
I18n.locale = @locale = session[:locale] = I18n.default_locale
|
56
|
-
end
|
57
|
-
rescue InvalidLocaleError
|
58
|
-
@locale = I18n.default_locale
|
59
|
-
end
|
60
|
-
|
61
|
-
def not_found
|
62
|
-
raise ActiveRecord::RecordNotFound
|
63
|
-
end
|
64
|
-
|
65
|
-
def access_denied
|
66
|
-
raise CanCan::AccessDenied
|
67
|
-
end
|
68
|
-
|
69
|
-
def get_user
|
70
|
-
@user = User.where(:username => params[:user_id]).first if params[:user_id]
|
71
|
-
end
|
72
|
-
|
73
|
-
def convert_charset
|
74
|
-
case params[:format]
|
75
|
-
when 'csv'
|
76
|
-
return unless Setting.csv_charset_conversion
|
77
|
-
# TODO: 他の言語
|
78
|
-
if @locale.to_sym == :ja
|
79
|
-
headers["Content-Type"] = "text/csv; charset=Shift_JIS"
|
80
|
-
response.body = NKF::nkf('-Ws', response.body)
|
81
|
-
end
|
82
|
-
when 'xml'
|
83
|
-
if @locale.to_sym == :ja
|
84
|
-
headers["Content-Type"] = "application/xml; charset=Shift_JIS"
|
85
|
-
response.body = NKF::nkf('-Ws', response.body)
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
def store_location
|
91
|
-
if request.get? and request.format.try(:html?) and !request.xhr?
|
92
|
-
session[:user_return_to] = request.fullpath
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
def solr_commit
|
97
|
-
Sunspot.commit
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
class InvalidLocaleError < StandardError
|
102
7
|
end
|
Binary file
|
@@ -1,6 +1,6 @@
|
|
1
|
-
class
|
1
|
+
class CreateAgents < ActiveRecord::Migration
|
2
2
|
def change
|
3
|
-
create_table :
|
3
|
+
create_table :agents do |t|
|
4
4
|
t.integer :user_id
|
5
5
|
t.string :last_name
|
6
6
|
t.string :middle_name
|
@@ -35,7 +35,7 @@ class CreatePatrons < ActiveRecord::Migration
|
|
35
35
|
t.datetime :date_of_death
|
36
36
|
t.integer :language_id, :default => 1, :null => false
|
37
37
|
t.integer :country_id, :default => 1, :null => false
|
38
|
-
t.integer :
|
38
|
+
t.integer :agent_type_id, :default => 1, :null => false
|
39
39
|
t.integer :lock_version, :default => 0, :null => false
|
40
40
|
t.text :note
|
41
41
|
t.integer :required_role_id, :default => 1, :null => false
|
@@ -44,10 +44,10 @@ class CreatePatrons < ActiveRecord::Migration
|
|
44
44
|
t.text :email
|
45
45
|
t.text :url
|
46
46
|
end
|
47
|
-
add_index :
|
48
|
-
add_index :
|
49
|
-
add_index :
|
50
|
-
add_index :
|
51
|
-
add_index :
|
47
|
+
add_index :agents, :user_id, :unique => true
|
48
|
+
add_index :agents, :language_id
|
49
|
+
add_index :agents, :country_id
|
50
|
+
add_index :agents, :required_role_id
|
51
|
+
add_index :agents, :full_name
|
52
52
|
end
|
53
53
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
class CreateOwns < ActiveRecord::Migration
|
2
2
|
def change
|
3
3
|
create_table :owns do |t|
|
4
|
-
t.references :
|
4
|
+
t.references :agent, :null => false
|
5
5
|
t.references :item, :null => false
|
6
6
|
t.integer :position
|
7
7
|
t.timestamps
|
8
8
|
end
|
9
|
-
add_index :owns, :
|
9
|
+
add_index :owns, :agent_id
|
10
10
|
add_index :owns, :item_id
|
11
11
|
end
|
12
12
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
class CreateCreates < ActiveRecord::Migration
|
2
2
|
def change
|
3
3
|
create_table :creates do |t|
|
4
|
-
t.references :
|
4
|
+
t.references :agent, :null => false
|
5
5
|
t.references :work, :null => false
|
6
6
|
t.integer :position
|
7
7
|
t.timestamps
|
8
8
|
end
|
9
|
-
add_index :creates, :
|
9
|
+
add_index :creates, :agent_id
|
10
10
|
add_index :creates, :work_id
|
11
11
|
end
|
12
12
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
class CreateProduces < ActiveRecord::Migration
|
2
2
|
def change
|
3
3
|
create_table :produces do |t|
|
4
|
-
t.references :
|
4
|
+
t.references :agent, :null => false
|
5
5
|
t.references :manifestation, :null => false
|
6
6
|
t.integer :position
|
7
7
|
t.timestamps
|
8
8
|
end
|
9
|
-
add_index :produces, :
|
9
|
+
add_index :produces, :agent_id
|
10
10
|
add_index :produces, :manifestation_id
|
11
11
|
end
|
12
12
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreateLibraryGroups < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :library_groups do |t|
|
4
|
+
t.string :name, :null => false
|
5
|
+
t.text :display_name
|
6
|
+
t.string :short_name, :null => false
|
7
|
+
t.string :email
|
8
|
+
t.text :my_networks
|
9
|
+
t.text :login_banner
|
10
|
+
t.text :note
|
11
|
+
t.integer :country_id
|
12
|
+
t.integer :position
|
13
|
+
|
14
|
+
t.timestamps
|
15
|
+
end
|
16
|
+
add_index :library_groups, :short_name
|
17
|
+
end
|
18
|
+
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
class CreateDonates < ActiveRecord::Migration
|
2
2
|
def change
|
3
3
|
create_table :donates do |t|
|
4
|
-
t.integer :
|
4
|
+
t.integer :agent_id, :null => false
|
5
5
|
t.integer :item_id, :null => false
|
6
6
|
|
7
7
|
t.timestamps
|
8
8
|
end
|
9
|
-
add_index :donates, :
|
9
|
+
add_index :donates, :agent_id
|
10
10
|
add_index :donates, :item_id
|
11
11
|
end
|
12
12
|
end
|
@@ -1,13 +1,13 @@
|
|
1
1
|
class CreateRealizes < ActiveRecord::Migration
|
2
2
|
def change
|
3
3
|
create_table :realizes do |t|
|
4
|
-
t.references :
|
4
|
+
t.references :agent, :null => false
|
5
5
|
t.references :expression, :null => false
|
6
6
|
t.integer :position
|
7
7
|
|
8
8
|
t.timestamps
|
9
9
|
end
|
10
|
-
add_index :realizes, :
|
10
|
+
add_index :realizes, :agent_id
|
11
11
|
add_index :realizes, :expression_id
|
12
12
|
end
|
13
13
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class CreateAgentImportFiles < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :agent_import_files do |t|
|
4
|
+
t.integer :parent_id
|
5
|
+
t.string :content_type
|
6
|
+
t.integer :size
|
7
|
+
t.integer :user_id
|
8
|
+
t.text :note
|
9
|
+
t.datetime :executed_at
|
10
|
+
t.string :state
|
11
|
+
t.string :agent_import_file_name
|
12
|
+
t.string :agent_import_content_type
|
13
|
+
t.integer :agent_import_file_size
|
14
|
+
t.datetime :agent_import_updated_at
|
15
|
+
|
16
|
+
t.timestamps
|
17
|
+
end
|
18
|
+
add_index :agent_import_files, :parent_id
|
19
|
+
add_index :agent_import_files, :user_id
|
20
|
+
add_index :agent_import_files, :state
|
21
|
+
end
|
22
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
class
|
1
|
+
class CreateAgentRelationshipTypes < ActiveRecord::Migration
|
2
2
|
def change
|
3
|
-
create_table :
|
3
|
+
create_table :agent_relationship_types do |t|
|
4
4
|
t.string :name, :null => false
|
5
5
|
t.text :display_name
|
6
6
|
t.text :note
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class AddDcndlSchema < ActiveRecord::Migration
|
2
2
|
def self.up
|
3
3
|
add_column :manifestations, :title_alternative_transcription, :text
|
4
|
-
add_column :
|
4
|
+
add_column :agents, :full_name_alternative_transcription, :text
|
5
5
|
add_column :manifestations, :description, :text
|
6
6
|
add_column :manifestations, :abstract, :text
|
7
7
|
add_column :manifestations, :available_at, :timestamp
|
@@ -14,7 +14,7 @@ class AddDcndlSchema < ActiveRecord::Migration
|
|
14
14
|
|
15
15
|
def self.down
|
16
16
|
remove_column :manifestations, :title_alternative_transcription
|
17
|
-
remove_column :
|
17
|
+
remove_column :agents, :full_name_alternative_transcription
|
18
18
|
remove_column :manifestations, :description
|
19
19
|
remove_column :manifestations, :abstract
|
20
20
|
remove_column :manifestations, :available_at
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateAgentRelationships < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :agent_relationships do |t|
|
4
|
+
t.integer :parent_id
|
5
|
+
t.integer :child_id
|
6
|
+
t.integer :agent_relationship_type_id
|
7
|
+
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
add_index :agent_relationships, :parent_id
|
11
|
+
add_index :agent_relationships, :child_id
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class AddPositionToAgentRelationship < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
add_column :manifestation_relationships, :position, :integer
|
4
|
+
add_column :agent_relationships, :position, :integer
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.down
|
8
|
+
remove_column :agent_relationships, :position
|
9
|
+
remove_column :manifestation_relationships, :position
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class AddBirthDateAndDeathDateToAgent < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
add_column :agents, :birth_date, :string
|
4
|
+
add_column :agents, :death_date, :string
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.down
|
8
|
+
remove_column :agents, :death_date
|
9
|
+
remove_column :agents, :birth_date
|
10
|
+
end
|
11
|
+
end
|