enju_biblio 0.1.0.pre56 → 0.1.0.pre57

Sign up to get free protection for your applications and to get access to all the features.
Files changed (192) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/agent_import_files_controller.rb +1 -1
  3. data/app/controllers/agent_import_results_controller.rb +30 -6
  4. data/app/controllers/agent_relationship_types_controller.rb +74 -4
  5. data/app/controllers/agent_relationships_controller.rb +92 -10
  6. data/app/controllers/agent_types_controller.rb +74 -3
  7. data/app/controllers/carrier_types_controller.rb +1 -1
  8. data/app/controllers/content_types_controller.rb +74 -4
  9. data/app/controllers/countries_controller.rb +66 -4
  10. data/app/controllers/create_types_controller.rb +74 -3
  11. data/app/controllers/extents_controller.rb +74 -4
  12. data/app/controllers/form_of_works_controller.rb +74 -4
  13. data/app/controllers/frequencies_controller.rb +74 -4
  14. data/app/controllers/identifier_types_controller.rb +4 -5
  15. data/app/controllers/import_requests_controller.rb +1 -1
  16. data/app/controllers/languages_controller.rb +66 -4
  17. data/app/controllers/licenses_controller.rb +74 -3
  18. data/app/controllers/manifestation_relationship_types_controller.rb +74 -3
  19. data/app/controllers/manifestation_relationships_controller.rb +92 -9
  20. data/app/controllers/medium_of_performances_controller.rb +74 -3
  21. data/app/controllers/picture_files_controller.rb +34 -10
  22. data/app/controllers/produce_types_controller.rb +74 -3
  23. data/app/controllers/realize_types_controller.rb +74 -3
  24. data/app/controllers/resource_import_files_controller.rb +2 -1
  25. data/app/controllers/resource_import_results_controller.rb +31 -11
  26. data/app/models/agent_import_file.rb +1 -1
  27. data/app/models/agent_import_result.rb +0 -2
  28. data/app/models/carrier_type.rb +1 -1
  29. data/app/models/identifier.rb +5 -0
  30. data/app/models/item.rb +1 -1
  31. data/app/models/manifestation.rb +13 -8
  32. data/app/models/resource_import_file.rb +73 -79
  33. data/app/views/agent_import_files/index.html.erb +1 -0
  34. data/app/views/agent_relationship_types/index.html.erb +5 -4
  35. data/app/views/agent_types/index.html.erb +5 -4
  36. data/app/views/carrier_types/index.html.erb +2 -1
  37. data/app/views/content_types/index.html.erb +1 -0
  38. data/app/views/countries/show.html.erb +5 -0
  39. data/app/views/create_types/index.html.erb +5 -4
  40. data/app/views/extents/index.html.erb +2 -1
  41. data/app/views/form_of_works/index.html.erb +2 -1
  42. data/app/views/frequencies/index.html.erb +2 -1
  43. data/app/views/identifier_types/index.html.erb +12 -5
  44. data/app/views/import_requests/index.html.erb +1 -0
  45. data/app/views/items/show.html.erb +3 -7
  46. data/app/views/languages/_form.html.erb +19 -4
  47. data/app/views/languages/index.html.erb +6 -5
  48. data/app/views/languages/show.html.erb +19 -4
  49. data/app/views/layouts/manifestations.html.erb +2 -1
  50. data/app/views/licenses/index.html.erb +2 -1
  51. data/app/views/manifestation_relationship_types/index.html.erb +5 -4
  52. data/app/views/manifestations/_call_number.html.erb +1 -1
  53. data/app/views/manifestations/_edit_detail.html.erb +4 -1
  54. data/app/views/manifestations/_form.html.erb +5 -5
  55. data/app/views/manifestations/_show_detail_librarian.html.erb +8 -3
  56. data/app/views/manifestations/_show_detail_user.html.erb +8 -3
  57. data/app/views/medium_of_performances/index.html.erb +2 -1
  58. data/app/views/notifier/manifestation_info.en.text.erb +1 -1
  59. data/app/views/notifier/manifestation_info.ja.text.erb +1 -1
  60. data/app/views/picture_files/_index.html.erb +1 -0
  61. data/app/views/picture_files/_index_agent.html.erb +1 -0
  62. data/app/views/picture_files/_index_manifestation.html.erb +1 -0
  63. data/app/views/picture_files/show.html.erb +15 -7
  64. data/app/views/produce_types/index.html.erb +5 -4
  65. data/app/views/realize_types/index.html.erb +5 -4
  66. data/app/views/resource_import_files/index.html.erb +1 -0
  67. data/app/views/series_statements/_index.html.erb +1 -0
  68. data/app/views/series_statements/_index_series_statement_merge_list.html.erb +1 -0
  69. data/config/locales/translation_en.yml +70 -1
  70. data/config/locales/translation_ja.yml +77 -8
  71. data/db/migrate/20140817155043_add_extent_of_text_to_manifestation.rb +5 -0
  72. data/lib/enju_biblio/biblio_helper.rb +13 -0
  73. data/lib/enju_biblio/engine.rb +0 -2
  74. data/lib/enju_biblio/version.rb +1 -1
  75. data/lib/generators/enju_biblio/setup/templates/db/fixtures/content_types.yml +1 -1
  76. data/lib/generators/enju_biblio/setup/templates/db/fixtures/identifier_types.yml +24 -3
  77. data/lib/tasks/enju_biblio_tasks.rake +2 -0
  78. data/lib/tasks/identifier_type.rb +12 -0
  79. data/lib/tasks/item.rb +1 -1
  80. data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_is_written_in_utf-8/should_send_message_when_import_is_completed.yml +433 -0
  81. data/spec/controllers/agent_import_files_controller_spec.rb +35 -35
  82. data/spec/controllers/agent_import_results_controller_spec.rb +11 -11
  83. data/spec/controllers/agent_relationship_types_controller_spec.rb +51 -51
  84. data/spec/controllers/agent_relationships_controller_spec.rb +53 -53
  85. data/spec/controllers/agent_types_controller_spec.rb +15 -15
  86. data/spec/controllers/agents_controller_spec.rb +96 -96
  87. data/spec/controllers/carrier_types_controller_spec.rb +15 -15
  88. data/spec/controllers/content_types_controller_spec.rb +15 -15
  89. data/spec/controllers/countries_controller_spec.rb +25 -25
  90. data/spec/controllers/create_types_controller_spec.rb +15 -15
  91. data/spec/controllers/creates_controller_spec.rb +50 -50
  92. data/spec/controllers/donates_controller_spec.rb +49 -49
  93. data/spec/controllers/extents_controller_spec.rb +15 -15
  94. data/spec/controllers/form_of_works_controller_spec.rb +15 -15
  95. data/spec/controllers/frequencies_controller_spec.rb +6 -6
  96. data/spec/controllers/identifier_types_controller_spec.rb +15 -15
  97. data/spec/controllers/import_requests_controller_spec.rb +50 -50
  98. data/spec/controllers/items_controller_spec.rb +72 -72
  99. data/spec/controllers/languages_controller_spec.rb +18 -18
  100. data/spec/controllers/licenses_controller_spec.rb +15 -15
  101. data/spec/controllers/manifestation_relationship_types_controller_spec.rb +51 -51
  102. data/spec/controllers/manifestation_relationships_controller_spec.rb +53 -53
  103. data/spec/controllers/manifestations_controller_spec.rb +108 -108
  104. data/spec/controllers/medium_of_performances_controller_spec.rb +15 -15
  105. data/spec/controllers/owns_controller_spec.rb +52 -52
  106. data/spec/controllers/picture_files_controller_spec.rb +52 -52
  107. data/spec/controllers/produce_types_controller_spec.rb +15 -15
  108. data/spec/controllers/produces_controller_spec.rb +50 -50
  109. data/spec/controllers/realize_types_controller_spec.rb +15 -15
  110. data/spec/controllers/realizes_controller_spec.rb +51 -51
  111. data/spec/controllers/resource_export_files_controller_spec.rb +38 -38
  112. data/spec/controllers/resource_import_files_controller_spec.rb +38 -38
  113. data/spec/controllers/resource_import_results_controller_spec.rb +15 -15
  114. data/spec/controllers/series_statements_controller_spec.rb +54 -54
  115. data/spec/dummy/db/development.sqlite3 +0 -0
  116. data/spec/dummy/db/schema.rb +2 -3
  117. data/spec/dummy/db/test.sqlite3 +0 -0
  118. data/spec/dummy/private/system/resource_import_files/resource_imports/000/000/004/original/resource_import_file_sample1.tsv +19 -19
  119. data/spec/dummy/private/system/resource_import_files/resource_imports/000/000/004/original/resource_import_file_sample2.tsv +19 -19
  120. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140818-53863-1jz1wlr.txt +147 -0
  121. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140818-55246-1rvhs1s.txt +147 -0
  122. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140818-60268-1psjqua.txt +147 -0
  123. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140818-60996-1cy28m2.txt +147 -0
  124. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140818-67507-19qjhj3.txt +147 -0
  125. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140818-69234-1cllrec.txt +147 -0
  126. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140818-76875-1os6joy.txt +147 -0
  127. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-1148-136brhb.txt +147 -0
  128. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-473-1c326dm.txt +147 -0
  129. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-93795-1x882ik.txt +147 -0
  130. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-94274-1xr9d9e.txt +147 -0
  131. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-94643-1fjcept.txt +147 -0
  132. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-97947-mfqh5b.txt +147 -0
  133. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-98488-126cvb4.txt +147 -0
  134. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-98849-1lg47mm.txt +147 -0
  135. data/spec/dummy/solr/test/data/index/segments.gen +0 -0
  136. data/spec/dummy/solr/test/data/index/segments_5ur +0 -0
  137. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000007580 +0 -0
  138. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000007581 +0 -0
  139. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000007582 +0 -0
  140. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000007583 +0 -0
  141. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000007584 +0 -0
  142. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000007585 +0 -0
  143. data/spec/dummy/tmp/cache/ACB/B20/manifestation_search_total +0 -0
  144. data/spec/dummy/tmp/cache/stdout +2554 -0
  145. data/spec/dummy/tmp/pids/redis-test.pid +1 -1
  146. data/spec/fixtures/agent_import_results.yml +0 -3
  147. data/spec/fixtures/carrier_types.yml +16 -16
  148. data/spec/fixtures/content_types.yml +78 -29
  149. data/spec/fixtures/frequencies.yml +32 -62
  150. data/spec/fixtures/manifestations.yml +1 -1
  151. data/spec/models/agent_import_result_spec.rb +0 -2
  152. data/spec/models/manifestation_spec.rb +1 -1
  153. data/spec/models/resource_import_file_spec.rb +30 -3
  154. data/spec/views/manifestations/show.html.erb_spec.rb +1 -1
  155. metadata +68 -103
  156. data/app/views/picture_files/_index_event.html.erb +0 -53
  157. data/app/views/picture_files/_index_shelf.html.erb +0 -53
  158. data/db/migrate/20121116033446_add_doi_to_manifestation.rb +0 -6
  159. data/spec/dummy/solr/test/data/index/_20i.fdt +0 -0
  160. data/spec/dummy/solr/test/data/index/_20i.fdx +0 -0
  161. data/spec/dummy/solr/test/data/index/_20i.fnm +0 -0
  162. data/spec/dummy/solr/test/data/index/_20i.nvd +0 -0
  163. data/spec/dummy/solr/test/data/index/_20i.nvm +0 -0
  164. data/spec/dummy/solr/test/data/index/_20i.si +0 -0
  165. data/spec/dummy/solr/test/data/index/_20i_Lucene41_0.doc +0 -0
  166. data/spec/dummy/solr/test/data/index/_20i_Lucene41_0.pos +0 -0
  167. data/spec/dummy/solr/test/data/index/_20i_Lucene41_0.tim +0 -0
  168. data/spec/dummy/solr/test/data/index/_20i_Lucene41_0.tip +0 -0
  169. data/spec/dummy/solr/test/data/index/_20j.fdt +0 -0
  170. data/spec/dummy/solr/test/data/index/_20j.fdx +0 -0
  171. data/spec/dummy/solr/test/data/index/_20j.fnm +0 -0
  172. data/spec/dummy/solr/test/data/index/_20j.nvd +0 -0
  173. data/spec/dummy/solr/test/data/index/_20j.nvm +0 -0
  174. data/spec/dummy/solr/test/data/index/_20j.si +0 -0
  175. data/spec/dummy/solr/test/data/index/_20j_Lucene41_0.doc +0 -0
  176. data/spec/dummy/solr/test/data/index/_20j_Lucene41_0.pos +0 -0
  177. data/spec/dummy/solr/test/data/index/_20j_Lucene41_0.tim +0 -0
  178. data/spec/dummy/solr/test/data/index/_20j_Lucene41_0.tip +0 -0
  179. data/spec/dummy/solr/test/data/index/_20k.fdt +0 -0
  180. data/spec/dummy/solr/test/data/index/_20k.fdx +0 -0
  181. data/spec/dummy/solr/test/data/index/_20k.fnm +0 -0
  182. data/spec/dummy/solr/test/data/index/_20k.nvd +0 -0
  183. data/spec/dummy/solr/test/data/index/_20k.nvm +0 -0
  184. data/spec/dummy/solr/test/data/index/_20k.si +0 -0
  185. data/spec/dummy/solr/test/data/index/_20k_Lucene41_0.doc +0 -0
  186. data/spec/dummy/solr/test/data/index/_20k_Lucene41_0.pos +0 -0
  187. data/spec/dummy/solr/test/data/index/_20k_Lucene41_0.tim +0 -0
  188. data/spec/dummy/solr/test/data/index/_20k_Lucene41_0.tip +0 -0
  189. data/spec/dummy/solr/test/data/index/segments_2uc +0 -0
  190. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000003680 +0 -0
  191. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000003681 +0 -0
  192. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000003682 +0 -0
