enju_library 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.rdoc +3 -0
  3. data/Rakefile +47 -0
  4. data/app/controllers/bookstores_controller.rb +17 -0
  5. data/app/controllers/budget_types_controller.rb +13 -0
  6. data/app/controllers/libraries_controller.rb +125 -0
  7. data/app/controllers/library_groups_controller.rb +46 -0
  8. data/app/controllers/request_status_types_controller.rb +13 -0
  9. data/app/controllers/request_types_controller.rb +13 -0
  10. data/app/controllers/search_engines_controller.rb +17 -0
  11. data/app/controllers/shelves_controller.rb +138 -0
  12. data/app/controllers/subscribes_controller.rb +82 -0
  13. data/app/controllers/subscriptions_controller.rb +87 -0
  14. data/app/helpers/shelves_helper.rb +13 -0
  15. data/app/models/bookstore.rb +37 -0
  16. data/app/models/budget_type.rb +19 -0
  17. data/app/models/library.rb +131 -0
  18. data/app/models/library_group.rb +86 -0
  19. data/app/models/library_group_sweeper.rb +12 -0
  20. data/app/models/request_status_type.rb +20 -0
  21. data/app/models/request_type.rb +19 -0
  22. data/app/models/search_engine.rb +52 -0
  23. data/app/models/shelf.rb +66 -0
  24. data/app/models/subscribe.rb +23 -0
  25. data/app/models/subscription.rb +44 -0
  26. data/app/views/accepts/_form.html.erb +11 -0
  27. data/app/views/accepts/_list.html.erb +31 -0
  28. data/app/views/accepts/edit.html.erb +13 -0
  29. data/app/views/accepts/index.csv.erb +4 -0
  30. data/app/views/accepts/index.html.erb +49 -0
  31. data/app/views/accepts/index.js.erb +1 -0
  32. data/app/views/accepts/new.html.erb +14 -0
  33. data/app/views/accepts/show.html.erb +31 -0
  34. data/app/views/bookstores/_form.html.erb +42 -0
  35. data/app/views/bookstores/edit.html.erb +13 -0
  36. data/app/views/bookstores/index.html.erb +49 -0
  37. data/app/views/bookstores/new.html.erb +12 -0
  38. data/app/views/bookstores/show.html.erb +52 -0
  39. data/app/views/budget_types/_form.html.erb +19 -0
  40. data/app/views/budget_types/edit.html.erb +13 -0
  41. data/app/views/budget_types/index.html.erb +43 -0
  42. data/app/views/budget_types/new.html.erb +12 -0
  43. data/app/views/budget_types/show.html.erb +29 -0
  44. data/app/views/libraries/_calendar.html.erb +13 -0
  45. data/app/views/libraries/_form.html.erb +90 -0
  46. data/app/views/libraries/_map.html.erb +25 -0
  47. data/app/views/libraries/_map.mobile.erb +25 -0
  48. data/app/views/libraries/edit.html.erb +13 -0
  49. data/app/views/libraries/index.html.erb +75 -0
  50. data/app/views/libraries/new.html.erb +12 -0
  51. data/app/views/libraries/show.html.erb +131 -0
  52. data/app/views/libraries/show.mobile.erb +26 -0
  53. data/app/views/library_groups/_form.html.erb +59 -0
  54. data/app/views/library_groups/edit.html.erb +12 -0
  55. data/app/views/library_groups/index.html.erb +30 -0
  56. data/app/views/library_groups/new.html.erb +12 -0
  57. data/app/views/library_groups/show.html.erb +66 -0
  58. data/app/views/request_status_types/_form.html.erb +19 -0
  59. data/app/views/request_status_types/edit.html.erb +13 -0
  60. data/app/views/request_status_types/index.html.erb +40 -0
  61. data/app/views/request_status_types/new.html.erb +12 -0
  62. data/app/views/request_status_types/show.html.erb +29 -0
  63. data/app/views/request_types/_form.html.erb +19 -0
  64. data/app/views/request_types/edit.html.erb +13 -0
  65. data/app/views/request_types/index.html.erb +40 -0
  66. data/app/views/request_types/new.html.erb +12 -0
  67. data/app/views/request_types/show.html.erb +29 -0
  68. data/app/views/search_engines/_form.html.erb +44 -0
  69. data/app/views/search_engines/edit.html.erb +13 -0
  70. data/app/views/search_engines/index.html.erb +44 -0
  71. data/app/views/search_engines/new.html.erb +12 -0
  72. data/app/views/search_engines/show.html.erb +49 -0
  73. data/app/views/shelves/_form.html.erb +37 -0
  74. data/app/views/shelves/_library_facet.html.erb +12 -0
  75. data/app/views/shelves/_select_form.html.erb +1 -0
  76. data/app/views/shelves/edit.html.erb +13 -0
  77. data/app/views/shelves/index.html.erb +73 -0
  78. data/app/views/shelves/new.html.erb +18 -0
  79. data/app/views/shelves/show.html.erb +65 -0
  80. data/app/views/subscribes/edit.html.erb +37 -0
  81. data/app/views/subscribes/index.html.erb +31 -0
  82. data/app/views/subscribes/new.html.erb +48 -0
  83. data/app/views/subscribes/show.html.erb +34 -0
  84. data/app/views/subscriptions/edit.html.erb +29 -0
  85. data/app/views/subscriptions/index.html.erb +39 -0
  86. data/app/views/subscriptions/new.html.erb +28 -0
  87. data/app/views/subscriptions/show.html.erb +40 -0
  88. data/config/routes.rb +17 -0
  89. data/db/migrate/059_create_libraries.rb +28 -0
  90. data/db/migrate/069_create_shelves.rb +15 -0
  91. data/db/migrate/080_create_library_groups.rb +20 -0
  92. data/db/migrate/124_create_bookstores.rb +17 -0
  93. data/db/migrate/130_create_request_status_types.rb +12 -0
  94. data/db/migrate/131_create_request_types.rb +12 -0
  95. data/db/migrate/20081006090811_create_subscriptions.rb +17 -0
  96. data/db/migrate/20081006093246_create_subscribes.rb +14 -0
  97. data/db/migrate/20081023092436_create_search_engines.rb +17 -0
  98. data/db/migrate/20110222073537_add_url_to_library_group.rb +9 -0
  99. data/db/migrate/20110620173525_add_bookstore_id_to_item.rb +11 -0
  100. data/db/migrate/20110627122938_add_number_of_day_to_notify_overdue_to_user_group.rb +13 -0
  101. data/db/migrate/20120105074911_add_isil_to_library.rb +5 -0
  102. data/db/migrate/20120129014038_create_budget_types.rb +12 -0
  103. data/db/migrate/20120510140958_add_closed_to_shelf.rb +5 -0
  104. data/lib/enju_library/engine.rb +16 -0
  105. data/lib/enju_library/master_model.rb +19 -0
  106. data/lib/enju_library/url_validator.rb +10 -0
  107. data/lib/enju_library/version.rb +3 -0
  108. data/lib/enju_library.rb +49 -0
  109. data/lib/tasks/enju_library_tasks.rake +4 -0
  110. data/test/dummy/README.rdoc +261 -0
  111. data/test/dummy/Rakefile +7 -0
  112. data/test/dummy/app/assets/javascripts/application.js +15 -0
  113. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  114. data/test/dummy/app/controllers/application_controller.rb +3 -0
  115. data/test/dummy/app/helpers/application_helper.rb +2 -0
  116. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  117. data/test/dummy/config/application.rb +56 -0
  118. data/test/dummy/config/boot.rb +10 -0
  119. data/test/dummy/config/database.yml +25 -0
  120. data/test/dummy/config/environment.rb +5 -0
  121. data/test/dummy/config/environments/development.rb +37 -0
  122. data/test/dummy/config/environments/production.rb +67 -0
  123. data/test/dummy/config/environments/test.rb +37 -0
  124. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  125. data/test/dummy/config/initializers/inflections.rb +15 -0
  126. data/test/dummy/config/initializers/mime_types.rb +5 -0
  127. data/test/dummy/config/initializers/secret_token.rb +7 -0
  128. data/test/dummy/config/initializers/session_store.rb +8 -0
  129. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  130. data/test/dummy/config/locales/en.yml +5 -0
  131. data/test/dummy/config/routes.rb +58 -0
  132. data/test/dummy/config.ru +4 -0
  133. data/test/dummy/db/development.sqlite3 +0 -0
  134. data/test/dummy/db/test.sqlite3 +0 -0
  135. data/test/dummy/log/development.log +0 -0
  136. data/test/dummy/log/test.log +0 -0
  137. data/test/dummy/public/404.html +26 -0
  138. data/test/dummy/public/422.html +26 -0
  139. data/test/dummy/public/500.html +25 -0
  140. data/test/dummy/public/favicon.ico +0 -0
  141. data/test/dummy/script/rails +6 -0
  142. data/test/enju_library_test.rb +7 -0
  143. data/test/integration/navigation_test.rb +10 -0
  144. data/test/test_helper.rb +15 -0
  145. metadata +576 -0
