enju_message 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/config/locales/translation_en.yml +51 -0
- data/config/locales/translation_ja.yml +51 -0
- data/lib/enju_message/version.rb +1 -1
- data/spec/controllers/message_requests_controller_spec.rb +275 -0
- data/spec/controllers/message_templates_controller_spec.rb +443 -0
- data/spec/controllers/messages_controller_spec.rb +439 -0
- data/{test → spec}/dummy/Rakefile +0 -0
- data/{test → spec}/dummy/app/assets/javascripts/application.js +0 -0
- data/{test → spec}/dummy/app/assets/stylesheets/application.css +0 -0
- data/spec/dummy/app/controllers/application_controller.rb +45 -0
- data/{test → spec}/dummy/app/helpers/application_helper.rb +0 -0
- data/spec/dummy/app/mailers/notifier.rb +28 -0
- data/spec/dummy/app/models/ability.rb +30 -0
- data/spec/dummy/app/models/library_group.rb +86 -0
- data/spec/dummy/app/models/patron.rb +167 -0
- data/spec/dummy/app/models/patron_type.rb +19 -0
- data/spec/dummy/app/models/role.rb +8 -0
- data/spec/dummy/app/models/user.rb +53 -0
- data/spec/dummy/app/models/user_group.rb +2 -0
- data/spec/dummy/app/models/user_has_role.rb +4 -0
- data/{test → spec}/dummy/app/views/layouts/application.html.erb +0 -0
- data/spec/dummy/app/views/page/403.html.erb +9 -0
- data/spec/dummy/app/views/page/403.mobile.erb +5 -0
- data/spec/dummy/app/views/page/403.xml.erb +4 -0
- data/spec/dummy/app/views/page/404.html.erb +9 -0
- data/spec/dummy/app/views/page/404.mobile.erb +5 -0
- data/spec/dummy/app/views/page/404.xml.erb +4 -0
- data/{test → spec}/dummy/config/application.rb +1 -0
- data/{test → spec}/dummy/config/boot.rb +0 -0
- data/{test → spec}/dummy/config/database.yml +0 -0
- data/{test → spec}/dummy/config/environment.rb +0 -0
- data/{test → spec}/dummy/config/environments/development.rb +0 -0
- data/{test → spec}/dummy/config/environments/production.rb +0 -0
- data/{test → spec}/dummy/config/environments/test.rb +0 -0
- data/{test → spec}/dummy/config/initializers/backtrace_silencers.rb +0 -0
- data/spec/dummy/config/initializers/devise.rb +209 -0
- data/{test → spec}/dummy/config/initializers/inflections.rb +0 -0
- data/{test → spec}/dummy/config/initializers/mime_types.rb +1 -0
- data/{test → spec}/dummy/config/initializers/secret_token.rb +0 -0
- data/{test → spec}/dummy/config/initializers/session_store.rb +0 -0
- data/{test → spec}/dummy/config/initializers/wrap_parameters.rb +0 -0
- data/{test → spec}/dummy/config/locales/en.yml +0 -0
- data/{test → spec}/dummy/config/routes.rb +2 -0
- data/{test → spec}/dummy/config.ru +0 -0
- data/{test/dummy/public/favicon.ico → spec/dummy/db/development.sqlite3} +0 -0
- data/spec/dummy/db/migrate/001_create_patrons.rb +62 -0
- data/spec/dummy/db/migrate/080_create_library_groups.rb +25 -0
- data/spec/dummy/db/migrate/20080905191442_create_patron_types.rb +16 -0
- data/spec/dummy/db/migrate/20100211105551_add_admin_networks_to_library_group.rb +9 -0
- data/spec/dummy/db/migrate/20100222124420_add_allow_bookmark_external_url_to_library_group.rb +9 -0
- data/spec/dummy/db/migrate/20100527113752_create_delayed_jobs.rb +21 -0
- data/spec/dummy/db/migrate/20110115022329_add_position_to_library_group.rb +9 -0
- data/spec/dummy/db/migrate/20110222073537_add_url_to_library_group.rb +9 -0
- data/spec/dummy/db/migrate/20111020063828_remove_dsbl_from_library_group.rb +11 -0
- data/spec/dummy/db/migrate/20111201121636_create_languages.rb +16 -0
- data/spec/dummy/db/migrate/20111201121844_create_roles.rb +12 -0
- data/spec/dummy/db/migrate/20111201155456_create_users.rb +14 -0
- data/spec/dummy/db/migrate/20111201155513_add_devise_to_users.rb +31 -0
- data/spec/dummy/db/migrate/20111201163342_create_user_groups.rb +12 -0
- data/spec/dummy/db/migrate/20111201163718_create_user_has_roles.rb +10 -0
- data/spec/dummy/db/schema.rb +225 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/lib/enju_leaf/localized_name.rb +13 -0
- data/spec/dummy/lib/enju_leaf/master_model.rb +41 -0
- data/spec/dummy/lib/enju_leaf/url_validator.rb +10 -0
- data/spec/dummy/lib/enju_leaf.rb +4 -0
- data/spec/dummy/log/development.log +106 -0
- data/spec/dummy/log/sunspot-solr-test.log +232 -0
- data/spec/dummy/log/test.log +145040 -0
- data/{test → spec}/dummy/public/404.html +0 -0
- data/{test → spec}/dummy/public/422.html +0 -0
- data/{test → spec}/dummy/public/500.html +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/{test → spec}/dummy/script/rails +0 -0
- data/spec/dummy/solr/conf/admin-extra.html +31 -0
- data/spec/dummy/solr/conf/elevate.xml +36 -0
- data/spec/dummy/solr/conf/mapping-ISOLatin1Accent.txt +246 -0
- data/spec/dummy/solr/conf/protwords.txt +21 -0
- data/spec/dummy/solr/conf/schema.xml +238 -0
- data/spec/dummy/solr/conf/scripts.conf +24 -0
- data/spec/dummy/solr/conf/solrconfig.xml +934 -0
- data/spec/dummy/solr/conf/spellings.txt +2 -0
- data/spec/dummy/solr/conf/stopwords.txt +58 -0
- data/spec/dummy/solr/conf/synonyms.txt +31 -0
- data/spec/dummy/solr/data/test/index/segments.gen +0 -0
- data/spec/dummy/solr/data/test/index/segments_1 +0 -0
- data/spec/dummy/solr/data/test/spellchecker/segments.gen +0 -0
- data/spec/dummy/solr/data/test/spellchecker/segments_1 +0 -0
- data/spec/factories/message.rb +8 -0
- data/spec/factories/message_request.rb +7 -0
- data/spec/factories/message_template.rb +7 -0
- data/spec/factories/user.rb +34 -0
- data/spec/fixtures/library_groups.yml +34 -0
- data/spec/fixtures/message_requests.yml +30 -0
- data/spec/fixtures/message_templates.yml +65 -0
- data/spec/fixtures/messages.yml +62 -0
- data/spec/fixtures/patrons.yml +338 -0
- data/spec/fixtures/roles.yml +21 -0
- data/spec/fixtures/user_groups.yml +25 -0
- data/spec/fixtures/user_has_roles.yml +41 -0
- data/spec/fixtures/users.yml +69 -0
- data/spec/models/message_request_spec.rb +24 -0
- data/spec/models/message_spec.rb +59 -0
- data/spec/models/message_template_spec.rb +24 -0
- data/spec/spec_helper.rb +46 -0
- data/spec/support/controller_macros.rb +48 -0
- data/spec/support/devise.rb +4 -0
- metadata +273 -220
- data/app/views/baskets/edit.html.erb +0 -30
- data/app/views/baskets/index.html.erb +0 -31
- data/app/views/baskets/new.html.erb +0 -29
- data/app/views/baskets/show.html.erb +0 -23
- data/app/views/carrier_type_has_checkout_types/_form.html.erb +0 -19
- data/app/views/carrier_type_has_checkout_types/edit.html.erb +0 -13
- data/app/views/carrier_type_has_checkout_types/index.html.erb +0 -33
- data/app/views/carrier_type_has_checkout_types/new.html.erb +0 -12
- data/app/views/carrier_type_has_checkout_types/show.html.erb +0 -29
- data/app/views/checked_items/_checkouts.html.erb +0 -20
- data/app/views/checked_items/_list.html.erb +0 -39
- data/app/views/checked_items/edit.html.erb +0 -21
- data/app/views/checked_items/index.html.erb +0 -32
- data/app/views/checked_items/index.js.erb +0 -1
- data/app/views/checked_items/new.html.erb +0 -20
- data/app/views/checked_items/show.html.erb +0 -24
- data/app/views/checkins/_form.html.erb +0 -24
- data/app/views/checkins/_list.html.erb +0 -51
- data/app/views/checkins/edit.html.erb +0 -26
- data/app/views/checkins/index.html.erb +0 -16
- data/app/views/checkins/index.js.erb +0 -1
- data/app/views/checkins/new.html.erb +0 -14
- data/app/views/checkins/show.html.erb +0 -24
- data/app/views/checkout_stat_has_manifestations/_form.html.erb +0 -15
- data/app/views/checkout_stat_has_manifestations/edit.html.erb +0 -13
- data/app/views/checkout_stat_has_manifestations/index.html.erb +0 -33
- data/app/views/checkout_stat_has_manifestations/new.html.erb +0 -12
- data/app/views/checkout_stat_has_manifestations/show.html.erb +0 -28
- data/app/views/checkout_stat_has_users/_form.html.erb +0 -15
- data/app/views/checkout_stat_has_users/edit.html.erb +0 -13
- data/app/views/checkout_stat_has_users/index.html.erb +0 -33
- data/app/views/checkout_stat_has_users/new.html.erb +0 -12
- data/app/views/checkout_stat_has_users/show.html.erb +0 -28
- data/app/views/checkout_types/_form.html.erb +0 -19
- data/app/views/checkout_types/edit.html.erb +0 -13
- data/app/views/checkout_types/index.html.erb +0 -50
- data/app/views/checkout_types/new.html.erb +0 -12
- data/app/views/checkout_types/show.html.erb +0 -38
- data/app/views/checkouts/_form.html.erb +0 -28
- data/app/views/checkouts/_index.html.erb +0 -23
- data/app/views/checkouts/_index_overdue.html.erb +0 -33
- data/app/views/checkouts/_index_user.html.erb +0 -44
- data/app/views/checkouts/_list.html.erb +0 -45
- data/app/views/checkouts/edit.html.erb +0 -51
- data/app/views/checkouts/index.atom.builder +0 -14
- data/app/views/checkouts/index.csv.erb +0 -4
- data/app/views/checkouts/index.html.erb +0 -11
- data/app/views/checkouts/index.ics.erb +0 -13
- data/app/views/checkouts/index.rss.builder +0 -38
- data/app/views/checkouts/new.html.erb +0 -20
- data/app/views/checkouts/show.html.erb +0 -35
- data/app/views/circulation_statuses/_form.html.erb +0 -19
- data/app/views/circulation_statuses/edit.html.erb +0 -13
- data/app/views/circulation_statuses/index.html.erb +0 -43
- data/app/views/circulation_statuses/new.html.erb +0 -12
- data/app/views/circulation_statuses/show.html.erb +0 -29
- data/app/views/item_has_use_restrictions/edit.html.erb +0 -27
- data/app/views/item_has_use_restrictions/index.html.erb +0 -32
- data/app/views/item_has_use_restrictions/new.html.erb +0 -25
- data/app/views/item_has_use_restrictions/show.html.erb +0 -29
- data/app/views/lending_policies/_form.html.erb +0 -41
- data/app/views/lending_policies/edit.html.erb +0 -13
- data/app/views/lending_policies/index.html.erb +0 -42
- data/app/views/lending_policies/new.html.erb +0 -12
- data/app/views/lending_policies/show.html.erb +0 -50
- data/app/views/manifestation_checkout_stats/_form.html.erb +0 -19
- data/app/views/manifestation_checkout_stats/edit.html.erb +0 -13
- data/app/views/manifestation_checkout_stats/index.html.erb +0 -35
- data/app/views/manifestation_checkout_stats/new.html.erb +0 -12
- data/app/views/manifestation_checkout_stats/show.csv.erb +0 -4
- data/app/views/manifestation_checkout_stats/show.html.erb +0 -55
- data/app/views/manifestation_reserve_stats/_form.html.erb +0 -19
- data/app/views/manifestation_reserve_stats/edit.html.erb +0 -13
- data/app/views/manifestation_reserve_stats/index.html.erb +0 -35
- data/app/views/manifestation_reserve_stats/new.html.erb +0 -12
- data/app/views/manifestation_reserve_stats/show.csv.erb +0 -4
- data/app/views/manifestation_reserve_stats/show.html.erb +0 -55
- data/app/views/reserve_stat_has_manifestations/_form.html.erb +0 -15
- data/app/views/reserve_stat_has_manifestations/edit.html.erb +0 -13
- data/app/views/reserve_stat_has_manifestations/index.html.erb +0 -33
- data/app/views/reserve_stat_has_manifestations/new.html.erb +0 -12
- data/app/views/reserve_stat_has_manifestations/show.html.erb +0 -28
- data/app/views/reserve_stat_has_users/_form.html.erb +0 -15
- data/app/views/reserve_stat_has_users/edit.html.erb +0 -13
- data/app/views/reserve_stat_has_users/index.html.erb +0 -33
- data/app/views/reserve_stat_has_users/new.html.erb +0 -12
- data/app/views/reserve_stat_has_users/show.html.erb +0 -28
- data/app/views/reserves/_form.html.erb +0 -49
- data/app/views/reserves/_new.html.erb +0 -44
- data/app/views/reserves/_new_user.html.erb +0 -50
- data/app/views/reserves/_title.html.erb +0 -19
- data/app/views/reserves/edit.html.erb +0 -42
- data/app/views/reserves/index.atom.builder +0 -14
- data/app/views/reserves/index.csv.erb +0 -4
- data/app/views/reserves/index.html.erb +0 -75
- data/app/views/reserves/index.rss.builder +0 -41
- data/app/views/reserves/new.html.erb +0 -5
- data/app/views/reserves/show.html.erb +0 -61
- data/app/views/use_restrictions/_form.html.erb +0 -19
- data/app/views/use_restrictions/edit.html.erb +0 -13
- data/app/views/use_restrictions/index.html.erb +0 -43
- data/app/views/use_restrictions/new.html.erb +0 -12
- data/app/views/use_restrictions/show.html.erb +0 -29
- data/app/views/user_checkout_stats/_form.html.erb +0 -19
- data/app/views/user_checkout_stats/edit.html.erb +0 -13
- data/app/views/user_checkout_stats/index.html.erb +0 -35
- data/app/views/user_checkout_stats/new.html.erb +0 -12
- data/app/views/user_checkout_stats/show.csv.erb +0 -4
- data/app/views/user_checkout_stats/show.html.erb +0 -55
- data/app/views/user_group_has_checkout_types/edit.html.erb +0 -63
- data/app/views/user_group_has_checkout_types/index.html.erb +0 -32
- data/app/views/user_group_has_checkout_types/new.html.erb +0 -62
- data/app/views/user_group_has_checkout_types/show.html.erb +0 -64
- data/app/views/user_reserve_stats/_form.html.erb +0 -19
- data/app/views/user_reserve_stats/edit.html.erb +0 -13
- data/app/views/user_reserve_stats/index.html.erb +0 -35
- data/app/views/user_reserve_stats/new.html.erb +0 -12
- data/app/views/user_reserve_stats/show.csv.erb +0 -4
- data/app/views/user_reserve_stats/show.html.erb +0 -54
- data/test/dummy/app/controllers/application_controller.rb +0 -3
- data/test/enju_message_test.rb +0 -7
- data/test/integration/navigation_test.rb +0 -10
- data/test/test_helper.rb +0 -10
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreatePatronTypes < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :patron_types do |t|
|
4
|
+
t.string :name, :null => false
|
5
|
+
t.text :display_name
|
6
|
+
t.text :note
|
7
|
+
t.integer :position
|
8
|
+
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.down
|
14
|
+
drop_table :patron_types
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class AddAllowBookmarkExternalUrlToLibraryGroup < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
add_column :library_groups, :allow_bookmark_external_url, :boolean, :null => false, :default => false
|
4
|
+
end
|
5
|
+
|
6
|
+
def self.down
|
7
|
+
remove_column :library_groups, :allow_bookmark_external_url
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class CreateDelayedJobs < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :delayed_jobs, :force => true do |table|
|
4
|
+
table.integer :priority, :default => 0 # Allows some jobs to jump to the front of the queue
|
5
|
+
table.integer :attempts, :default => 0 # Provides for retries, but still fail eventually.
|
6
|
+
table.text :handler # YAML-encoded string of the object that will do work
|
7
|
+
table.text :last_error # reason for last failure (See Note below)
|
8
|
+
table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future.
|
9
|
+
table.datetime :locked_at # Set when a client is working on this object
|
10
|
+
table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead)
|
11
|
+
table.string :locked_by # Who is working on this object (if locked)
|
12
|
+
table.timestamps
|
13
|
+
end
|
14
|
+
|
15
|
+
add_index :delayed_jobs, [:priority, :run_at], :name => 'delayed_jobs_priority'
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.down
|
19
|
+
drop_table :delayed_jobs
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class RemoveDsblFromLibraryGroup < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
remove_column :library_groups, :use_dsbl
|
4
|
+
remove_column :library_groups, :dsbl_list
|
5
|
+
end
|
6
|
+
|
7
|
+
def down
|
8
|
+
add_column :library_groups, :dsbl_list, :text
|
9
|
+
add_column :library_groups, :use_dsbl, :boolean
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateLanguages < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :languages do |t|
|
4
|
+
t.string :name
|
5
|
+
t.string :native_name
|
6
|
+
t.text :display_name
|
7
|
+
t.string :iso_639_1
|
8
|
+
t.string :iso_639_2
|
9
|
+
t.string :iso_639_3
|
10
|
+
t.text :note
|
11
|
+
t.integer :position
|
12
|
+
|
13
|
+
t.timestamps
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateUsers < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :users do |t|
|
4
|
+
t.integer :user_group_id
|
5
|
+
t.integer :required_role_id
|
6
|
+
t.string :username
|
7
|
+
t.text :note
|
8
|
+
t.string :locale
|
9
|
+
t.string :user_number
|
10
|
+
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
class AddDeviseToUsers < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
change_table(:users) do |t|
|
4
|
+
t.database_authenticatable :null => false
|
5
|
+
t.recoverable
|
6
|
+
t.rememberable
|
7
|
+
t.trackable
|
8
|
+
|
9
|
+
# t.encryptable
|
10
|
+
# t.confirmable
|
11
|
+
# t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both
|
12
|
+
# t.token_authenticatable
|
13
|
+
|
14
|
+
|
15
|
+
# Uncomment below if timestamps were not included in your original model.
|
16
|
+
# t.timestamps
|
17
|
+
end
|
18
|
+
|
19
|
+
add_index :users, :email #, :unique => true
|
20
|
+
add_index :users, :reset_password_token, :unique => true
|
21
|
+
# add_index :users, :confirmation_token, :unique => true
|
22
|
+
# add_index :users, :unlock_token, :unique => true
|
23
|
+
# add_index :users, :authentication_token, :unique => true
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.down
|
27
|
+
# By default, we don't want to make any assumption about how to roll back a migration when your
|
28
|
+
# model already existed. Please edit below which fields you would like to remove in this migration.
|
29
|
+
raise ActiveRecord::IrreversibleMigration
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,225 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# This file is auto-generated from the current state of the database. Instead
|
3
|
+
# of editing this file, please use the migrations feature of Active Record to
|
4
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
+
#
|
6
|
+
# Note that this schema.rb definition is the authoritative source for your
|
7
|
+
# database schema. If you need to create the application database on another
|
8
|
+
# system, you should be using db:schema:load, not running all the migrations
|
9
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
+
#
|
12
|
+
# It's strongly recommended to check this file into your version control system.
|
13
|
+
|
14
|
+
ActiveRecord::Schema.define(:version => 20111201163718) do
|
15
|
+
|
16
|
+
create_table "delayed_jobs", :force => true do |t|
|
17
|
+
t.integer "priority", :default => 0
|
18
|
+
t.integer "attempts", :default => 0
|
19
|
+
t.text "handler"
|
20
|
+
t.text "last_error"
|
21
|
+
t.datetime "run_at"
|
22
|
+
t.datetime "locked_at"
|
23
|
+
t.datetime "failed_at"
|
24
|
+
t.string "locked_by"
|
25
|
+
t.datetime "created_at"
|
26
|
+
t.datetime "updated_at"
|
27
|
+
end
|
28
|
+
|
29
|
+
add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
|
30
|
+
|
31
|
+
create_table "languages", :force => true do |t|
|
32
|
+
t.string "name"
|
33
|
+
t.string "native_name"
|
34
|
+
t.text "display_name"
|
35
|
+
t.string "iso_639_1"
|
36
|
+
t.string "iso_639_2"
|
37
|
+
t.string "iso_639_3"
|
38
|
+
t.text "note"
|
39
|
+
t.integer "position"
|
40
|
+
t.datetime "created_at"
|
41
|
+
t.datetime "updated_at"
|
42
|
+
end
|
43
|
+
|
44
|
+
create_table "library_groups", :force => true do |t|
|
45
|
+
t.string "name", :null => false
|
46
|
+
t.text "display_name"
|
47
|
+
t.string "short_name", :null => false
|
48
|
+
t.string "email"
|
49
|
+
t.text "my_networks"
|
50
|
+
t.text "login_banner"
|
51
|
+
t.text "note"
|
52
|
+
t.integer "valid_period_for_new_user", :default => 365, :null => false
|
53
|
+
t.boolean "post_to_union_catalog", :default => false, :null => false
|
54
|
+
t.integer "country_id"
|
55
|
+
t.datetime "created_at"
|
56
|
+
t.datetime "updated_at"
|
57
|
+
t.text "admin_networks"
|
58
|
+
t.boolean "allow_bookmark_external_url", :default => false, :null => false
|
59
|
+
t.integer "position"
|
60
|
+
t.string "url", :default => "http://localhost:3000/"
|
61
|
+
end
|
62
|
+
|
63
|
+
add_index "library_groups", ["short_name"], :name => "index_library_groups_on_short_name"
|
64
|
+
|
65
|
+
create_table "message_requests", :force => true do |t|
|
66
|
+
t.integer "sender_id"
|
67
|
+
t.integer "receiver_id"
|
68
|
+
t.integer "message_template_id"
|
69
|
+
t.datetime "sent_at"
|
70
|
+
t.datetime "deleted_at"
|
71
|
+
t.text "body"
|
72
|
+
t.string "state"
|
73
|
+
t.datetime "created_at"
|
74
|
+
t.datetime "updated_at"
|
75
|
+
end
|
76
|
+
|
77
|
+
add_index "message_requests", ["state"], :name => "index_message_requests_on_state"
|
78
|
+
|
79
|
+
create_table "message_templates", :force => true do |t|
|
80
|
+
t.string "status", :null => false
|
81
|
+
t.text "title", :null => false
|
82
|
+
t.text "body", :null => false
|
83
|
+
t.integer "position"
|
84
|
+
t.string "locale", :default => "en"
|
85
|
+
t.datetime "created_at"
|
86
|
+
t.datetime "updated_at"
|
87
|
+
end
|
88
|
+
|
89
|
+
add_index "message_templates", ["status"], :name => "index_message_templates_on_status", :unique => true
|
90
|
+
|
91
|
+
create_table "messages", :force => true do |t|
|
92
|
+
t.datetime "read_at"
|
93
|
+
t.integer "receiver_id"
|
94
|
+
t.integer "sender_id"
|
95
|
+
t.string "subject", :null => false
|
96
|
+
t.text "body"
|
97
|
+
t.integer "message_request_id"
|
98
|
+
t.string "state"
|
99
|
+
t.integer "parent_id"
|
100
|
+
t.datetime "created_at"
|
101
|
+
t.datetime "updated_at"
|
102
|
+
t.integer "lft"
|
103
|
+
t.integer "rgt"
|
104
|
+
end
|
105
|
+
|
106
|
+
add_index "messages", ["message_request_id"], :name => "index_messages_on_message_request_id"
|
107
|
+
add_index "messages", ["parent_id"], :name => "index_messages_on_parent_id"
|
108
|
+
add_index "messages", ["receiver_id"], :name => "index_messages_on_receiver_id"
|
109
|
+
add_index "messages", ["sender_id"], :name => "index_messages_on_sender_id"
|
110
|
+
|
111
|
+
create_table "patron_types", :force => true do |t|
|
112
|
+
t.string "name", :null => false
|
113
|
+
t.text "display_name"
|
114
|
+
t.text "note"
|
115
|
+
t.integer "position"
|
116
|
+
t.datetime "created_at"
|
117
|
+
t.datetime "updated_at"
|
118
|
+
end
|
119
|
+
|
120
|
+
create_table "patrons", :force => true do |t|
|
121
|
+
t.integer "user_id"
|
122
|
+
t.string "last_name"
|
123
|
+
t.string "middle_name"
|
124
|
+
t.string "first_name"
|
125
|
+
t.string "last_name_transcription"
|
126
|
+
t.string "middle_name_transcription"
|
127
|
+
t.string "first_name_transcription"
|
128
|
+
t.string "corporate_name"
|
129
|
+
t.string "corporate_name_transcription"
|
130
|
+
t.string "full_name"
|
131
|
+
t.text "full_name_transcription"
|
132
|
+
t.text "full_name_alternative"
|
133
|
+
t.datetime "created_at"
|
134
|
+
t.datetime "updated_at"
|
135
|
+
t.datetime "deleted_at"
|
136
|
+
t.string "zip_code_1"
|
137
|
+
t.string "zip_code_2"
|
138
|
+
t.text "address_1"
|
139
|
+
t.text "address_2"
|
140
|
+
t.text "address_1_note"
|
141
|
+
t.text "address_2_note"
|
142
|
+
t.string "telephone_number_1"
|
143
|
+
t.string "telephone_number_2"
|
144
|
+
t.string "fax_number_1"
|
145
|
+
t.string "fax_number_2"
|
146
|
+
t.text "other_designation"
|
147
|
+
t.text "place"
|
148
|
+
t.string "postal_code"
|
149
|
+
t.text "street"
|
150
|
+
t.text "locality"
|
151
|
+
t.text "region"
|
152
|
+
t.datetime "date_of_birth"
|
153
|
+
t.datetime "date_of_death"
|
154
|
+
t.integer "language_id", :default => 1, :null => false
|
155
|
+
t.integer "country_id", :default => 1, :null => false
|
156
|
+
t.integer "patron_type_id", :default => 1, :null => false
|
157
|
+
t.integer "lock_version", :default => 0, :null => false
|
158
|
+
t.text "note"
|
159
|
+
t.integer "creates_count", :default => 0, :null => false
|
160
|
+
t.integer "realizes_count", :default => 0, :null => false
|
161
|
+
t.integer "produces_count", :default => 0, :null => false
|
162
|
+
t.integer "owns_count", :default => 0, :null => false
|
163
|
+
t.integer "required_role_id", :default => 1, :null => false
|
164
|
+
t.integer "required_score", :default => 0, :null => false
|
165
|
+
t.string "state"
|
166
|
+
t.text "email"
|
167
|
+
t.text "url"
|
168
|
+
end
|
169
|
+
|
170
|
+
add_index "patrons", ["country_id"], :name => "index_patrons_on_country_id"
|
171
|
+
add_index "patrons", ["full_name"], :name => "index_patrons_on_full_name"
|
172
|
+
add_index "patrons", ["language_id"], :name => "index_patrons_on_language_id"
|
173
|
+
add_index "patrons", ["required_role_id"], :name => "index_patrons_on_required_role_id"
|
174
|
+
add_index "patrons", ["user_id"], :name => "index_patrons_on_user_id", :unique => true
|
175
|
+
|
176
|
+
create_table "roles", :force => true do |t|
|
177
|
+
t.string "name"
|
178
|
+
t.text "display_name"
|
179
|
+
t.text "note"
|
180
|
+
t.integer "position"
|
181
|
+
t.datetime "created_at"
|
182
|
+
t.datetime "updated_at"
|
183
|
+
end
|
184
|
+
|
185
|
+
create_table "user_groups", :force => true do |t|
|
186
|
+
t.string "name"
|
187
|
+
t.text "display_name"
|
188
|
+
t.text "note"
|
189
|
+
t.integer "position"
|
190
|
+
t.datetime "created_at"
|
191
|
+
t.datetime "updated_at"
|
192
|
+
end
|
193
|
+
|
194
|
+
create_table "user_has_roles", :force => true do |t|
|
195
|
+
t.integer "user_id"
|
196
|
+
t.integer "role_id"
|
197
|
+
t.datetime "created_at"
|
198
|
+
t.datetime "updated_at"
|
199
|
+
end
|
200
|
+
|
201
|
+
create_table "users", :force => true do |t|
|
202
|
+
t.integer "user_group_id"
|
203
|
+
t.integer "required_role_id"
|
204
|
+
t.string "username"
|
205
|
+
t.text "note"
|
206
|
+
t.string "locale"
|
207
|
+
t.string "user_number"
|
208
|
+
t.datetime "created_at"
|
209
|
+
t.datetime "updated_at"
|
210
|
+
t.string "email", :default => "", :null => false
|
211
|
+
t.string "encrypted_password", :limit => 128, :default => "", :null => false
|
212
|
+
t.string "reset_password_token"
|
213
|
+
t.datetime "reset_password_sent_at"
|
214
|
+
t.datetime "remember_created_at"
|
215
|
+
t.integer "sign_in_count", :default => 0
|
216
|
+
t.datetime "current_sign_in_at"
|
217
|
+
t.datetime "last_sign_in_at"
|
218
|
+
t.string "current_sign_in_ip"
|
219
|
+
t.string "last_sign_in_ip"
|
220
|
+
end
|
221
|
+
|
222
|
+
add_index "users", ["email"], :name => "index_users_on_email"
|
223
|
+
add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
|
224
|
+
|
225
|
+
end
|
Binary file
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module LocalizedName
|
2
|
+
def localize(locale = I18n.locale.to_s)
|
3
|
+
values = Hash[*self.strip.split("\n").map{|n| n.split(':', 2)}.flatten]
|
4
|
+
name = values[locale.to_s] || self
|
5
|
+
name.strip
|
6
|
+
rescue ArgumentError
|
7
|
+
self
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
class String
|
12
|
+
include LocalizedName
|
13
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module MasterModel
|
2
|
+
def self.included(base)
|
3
|
+
#base.extend ClassMethods
|
4
|
+
base.send :include, InstanceMethods
|
5
|
+
base.class_eval do
|
6
|
+
acts_as_list
|
7
|
+
validates_uniqueness_of :name, :case_sensitive => false
|
8
|
+
validates_presence_of :name, :display_name
|
9
|
+
before_validation :set_display_name, :on => :create
|
10
|
+
normalize_attributes :name
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
module InstanceMethods
|
15
|
+
def set_display_name
|
16
|
+
self.display_name = self.name if self.display_name.blank?
|
17
|
+
end
|
18
|
+
|
19
|
+
def check_creatable
|
20
|
+
if creatable?
|
21
|
+
raise NotModifiableError
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def check_deletable
|
26
|
+
if deletable?
|
27
|
+
raise NotModifiableError
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def creatable?
|
32
|
+
false
|
33
|
+
end
|
34
|
+
|
35
|
+
def deletable?
|
36
|
+
false
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
class NotModifiableError < StandardError; end
|
41
|
+
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
[1m[36m (0.1ms)[0m [1mselect sqlite_version(*)[0m
|
2
|
+
[1m[35m (1.9ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
3
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
4
|
+
[1m[35m (1.8ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
5
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
6
|
+
Migrating to CreateMessageTemplates (149)
|
7
|
+
[1m[35m (0.4ms)[0m CREATE TABLE "message_templates" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "status" varchar(255) NOT NULL, "title" text NOT NULL, "body" text NOT NULL, "position" integer, "locale" varchar(255) DEFAULT 'en', "created_at" datetime, "updated_at" datetime)
|
8
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("message_templates")[0m
|
9
|
+
[1m[35m (0.4ms)[0m CREATE UNIQUE INDEX "index_message_templates_on_status" ON "message_templates" ("status")
|
10
|
+
[1m[36m (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES ('149')[0m
|
11
|
+
Migrating to CreateMessages (154)
|
12
|
+
[1m[35m (0.3ms)[0m CREATE TABLE "messages" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "read_at" datetime, "receiver_id" integer, "sender_id" integer, "subject" varchar(255) NOT NULL, "body" text, "message_request_id" integer, "state" varchar(255), "parent_id" integer, "created_at" datetime, "updated_at" datetime)
|
13
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("messages")[0m
|
14
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_messages_on_sender_id" ON "messages" ("sender_id")
|
15
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("messages")[0m
|
16
|
+
[1m[35m (0.0ms)[0m PRAGMA index_info('index_messages_on_sender_id')
|
17
|
+
[1m[36m (0.1ms)[0m [1mCREATE INDEX "index_messages_on_receiver_id" ON "messages" ("receiver_id")[0m
|
18
|
+
[1m[35m (0.0ms)[0m PRAGMA index_list("messages")
|
19
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_info('index_messages_on_receiver_id')[0m
|
20
|
+
[1m[35m (0.0ms)[0m PRAGMA index_info('index_messages_on_sender_id')
|
21
|
+
[1m[36m (0.1ms)[0m [1mCREATE INDEX "index_messages_on_message_request_id" ON "messages" ("message_request_id")[0m
|
22
|
+
[1m[35m (0.0ms)[0m PRAGMA index_list("messages")
|
23
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_info('index_messages_on_message_request_id')[0m
|
24
|
+
[1m[35m (0.0ms)[0m PRAGMA index_info('index_messages_on_receiver_id')
|
25
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_info('index_messages_on_sender_id')[0m
|
26
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_messages_on_parent_id" ON "messages" ("parent_id")
|
27
|
+
[1m[36m (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES ('154')[0m
|
28
|
+
Migrating to CreateMessageRequests (20080819181903)
|
29
|
+
[1m[35m (0.4ms)[0m CREATE TABLE "message_requests" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "sender_id" integer, "receiver_id" integer, "message_template_id" integer, "sent_at" datetime, "deleted_at" datetime, "body" text, "state" varchar(255), "created_at" datetime, "updated_at" datetime)
|
30
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("message_requests")[0m
|
31
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_message_requests_on_state" ON "message_requests" ("state")
|
32
|
+
[1m[36m (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES ('20080819181903')[0m
|
33
|
+
Migrating to AddLftAndRgtToMessage (20110913115320)
|
34
|
+
[1m[35m (0.5ms)[0m ALTER TABLE "messages" ADD "lft" integer
|
35
|
+
[1m[36m (0.2ms)[0m [1mALTER TABLE "messages" ADD "rgt" integer[0m
|
36
|
+
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ('20110913115320')
|
37
|
+
Migrating to CreateLanguages (20111201121636)
|
38
|
+
[1m[36m (0.5ms)[0m [1mCREATE TABLE "languages" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "native_name" varchar(255), "display_name" text, "iso_639_1" varchar(255), "iso_639_2" varchar(255), "iso_639_3" varchar(255), "note" text, "position" integer, "created_at" datetime, "updated_at" datetime) [0m
|
39
|
+
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ('20111201121636')
|
40
|
+
Migrating to CreateRoles (20111201121844)
|
41
|
+
[1m[36m (0.3ms)[0m [1mCREATE TABLE "roles" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "display_name" text, "note" text, "position" integer, "created_at" datetime, "updated_at" datetime) [0m
|
42
|
+
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ('20111201121844')
|
43
|
+
Migrating to CreateUsers (20111201155456)
|
44
|
+
[1m[36m (0.4ms)[0m [1mCREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_group_id" integer, "required_role_id" integer, "username" varchar(255), "note" text, "locale" varchar(255), "created_at" datetime, "updated_at" datetime) [0m
|
45
|
+
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ('20111201155456')
|
46
|
+
Migrating to AddDeviseToUsers (20111201155513)
|
47
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
48
|
+
Migrating to CreateMessageTemplates (149)
|
49
|
+
Migrating to CreateMessages (154)
|
50
|
+
Migrating to CreateMessageRequests (20080819181903)
|
51
|
+
Migrating to AddLftAndRgtToMessage (20110913115320)
|
52
|
+
Migrating to CreateLanguages (20111201121636)
|
53
|
+
Migrating to CreateRoles (20111201121844)
|
54
|
+
Migrating to CreateUsers (20111201155456)
|
55
|
+
Migrating to AddDeviseToUsers (20111201155513)
|
56
|
+
[1m[35m (0.0ms)[0m select sqlite_version(*)
|
57
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
58
|
+
Migrating to CreateMessageTemplates (149)
|
59
|
+
Migrating to CreateMessages (154)
|
60
|
+
Migrating to CreateMessageRequests (20080819181903)
|
61
|
+
Migrating to AddLftAndRgtToMessage (20110913115320)
|
62
|
+
Migrating to CreateLanguages (20111201121636)
|
63
|
+
Migrating to CreateRoles (20111201121844)
|
64
|
+
Migrating to CreateUsers (20111201155456)
|
65
|
+
Migrating to AddDeviseToUsers (20111201155513)
|
66
|
+
[1m[35m (0.0ms)[0m select sqlite_version(*)
|
67
|
+
[1m[36m (0.6ms)[0m [1mALTER TABLE "users" ADD "email" varchar(255) DEFAULT '' NOT NULL[0m
|
68
|
+
[1m[35m (0.2ms)[0m ALTER TABLE "users" ADD "encrypted_password" varchar(128) DEFAULT '' NOT NULL
|
69
|
+
[1m[36m (0.2ms)[0m [1mALTER TABLE "users" ADD "reset_password_token" varchar(255)[0m
|
70
|
+
[1m[35m (0.2ms)[0m ALTER TABLE "users" ADD "reset_password_sent_at" datetime
|
71
|
+
[1m[36m (0.2ms)[0m [1mALTER TABLE "users" ADD "remember_created_at" datetime[0m
|
72
|
+
[1m[35m (0.3ms)[0m ALTER TABLE "users" ADD "sign_in_count" integer DEFAULT 0
|
73
|
+
[1m[36m (0.2ms)[0m [1mALTER TABLE "users" ADD "current_sign_in_at" datetime[0m
|
74
|
+
[1m[35m (0.2ms)[0m ALTER TABLE "users" ADD "last_sign_in_at" datetime
|
75
|
+
[1m[36m (0.2ms)[0m [1mALTER TABLE "users" ADD "current_sign_in_ip" varchar(255)[0m
|
76
|
+
[1m[35m (0.2ms)[0m ALTER TABLE "users" ADD "last_sign_in_ip" varchar(255)
|
77
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("users")[0m
|
78
|
+
[1m[35m (0.2ms)[0m CREATE INDEX "index_users_on_email" ON "users" ("email")
|
79
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("users")[0m
|
80
|
+
[1m[35m (0.0ms)[0m PRAGMA index_info('index_users_on_email')
|
81
|
+
[1m[36m (0.5ms)[0m [1mCREATE UNIQUE INDEX "index_users_on_reset_password_token" ON "users" ("reset_password_token")[0m
|
82
|
+
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ('20111201155513')
|
83
|
+
Migrating to CreateUserGroups (20111201163342)
|
84
|
+
[1m[36m (0.5ms)[0m [1mCREATE TABLE "user_groups" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "display_name" text, "note" text, "position" integer, "created_at" datetime, "updated_at" datetime) [0m
|
85
|
+
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ('20111201163342')
|
86
|
+
Migrating to CreateUserHasRoles (20111201163718)
|
87
|
+
[1m[36m (0.5ms)[0m [1mCREATE TABLE "user_has_roles" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "role_id" integer, "created_at" datetime, "updated_at" datetime) [0m
|
88
|
+
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ('20111201163718')
|
89
|
+
[1m[36m (0.5ms)[0m [1mselect sqlite_version(*)[0m
|
90
|
+
[1m[35m (0.1ms)[0m SELECT "schema_migrations"."version" FROM "schema_migrations"
|
91
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("languages")[0m
|
92
|
+
[1m[35m (0.0ms)[0m PRAGMA index_list("message_requests")
|
93
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_info('index_message_requests_on_state')[0m
|
94
|
+
[1m[35m (0.0ms)[0m PRAGMA index_list("message_templates")
|
95
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_info('index_message_templates_on_status')[0m
|
96
|
+
[1m[35m (0.1ms)[0m PRAGMA index_list("messages")
|
97
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_info('index_messages_on_parent_id')[0m
|
98
|
+
[1m[35m (0.0ms)[0m PRAGMA index_info('index_messages_on_message_request_id')
|
99
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_info('index_messages_on_receiver_id')[0m
|
100
|
+
[1m[35m (0.0ms)[0m PRAGMA index_info('index_messages_on_sender_id')
|
101
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("roles")[0m
|
102
|
+
[1m[35m (0.0ms)[0m PRAGMA index_list("user_groups")
|
103
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("user_has_roles")[0m
|
104
|
+
[1m[35m (0.0ms)[0m PRAGMA index_list("users")
|
105
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_info('index_users_on_reset_password_token')[0m
|
106
|
+
[1m[35m (0.0ms)[0m PRAGMA index_info('index_users_on_email')
|