enju_question 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +36 -0
- data/app/controllers/answers_controller.rb +140 -0
- data/app/controllers/questions_controller.rb +171 -0
- data/app/models/answer.rb +59 -0
- data/app/models/answer_has_item.rb +20 -0
- data/app/models/question.rb +87 -0
- data/app/models/question_sweeper.rb +17 -0
- data/app/views/answers/_form.html.erb +33 -0
- data/app/views/answers/edit.html.erb +13 -0
- data/app/views/answers/index.atom.builder +16 -0
- data/app/views/answers/index.html.erb +44 -0
- data/app/views/answers/index.rss.builder +31 -0
- data/app/views/answers/new.html.erb +14 -0
- data/app/views/answers/new.mobile.erb +35 -0
- data/app/views/answers/show.html.erb +54 -0
- data/app/views/questions/_crd.html.erb +24 -0
- data/app/views/questions/_index.html.erb +22 -0
- data/app/views/questions/_index_user.html.erb +18 -0
- data/app/views/questions/_list.html.erb +69 -0
- data/app/views/questions/_solved_facet.html.erb +21 -0
- data/app/views/questions/edit.html.erb +44 -0
- data/app/views/questions/index.atom.builder +16 -0
- data/app/views/questions/index.html.erb +5 -0
- data/app/views/questions/index.js.erb +2 -0
- data/app/views/questions/index.mobile.erb +21 -0
- data/app/views/questions/index.rss.builder +41 -0
- data/app/views/questions/index_crd.xml.builder +36 -0
- data/app/views/questions/new.html.erb +35 -0
- data/app/views/questions/show.html.erb +62 -0
- data/app/views/questions/show.mobile.erb +46 -0
- data/app/views/questions/show_crd.xml.builder +34 -0
- data/config/routes.rb +10 -0
- data/db/migrate/098_create_questions.rb +21 -0
- data/db/migrate/099_create_answers.rb +21 -0
- data/db/migrate/20100217054028_create_answer_has_items.rb +17 -0
- data/lib/enju_question/engine.rb +4 -0
- data/lib/enju_question/version.rb +3 -0
- data/lib/enju_question.rb +4 -0
- data/lib/tasks/enju_question_tasks.rake +4 -0
- data/spec/cassette_library/enju_ndl/crd.yml +440 -0
- data/spec/controllers/answers_controller_spec.rb +486 -0
- data/spec/controllers/questions_controller_spec.rb +559 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +9 -0
- data/spec/dummy/app/assets/stylesheets/application.css +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +106 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/models/ability.rb +42 -0
- data/spec/dummy/app/models/item.rb +5 -0
- data/spec/dummy/app/models/role.rb +8 -0
- data/spec/dummy/app/models/user.rb +29 -0
- data/spec/dummy/app/models/user_group.rb +2 -0
- data/spec/dummy/app/models/user_has_role.rb +4 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -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/spec/dummy/config/application.rb +46 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +30 -0
- data/spec/dummy/config/environments/production.rb +60 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/devise.rb +209 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +6 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +60 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/006_create_items.rb +36 -0
- data/spec/dummy/db/migrate/20100525171356_acts_as_taggable_on_migration.rb +30 -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 +13 -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 +168 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/lib/expire_editable_fragment.rb +62 -0
- data/spec/dummy/log/development.log +2 -0
- data/spec/dummy/log/sunspot-solr-test.log +222 -0
- data/spec/dummy/log/test.log +77918 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -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/answer.rb +7 -0
- data/spec/factories/question.rb +6 -0
- data/spec/factories/user.rb +34 -0
- data/spec/fixtures/answer_has_items.yml +26 -0
- data/spec/fixtures/answers.yml +61 -0
- data/spec/fixtures/questions.yml +61 -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/answer_has_item_spec.rb +20 -0
- data/spec/models/answer_spec.rb +25 -0
- data/spec/spec_helper.rb +48 -0
- data/spec/support/controller_macros.rb +48 -0
- data/spec/support/devise.rb +4 -0
- data/spec/support/vcr.rb +6 -0
- metadata +306 -0
@@ -0,0 +1,60 @@
|
|
1
|
+
Dummy::Application.routes.draw do
|
2
|
+
devise_for :users
|
3
|
+
|
4
|
+
# The priority is based upon order of creation:
|
5
|
+
# first created -> highest priority.
|
6
|
+
|
7
|
+
# Sample of regular route:
|
8
|
+
# match 'products/:id' => 'catalog#view'
|
9
|
+
# Keep in mind you can assign values other than :controller and :action
|
10
|
+
|
11
|
+
# Sample of named route:
|
12
|
+
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
|
13
|
+
# This route can be invoked with purchase_url(:id => product.id)
|
14
|
+
|
15
|
+
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
16
|
+
# resources :products
|
17
|
+
|
18
|
+
# Sample resource route with options:
|
19
|
+
# resources :products do
|
20
|
+
# member do
|
21
|
+
# get 'short'
|
22
|
+
# post 'toggle'
|
23
|
+
# end
|
24
|
+
#
|
25
|
+
# collection do
|
26
|
+
# get 'sold'
|
27
|
+
# end
|
28
|
+
# end
|
29
|
+
|
30
|
+
# Sample resource route with sub-resources:
|
31
|
+
# resources :products do
|
32
|
+
# resources :comments, :sales
|
33
|
+
# resource :seller
|
34
|
+
# end
|
35
|
+
|
36
|
+
# Sample resource route with more complex sub-resources
|
37
|
+
# resources :products do
|
38
|
+
# resources :comments
|
39
|
+
# resources :sales do
|
40
|
+
# get 'recent', :on => :collection
|
41
|
+
# end
|
42
|
+
# end
|
43
|
+
|
44
|
+
# Sample resource route within a namespace:
|
45
|
+
# namespace :admin do
|
46
|
+
# # Directs /admin/products/* to Admin::ProductsController
|
47
|
+
# # (app/controllers/admin/products_controller.rb)
|
48
|
+
# resources :products
|
49
|
+
# end
|
50
|
+
|
51
|
+
# You can have the root of your site routed with "root"
|
52
|
+
# just remember to delete public/index.html.
|
53
|
+
# root :to => 'welcome#index'
|
54
|
+
|
55
|
+
# See how all your routes lay out with "rake routes"
|
56
|
+
|
57
|
+
# This is a legacy wild controller route that's not recommended for RESTful applications.
|
58
|
+
# Note: This route will make all actions in every controller accessible via GET requests.
|
59
|
+
# match ':controller(/:action(/:id(.:format)))'
|
60
|
+
end
|
Binary file
|
@@ -0,0 +1,36 @@
|
|
1
|
+
class CreateItems < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :items do |t|
|
4
|
+
#t.integer :manifestation_id
|
5
|
+
t.string :call_number
|
6
|
+
t.string :item_identifier
|
7
|
+
t.integer :circulation_status_id, :default => 5, :null => false
|
8
|
+
t.integer :checkout_type_id, :default => 1, :null => false
|
9
|
+
t.timestamps
|
10
|
+
t.datetime :deleted_at
|
11
|
+
t.integer :shelf_id, :default => 1, :null => false
|
12
|
+
t.integer :basket_id
|
13
|
+
t.boolean :include_supplements, :default => false, :null => false
|
14
|
+
t.integer :checkouts_count, :default => 0, :null => false
|
15
|
+
t.integer :owns_count, :default => 0, :null => false
|
16
|
+
t.integer :resource_has_subjects_count, :default => 0, :null => false
|
17
|
+
t.text :note
|
18
|
+
t.string :url
|
19
|
+
t.integer :price
|
20
|
+
t.integer :lock_version, :default => 0, :null => false
|
21
|
+
t.integer :required_role_id, :default => 1, :null => false
|
22
|
+
t.string :state
|
23
|
+
t.integer :required_score, :default => 0, :null => false
|
24
|
+
end
|
25
|
+
#add_index :items, :manifestation_id
|
26
|
+
add_index :items, :circulation_status_id
|
27
|
+
add_index :items, :checkout_type_id
|
28
|
+
add_index :items, :shelf_id
|
29
|
+
add_index :items, :item_identifier
|
30
|
+
add_index :items, :required_role_id
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.down
|
34
|
+
drop_table :items
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class ActsAsTaggableOnMigration < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :tags do |t|
|
4
|
+
t.string :name
|
5
|
+
t.string :name_transcription
|
6
|
+
t.timestamps
|
7
|
+
end
|
8
|
+
|
9
|
+
create_table :taggings do |t|
|
10
|
+
t.references :tag
|
11
|
+
|
12
|
+
# You should make sure that the column created is
|
13
|
+
# long enough to store the required class names.
|
14
|
+
t.references :taggable, :polymorphic => true
|
15
|
+
t.references :tagger, :polymorphic => true
|
16
|
+
|
17
|
+
t.string :context
|
18
|
+
|
19
|
+
t.datetime :created_at
|
20
|
+
end
|
21
|
+
|
22
|
+
add_index :taggings, :tag_id
|
23
|
+
add_index :taggings, [:taggable_id, :taggable_type, :context]
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.down
|
27
|
+
drop_table :taggings
|
28
|
+
drop_table :tags
|
29
|
+
end
|
30
|
+
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,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,168 @@
|
|
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 "answer_has_items", :force => true do |t|
|
17
|
+
t.integer "answer_id"
|
18
|
+
t.integer "item_id"
|
19
|
+
t.integer "position"
|
20
|
+
t.datetime "created_at"
|
21
|
+
t.datetime "updated_at"
|
22
|
+
end
|
23
|
+
|
24
|
+
add_index "answer_has_items", ["answer_id"], :name => "index_answer_has_items_on_answer_id"
|
25
|
+
add_index "answer_has_items", ["item_id"], :name => "index_answer_has_items_on_item_id"
|
26
|
+
|
27
|
+
create_table "answers", :force => true do |t|
|
28
|
+
t.integer "user_id", :null => false
|
29
|
+
t.integer "question_id", :null => false
|
30
|
+
t.text "body"
|
31
|
+
t.datetime "created_at"
|
32
|
+
t.datetime "updated_at"
|
33
|
+
t.datetime "deleted_at"
|
34
|
+
t.boolean "shared", :default => true, :null => false
|
35
|
+
t.string "state"
|
36
|
+
t.text "item_identifier_list"
|
37
|
+
t.text "url_list"
|
38
|
+
end
|
39
|
+
|
40
|
+
add_index "answers", ["question_id"], :name => "index_answers_on_question_id"
|
41
|
+
add_index "answers", ["user_id"], :name => "index_answers_on_user_id"
|
42
|
+
|
43
|
+
create_table "items", :force => true do |t|
|
44
|
+
t.string "call_number"
|
45
|
+
t.string "item_identifier"
|
46
|
+
t.integer "circulation_status_id", :default => 5, :null => false
|
47
|
+
t.integer "checkout_type_id", :default => 1, :null => false
|
48
|
+
t.datetime "created_at"
|
49
|
+
t.datetime "updated_at"
|
50
|
+
t.datetime "deleted_at"
|
51
|
+
t.integer "shelf_id", :default => 1, :null => false
|
52
|
+
t.integer "basket_id"
|
53
|
+
t.boolean "include_supplements", :default => false, :null => false
|
54
|
+
t.integer "checkouts_count", :default => 0, :null => false
|
55
|
+
t.integer "owns_count", :default => 0, :null => false
|
56
|
+
t.integer "resource_has_subjects_count", :default => 0, :null => false
|
57
|
+
t.text "note"
|
58
|
+
t.string "url"
|
59
|
+
t.integer "price"
|
60
|
+
t.integer "lock_version", :default => 0, :null => false
|
61
|
+
t.integer "required_role_id", :default => 1, :null => false
|
62
|
+
t.string "state"
|
63
|
+
t.integer "required_score", :default => 0, :null => false
|
64
|
+
end
|
65
|
+
|
66
|
+
add_index "items", ["checkout_type_id"], :name => "index_items_on_checkout_type_id"
|
67
|
+
add_index "items", ["circulation_status_id"], :name => "index_items_on_circulation_status_id"
|
68
|
+
add_index "items", ["item_identifier"], :name => "index_items_on_item_identifier"
|
69
|
+
add_index "items", ["required_role_id"], :name => "index_items_on_required_role_id"
|
70
|
+
add_index "items", ["shelf_id"], :name => "index_items_on_shelf_id"
|
71
|
+
|
72
|
+
create_table "languages", :force => true do |t|
|
73
|
+
t.string "name"
|
74
|
+
t.string "native_name"
|
75
|
+
t.text "display_name"
|
76
|
+
t.string "iso_639_1"
|
77
|
+
t.string "iso_639_2"
|
78
|
+
t.string "iso_639_3"
|
79
|
+
t.text "note"
|
80
|
+
t.integer "position"
|
81
|
+
t.datetime "created_at"
|
82
|
+
t.datetime "updated_at"
|
83
|
+
end
|
84
|
+
|
85
|
+
create_table "questions", :force => true do |t|
|
86
|
+
t.integer "user_id", :null => false
|
87
|
+
t.text "body"
|
88
|
+
t.boolean "shared", :default => true, :null => false
|
89
|
+
t.integer "answers_count", :default => 0, :null => false
|
90
|
+
t.datetime "deleted_at"
|
91
|
+
t.string "state"
|
92
|
+
t.boolean "solved", :default => false, :null => false
|
93
|
+
t.text "note"
|
94
|
+
t.datetime "created_at"
|
95
|
+
t.datetime "updated_at"
|
96
|
+
end
|
97
|
+
|
98
|
+
add_index "questions", ["user_id"], :name => "index_questions_on_user_id"
|
99
|
+
|
100
|
+
create_table "roles", :force => true do |t|
|
101
|
+
t.string "name"
|
102
|
+
t.text "display_name"
|
103
|
+
t.text "note"
|
104
|
+
t.integer "position"
|
105
|
+
t.datetime "created_at"
|
106
|
+
t.datetime "updated_at"
|
107
|
+
end
|
108
|
+
|
109
|
+
create_table "taggings", :force => true do |t|
|
110
|
+
t.integer "tag_id"
|
111
|
+
t.integer "taggable_id"
|
112
|
+
t.string "taggable_type"
|
113
|
+
t.integer "tagger_id"
|
114
|
+
t.string "tagger_type"
|
115
|
+
t.string "context"
|
116
|
+
t.datetime "created_at"
|
117
|
+
end
|
118
|
+
|
119
|
+
add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id"
|
120
|
+
add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context"
|
121
|
+
|
122
|
+
create_table "tags", :force => true do |t|
|
123
|
+
t.string "name"
|
124
|
+
t.string "name_transcription"
|
125
|
+
t.datetime "created_at"
|
126
|
+
t.datetime "updated_at"
|
127
|
+
end
|
128
|
+
|
129
|
+
create_table "user_groups", :force => true do |t|
|
130
|
+
t.string "name"
|
131
|
+
t.text "display_name"
|
132
|
+
t.text "note"
|
133
|
+
t.integer "position"
|
134
|
+
t.datetime "created_at"
|
135
|
+
t.datetime "updated_at"
|
136
|
+
end
|
137
|
+
|
138
|
+
create_table "user_has_roles", :force => true do |t|
|
139
|
+
t.integer "user_id"
|
140
|
+
t.integer "role_id"
|
141
|
+
t.datetime "created_at"
|
142
|
+
t.datetime "updated_at"
|
143
|
+
end
|
144
|
+
|
145
|
+
create_table "users", :force => true do |t|
|
146
|
+
t.integer "user_group_id"
|
147
|
+
t.integer "required_role_id"
|
148
|
+
t.string "username"
|
149
|
+
t.text "note"
|
150
|
+
t.string "locale"
|
151
|
+
t.datetime "created_at"
|
152
|
+
t.datetime "updated_at"
|
153
|
+
t.string "email", :default => "", :null => false
|
154
|
+
t.string "encrypted_password", :limit => 128, :default => "", :null => false
|
155
|
+
t.string "reset_password_token"
|
156
|
+
t.datetime "reset_password_sent_at"
|
157
|
+
t.datetime "remember_created_at"
|
158
|
+
t.integer "sign_in_count", :default => 0
|
159
|
+
t.datetime "current_sign_in_at"
|
160
|
+
t.datetime "last_sign_in_at"
|
161
|
+
t.string "current_sign_in_ip"
|
162
|
+
t.string "last_sign_in_ip"
|
163
|
+
end
|
164
|
+
|
165
|
+
add_index "users", ["email"], :name => "index_users_on_email"
|
166
|
+
add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
|
167
|
+
|
168
|
+
end
|
Binary file
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module ExpireEditableFragment
|
2
|
+
def expire_editable_fragment(record, fragments = [], formats = [])
|
3
|
+
fragments.uniq!
|
4
|
+
fragments = ['detail'] if fragments.empty?
|
5
|
+
if record
|
6
|
+
if record.is_a?(Manifestation)
|
7
|
+
expire_manifestation_cache(record, fragments, formats)
|
8
|
+
else
|
9
|
+
I18n.available_locales.each do |locale|
|
10
|
+
Role.all_cache.each do |role|
|
11
|
+
fragments.each do |fragment|
|
12
|
+
expire_fragment(:controller => record.class.to_s.pluralize.downcase, :action => :show, :id => record.id, :page => fragment, :role => role.name, :locale => locale)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def expire_manifestation_cache(manifestation, fragments = [], formats = [])
|
21
|
+
fragments = %w[detail pickup title show_list show_index sru] if fragments.size == 1 and fragments.first == 'detail'
|
22
|
+
expire_fragment(:controller => :manifestations, :action => :index, :page => 'numdocs')
|
23
|
+
fragments.uniq.each do |fragment|
|
24
|
+
expire_manifestation_fragment(manifestation, fragment, formats)
|
25
|
+
end
|
26
|
+
if defined?(EnjuBookmark)
|
27
|
+
manifestation.bookmarks.each do |bookmark|
|
28
|
+
expire_tag_cloud(bookmark)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def expire_manifestation_fragment(manifestation, fragment, formats = [])
|
34
|
+
formats = ['atom', 'csv', 'html', 'mods', 'mobile', 'oai_list_identifiers', 'oai_list_records', 'rdf', 'rss'] if formats.empty?
|
35
|
+
if manifestation
|
36
|
+
I18n.available_locales.each do |locale|
|
37
|
+
if fragment == 'holding'
|
38
|
+
expire_fragment(:controller => :manifestations, :action => :show, :id => manifestation.id, :page => fragment, :locale => locale, :manifestation_id => nil)
|
39
|
+
formats.each do |format|
|
40
|
+
expire_fragment(:controller => :manifestations, :action => :show, :id => manifestation.id, :page => fragment, :locale => locale, :format => format, :manifestation_id => nil)
|
41
|
+
end
|
42
|
+
else
|
43
|
+
Role.all_cache.each do |role|
|
44
|
+
expire_fragment(:controller => :manifestations, :action => :show, :id => manifestation.id, :page => fragment, :role => role.name, :locale => locale, :manifestation_id => nil)
|
45
|
+
formats.each do |format|
|
46
|
+
expire_fragment(:controller => :manifestations, :action => :show, :id => manifestation.id, :page => fragment, :role => role.name, :locale => locale, :format => format, :manifestation_id => nil)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def expire_tag_cloud(bookmark)
|
55
|
+
I18n.available_locales.each do |locale|
|
56
|
+
Role.all_cache.each do |role|
|
57
|
+
expire_fragment(:controller => :tags, :action => :index, :page => 'user_tag_cloud', :user_id => bookmark.user.username, :locale => locale, :role => role.name, :user_id => nil)
|
58
|
+
expire_fragment(:controller => :tags, :action => :index, :page => 'public_tag_cloud', :locale => locale, :role => role.name, :user_id => nil)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,2 @@
|
|
1
|
+
[1m[32mSOLR Request (1.8ms)[0m [ path=#<RSolr::Client:0x007fd361ba8b28> parameters={data: [1m[1m<?xml version="1.0" encoding="UTF-8"?><delete><query>type:Question</query></delete>[0m, headers: [1m[1m{"Content-Type"=>"text/xml"}[0m, method: [1m[1mpost[0m, params: [1m[1m{:wt=>:ruby}[0m, query: [1m[1mwt=ruby[0m, path: [1m[1mupdate[0m, uri: [1m[1mhttp://localhost:8982/solr/update?wt=ruby[0m} ]
|
2
|
+
[1m[32mSOLR Request (2.0ms)[0m [ path=#<RSolr::Client:0x007fb543353c48> parameters={data: [1m[1m<?xml version="1.0" encoding="UTF-8"?><delete><query>type:Question</query></delete>[0m, headers: [1m[1m{"Content-Type"=>"text/xml"}[0m, method: [1m[1mpost[0m, params: [1m[1m{:wt=>:ruby}[0m, query: [1m[1mwt=ruby[0m, path: [1m[1mupdate[0m, uri: [1m[1mhttp://localhost:8982/solr/update?wt=ruby[0m} ]
|