enju_resource_merge 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +36 -0
- data/app/controllers/patron_merge_lists_controller.rb +93 -0
- data/app/controllers/patron_merges_controller.rb +89 -0
- data/app/controllers/series_statement_merge_lists_controller.rb +93 -0
- data/app/controllers/series_statement_merges_controller.rb +94 -0
- data/app/models/patron_merge.rb +22 -0
- data/app/models/patron_merge_list.rb +31 -0
- data/app/models/series_statement_merge.rb +22 -0
- data/app/models/series_statement_merge_list.rb +26 -0
- data/app/views/patron_merge_lists/_form.html.erb +11 -0
- data/app/views/patron_merge_lists/edit.html.erb +13 -0
- data/app/views/patron_merge_lists/index.html.erb +33 -0
- data/app/views/patron_merge_lists/new.html.erb +12 -0
- data/app/views/patron_merge_lists/show.html.erb +31 -0
- data/app/views/patron_merges/edit.html.erb +31 -0
- data/app/views/patron_merges/index.html.erb +32 -0
- data/app/views/patron_merges/new.html.erb +39 -0
- data/app/views/patron_merges/show.html.erb +25 -0
- data/app/views/series_statement_merge_lists/_form.html.erb +11 -0
- data/app/views/series_statement_merge_lists/edit.html.erb +13 -0
- data/app/views/series_statement_merge_lists/index.html.erb +33 -0
- data/app/views/series_statement_merge_lists/new.html.erb +12 -0
- data/app/views/series_statement_merge_lists/show.html.erb +31 -0
- data/app/views/series_statement_merges/_form.html.erb +12 -0
- data/app/views/series_statement_merges/edit.html.erb +31 -0
- data/app/views/series_statement_merges/index.html.erb +32 -0
- data/app/views/series_statement_merges/new.html.erb +39 -0
- data/app/views/series_statement_merges/show.html.erb +27 -0
- data/config/routes.rb +21 -0
- data/db/migrate/133_create_patron_merges.rb +15 -0
- data/db/migrate/134_create_patron_merge_lists.rb +13 -0
- data/db/migrate/20110627034940_create_series_statement_merge_lists.rb +13 -0
- data/db/migrate/20110627035057_create_series_statement_merges.rb +16 -0
- data/lib/enju_resource_merge.rb +5 -0
- data/lib/enju_resource_merge/engine.rb +12 -0
- data/lib/enju_resource_merge/version.rb +3 -0
- data/lib/tasks/enju_resource_merge_tasks.rake +4 -0
- data/spec/controllers/patron_merge_lists_controller_spec.rb +456 -0
- data/spec/controllers/patron_merges_controller_spec.rb +437 -0
- data/spec/controllers/series_statement_merge_lists_controller_spec.rb +439 -0
- data/spec/controllers/series_statement_merges_controller_spec.rb +437 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +9 -0
- data/spec/dummy/app/assets/stylesheets/application.css +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +75 -0
- data/spec/dummy/app/helpers/application_helper.rb +13 -0
- data/spec/dummy/app/models/ability.rb +22 -0
- data/spec/dummy/app/models/create.rb +4 -0
- data/spec/dummy/app/models/donate.rb +10 -0
- data/spec/dummy/app/models/item.rb +20 -0
- data/spec/dummy/app/models/manifestation.rb +416 -0
- data/spec/dummy/app/models/own.rb +22 -0
- data/spec/dummy/app/models/patron.rb +14 -0
- data/spec/dummy/app/models/produce.rb +4 -0
- data/spec/dummy/app/models/realize.rb +4 -0
- data/spec/dummy/app/models/role.rb +5 -0
- data/spec/dummy/app/models/series_has_manifestation.rb +35 -0
- data/spec/dummy/app/models/series_statement.rb +88 -0
- data/spec/dummy/app/models/user.rb +28 -0
- data/spec/dummy/app/models/user_has_role.rb +4 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/app/views/page/403.html.erb +9 -0
- data/spec/dummy/app/views/page/403.mobile.erb +5 -0
- data/spec/dummy/app/views/page/403.xml.erb +4 -0
- data/spec/dummy/app/views/page/404.html.erb +9 -0
- data/spec/dummy/app/views/page/404.mobile.erb +5 -0
- data/spec/dummy/app/views/page/404.xml.erb +4 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +46 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +30 -0
- data/spec/dummy/config/environments/production.rb +60 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/devise.rb +209 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +60 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/001_create_patrons.rb +62 -0
- data/spec/dummy/db/migrate/005_create_manifestations.rb +68 -0
- data/spec/dummy/db/migrate/006_create_items.rb +36 -0
- data/spec/dummy/db/migrate/125_create_donates.rb +16 -0
- data/spec/dummy/db/migrate/20091214131723_create_series_statements.rb +17 -0
- data/spec/dummy/db/migrate/20100223121519_rename_sereis_statement_title_to_original_title.rb +13 -0
- data/spec/dummy/db/migrate/20100321235924_add_series_statement_identifier_to_series_statement.rb +10 -0
- data/spec/dummy/db/migrate/20110425133109_add_issn_to_series_statement.rb +9 -0
- data/spec/dummy/db/migrate/20110618091240_add_periodical_to_series_statement.rb +9 -0
- data/spec/dummy/db/migrate/20110820131417_create_series_has_manifestations.rb +17 -0
- data/spec/dummy/db/migrate/20110916103953_add_manifestaiton_id_to_series_statement.rb +10 -0
- data/spec/dummy/db/migrate/20110918162329_add_note_to_series_statement.rb +9 -0
- data/spec/dummy/db/migrate/20111201115527_create_creates.rb +10 -0
- data/spec/dummy/db/migrate/20111201115540_create_produces.rb +10 -0
- data/spec/dummy/db/migrate/20111201121844_create_roles.rb +12 -0
- data/spec/dummy/db/migrate/20111201155456_create_users.rb +13 -0
- data/spec/dummy/db/migrate/20111201155513_add_devise_to_users.rb +31 -0
- data/spec/dummy/db/migrate/20111201163718_create_user_has_roles.rb +10 -0
- data/spec/dummy/db/migrate/20120106093356_create_realizes.rb +10 -0
- data/spec/dummy/db/migrate/20120106093603_create_owns.rb +10 -0
- data/spec/dummy/db/schema.rb +300 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/lib/url_validator.rb +10 -0
- data/spec/dummy/log/development.log +63 -0
- data/spec/dummy/log/test.log +67969 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/enju_resource_merge_test.rb +7 -0
- data/spec/factories/patron.rb +10 -0
- data/spec/factories/patron_merge.rb +6 -0
- data/spec/factories/patron_merge_list.rb +5 -0
- data/spec/factories/series_statement.rb +5 -0
- data/spec/factories/series_statement_merge.rb +6 -0
- data/spec/factories/series_statement_merge_list.rb +5 -0
- data/spec/factories/user.rb +31 -0
- data/spec/fixtures/manifestations.yml +2017 -0
- data/spec/fixtures/patron_merge_lists.yml +27 -0
- data/spec/fixtures/patron_merges.yml +31 -0
- data/spec/fixtures/patrons.yml +338 -0
- data/spec/fixtures/roles.yml +21 -0
- data/spec/fixtures/series_has_manifestations.yml +35 -0
- data/spec/fixtures/series_statement_merge_lists.yml +27 -0
- data/spec/fixtures/series_statement_merges.yml +31 -0
- data/spec/fixtures/series_statements.yml +35 -0
- data/spec/fixtures/user_has_roles.yml +41 -0
- data/spec/fixtures/users.yml +69 -0
- data/spec/models/patron_merge_list_spec.rb +18 -0
- data/spec/models/patron_merge_spec.rb +19 -0
- data/spec/models/series_statement_merge_list_spec.rb +21 -0
- data/spec/models/series_statement_merge_spec.rb +17 -0
- data/spec/requests/series_statement_merge_lists_spec.rb +11 -0
- data/spec/requests/series_statement_merges_spec.rb +11 -0
- data/spec/spec_helper.rb +33 -0
- data/spec/support/controller_macros.rb +48 -0
- data/spec/support/devise.rb +4 -0
- data/spec/views/series_statement_merge_lists/edit.html.erb_spec.rb +18 -0
- data/spec/views/series_statement_merge_lists/index.html.erb_spec.rb +22 -0
- data/spec/views/series_statement_merge_lists/new.html.erb_spec.rb +18 -0
- data/spec/views/series_statement_merge_lists/show.html.erb_spec.rb +15 -0
- data/spec/views/series_statement_merges/edit.html.erb_spec.rb +23 -0
- data/spec/views/series_statement_merges/index.html.erb_spec.rb +25 -0
- data/spec/views/series_statement_merges/new.html.erb_spec.rb +23 -0
- data/spec/views/series_statement_merges/show.html.erb_spec.rb +17 -0
- metadata +433 -0
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2011 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'rdoc/task'
|
9
|
+
rescue LoadError
|
10
|
+
require 'rdoc/rdoc'
|
11
|
+
require 'rake/rdoctask'
|
12
|
+
RDoc::Task = Rake::RDocTask
|
13
|
+
end
|
14
|
+
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
17
|
+
rdoc.title = 'EnjuInventory'
|
18
|
+
rdoc.options << '--line-numbers'
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
+
end
|
22
|
+
|
23
|
+
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
24
|
+
load 'rails/tasks/engine.rake'
|
25
|
+
|
26
|
+
|
27
|
+
Bundler::GemHelper.install_tasks
|
28
|
+
|
29
|
+
require 'rspec/core'
|
30
|
+
require 'rspec/core/rake_task'
|
31
|
+
|
32
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
33
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
34
|
+
end
|
35
|
+
|
36
|
+
task :default => :spec
|
@@ -0,0 +1,93 @@
|
|
1
|
+
class PatronMergeListsController < ApplicationController
|
2
|
+
load_and_authorize_resource
|
3
|
+
|
4
|
+
# GET /patron_merge_lists
|
5
|
+
# GET /patron_merge_lists.json
|
6
|
+
def index
|
7
|
+
@patron_merge_lists = PatronMergeList.page(params[:page])
|
8
|
+
|
9
|
+
respond_to do |format|
|
10
|
+
format.html # index.html.erb
|
11
|
+
format.json { render :json => @patron_merge_lists }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# GET /patron_merge_lists/1
|
16
|
+
# GET /patron_merge_lists/1.json
|
17
|
+
def show
|
18
|
+
respond_to do |format|
|
19
|
+
format.html # show.html.erb
|
20
|
+
format.json { render :json => @patron_merge_list }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# GET /patron_merge_lists/new
|
25
|
+
# GET /patron_merge_lists/new.json
|
26
|
+
def new
|
27
|
+
@patron_merge_list = PatronMergeList.new
|
28
|
+
|
29
|
+
respond_to do |format|
|
30
|
+
format.html # new.html.erb
|
31
|
+
format.json { render :json => @patron_merge_list }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# GET /patron_merge_lists/1/edit
|
36
|
+
def edit
|
37
|
+
end
|
38
|
+
|
39
|
+
# POST /patron_merge_lists
|
40
|
+
# POST /patron_merge_lists.json
|
41
|
+
def create
|
42
|
+
@patron_merge_list = PatronMergeList.new(params[:patron_merge_list])
|
43
|
+
|
44
|
+
respond_to do |format|
|
45
|
+
if @patron_merge_list.save
|
46
|
+
flash[:notice] = t('controller.successfully_created', :model => t('activerecord.models.patron_merge_list'))
|
47
|
+
format.html { redirect_to(@patron_merge_list) }
|
48
|
+
format.json { render :json => @patron_merge_list, :status => :created, :location => @patron_merge_list }
|
49
|
+
else
|
50
|
+
format.html { render :action => "new" }
|
51
|
+
format.json { render :json => @patron_merge_list.errors, :status => :unprocessable_entity }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# PUT /patron_merge_lists/1
|
57
|
+
# PUT /patron_merge_lists/1.json
|
58
|
+
def update
|
59
|
+
respond_to do |format|
|
60
|
+
if @patron_merge_list.update_attributes(params[:patron_merge_list])
|
61
|
+
if params[:mode] == 'merge'
|
62
|
+
selected_patron = Patron.where(:id => params[:selected_patron_id]).first
|
63
|
+
if selected_patron
|
64
|
+
@patron_merge_list.merge_patrons(selected_patron)
|
65
|
+
flash[:notice] = t('merge_list.successfully_merged', :model => t('activerecord.models.patron'))
|
66
|
+
else
|
67
|
+
flash[:notice] = t('merge_list.specify_id', :model => t('activerecord.models.patron'))
|
68
|
+
redirect_to patron_merge_list_url(@patron_merge_list)
|
69
|
+
return
|
70
|
+
end
|
71
|
+
else
|
72
|
+
flash[:notice] = t('controller.successfully_updated', :model => t('activerecord.models.patron_merge_list'))
|
73
|
+
end
|
74
|
+
format.html { redirect_to(@patron_merge_list) }
|
75
|
+
format.json { head :ok }
|
76
|
+
else
|
77
|
+
format.html { render :action => "edit" }
|
78
|
+
format.json { render :json => @patron_merge_list.errors, :status => :unprocessable_entity }
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# DELETE /patron_merge_lists/1
|
84
|
+
# DELETE /patron_merge_lists/1.json
|
85
|
+
def destroy
|
86
|
+
@patron_merge_list.destroy
|
87
|
+
|
88
|
+
respond_to do |format|
|
89
|
+
format.html { redirect_to(patron_merge_lists_url) }
|
90
|
+
format.json { head :ok }
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
class PatronMergesController < ApplicationController
|
2
|
+
load_and_authorize_resource
|
3
|
+
before_filter :get_patron, :get_patron_merge_list
|
4
|
+
|
5
|
+
# GET /patron_merges
|
6
|
+
# GET /patron_merges.json
|
7
|
+
def index
|
8
|
+
if @patron
|
9
|
+
@patron_merges = @patron.patron_merges.order('patron_merges.id').page(params[:page])
|
10
|
+
elsif @patron_merge_list
|
11
|
+
@patron_merges = @patron_merge_list.patron_merges.order('patron_merges.id').includes(:patron).page(params[:page])
|
12
|
+
else
|
13
|
+
@patron_merges = PatronMerge.page(params[:page])
|
14
|
+
end
|
15
|
+
|
16
|
+
respond_to do |format|
|
17
|
+
format.html # index.html.erb
|
18
|
+
format.json { render :json => @patron_merges }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# GET /patron_merges/1
|
23
|
+
# GET /patron_merges/1.json
|
24
|
+
def show
|
25
|
+
respond_to do |format|
|
26
|
+
format.html # show.html.erb
|
27
|
+
format.json { render :json => @patron_merge }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# GET /patron_merges/new
|
32
|
+
# GET /patron_merges/new.json
|
33
|
+
def new
|
34
|
+
@patron_merge = PatronMerge.new
|
35
|
+
@patron_merge.patron = @patron
|
36
|
+
|
37
|
+
respond_to do |format|
|
38
|
+
format.html # new.html.erb
|
39
|
+
format.json { render :json => @patron_merge }
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# GET /patron_merges/1/edit
|
44
|
+
def edit
|
45
|
+
end
|
46
|
+
|
47
|
+
# POST /patron_merges
|
48
|
+
# POST /patron_merges.json
|
49
|
+
def create
|
50
|
+
@patron_merge = PatronMerge.new(params[:patron_merge])
|
51
|
+
|
52
|
+
respond_to do |format|
|
53
|
+
if @patron_merge.save
|
54
|
+
flash[:notice] = t('controller.successfully_created', :model => t('activerecord.models.patron_merge'))
|
55
|
+
format.html { redirect_to(@patron_merge) }
|
56
|
+
format.json { render :json => @patron_merge, :status => :created, :location => @patron_merge }
|
57
|
+
else
|
58
|
+
format.html { render :action => "new" }
|
59
|
+
format.json { render :json => @patron_merge.errors, :status => :unprocessable_entity }
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# PUT /patron_merges/1
|
65
|
+
# PUT /patron_merges/1.json
|
66
|
+
def update
|
67
|
+
respond_to do |format|
|
68
|
+
if @patron_merge.update_attributes(params[:patron_merge])
|
69
|
+
flash[:notice] = t('controller.successfully_updated', :model => t('activerecord.models.patron_merge'))
|
70
|
+
format.html { redirect_to(@patron_merge) }
|
71
|
+
format.json { head :ok }
|
72
|
+
else
|
73
|
+
format.html { render :action => "edit" }
|
74
|
+
format.json { render :json => @patron_merge.errors, :status => :unprocessable_entity }
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# DELETE /patron_merges/1
|
80
|
+
# DELETE /patron_merges/1.json
|
81
|
+
def destroy
|
82
|
+
@patron_merge.destroy
|
83
|
+
|
84
|
+
respond_to do |format|
|
85
|
+
format.html { redirect_to(patron_merges_url) }
|
86
|
+
format.json { head :ok }
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
class SeriesStatementMergeListsController < ApplicationController
|
2
|
+
load_and_authorize_resource
|
3
|
+
|
4
|
+
# GET /series_statement_merge_lists
|
5
|
+
# GET /series_statement_merge_lists.json
|
6
|
+
def index
|
7
|
+
@series_statement_merge_lists = SeriesStatementMergeList.page(params[:page])
|
8
|
+
|
9
|
+
respond_to do |format|
|
10
|
+
format.html # index.html.erb
|
11
|
+
format.json { render :json => @series_statement_merge_lists }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# GET /series_statement_merge_lists/1
|
16
|
+
# GET /series_statement_merge_lists/1.json
|
17
|
+
def show
|
18
|
+
respond_to do |format|
|
19
|
+
format.html # show.html.erb
|
20
|
+
format.json { render :json => @series_statement_merge_list }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# GET /series_statement_merge_lists/new
|
25
|
+
# GET /series_statement_merge_lists/new.json
|
26
|
+
def new
|
27
|
+
@series_statement_merge_list = SeriesStatementMergeList.new
|
28
|
+
|
29
|
+
respond_to do |format|
|
30
|
+
format.html # new.html.erb
|
31
|
+
format.json { render :json => @series_statement_merge_list }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# GET /series_statement_merge_lists/1/edit
|
36
|
+
def edit
|
37
|
+
end
|
38
|
+
|
39
|
+
# POST /series_statement_merge_lists
|
40
|
+
# POST /series_statement_merge_lists.json
|
41
|
+
def create
|
42
|
+
@series_statement_merge_list = SeriesStatementMergeList.new(params[:series_statement_merge_list])
|
43
|
+
|
44
|
+
respond_to do |format|
|
45
|
+
if @series_statement_merge_list.save
|
46
|
+
flash[:notice] = t('controller.successfully_created', :model => t('activerecord.models.series_statement_merge_list'))
|
47
|
+
format.html { redirect_to(@series_statement_merge_list) }
|
48
|
+
format.json { render :json => @series_statement_merge_list, :status => :created, :location => @series_statement_merge_list }
|
49
|
+
else
|
50
|
+
format.html { render :action => "new" }
|
51
|
+
format.json { render :json => @series_statement_merge_list.errors, :status => :unprocessable_entity }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# PUT /series_statement_merge_lists/1
|
57
|
+
# PUT /series_statement_merge_lists/1.json
|
58
|
+
def update
|
59
|
+
respond_to do |format|
|
60
|
+
if @series_statement_merge_list.update_attributes(params[:series_statement_merge_list])
|
61
|
+
if params[:mode] == 'merge'
|
62
|
+
selected_series_statement = SeriesStatement.find(params[:selected_series_statement_id]) rescue nil
|
63
|
+
if selected_series_statement
|
64
|
+
@series_statement_merge_list.merge_series_statements(selected_series_statement)
|
65
|
+
flash[:notice] = t('merge_list.successfully_merged', :model => t('activerecord.models.series_statement'))
|
66
|
+
else
|
67
|
+
flash[:notice] = t('merge_list.specify_id', :model => t('activerecord.models.series_statement'))
|
68
|
+
redirect_to series_statement_merge_list_url(@series_statement_merge_list)
|
69
|
+
return
|
70
|
+
end
|
71
|
+
else
|
72
|
+
flash[:notice] = t('controller.successfully_updated', :model => t('activerecord.models.series_statement_merge_list'))
|
73
|
+
end
|
74
|
+
format.html { redirect_to(@series_statement_merge_list) }
|
75
|
+
format.json { head :ok }
|
76
|
+
else
|
77
|
+
format.html { render :action => "edit" }
|
78
|
+
format.json { render :json => @series_statement_merge_list.errors, :status => :unprocessable_entity }
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# DELETE /series_statement_merge_lists/1
|
84
|
+
# DELETE /series_statement_merge_lists/1.json
|
85
|
+
def destroy
|
86
|
+
@series_statement_merge_list.destroy
|
87
|
+
|
88
|
+
respond_to do |format|
|
89
|
+
format.html { redirect_to(series_statement_merge_lists_url) }
|
90
|
+
format.json { head :ok }
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
class SeriesStatementMergesController < ApplicationController
|
2
|
+
load_and_authorize_resource
|
3
|
+
before_filter :get_series_statement, :get_series_statement_merge_list
|
4
|
+
|
5
|
+
# GET /series_statement_merges
|
6
|
+
# GET /series_statement_merges.json
|
7
|
+
def index
|
8
|
+
if @series_statement
|
9
|
+
@series_statement_merges = @series_statement.series_statement_merges.order('series_statement_merges.id').page(params[:page])
|
10
|
+
elsif @series_statement_merge_list
|
11
|
+
@series_statement_merges = @series_statement_merge_list.series_statement_merges.order('series_statement_merges.id').includes(:series_statement).page(params[:page])
|
12
|
+
else
|
13
|
+
@series_statement_merges = SeriesStatementMerge.page(params[:page])
|
14
|
+
end
|
15
|
+
|
16
|
+
respond_to do |format|
|
17
|
+
format.html # index.html.erb
|
18
|
+
format.json { render :json => @series_statement_merges }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# GET /series_statement_merges/1
|
23
|
+
# GET /series_statement_merges/1.json
|
24
|
+
def show
|
25
|
+
respond_to do |format|
|
26
|
+
format.html # show.html.erb
|
27
|
+
format.json { render :json => @series_statement_merge }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# GET /series_statement_merges/new
|
32
|
+
# GET /series_statement_merges/new.json
|
33
|
+
def new
|
34
|
+
@series_statement_merge = SeriesStatementMerge.new
|
35
|
+
@series_statement_merge.series_statement = @series_statement
|
36
|
+
|
37
|
+
respond_to do |format|
|
38
|
+
format.html # new.html.erb
|
39
|
+
format.json { render :json => @series_statement_merge }
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# GET /series_statement_merges/1/edit
|
44
|
+
def edit
|
45
|
+
end
|
46
|
+
|
47
|
+
# POST /series_statement_merges
|
48
|
+
# POST /series_statement_merges.json
|
49
|
+
def create
|
50
|
+
@series_statement_merge = SeriesStatementMerge.new(params[:series_statement_merge])
|
51
|
+
|
52
|
+
respond_to do |format|
|
53
|
+
if @series_statement_merge.save
|
54
|
+
flash[:notice] = t('controller.successfully_created', :model => t('activerecord.models.series_statement_merge'))
|
55
|
+
format.html { redirect_to(@series_statement_merge) }
|
56
|
+
format.json { render :json => @series_statement_merge, :status => :created, :location => @series_statement_merge }
|
57
|
+
else
|
58
|
+
format.html { render :action => "new" }
|
59
|
+
format.json { render :json => @series_statement_merge.errors, :status => :unprocessable_entity }
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# PUT /series_statement_merges/1
|
65
|
+
# PUT /series_statement_merges/1.json
|
66
|
+
def update
|
67
|
+
respond_to do |format|
|
68
|
+
if @series_statement_merge.update_attributes(params[:series_statement_merge])
|
69
|
+
flash[:notice] = t('controller.successfully_updated', :model => t('activerecord.models.series_statement_merge'))
|
70
|
+
format.html { redirect_to(@series_statement_merge) }
|
71
|
+
format.json { head :ok }
|
72
|
+
else
|
73
|
+
format.html { render :action => "edit" }
|
74
|
+
format.json { render :json => @series_statement_merge.errors, :status => :unprocessable_entity }
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# DELETE /series_statement_merges/1
|
80
|
+
# DELETE /series_statement_merges/1.json
|
81
|
+
def destroy
|
82
|
+
@series_statement_merge.destroy
|
83
|
+
|
84
|
+
respond_to do |format|
|
85
|
+
format.html { redirect_to(series_statement_merges_url) }
|
86
|
+
format.json { head :ok }
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
private
|
91
|
+
def get_series_statement_merge_list
|
92
|
+
@series_statement_merge_list = SeriesStatementMerge_list.find(params[:series_statement_merge_list_id]) if params[:series_statement_merge_list_id]
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class PatronMerge < ActiveRecord::Base
|
2
|
+
belongs_to :patron, :validate => true
|
3
|
+
belongs_to :patron_merge_list, :validate => true
|
4
|
+
validates_presence_of :patron, :patron_merge_list
|
5
|
+
validates_associated :patron, :patron_merge_list
|
6
|
+
|
7
|
+
def self.per_page
|
8
|
+
10
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
# == Schema Information
|
13
|
+
#
|
14
|
+
# Table name: patron_merges
|
15
|
+
#
|
16
|
+
# id :integer not null, primary key
|
17
|
+
# patron_id :integer not null
|
18
|
+
# patron_merge_list_id :integer not null
|
19
|
+
# created_at :datetime
|
20
|
+
# updated_at :datetime
|
21
|
+
#
|
22
|
+
|