@@ -1,12 +1,83 @@
1
- class MediumOfPerformancesController < InheritedResources::Base
2
- respond_to :html, :json
1
+ class MediumOfPerformancesController < ApplicationController
3
2
  load_and_authorize_resource
3
+ # GET /medium_of_performances
4
+ # GET /medium_of_performances.json
5
+ def index
6
+ @medium_of_performances = MediumOfPerformance.all
4
7
 
8
+ respond_to do |format|
9
+ format.html # index.html.erb
10
+ format.json { render json: @medium_of_performances }
11
+ end
12
+ end
13
+
14
+ # GET /medium_of_performances/1
15
+ # GET /medium_of_performances/1.json
16
+ def show
17
+ respond_to do |format|
18
+ format.html # show.html.erb
19
+ format.json { render json: @medium_of_performance }
20
+ end
21
+ end
22
+
23
+ # GET /medium_of_performances/new
24
+ # GET /medium_of_performances/new.json
25
+ def new
26
+ @medium_of_performance = MediumOfPerformance.new
27
+
28
+ respond_to do |format|
29
+ format.html # new.html.erb
30
+ format.json { render json: @medium_of_performance }
31
+ end
32
+ end
33
+
34
+ # GET /medium_of_performances/1/edit
35
+ def edit
36
+ end
37
+
38
+ # POST /medium_of_performances
39
+ # POST /medium_of_performances.json
40
+ def create
41
+ @medium_of_performance = MediumOfPerformance.new(params[:medium_of_performance])
42
+
43
+ respond_to do |format|
44
+ if @medium_of_performance.save
45
+ format.html { redirect_to @medium_of_performance, notice: t('controller.successfully_created', model: t('activerecord.models.medium_of_performance')) }
46
+ format.json { render json: @medium_of_performance, status: :created, location: @medium_of_performance }
47
+ else
48
+ format.html { render action: "new" }
49
+ format.json { render json: @medium_of_performance.errors, status: :unprocessable_entity }
50
+ end
51
+ end
52
+ end
53
+
54
+ # PUT /medium_of_performances/1
55
+ # PUT /medium_of_performances/1.json
5
56
  def update
