enju_biblio 0.1.0.pre37 → 0.1.0.pre38
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/addresses.js +2 -0
- data/app/assets/javascripts/identifier_types.js +2 -0
- data/app/assets/javascripts/identifiers.js +2 -0
- data/app/assets/stylesheets/addresses.css +4 -0
- data/app/assets/stylesheets/identifier_types.css +4 -0
- data/app/assets/stylesheets/identifiers.css +4 -0
- data/app/controllers/addresses_controller.rb +2 -0
- data/app/controllers/carrier_types_controller.rb +85 -5
- data/app/controllers/identifier_types_controller.rb +84 -0
- data/app/controllers/identifiers_controller.rb +14 -0
- data/app/controllers/manifestations_controller.rb +14 -21
- data/app/helpers/addresses_helper.rb +2 -0
- data/app/helpers/identifier_types_helper.rb +2 -0
- data/app/helpers/identifiers_helper.rb +2 -0
- data/app/models/carrier_type.rb +2 -0
- data/app/models/enju_biblio/ability.rb +12 -0
- data/app/models/identifier.rb +65 -0
- data/app/models/identifier_type.rb +21 -0
- data/app/models/import_request.rb +1 -0
- data/app/models/manifestation.rb +28 -87
- data/app/models/page_sweeper.rb +0 -2
- data/app/models/resource_import_file.rb +34 -18
- data/app/views/addresses/_form.html.erb +57 -0
- data/app/views/addresses/edit.html.erb +6 -0
- data/app/views/addresses/index.html.erb +41 -0
- data/app/views/addresses/new.html.erb +5 -0
- data/app/views/addresses/show.html.erb +55 -0
- data/app/views/carrier_types/_form.html.erb +4 -1
- data/app/views/carrier_types/index.html.erb +1 -1
- data/app/views/identifier_types/_form.html.erb +22 -0
- data/app/views/identifier_types/edit.html.erb +13 -0
- data/app/views/identifier_types/index.html.erb +45 -0
- data/app/views/identifier_types/new.html.erb +12 -0
- data/app/views/identifier_types/show.html.erb +24 -0
- data/app/views/identifiers/_form.html.erb +30 -0
- data/app/views/identifiers/edit.html.erb +15 -0
- data/app/views/identifiers/index.html.erb +33 -0
- data/app/views/identifiers/new.html.erb +14 -0
- data/app/views/identifiers/show.html.erb +29 -0
- data/app/views/items/index.csv.erb +1 -1
- data/app/views/items/index.html.erb +2 -1
- data/app/views/manifestations/_form.html.erb +17 -36
- data/app/views/manifestations/_show.mods.builder +6 -2
- data/app/views/manifestations/_show.rdf.builder +7 -6
- data/app/views/manifestations/_show_detail_librarian.html.erb +5 -15
- data/app/views/manifestations/_show_detail_user.html.erb +5 -15
- data/app/views/manifestations/_show_index.html.erb +1 -1
- data/app/views/manifestations/index.csv.erb +1 -1
- data/app/views/manifestations/index.rss.builder +3 -1
- data/app/views/manifestations/show.mobile.erb +1 -1
- data/config/locales/translation_en.yml +14 -7
- data/config/locales/translation_ja.yml +15 -8
- data/config/routes.rb +6 -8
- data/db/migrate/005_create_manifestations.rb +0 -12
- data/db/migrate/20130506175303_create_identifier_types.rb +12 -0
- data/db/migrate/20130506175834_create_identifiers.rb +14 -0
- data/lib/enju_biblio/version.rb +1 -1
- data/lib/generators/enju_biblio/setup/templates/db/fixtures/identifier_types.yml +27 -0
- data/spec/controllers/identifier_types_controller_spec.rb +167 -0
- data/spec/controllers/identifiers_controller_spec.rb +446 -0
- data/spec/controllers/import_requests_controller_spec.rb +1 -1
- data/spec/controllers/manifestations_controller_spec.rb +12 -10
- data/spec/dummy/app/models/ability.rb +12 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20130504195916_add_subject_heading_type_id_to_subject.rb +5 -0
- data/spec/dummy/db/schema.rb +26 -16
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/solr/data/test/index/segments.gen +0 -0
- data/spec/dummy/solr/data/test/index/segments_myc +0 -0
- data/spec/dummy/tmp/cache/4AD/470/country_all +0 -0
- data/spec/factories/identifier.rb +6 -0
- data/spec/factories/identifier_type.rb +5 -0
- data/spec/fixtures/identifier_types.yml +29 -0
- data/spec/fixtures/identifiers.yml +113 -0
- data/spec/fixtures/manifestations.yml +0 -137
- data/spec/fixtures/subject_heading_types.yml +39 -0
- data/spec/fixtures/subject_types.yml +4 -4
- data/spec/models/identifier_spec.rb +22 -0
- data/spec/models/identifier_type_spec.rb +21 -0
- data/spec/models/manifestation_spec.rb +0 -11
- data/spec/models/resource_import_file_spec.rb +7 -7
- data/spec/routing/manifestations_routing_spec.rb +1 -1
- metadata +66 -16
- data/app/views/manifestations/_show_periodical_master.html.erb +0 -23
- data/app/views/manifestations/_show_series_statement.html.erb +0 -30
- data/spec/dummy/solr/data/test/index/segments_l8s +0 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
class IdentifierType < ActiveRecord::Base
|
2
|
+
attr_accessible :display_name, :name, :note, :position
|
3
|
+
include MasterModel
|
4
|
+
default_scope :order => "identifier_types.position"
|
5
|
+
has_many :identifiers
|
6
|
+
validates :name, :format => {:with => /\A[0-9a-z][0-9a-z_\-]*[0-9a-z]\Z/}
|
7
|
+
end
|
8
|
+
|
9
|
+
# == Schema Information
|
10
|
+
#
|
11
|
+
# Table name: identifier_types
|
12
|
+
#
|
13
|
+
# id :integer not null, primary key
|
14
|
+
# name :string(255)
|
15
|
+
# display_name :text
|
16
|
+
# note :text
|
17
|
+
# position :integer
|
18
|
+
# created_at :datetime not null
|
19
|
+
# updated_at :datetime not null
|
20
|
+
#
|
21
|
+
|
data/app/models/manifestation.rb
CHANGED
@@ -12,8 +12,8 @@ class Manifestation < ActiveRecord::Base
|
|
12
12
|
attr_accessible :original_title, :title_alternative, :title_transcription,
|
13
13
|
:manifestation_identifier, :date_copyrighted,
|
14
14
|
:access_address, :language_id, :carrier_type_id, :extent_id, :start_page,
|
15
|
-
:end_page, :height, :width, :depth,
|
16
|
-
:
|
15
|
+
:end_page, :height, :width, :depth,
|
16
|
+
:price, :fulltext, :volume_number_string,
|
17
17
|
:issue_number_string, :serial_number_string, :edition, :note,
|
18
18
|
:repository_content, :required_role_id, :frequency_id,
|
19
19
|
:title_alternative_transcription, :description, :abstract, :available_at,
|
@@ -21,7 +21,8 @@ class Manifestation < ActiveRecord::Base
|
|
21
21
|
:pub_date, :edition_string, :volume_number, :issue_number, :serial_number,
|
22
22
|
:ndc, :content_type_id, :attachment, :classification_number,
|
23
23
|
:series_statements_attributes, :periodical,
|
24
|
-
:creators_attributes, :contributors_attributes, :publishers_attributes
|
24
|
+
:creators_attributes, :contributors_attributes, :publishers_attributes,
|
25
|
+
:identifiers_attributes
|
25
26
|
attr_accessible :fulltext_content,
|
26
27
|
:doi, :number_of_page_string, :parent_id
|
27
28
|
|
@@ -46,11 +47,13 @@ class Manifestation < ActiveRecord::Base
|
|
46
47
|
belongs_to :frequency
|
47
48
|
belongs_to :required_role, :class_name => 'Role', :foreign_key => 'required_role_id', :validate => true
|
48
49
|
has_one :resource_import_result
|
50
|
+
has_many :identifiers
|
49
51
|
belongs_to :nii_type if defined?(EnjuNii)
|
50
52
|
accepts_nested_attributes_for :creators, :allow_destroy => true, :reject_if => :all_blank
|
51
53
|
accepts_nested_attributes_for :contributors, :allow_destroy => true, :reject_if => :all_blank
|
52
54
|
accepts_nested_attributes_for :publishers, :allow_destroy => true, :reject_if => :all_blank
|
53
55
|
accepts_nested_attributes_for :series_statements, :allow_destroy => true, :reject_if => :all_blank
|
56
|
+
accepts_nested_attributes_for :identifiers, :allow_destroy => true, :reject_if => :all_blank
|
54
57
|
|
55
58
|
searchable do
|
56
59
|
text :title, :default_boost => 2 do
|
@@ -78,17 +81,21 @@ class Manifestation < ActiveRecord::Base
|
|
78
81
|
publisher.join('').gsub(/\s/, '').downcase
|
79
82
|
end
|
80
83
|
string :isbn, :multiple => true do
|
81
|
-
|
84
|
+
identifier_contents(:isbn)
|
82
85
|
end
|
83
86
|
string :issn, :multiple => true do
|
84
87
|
if series_statements.exists?
|
85
|
-
[issn, (series_statements.map{|s| s.manifestation.issn})].flatten.uniq.compact
|
88
|
+
[identifier_contents(:issn), (series_statements.map{|s| s.manifestation.identifier_contents(:issn)})].flatten.uniq.compact
|
86
89
|
else
|
87
|
-
issn
|
90
|
+
identifier_contents(:issn)
|
88
91
|
end
|
89
92
|
end
|
90
|
-
string :lccn
|
91
|
-
|
93
|
+
string :lccn, :multiple => true do
|
94
|
+
identifier_contents(:lccn)
|
95
|
+
end
|
96
|
+
string :nbn, :multiple => true do
|
97
|
+
identifier_contents(:nbn)
|
98
|
+
end
|
92
99
|
string :carrier_type do
|
93
100
|
carrier_type.name
|
94
101
|
end
|
@@ -179,13 +186,13 @@ class Manifestation < ActiveRecord::Base
|
|
179
186
|
end
|
180
187
|
end
|
181
188
|
text :isbn do # 前方一致検索のためtext指定を追加
|
182
|
-
|
189
|
+
identifier_contents(:isbn)
|
183
190
|
end
|
184
191
|
text :issn do # 前方一致検索のためtext指定を追加
|
185
192
|
if series_statements.exists?
|
186
|
-
[issn, (series_statements.map{|s| s.manifestation.issn})].flatten.uniq.compact
|
193
|
+
[identifier_contents(:issn), (series_statements.map{|s| s.manifestation.identifier_contents(:issn)})].flatten.uniq.compact
|
187
194
|
else
|
188
|
-
issn
|
195
|
+
identifier_contents(:issn)
|
189
196
|
end
|
190
197
|
end
|
191
198
|
string :sort_title
|
@@ -223,75 +230,22 @@ class Manifestation < ActiveRecord::Base
|
|
223
230
|
validates_associated :carrier_type, :language
|
224
231
|
validates :start_page, :numericality => true, :allow_blank => true
|
225
232
|
validates :end_page, :numericality => true, :allow_blank => true
|
226
|
-
validates :isbn, :uniqueness => true, :allow_blank => true, :unless => proc{|manifestation| manifestation.series_statements.exists?}
|
227
|
-
validates :nbn, :uniqueness => true, :allow_blank => true
|
228
233
|
validates :manifestation_identifier, :uniqueness => true, :allow_blank => true
|
229
234
|
validates :pub_date, :format => {:with => /\A\[{0,1}\d+([\/-]\d{0,2}){0,2}\]{0,1}\z/}, :allow_blank => true
|
230
235
|
validates :access_address, :url => true, :allow_blank => true, :length => {:maximum => 255}
|
231
|
-
validate :check_isbn, :check_issn, :check_lccn, :unless => :during_import
|
232
236
|
validates :issue_number, :numericality => {:greater_than => 0}, :allow_blank => true
|
233
237
|
validates :volume_number, :numericality => {:greater_than => 0}, :allow_blank => true
|
234
238
|
validates :serial_number, :numericality => {:greater_than => 0}, :allow_blank => true
|
235
239
|
validates :edition, :numericality => {:greater_than => 0}, :allow_blank => true
|
236
|
-
before_validation :set_wrong_isbn, :check_issn, :check_lccn, :if => :during_import
|
237
|
-
before_validation :convert_isbn, :if => :isbn_changed?
|
238
240
|
after_create :clear_cached_numdocs
|
239
241
|
before_save :set_date_of_publication, :set_number
|
240
242
|
after_save :index_series_statement
|
241
243
|
after_destroy :index_series_statement
|
242
|
-
normalize_attributes :manifestation_identifier, :pub_date, :
|
244
|
+
normalize_attributes :manifestation_identifier, :pub_date, :original_title
|
243
245
|
paginates_per 10
|
244
246
|
|
245
247
|
attr_accessor :during_import, :parent_id
|
246
248
|
|
247
|
-
def check_isbn
|
248
|
-
if isbn.present?
|
249
|
-
unless StdNum::ISBN.valid?(isbn)
|
250
|
-
errors.add(:isbn)
|
251
|
-
end
|
252
|
-
end
|
253
|
-
end
|
254
|
-
|
255
|
-
def check_issn
|
256
|
-
self.issn = StdNum::ISSN.normalize(issn)
|
257
|
-
if issn.present?
|
258
|
-
unless StdNum::ISSN.valid?(issn)
|
259
|
-
errors.add(:issn)
|
260
|
-
end
|
261
|
-
end
|
262
|
-
end
|
263
|
-
|
264
|
-
def check_lccn
|
265
|
-
if lccn.present?
|
266
|
-
unless StdNum::LCCN.valid?(lccn)
|
267
|
-
errors.add(:lccn)
|
268
|
-
end
|
269
|
-
end
|
270
|
-
end
|
271
|
-
|
272
|
-
def set_wrong_isbn
|
273
|
-
if isbn.present?
|
274
|
-
unless StdNum::ISBN.valid?(isbn)
|
275
|
-
self.wrong_isbn
|
276
|
-
self.isbn = nil
|
277
|
-
end
|
278
|
-
end
|
279
|
-
end
|
280
|
-
|
281
|
-
def convert_isbn
|
282
|
-
return nil unless isbn
|
283
|
-
lisbn = Lisbn.new(isbn)
|
284
|
-
if lisbn.isbn
|
285
|
-
if lisbn.isbn.length == 10
|
286
|
-
self.isbn10 = lisbn.isbn10
|
287
|
-
self.isbn = lisbn.isbn13
|
288
|
-
elsif lisbn.isbn.length == 13
|
289
|
-
self.isbn = lisbn.isbn10
|
290
|
-
self.isbn = lisbn.isbn13
|
291
|
-
end
|
292
|
-
end
|
293
|
-
end
|
294
|
-
|
295
249
|
def set_date_of_publication
|
296
250
|
return if pub_date.blank?
|
297
251
|
begin
|
@@ -379,11 +333,6 @@ class Manifestation < ActiveRecord::Base
|
|
379
333
|
titles
|
380
334
|
end
|
381
335
|
|
382
|
-
def hyphenated_isbn
|
383
|
-
lisbn = Lisbn.new(isbn)
|
384
|
-
lisbn.parts.join('-')
|
385
|
-
end
|
386
|
-
|
387
336
|
# TODO: よりよい推薦方法
|
388
337
|
def self.pickup(keyword = nil)
|
389
338
|
return nil if self.cached_numdocs < 5
|
@@ -434,10 +383,9 @@ class Manifestation < ActiveRecord::Base
|
|
434
383
|
end
|
435
384
|
|
436
385
|
def self.find_by_isbn(isbn)
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
end
|
386
|
+
identifier_type = IdentifierType.where(:name => 'isbn').first
|
387
|
+
return nil unless identifier_type
|
388
|
+
Manifestation.includes(:identifiers => :identifier_type).where(:"identifiers.body" => isbn, :"identifier_types.name" => 'isbn')
|
441
389
|
end
|
442
390
|
|
443
391
|
def index_series_statement
|
@@ -513,12 +461,6 @@ class Manifestation < ActiveRecord::Base
|
|
513
461
|
}.compact
|
514
462
|
end
|
515
463
|
|
516
|
-
def self.import_isbn(isbn)
|
517
|
-
manifestation = Manifestation.import_from_ndl_search(:isbn => isbn) if defined?(EnjuNdl)
|
518
|
-
#manifestation = Manifestation.import_from_cinii_books(:isbn => isbn) if defined?(EnjuNii)
|
519
|
-
manifestation
|
520
|
-
end
|
521
|
-
|
522
464
|
def latest_issue
|
523
465
|
if series_master?
|
524
466
|
derived_manifestations.where('date_of_publication IS NOT NULL').order('date_of_publication DESC').first
|
@@ -530,6 +472,12 @@ class Manifestation < ActiveRecord::Base
|
|
530
472
|
derived_manifestations.where('date_of_publication IS NOT NULL').order('date_of_publication DESC').first
|
531
473
|
end
|
532
474
|
end
|
475
|
+
|
476
|
+
def identifier_contents(name)
|
477
|
+
if IdentifierType.where(:name => name.to_s).exists?
|
478
|
+
identifiers.where(:identifier_type_id => IdentifierType.where(:name => name).first.id).pluck(:body)
|
479
|
+
end
|
480
|
+
end
|
533
481
|
end
|
534
482
|
|
535
483
|
# == Schema Information
|
@@ -556,13 +504,6 @@ end
|
|
556
504
|
# height :integer
|
557
505
|
# width :integer
|
558
506
|
# depth :integer
|
559
|
-
# isbn :string(255)
|
560
|
-
# isbn10 :string(255)
|
561
|
-
# wrong_isbn :string(255)
|
562
|
-
# nbn :string(255)
|
563
|
-
# lccn :string(255)
|
564
|
-
# oclc_number :string(255)
|
565
|
-
# issn :string(255)
|
566
507
|
# price :integer
|
567
508
|
# fulltext :text
|
568
509
|
# volume_number_string :string(255)
|
data/app/models/page_sweeper.rb
CHANGED
@@ -23,8 +23,6 @@ class PageSweeper < ActionController::Caching::Sweeper
|
|
23
23
|
expire_editable_fragment(record.item)
|
24
24
|
when :SeriesStatement
|
25
25
|
expire_editable_fragment(record.manifestation)
|
26
|
-
when :SeriesHasManifestation
|
27
|
-
expire_editable_fragment(record.manifestation)
|
28
26
|
when :PictureFile
|
29
27
|
if record.picture_attachable_type?
|
30
28
|
expire_editable_fragment(record.picture_attachable)
|
@@ -91,21 +91,24 @@ class ResourceImportFile < ActiveRecord::Base
|
|
91
91
|
manifestation = Manifestation.where(:manifestation_identifier => row['manifestation_identifier'].to_s.strip).first
|
92
92
|
end
|
93
93
|
|
94
|
-
if row['nbn'].present?
|
95
|
-
manifestation = Manifestation.where(:nbn => row['nbn'].to_s.strip).first
|
96
|
-
end
|
97
|
-
|
98
94
|
unless manifestation
|
99
95
|
if row['doi'].present?
|
100
96
|
doi = URI.parse(row['doi']).path.gsub(/^\//, "")
|
101
|
-
manifestation = Manifestation.where(:doi => doi).first
|
97
|
+
manifestation = Manifestation.where(:doi => doi).first
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
unless manifestation
|
102
|
+
if row['nbn'].present?
|
103
|
+
nbn = row['nbn'].to_s.strip
|
104
|
+
manifestation = Identifier.where(:body => 'nbn', :identifier_type_id => IdentifierType.where(:name => 'nbn').first_or_create.id).first.try(:manifestation)
|
102
105
|
end
|
103
106
|
end
|
104
107
|
|
105
108
|
unless manifestation
|
106
109
|
if row['isbn'].present?
|
107
110
|
isbn = StdNum::ISBN.normalize(row['isbn'])
|
108
|
-
m =
|
111
|
+
m = Identifier.where(:body => isbn, :identifier_type_id => IdentifierType.where(:name => 'isbn').first_or_create.id).first.try(:manifestation)
|
109
112
|
end
|
110
113
|
if m
|
111
114
|
if m.series_statements.exists?
|
@@ -393,11 +396,10 @@ class ResourceImportFile < ActiveRecord::Base
|
|
393
396
|
def import_subject(row)
|
394
397
|
subjects = []
|
395
398
|
row['subject'].to_s.split('//').each do |s|
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
end
|
399
|
+
# TODO: Subject typeの設定
|
400
|
+
subject = Subject.new(:term => s.to_s.strip)
|
401
|
+
subject.subject_type = SubjectType.where(:name => 'concept').first
|
402
|
+
subject.subject_heading_type = SubjectHeadingType.where(:name => 'unknown').first
|
401
403
|
subjects << subject
|
402
404
|
end
|
403
405
|
subjects
|
@@ -476,6 +478,20 @@ class ResourceImportFile < ActiveRecord::Base
|
|
476
478
|
|
477
479
|
carrier_type = CarrierType.where(:name => row['carrier_type'].to_s.strip).first
|
478
480
|
|
481
|
+
identifier = {}
|
482
|
+
if row['isbn']
|
483
|
+
identifier[:isbn] = Identifier.new(:body => row['isbn'])
|
484
|
+
identifier[:isbn].identifier_type = IdentifierType.where(:name => 'isbn').first_or_create
|
485
|
+
end
|
486
|
+
if row['nbn']
|
487
|
+
identifier[:nbn] = Identifier.new(:body => row['nbn'])
|
488
|
+
identifier[:nbn].identifier_type = IdentifierType.where(:name => 'nbn').first_or_create
|
489
|
+
end
|
490
|
+
if row['issn']
|
491
|
+
identifier[:issn] = Identifier.new(:body => row['issn'])
|
492
|
+
identifier[:issn].identifier_type = IdentifierType.where(:name => 'issn').first_or_create
|
493
|
+
end
|
494
|
+
|
479
495
|
if end_page >= 1
|
480
496
|
start_page = 1
|
481
497
|
else
|
@@ -531,12 +547,6 @@ class ResourceImportFile < ActiveRecord::Base
|
|
531
547
|
:title_transcription => title[:title_transcription],
|
532
548
|
:title_alternative => title[:title_alternative],
|
533
549
|
:title_alternative_transcription => title[:title_alternative_transcription],
|
534
|
-
:isbn => isbn,
|
535
|
-
:wrong_isbn => row['wrong_isbn'],
|
536
|
-
:issn => row['issn'],
|
537
|
-
:lccn => row['lccn'],
|
538
|
-
:nbn => row['nbn'],
|
539
|
-
:ndc => row['ndc'],
|
540
550
|
:pub_date => row['pub_date'],
|
541
551
|
:volume_number_string => row['volume_number_string'].to_s.split(' ').first.try(:tr, '0-9', '0-9'),
|
542
552
|
:issue_number_string => row['issue_number_string'],
|
@@ -553,7 +563,6 @@ class ResourceImportFile < ActiveRecord::Base
|
|
553
563
|
:start_page => start_page,
|
554
564
|
:end_page => end_page,
|
555
565
|
:access_address => row['access_address'],
|
556
|
-
:doi => row['doi'],
|
557
566
|
:manifestation_identifier => row['manifestation_identifier'],
|
558
567
|
:fulltext_content => fulltext_content
|
559
568
|
}.delete_if{|key, value| value.nil?}
|
@@ -578,6 +587,13 @@ class ResourceImportFile < ActiveRecord::Base
|
|
578
587
|
|
579
588
|
manifestation.carrier_type = carrier_type if carrier_type
|
580
589
|
|
590
|
+
Manifestation.transaction do
|
591
|
+
manifestation.identifiers.delete_all if manifestation.identifiers.exists?
|
592
|
+
identifier.each do |k, v|
|
593
|
+
manifestation.identifiers << v if v.valid?
|
594
|
+
end
|
595
|
+
end
|
596
|
+
|
581
597
|
if row['series_original_title'].to_s.strip.present?
|
582
598
|
Manifestation.transaction do
|
583
599
|
if manifestation.series_statements.exists?
|
@@ -0,0 +1,57 @@
|
|
1
|
+
<%= form_for(@address) do |f| %>
|
2
|
+
<% if @address.errors.any? %>
|
3
|
+
<div id="error_explanation">
|
4
|
+
<h2><%= pluralize(@address.errors.count, "error") %> prohibited this address from being saved:</h2>
|
5
|
+
|
6
|
+
<ul>
|
7
|
+
<% @address.errors.full_messages.each do |msg| %>
|
8
|
+
<li><%= msg %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<div class="field">
|
15
|
+
<%= f.label :patron_id %><br />
|
16
|
+
<%= f.number_field :patron_id %>
|
17
|
+
</div>
|
18
|
+
<div class="field">
|
19
|
+
<%= f.label :place %><br />
|
20
|
+
<%= f.text_area :place %>
|
21
|
+
</div>
|
22
|
+
<div class="field">
|
23
|
+
<%= f.label :street %><br />
|
24
|
+
<%= f.text_area :street %>
|
25
|
+
</div>
|
26
|
+
<div class="field">
|
27
|
+
<%= f.label :locality %><br />
|
28
|
+
<%= f.text_area :locality %>
|
29
|
+
</div>
|
30
|
+
<div class="field">
|
31
|
+
<%= f.label :region %><br />
|
32
|
+
<%= f.text_area :region %>
|
33
|
+
</div>
|
34
|
+
<div class="field">
|
35
|
+
<%= f.label :zip_code %><br />
|
36
|
+
<%= f.text_field :zip_code %>
|
37
|
+
</div>
|
38
|
+
<div class="field">
|
39
|
+
<%= f.label :country_id %><br />
|
40
|
+
<%= f.number_field :country_id %>
|
41
|
+
</div>
|
42
|
+
<div class="field">
|
43
|
+
<%= f.label :telephone_number %><br />
|
44
|
+
<%= f.text_field :telephone_number %>
|
45
|
+
</div>
|
46
|
+
<div class="field">
|
47
|
+
<%= f.label :fax_number %><br />
|
48
|
+
<%= f.text_field :fax_number %>
|
49
|
+
</div>
|
50
|
+
<div class="field">
|
51
|
+
<%= f.label :note %><br />
|
52
|
+
<%= f.text_area :note %>
|
53
|
+
</div>
|
54
|
+
<div class="actions">
|
55
|
+
<%= f.submit %>
|
56
|
+
</div>
|
57
|
+
<% end %>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<h1>Listing addresses</h1>
|
2
|
+
|
3
|
+
<table>
|
4
|
+
<tr>
|
5
|
+
<th>Patron</th>
|
6
|
+
<th>Place</th>
|
7
|
+
<th>Street</th>
|
8
|
+
<th>Locality</th>
|
9
|
+
<th>Region</th>
|
10
|
+
<th>Zip code</th>
|
11
|
+
<th>Country</th>
|
12
|
+
<th>Telephone number</th>
|
13
|
+
<th>Fax number</th>
|
14
|
+
<th>Note</th>
|
15
|
+
<th></th>
|
16
|
+
<th></th>
|
17
|
+
<th></th>
|
18
|
+
</tr>
|
19
|
+
|
20
|
+
<% @addresses.each do |address| %>
|
21
|
+
<tr>
|
22
|
+
<td><%= address.patron_id %></td>
|
23
|
+
<td><%= address.place %></td>
|
24
|
+
<td><%= address.street %></td>
|
25
|
+
<td><%= address.locality %></td>
|
26
|
+
<td><%= address.region %></td>
|
27
|
+
<td><%= address.zip_code %></td>
|
28
|
+
<td><%= address.country_id %></td>
|
29
|
+
<td><%= address.telephone_number %></td>
|
30
|
+
<td><%= address.fax_number %></td>
|
31
|
+
<td><%= address.note %></td>
|
32
|
+
<td><%= link_to 'Show', address %></td>
|
33
|
+
<td><%= link_to 'Edit', edit_address_path(address) %></td>
|
34
|
+
<td><%= link_to 'Destroy', address, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
35
|
+
</tr>
|
36
|
+
<% end %>
|
37
|
+
</table>
|
38
|
+
|
39
|
+
<br />
|
40
|
+
|
41
|
+
<%= link_to 'New Address', new_address_path %>
|