enju_resource_merge 0.1.0.pre7 → 0.1.0.pre8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/patron_merge_lists_controller.rb +37 -37
- data/app/controllers/patron_merges_controller.rb +35 -35
- data/app/controllers/series_statement_merge_lists_controller.rb +0 -1
- data/app/models/agent_merge.rb +21 -0
- data/app/models/agent_merge_list.rb +29 -0
- data/app/models/enju_resource_merge/ability.rb +4 -4
- data/app/models/series_statement_merge_list.rb +0 -18
- data/app/views/{patron_merge_lists → agent_merge_lists}/_form.html.erb +1 -1
- data/app/views/{patron_merge_lists → agent_merge_lists}/edit.html.erb +3 -3
- data/app/views/agent_merge_lists/index.html.erb +33 -0
- data/app/views/{patron_merge_lists → agent_merge_lists}/new.html.erb +1 -1
- data/app/views/agent_merge_lists/show.html.erb +31 -0
- data/app/views/agent_merges/edit.html.erb +31 -0
- data/app/views/agent_merges/index.html.erb +32 -0
- data/app/views/agent_merges/new.html.erb +39 -0
- data/app/views/agent_merges/show.html.erb +25 -0
- data/config/routes.rb +7 -7
- data/db/migrate/133_create_agent_merges.rb +15 -0
- data/db/migrate/134_create_agent_merge_lists.rb +13 -0
- data/lib/enju_resource_merge/version.rb +1 -1
- data/lib/enju_resource_merge.rb +2 -2
- data/spec/controllers/agent_merge_lists_controller_spec.rb +456 -0
- data/spec/controllers/agent_merges_controller_spec.rb +437 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -68
- data/spec/dummy/app/models/ability.rb +4 -4
- data/spec/dummy/app/models/user.rb +5 -25
- data/spec/dummy/config/application.rb +1 -1
- 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/059_create_libraries.rb +28 -0
- data/spec/dummy/db/migrate/069_create_shelves.rb +15 -0
- data/spec/dummy/db/migrate/077_create_user_groups.rb +16 -0
- data/spec/dummy/db/migrate/080_create_library_groups.rb +18 -0
- data/spec/dummy/db/migrate/120_create_baskets.rb +12 -0
- data/spec/dummy/db/migrate/124_create_bookstores.rb +17 -0
- data/spec/dummy/db/migrate/125_create_donates.rb +2 -2
- data/spec/dummy/db/migrate/{20090812151902_create_patron_relationship_types.rb → 130_create_request_status_types.rb} +2 -2
- data/spec/dummy/db/migrate/131_create_request_types.rb +12 -0
- 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/20081006090811_create_subscriptions.rb +17 -0
- data/spec/dummy/db/migrate/20081006093246_create_subscribes.rb +14 -0
- data/spec/dummy/db/migrate/20081023092436_create_search_engines.rb +17 -0
- data/spec/dummy/db/migrate/20081028083142_create_agent_import_files.rb +22 -0
- data/spec/dummy/db/migrate/20090812151902_create_agent_relationship_types.rb +12 -0
- 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/20100314190054_add_opening_hour_to_library.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/20110318183304_add_valid_period_for_new_user_to_user_group.rb +11 -0
- data/spec/dummy/db/migrate/20111201155456_create_users.rb +0 -5
- data/spec/dummy/db/migrate/20120105074911_add_isil_to_library.rb +5 -0
- data/spec/dummy/db/migrate/20120129014038_create_budget_types.rb +12 -0
- data/spec/dummy/db/migrate/20120319173203_create_accepts.rb +14 -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/20120510140958_add_closed_to_shelf.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/migrate/20130221154434_add_additional_attributes_to_user.rb +26 -0
- data/spec/dummy/db/migrate/20130412083556_add_latitude_and_longitude_to_library.rb +6 -0
- data/spec/dummy/db/migrate/20130421093852_add_periodical_to_manifestation.rb +5 -0
- data/spec/dummy/db/migrate/20130421155019_add_creator_string_to_series_statement.rb +7 -0
- data/spec/dummy/db/migrate/20130421164124_add_series_master_to_series_statement.rb +5 -0
- data/spec/dummy/db/schema.rb +352 -154
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/factories/{patron.rb → agent.rb} +2 -2
- data/spec/factories/agent_merge.rb +6 -0
- data/spec/factories/agent_merge_list.rb +5 -0
- data/spec/factories/library.rb +13 -0
- data/spec/factories/user.rb +34 -6
- data/spec/fixtures/{patron_merge_lists.yml → agent_merge_lists.yml} +4 -4
- data/spec/fixtures/agent_merges.yml +31 -0
- data/spec/fixtures/{patron_types.yml → agent_types.yml} +4 -4
- data/spec/fixtures/{patrons.yml → agents.yml} +46 -46
- data/spec/fixtures/libraries.yml +102 -0
- data/spec/fixtures/library_groups.yml +34 -0
- data/spec/fixtures/series_statements.yml +23 -22
- data/spec/fixtures/shelves.yml +47 -0
- data/spec/fixtures/user_groups.yml +45 -0
- data/spec/models/{patron_merge_list_spec.rb → agent_merge_list_spec.rb} +2 -2
- data/spec/models/agent_merge_spec.rb +19 -0
- data/spec/models/series_statement_merge_list_spec.rb +0 -5
- metadata +136 -72
- data/app/models/patron_merge.rb +0 -21
- data/app/models/patron_merge_list.rb +0 -29
- data/app/views/patron_merge_lists/index.html.erb +0 -33
- data/app/views/patron_merge_lists/show.html.erb +0 -31
- data/app/views/patron_merges/edit.html.erb +0 -31
- data/app/views/patron_merges/index.html.erb +0 -32
- data/app/views/patron_merges/new.html.erb +0 -39
- data/app/views/patron_merges/show.html.erb +0 -25
- data/db/migrate/133_create_patron_merges.rb +0 -15
- data/db/migrate/134_create_patron_merge_lists.rb +0 -13
- data/spec/controllers/patron_merge_lists_controller_spec.rb +0 -456
- data/spec/controllers/patron_merges_controller_spec.rb +0 -437
- data/spec/dummy/app/models/role.rb +0 -47
- 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/20111009183423_add_ndc_to_manifestation.rb +0 -9
- 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/factories/patron_merge.rb +0 -6
- data/spec/factories/patron_merge_list.rb +0 -5
- data/spec/fixtures/patron_merges.yml +0 -31
- data/spec/models/patron_merge_spec.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5696cba3069aacbf3d90e6e8b44e3439430036d1
|
4
|
+
data.tar.gz: b6f9b9a97dbb67473649ebdb13080ce2aa3662af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7266fa6d3dc5838dfb93cef447e12c54968d3d6f96620be010610a2ec2980776e15c9cced24d4608c8f08d5704900224bb05907544f9c6e350516c54116f0e3
|
7
|
+
data.tar.gz: ad7c2598aca6db0c81977f56a8345f8f8d148afcf713245d381a76e38f124e4771596117fd22af06ef4c70dcd2ea2619dcc8fae3ef4d6a9402c78cd8ee454005
|
@@ -1,92 +1,92 @@
|
|
1
|
-
class
|
1
|
+
class AgentMergeListsController < ApplicationController
|
2
2
|
load_and_authorize_resource
|
3
3
|
|
4
|
-
# GET /
|
5
|
-
# GET /
|
4
|
+
# GET /agent_merge_lists
|
5
|
+
# GET /agent_merge_lists.json
|
6
6
|
def index
|
7
|
-
@
|
7
|
+
@agent_merge_lists = AgentMergeList.page(params[:page])
|
8
8
|
|
9
9
|
respond_to do |format|
|
10
10
|
format.html # index.html.erb
|
11
|
-
format.json { render :json => @
|
11
|
+
format.json { render :json => @agent_merge_lists }
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
# GET /
|
16
|
-
# GET /
|
15
|
+
# GET /agent_merge_lists/1
|
16
|
+
# GET /agent_merge_lists/1.json
|
17
17
|
def show
|
18
18
|
respond_to do |format|
|
19
19
|
format.html # show.html.erb
|
20
|
-
format.json { render :json => @
|
20
|
+
format.json { render :json => @agent_merge_list }
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
# GET /
|
25
|
-
# GET /
|
24
|
+
# GET /agent_merge_lists/new
|
25
|
+
# GET /agent_merge_lists/new.json
|
26
26
|
def new
|
27
|
-
@
|
27
|
+
@agent_merge_list = AgentMergeList.new
|
28
28
|
|
29
29
|
respond_to do |format|
|
30
30
|
format.html # new.html.erb
|
31
|
-
format.json { render :json => @
|
31
|
+
format.json { render :json => @agent_merge_list }
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
# GET /
|
35
|
+
# GET /agent_merge_lists/1/edit
|
36
36
|
def edit
|
37
37
|
end
|
38
38
|
|
39
|
-
# POST /
|
40
|
-
# POST /
|
39
|
+
# POST /agent_merge_lists
|
40
|
+
# POST /agent_merge_lists.json
|
41
41
|
def create
|
42
|
-
@
|
42
|
+
@agent_merge_list = AgentMergeList.new(params[:agent_merge_list])
|
43
43
|
|
44
44
|
respond_to do |format|
|
45
|
-
if @
|
46
|
-
flash[:notice] = t('controller.successfully_created', :model => t('activerecord.models.
|
47
|
-
format.html { redirect_to(@
|
48
|
-
format.json { render :json => @
|
45
|
+
if @agent_merge_list.save
|
46
|
+
flash[:notice] = t('controller.successfully_created', :model => t('activerecord.models.agent_merge_list'))
|
47
|
+
format.html { redirect_to(@agent_merge_list) }
|
48
|
+
format.json { render :json => @agent_merge_list, :status => :created, :location => @agent_merge_list }
|
49
49
|
else
|
50
50
|
format.html { render :action => "new" }
|
51
|
-
format.json { render :json => @
|
51
|
+
format.json { render :json => @agent_merge_list.errors, :status => :unprocessable_entity }
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
# PUT /
|
57
|
-
# PUT /
|
56
|
+
# PUT /agent_merge_lists/1
|
57
|
+
# PUT /agent_merge_lists/1.json
|
58
58
|
def update
|
59
59
|
respond_to do |format|
|
60
|
-
if @
|
60
|
+
if @agent_merge_list.update_attributes(params[:agent_merge_list])
|
61
61
|
if params[:mode] == 'merge'
|
62
|
-
|
63
|
-
if
|
64
|
-
@
|
65
|
-
flash[:notice] = t('merge_list.successfully_merged', :model => t('activerecord.models.
|
62
|
+
selected_agent = Agent.where(:id => params[:selected_agent_id]).first
|
63
|
+
if selected_agent
|
64
|
+
@agent_merge_list.merge_agents(selected_agent)
|
65
|
+
flash[:notice] = t('merge_list.successfully_merged', :model => t('activerecord.models.agent'))
|
66
66
|
else
|
67
|
-
flash[:notice] = t('merge_list.specify_id', :model => t('activerecord.models.
|
68
|
-
redirect_to
|
67
|
+
flash[:notice] = t('merge_list.specify_id', :model => t('activerecord.models.agent'))
|
68
|
+
redirect_to agent_merge_list_url(@agent_merge_list)
|
69
69
|
return
|
70
70
|
end
|
71
71
|
else
|
72
|
-
flash[:notice] = t('controller.successfully_updated', :model => t('activerecord.models.
|
72
|
+
flash[:notice] = t('controller.successfully_updated', :model => t('activerecord.models.agent_merge_list'))
|
73
73
|
end
|
74
|
-
format.html { redirect_to(@
|
74
|
+
format.html { redirect_to(@agent_merge_list) }
|
75
75
|
format.json { head :no_content }
|
76
76
|
else
|
77
77
|
format.html { render :action => "edit" }
|
78
|
-
format.json { render :json => @
|
78
|
+
format.json { render :json => @agent_merge_list.errors, :status => :unprocessable_entity }
|
79
79
|
end
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
-
# DELETE /
|
84
|
-
# DELETE /
|
83
|
+
# DELETE /agent_merge_lists/1
|
84
|
+
# DELETE /agent_merge_lists/1.json
|
85
85
|
def destroy
|
86
|
-
@
|
86
|
+
@agent_merge_list.destroy
|
87
87
|
|
88
88
|
respond_to do |format|
|
89
|
-
format.html { redirect_to(
|
89
|
+
format.html { redirect_to(agent_merge_lists_url) }
|
90
90
|
format.json { head :no_content }
|
91
91
|
end
|
92
92
|
end
|
@@ -1,86 +1,86 @@
|
|
1
|
-
class
|
1
|
+
class AgentMergesController < ApplicationController
|
2
2
|
load_and_authorize_resource
|
3
|
-
before_filter :
|
3
|
+
before_filter :get_agent, :get_agent_merge_list
|
4
4
|
|
5
|
-
# GET /
|
6
|
-
# GET /
|
5
|
+
# GET /agent_merges
|
6
|
+
# GET /agent_merges.json
|
7
7
|
def index
|
8
|
-
if @
|
9
|
-
@
|
10
|
-
elsif @
|
11
|
-
@
|
8
|
+
if @agent
|
9
|
+
@agent_merges = @agent.agent_merges.order('agent_merges.id').page(params[:page])
|
10
|
+
elsif @agent_merge_list
|
11
|
+
@agent_merges = @agent_merge_list.agent_merges.order('agent_merges.id').includes(:agent).page(params[:page])
|
12
12
|
else
|
13
|
-
@
|
13
|
+
@agent_merges = AgentMerge.page(params[:page])
|
14
14
|
end
|
15
15
|
|
16
16
|
respond_to do |format|
|
17
17
|
format.html # index.html.erb
|
18
|
-
format.json { render :json => @
|
18
|
+
format.json { render :json => @agent_merges }
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
# GET /
|
23
|
-
# GET /
|
22
|
+
# GET /agent_merges/1
|
23
|
+
# GET /agent_merges/1.json
|
24
24
|
def show
|
25
25
|
respond_to do |format|
|
26
26
|
format.html # show.html.erb
|
27
|
-
format.json { render :json => @
|
27
|
+
format.json { render :json => @agent_merge }
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
# GET /
|
32
|
-
# GET /
|
31
|
+
# GET /agent_merges/new
|
32
|
+
# GET /agent_merges/new.json
|
33
33
|
def new
|
34
|
-
@
|
35
|
-
@
|
34
|
+
@agent_merge = AgentMerge.new
|
35
|
+
@agent_merge.agent = @agent
|
36
36
|
|
37
37
|
respond_to do |format|
|
38
38
|
format.html # new.html.erb
|
39
|
-
format.json { render :json => @
|
39
|
+
format.json { render :json => @agent_merge }
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
# GET /
|
43
|
+
# GET /agent_merges/1/edit
|
44
44
|
def edit
|
45
45
|
end
|
46
46
|
|
47
|
-
# POST /
|
48
|
-
# POST /
|
47
|
+
# POST /agent_merges
|
48
|
+
# POST /agent_merges.json
|
49
49
|
def create
|
50
|
-
@
|
50
|
+
@agent_merge = AgentMerge.new(params[:agent_merge])
|
51
51
|
|
52
52
|
respond_to do |format|
|
53
|
-
if @
|
54
|
-
format.html { redirect_to(@
|
55
|
-
format.json { render :json => @
|
53
|
+
if @agent_merge.save
|
54
|
+
format.html { redirect_to(@agent_merge, :notice => t('controller.successfully_created', :model => t('activerecord.models.agent_merge'))) }
|
55
|
+
format.json { render :json => @agent_merge, :status => :created, :location => @agent_merge }
|
56
56
|
else
|
57
57
|
format.html { render :action => "new" }
|
58
|
-
format.json { render :json => @
|
58
|
+
format.json { render :json => @agent_merge.errors, :status => :unprocessable_entity }
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
-
# PUT /
|
64
|
-
# PUT /
|
63
|
+
# PUT /agent_merges/1
|
64
|
+
# PUT /agent_merges/1.json
|
65
65
|
def update
|
66
66
|
respond_to do |format|
|
67
|
-
if @
|
68
|
-
format.html { redirect_to(@
|
67
|
+
if @agent_merge.update_attributes(params[:agent_merge])
|
68
|
+
format.html { redirect_to(@agent_merge, :notice => t('controller.successfully_updated', :model => t('activerecord.models.agent_merge'))) }
|
69
69
|
format.json { head :no_content }
|
70
70
|
else
|
71
71
|
format.html { render :action => "edit" }
|
72
|
-
format.json { render :json => @
|
72
|
+
format.json { render :json => @agent_merge.errors, :status => :unprocessable_entity }
|
73
73
|
end
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
|
-
# DELETE /
|
78
|
-
# DELETE /
|
77
|
+
# DELETE /agent_merges/1
|
78
|
+
# DELETE /agent_merges/1.json
|
79
79
|
def destroy
|
80
|
-
@
|
80
|
+
@agent_merge.destroy
|
81
81
|
|
82
82
|
respond_to do |format|
|
83
|
-
format.html { redirect_to(
|
83
|
+
format.html { redirect_to(agent_merges_url) }
|
84
84
|
format.json { head :no_content }
|
85
85
|
end
|
86
86
|
end
|
@@ -61,7 +61,6 @@ class SeriesStatementMergeListsController < ApplicationController
|
|
61
61
|
if params[:mode] == 'merge'
|
62
62
|
selected_series_statement = SeriesStatement.find(params[:selected_series_statement_id]) rescue nil
|
63
63
|
if selected_series_statement
|
64
|
-
@series_statement_merge_list.merge_series_statements(selected_series_statement)
|
65
64
|
flash[:notice] = t('merge_list.successfully_merged', :model => t('activerecord.models.series_statement'))
|
66
65
|
else
|
67
66
|
flash[:notice] = t('merge_list.specify_id', :model => t('activerecord.models.series_statement'))
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class AgentMerge < ActiveRecord::Base
|
2
|
+
attr_accessible :agent_id, :agent_merge_list_id
|
3
|
+
belongs_to :agent, :validate => true
|
4
|
+
belongs_to :agent_merge_list, :validate => true
|
5
|
+
validates_presence_of :agent, :agent_merge_list
|
6
|
+
validates_associated :agent, :agent_merge_list
|
7
|
+
|
8
|
+
paginates_per 10
|
9
|
+
end
|
10
|
+
|
11
|
+
# == Schema Information
|
12
|
+
#
|
13
|
+
# Table name: agent_merges
|
14
|
+
#
|
15
|
+
# id :integer not null, primary key
|
16
|
+
# agent_id :integer not null
|
17
|
+
# agent_merge_list_id :integer not null
|
18
|
+
# created_at :datetime not null
|
19
|
+
# updated_at :datetime not null
|
20
|
+
#
|
21
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class AgentMergeList < ActiveRecord::Base
|
2
|
+
attr_accessible :title
|
3
|
+
has_many :agent_merges, :dependent => :destroy
|
4
|
+
has_many :agents, :through => :agent_merges
|
5
|
+
validates_presence_of :title
|
6
|
+
|
7
|
+
paginates_per 10
|
8
|
+
|
9
|
+
def merge_agents(selected_agent)
|
10
|
+
self.agents.each do |agent|
|
11
|
+
Create.update_all(['agent_id = ?', selected_agent.id], ['agent_id = ?', agent.id])
|
12
|
+
Produce.update_all(['agent_id = ?', selected_agent.id], ['agent_id = ?', agent.id])
|
13
|
+
Own.update_all(['agent_id = ?', selected_agent.id], ['agent_id = ?', agent.id])
|
14
|
+
Donate.update_all(['agent_id = ?', selected_agent.id], ['agent_id = ?', agent.id])
|
15
|
+
agent.destroy unless agent == selected_agent
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# == Schema Information
|
21
|
+
#
|
22
|
+
# Table name: agent_merge_lists
|
23
|
+
#
|
24
|
+
# id :integer not null, primary key
|
25
|
+
# title :string(255)
|
26
|
+
# created_at :datetime not null
|
27
|
+
# updated_at :datetime not null
|
28
|
+
#
|
29
|
+
|
@@ -6,15 +6,15 @@ module EnjuResourceMerge
|
|
6
6
|
case user.try(:role).try(:name)
|
7
7
|
when 'Administrator'
|
8
8
|
can :manage, [
|
9
|
-
|
10
|
-
|
9
|
+
AgentMerge,
|
10
|
+
AgentMergeList,
|
11
11
|
SeriesStatementMerge,
|
12
12
|
SeriesStatementMergeList
|
13
13
|
]
|
14
14
|
when 'Librarian'
|
15
15
|
can :manage, [
|
16
|
-
|
17
|
-
|
16
|
+
AgentMerge,
|
17
|
+
AgentMergeList,
|
18
18
|
SeriesStatementMerge,
|
19
19
|
SeriesStatementMergeList
|
20
20
|
]
|
@@ -5,24 +5,6 @@ class SeriesStatementMergeList < ActiveRecord::Base
|
|
5
5
|
validates_presence_of :title
|
6
6
|
|
7
7
|
paginates_per 10
|
8
|
-
|
9
|
-
def merge_series_statements(selected_series_statement)
|
10
|
-
series_statements.each do |series_statement|
|
11
|
-
if series_statement == selected_series_statement
|
12
|
-
series_statement.root_manifestation.update_attributes!({
|
13
|
-
:original_title => selected_series_statement.original_title,
|
14
|
-
:title_transcription => selected_series_statement.title_transcription,
|
15
|
-
:title_alternative => selected_series_statement.title_alternative
|
16
|
-
}) if series_statement.root_manifestation
|
17
|
-
else
|
18
|
-
series_statement.manifestations.each do |manifestation|
|
19
|
-
manifestation.series_statement = selected_series_statement
|
20
|
-
manifestation.save!
|
21
|
-
end
|
22
|
-
series_statement.destroy
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
8
|
end
|
27
9
|
|
28
10
|
# == Schema Information
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<div id="content_detail" class="ui-corner-all">
|
2
|
-
<h1 class="title"><%= t('page.editing', :model => t('activerecord.models.
|
2
|
+
<h1 class="title"><%= t('page.editing', :model => t('activerecord.models.agent_merge_list')) -%></h1>
|
3
3
|
<div id="content_list">
|
4
4
|
<%= render 'form' %>
|
5
5
|
</div>
|
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
<div id="submenu" class="ui-corner-all">
|
9
9
|
<ul>
|
10
|
-
<li><%= link_to t('page.show'), @
|
11
|
-
<li><%= link_to t('page.back'),
|
10
|
+
<li><%= link_to t('page.show'), @agent_merge_list -%></li>
|
11
|
+
<li><%= link_to t('page.back'), agent_merge_lists_path -%></li>
|
12
12
|
</ul>
|
13
13
|
</div>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<div id="content_detail" class="ui-corner-all">
|
2
|
+
<h1 class="title"><%= t('page.listing', :model => t('activerecord.models.agent_merge_list')) -%></h1>
|
3
|
+
<div id="content_list">
|
4
|
+
|
5
|
+
<table class="table table-striped index">
|
6
|
+
<tr>
|
7
|
+
<th><%= t('activerecord.attributes.agent_merge_list.title') -%></th>
|
8
|
+
<th><%= t('page.created_at') -%></th>
|
9
|
+
<th></th>
|
10
|
+
</tr>
|
11
|
+
|
12
|
+
<%- @agent_merge_lists.each do |agent_merge_list| -%>
|
13
|
+
<tr class="line<%= cycle("0", "1") -%>">
|
14
|
+
<td><%= link_to agent_merge_list.title, agent_merge_list -%></td>
|
15
|
+
<td><%= l(agent_merge_list.created_at) -%></td>
|
16
|
+
<td>
|
17
|
+
<%= link_to t('page.show'), agent_merge_list -%>
|
18
|
+
<%= link_to t('page.edit'), edit_agent_merge_list_path(agent_merge_list) -%>
|
19
|
+
<%= link_to t('page.destroy'), agent_merge_list, :data => {:confirm => t('page.are_you_sure')}, :method => :delete -%>
|
20
|
+
</td>
|
21
|
+
</tr>
|
22
|
+
<%- end -%>
|
23
|
+
</table>
|
24
|
+
|
25
|
+
<%= paginate(@agent_merge_lists) -%>
|
26
|
+
</div>
|
27
|
+
</div>
|
28
|
+
|
29
|
+
<div id="submenu" class="ui-corner-all">
|
30
|
+
<ul>
|
31
|
+
<li><%= link_to t('page.new', :model => t('activerecord.models.agent_merge_list')), new_agent_merge_list_path -%></li>
|
32
|
+
</ul>
|
33
|
+
</div>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<div id="content_detail" class="ui-corner-all">
|
2
|
-
<h1 class="title"><%= t('page.new', :model => t('activerecord.models.
|
2
|
+
<h1 class="title"><%= t('page.new', :model => t('activerecord.models.agent_merge_list')) -%></h1>
|
3
3
|
<div id="content_list">
|
4
4
|
<%= render 'form' %>
|
5
5
|
</div>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<div id="content_detail" class="ui-corner-all">
|
2
|
+
<h1 class="title"><%= t('page.showing', :model => t('activerecord.models.agent_merge_list')) -%></h1>
|
3
|
+
<div id="content_list">
|
4
|
+
<p id="notice"><%= notice %></p>
|
5
|
+
|
6
|
+
<%= form_for(:agent_merge_list, :url => agent_merge_list_path(@agent_merge_list, :mode => 'merge'), :html => { :method => :put }) do |f| -%>
|
7
|
+
<p>
|
8
|
+
<strong><%= t('page.title') -%>:</strong>
|
9
|
+
<%= @agent_merge_list.title -%>
|
10
|
+
</p>
|
11
|
+
|
12
|
+
<ul>
|
13
|
+
<%- @agent_merge_list.agents.each do |agent| -%>
|
14
|
+
<li><%= radio_button_tag 'selected_agent_id', agent.id -%><%= link_to agent.full_name, agent -%></li>
|
15
|
+
<%- end -%>
|
16
|
+
</ul>
|
17
|
+
<%- if @agent_merge_list.agents.size > 1 -%>
|
18
|
+
<%= f.submit t('page.merge'), :data => {:confirm => t('page.are_you_sure')} -%>
|
19
|
+
<%- end -%>
|
20
|
+
<%- end -%>
|
21
|
+
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
|
25
|
+
<div id="submenu" class="ui-corner-all">
|
26
|
+
<ul>
|
27
|
+
<li><%= link_to t('page.listing', :model => t('activerecord.models.agent')), agent_merge_list_agents_path(@agent_merge_list) -%></li>
|
28
|
+
<li><%= link_to t('page.edit'), edit_agent_merge_list_path(@agent_merge_list) -%></li>
|
29
|
+
<li><%= back_to_index(flash[:page_info]) -%></li>
|
30
|
+
</ul>
|
31
|
+
</div>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<div id="content_detail" class="ui-corner-all">
|
2
|
+
<h1 class="title"><%= t('page.editing', :model => t('activerecord.models.agent_merge')) -%></h1>
|
3
|
+
<div id="content_list">
|
4
|
+
|
5
|
+
<%= form_for(@agent_merge) do |f| -%>
|
6
|
+
<%= f.error_messages -%>
|
7
|
+
|
8
|
+
<div class="field">
|
9
|
+
<%= f.label t('activerecord.models.agent') -%><br />
|
10
|
+
<%= f.text_field :agent_id -%>
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<div class="field">
|
14
|
+
<%= f.label t('activerecord.models.agent_merge_list') -%><br />
|
15
|
+
<%= f.text_field :agent_merge_list_id -%>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<div class="actions">
|
19
|
+
<%= f.submit %>
|
20
|
+
</div>
|
21
|
+
<%- end -%>
|
22
|
+
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
|
26
|
+
<div id="submenu" class="ui-corner-all">
|
27
|
+
<ul>
|
28
|
+
<li><%= link_to t('page.show'), @agent_merge -%></li>
|
29
|
+
<li><%= link_to t('page.back'), agent_merges_path -%></li>
|
30
|
+
</ul>
|
31
|
+
</div>
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<div id="content_detail" class="ui-corner-all">
|
2
|
+
<h1 class="title"><%= t('page.listing', :model => t('activerecord.models.agent_merge')) -%></h1>
|
3
|
+
<div id="content_list">
|
4
|
+
|
5
|
+
<table class="table table-striped index">
|
6
|
+
<tr>
|
7
|
+
<td><%= t('activerecord.models.agent') -%></td>
|
8
|
+
<td><%= t('activerecord.models.agent_merge_list') -%></td>
|
9
|
+
</tr>
|
10
|
+
|
11
|
+
<%- @agent_merges.each do |agent_merge| -%>
|
12
|
+
<tr class="line<%= cycle("0", "1") -%>">
|
13
|
+
<td><%= link_to agent_merge.agent.full_name, agent_merge.agent -%></td>
|
14
|
+
<td><%= link_to agent_merge.agent_merge_list.title, agent_merge.agent_merge_list -%></td>
|
15
|
+
<td><%= link_to t('page.show'), agent_merge -%></td>
|
16
|
+
<td><%= link_to t('page.edit'), edit_agent_merge_path(agent_merge) -%></td>
|
17
|
+
<td><%= link_to t('page.destroy'), agent_merge, :data => {:confirm => t('page.are_you_sure')}, :method => :delete -%></td>
|
18
|
+
</tr>
|
19
|
+
<%- end -%>
|
20
|
+
</table>
|
21
|
+
|
22
|
+
<%= paginate(@agent_merges) -%>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
|
26
|
+
<div id="submenu" class="ui-corner-all">
|
27
|
+
<ul>
|
28
|
+
<%- if @agent_merge_list -%>
|
29
|
+
<li><%= link_to t('page.add', :model => t('activerecord.models.agent')), agent_merge_list_agents_path(@agent_merge_list) -%></li>
|
30
|
+
<%- end -%>
|
31
|
+
</ul>
|
32
|
+
</div>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<div id="content_detail" class="ui-corner-all">
|
2
|
+
<h1 class="title"><%= t('page.new', :model => t('activerecord.models.agent_merge')) -%></h1>
|
3
|
+
<div id="content_list">
|
4
|
+
|
5
|
+
<%= form_for(@agent_merge) do |f| -%>
|
6
|
+
<%= f.error_messages -%>
|
7
|
+
<div class="field">
|
8
|
+
<%= f.label t('activerecord.models.agent') -%><br />
|
9
|
+
<%- if @agent -%>
|
10
|
+
<%= link_to @agent.full_name, @agent -%>
|
11
|
+
<%= f.hidden_field :agent_id -%>
|
12
|
+
<%- else -%>
|
13
|
+
<%= f.text_field :agent_id -%>
|
14
|
+
<%- end -%>
|
15
|
+
</div>
|
16
|
+
|
17
|
+
<div class="field">
|
18
|
+
<%= f.label t('activerecord.models.agent_merge_list') -%><br />
|
19
|
+
<%- if @agent_merge_list -%>
|
20
|
+
<%= link_to @agent_merge_list.title, agent_merge_list_path(@agent_merge_list) -%>
|
21
|
+
<%= f.hidden_field :agent_merge_list_id, :value => @agent_merge_list.id -%>
|
22
|
+
<%- else -%>
|
23
|
+
<%= f.text_field :agent_merge_list_id, :value => params[:agent_merge_list_id] -%>
|
24
|
+
<%- end -%>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
<div class="actions">
|
28
|
+
<%= f.submit %>
|
29
|
+
</div>
|
30
|
+
<%- end -%>
|
31
|
+
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="submenu" class="ui-corner-all">
|
36
|
+
<ul>
|
37
|
+
<li><%= link_to t('page.back'), agent_merges_path -%></li>
|
38
|
+
</ul>
|
39
|
+
</div>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<div id="content_detail" class="ui-corner-all">
|
2
|
+
<h1 class="title"><%= t('page.showing', :model => t('activerecord.models.agent_merge')) -%></h1>
|
3
|
+
<div id="content_list">
|
4
|
+
<p id="notice"><%= notice %></p>
|
5
|
+
|
6
|
+
<p>
|
7
|
+
<strong><%= t('activerecord.models.agent') -%>:</strong>
|
8
|
+
<%= link_to @agent_merge.agent.full_name, @agent_merge.agent -%>
|
9
|
+
</p>
|
10
|
+
|
11
|
+
<p>
|
12
|
+
<strong><%= t('activerecord.models.agent_merge_list') -%>:</strong>
|
13
|
+
<%= link_to @agent_merge.agent_merge_list.title, @agent_merge.agent_merge_list -%>
|
14
|
+
</p>
|
15
|
+
|
16
|
+
</div>
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<div id="submenu" class="ui-corner-all">
|
20
|
+
<ul>
|
21
|
+
<li><%= link_to t('page.add', :model => t('activerecord.models.agent')), @agent_merge.agent_merge_list -%></li>
|
22
|
+
<li><%= link_to t('page.edit'), edit_agent_merge_path(@agent_merge) -%></li>
|
23
|
+
<li><%= back_to_index(flash[:page_info]) -%></li>
|
24
|
+
</ul>
|
25
|
+
</div>
|
data/config/routes.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
Rails.application.routes.draw do
|
2
|
-
resources :
|
3
|
-
resources :
|
4
|
-
resources :
|
2
|
+
resources :agents do
|
3
|
+
resources :agent_merges
|
4
|
+
resources :agent_merge_lists
|
5
5
|
end
|
6
|
-
resources :
|
7
|
-
resources :
|
8
|
-
resources :
|
6
|
+
resources :agent_merge_lists do
|
7
|
+
resources :agents
|
8
|
+
resources :agent_merges
|
9
9
|
end
|
10
|
-
resources :
|
10
|
+
resources :agent_merges
|
11
11
|
|
12
12
|
resources :series_statements do
|
13
13
|
resources :series_statement_merges
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateAgentMerges < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :agent_merges do |t|
|
4
|
+
t.integer :agent_id, :agent_merge_list_id, :null => false
|
5
|
+
|
6
|
+
t.timestamps
|
7
|
+
end
|
8
|
+
add_index :agent_merges, :agent_id
|
9
|
+
add_index :agent_merges, :agent_merge_list_id
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.down
|
13
|
+
drop_table :agent_merges
|
14
|
+
end
|
15
|
+
end
|