6
57
  if params[:move]
7
58
  move_position(@medium_of_performance, params[:move])
8
59
  return
9
60
  end
10
- update!
61
+
62
+ respond_to do |format|
63
+ if @medium_of_performance.update_attributes(params[:medium_of_performance])
64
+ format.html { redirect_to @medium_of_performance, notice: t('controller.successfully_updated', model: t('activerecord.models.medium_of_performance')) }
65
+ format.json { head :no_content }
66
+ else
67
+ format.html { render action: "edit" }
68
+ format.json { render json: @medium_of_performance.errors, status: :unprocessable_entity }
69
+ end
70
+ end
71
+ end
72
+
73
+ # DELETE /medium_of_performances/1
74
+ # DELETE /medium_of_performances/1.json
75
+ def destroy
76
+ @medium_of_performance.destroy
77
+
78
+ respond_to do |format|
79
+ format.html { redirect_to medium_of_performances_url, notice: t('controller.successfully_deleted', model: t('activerecord.models.medium_of_performance')) }
80
+ format.json { head :no_content }
81
+ end
11
82
  end
12
83
  end
@@ -96,11 +96,19 @@ class PictureFilesController < ApplicationController
96
96
  move_position(@picture_file, params[:move], false)
97
97
  case
98
98
  when @picture_file.picture_attachable.is_a?(Shelf)