@@ -0,0 +1,19 @@
1
+ class BudgetType < ActiveRecord::Base
2
+ attr_accessible :name, :display_name, :note
3
+ include MasterModel
4
+ default_scope :order => 'budget_types.position'
5
+ has_many :items
6
+ end
7
+ # == Schema Information
8
+ #
9
+ # Table name: budget_types
10
+ #
11
+ # id :integer not null, primary key
12
+ # name :string(255)
13
+ # display_name :text
14
+ # note :text
15
+ # position :integer
16
+ # created_at :datetime not null
17
+ # updated_at :datetime not null
18
+ #
19
+
@@ -0,0 +1,131 @@
1
+ # -*- encoding: utf-8 -*-
2
+ class Library < ActiveRecord::Base
3
+ attr_accessible :name, :display_name, :short_display_name, :zip_code, :street,
4
+ :locality, :region, :telephone_number_1, :telephone_number_2, :fax_number,
5
+ :note, :call_number_rows, :call_number_delimiter, :library_group_id,
6
+ :country_id, :opening_hour, :isil
7
+
8
+ include MasterModel
9
+ default_scope :order => 'libraries.position'
10
+ scope :real, where('id != 1')
11
+ has_many :shelves, :order => 'shelves.position'
12
+ belongs_to :library_group, :validate => true
13
+ has_many :users
14
+ belongs_to :country
15
+
16
+ extend FriendlyId
17
+ friendly_id :name
18
+ geocoded_by :address
19
+
20
+ searchable do
21
+ text :name, :display_name, :note, :address
22
+ time :created_at
23
+ time :updated_at
24
+ integer :position
25
+ end
26
+
27
+ validates_associated :library_group
28
+ validates_presence_of :short_display_name, :library_group
29
+ validates_uniqueness_of :short_display_name, :case_sensitive => false
30
+ validates_uniqueness_of :isil, :allow_blank => true
31
+ validates :display_name, :uniqueness => true
32
+ validates :name, :format => {:with => /^[a-z][0-9a-z]{2,254}$/}
33
+ validates :isil, :format => {:with => /^[A-Za-z]{1,4}-[A-Za-z0-9\/:\-]{2,11}$/}, :allow_blank => true
34
+ #before_save :set_calil_neighborhood_library
35
+ after_validation :geocode, :if => :address_changed?
36
+ after_create :create_shelf
37
+ after_save :clear_all_cache
38
+ after_destroy :clear_all_cache
39
+
40
+ def self.per_page
41
+ 10
42
+ end
43
+
44
+ def self.all_cache
45
+ if Rails.env == 'production'
46
+ Rails.cache.fetch('library_all'){Library.all}
47
+ else
48
+ Library.all
49
+ end
50
+ end
51
+
52
+ def clear_all_cache
53
+ Rails.cache.delete('library_all')
54
+ end
55
+
56
+ def create_shelf
57
+ shelf = Shelf.new
58
+ shelf.name = "#{self.name}_default"
59
+ shelf.library = self
60
+ shelf.save!
61
+ end
62
+
63
+ def web?
64
+ return true if self.id == 1
65
+ false
66
+ end
67
+
68
+ def self.web
69
+ Library.find(1)
70
+ end
71
+
72
+ def address(locale = I18n.locale)
73
+ case locale.to_sym
74
+ when :ja
75
+ "#{self.region.to_s.localize(locale)}#{self.locality.to_s.localize(locale)}#{self.street.to_s.localize(locale)}"
76
+ else
77
+ "#{self.street.to_s.localize(locale)} #{self.locality.to_s.localize(locale)} #{self.region.to_s.localize(locale)}"
78
+ end
79
+ rescue
80
+ nil
81
+ end
82
+
83
+ def address_changed?
84
+ return true if region_changed? or locality_changed? or street_changed?
85
+ false
86
+ end
87
+
88
+ if defined?(EnjuEvent)
89
+ has_many :events, :include => :event_category
90
+
91
+ def closed?(date)
92
+ events.closing_days.collect{|c| c.start_at.beginning_of_day}.include?(date.beginning_of_day)
93
+ end
94
+ end
95
+
96
+ if defined?(EnjuInterLibraryLoan)
97
+ has_many :inter_library_loans, :foreign_key => 'borrowing_library_id'
98
+ end
99
+ end
100
+
101
+ # == Schema Information
102
+ #
103
+ # Table name: libraries
104
+ #
105
+ # id :integer not null, primary key
106
+ # name :string(255) not null
107
+ # display_name :text
108
+ # short_display_name :string(255) not null
109
+ # zip_code :string(255)
110
+ # street :text
111
+ # locality :text
112
+ # region :text
113
+ # telephone_number_1 :string(255)
114
+ # telephone_number_2 :string(255)
115
+ # fax_number :string(255)
116
+ # note :text
117
+ # call_number_rows :integer default(1), not null
118
+ # call_number_delimiter :string(255) default("|"), not null
119
+ # library_group_id :integer default(1), not null
120
+ # users_count :integer default(0), not null
121
+ # position :integer
122
+ # country_id :integer
123
+ # created_at :datetime not null
124
+ # updated_at :datetime not null
125
+ # deleted_at :datetime
126
+ # opening_hour :text
127
+ # latitude :float
128
+ # longitude :float
129
+ # isil :string(255)
130
+ #
131
+
@@ -0,0 +1,86 @@
1
+ # -*- encoding: utf-8 -*-
2
+ class LibraryGroup < ActiveRecord::Base
3
+ attr_accessible :name, :display_name, :short_name, :email, :my_networks,
4
+ :login_banner, :note, :country_id, :admin_networks, :url
5
+
6
+ #include Singleton
7
+ #include Configurator
8
+ include MasterModel
9
+
10
+ has_many :libraries
11
+ belongs_to :country
12
+
13
+ validates :email, :format => {:with => /\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i}, :presence => true
14
+ validates :url, :presence => true, :url => true
15
+ after_save :clear_site_config_cache
16
+
17
+ def clear_site_config_cache
18
+ Rails.cache.delete('library_site_config')
19
+ end
20
+
21
+ def self.site_config
22
+ #if Rails.env == 'production'
23
+ # Rails.cache.fetch('library_site_config'){LibraryGroup.find(1)}
24
+ #else
25
+ LibraryGroup.find(1)
26
+ #end
27
+ rescue ActiveRecord::RecordNotFound
28
+ nil
29
+ end
30
+
31
+ def self.system_name(locale = I18n.locale)
32
+ LibraryGroup.site_config.display_name.localize(locale)
33
+ end
34
+
35
+ def config?
36
+ true if self == LibraryGroup.site_config
37
+ end
38
+
39
+ def real_libraries
40
+ # 物理的な図書館 = IDが1以外
41
+ libraries.where('id != 1').all
42
+ end
43
+
44
+ def network_access_allowed?(ip_address, options = {})
45
+ options = {:network_type => :lan}.merge(options)
46
+ client_ip = IPAddr.new(ip_address)
47
+ case options[:network_type]
48
+ when :admin
49
+ allowed_networks = self.admin_networks.to_s.split
50
+ else
51
+ allowed_networks = self.my_networks.to_s.split
52
+ end
53
+ allowed_networks.each do |allowed_network|
54
+ begin
55
+ network = IPAddr.new(allowed_network)
56
+ return true if network.include?(client_ip)
57
+ rescue ArgumentError
58
+ nil
59
+ end
60
+ end
61
+ return false
62
+ end
63
+ end
64
+
65
+
66
+ # == Schema Information
67
+ #
68
+ # Table name: library_groups
69
+ #
70
+ # id :integer not null, primary key
71
+ # name :string(255) not null
72
+ # display_name :text
73
+ # short_name :string(255) not null
74
+ # email :string(255)
75
+ # my_networks :text
76
+ # login_banner :text
77
+ # note :text
78
+ # country_id :integer
79
+ # created_at :datetime not null
80
+ # updated_at :datetime not null
81
+ # admin_networks :text
82
+ # allow_bookmark_external_url :boolean default(FALSE), not null
83
+ # position :integer
84
+ # url :string(255) default("http://localhost:3000/")
85
+ #
86
+
@@ -0,0 +1,12 @@
1
+ class LibraryGroupSweeper < ActionController::Caching::Sweeper
2
+ observe LibraryGroup
3
+ def after_save(record)
4
+ I18n.available_locales.each do |locale|
5
+ expire_fragment(:controller => 'page', :action => 'advanced_search', :locale => locale)
6
+ end
7
+ end
8
+
9
+ def after_destroy(record)
10
+ after_save(record)
11
+ end
12
+ end
@@ -0,0 +1,20 @@
1
+ class RequestStatusType < ActiveRecord::Base
2
+ attr_accessible :name, :display_name, :note
3
+ include MasterModel
4
+ default_scope :order => 'position'
5
+ has_many :reserves
6
+ end
7
+
8
+ # == Schema Information
9
+ #
10
+ # Table name: request_status_types
11
+ #
12
+ # id :integer not null, primary key
13
+ # name :string(255) not null
14
+ # display_name :text
15
+ # note :text
16
+ # position :integer
17
+ # created_at :datetime
18
+ # updated_at :datetime
19
+ #
20
+
@@ -0,0 +1,19 @@
1
+ class RequestType < ActiveRecord::Base
2
+ attr_accessible :name, :display_name, :note
3
+ include MasterModel
4
+ default_scope :order => 'position'
5
+ end
6
+
7
+ # == Schema Information
8
+ #
9
+ # Table name: request_types
10
+ #
11
+ # id :integer not null, primary key
12
+ # name :string(255) not null
13
+ # display_name :text
14
+ # note :text
15
+ # position :integer
16
+ # created_at :datetime
17
+ # updated_at :datetime
18
+ #
19
+
@@ -0,0 +1,52 @@
1
+ class SearchEngine < ActiveRecord::Base
2
+ attr_accessible :name, :display_name, :url, :base_url, :http_method,
3
+ :query_param, :additional_param, :note
4
+ default_scope :order => "search_engines.position"
5
+ acts_as_list
6
+
7
+ validates :name, :presence => true
8
+ validates :query_param, :presence => true
9
+ validates :http_method, :presence => true, :inclusion => %w(get post)
10
+ validates :url, :presence => true, :url => true, :length => {:maximum => 255}
11
+ validates :base_url, :presence => true, :url => true, :length => {:maximum => 255}
12
+ after_save :clear_all_cache
13
+ after_destroy :clear_all_cache
14
+
15
+ def self.per_page
16
+ 10
17
+ end
18
+
19
+ def clear_all_cache
20
+ Rails.cache.delete('search_engine_all')
21
+ end
22
+
23
+ def search_params(query)
24
+ params = {}
25
+ if self.additional_param
26
+ self.additional_param.gsub('{query}', query).to_s.split.each do |param|
27
+ p = param.split("=")
28
+ params[p[0].to_sym] = p[1]
29
+ end
30
+ return params
31
+ end
32
+ end
33
+ end
34
+
35
+ # == Schema Information
36
+ #
37
+ # Table name: search_engines
38
+ #
39
+ # id :integer not null, primary key
40
+ # name :string(255) not null
41
+ # display_name :text
42
+ # url :string(255) not null
43
+ # base_url :text not null
44
+ # http_method :text not null
45
+ # query_param :text not null
46
+ # additional_param :text
47
+ # note :text
48
+ # position :integer
49
+ # created_at :datetime
50
+ # updated_at :datetime
51
+ #
52
+
@@ -0,0 +1,66 @@
1
+ class Shelf < ActiveRecord::Base
2
+ attr_accessible :name, :display_name, :note, :library_id, :closed
3
+ include MasterModel
4
+ scope :real, where('library_id != 1')
5
+ belongs_to :library, :validate => true
6
+ has_many :items, :include => [:circulation_status]
7
+ has_many :picture_files, :as => :picture_attachable, :dependent => :destroy
8
+
9
+ validates_associated :library
10
+ validates_presence_of :library
11
+ validates_uniqueness_of :display_name, :scope => :library_id
12
+
13
+ acts_as_list :scope => :library
14
+
15
+ searchable do
16
+ string :name
17
+ string :library do
18
+ library.name
19
+ end
20
+ text :name do
21
+ [name, library.name, display_name, library.display_name]
22
+ end
23
+ integer :position
24
+ end
25
+
26
+ def self.per_page
27
+ 10
28
+ end
29
+
30
+ def web_shelf?
31
+ return true if self.id == 1
32
+ false
33
+ end
34
+
35
+ def self.web
36
+ Shelf.find(1)
37
+ end
38
+
39
+ def first?
40
+ # 必ずposition順に並んでいる
41
+ return true if library.shelves.first.position == position
42
+ false
43
+ end
44
+
45
+ def localized_display_name
46
+ display_name.localize
47
+ end
48
+ end
49
+
50
+ # == Schema Information
51
+ #
52
+ # Table name: shelves
53
+ #
54
+ # id :integer not null, primary key
55
+ # name :string(255) not null
56
+ # display_name :text
57
+ # note :text
58
+ # library_id :integer default(1), not null
59
+ # items_count :integer default(0), not null
60
+ # position :integer
61
+ # created_at :datetime not null
62
+ # updated_at :datetime not null
63
+ # deleted_at :datetime
64
+ # closed :boolean default(FALSE), not null
65
+ #
66
+
@@ -0,0 +1,23 @@
1
+ class Subscribe < ActiveRecord::Base
2
+ attr_accessible :subscription_id, :work_id, :start_at, :end_at
3
+ belongs_to :subscription, :counter_cache => true, :validate => true
4
+ belongs_to :work, :class_name => 'Manifestation', :validate => true
5
+
6
+ validates_associated :subscription, :work
7
+ validates_presence_of :subscription, :work, :start_at, :end_at
8
+ validates_uniqueness_of :work_id, :scope => :subscription_id
9
+ end
10
+
11
+ # == Schema Information
12
+ #
13
+ # Table name: subscribes
14
+ #
15
+ # id :integer not null, primary key
16
+ # subscription_id :integer not null
17
+ # work_id :integer not null
18
+ # start_at :datetime not null
19
+ # end_at :datetime not null
20
+ # created_at :datetime
21
+ # updated_at :datetime
22
+ #
23
+
@@ -0,0 +1,44 @@
1
+ class Subscription < ActiveRecord::Base
2
+ attr_accessible :title, :note, :order_list_id, :user_id
3
+ has_many :subscribes, :dependent => :destroy
4
+ has_many :works, :through => :subscribes
5
+ belongs_to :user, :validate => true
6
+ if defined?(EnjuPurchasRequest)
7
+ belongs_to :order_list, :validate => true
8
+ end
9
+
10
+ validates_presence_of :title, :user
11
+ validates_associated :user
12
+
13
+ searchable do
14
+ text :title, :note
15
+ time :created_at
16
+ time :updated_at
17
+ integer :work_ids, :multiple => true
18
+ end
19
+
20
+ def self.per_page
21
+ 10
22
+ end
23
+
24
+ def subscribed(work)
25
+ subscribes.where(:work_id => work.id).first
26
+ end
27
+
28
+ end
29
+
30
+ # == Schema Information
31
+ #
32
+ # Table name: subscriptions
33
+ #
34
+ # id :integer not null, primary key
35
+ # title :text not null
36
+ # note :text
37
+ # user_id :integer
38
+ # order_list_id :integer
39
+ # deleted_at :datetime
40
+ # subscribes_count :integer default(0), not null
41
+ # created_at :datetime
42
+ # updated_at :datetime
43
+ #
44
+
@@ -0,0 +1,11 @@
1
+ <%= simple_form_for(@accept) do |f| %>
2
+ <%= f.error_notification %>
3
+
4
+ <div class="form-inputs">
5
+ <%= f.input :item_id %>
6
+ </div>
7
+
8
+ <div class="form-actions">
9
+ <%= f.button :submit %>
10
+ </div>
11
+ <% end %>
@@ -0,0 +1,31 @@
1
+ <div style="color: red"><%= flash[:message] -%></div>
2
+
3
+ <div class="search_form">
4
+ <%= form_for(@accept, :url => basket_accepts_path(@basket), :remote => true) do |f| %>
5
+ <%= f.error_messages %>
6
+ <p>
7
+ <%= t('activerecord.attributes.item.item_identifier') -%>:
8
+ <%= f.search_field :item_identifier, :class => 'resource_item_identifier', :value => nil -%>
9
+ <%= f.submit t('accept.accept'), 'data-disable-with' => t('page.saving') -%>
10
+ </p>
11
+ <%- end -%>
12
+ </div>
13
+
14
+ <table class="index">
15
+ <tr>
16
+ <th><%= t('activerecord.models.item') -%></th>
17
+ </tr>
18
+ <%- @accepts.each_with_index do |accept, i| -%>
19
+ <tr class="line<%= cycle("0", "1") -%>">
20
+ <td>
21
+ <%= render 'manifestations/show_index', :manifestation => accept.item.manifestation %>
22
+ <%= link_to accept.item.item_identifier, accept.item -%> / <%= accept.item.call_number %>
23
+ (<%= link_to accept.item.shelf.library.display_name.localize, accept.item.shelf.library %> /
24
+ <%= link_to accept.item.shelf.display_name.localize, accept.item.shelf %>)<br />
25
+ <%=l accept.created_at %>
26
+ </td>
27
+ </tr>
28
+ <%- end -%>
29
+ </table>
30
+
31
+ <%= javascript_tag("$('#accept_item_identifier').focus()") -%>
@@ -0,0 +1,13 @@
1
+ <div id="content_detail" class="ui-corner-all">
2
+ <h1 class="title"><%= t('page.editing', :model => t('activerecord.models.accept')) -%></h1>
3
+ <div id="content_list">
4
+ <%= render 'form' %>
5
+ </div>
6
+ </div>
7
+
8
+ <div id="submenu" class="ui-corner-all">
9
+ <ul>
10
+ <li><%= link_to t('page.show'), @accept -%></li>
11
+ <li><%= link_to t('page.back'), accepts_path -%></li>
12
+ </ul>
13
+ </div>
@@ -0,0 +1,4 @@
1
+ item_identifier basket_id accepted_at
2
+ <% @accepts.each do |accept| %>
3
+ <%= accept.item.item_identifier %> <%= accept.basket_id %> <%= accept.created_at %>
4
+ <% end %>
@@ -0,0 +1,49 @@
1
+ <div id="content_detail" class="ui-corner-all">
2
+ <h1 class="title"><%= t('page.listing', :model => t('activerecord.models.accept')) -%></h1>
3
+ <div id="content_list">
4
+
5
+ <div class="search_form">
6
+ <%= form_for(:accept, :html => {:method => :get}) do |f| %>
7
+ <p>
8
+ <%= t('activerecord.attributes.item.item_identifier') -%>:
9
+ <%= f.search_field :item_identifier, :value => @query, :class => 'resource_item_identifier' -%>
10
+ <%= f.submit t('page.search') -%>
11
+ </p>
12
+ <%- end -%>
13
+ </div>
14
+
15
+ <table class="index">
16
+ <tr>
17
+ <th><%= t('activerecord.models.item') -%></th>
18
+ <th></th>
19
+ </tr>
20
+ <%- @accepts.each_with_index do |accept, i| -%>
21
+ <tr class="line<%= cycle("0", "1") -%>">
22
+ <td>
23
+ <% if accept.item %>
24
+ <%= render 'manifestations/show_index', :manifestation => accept.item.manifestation %>
25
+ <%= link_to accept.item.item_identifier, accept.item -%> / <%= accept.item.call_number %>
26
+ (<%= link_to accept.item.shelf.library.display_name.localize, accept.item.shelf.library %> /
27
+ <%= link_to accept.item.shelf.display_name.localize, accept.item.shelf %>)<br />
28
+ <%=l accept.created_at %>
29
+ <% end %>
30
+ </td>
31
+ <td>
32
+ <%- if can? :destroy, accept -%>
33
+ <%= link_to t('page.destroy'), accept, :confirm => t('page.are_you_sure'), :method => :delete -%>
34
+ <%- end -%>
35
+ </td>
36
+ </tr>
37
+ <%- end -%>
38
+ </table>
39
+ <%= javascript_tag("$('#accept_item_identifier').focus()") -%>
40
+
41
+ <%= will_paginate(@accepts) %>
42
+ </div>
43
+ </div>
44
+
45
+ <div id="submenu" class="ui-corner-all">
46
+ <ul>
47
+ <li><%= link_to t('page.new', :model => t('activerecord.models.accept')), new_accept_path -%></li>
48
+ </ul>
49
+ </div>
@@ -0,0 +1 @@
1
+ $("#accept_list").html("<%= escape_javascript(render('accepts/list')) %>");
@@ -0,0 +1,14 @@
1
+ <div id="content_detail" class="ui-corner-all">
2
+ <h1 class="title"><%= t('page.new', :model => t('activerecord.models.accept')) -%></h1>
3
+ <div id="content_list">
4
+ <div id="accept_list">
5
+ <%= render 'list' -%>
6
+ </div>
7
+ </div>
8
+ </div>
9
+
10
+ <div id="submenu" class="ui-corner-all">
11
+ <ul>
12
+ <li><%= link_to t('page.back'), accepts_path -%></li>
13
+ </ul>
14
+ </div>
@@ -0,0 +1,31 @@
1
+ <div id="content_detail" class="ui-corner-all">
2
+ <h1 class="title"><%= t('page.showing', :model => t('activerecord.models.accept')) -%></h1>
3
+ <div id="content_list">
4
+ <p id="notice"><%= notice %></p>
5
+
6
+ <p>
7
+ <strong><%= t('activerecord.models.item') -%>:</strong>
8
+ <% if @accept.item %>
9
+ <%= link_to @accept.item.item_identifier, @accept.item -%>
10
+ (<%= link_to @accept.item.manifestation.original_title, @accept.item.manifestation %>)
11
+ <% end %>
12
+ </p>
13
+
14
+ <p>
15
+ <strong><%= t('activerecord.models.user') -%>:</strong>
16
+ <%= link_to @accept.librarian.username, @accept.librarian if @accept.librarian -%>
17
+ </p>
18
+
19
+ <p>
20
+ <strong><%= t('page.created_at') -%>:</strong>
21
+ <%=l @accept.created_at %>
22
+ </p>
23
+
24
+ </div>
25
+ </div>
26
+
27
+ <div id="submenu" class="ui-corner-all">
28
+ <ul>
29
+ <li><%= back_to_index(flash[:page_info]) -%></li>
30
+ </ul>
31
+ </div>
@@ -0,0 +1,42 @@
1
+ <%= form_for(@bookstore) do |f| -%>
2
+ <%= f.error_messages -%>
3
+
4
+ <div class="field">
5
+ <%= f.label :name -%><br />
6
+ <%= f.text_field :name -%>
7
+ </div>
8
+
9
+ <div class="field">
10
+ <%= f.label :zip_code -%><br />
11
+ <%= f.text_field :zip_code -%>
12
+ </div>
13
+
14
+ <div class="field">
15
+ <%= f.label :address -%><br />
16
+ <%= f.text_area :address, :class => 'resource_textarea' -%>
17
+ </div>
18
+
19
+ <div class="field">
20
+ <%= f.label :telephone_number -%><br />
21
+ <%= f.phone_field :telephone_number -%>
22
+ </div>
23
+
24
+ <div class="field">
25
+ <%= f.label :fax_number -%><br />
26
+ <%= f.phone_field :fax_number -%>
27
+ </div>
28
+
29
+ <div class="field">
30
+ <%= f.label :url -%><br />
31
+ <%= f.url_field :url, :class => 'resource_url' -%>
32
+ </div>
33
+
34
+ <div class="field">
35
+ <%= f.label :note -%><br />
36
+ <%= f.text_area :note, :class => 'resource_textarea' -%>
37
+ </div>
38
+
39
+ <div class="actions">
40
+ <%= f.submit %>
41
+ </div>
42
+ <%- end -%>