enju_biblio 0.1.0.pre42 → 0.1.0.pre43
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/creates_controller.rb +11 -11
- data/app/controllers/items_controller.rb +3 -3
- data/app/controllers/manifestations_controller.rb +14 -14
- data/app/controllers/owns_controller.rb +10 -10
- data/app/controllers/patron_import_files_controller.rb +34 -34
- data/app/controllers/patron_import_results_controller.rb +5 -5
- data/app/controllers/patron_relationship_types_controller.rb +3 -3
- data/app/controllers/patron_relationships_controller.rb +7 -7
- data/app/controllers/patron_types_controller.rb +3 -3
- data/app/controllers/patrons_controller.rb +61 -61
- data/app/controllers/picture_files_controller.rb +4 -4
- data/app/controllers/produces_controller.rb +11 -11
- data/app/controllers/realizes_controller.rb +11 -11
- data/app/helpers/{patrons_helper.rb → agents_helper.rb} +5 -5
- data/app/models/{patron.rb → agent.rb} +36 -36
- data/app/models/{patron_import_file.rb → agent_import_file.rb} +77 -77
- data/app/models/agent_import_result.rb +26 -0
- data/app/models/{patron_relationship.rb → agent_relationship.rb} +7 -7
- data/app/models/{patron_relationship_type.rb → agent_relationship_type.rb} +4 -4
- data/app/models/{patron_sweeper.rb → agent_sweeper.rb} +6 -6
- data/app/models/{patron_type.rb → agent_type.rb} +4 -4
- data/app/models/country.rb +1 -1
- data/app/models/create.rb +7 -7
- data/app/models/donate.rb +5 -5
- data/app/models/enju_biblio/ability.rb +24 -24
- data/app/models/item.rb +5 -5
- data/app/models/item_sweeper.rb +2 -2
- data/app/models/manifestation.rb +24 -20
- data/app/models/own.rb +7 -7
- data/app/models/page_sweeper.rb +4 -4
- data/app/models/picture_file.rb +1 -1
- data/app/models/produce.rb +7 -7
- data/app/models/realize.rb +7 -7
- data/app/models/resource_import_file.rb +19 -19
- data/app/views/{patron_import_files → agent_import_files}/edit.html.erb +6 -6
- data/app/views/agent_import_files/index.html.erb +40 -0
- data/app/views/{patron_import_files → agent_import_files}/new.html.erb +3 -3
- data/app/views/agent_import_files/show.html.erb +69 -0
- data/app/views/agent_import_results/index.csv.erb +3 -0
- data/app/views/agent_import_results/index.html.erb +52 -0
- data/app/views/agent_import_results/show.html.erb +38 -0
- data/app/views/{patron_relationship_types → agent_relationship_types}/_form.html.erb +1 -1
- data/app/views/{patron_relationship_types → agent_relationship_types}/edit.html.erb +3 -3
- data/app/views/agent_relationship_types/index.html.erb +43 -0
- data/app/views/{patron_relationship_types → agent_relationship_types}/new.html.erb +2 -2
- data/app/views/agent_relationship_types/show.html.erb +29 -0
- data/app/views/{patron_relationships → agent_relationships}/_form.html.erb +7 -7
- data/app/views/{patron_relationships → agent_relationships}/edit.html.erb +3 -3
- data/app/views/agent_relationships/index.html.erb +34 -0
- data/app/views/{patron_relationships → agent_relationships}/new.html.erb +2 -2
- data/app/views/agent_relationships/show.html.erb +24 -0
- data/app/views/{patron_types → agent_types}/_form.html.erb +1 -1
- data/app/views/{patron_types → agent_types}/edit.html.erb +3 -3
- data/app/views/agent_types/index.html.erb +43 -0
- data/app/views/{patron_types → agent_types}/new.html.erb +2 -2
- data/app/views/agent_types/show.html.erb +29 -0
- data/app/views/{patrons → agents}/_expression_list.html.erb +3 -3
- data/app/views/{patrons → agents}/_form.html.erb +9 -9
- data/app/views/{patrons → agents}/_form_family_name_first.html.erb +0 -0
- data/app/views/{patrons → agents}/_form_family_name_last.html.erb +0 -0
- data/app/views/{patrons → agents}/_history_list.html.erb +2 -2
- data/app/views/{patrons → agents}/_index.html.erb +9 -9
- data/app/views/{patrons → agents}/_index_expression.html.erb +15 -15
- data/app/views/{patrons → agents}/_index_manifestation.html.erb +16 -16
- data/app/views/agents/_index_patron.html.erb +71 -0
- data/app/views/agents/_index_patron_merge_list.html.erb +53 -0
- data/app/views/{patrons → agents}/_index_work.html.erb +17 -17
- data/app/views/{patrons → agents}/_manifestation_list.html.erb +3 -3
- data/app/views/agents/_patron.html.erb +13 -0
- data/app/views/agents/_patron_list.html.erb +18 -0
- data/app/views/{patrons → agents}/_work_list.html.erb +1 -1
- data/app/views/agents/edit.html.erb +16 -0
- data/app/views/agents/index.atom.builder +10 -0
- data/app/views/{patrons → agents}/index.html.erb +4 -4
- data/app/views/{patrons → agents}/index.mobile.erb +5 -5
- data/app/views/{patrons → agents}/index.rss.builder +11 -11
- data/app/views/{patrons → agents}/new.html.erb +2 -2
- data/app/views/agents/show.html.erb +152 -0
- data/app/views/{patrons → agents}/show.js.erb +0 -0
- data/app/views/agents/show.mobile.erb +69 -0
- data/app/views/creates/_form.html.erb +5 -5
- data/app/views/creates/_index.html.erb +2 -2
- data/app/views/creates/_index_patron.html.erb +6 -6
- data/app/views/creates/_index_work.html.erb +2 -2
- data/app/views/creates/index.html.erb +2 -2
- data/app/views/creates/new.html.erb +3 -3
- data/app/views/creates/show.html.erb +4 -4
- data/app/views/donates/edit.html.erb +2 -2
- data/app/views/donates/index.html.erb +2 -2
- data/app/views/donates/new.html.erb +2 -2
- data/app/views/donates/show.html.erb +2 -2
- data/app/views/items/index.html.erb +1 -1
- data/app/views/languages/index.html.erb +1 -1
- data/app/views/layouts/patrons.html.erb +2 -2
- data/app/views/manifestations/_index_form_contributor.html.erb +1 -1
- data/app/views/manifestations/_index_form_creator.html.erb +1 -1
- data/app/views/manifestations/_index_form_publisher.html.erb +1 -1
- data/app/views/manifestations/_manifestation_list.html.erb +6 -6
- data/app/views/manifestations/_show.mods.builder +4 -4
- data/app/views/manifestations/_show.rdf.builder +4 -4
- data/app/views/manifestations/_show_creators.html.erb +4 -4
- data/app/views/manifestations/_show_creators.mobile.erb +4 -4
- data/app/views/manifestations/_title.html.erb +3 -3
- data/app/views/manifestations/_title.mobile.erb +3 -3
- data/app/views/manifestations/edit.html.erb +2 -2
- data/app/views/manifestations/index.atom.builder +2 -2
- data/app/views/manifestations/index.html.erb +3 -3
- data/app/views/manifestations/index.opds.builder +2 -2
- data/app/views/manifestations/index.sru.builder +6 -6
- data/app/views/manifestations/new.html.erb +2 -2
- data/app/views/notifier/manifestation_info.en.text.erb +1 -1
- data/app/views/notifier/manifestation_info.ja.text.erb +1 -1
- data/app/views/owns/_form.html.erb +1 -1
- data/app/views/owns/index.html.erb +2 -2
- data/app/views/owns/show.html.erb +4 -4
- data/app/views/picture_files/_index.html.erb +1 -1
- data/app/views/picture_files/_index_patron.html.erb +2 -2
- data/app/views/picture_files/index.html.erb +2 -2
- data/app/views/picture_files/show.html.erb +2 -2
- data/app/views/produces/_form.html.erb +5 -5
- data/app/views/produces/_index.html.erb +2 -2
- data/app/views/produces/_index_manifestation.html.erb +3 -3
- data/app/views/produces/_index_patron.html.erb +3 -3
- data/app/views/produces/index.html.erb +2 -2
- data/app/views/produces/new.html.erb +3 -3
- data/app/views/produces/show.html.erb +4 -4
- data/app/views/realizes/_form.html.erb +5 -5
- data/app/views/realizes/_index.html.erb +2 -2
- data/app/views/realizes/_index_expression.html.erb +3 -3
- data/app/views/realizes/_index_patron.html.erb +3 -3
- data/app/views/realizes/index.html.erb +2 -2
- data/app/views/realizes/new.html.erb +3 -3
- data/app/views/realizes/show.html.erb +4 -4
- data/app/views/resource_import_results/show.html.erb +1 -1
- data/config/routes.rb +16 -16
- data/db/migrate/{001_create_patrons.rb → 001_create_agents.rb} +8 -8
- data/db/migrate/012_create_owns.rb +2 -2
- data/db/migrate/015_create_creates.rb +2 -2
- data/db/migrate/047_create_produces.rb +2 -2
- data/db/migrate/125_create_donates.rb +2 -2
- data/db/migrate/20080830154109_create_realizes.rb +2 -2
- data/db/migrate/{20080905191442_create_patron_types.rb → 20080905191442_create_agent_types.rb} +2 -2
- data/db/migrate/20081028083142_create_agent_import_files.rb +22 -0
- data/db/migrate/{20090812151902_create_patron_relationship_types.rb → 20090812151902_create_agent_relationship_types.rb} +2 -2
- data/db/migrate/20091012101112_add_dcndl_schema.rb +2 -2
- data/db/migrate/20100606073747_create_agent_relationships.rb +13 -0
- data/db/migrate/20100814091104_add_position_to_agent_relationship.rb +11 -0
- data/db/migrate/20100925074559_create_agent_import_results.rb +12 -0
- data/db/migrate/20110301121550_add_birth_date_and_death_date_to_agent.rb +11 -0
- data/db/migrate/20120413161403_add_fingerprint_to_agent_import_file.rb +5 -0
- data/db/migrate/20120413170720_add_error_message_to_agent_import_file.rb +5 -0
- data/db/migrate/20120511072422_add_agent_identifier_to_agent.rb +6 -0
- data/db/migrate/20120602141129_add_edit_mode_to_agent_import_file.rb +5 -0
- data/lib/enju_biblio/biblio_helper.rb +8 -8
- data/lib/enju_biblio/version.rb +1 -1
- data/lib/enju_biblio.rb +3 -3
- data/lib/generators/enju_biblio/setup/templates/db/fixtures/patron_relationship_types.yml +3 -3
- data/lib/generators/enju_biblio/setup/templates/db/fixtures/patron_types.yml +2 -2
- data/lib/generators/enju_biblio/setup/templates/db/fixtures/patrons.yml +4 -4
- data/spec/controllers/agent_import_files_controller_spec.rb +321 -0
- data/spec/controllers/{patron_import_results_controller_spec.rb → agent_import_results_controller_spec.rb} +17 -17
- data/spec/controllers/agent_relationship_types_controller_spec.rb +445 -0
- data/spec/controllers/agent_relationships_controller_spec.rb +446 -0
- data/spec/controllers/agent_types_controller_spec.rb +447 -0
- data/spec/controllers/agents_controller_spec.rb +644 -0
- data/spec/controllers/countries_controller_spec.rb +1 -1
- data/spec/controllers/items_controller_spec.rb +4 -4
- data/spec/controllers/manifestation_relationship_types_controller_spec.rb +1 -1
- data/spec/controllers/manifestations_controller_spec.rb +4 -4
- data/spec/controllers/owns_controller_spec.rb +2 -2
- data/spec/controllers/resource_import_files_controller_spec.rb +1 -1
- data/spec/dummy/app/helpers/application_helper.rb +5 -222
- data/spec/dummy/app/models/ability.rb +31 -31
- data/spec/dummy/app/models/{local_patron.rb → local_agent.rb} +1 -1
- data/spec/dummy/app/models/user.rb +3 -3
- data/spec/dummy/config/application.rb +0 -1
- data/spec/dummy/config/environments/test.rb +1 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/035_create_reserves.rb +1 -1
- data/spec/dummy/db/migrate/20090519203307_create_participates.rb +2 -2
- data/spec/dummy/db/schema.rb +132 -132
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/private/system/agent_import_files/agent_imports/000/000/004/original/agent_delete_file.tsv +8 -0
- data/spec/dummy/private/system/agent_import_files/agent_imports/000/000/004/original/agent_import_file_sample1.tsv +5 -0
- data/spec/dummy/private/system/agent_import_files/agent_imports/000/000/004/original/agent_import_file_sample2.tsv +8 -0
- data/spec/dummy/private/system/agent_import_files/agent_imports/000/000/004/original/agent_import_file_sample3.tsv +5 -0
- data/spec/dummy/private/system/agent_import_files/agent_imports/000/000/004/original/agent_update_file.tsv +3 -0
- data/spec/dummy/solr/data/test/index/segments.gen +0 -0
- data/spec/dummy/solr/data/test/index/segments_q76 +0 -0
- data/spec/factories/{patron.rb → agent.rb} +3 -3
- data/spec/factories/create.rb +1 -1
- data/spec/factories/donate.rb +1 -1
- data/spec/factories/own.rb +1 -1
- data/spec/factories/patron_relationship.rb +3 -3
- data/spec/factories/patron_relationship_type.rb +2 -2
- data/spec/factories/patron_type.rb +2 -2
- data/spec/factories/produce.rb +1 -1
- data/spec/factories/realize.rb +1 -1
- data/spec/fixtures/{patron_import_files.yml → agent_import_files.yml} +18 -18
- data/spec/fixtures/{patron_import_results.yml → agent_import_results.yml} +7 -7
- data/spec/fixtures/{patron_relationship_types.yml → agent_relationship_types.yml} +4 -4
- data/spec/fixtures/{patron_relationships.yml → agent_relationships.yml} +4 -4
- data/spec/fixtures/{patron_types.yml → agent_types.yml} +4 -4
- data/spec/fixtures/{patrons.yml → agents.yml} +47 -47
- data/spec/fixtures/creates.yml +8 -8
- data/spec/fixtures/donates.yml +4 -4
- data/spec/fixtures/owns.yml +3 -3
- data/spec/fixtures/picture_files.yml +1 -1
- data/spec/fixtures/produces.yml +20 -20
- data/spec/fixtures/realizes.yml +11 -11
- data/spec/fixtures/reserves.yml +1 -1
- data/spec/models/agent_import_file_spec.rb +96 -0
- data/spec/models/{patron_import_result_spec.rb → agent_import_result_spec.rb} +4 -4
- data/spec/models/{patron_relationship_spec.rb → agent_relationship_spec.rb} +3 -3
- data/spec/models/{patron_relationship_type_spec.rb → agent_relationship_type_spec.rb} +2 -2
- data/spec/models/{patron_spec.rb → agent_spec.rb} +16 -16
- data/spec/models/{patron_type_spec.rb → agent_type_spec.rb} +2 -2
- data/spec/models/create_spec.rb +1 -1
- data/spec/models/donate_spec.rb +1 -1
- data/spec/models/manifestation_spec.rb +1 -1
- data/spec/models/own_spec.rb +1 -1
- data/spec/models/produce_spec.rb +1 -1
- data/spec/models/realize_spec.rb +1 -1
- data/spec/models/resource_import_file_spec.rb +8 -8
- data/spec/requests/agents_spec.rb +9 -0
- data/spec/routing/agent_relationship_types_routing_spec.rb +35 -0
- data/spec/routing/agent_relationships_routing_spec.rb +35 -0
- data/spec/routing/agents_routing_spec.rb +35 -0
- data/spec/views/creates/edit.html.erb_spec.rb +1 -1
- data/spec/views/creates/index.html.erb_spec.rb +2 -2
- data/spec/views/creates/new.html.erb_spec.rb +1 -1
- data/spec/views/creates/show.html.erb_spec.rb +1 -1
- data/spec/views/owns/edit.html.erb_spec.rb +1 -1
- data/spec/views/owns/index.html.erb_spec.rb +2 -2
- data/spec/views/owns/new.html.erb_spec.rb +1 -1
- data/spec/views/owns/show.html.erb_spec.rb +1 -1
- data/spec/views/produces/edit.html.erb_spec.rb +2 -2
- data/spec/views/produces/index.html.erb_spec.rb +2 -2
- data/spec/views/produces/new.html.erb_spec.rb +2 -2
- data/spec/views/produces/show.html.erb_spec.rb +1 -1
- data/spec/views/realizes/edit.html.erb_spec.rb +2 -2
- data/spec/views/realizes/index.html.erb_spec.rb +2 -2
- data/spec/views/realizes/new.html.erb_spec.rb +2 -2
- data/spec/views/realizes/show.html.erb_spec.rb +1 -1
- metadata +131 -187
- data/app/models/patron_import_result.rb +0 -26
- data/app/views/patron_import_files/index.html.erb +0 -40
- data/app/views/patron_import_files/show.html.erb +0 -69
- data/app/views/patron_import_results/index.csv.erb +0 -3
- data/app/views/patron_import_results/index.html.erb +0 -52
- data/app/views/patron_import_results/show.html.erb +0 -38
- data/app/views/patron_relationship_types/index.html.erb +0 -43
- data/app/views/patron_relationship_types/show.html.erb +0 -29
- data/app/views/patron_relationships/index.html.erb +0 -34
- data/app/views/patron_relationships/show.html.erb +0 -24
- data/app/views/patron_types/index.html.erb +0 -43
- data/app/views/patron_types/show.html.erb +0 -29
- data/app/views/patrons/_index_patron.html.erb +0 -71
- data/app/views/patrons/_index_patron_merge_list.html.erb +0 -53
- data/app/views/patrons/_patron.html.erb +0 -13
- data/app/views/patrons/_patron_list.html.erb +0 -18
- data/app/views/patrons/edit.html.erb +0 -16
- data/app/views/patrons/index.atom.builder +0 -10
- data/app/views/patrons/show.html.erb +0 -152
- data/app/views/patrons/show.mobile.erb +0 -69
- data/db/migrate/20081028083142_create_patron_import_files.rb +0 -22
- data/db/migrate/20100606073747_create_patron_relationships.rb +0 -13
- data/db/migrate/20100814091104_add_position_to_patron_relationship.rb +0 -11
- data/db/migrate/20100925074559_create_patron_import_results.rb +0 -12
- data/db/migrate/20110301121550_add_birth_date_and_death_date_to_patron.rb +0 -11
- data/db/migrate/20120413161403_add_fingerprint_to_patron_import_file.rb +0 -5
- data/db/migrate/20120413170720_add_error_message_to_patron_import_file.rb +0 -5
- data/db/migrate/20120511072422_add_patron_identifier_to_patron.rb +0 -6
- data/db/migrate/20120602141129_add_edit_mode_to_patron_import_file.rb +0 -5
- data/spec/controllers/patron_import_files_controller_spec.rb +0 -321
- data/spec/controllers/patron_relationship_types_controller_spec.rb +0 -445
- data/spec/controllers/patron_relationships_controller_spec.rb +0 -446
- data/spec/controllers/patron_types_controller_spec.rb +0 -447
- data/spec/controllers/patrons_controller_spec.rb +0 -644
- data/spec/dummy/app/mailers/notifier.rb +0 -40
- data/spec/dummy/lib/plugins/ext/event-calendar.rb +0 -38
- data/spec/dummy/lib/plugins/ext/sunspot/abstract_search.rb +0 -12
- data/spec/dummy/lib/plugins/ext/sunspot/dismax.rb +0 -41
- data/spec/dummy/lib/plugins/ext/sunspot/start_record.rb +0 -55
- data/spec/dummy/lib/plugins/ext/sunspot.rb +0 -3
- data/spec/dummy/lib/plugins/ext.rb +0 -1
- data/spec/dummy/lib/plugins.rb +0 -2
- data/spec/dummy/solr/data/test/index/_goc.fdt +0 -0
- data/spec/dummy/solr/data/test/index/_goc.fdx +0 -0
- data/spec/dummy/solr/data/test/index/_goc.fnm +0 -7
- data/spec/dummy/solr/data/test/index/_goc.frq +0 -0
- data/spec/dummy/solr/data/test/index/_goc.nrm +0 -1
- data/spec/dummy/solr/data/test/index/_goc.prx +0 -0
- data/spec/dummy/solr/data/test/index/_goc.tii +0 -0
- data/spec/dummy/solr/data/test/index/_goc.tis +0 -0
- data/spec/dummy/solr/data/test/index/_god.fdt +0 -0
- data/spec/dummy/solr/data/test/index/_god.fdx +0 -0
- data/spec/dummy/solr/data/test/index/_god.fnm +0 -7
- data/spec/dummy/solr/data/test/index/_god.frq +0 -0
- data/spec/dummy/solr/data/test/index/_god.nrm +0 -1
- data/spec/dummy/solr/data/test/index/_god.prx +0 -0
- data/spec/dummy/solr/data/test/index/_god.tii +0 -0
- data/spec/dummy/solr/data/test/index/_god.tis +0 -0
- data/spec/dummy/solr/data/test/index/_goe.fdt +0 -0
- data/spec/dummy/solr/data/test/index/_goe.fdx +0 -0
- data/spec/dummy/solr/data/test/index/_goe.fnm +0 -8
- data/spec/dummy/solr/data/test/index/_goe.frq +0 -0
- data/spec/dummy/solr/data/test/index/_goe.nrm +0 -1
- data/spec/dummy/solr/data/test/index/_goe.prx +0 -0
- data/spec/dummy/solr/data/test/index/_goe.tii +0 -0
- data/spec/dummy/solr/data/test/index/_goe.tis +0 -0
- data/spec/dummy/solr/data/test/index/segments_otc +0 -0
- data/spec/dummy/tmp/cache/4AD/470/country_all +0 -0
- data/spec/models/patron_import_file_spec.rb +0 -96
- data/spec/requests/patrons_spec.rb +0 -9
- data/spec/routing/patron_relationship_types_routing_spec.rb +0 -35
- data/spec/routing/patron_relationships_routing_spec.rb +0 -35
- data/spec/routing/patrons_routing_spec.rb +0 -35
@@ -1,22 +1,22 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
class
|
2
|
+
class AgentsController < ApplicationController
|
3
3
|
load_and_authorize_resource :except => :index
|
4
4
|
authorize_resource :only => :index
|
5
|
-
before_filter :get_work, :get_expression, :get_manifestation, :get_item, :
|
5
|
+
before_filter :get_work, :get_expression, :get_manifestation, :get_item, :get_agent, :except => [:update, :destroy]
|
6
6
|
if defined?(EnjuResourceMerge)
|
7
|
-
before_filter :
|
7
|
+
before_filter :get_agent_merge_list, :except => [:create, :update, :destroy]
|
8
8
|
end
|
9
9
|
before_filter :prepare_options, :only => [:new, :edit]
|
10
10
|
before_filter :store_location
|
11
11
|
before_filter :get_version, :only => [:show]
|
12
12
|
after_filter :solr_commit, :only => [:create, :update, :destroy]
|
13
|
-
cache_sweeper :
|
13
|
+
cache_sweeper :agent_sweeper, :only => [:create, :update, :destroy]
|
14
14
|
|
15
|
-
# GET /
|
16
|
-
# GET /
|
15
|
+
# GET /agents
|
16
|
+
# GET /agents.json
|
17
17
|
def index
|
18
18
|
#session[:params] = {} unless session[:params]
|
19
|
-
#session[:params][:
|
19
|
+
#session[:params][:agent] = params
|
20
20
|
# 最近追加されたパトロン
|
21
21
|
#@query = params[:query] ||= "[* TO *]"
|
22
22
|
if params[:mode] == 'add'
|
@@ -35,12 +35,12 @@ class PatronsController < ApplicationController
|
|
35
35
|
order = nil
|
36
36
|
@count = {}
|
37
37
|
|
38
|
-
search =
|
39
|
-
search.data_accessor_for(
|
38
|
+
search = Agent.search(:include => [:agent_type, :required_role])
|
39
|
+
search.data_accessor_for(Agent).select = [
|
40
40
|
:id,
|
41
41
|
:full_name,
|
42
42
|
:full_name_transcription,
|
43
|
-
:
|
43
|
+
:agent_type_id,
|
44
44
|
:required_role_id,
|
45
45
|
:created_at,
|
46
46
|
:updated_at,
|
@@ -61,14 +61,14 @@ class PatronsController < ApplicationController
|
|
61
61
|
work = @work
|
62
62
|
expression = @expression
|
63
63
|
manifestation = @manifestation
|
64
|
-
|
65
|
-
|
64
|
+
agent = @agent
|
65
|
+
agent_merge_list = @agent_merge_list
|
66
66
|
search.build do
|
67
67
|
with(:work_ids).equal_to work.id if work
|
68
68
|
with(:expression_ids).equal_to expression.id if expression
|
69
69
|
with(:manifestation_ids).equal_to manifestation.id if manifestation
|
70
|
-
with(:
|
71
|
-
with(:
|
70
|
+
with(:original_agent_ids).equal_to agent.id if agent
|
71
|
+
with(:agent_merge_list_ids).equal_to agent_merge_list.id if agent_merge_list
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
@@ -79,138 +79,138 @@ class PatronsController < ApplicationController
|
|
79
79
|
|
80
80
|
page = params[:page].to_i || 1
|
81
81
|
page = 1 if page == 0
|
82
|
-
search.query.paginate(page,
|
83
|
-
@
|
82
|
+
search.query.paginate(page, Agent.default_per_page)
|
83
|
+
@agents = search.execute!.results
|
84
84
|
|
85
85
|
flash[:page_info] = {:page => page, :query => query}
|
86
86
|
|
87
87
|
respond_to do |format|
|
88
88
|
format.html # index.html.erb
|
89
|
-
format.xml { render :xml => @
|
89
|
+
format.xml { render :xml => @agents }
|
90
90
|
format.rss { render :layout => false }
|
91
91
|
format.atom
|
92
|
-
format.json { render :json => @
|
92
|
+
format.json { render :json => @agents }
|
93
93
|
format.mobile
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
97
|
-
# GET /
|
98
|
-
# GET /
|
97
|
+
# GET /agents/1
|
98
|
+
# GET /agents/1.json
|
99
99
|
def show
|
100
100
|
case
|
101
101
|
when @work
|
102
|
-
@
|
102
|
+
@agent = @work.creators.find(params[:id])
|
103
103
|
when @manifestation
|
104
|
-
@
|
104
|
+
@agent = @manifestation.publishers.find(params[:id])
|
105
105
|
when @item
|
106
|
-
@
|
106
|
+
@agent = @item.agents.find(params[:id])
|
107
107
|
else
|
108
108
|
if @version
|
109
|
-
@
|
109
|
+
@agent = @agent.versions.find(@version).item if @version
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
|
-
|
113
|
+
agent = @agent
|
114
114
|
role = current_user.try(:role) || Role.default_role
|
115
115
|
@works = Manifestation.search do
|
116
|
-
with(:creator_ids).equal_to
|
116
|
+
with(:creator_ids).equal_to agent.id
|
117
117
|
with(:required_role_id).less_than_or_equal_to role.id
|
118
118
|
paginate :page => params[:work_list_page], :per_page => Manifestation.default_per_page
|
119
119
|
end.results
|
120
120
|
@expressions = Manifestation.search do
|
121
|
-
with(:contributor_ids).equal_to
|
121
|
+
with(:contributor_ids).equal_to agent.id
|
122
122
|
with(:required_role_id).less_than_or_equal_to role.id
|
123
123
|
paginate :page => params[:expression_list_page], :per_page => Manifestation.default_per_page
|
124
124
|
end.results
|
125
125
|
@manifestations = Manifestation.search do
|
126
|
-
with(:publisher_ids).equal_to
|
126
|
+
with(:publisher_ids).equal_to agent.id
|
127
127
|
with(:required_role_id).less_than_or_equal_to role.id
|
128
128
|
paginate :page => params[:manifestation_list_page], :per_page => Manifestation.default_per_page
|
129
129
|
end.results
|
130
130
|
|
131
131
|
respond_to do |format|
|
132
132
|
format.html # show.html.erb
|
133
|
-
format.json { render :json => @
|
133
|
+
format.json { render :json => @agent }
|
134
134
|
format.js
|
135
135
|
format.mobile
|
136
136
|
end
|
137
137
|
end
|
138
138
|
|
139
|
-
# GET /
|
140
|
-
# GET /
|
139
|
+
# GET /agents/new
|
140
|
+
# GET /agents/new.json
|
141
141
|
def new
|
142
|
-
@
|
143
|
-
@
|
144
|
-
@
|
145
|
-
@
|
142
|
+
@agent = Agent.new
|
143
|
+
@agent.required_role = Role.where(:name => 'Guest').first
|
144
|
+
@agent.language = Language.where(:iso_639_1 => I18n.default_locale.to_s).first || Language.first
|
145
|
+
@agent.country = current_user.library.country
|
146
146
|
prepare_options
|
147
147
|
|
148
148
|
respond_to do |format|
|
149
149
|
format.html # new.html.erb
|
150
|
-
format.json { render :json => @
|
150
|
+
format.json { render :json => @agent }
|
151
151
|
end
|
152
152
|
end
|
153
153
|
|
154
|
-
# GET /
|
154
|
+
# GET /agents/1/edit
|
155
155
|
def edit
|
156
156
|
prepare_options
|
157
157
|
end
|
158
158
|
|
159
|
-
# POST /
|
160
|
-
# POST /
|
159
|
+
# POST /agents
|
160
|
+
# POST /agents.json
|
161
161
|
def create
|
162
|
-
@
|
163
|
-
#if @
|
164
|
-
# @
|
162
|
+
@agent = Agent.new(params[:agent])
|
163
|
+
#if @agent.user_username
|
164
|
+
# @agent.user = User.find(@agent.user_username) rescue nil
|
165
165
|
#end
|
166
166
|
#unless current_user.has_role?('Librarian')
|
167
|
-
# if @
|
167
|
+
# if @agent.user != current_user
|
168
168
|
# access_denied; return
|
169
169
|
# end
|
170
170
|
#end
|
171
171
|
|
172
172
|
respond_to do |format|
|
173
|
-
if @
|
173
|
+
if @agent.save
|
174
174
|
case
|
175
175
|
when @work
|
176
|
-
@
|
176
|
+
@agent.works << @work
|
177
177
|
when @manifestation
|
178
|
-
@
|
178
|
+
@agent.manifestations << @manifestation
|
179
179
|
when @item
|
180
|
-
@
|
180
|
+
@agent.items << @item
|
181
181
|
end
|
182
|
-
format.html { redirect_to @
|
183
|
-
format.json { render :json => @
|
182
|
+
format.html { redirect_to @agent, :notice => t('controller.successfully_created', :model => t('activerecord.models.agent')) }
|
183
|
+
format.json { render :json => @agent, :status => :created, :location => @agent }
|
184
184
|
else
|
185
185
|
prepare_options
|
186
186
|
format.html { render :action => "new" }
|
187
|
-
format.json { render :json => @
|
187
|
+
format.json { render :json => @agent.errors, :status => :unprocessable_entity }
|
188
188
|
end
|
189
189
|
end
|
190
190
|
end
|
191
191
|
|
192
|
-
# PUT /
|
193
|
-
# PUT /
|
192
|
+
# PUT /agents/1
|
193
|
+
# PUT /agents/1.json
|
194
194
|
def update
|
195
195
|
respond_to do |format|
|
196
|
-
if @
|
197
|
-
format.html { redirect_to @
|
196
|
+
if @agent.update_attributes(params[:agent])
|
197
|
+
format.html { redirect_to @agent, :notice => t('controller.successfully_updated', :model => t('activerecord.models.agent')) }
|
198
198
|
format.json { head :no_content }
|
199
199
|
else
|
200
200
|
prepare_options
|
201
201
|
format.html { render :action => "edit" }
|
202
|
-
format.json { render :json => @
|
202
|
+
format.json { render :json => @agent.errors, :status => :unprocessable_entity }
|
203
203
|
end
|
204
204
|
end
|
205
205
|
end
|
206
206
|
|
207
|
-
# DELETE /
|
208
|
-
# DELETE /
|
207
|
+
# DELETE /agents/1
|
208
|
+
# DELETE /agents/1.json
|
209
209
|
def destroy
|
210
|
-
@
|
210
|
+
@agent.destroy
|
211
211
|
|
212
212
|
respond_to do |format|
|
213
|
-
format.html { redirect_to
|
213
|
+
format.html { redirect_to agents_url, :notice => t('controller.successfully_deleted', :model => t('activerecord.models.agent')) }
|
214
214
|
format.json { head :no_content }
|
215
215
|
end
|
216
216
|
end
|
@@ -218,9 +218,9 @@ class PatronsController < ApplicationController
|
|
218
218
|
private
|
219
219
|
def prepare_options
|
220
220
|
@countries = Country.all_cache
|
221
|
-
@
|
221
|
+
@agent_types = AgentType.all
|
222
222
|
@roles = Role.all
|
223
223
|
@languages = Language.all_cache
|
224
|
-
@
|
224
|
+
@agent_type = AgentType.where(:name => 'Person').first
|
225
225
|
end
|
226
226
|
end
|
@@ -59,7 +59,7 @@ class PictureFilesController < ApplicationController
|
|
59
59
|
redirect_to picture_files_url
|
60
60
|
return
|
61
61
|
end
|
62
|
-
#raise unless @event or @manifestation or @shelf or @
|
62
|
+
#raise unless @event or @manifestation or @shelf or @agent
|
63
63
|
@picture_file = PictureFile.new
|
64
64
|
@picture_file.picture_attachable = @attachable
|
65
65
|
|
@@ -140,9 +140,9 @@ class PictureFilesController < ApplicationController
|
|
140
140
|
@attachable = @manifestation
|
141
141
|
return
|
142
142
|
end
|
143
|
-
|
144
|
-
if @
|
145
|
-
@attachable = @
|
143
|
+
get_agent
|
144
|
+
if @agent
|
145
|
+
@attachable = @agent
|
146
146
|
return
|
147
147
|
end
|
148
148
|
get_event
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class ProducesController < ApplicationController
|
2
2
|
load_and_authorize_resource
|
3
|
-
before_filter :
|
3
|
+
before_filter :get_agent, :get_manifestation
|
4
4
|
before_filter :prepare_options, :only => [:new, :edit]
|
5
5
|
after_filter :solr_commit, :only => [:create, :update, :destroy]
|
6
6
|
cache_sweeper :page_sweeper, :only => [:create, :update, :destroy]
|
@@ -9,8 +9,8 @@ class ProducesController < ApplicationController
|
|
9
9
|
# GET /produces.json
|
10
10
|
def index
|
11
11
|
case
|
12
|
-
when @
|
13
|
-
@produces = @
|
12
|
+
when @agent
|
13
|
+
@produces = @agent.produces.order('produces.position').page(params[:page])
|
14
14
|
when @manifestation
|
15
15
|
@produces = @manifestation.produces.order('produces.position').page(params[:page])
|
16
16
|
else
|
@@ -39,16 +39,16 @@ class ProducesController < ApplicationController
|
|
39
39
|
|
40
40
|
# GET /produces/new
|
41
41
|
def new
|
42
|
-
if @
|
43
|
-
redirect_to
|
42
|
+
if @agent and @manifestation.blank?
|
43
|
+
redirect_to agent_manifestations_url(@agent)
|
44
44
|
return
|
45
|
-
elsif @manifestation and @
|
46
|
-
redirect_to
|
45
|
+
elsif @manifestation and @agent.blank?
|
46
|
+
redirect_to manifestation_agents_url(@manifestation)
|
47
47
|
return
|
48
48
|
else
|
49
49
|
@produce = Produce.new
|
50
50
|
@produce.manifestation = @manifestation
|
51
|
-
@produce.
|
51
|
+
@produce.agent = @agent
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -103,10 +103,10 @@ class ProducesController < ApplicationController
|
|
103
103
|
format.html {
|
104
104
|
flash[:notice] = t('controller.successfully_deleted', :model => t('activerecord.models.produce'))
|
105
105
|
case
|
106
|
-
when @
|
107
|
-
redirect_to
|
106
|
+
when @agent
|
107
|
+
redirect_to agent_manifestations_url(@agent)
|
108
108
|
when @manifestation
|
109
|
-
redirect_to
|
109
|
+
redirect_to manifestation_agents_url(@manifestation)
|
110
110
|
else
|
111
111
|
redirect_to produces_url
|
112
112
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class RealizesController < ApplicationController
|
2
2
|
load_and_authorize_resource
|
3
|
-
before_filter :
|
3
|
+
before_filter :get_agent, :get_expression
|
4
4
|
before_filter :prepare_options, :only => [:new, :edit]
|
5
5
|
after_filter :solr_commit, :only => [:create, :update, :destroy]
|
6
6
|
cache_sweeper :page_sweeper, :only => [:create, :update, :destroy]
|
@@ -9,8 +9,8 @@ class RealizesController < ApplicationController
|
|
9
9
|
# GET /realizes.json
|
10
10
|
def index
|
11
11
|
case
|
12
|
-
when @
|
13
|
-
@realizes = @
|
12
|
+
when @agent
|
13
|
+
@realizes = @agent.realizes.order('realizes.position').page(params[:page])
|
14
14
|
when @expression
|
15
15
|
@realizes = @expression.realizes.order('realizes.position').page(params[:page])
|
16
16
|
else
|
@@ -34,16 +34,16 @@ class RealizesController < ApplicationController
|
|
34
34
|
|
35
35
|
# GET /realizes/new
|
36
36
|
def new
|
37
|
-
if @expression and @
|
38
|
-
redirect_to
|
37
|
+
if @expression and @agent.blank?
|
38
|
+
redirect_to expression_agents_url(@expression)
|
39
39
|
return
|
40
|
-
elsif @
|
41
|
-
redirect_to
|
40
|
+
elsif @agent and @expression.blank?
|
41
|
+
redirect_to agent_expressions_url(@agent)
|
42
42
|
return
|
43
43
|
else
|
44
44
|
@realize = Realize.new
|
45
45
|
@realize.expression = @expression
|
46
|
-
@realize.
|
46
|
+
@realize.agent = @agent
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -100,9 +100,9 @@ class RealizesController < ApplicationController
|
|
100
100
|
flash[:notice] = t('controller.successfully_deleted', :model => t('activerecord.models.realize'))
|
101
101
|
case
|
102
102
|
when @expression
|
103
|
-
redirect_to
|
104
|
-
when @
|
105
|
-
redirect_to
|
103
|
+
redirect_to expression_agents_url(@expression)
|
104
|
+
when @agent
|
105
|
+
redirect_to agent_expressions_url(@agent)
|
106
106
|
else
|
107
107
|
redirect_to realizes_url
|
108
108
|
end
|
@@ -1,13 +1,13 @@
|
|
1
|
-
module
|
1
|
+
module AgentsHelper
|
2
2
|
include PictureFilesHelper
|
3
|
-
def
|
3
|
+
def agent_custom_book_jacket(agent)
|
4
4
|
link = ''
|
5
|
-
|
5
|
+
agent.picture_files.each_with_index do |picture_file, i|
|
6
6
|
if i == 0
|
7
|
-
link += link_to(show_image(picture_file, :size => :thumb), picture_file_path(picture_file, :format => :download), :rel => "
|
7
|
+
link += link_to(show_image(picture_file, :size => :thumb), picture_file_path(picture_file, :format => :download), :rel => "agent_#{agent.id}")
|
8
8
|
else
|
9
9
|
link += content_tag :span, :style => "display: none" do
|
10
|
-
link_to(show_image(picture_file, :size => :thumb), picture_file_path(picture_file, :format => :download), :rel => "
|
10
|
+
link_to(show_image(picture_file, :size => :thumb), picture_file_path(picture_file, :format => :download), :rel => "agent_#{agent.id}")
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
class
|
2
|
+
class Agent < ActiveRecord::Base
|
3
3
|
enju_export if defined?(EnjuExport)
|
4
4
|
attr_accessible :last_name, :middle_name, :first_name,
|
5
5
|
:last_name_transcription, :middle_name_transcription,
|
6
6
|
:first_name_transcription, :corporate_name, :corporate_name_transcription,
|
7
7
|
:full_name, :full_name_transcription, :full_name_alternative,
|
8
8
|
:other_designation, :language_id,
|
9
|
-
:country_id, :
|
9
|
+
:country_id, :agent_type_id, :note, :required_role_id, :email, :url,
|
10
10
|
:full_name_alternative_transcription, :title,
|
11
|
-
:
|
11
|
+
:agent_identifier
|
12
12
|
|
13
13
|
scope :readable_by, lambda{|user| {:conditions => ['required_role_id <= ?', user.try(:user_has_role).try(:role_id) || Role.where(:name => 'Guest').select(:id).first.id]}}
|
14
14
|
has_many :creates, :dependent => :destroy
|
@@ -17,28 +17,28 @@ class Patron < ActiveRecord::Base
|
|
17
17
|
has_many :expressions, :through => :realizes
|
18
18
|
has_many :produces, :dependent => :destroy
|
19
19
|
has_many :manifestations, :through => :produces
|
20
|
-
has_many :children, :foreign_key => 'parent_id', :class_name => '
|
21
|
-
has_many :parents, :foreign_key => 'child_id', :class_name => '
|
22
|
-
has_many :
|
23
|
-
has_many :
|
20
|
+
has_many :children, :foreign_key => 'parent_id', :class_name => 'AgentRelationship', :dependent => :destroy
|
21
|
+
has_many :parents, :foreign_key => 'child_id', :class_name => 'AgentRelationship', :dependent => :destroy
|
22
|
+
has_many :derived_agents, :through => :children, :source => :child
|
23
|
+
has_many :original_agents, :through => :parents, :source => :parent
|
24
24
|
has_many :picture_files, :as => :picture_attachable, :dependent => :destroy
|
25
25
|
has_many :donates
|
26
26
|
has_many :donated_items, :through => :donates, :source => :item
|
27
27
|
has_many :owns, :dependent => :destroy
|
28
28
|
has_many :items, :through => :owns
|
29
29
|
if defined?(EnjuResourceMerge)
|
30
|
-
has_many :
|
31
|
-
has_many :
|
30
|
+
has_many :agent_merges, :dependent => :destroy
|
31
|
+
has_many :agent_merge_lists, :through => :agent_merges
|
32
32
|
end
|
33
33
|
#belongs_to :user
|
34
|
-
belongs_to :
|
34
|
+
belongs_to :agent_type
|
35
35
|
belongs_to :required_role, :class_name => 'Role', :foreign_key => 'required_role_id', :validate => true
|
36
36
|
belongs_to :language
|
37
37
|
belongs_to :country
|
38
|
-
has_one :
|
38
|
+
has_one :agent_import_result
|
39
39
|
|
40
|
-
validates_presence_of :language, :
|
41
|
-
validates_associated :language, :
|
40
|
+
validates_presence_of :language, :agent_type, :country
|
41
|
+
validates_associated :language, :agent_type, :country
|
42
42
|
validates :full_name, :presence => true, :length => {:maximum => 255}
|
43
43
|
#validates :user_id, :uniqueness => true, :allow_nil => true
|
44
44
|
validates :birth_date, :format => {:with => /\A\d+(-\d{0,2}){0,2}\z/}, :allow_blank => true
|
@@ -63,10 +63,10 @@ class Patron < ActiveRecord::Base
|
|
63
63
|
integer :work_ids, :multiple => true
|
64
64
|
integer :expression_ids, :multiple => true
|
65
65
|
integer :manifestation_ids, :multiple => true
|
66
|
-
integer :
|
67
|
-
integer :
|
66
|
+
integer :agent_merge_list_ids, :multiple => true if defined?(EnjuResourceMerge)
|
67
|
+
integer :original_agent_ids, :multiple => true
|
68
68
|
integer :required_role_id
|
69
|
-
integer :
|
69
|
+
integer :agent_type_id
|
70
70
|
end
|
71
71
|
|
72
72
|
paginates_per 10
|
@@ -213,33 +213,33 @@ class Patron < ActiveRecord::Base
|
|
213
213
|
owns.where(:item_id => item.id)
|
214
214
|
end
|
215
215
|
|
216
|
-
def self.
|
217
|
-
|
218
|
-
|
219
|
-
name_and_role =
|
220
|
-
if
|
221
|
-
|
216
|
+
def self.import_agents(agent_lists)
|
217
|
+
agents = []
|
218
|
+
agent_lists.each do |agent_list|
|
219
|
+
name_and_role = agent_list[:full_name].split('||')
|
220
|
+
if agent_list[:agent_identifier].present?
|
221
|
+
agent = Agent.where(:agent_identifier => agent_list[:agent_identifier]).first
|
222
222
|
else
|
223
|
-
|
223
|
+
agent = Agent.where(:full_name => name_and_role[0]).first
|
224
224
|
end
|
225
225
|
role_type = name_and_role[1].to_s.strip
|
226
|
-
unless
|
227
|
-
|
226
|
+
unless agent
|
227
|
+
agent = Agent.new(
|
228
228
|
:full_name => name_and_role[0],
|
229
|
-
:full_name_transcription =>
|
230
|
-
:
|
229
|
+
:full_name_transcription => agent_list[:full_name_transcription],
|
230
|
+
:agent_identifier => agent_list[:agent_identifier],
|
231
231
|
:language_id => 1
|
232
232
|
)
|
233
|
-
|
234
|
-
|
233
|
+
agent.required_role = Role.where(:name => 'Guest').first
|
234
|
+
agent.save
|
235
235
|
end
|
236
|
-
|
236
|
+
agents << agent
|
237
237
|
end
|
238
|
-
|
238
|
+
agents
|
239
239
|
end
|
240
240
|
|
241
|
-
def
|
242
|
-
self.
|
241
|
+
def agents
|
242
|
+
self.original_agents + self.derived_agents
|
243
243
|
end
|
244
244
|
|
245
245
|
def user
|
@@ -249,7 +249,7 @@ end
|
|
249
249
|
|
250
250
|
# == Schema Information
|
251
251
|
#
|
252
|
-
# Table name:
|
252
|
+
# Table name: agents
|
253
253
|
#
|
254
254
|
# id :integer not null, primary key
|
255
255
|
# user_id :integer
|
@@ -287,7 +287,7 @@ end
|
|
287
287
|
# date_of_death :datetime
|
288
288
|
# language_id :integer default(1), not null
|
289
289
|
# country_id :integer default(1), not null
|
290
|
-
#
|
290
|
+
# agent_type_id :integer default(1), not null
|
291
291
|
# lock_version :integer default(0), not null
|
292
292
|
# note :text
|
293
293
|
# required_role_id :integer default(1), not null
|
@@ -298,6 +298,6 @@ end
|
|
298
298
|
# full_name_alternative_transcription :text
|
299
299
|
# birth_date :string(255)
|
300
300
|
# death_date :string(255)
|
301
|
-
#
|
301
|
+
# agent_identifier :string(255)
|
302
302
|
#
|
303
303
|
|