99
- redirect_to shelf_picture_files_url(@picture_file.picture_attachable)
99
+ redirect_to picture_files_url(shelf_id: @picture_file.picture_attachable_id)
100
100
  when @picture_file.picture_attachable.is_a?(Manifestation)
101
- redirect_to manifestation_picture_files_url(@picture_file.picture_attachable)
101
+ redirect_to picture_files_url(manifestation_id: @picture_file.picture_attachable_id)
102
102
  else
103
- redirect_to picture_files_url
103
+ if defined?(EnjuEvent)
104
+ if @picture_file.picture_attachable.is_a?(Event)
105
+ redirect_to picture_files_url(manifestation_id: @picture_file.picture_attachable_id)
106
+ else
107
+ redirect_to picture_files_url
108
+ end
109
+ else
110
+ redirect_to picture_files_url
111
+ end
104
112
  end
105
113
  return
106
114
  end
@@ -119,16 +127,32 @@ class PictureFilesController < ApplicationController
119
127
  # DELETE /picture_files/1
120
128
  # DELETE /picture_files/1.json
121
129
  def destroy
130
+ attachable = @picture_file.picture_attachable
122
131
  @picture_file.destroy
123
132
 
124
133
  respond_to do |format|
125
- if @shelf
126
- format.html { redirect_to shelf_picture_files_url(@shelf) }
127
- format.json { head :no_content }
128
- else
129
- format.html { redirect_to picture_files_url }
130
- format.json { head :no_content }
131
- end
134
+ flash[:notice] = t('controller.successfully_deleted', model: t('activerecord.models.picture_file'))
135
+ format.html {
136
+ case attachable.class.name
137
+ when 'Manifestation'
138
+ redirect_to picture_files_url(manifestation_id: attachable.id)
139
+ when 'Agent'
140
+ redirect_to picture_files_url(agent_id: attachable.id)
141
+ when 'Shelf'
142
+ redirect_to picture_files_url(shelf_id: attachable.id)
143
+ else
144
+ if defined?(EnjuEvent)
145
+ if attachable.class.name == 'Event'
146
+ redirect_to picture_files_url(event_id: attachable.id)
147
+ else
148
+ redirect_to picture_files_url
149
+ end
150
+ else
151
+ redirect_to picture_files_url
152
+ end
153
+ end
154
+ }
155
+ format.json { head :no_content }
132
156
  end
