enju_inventory 0.1.11.pre9 → 0.1.11.pre10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/inventories_controller.rb +73 -3
- data/app/views/inventories/edit.html.erb +2 -2
- data/app/views/inventories/index.html.erb +2 -2
- data/app/views/inventories/new.html.erb +2 -2
- data/app/views/inventories/show.html.erb +2 -2
- data/app/views/inventory_files/edit.html.erb +2 -2
- data/app/views/inventory_files/index.html.erb +3 -3
- data/app/views/inventory_files/new.html.erb +2 -2
- data/app/views/inventory_files/show.html.erb +3 -3
- data/lib/enju_inventory/engine.rb +1 -2
- data/lib/enju_inventory/version.rb +1 -1
- data/spec/controllers/inventories_controller_spec.rb +40 -37
- data/spec/controllers/inventory_files_controller_spec.rb +56 -62
- data/spec/dummy/app/models/user.rb +5 -25
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/001_create_agents.rb +50 -0
- data/spec/dummy/db/migrate/002_devise_create_users.rb +46 -0
- data/spec/dummy/db/migrate/005_create_manifestations.rb +44 -0
- data/spec/dummy/db/migrate/006_create_items.rb +1 -12
- data/spec/dummy/db/migrate/012_create_owns.rb +12 -0
- data/spec/dummy/db/migrate/015_create_creates.rb +12 -0
- data/spec/dummy/db/migrate/041_create_roles.rb +13 -0
- data/spec/dummy/db/migrate/047_create_produces.rb +12 -0
- 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/073_create_carrier_types.rb +11 -0
- data/spec/dummy/db/migrate/077_create_user_groups.rb +12 -0
- data/spec/dummy/db/migrate/080_create_library_groups.rb +0 -1
- data/spec/dummy/db/migrate/112_create_frequencies.rb +12 -0
- data/spec/dummy/db/migrate/117_create_form_of_works.rb +12 -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 +12 -0
- data/spec/dummy/db/migrate/130_create_request_status_types.rb +12 -0
- data/spec/dummy/db/migrate/131_create_request_types.rb +12 -0
- data/spec/dummy/db/migrate/20080830154109_create_realizes.rb +13 -0
- data/spec/dummy/db/migrate/20080830172106_create_exemplifies.rb +13 -0
- data/spec/dummy/db/migrate/20080905191442_create_agent_types.rb +12 -0
- 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/20081025083323_create_countries.rb +28 -0
- data/spec/dummy/db/migrate/20081025083905_create_languages.rb +23 -0
- data/spec/dummy/db/migrate/20081027150907_create_picture_files.rb +15 -0
- data/spec/dummy/db/migrate/20081028083142_create_agent_import_files.rb +20 -0
- data/spec/dummy/db/migrate/20081028083208_create_resource_import_files.rb +20 -0
- data/spec/dummy/db/migrate/20090705133942_add_attachments_picture_to_picture_file.rb +15 -0
- data/spec/dummy/db/migrate/20090705212043_add_attachments_attachment_to_manifestation.rb +15 -0
- data/spec/dummy/db/migrate/20090719201843_create_extents.rb +12 -0
- data/spec/dummy/db/migrate/20090720091106_create_medium_of_performances.rb +12 -0
- data/spec/dummy/db/migrate/20090720091429_create_content_types.rb +12 -0
- data/spec/dummy/db/migrate/20090812151902_create_agent_relationship_types.rb +12 -0
- data/spec/dummy/db/migrate/20091012101112_add_dcndl_schema.rb +27 -0
- data/spec/dummy/db/migrate/20091025080447_create_licenses.rb +12 -0
- data/spec/dummy/db/migrate/20091202124834_create_versions.rb +18 -0
- data/spec/dummy/db/migrate/20091214131723_create_series_statements.rb +13 -0
- data/spec/dummy/db/migrate/20100129142347_create_import_requests.rb +14 -0
- data/spec/dummy/db/migrate/20100223121519_rename_series_statement_title_to_original_title.rb +13 -0
- data/spec/dummy/db/migrate/20100314190054_add_opening_hour_to_library.rb +9 -0
- data/spec/dummy/db/migrate/20100321235924_add_series_statement_identifier_to_series_statement.rb +10 -0
- data/spec/dummy/db/migrate/20100525124311_create_manifestation_relationships.rb +13 -0
- data/spec/dummy/db/migrate/{20111201163718_create_user_has_roles.rb → 20100606065209_create_user_has_roles.rb} +2 -0
- data/spec/dummy/db/migrate/20100606073747_create_agent_relationships.rb +13 -0
- data/spec/dummy/db/migrate/20100607044753_create_manifestation_relationship_types.rb +12 -0
- data/spec/dummy/db/migrate/20100814091104_add_position_to_agent_relationship.rb +11 -0
- data/spec/dummy/db/migrate/20100925043847_create_resource_import_results.rb +15 -0
- data/spec/dummy/db/migrate/20100925074559_create_agent_import_results.rb +11 -0
- data/spec/dummy/db/migrate/20101212070145_add_acquired_at_to_item.rb +9 -0
- data/spec/dummy/db/migrate/20110301035123_add_pub_date_to_manifestation.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/20110603184217_add_edit_mode_to_resource_import_file.rb +9 -0
- data/spec/dummy/db/migrate/20110619064807_add_edition_string_to_manifestation.rb +9 -0
- data/spec/dummy/db/migrate/20110620173525_add_bookstore_id_to_item.rb +11 -0
- data/spec/dummy/db/migrate/20110627034940_create_series_statement_merge_lists.rb +9 -0
- data/spec/dummy/db/migrate/20110627035057_create_series_statement_merges.rb +12 -0
- data/spec/dummy/db/migrate/20110916091020_add_volume_number_to_manifestation.rb +13 -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/{20111201121844_create_roles.rb → 20111124110059_create_create_types.rb} +2 -2
- data/spec/dummy/db/migrate/20111124110319_create_realize_types.rb +12 -0
- data/spec/dummy/db/migrate/20111124110355_create_produce_types.rb +12 -0
- data/spec/dummy/db/migrate/20111124112131_add_create_type_to_create.rb +7 -0
- data/spec/dummy/db/migrate/20120105074911_add_isil_to_library.rb +5 -0
- data/spec/dummy/db/migrate/20120125152919_add_title_subseries_transcription_to_series_statement.rb +6 -0
- data/spec/dummy/db/migrate/20120129014038_create_budget_types.rb +12 -0
- data/spec/dummy/db/migrate/20120129020544_add_budget_type_id_to_item.rb +6 -0
- data/spec/dummy/db/migrate/20120319120638_add_content_type_id_to_manifestation.rb +6 -0
- data/spec/dummy/db/migrate/20120319173203_create_accepts.rb +14 -0
- data/spec/dummy/db/migrate/20120410104851_add_year_of_publication_to_manifestation.rb +5 -0
- data/spec/dummy/db/migrate/20120413072700_add_picture_meta_to_picture_file.rb +5 -0
- data/spec/dummy/db/migrate/20120413100352_add_fingerprint_to_picture_file.rb +5 -0
- data/spec/dummy/db/migrate/20120413161340_add_fingerprint_to_resource_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20120413161403_add_fingerprint_to_agent_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20120413170705_add_error_message_to_resource_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/20120415164821_add_attachment_meta_to_manifestation.rb +5 -0
- data/spec/dummy/db/migrate/20120418081407_add_month_of_publication_to_manifestation.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/20121116031206_add_fulltext_content_to_manifestation.rb +5 -0
- data/spec/dummy/db/migrate/20121116033446_add_doi_to_manifestation.rb +6 -0
- data/spec/dummy/db/migrate/20130221154434_add_additional_attributes_to_user.rb +16 -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/migrate/20130429020822_add_root_manifestation_id_to_series_statement.rb +6 -0
- data/spec/dummy/db/migrate/20130506175303_create_identifier_types.rb +12 -0
- data/spec/dummy/db/migrate/20130506175834_create_identifiers.rb +15 -0
- data/spec/dummy/db/migrate/20130509185724_add_statement_of_responsibility_to_manifestation.rb +5 -0
- data/spec/dummy/db/migrate/20140110122216_create_user_import_files.rb +18 -0
- data/spec/dummy/db/migrate/20140110131010_create_user_import_results.rb +11 -0
- data/spec/dummy/db/migrate/20140122054321_create_profiles.rb +20 -0
- data/spec/dummy/db/migrate/20140519170214_create_resource_import_file_transitions.rb +14 -0
- data/spec/dummy/db/migrate/20140519171220_create_import_request_transitions.rb +14 -0
- data/spec/dummy/db/migrate/20140524020735_create_agent_import_file_transitions.rb +14 -0
- data/spec/dummy/db/migrate/20140524074813_create_user_import_file_transitions.rb +14 -0
- data/spec/dummy/db/migrate/20140610123439_drop_email_unique_constraint_enju_leaf_rc10.rb +11 -0
- data/spec/dummy/db/migrate/20140614065404_create_resource_export_files.rb +11 -0
- data/spec/dummy/db/migrate/20140614141500_create_resource_export_file_transitions.rb +14 -0
- data/spec/dummy/db/migrate/20140628072217_add_user_encoding_to_user_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20140628073524_add_user_encoding_to_agent_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20140628073535_add_user_encoding_to_resource_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20140709113413_create_user_export_files.rb +11 -0
- data/spec/dummy/db/migrate/20140709113905_create_user_export_file_transitions.rb +14 -0
- data/spec/dummy/db/migrate/20140720140916_add_binding_item_identifier_to_item.rb +8 -0
- data/spec/dummy/db/migrate/20140720170714_add_default_library_id_to_user_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20140720170735_add_default_user_group_id_to_user_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20140721151416_add_default_shelf_id_to_resource_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20140802082007_add_manifestation_id_to_item.rb +6 -0
- data/spec/dummy/db/migrate/20140811031145_add_expired_at_to_profile.rb +5 -0
- data/spec/dummy/db/migrate/20140813182425_add_publication_place_to_manifestation.rb +5 -0
- data/spec/dummy/db/schema.rb +860 -28
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/private/system/inventory_files/inventories/000/000/001/original/inventory_file_sample.tsv +7 -0
- data/spec/factories/user.rb +6 -0
- data/spec/fixtures/libraries.yml +102 -0
- data/spec/fixtures/library_groups.yml +15 -18
- data/spec/fixtures/profiles.yml +98 -0
- data/spec/fixtures/users.yml +3 -21
- data/spec/models/inventory_file_spec.rb +1 -1
- data/spec/spec_helper.rb +5 -1
- metadata +297 -36
- data/app/models/setting.rb +0 -4
- data/spec/dummy/app/models/ability.rb +0 -20
- data/spec/dummy/app/views/page/403.html.erb +0 -9
- data/spec/dummy/app/views/page/403.mobile.erb +0 -5
- data/spec/dummy/app/views/page/403.xml.erb +0 -4
- data/spec/dummy/app/views/page/404.html.erb +0 -9
- data/spec/dummy/app/views/page/404.mobile.erb +0 -5
- data/spec/dummy/app/views/page/404.xml.erb +0 -4
- data/spec/dummy/db/migrate/20111201155456_create_users.rb +0 -13
- data/spec/dummy/db/migrate/20111201155513_add_devise_to_users.rb +0 -52
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85e9adb15d7c764bb35726ef2712ef5869b27e37
|
4
|
+
data.tar.gz: c548a5a5a8a447fab6fc84e9f9c806626dc3b971
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e480c7b2328b63134bc3016bb531708c7fd220758102f9e4b85ee8c05e1bde0c2c0850e69e210731200562d8eacda5d6024413ebd7b88759827d6f9deb1ff89
|
7
|
+
data.tar.gz: 94e5b5da6211659c6c8eeafc45202a7aa4499803122b5bedc704712b293629ff2cd6c7efadfafa73b16b00a4e68c045ef1b23ccfc692d7bdb6747288079c740e
|
@@ -1,8 +1,78 @@
|
|
1
|
-
class InventoriesController <
|
2
|
-
respond_to :html, :json
|
1
|
+
class InventoriesController < ApplicationController
|
3
2
|
load_and_authorize_resource
|
4
|
-
|
3
|
+
# GET /inventories
|
4
|
+
# GET /inventories.json
|
5
5
|
def index
|
6
6
|
@inventories = Inventory.page(params[:page])
|
7
|
+
|
8
|
+
respond_to do |format|
|
9
|
+
format.html # index.html.erb
|
10
|
+
format.json { render json: @inventories }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
# GET /inventories/1
|
15
|
+
# GET /inventories/1.json
|
16
|
+
def show
|
17
|
+
respond_to do |format|
|
18
|
+
format.html # show.html.erb
|
19
|
+
format.json { render json: @inventory }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# GET /inventories/new
|
24
|
+
# GET /inventories/new.json
|
25
|
+
def new
|
26
|
+
@inventory = Inventory.new
|
27
|
+
|
28
|
+
respond_to do |format|
|
29
|
+
format.html # new.html.erb
|
30
|
+
format.json { render json: @inventory }
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# GET /inventories/1/edit
|
35
|
+
def edit
|
36
|
+
end
|
37
|
+
|
38
|
+
# POST /inventories
|
39
|
+
# POST /inventories.json
|
40
|
+
def create
|
41
|
+
@inventory = Inventory.new(params[:inventory])
|
42
|
+
|
43
|
+
respond_to do |format|
|
44
|
+
if @inventory.save
|
45
|
+
format.html { redirect_to @inventory, notice: t('controller.successfully_created', model: t('activerecord.models.inventory')) }
|
46
|
+
format.json { render json: @inventory, status: :created, location: @inventory }
|
47
|
+
else
|
48
|
+
format.html { render action: "new" }
|
49
|
+
format.json { render json: @inventory.errors, status: :unprocessable_entity }
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# PUT /inventories/1
|
55
|
+
# PUT /inventories/1.json
|
56
|
+
def update
|
57
|
+
respond_to do |format|
|
58
|
+
if @inventory.update_attributes(params[:inventory])
|
59
|
+
format.html { redirect_to @inventory, notice: t('controller.successfully_updated', model: t('activerecord.models.inventory')) }
|
60
|
+
format.json { head :no_content }
|
61
|
+
else
|
62
|
+
format.html { render action: "edit" }
|
63
|
+
format.json { render json: @inventory.errors, status: :unprocessable_entity }
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# DELETE /inventories/1
|
69
|
+
# DELETE /inventories/1.json
|
70
|
+
def destroy
|
71
|
+
@inventory.destroy
|
72
|
+
|
73
|
+
respond_to do |format|
|
74
|
+
format.html { redirect_to inventories_url, notice: t('controller.successfully_deleted', model: t('activerecord.models.inventory')) }
|
75
|
+
format.json { head :no_content }
|
76
|
+
end
|
7
77
|
end
|
8
78
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<div id="content_detail" class="ui-corner-all">
|
1
|
+
<div id="content_detail" class="ui-corner-all ui-widget-content">
|
2
2
|
<h1 class="title"><%= t('page.editing', :model => t('activerecord.models.inventory')) -%> </h1>
|
3
3
|
<div id="content_list">
|
4
4
|
|
@@ -25,7 +25,7 @@
|
|
25
25
|
</div>
|
26
26
|
</div>
|
27
27
|
|
28
|
-
<div id="submenu" class="ui-corner-all">
|
28
|
+
<div id="submenu" class="ui-corner-all ui-widget-content">
|
29
29
|
<ul>
|
30
30
|
<li><%= link_to t('page.show'), @inventory -%></li>
|
31
31
|
<li><%= link_to t('page.back'), inventories_path -%></li>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<div id="content_detail" class="ui-corner-all">
|
1
|
+
<div id="content_detail" class="ui-corner-all ui-widget-content">
|
2
2
|
<h1 class="title"><%= t('page.listing', :model => t('activerecord.models.inventory')) -%></h1>
|
3
3
|
<div id="content_list">
|
4
4
|
|
@@ -27,7 +27,7 @@
|
|
27
27
|
</div>
|
28
28
|
</div>
|
29
29
|
|
30
|
-
<div id="submenu" class="ui-corner-all">
|
30
|
+
<div id="submenu" class="ui-corner-all ui-widget-content">
|
31
31
|
<ul>
|
32
32
|
<li><%= link_to t('page.new', :model => t('activerecord.models.inventory')), new_inventory_path -%></li>
|
33
33
|
</ul>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<div id="content_detail" class="ui-corner-all">
|
1
|
+
<div id="content_detail" class="ui-corner-all ui-widget-content">
|
2
2
|
<h1 class="title"><%= t('page.new', :model => t('activerecord.models.inventory')) -%> </h1>
|
3
3
|
<div id="content_list">
|
4
4
|
|
@@ -25,7 +25,7 @@
|
|
25
25
|
</div>
|
26
26
|
</div>
|
27
27
|
|
28
|
-
<div id="submenu" class="ui-corner-all">
|
28
|
+
<div id="submenu" class="ui-corner-all ui-widget-content">
|
29
29
|
<ul>
|
30
30
|
<li><%= link_to t('page.back'), inventories_path -%></li>
|
31
31
|
</ul>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<div id="content_detail" class="ui-corner-all">
|
1
|
+
<div id="content_detail" class="ui-corner-all ui-widget-content">
|
2
2
|
<h1 class="title"><%= t('page.showing', :model => t('activerecord.models.inventory')) -%> </h1>
|
3
3
|
<div id="content_list">
|
4
4
|
<p id="notice"><%= notice %></p>
|
@@ -21,7 +21,7 @@
|
|
21
21
|
</div>
|
22
22
|
</div>
|
23
23
|
|
24
|
-
<div id="submenu" class="ui-corner-all">
|
24
|
+
<div id="submenu" class="ui-corner-all ui-widget-content">
|
25
25
|
<ul>
|
26
26
|
<li><%= link_to t('page.edit'), edit_inventory_path(@inventory) -%></li>
|
27
27
|
<li><%= back_to_index(flash[:page_info]) -%></li>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<div id="content_detail" class="ui-corner-all">
|
1
|
+
<div id="content_detail" class="ui-corner-all ui-widget-content">
|
2
2
|
<h1 class="title"><%= t('page.editing', :model => t('activerecord.models.inventory_file')) -%></h1>
|
3
3
|
<div id="content_list">
|
4
4
|
|
@@ -37,7 +37,7 @@
|
|
37
37
|
</div>
|
38
38
|
</div>
|
39
39
|
|
40
|
-
<div id="submenu" class="ui-corner-all">
|
40
|
+
<div id="submenu" class="ui-corner-all ui-widget-content">
|
41
41
|
<ul>
|
42
42
|
<li><%= link_to t('page.show'), @inventory_file -%></li>
|
43
43
|
<li><%= link_to t('page.back'), inventory_files_path -%></li>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<div id="content_detail" class="ui-corner-all">
|
1
|
+
<div id="content_detail" class="ui-corner-all ui-widget-content">
|
2
2
|
<h1 class="title"><%= t('page.listing', :model => t('activerecord.models.inventory_file')) -%></h1>
|
3
3
|
<div id="content_list">
|
4
4
|
|
@@ -22,7 +22,7 @@
|
|
22
22
|
<td><%= inventory_file.inventory_content_type -%> </td>
|
23
23
|
<td><%= inventory_file.inventory_file_size -%> </td>
|
24
24
|
<td><%= inventory_file.inventory_fingerprint -%> </td>
|
25
|
-
<td><%= link_to inventory_file.user.username, inventory_file.user -%> </td>
|
25
|
+
<td><%= link_to inventory_file.user.username, inventory_file.user.profile if inventory_file.user.try(:profile) -%> </td>
|
26
26
|
<td>
|
27
27
|
<%= link_to t('page.edit'), edit_inventory_file_path(inventory_file) -%>
|
28
28
|
<%= link_to t('page.destroy'), inventory_file, :data => {:confirm => t('page.are_you_sure')}, :method => :delete -%>
|
@@ -35,7 +35,7 @@
|
|
35
35
|
</div>
|
36
36
|
</div>
|
37
37
|
|
38
|
-
<div id="submenu" class="ui-corner-all">
|
38
|
+
<div id="submenu" class="ui-corner-all ui-widget-content">
|
39
39
|
<ul>
|
40
40
|
<li><%= link_to t('page.new', :model => t('activerecord.models.inventory_file')), new_inventory_file_path -%></li>
|
41
41
|
</ul>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<div id="content_detail" class="ui-corner-all">
|
1
|
+
<div id="content_detail" class="ui-corner-all ui-widget-content">
|
2
2
|
<h1 class="title"><%= t('page.new', :model => t('activerecord.models.inventory_file')) -%> </h1>
|
3
3
|
<div id="content_list">
|
4
4
|
|
@@ -18,7 +18,7 @@
|
|
18
18
|
</div>
|
19
19
|
</div>
|
20
20
|
|
21
|
-
<div id="submenu" class="ui-corner-all">
|
21
|
+
<div id="submenu" class="ui-corner-all ui-widget-content">
|
22
22
|
<ul>
|
23
23
|
<li><%= link_to t('page.back'), inventory_files_path -%> </li>
|
24
24
|
</ul>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<div id="content_detail" class="ui-corner-all">
|
1
|
+
<div id="content_detail" class="ui-corner-all ui-widget-content">
|
2
2
|
<h1 class="title"><%= t('page.showing', :model => t('activerecord.models.inventory_file')) -%></h1>
|
3
3
|
<div id="content_list">
|
4
4
|
<p id="notice"><%= notice %></p>
|
@@ -25,7 +25,7 @@
|
|
25
25
|
|
26
26
|
<p>
|
27
27
|
<strong><%= t('activerecord.models.user') -%> :</strong>
|
28
|
-
<%= link_to @inventory_file.user.username, @inventory_file.user -%>
|
28
|
+
<%= link_to @inventory_file.user.username, @inventory_file.user.profile if @inventory_file.user.try(:profile) -%>
|
29
29
|
</p>
|
30
30
|
|
31
31
|
<p>
|
@@ -36,7 +36,7 @@
|
|
36
36
|
</div>
|
37
37
|
</div>
|
38
38
|
|
39
|
-
<div id="submenu" class="ui-corner-all">
|
39
|
+
<div id="submenu" class="ui-corner-all ui-widget-content">
|
40
40
|
<ul>
|
41
41
|
<li><%= link_to t('page.edit'), edit_inventory_file_path(@inventory_file) -%> </li>
|
42
42
|
<li><%= back_to_index(flash[:page_info]) -%> </li>
|
@@ -5,149 +5,152 @@ describe InventoriesController do
|
|
5
5
|
|
6
6
|
describe "GET index" do
|
7
7
|
describe "When logged in as Administrator" do
|
8
|
-
|
8
|
+
login_fixture_admin
|
9
9
|
|
10
10
|
it "assigns all inventories as @inventories" do
|
11
11
|
get :index
|
12
|
-
assigns(:inventories).
|
13
|
-
response.
|
12
|
+
expect(assigns(:inventories)).to eq(Inventory.page(1))
|
13
|
+
expect(response).to be_success
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
describe "When logged in as Librarian" do
|
18
|
-
|
18
|
+
login_fixture_librarian
|
19
19
|
|
20
20
|
it "assigns all inventories as @inventories" do
|
21
21
|
get :index
|
22
|
-
assigns(:inventories).
|
23
|
-
response.
|
22
|
+
expect(assigns(:inventories)).to eq(Inventory.page(1))
|
23
|
+
expect(response).to be_success
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
27
|
describe "When logged in as User" do
|
28
|
-
|
28
|
+
login_fixture_user
|
29
29
|
|
30
30
|
it "assigns all empty as @inventories" do
|
31
31
|
get :index
|
32
|
-
assigns(:inventories).
|
33
|
-
response.
|
32
|
+
expect(assigns(:inventories)).to be_empty
|
33
|
+
expect(response).to be_forbidden
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
37
|
describe "When not logged in" do
|
38
38
|
it "assigns all inventories as @inventories" do
|
39
39
|
get :index
|
40
|
-
assigns(:inventories).
|
41
|
-
response.
|
40
|
+
expect(assigns(:inventories)).to be_empty
|
41
|
+
expect(response).to redirect_to(new_user_session_url)
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
46
|
describe "GET show" do
|
47
47
|
describe "When logged in as Administrator" do
|
48
|
-
|
48
|
+
login_fixture_admin
|
49
49
|
|
50
50
|
it "assigns the requested inventory as @inventory" do
|
51
51
|
get :show, :id => 1
|
52
|
-
assigns(:inventory).
|
52
|
+
expect(assigns(:inventory)).to eq(Inventory.find(1))
|
53
|
+
expect(response).to be_success
|
53
54
|
end
|
54
55
|
end
|
55
56
|
|
56
57
|
describe "When logged in as Librarian" do
|
57
|
-
|
58
|
+
login_fixture_librarian
|
58
59
|
|
59
60
|
it "assigns the requested inventory as @inventory" do
|
60
61
|
get :show, :id => 1
|
61
|
-
assigns(:inventory).
|
62
|
+
expect(assigns(:inventory)).to eq(Inventory.find(1))
|
63
|
+
expect(response).to be_success
|
62
64
|
end
|
63
65
|
end
|
64
66
|
|
65
67
|
describe "When logged in as User" do
|
66
|
-
|
68
|
+
login_fixture_user
|
67
69
|
|
68
70
|
it "assigns the requested inventory as @inventory" do
|
69
71
|
get :show, :id => 1
|
70
|
-
assigns(:inventory).
|
72
|
+
expect(assigns(:inventory)).to eq(Inventory.find(1))
|
73
|
+
expect(response).to be_forbidden
|
71
74
|
end
|
72
75
|
end
|
73
76
|
|
74
77
|
describe "When not logged in" do
|
75
78
|
it "assigns the requested inventory as @inventory" do
|
76
79
|
get :show, :id => 1
|
77
|
-
assigns(:inventory).
|
78
|
-
response.
|
80
|
+
expect(assigns(:inventory)).to eq(Inventory.find(1))
|
81
|
+
expect(response).to redirect_to(new_user_session_url)
|
79
82
|
end
|
80
83
|
end
|
81
84
|
end
|
82
85
|
|
83
86
|
describe "GET new" do
|
84
87
|
describe "When logged in as Administrator" do
|
85
|
-
|
88
|
+
login_fixture_admin
|
86
89
|
|
87
90
|
it "assigns the requested inventory as @inventory" do
|
88
91
|
get :new
|
89
|
-
assigns(:inventory).
|
90
|
-
response.
|
92
|
+
expect(assigns(:inventory)).not_to be_valid
|
93
|
+
expect(response).to be_success
|
91
94
|
end
|
92
95
|
end
|
93
96
|
|
94
97
|
describe "When logged in as Librarian" do
|
95
|
-
|
98
|
+
login_fixture_librarian
|
96
99
|
|
97
100
|
it "should not assign the requested inventory as @inventory" do
|
98
101
|
get :new
|
99
|
-
assigns(:inventory).
|
100
|
-
response.
|
102
|
+
expect(assigns(:inventory)).not_to be_valid
|
103
|
+
expect(response).to be_success
|
101
104
|
end
|
102
105
|
end
|
103
106
|
|
104
107
|
describe "When logged in as User" do
|
105
|
-
|
108
|
+
login_fixture_user
|
106
109
|
|
107
110
|
it "should not assign the requested inventory as @inventory" do
|
108
111
|
get :new
|
109
|
-
assigns(:inventory).
|
110
|
-
response.
|
112
|
+
expect(assigns(:inventory)).not_to be_valid
|
113
|
+
expect(response).to be_forbidden
|
111
114
|
end
|
112
115
|
end
|
113
116
|
|
114
117
|
describe "When not logged in" do
|
115
118
|
it "should not assign the requested inventory as @inventory" do
|
116
119
|
get :new
|
117
|
-
assigns(:inventory).
|
118
|
-
response.
|
120
|
+
expect(assigns(:inventory)).not_to be_valid
|
121
|
+
expect(response).to redirect_to(new_user_session_url)
|
119
122
|
end
|
120
123
|
end
|
121
124
|
end
|
122
125
|
|
123
126
|
describe "GET edit" do
|
124
127
|
describe "When logged in as Administrator" do
|
125
|
-
|
128
|
+
login_fixture_admin
|
126
129
|
|
127
130
|
it "assigns the requested inventory as @inventory" do
|
128
131
|
inventory = inventories(:inventory_00001)
|
129
132
|
get :edit, :id => inventory.id
|
130
|
-
assigns(:inventory).
|
133
|
+
expect(assigns(:inventory)).to eq(inventory)
|
131
134
|
end
|
132
135
|
end
|
133
136
|
|
134
137
|
describe "When logged in as Librarian" do
|
135
|
-
|
138
|
+
login_fixture_librarian
|
136
139
|
|
137
140
|
it "assigns the requested inventory as @inventory" do
|
138
141
|
inventory = inventories(:inventory_00001)
|
139
142
|
get :edit, :id => inventory.id
|
140
|
-
assigns(:inventory).
|
143
|
+
expect(assigns(:inventory)).to eq(inventory)
|
141
144
|
end
|
142
145
|
end
|
143
146
|
|
144
147
|
describe "When logged in as User" do
|
145
|
-
|
148
|
+
login_fixture_user
|
146
149
|
|
147
150
|
it "assigns the requested inventory as @inventory" do
|
148
151
|
inventory = inventories(:inventory_00001)
|
149
152
|
get :edit, :id => inventory.id
|
150
|
-
response.
|
153
|
+
expect(response).to be_forbidden
|
151
154
|
end
|
152
155
|
end
|
153
156
|
|
@@ -155,7 +158,7 @@ describe InventoriesController do
|
|
155
158
|
it "should not assign the requested inventory as @inventory" do
|
156
159
|
inventory = inventories(:inventory_00001)
|
157
160
|
get :edit, :id => inventory.id
|
158
|
-
response.
|
161
|
+
expect(response).to redirect_to(new_user_session_url)
|
159
162
|
end
|
160
163
|
end
|
161
164
|
end
|