kete_trackable_items 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.document +5 -0
- data/.gitignore +21 -0
- data/.specification +146 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +27 -0
- data/LICENSE +20 -0
- data/README.rdoc +24 -0
- data/Rakefile +53 -0
- data/VERSION +1 -0
- data/app/controllers/repositories_controller.rb +70 -0
- data/app/controllers/shelf_locations_controller.rb +98 -0
- data/app/controllers/trackable_item_shelf_locations_controller.rb +64 -0
- data/app/controllers/tracked_items_controller.rb +44 -0
- data/app/controllers/tracking_lists_controller.rb +88 -0
- data/app/helpers/trackable_item_shelf_locations_helper.rb +17 -0
- data/app/helpers/trackable_items_helper.rb +52 -0
- data/app/models/on_loan_organization.rb +8 -0
- data/app/models/repository.rb +11 -0
- data/app/models/shelf_location.rb +69 -0
- data/app/models/trackable_item_shelf_location.rb +58 -0
- data/app/models/tracked_item.rb +18 -0
- data/app/models/tracking_list.rb +50 -0
- data/app/views/repositories/_form.html.erb +14 -0
- data/app/views/repositories/edit.html.erb +9 -0
- data/app/views/repositories/index.html.erb +22 -0
- data/app/views/repositories/new.html.erb +9 -0
- data/app/views/repositories/show.html.erb +30 -0
- data/app/views/shelf_locations/_event_button.html.erb +1 -0
- data/app/views/shelf_locations/_form.html.erb +34 -0
- data/app/views/shelf_locations/_shelf_location.html.erb +17 -0
- data/app/views/shelf_locations/_shelf_locations.html.erb +14 -0
- data/app/views/shelf_locations/_trackable_item.html.erb +12 -0
- data/app/views/shelf_locations/edit.html.erb +9 -0
- data/app/views/shelf_locations/index.html.erb +7 -0
- data/app/views/shelf_locations/new.html.erb +9 -0
- data/app/views/shelf_locations/show.html.erb +48 -0
- data/app/views/trackable_item_shelf_locations/new.html.erb +70 -0
- data/app/views/tracked_items/_tracked_item.html.erb +18 -0
- data/app/views/tracking_lists/_event_button.html.erb +1 -0
- data/app/views/tracking_lists/_form.html.erb +27 -0
- data/app/views/tracking_lists/_trackable_item_search_form.html.erb +28 -0
- data/app/views/tracking_lists/_tracking_list.html.erb +11 -0
- data/app/views/tracking_lists/_tracking_lists.html.erb +14 -0
- data/app/views/tracking_lists/edit.html.erb +9 -0
- data/app/views/tracking_lists/index.html.erb +11 -0
- data/app/views/tracking_lists/show.html.erb +45 -0
- data/app/views/tracking_lists/show.xls.builder +48 -0
- data/config/locales/en.yml +151 -0
- data/config/routes.rb +6 -0
- data/generators/kete_trackable_items_migrations/USAGE +2 -0
- data/generators/kete_trackable_items_migrations/kete_trackable_items_migrations_generator.rb +19 -0
- data/generators/kete_trackable_items_migrations/templates/add_trackable_item_columns_to_topics.rb +15 -0
- data/generators/kete_trackable_items_migrations/templates/create_on_loan_organizations.rb +14 -0
- data/generators/kete_trackable_items_migrations/templates/create_repositories.rb +14 -0
- data/generators/kete_trackable_items_migrations/templates/create_shelf_locations.rb +15 -0
- data/generators/kete_trackable_items_migrations/templates/create_trackable_item_shelf_locations.rb +16 -0
- data/generators/kete_trackable_items_migrations/templates/create_tracked_items.rb +15 -0
- data/generators/kete_trackable_items_migrations/templates/create_tracking_lists.rb +15 -0
- data/kete_trackable_items.gemspec +25 -0
- data/lib/kete_trackable_items.rb +0 -0
- data/lib/kete_trackable_items/controller_helpers.rb +7 -0
- data/lib/kete_trackable_items/extensions/helpers/application_helper.rb +29 -0
- data/lib/kete_trackable_items/extensions/models/basket.rb +4 -0
- data/lib/kete_trackable_items/extensions/models/topic.rb +6 -0
- data/lib/kete_trackable_items/matching_trackable_items_controller_helpers.rb +42 -0
- data/lib/kete_trackable_items/trackable_item.rb +80 -0
- data/lib/kete_trackable_items/version.rb +3 -0
- data/lib/kete_trackable_items/workflow_utilities.rb +91 -0
- data/rails/init.rb +68 -0
- metadata +166 -0
data/.document
ADDED
data/.gitignore
ADDED
data/.specification
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kete_trackable_items
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
segments_generated: true
|
11
|
+
version: 0.0.1
|
12
|
+
platform: ruby
|
13
|
+
authors:
|
14
|
+
- Walter McGinnis
|
15
|
+
- Noel Gomez
|
16
|
+
- Chris Toynbee
|
17
|
+
autorequire:
|
18
|
+
bindir: bin
|
19
|
+
cert_chain: []
|
20
|
+
|
21
|
+
date: 2012-04-18 00:00:00 +12:00
|
22
|
+
default_executable:
|
23
|
+
dependencies:
|
24
|
+
- !ruby/object:Gem::Dependency
|
25
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ">="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
hash: 3
|
31
|
+
segments:
|
32
|
+
- 0
|
33
|
+
segments_generated: true
|
34
|
+
version: "0"
|
35
|
+
requirement: *id001
|
36
|
+
name: thoughtbot-shoulda
|
37
|
+
prerelease: false
|
38
|
+
type: :development
|
39
|
+
- !ruby/object:Gem::Dependency
|
40
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 3
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
segments_generated: true
|
49
|
+
version: "0"
|
50
|
+
requirement: *id002
|
51
|
+
name: jeweler
|
52
|
+
prerelease: false
|
53
|
+
type: :development
|
54
|
+
description: A Kete application add-on that allows for tracking the location of an item in a physical archive that corresponds to the item in the Kete application.
|
55
|
+
email:
|
56
|
+
- ctoynbee@gmail.com
|
57
|
+
- walter@katipo.co.nz
|
58
|
+
executables: []
|
59
|
+
|
60
|
+
extensions: []
|
61
|
+
|
62
|
+
extra_rdoc_files: []
|
63
|
+
|
64
|
+
files:
|
65
|
+
- .document
|
66
|
+
- .gitignore
|
67
|
+
- .specification
|
68
|
+
- Gemfile
|
69
|
+
- Gemfile.lock
|
70
|
+
- LICENSE
|
71
|
+
- README.rdoc
|
72
|
+
- Rakefile
|
73
|
+
- VERSION
|
74
|
+
- app/controllers/repositories_controller.rb
|
75
|
+
- app/controllers/shelf_locations_controller.rb
|
76
|
+
- app/controllers/tracked_items_controller.rb
|
77
|
+
- app/controllers/tracking_lists_controller.rb
|
78
|
+
- app/helpers/kete_trackable_items_helper.rb
|
79
|
+
- app/models/on_loan_organisation.rb
|
80
|
+
- app/models/repository.rb
|
81
|
+
- app/models/shelf_location.rb
|
82
|
+
- app/models/tracked_item.rb
|
83
|
+
- app/models/tracking_list.rb
|
84
|
+
- app/views/repositories/_form.html.erb
|
85
|
+
- app/views/repositories/edit.html.erb
|
86
|
+
- app/views/repositories/index.html.erb
|
87
|
+
- app/views/repositories/new.html.erb
|
88
|
+
- app/views/repositories/show.html.erb
|
89
|
+
- app/views/shelf_locations/_form.html.erb
|
90
|
+
- app/views/shelf_locations/_index.html.erb
|
91
|
+
- app/views/shelf_locations/edit.html.erb
|
92
|
+
- app/views/shelf_locations/new.html.erb
|
93
|
+
- app/views/shelf_locations/show.html.erb
|
94
|
+
- app/views/tracked_items/index.html.erb
|
95
|
+
- app/views/tracking_lists/index.html.erb
|
96
|
+
- config/routes.rb
|
97
|
+
- generators/kete_trackable_items_migrations/USAGE
|
98
|
+
- generators/kete_trackable_items_migrations/migrations_generator.rb
|
99
|
+
- generators/kete_trackable_items_migrations/templates/create_repositories.rb
|
100
|
+
- generators/kete_trackable_items_migrations/templates/create_shelf_locations.rb
|
101
|
+
- generators/kete_trackable_items_migrations/templates/create_tracked_items.rb
|
102
|
+
- generators/kete_trackable_items_migrations/templates/create_tracking_lists.rb
|
103
|
+
- generators/kete_trackable_items_migrations/templates/trackable_items_shelf_locations.rb
|
104
|
+
- kete_trackable_items.gemspec
|
105
|
+
- lib/kete_trackable_items/version.rb
|
106
|
+
- lib/kete_trackable_items_controller_helpers.rb
|
107
|
+
- lib/trackable_items.rb
|
108
|
+
- rails/init.rb
|
109
|
+
has_rdoc: true
|
110
|
+
homepage: ""
|
111
|
+
licenses: []
|
112
|
+
|
113
|
+
post_install_message:
|
114
|
+
rdoc_options: []
|
115
|
+
|
116
|
+
require_paths:
|
117
|
+
- lib
|
118
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
119
|
+
none: false
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
hash: 3
|
124
|
+
segments:
|
125
|
+
- 0
|
126
|
+
segments_generated: true
|
127
|
+
version: "0"
|
128
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
hash: 3
|
134
|
+
segments:
|
135
|
+
- 0
|
136
|
+
segments_generated: true
|
137
|
+
version: "0"
|
138
|
+
requirements: []
|
139
|
+
|
140
|
+
rubyforge_project: kete_trackable_items
|
141
|
+
rubygems_version: 1.3.7
|
142
|
+
signing_key:
|
143
|
+
specification_version: 3
|
144
|
+
summary: A Rails engine gem that works in conjunction with kete_gets_trollied to track where an item (with a corresponding physical archive) is physically located.
|
145
|
+
test_files: []
|
146
|
+
|
data/Gemfile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
gemspec
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
kete_trackable_items (0.0.1)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: http://rubygems.org/
|
8
|
+
specs:
|
9
|
+
git (1.2.5)
|
10
|
+
jeweler (1.8.3)
|
11
|
+
bundler (~> 1.0)
|
12
|
+
git (>= 1.2.5)
|
13
|
+
rake
|
14
|
+
rdoc
|
15
|
+
json (1.6.6)
|
16
|
+
rake (0.9.2.2)
|
17
|
+
rdoc (3.12)
|
18
|
+
json (~> 1.4)
|
19
|
+
thoughtbot-shoulda (2.11.1)
|
20
|
+
|
21
|
+
PLATFORMS
|
22
|
+
ruby
|
23
|
+
|
24
|
+
DEPENDENCIES
|
25
|
+
jeweler
|
26
|
+
kete_trackable_items!
|
27
|
+
thoughtbot-shoulda
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 Horowhenua Library Trust
|
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
@@ -0,0 +1,24 @@
|
|
1
|
+
= kete_trackable_items
|
2
|
+
|
3
|
+
A Rails engine gem that works in conjunction with kete_gets_trollied to track where an item (with a corresponding physical archive) is physically located.
|
4
|
+
|
5
|
+
== Usage
|
6
|
+
|
7
|
+
You'll need to add the following to your application's config/initializers/mime_types.rb
|
8
|
+
|
9
|
+
Mime::Type.register "application/vnd.ms-excel", :xls
|
10
|
+
|
11
|
+
== Note on Patches/Pull Requests
|
12
|
+
|
13
|
+
* Fork the project.
|
14
|
+
* Open an issue for feature or bug fix.
|
15
|
+
* Create a corresponding branch for the issue, similar to the way working for branches is outlined here (particularly in regards to naming of branch): http://kete.net.nz/documentation/topics/show/326-working-with-git-branches-on-github
|
16
|
+
* Add tests for it. This is important so I don't break it in a
|
17
|
+
future version unintentionally.
|
18
|
+
* Commit, do not mess with rakefile, version, or history.
|
19
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
20
|
+
* Send me a pull request. Bonus points for topic branches.
|
21
|
+
|
22
|
+
== Copyright
|
23
|
+
|
24
|
+
Copyright (c) 2012 Horowhenua Library Trust. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "kete_trackable_items"
|
8
|
+
gem.summary = %Q{A Rails engine gem that works in conjunction with kete_gets_trollied to track where an item (with a corresponding physical archive) is physically located.}
|
9
|
+
gem.description = %Q{A Kete application add-on that allows for tracking the location of an item in a physical archive that corresponds to the item in the Kete application.}
|
10
|
+
gem.email = "walter@katipo.co.nz"
|
11
|
+
gem.homepage = "http://github.com/kete/kete_trackable_items"
|
12
|
+
gem.authors = ["Walter McGinnis", "Noel Gomez", "Chris Toynbee"]
|
13
|
+
gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
|
14
|
+
gem.add_dependency "kete_gets_trollied"
|
15
|
+
gem.add_dependency "workflow", ">= 0.8.0"
|
16
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
17
|
+
end
|
18
|
+
Jeweler::GemcutterTasks.new
|
19
|
+
rescue LoadError
|
20
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
21
|
+
end
|
22
|
+
|
23
|
+
require 'rake/testtask'
|
24
|
+
Rake::TestTask.new(:test) do |test|
|
25
|
+
# in the future may include own tests under dummy app or generators for kete app specific tests.
|
26
|
+
end
|
27
|
+
|
28
|
+
begin
|
29
|
+
require 'rcov/rcovtask'
|
30
|
+
Rcov::RcovTask.new do |test|
|
31
|
+
test.libs << 'test'
|
32
|
+
test.pattern = 'test/**/test_*.rb'
|
33
|
+
test.verbose = true
|
34
|
+
end
|
35
|
+
rescue LoadError
|
36
|
+
task :rcov do
|
37
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
task :test => :check_dependencies
|
42
|
+
|
43
|
+
task :default => :test
|
44
|
+
|
45
|
+
require 'rake/rdoctask'
|
46
|
+
Rake::RDocTask.new do |rdoc|
|
47
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
48
|
+
|
49
|
+
rdoc.rdoc_dir = 'rdoc'
|
50
|
+
rdoc.title = "kete_trackable_items #{version}"
|
51
|
+
rdoc.rdoc_files.include('README*')
|
52
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
53
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
@@ -0,0 +1,70 @@
|
|
1
|
+
class RepositoriesController < ApplicationController
|
2
|
+
# Prevents the following error from showing up, common in Rails engines
|
3
|
+
# A copy of ApplicationController has been removed from the module tree but is still active!
|
4
|
+
unloadable
|
5
|
+
|
6
|
+
before_filter :get_repository, :except => [:new, :create, :index]
|
7
|
+
|
8
|
+
READABLE_ACTIONS = [:show, :index]
|
9
|
+
|
10
|
+
permit "site_admin or admin of :site_basket", :except => READABLE_ACTIONS
|
11
|
+
|
12
|
+
permit "site_admin or admin of :site_basket or moderator of :current_basket or admin of :current_basket", :only => READABLE_ACTIONS
|
13
|
+
|
14
|
+
def index
|
15
|
+
@repositories = appropriate_repositories_for_basket
|
16
|
+
end
|
17
|
+
|
18
|
+
def show
|
19
|
+
end
|
20
|
+
|
21
|
+
def new
|
22
|
+
@repository = Repository.new
|
23
|
+
end
|
24
|
+
|
25
|
+
def edit
|
26
|
+
end
|
27
|
+
|
28
|
+
def create
|
29
|
+
# a repository belongs to whatever basket it was created in
|
30
|
+
params[:repository][:basket_id] = @current_basket.id
|
31
|
+
|
32
|
+
@repository = Repository.new(params[:repository])
|
33
|
+
|
34
|
+
if @repository.save
|
35
|
+
redirect_to repository_url(:id => @repository)
|
36
|
+
else
|
37
|
+
render :action => 'new'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def update
|
42
|
+
if @repository.update_attributes(params[:repository])
|
43
|
+
redirect_to repository_url(:id => @repository)
|
44
|
+
else
|
45
|
+
render :action => 'edit'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def destroy
|
50
|
+
@repository.destroy
|
51
|
+
|
52
|
+
redirect_to repositories_url
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def get_repository
|
58
|
+
begin
|
59
|
+
@repository = @current_basket.repositories.find(params[:id])
|
60
|
+
rescue
|
61
|
+
@repository = Repository.find(params[:id])
|
62
|
+
|
63
|
+
if @current_basket != @repository.basket
|
64
|
+
redirect_to url_for(:urlified_name => @site_basket.urlified_name,
|
65
|
+
:action => params[:action],
|
66
|
+
:id => params[:id])
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
class ShelfLocationsController < ApplicationController
|
2
|
+
# Prevents the following error from showing up, common in Rails engines
|
3
|
+
# A copy of ApplicationController has been removed from the module tree but is still active!
|
4
|
+
unloadable
|
5
|
+
|
6
|
+
include KeteTrackableItems::MatchingTrackableItemsControllerHelpers
|
7
|
+
|
8
|
+
before_filter :set_repository
|
9
|
+
before_filter :set_shelf_location, :except => [:index, :create, :new]
|
10
|
+
|
11
|
+
def index
|
12
|
+
if params[:code_pattern].present?
|
13
|
+
@code_pattern = params[:code_pattern]
|
14
|
+
pattern_for_sql = @code_pattern.downcase + '%'
|
15
|
+
@shelf_locations = @repository.shelf_locations.find(:all,
|
16
|
+
:conditions => ["LOWER(code) like :pattern_for_sql",
|
17
|
+
{ :pattern_for_sql => pattern_for_sql }])
|
18
|
+
else
|
19
|
+
@shelf_locations = @repository.shelf_locations
|
20
|
+
end
|
21
|
+
|
22
|
+
respond_to do |format|
|
23
|
+
format.html
|
24
|
+
format.json { render :json => @shelf_locations }
|
25
|
+
format.js do
|
26
|
+
render :inline => "<%= auto_complete_result(@shelf_locations, :code) %>"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def show
|
32
|
+
@possible_events = @shelf_location.current_state.events.keys.collect(&:to_s).sort
|
33
|
+
|
34
|
+
# this is always done through creation of trackable_item_shelf_location
|
35
|
+
@possible_events -= ['allocate']
|
36
|
+
|
37
|
+
# not available through this interface
|
38
|
+
@possible_events -= ['deallocate']
|
39
|
+
end
|
40
|
+
|
41
|
+
def new
|
42
|
+
@shelf_location = @repository.shelf_locations.new
|
43
|
+
end
|
44
|
+
|
45
|
+
def edit
|
46
|
+
set_matching_trackable_items
|
47
|
+
|
48
|
+
build_items_for_matching_trackable_items_for(@shelf_location, :trackable_item_shelf_locations)
|
49
|
+
end
|
50
|
+
|
51
|
+
def create
|
52
|
+
@shelf_location = @repository.shelf_locations.build(params[:shelf_location])
|
53
|
+
|
54
|
+
if @shelf_location.save
|
55
|
+
redirect_to repository_shelf_location_url(:id => @shelf_location,
|
56
|
+
:repository_id => @repository)
|
57
|
+
else
|
58
|
+
render :action => 'new'
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def update
|
63
|
+
if params[:event]
|
64
|
+
original_state = @shelf_location.current_state
|
65
|
+
event_method = params[:event] + '!'
|
66
|
+
@shelf_location.send(event_method)
|
67
|
+
@successful = @shelf_location.current_state != original_state
|
68
|
+
@state_change_failed = @succesful
|
69
|
+
else
|
70
|
+
@successful = @shelf_location.update_attributes(params[:shelf_location])
|
71
|
+
end
|
72
|
+
|
73
|
+
if @successful || @state_change_failed
|
74
|
+
flash[:notice] = t('shelf_locations.update.state_change_failed', :event_transition => params[:event].humanize) if @state_change_failed
|
75
|
+
|
76
|
+
redirect_to repository_shelf_location_url(:id => @shelf_location,
|
77
|
+
:repository_id => @repository)
|
78
|
+
else
|
79
|
+
render :action => 'edit'
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def destroy
|
84
|
+
@shelf_location.destroy
|
85
|
+
|
86
|
+
redirect_to repository_url(:id => @repository)
|
87
|
+
end
|
88
|
+
|
89
|
+
private
|
90
|
+
|
91
|
+
def set_repository
|
92
|
+
@repository = Repository.find(params[:repository_id])
|
93
|
+
end
|
94
|
+
|
95
|
+
def set_shelf_location
|
96
|
+
@shelf_location = @repository.shelf_locations.find(params[:id])
|
97
|
+
end
|
98
|
+
end
|