133
157
  end
134
158
 
@@ -1,12 +1,83 @@
1
- class ProduceTypesController < InheritedResources::Base
2
- respond_to :html, :json
1
+ class ProduceTypesController < ApplicationController
3
2
  load_and_authorize_resource
3
+ # GET /produce_types
4
+ # GET /produce_types.json
5
+ def index
6
+ @produce_types = ProduceType.all
4
7
 
8
+ respond_to do |format|
9
+ format.html # index.html.erb
10
+ format.json { render json: @produce_types }
11
+ end
12
+ end
13
+
14
+ # GET /produce_types/1
15
+ # GET /produce_types/1.json
16
+ def show
17
+ respond_to do |format|
18
+ format.html # show.html.erb
19
+ format.json { render json: @produce_type }
20
+ end
21
+ end
22
+
23
+ # GET /produce_types/new
24
+ # GET /produce_types/new.json
25
+ def new
26
+ @produce_type = ProduceType.new
27
+
28
+ respond_to do |format|
29
+ format.html # new.html.erb
30
+ format.json { render json: @produce_type }
31
+ end
32
+ end
33
+
34
+ # GET /produce_types/1/edit
35
+ def edit
36
+ end
37
+
38
+ # POST /produce_types
39
+ # POST /produce_types.json
40
+ def create
41
+ @produce_type = ProduceType.new(params[:produce_type])
42
+
43
+ respond_to do |format|
44
+ if @produce_type.save
45
+ format.html { redirect_to @produce_type, notice: t('controller.successfully_created', model: t('activerecord.models.produce_type')) }
46
+ format.json { render json: @produce_type, status: :created, location: @produce_type }
47
+ else
48
+ format.html { render action: "new" }
49
+ format.json { render json: @produce_type.errors, status: :unprocessable_entity }
50
+ end
51
+ end
52
+ end
53
+
54
+ # PUT /produce_types/1
55
+ # PUT /produce_types/1.json
5
56
  def update
