kete_trackable_items 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. data/.document +5 -0
  2. data/.gitignore +21 -0
  3. data/.specification +146 -0
  4. data/Gemfile +1 -0
  5. data/Gemfile.lock +27 -0
  6. data/LICENSE +20 -0
  7. data/README.rdoc +24 -0
  8. data/Rakefile +53 -0
  9. data/VERSION +1 -0
  10. data/app/controllers/repositories_controller.rb +70 -0
  11. data/app/controllers/shelf_locations_controller.rb +98 -0
  12. data/app/controllers/trackable_item_shelf_locations_controller.rb +64 -0
  13. data/app/controllers/tracked_items_controller.rb +44 -0
  14. data/app/controllers/tracking_lists_controller.rb +88 -0
  15. data/app/helpers/trackable_item_shelf_locations_helper.rb +17 -0
  16. data/app/helpers/trackable_items_helper.rb +52 -0
  17. data/app/models/on_loan_organization.rb +8 -0
  18. data/app/models/repository.rb +11 -0
  19. data/app/models/shelf_location.rb +69 -0
  20. data/app/models/trackable_item_shelf_location.rb +58 -0
  21. data/app/models/tracked_item.rb +18 -0
  22. data/app/models/tracking_list.rb +50 -0
  23. data/app/views/repositories/_form.html.erb +14 -0
  24. data/app/views/repositories/edit.html.erb +9 -0
  25. data/app/views/repositories/index.html.erb +22 -0
  26. data/app/views/repositories/new.html.erb +9 -0
  27. data/app/views/repositories/show.html.erb +30 -0
  28. data/app/views/shelf_locations/_event_button.html.erb +1 -0
  29. data/app/views/shelf_locations/_form.html.erb +34 -0
  30. data/app/views/shelf_locations/_shelf_location.html.erb +17 -0
  31. data/app/views/shelf_locations/_shelf_locations.html.erb +14 -0
  32. data/app/views/shelf_locations/_trackable_item.html.erb +12 -0
  33. data/app/views/shelf_locations/edit.html.erb +9 -0
  34. data/app/views/shelf_locations/index.html.erb +7 -0
  35. data/app/views/shelf_locations/new.html.erb +9 -0
  36. data/app/views/shelf_locations/show.html.erb +48 -0
  37. data/app/views/trackable_item_shelf_locations/new.html.erb +70 -0
  38. data/app/views/tracked_items/_tracked_item.html.erb +18 -0
  39. data/app/views/tracking_lists/_event_button.html.erb +1 -0
  40. data/app/views/tracking_lists/_form.html.erb +27 -0
  41. data/app/views/tracking_lists/_trackable_item_search_form.html.erb +28 -0
  42. data/app/views/tracking_lists/_tracking_list.html.erb +11 -0
  43. data/app/views/tracking_lists/_tracking_lists.html.erb +14 -0
  44. data/app/views/tracking_lists/edit.html.erb +9 -0
  45. data/app/views/tracking_lists/index.html.erb +11 -0
  46. data/app/views/tracking_lists/show.html.erb +45 -0
  47. data/app/views/tracking_lists/show.xls.builder +48 -0
  48. data/config/locales/en.yml +151 -0
  49. data/config/routes.rb +6 -0
  50. data/generators/kete_trackable_items_migrations/USAGE +2 -0
  51. data/generators/kete_trackable_items_migrations/kete_trackable_items_migrations_generator.rb +19 -0
  52. data/generators/kete_trackable_items_migrations/templates/add_trackable_item_columns_to_topics.rb +15 -0
  53. data/generators/kete_trackable_items_migrations/templates/create_on_loan_organizations.rb +14 -0
  54. data/generators/kete_trackable_items_migrations/templates/create_repositories.rb +14 -0
  55. data/generators/kete_trackable_items_migrations/templates/create_shelf_locations.rb +15 -0
  56. data/generators/kete_trackable_items_migrations/templates/create_trackable_item_shelf_locations.rb +16 -0
  57. data/generators/kete_trackable_items_migrations/templates/create_tracked_items.rb +15 -0
  58. data/generators/kete_trackable_items_migrations/templates/create_tracking_lists.rb +15 -0
  59. data/kete_trackable_items.gemspec +25 -0
  60. data/lib/kete_trackable_items.rb +0 -0
  61. data/lib/kete_trackable_items/controller_helpers.rb +7 -0
  62. data/lib/kete_trackable_items/extensions/helpers/application_helper.rb +29 -0
  63. data/lib/kete_trackable_items/extensions/models/basket.rb +4 -0
  64. data/lib/kete_trackable_items/extensions/models/topic.rb +6 -0
  65. data/lib/kete_trackable_items/matching_trackable_items_controller_helpers.rb +42 -0
  66. data/lib/kete_trackable_items/trackable_item.rb +80 -0
  67. data/lib/kete_trackable_items/version.rb +3 -0
  68. data/lib/kete_trackable_items/workflow_utilities.rb +91 -0
  69. data/rails/init.rb +68 -0
  70. metadata +166 -0