6
57
  if params[:move]
7
58
  move_position(@produce_type, params[:move])
8
59
  return
9
60
  end
10
- update!
61
+
62
+ respond_to do |format|
63
+ if @produce_type.update_attributes(params[:produce_type])
64
+ format.html { redirect_to @produce_type, notice: t('controller.successfully_updated', model: t('activerecord.models.produce_type')) }
65
+ format.json { head :no_content }
66
+ else
67
+ format.html { render action: "edit" }
68
+ format.json { render json: @produce_type.errors, status: :unprocessable_entity }
69
+ end
70
+ end
71
+ end
72
+
73
+ # DELETE /produce_types/1
74
+ # DELETE /produce_types/1.json
75
+ def destroy
76
+ @produce_type.destroy
77
+
78
+ respond_to do |format|
79
+ format.html { redirect_to produce_types_url, notice: t('controller.successfully_deleted', model: t('activerecord.models.produce_type')) }
80
+ format.json { head :no_content }
81
+ end
11
82
  end
12
83
  end
@@ -1,12 +1,83 @@
1
- class RealizeTypesController < InheritedResources::Base
2
- respond_to :html, :json
1
+ class RealizeTypesController < ApplicationController
3
2
  load_and_authorize_resource
3
+ # GET /realize_types
4
+ # GET /realize_types.json
5
+ def index
6
+ @realize_types = RealizeType.all
4
7
 
8
+ respond_to do |format|
9
+ format.html # index.html.erb
10
+ format.json { render json: @realize_types }
11
+ end
12
+ end
13
+
14
+ # GET /realize_types/1
15
+ # GET /realize_types/1.json
16
+ def show
17
+ respond_to do |format|
18
+ format.html # show.html.erb
19
+ format.json { render json: @realize_type }
20
+ end
21
+ end
22
+
23
+ # GET /realize_types/new
24
+ # GET /realize_types/new.json
25
+ def new
26
+ @realize_type = RealizeType.new
27
+
28
+ respond_to do |format|
29
+ format.html # new.html.erb
30
+ format.json { render json: @realize_type }
31
+ end
32
+ end
33
+
34
+ # GET /realize_types/1/edit
35
+ def edit
36
+ end
37
+
38
+ # POST /realize_types
39
+ # POST /realize_types.json
40
+ def create
41
+ @realize_type = RealizeType.new(params[:realize_type])
42
+
43
+ respond_to do |format|
44
+ if @realize_type.save
45
+ format.html { redirect_to @realize_type, notice: t('controller.successfully_created', model: t('activerecord.models.realize_type')) }
46
+ format.json { render json: @realize_type, status: :created, location: @realize_type }
47
+ else
48
+ format.html { render action: "new" }
49
+ format.json { render json: @realize_type.errors, status: :unprocessable_entity }
50
+ end
51
+ end
52
+ end
53
+
54
+ # PUT /realize_types/1
55
+ # PUT /realize_types/1.json
5
56
  def update
6
57
  if params[:move]
7
58
  move_position(@realize_type, params[:move])
8
59
  return
9
60
  end
10
- update!
61
+
62
+ respond_to do |format|
63
+ if @realize_type.update_attributes(params[:realize_type])
64
+ format.html { redirect_to @realize_type, notice: t('controller.successfully_updated', model: t('activerecord.models.realize_type')) }
65
+ format.json { head :no_content }
66
+ else
67
+ format.html { render action: "edit" }
68
+ format.json { render json: @realize_type.errors, status: :unprocessable_entity }
69
+ end
70
+ end
71
+ end
72
+
73
+ # DELETE /realize_types/1
74
+ # DELETE /realize_types/1.json
75
+ def destroy
76
+ @realize_type.destroy
77
+
78
+ respond_to do |format|
79
+ format.html { redirect_to realize_types_url, notice: t('controller.successfully_deleted', model: t('activerecord.models.realize_type')) }
80
+ format.json { head :no_content }
81
+ end
11
82
  end
12
83
  end
@@ -97,11 +97,12 @@ class ResourceImportFilesController < ApplicationController
97
97
  @resource_import_file.destroy
98
98
 
99
99
  respond_to do |format|
100
- format.html { redirect_to resource_import_files_url }
100
+ format.html { redirect_to resource_import_files_url, notice: t('controller.successfully_deleted', model: t('activerecord.models.resource_import_file')) }
101
101
  format.json { head :no_content }
102
102
  end
103
103
  end
104
104
 
105
+ private
105
106
  def prepare_options
106
107
  @libraries = Library.all
107
108
  library = Library.where(id: @resource_import_file.try(:library_id)).first
@@ -1,19 +1,39 @@
1
- class ResourceImportResultsController < InheritedResources::Base
2
- respond_to :html, :json, :txt
1
+ class ResourceImportResultsController < ApplicationController
3
2
  load_and_authorize_resource
4
- has_scope :file_id
5
- actions :index, :show, :destroy
6
-
3
+ # GET /resource_import_results
4
+ # GET /resource_import_results.json
7
5
  def index
8
- @resource_import_file = ResourceImportFile.where(:id => params[:resource_import_file_id]).first
6
+ @resource_import_file = ResourceImportFile.where(id: params[:resource_import_file_id]).first
9
7
  if @resource_import_file
10
- if params[:format] == 'txt'
11
- @resource_import_results = @resource_import_file.resource_import_results
12
- else
13
- @resource_import_results = @resource_import_file.resource_import_results.page(params[:page])
14
- end
8
+ @resource_import_results = @resource_import_file.resource_import_results.page(params[:page])
15
9
  else
16
10
  @resource_import_results = ResourceImportResult.page(params[:page])
17
11
  end
12
+
13
+ respond_to do |format|
14
+ format.html # index.html.erb
15
+ format.json { render json: @resource_import_results }
16
+ format.txt
17
+ end
18
+ end
19
+
20
+ # GET /resource_import_results/1
21
+ # GET /resource_import_results/1.json
22
+ def show
23
+ respond_to do |format|
24
+ format.html # show.html.erb
25
+ format.json { render json: @resource_import_result }
26
+ end
27
+ end
28
+
29
+ # DELETE /resource_import_results/1
30
+ # DELETE /resource_import_results/1.json
31
+ def destroy
32
+ @resource_import_result.destroy
33
+
34
+ respond_to do |format|
35
+ format.html { redirect_to resource_import_results_url, notice: t('controller.successfully_deleted', model: t('activerecord.models.resource_import_result')) }
36
+ format.json { head :no_content }
37
+ end
18
38
  end
19
39
  end
@@ -4,7 +4,7 @@ class AgentImportFile < ActiveRecord::Base
4
4
  attr_accessible :agent_import, :edit_mode, :user_encoding, :mode
5
5
  default_scope {order('agent_import_files.id DESC')}
6
6
  scope :not_imported, -> {in_state(:pending)}
7
- scope :stucked, -> {in_state(:pending).where('created_at < ?', 1.hour.ago)}
7
+ scope :stucked, -> {in_state(:pending).where('agent_import_files.created_at < ?', 1.hour.ago)}
8
8
 
9
9
  if Setting.uploaded_file.storage == :s3
10
10
  has_attached_file :agent_import, :storage => :s3, :s3_credentials => "#{Setting.amazon}",
@@ -17,9 +17,7 @@ end
17
17
  # id :integer not null, primary key
18
18
  # agent_import_file_id :integer
19
19
  # agent_id :integer
20
- # user_id :integer
21
20
  # body :text