@@ -0,0 +1,11 @@
1
+ <% @title = t('.title', :name => h(@repository.name)) -%>
2
+
3
+ <h2><%= @title -%></h2>
4
+
5
+ <%= render :partial => 'tracking_lists', :locals => { :repository => @repository, :tracking_lists => @tracking_lists } -%>
6
+
7
+ <p><%= button_to t('.new'),
8
+ repository_tracking_lists_url(:repository_id => @repository, :method => :post) %></p>
9
+
10
+ <p><%= link_to t('.back_to', :name => h(@repository.name)), repository_url(:id => @repository) %></p>
11
+
@@ -0,0 +1,45 @@
1
+ <% @title = t('.title', :state_name => @tracking_list.current_state_humanized) -%>
2
+ <fieldset class="tracking_list">
3
+ <h3><%= @title -%> (<%= link_to(t('.download_for_excel'), repository_tracking_list_url(:id => @tracking_list, :repository_id => @tracking_list.repository, :format => :xls)) -%>)</h3>
4
+ <table class="order">
5
+ <tr>
6
+ <th abbr="Actions for Tracked Item"><%= t '.tracked_item_actions' %></th>
7
+ <th abbr="Tracked Item Series No"><%= t '.tracked_item_series_no' -%></th>
8
+ <th abbr="Tracked Item Box No"><%= t '.tracked_item_box_no' -%></th>
9
+ <th abbr="Tracked Item Item No"><%= t '.tracked_item_item_no' -%></th>
10
+ <th abbr="Tracked Item Shelf Code"><%= t '.tracked_item_shelf_code' -%></th>
11
+ <th abbr="Tracked Item"><%= t '.tracked_item_description' -%></th>
12
+ </tr>
13
+
14
+ <% if @tracking_list.tracked_items.count > 0 -%>
15
+ <%= render :partial => 'tracked_items/tracked_item', :collection => @tracking_list.tracked_items, :locals => { :tracking_list => @tracking_list } -%>
16
+ <% else -%>
17
+ <tr><td><%= t '.not_items_in_tracking_list' %></td></tr>
18
+ <% end -%>
19
+
20
+ <tr class="order-buttons">
21
+ <td><%= t '.tracking_list_controls_preface' -%></td>
22
+
23
+ <td colspan="5">
24
+ <% if @tracking_list.current_state.name == :new -%>
25
+ <%= add_trackable_items_links -%>
26
+ <% end -%>
27
+
28
+ <% if @tracking_list.tracked_items.count > 0 -%>
29
+ <%= render :partial => 'event_button', :collection => @possible_events, :locals => { :tracking_list => @tracking_list } %>
30
+ <% end -%>
31
+
32
+ <%= button_to(t('.delete_tracking_list'), repository_tracking_list_url(:id => @tracking_list, :repository_id => @repository),
33
+ :confirm => t('.are_you_sure'),
34
+ :method => :delete) %>
35
+ </td>
36
+
37
+ </tr>
38
+ </table>
39
+
40
+ <div id="trackable_item_search_form" style="display: none;">
41
+ <%= render :partial => 'trackable_item_search_form', :locals => { :target => @tracking_list } -%>
42
+ </div>
43
+ </fieldset>
44
+
45
+ <%= link_to t('.back_to', :name => h(@repository.name)), repository_url(:id => @repository) %>
@@ -0,0 +1,48 @@
1
+ xml.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8"
2
+ xml.Workbook({
3
+ 'xmlns' => "urn:schemas-microsoft-com:office:spreadsheet",
4
+ 'xmlns:o' => "urn:schemas-microsoft-com:office:office",
5
+ 'xmlns:x' => "urn:schemas-microsoft-com:office:excel",
6
+ 'xmlns:html' => "http://www.w3.org/TR/REC-html40",
7
+ 'xmlns:ss' => "urn:schemas-microsoft-com:office:spreadsheet"
8
+ }) do
9
+
10
+ xml.Worksheet 'ss:Name' => t('.tracked_items') do
11
+ xml.Table do
12
+ # Tracked List Header
13
+ xml.Row do
14
+ xml.Cell { xml.Data 'List ID', 'ss:Type' => 'String' }
15
+ xml.Cell { xml.Data 'Repository', 'ss:Type' => 'String' }
16
+ xml.Cell { xml.Data 'Current State', 'ss:Type' => 'String' }
17
+ end
18
+
19
+ # Tracked List Data
20
+ xml.Row do
21
+ xml.Cell { xml.Data @tracking_list.id, 'ss:Type' => 'String' }
22
+ xml.Cell { xml.Data @tracking_list.repository.name, 'ss:Type' => 'String' }
23
+ xml.Cell { xml.Data @tracking_list.current_state_humanized, 'ss:Type' => 'String' }
24
+ end
25
+
26
+ # Tracked Items Header
27
+ xml.Row do
28
+ xml.Cell { xml.Data 'Series No', 'ss:Type' => 'String' }
29
+ xml.Cell { xml.Data 'Box No', 'ss:Type' => 'String' }
30
+ xml.Cell { xml.Data 'Item No', 'ss:Type' => 'String' }
31
+ xml.Cell { xml.Data 'Shelf Code', 'ss:Type' => 'String' }
32
+ xml.Cell { xml.Data 'Description', 'ss:Type' => 'String' }
33
+ end
34
+
35
+ # Rows
36
+ for tracked_item in @tracking_list.tracked_items
37
+ topic = Topic.find(tracked_item.trackable_item.id)
38
+ xml.Row do
39
+ xml.Cell { xml.Data topic.series_no, 'ss:Type' => 'String' }
40
+ xml.Cell { xml.Data topic.box_no, 'ss:Type' => 'String' }
41
+ xml.Cell { xml.Data topic.item_no, 'ss:Type' => 'String' }
42
+ xml.Cell { xml.Data topic.shelf_locations.first.code, 'ss:Type' => 'String' }
43
+ xml.Cell { xml.Data topic.title, 'ss:Type' => 'String' }
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,151 @@
1
+ ---
2
+ en:
3
+ application_helper:
4
+ add_trackable_items_links:
5
+ add_items_to_tracking_list: "{{t.base.add.capitalize}} {{t.base.trackable_item.pluralize}}"
6
+ close_add_items_to_tracking_list: "{{t.base.close.capitalize}} {{t.base.add}} {{t.base.trackable_item.pluralize}}"
7
+ base:
8
+ action: action
9
+ allocate: allocate
10
+ allocated: allocated
11
+ deallocate: deallocate
12
+ repository: repository
13
+ shelf_location: shelf location
14
+ shelf_locations: "{{t.base.shelf_location.pluralize}}"
15
+ status: status
16
+ trackable_item: trackable item
17
+ tracked_item: tracked item
18
+ tracking_list: tracking list
19
+ tracking_lists: "{{t.base.tracking_list.pluralize}}"
20
+ repositories:
21
+ edit:
22
+ back_to_repositories: "{{t.base.back.capitalize}} to {{t.base.repository.pluralize}}"
23
+ edit_repository: "{{t.base.edit.capitalize}} {{t.base.repository}}"
24
+ form:
25
+ create: "{{t.base.create}}"
26
+ name_field: "{{t.base.name}}"
27
+ save: "{{t.base.save}}"
28
+ index:
29
+ edit: "{{t.base.edit.capitalize}}"
30
+ name: "{{t.base.name.capitalize}}"
31
+ new: "{{t.base.new.capitalize}} {{t.base.repository}}"
32
+ show: "{{t.base.show.capitalize}}"
33
+ title: "{{t.base.repository.pluralize.capitalize}}"
34
+ new:
35
+ back_to_repositories: "{{t.base.back.capitalize}} to {{t.base.repository.pluralize}}"
36
+ title: "{{t.base.new.capitalize}} {{t.base.repository}}"
37
+ show:
38
+ add_shelf_location: "{{t.base.add.capitalize}} {{t.base.shelf_location}}"
39
+ add_tracking_list: "{{t.base.add.capitalize}} {{t.base.tracking_list}}"
40
+ are_you_sure: "{{t.base.are_you_sure}}"
41
+ back_to_repositories: "{{t.base.back.capitalize}} to {{t.base.repository.pluralize}}"
42
+ edit: "{{t.base.edit.capitalize}}"
43
+ delete: "{{t.base.delete.capitalize}}"
44
+ shelf_locations: "{{t.base.shelf_location.pluralize.capitalize}}"
45
+ title: "{{t.base.repository.capitalize}}: {{name}}"
46
+ tracking_lists: "{{t.base.tracking_list.pluralize.capitalize}}"
47
+ shelf_locations:
48
+ form:
49
+ allocate_to: "{{t.base.allocated.capitalize}} these items to {{t.base.shelf_location}}:"
50
+ code: "{{t.base.code}}"
51
+ create: "{{t.base.create}}"
52
+ do_not_add: "Do not add this item"
53
+ no_matches: "No matching {{t.base.trackable_item.pluralize}}."
54
+ save: "{{t.base.save}}"
55
+ edit:
56
+ back_to: "{{t.base.back.capitalize}} to {{name}}"
57
+ title: "{{t.base.edit.capitalize}} {{t.base.shelf_location}} for {{name}} {{t.base.repository}}"
58
+ index:
59
+ title: "{{name}} {{t.base.shelf_locations}}"
60
+ for_code_pattern: " that match {{code_pattern}}"
61
+ new:
62
+ back_to: "{{t.base.back.capitalize}} to {{name}}"
63
+ title: "{{t.base.new.capitalize}} {{t.base.shelf_location}} for {{name}} {{t.base.repository}}"
64
+ shelf_location:
65
+ are_you_sure: "{{t.base.are_you_sure}}"
66
+ edit: "{{t.base.edit.capitalize}}"
67
+ delete: "{{t.base.delete.capitalize}}"
68
+ shelf_locations:
69
+ action: "Action"
70
+ code: "{{t.base.code.capitalize}}"
71
+ status: "{{t.base.status.capitalize}}"
72
+ show:
73
+ allocated_for: "{{t.base.allocated.capitalize}} for:"
74
+ are_you_sure: "{{t.base.are_you_sure}}"
75
+ back_to: "{{t.base.back.capitalize}} to {{name}}"
76
+ edit: "{{t.base.edit.capitalize}}"
77
+ delete: "{{t.base.delete.capitalize}} {{t.base.shelf_location}}"
78
+ item_actions: "{{t.base.action.pluralize.capitalize}}"
79
+ item_description: "{{t.base.tracked_item.capitalize}}"
80
+ not_currently_allocated: "Not currently {{t.base.allocated}}"
81
+ shelf_location_controls_preface: "{{t.base.shelf_location.capitalize}} {{t.base.action.pluralize}}:"
82
+ status: "{{t.base.status.capitalize}}"
83
+ title: "{{code}} {{t.base.shelf_location}} for {{name}} {{t.base.repository}}"
84
+ trackable_item:
85
+ deallocate: "{{t.base.deallocate.capitalize}}"
86
+ are_you_sure: "{{t.base.are_you_sure}}"
87
+ update:
88
+ state_change_failed: "We failed to {{event_transition}} the {{t.base.tracking_list}}."
89
+ trackable_items_helper:
90
+ add_to_shelf_location: "{{t.base.add.capitalize}} to {{t.base.shelf_location}}"
91
+ add_to_additional_shelf_location: "{{t.base.add.capitalize}} to additional {{t.base.shelf_location}}"
92
+ trackable_item_shelf_location:
93
+ previously_allocated_reactivate_instead: "previously allocated to this {{t.base.trackable_item}}, reactitvate instead?"
94
+ shelf_location_blank_or_does_not_match: "left blank or does not match existing {{t.base.shelf_location}}"
95
+ trackable_item_blank_or_does_not_match: "left blank or does not match existing {{t.base.trackable_item}}"
96
+ trackable_item_shelf_locations:
97
+ new:
98
+ back_to: "{{t.base.back.capitalize}} to {{name}}"
99
+ create: "{{t.base.allocate}}"
100
+ getting_shelf_locations_codes: "Getting {{t.base.shelf_locations}}. "
101
+ looking_up_shelf_locations_codes: "Looking up matching {{t.base.shelf_locations}}"
102
+ repository: "{{t.base.repository}}"
103
+ repository_label: "{{t.base.repository.capitalize}}:"
104
+ shelf_location_code: "{{t.base.shelf_location.capitalize}} {{t.base.code}}"
105
+ title: "{{t.base.allocate.capitalize}} {{t.base.shelf_location}} to {{reference}}"
106
+ title_with_shelf_location: "{{t.base.choose.capitalize}} {{t.base.item}} to {{t.base.allocate.capitalize}} to {{reference}}"
107
+ tracked_item:
108
+ already_in_tracking_list: "This item is already in this tracking list"
109
+ tracked_items:
110
+ tracked_item:
111
+ are_you_sure: "{{t.base.are_you_sure}}"
112
+ delete: "Drop from list"
113
+ tracking_lists:
114
+ edit:
115
+ back_to: "{{t.base.back.capitalize}} to {{t.base.tracking_list}}"
116
+ title: "{{t.base.edit.capitalize}} {{t.base.tracking_list}} for {{name}} {{t.base.repository}}"
117
+ form:
118
+ add: "{{t.base.add.capitalize}} to {{t.base.tracking_list}}"
119
+ do_not_add: "Skip this line"
120
+ no_matches: "No {{t.base.trackable_item.pluralize}} matching your criteria. Are you sure they have been {{t.base.allocated}} a {{t.base.shelf_location}}."
121
+ index:
122
+ back_to: "{{t.base.back.capitalize}} to {{name}}"
123
+ new: "{{t.base.new.capitalize}} {{t.base.tracking_list}}"
124
+ title: "{{name}} {{t.base.tracking_lists}}"
125
+ new:
126
+ back_to: "{{t.base.back.capitalize}} to {{name}}"
127
+ title: "{{t.base.new.capitalize}} {{t.base.tracking_list}} for {{name}} {{t.base.repository}}"
128
+ show:
129
+ are_you_sure: "{{t.base.are_you_sure}}"
130
+ back_to: "{{t.base.back.capitalize}} to {{name}} {{t.base.repository}}"
131
+ delete_tracking_list: "{{t.base.delete.capitalize}} {{t.base.tracking_list}}"
132
+ download_for_excel: "Download for Excel"
133
+ not_items_in_tracking_list: "No {{t.base.tracked_item.pluralize}} in {{t.base.tracking_list}}"
134
+ title: "{{state_name}} {{t.base.tracking_list.capitalize}}"
135
+ tracked_item_actions: "{{t.base.action.pluralize.capitalize}}"
136
+ tracked_item_description: "{{t.base.tracked_item.capitalize}}"
137
+ tracked_item_box_no: "Box No"
138
+ tracked_item_item_no: "Item No"
139
+ tracked_item_series_no: "Series No"
140
+ tracked_item_shelf_code: "Shelf Code"
141
+ tracking_list_controls_preface: "{{t.base.tracking_list.capitalize}} {{t.base.action.pluralize}}:"
142
+ trackable_item_search_form:
143
+ search_button: "{{t.base.search}}"
144
+ search_for_trackable_items_for_target: "{{t.base.search.capitalize}} for {{t.base.trackable_item.pluralize}} to {{t.base.add}}"
145
+ topic_search: "{{t.base.zoom_types.topic.capitalize.pluralize}}"
146
+ tracking_lists:
147
+ id: "{{t.base.tracking_list.capitalize}}"
148
+ number_of_tracked_items: "Number of {{t.base.trackable_item.pluralize}}"
149
+ status: "{{t.base.status.capitalize}}"
150
+ update:
151
+ state_change_failed: "We failed to {{event_transition}} the {{t.base.tracking_list}}."
@@ -0,0 +1,6 @@
1
+ # Routes needs more thought since some default routes in ArchivesCentral are taking precedence.
2
+ ActionController::Routing::Routes.draw do |map|
3
+ map.resources :tracked_items, :path_prefix => ':urlified_name', :only => [:create]
4
+ map.resources :trackable_item_shelf_locations, :path_prefix => ':urlified_name', :only => [:new, :create, :update]
5
+ map.resources :repositories, :path_prefix => ':urlified_name', :has_many => [:shelf_locations, :tracking_lists]
6
+ end
@@ -0,0 +1,2 @@
1
+ Description:
2
+ Generates the migrations necessary for using the kete_trackable_items gem in Kete application.
@@ -0,0 +1,19 @@
1
+ class KeteTrackableItemsMigrationsGenerator < Rails::Generator::Base
2
+ def manifest
3
+ record do |m|
4
+ m.migration_template 'create_repositories.rb', 'db/migrate', { :migration_file_name => "create_repositories" }
5
+ m.sleep(1)
6
+ m.migration_template 'create_tracking_lists.rb', 'db/migrate', { :migration_file_name => "create_tracking_lists" }
7
+ m.sleep(1)
8
+ m.migration_template 'create_shelf_locations.rb', 'db/migrate', { :migration_file_name => "create_shelf_locations" }
9
+ m.sleep(1)
10
+ m.migration_template 'create_tracked_items.rb', 'db/migrate', { :migration_file_name => "create_tracked_items" }
11
+ m.sleep(1)
12
+ m.migration_template 'create_trackable_item_shelf_locations.rb', 'db/migrate', { :migration_file_name => "create_trackable_item_shelf_locations" }
13
+ m.sleep(1)
14
+ m.migration_template 'create_on_loan_organizations.rb', 'db/migrate', { :migration_file_name => "create_on_loan_organizations" }
15
+ m.sleep(1)
16
+ m.migration_template 'add_trackable_item_columns_to_topics.rb', 'db/migrate', { :migration_file_name => "add_trackable_item_columns_to_topics" }
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,15 @@
1
+ class AddTrackableItemColumnsToTopics < ActiveRecord::Migration
2
+ def self.up
3
+ change_table :topics do |t|
4
+ t.integer :on_loan_organization_id
5
+ t.string :workflow_state, :default => 'unallocated', :null => false
6
+ end
7
+ end
8
+
9
+ def self.down
10
+ change_table :topics do |t|
11
+ t.remove :on_loan_organization_id
12
+ t.remove :workflow_state
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,14 @@
1
+ class CreateOnLoanOrganizations < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :on_loan_organizations do |t|
4
+ t.string :name, :null => false
5
+ t.text :contact_details
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+
11
+ def self.down
12
+ drop_table :on_loan_organizations
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ class CreateRepositories < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :repositories do |t|
4
+ t.integer :basket_id, :null => false
5
+ t.string :name, :null => false
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+
11
+ def self.down
12
+ drop_table :repositories
13
+ end
14
+ end
@@ -0,0 +1,15 @@
1
+ class CreateShelfLocations < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :shelf_locations do |t|
4
+ t.string :code, :null => false
5
+ t.integer :repository_id, :null => false
6
+ t.string :workflow_state, :default => 'available', :null => false
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+
12
+ def self.down
13
+ drop_table :shelf_locations
14
+ end
15
+ end
@@ -0,0 +1,16 @@
1
+ class CreateTrackableItemShelfLocations < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :trackable_item_shelf_locations do |t|
4
+ t.integer :shelf_location_id, :null => false
5
+ t.integer :trackable_item_id, :null => false, :references => nil
6
+ t.string :trackable_item_type, :null => false
7
+ t.string :workflow_state, :default => 'active', :null => false
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+
13
+ def self.down
14
+ drop_table :trackable_item_shelf_locations
15
+ end
16
+ end
@@ -0,0 +1,15 @@
1
+ class CreateTrackedItems < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :tracked_items do |t|
4
+ t.integer :tracking_list_id, :null => false
5
+ t.integer :trackable_item_id, :null => false, :references => nil
6
+ t.string :trackable_item_type, :null => false
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+
12
+ def self.down
13
+ drop_table :tracked_items
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ class CreateTrackingLists < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :tracking_lists do |t|
4
+ t.integer :repository_id, :null => false
5
+ t.string :workflow_state, :default => 'new', :null => false
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+
11
+ def self.down
12
+ drop_table :tracking_lists
13
+ end
14
+
15
+ end
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "kete_trackable_items/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "kete_trackable_items"
7
+ s.version = KeteTrackableItems::VERSION
8
+ s.authors = ["Walter McGinnis", "Noel Gomez", "Chris Toynbee"]
9
+ s.email = ["ctoynbee@gmail.com","walter@katipo.co.nz"]
10
+ s.homepage = "https://github.com/kete/kete_trackable_items"
11
+ s.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.}
12
+ s.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.}
13
+
14
+ s.rubyforge_project = "kete_trackable_items"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ # specify any dependencies here; for example:
22
+ s.add_development_dependency "thoughtbot-shoulda"
23
+ s.add_development_dependency "jeweler"
24
+ # s.add_runtime_dependency "rest-client"
25
+ end
File without changes
@@ -0,0 +1,7 @@
1
+ module KeteTrackableItems
2
+ module ControllerHelpers
3
+ def appropriate_repositories_for_basket
4
+ @current_basket == @site_basket ? Repository.all : @current_basket.repositories
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,29 @@
1
+ ApplicationHelper.module_eval do
2
+ def add_trackable_items_links
3
+ html = link_to(t('application_helper.add_trackable_items_links.add_items_to_tracking_list'),
4
+ '#', :id => 'add-items-button', :tabindex => 2)
5
+
6
+ html += link_to(t('application_helper.add_trackable_items_links.close_add_items_to_tracking_list'),
7
+ '#', :id => 'close-add-items-button', :tabindex => 2, :style => 'display: none;' )
8
+
9
+ html += javascript_tag("jQuery(document).ready(function(){
10
+ jQuery('#add-items-button').click(function() {
11
+ jQuery('#trackable_item_search_form').slideDown('slow',
12
+ function() {
13
+ jQuery('#add-items-button').hide();
14
+ jQuery('#close-add-items-button').show();
15
+ });
16
+ });
17
+ jQuery('#close-add-items-button').click(function() {
18
+ jQuery('#trackable_item_search_form').slideUp('slow',
19
+ function() {
20
+ jQuery('#close-add-items-button').hide();
21
+ jQuery('#add-items-button').show();
22
+ });
23
+ });
24
+ });
25
+ ")
26
+
27
+ html
28
+ end
29
+ end