22
21
  # created_at :datetime not null
23
22
  # updated_at :datetime not null
24
23
  #
25
-
@@ -12,7 +12,7 @@ class CarrierType < ActiveRecord::Base
12
12
 
13
13
  def mods_type
14
14
  case name
15
- when 'print'
15
+ when 'volume'
16
16
  'text'
17
17
  else
18
18
  # TODO: その他のタイプ
@@ -27,6 +27,11 @@ class Identifier < ActiveRecord::Base
27
27
  unless StdNum::LCCN.valid?(body)
28
28
  errors.add(:body)
29
29
  end
30
+
31
+ when 'doi'
32
+ if URI.parse(body).scheme
33
+ errors.add(:body)
34
+ end
30
35
  end
31
36
  end
32
37
 
data/app/models/item.rb CHANGED
@@ -34,7 +34,7 @@ class Item < ActiveRecord::Base
34
34
  validates_date :acquired_at, allow_blank: true
35
35
 
36
36
  normalize_attributes :item_identifier, :binding_item_identifier,
37
- :call_number, :binding_call_number
37
+ :call_number, :binding_call_number, :url
38
38
 
39
39
  searchable do
40
40
  text :item_identifier, :note, :title, :creator, :contributor, :publisher,
@@ -24,8 +24,8 @@ class Manifestation < ActiveRecord::Base
24
24
  :series_statements_attributes, :periodical, :statement_of_responsibility,
25
25
  :creators_attributes, :contributors_attributes, :publishers_attributes,
26
26
  :identifiers_attributes
27
- attr_accessible :fulltext_content,
28
- :doi, :number_of_page_string, :parent_id
27
+ attr_accessible :fulltext_content, :extent_of_text,
28
+ :number_of_page_string, :parent_id
29
29
 
30
30
  has_many :creates, dependent: :destroy, foreign_key: 'work_id'
31
31
  has_many :creators, through: :creates, source: :agent, order: 'creates.position'
@@ -201,7 +201,9 @@ class Manifestation < ActiveRecord::Base
201
201
  end
202
202
  end
203
203
  string :sort_title
204
- string :doi
204
+ string :doi, multiple: true do
205
+ identifier_contents(:doi)
206
+ end
205
207
  boolean :periodical do
206
208
  periodical?
207
209
  end
@@ -232,8 +234,11 @@ class Manifestation < ActiveRecord::Base
232
234
 
233
235
  validates_presence_of :original_title, :carrier_type, :language
234
236
  validates_associated :carrier_type, :language
235
- validates :start_page, :numericality => true, allow_blank: true
236
- validates :end_page, :numericality => true, allow_blank: true
237
+ validates :start_page, numericality: {greater_than_or_equal_to: 0}, allow_blank: true
238
+ validates :end_page, numericality: {greater_than_or_equal_to: 0}, allow_blank: true
239
+ validates :height, numericality: {greater_than_or_equal_to: 0}, allow_blank: true
240
+ validates :width, numericality: {greater_than_or_equal_to: 0}, allow_blank: true
241
+ validates :depth, numericality: {greater_than_or_equal_to: 0}, allow_blank: true
237
242
  validates :manifestation_identifier, uniqueness: true, allow_blank: true
238
243
  validates :pub_date, format: {with: /\A\[{0,1}\d+([\/-]\d{0,2}){0,2}\]{0,1}\z/}, allow_blank: true
239
244
  validates :access_address, url: true, allow_blank: true, length: {:maximum => 255}
@@ -300,8 +305,8 @@ class Manifestation < ActiveRecord::Base
300
305
  end
301
306
 
302
307
  def number_of_pages
303
- if self.start_page and self.end_page
304
- page = self.end_page.to_i - self.start_page.to_i + 1
308
+ if start_page and end_page
309
+ end_page.to_i - start_page.to_i + 1
305
310
  end
306
311
  end
307
312
 
@@ -613,8 +618,8 @@ end
613
618
  # attachment_meta :text
614
619
  # month_of_publication :integer
615
620
  # fulltext_content :boolean
616
- # doi :string(255)
617
621
  # periodical :boolean
618
622
  # statement_of_responsibility :text
619
623
  # publication_place :text
624
+ # extent_of_text :text
620
625
  #