hydra-editor 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +51 -0
  3. data/Rakefile +57 -0
  4. data/app/assets/javascripts/hydra-editor/editMetadata.js +4 -0
  5. data/app/assets/javascripts/hydra-editor/hydra-editor.js +2 -0
  6. data/app/assets/javascripts/hydra-editor/multiForm.js +58 -0
  7. data/app/assets/stylesheets/hydra-editor/application.css +13 -0
  8. data/app/assets/stylesheets/hydra-editor/hydra-editor.css +6 -0
  9. data/app/controllers/concerns/records_controller_behavior.rb +75 -0
  10. data/app/controllers/records_controller.rb +3 -0
  11. data/app/helpers/concerns/records_helper_behavior.rb +59 -0
  12. data/app/helpers/records_helper.rb +3 -0
  13. data/app/views/records/_edit_field.html.erb +15 -0
  14. data/app/views/records/_form.html.erb +16 -0
  15. data/app/views/records/choose_type.html.erb +8 -0
  16. data/app/views/records/edit.html.erb +3 -0
  17. data/app/views/records/edit_fields/_default.html.erb +10 -0
  18. data/app/views/records/edit_fields/_suffix.html.erb +6 -0
  19. data/app/views/records/new.html.erb +2 -0
  20. data/config/routes.rb +4 -0
  21. data/lib/hydra-editor.rb +12 -0
  22. data/lib/hydra_editor/engine.rb +8 -0
  23. data/lib/hydra_editor/version.rb +3 -0
  24. data/lib/tasks/hydra-editor_tasks.rake +4 -0
  25. data/spec/controllers/records_controller_spec.rb +101 -0
  26. data/spec/dummy/Gemfile +16 -0
  27. data/spec/dummy/Gemfile.lock +246 -0
  28. data/spec/dummy/README.rdoc +261 -0
  29. data/spec/dummy/Rakefile +7 -0
  30. data/spec/dummy/app/assets/images/blacklight/bg.png +0 -0
  31. data/spec/dummy/app/assets/images/blacklight/border.png +0 -0
  32. data/spec/dummy/app/assets/images/blacklight/bul_sq_gry.gif +0 -0
  33. data/spec/dummy/app/assets/images/blacklight/checkmark.gif +0 -0
  34. data/spec/dummy/app/assets/images/blacklight/logo.png +0 -0
  35. data/spec/dummy/app/assets/images/blacklight/magnifying_glass.gif +0 -0
  36. data/spec/dummy/app/assets/images/blacklight/remove.gif +0 -0
  37. data/spec/dummy/app/assets/images/blacklight/separator.gif +0 -0
  38. data/spec/dummy/app/assets/images/blacklight/start_over.gif +0 -0
  39. data/spec/dummy/app/assets/images/rails.png +0 -0
  40. data/spec/dummy/app/assets/javascripts/application.js +18 -0
  41. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  42. data/spec/dummy/app/assets/stylesheets/blacklight.css.scss +4 -0
  43. data/spec/dummy/app/controllers/application_controller.rb +10 -0
  44. data/spec/dummy/app/controllers/catalog_controller.rb +170 -0
  45. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  46. data/spec/dummy/app/models/solr_document.rb +33 -0
  47. data/spec/dummy/app/models/user.rb +22 -0
  48. data/spec/dummy/app/views/devise/confirmations/new.html.erb +12 -0
  49. data/spec/dummy/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  50. data/spec/dummy/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  51. data/spec/dummy/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  52. data/spec/dummy/app/views/devise/passwords/edit.html.erb +16 -0
  53. data/spec/dummy/app/views/devise/passwords/new.html.erb +12 -0
  54. data/spec/dummy/app/views/devise/registrations/edit.html.erb +29 -0
  55. data/spec/dummy/app/views/devise/registrations/new.html.erb +18 -0
  56. data/spec/dummy/app/views/devise/sessions/new.html.erb +17 -0
  57. data/spec/dummy/app/views/devise/shared/_links.erb +25 -0
  58. data/spec/dummy/app/views/devise/unlocks/new.html.erb +12 -0
  59. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  60. data/spec/dummy/config.ru +4 -0
  61. data/spec/dummy/config/SolrMarc/config-test.properties +37 -0
  62. data/spec/dummy/config/SolrMarc/config.properties +37 -0
  63. data/spec/dummy/config/SolrMarc/index.properties +97 -0
  64. data/spec/dummy/config/SolrMarc/index_scripts/dewey.bsh +47 -0
  65. data/spec/dummy/config/SolrMarc/index_scripts/format.bsh +126 -0
  66. data/spec/dummy/config/SolrMarc/translation_maps/README_MAPS +1 -0
  67. data/spec/dummy/config/SolrMarc/translation_maps/callnumber_map.properties +407 -0
  68. data/spec/dummy/config/SolrMarc/translation_maps/composition_era_map.properties +56 -0
  69. data/spec/dummy/config/SolrMarc/translation_maps/country_map.properties +379 -0
  70. data/spec/dummy/config/SolrMarc/translation_maps/format_map.properties +50 -0
  71. data/spec/dummy/config/SolrMarc/translation_maps/instrument_map.properties +101 -0
  72. data/spec/dummy/config/SolrMarc/translation_maps/language_map.properties +490 -0
  73. data/spec/dummy/config/application.rb +66 -0
  74. data/spec/dummy/config/boot.rb +6 -0
  75. data/spec/dummy/config/database.yml +25 -0
  76. data/spec/dummy/config/environment.rb +5 -0
  77. data/spec/dummy/config/environments/development.rb +37 -0
  78. data/spec/dummy/config/environments/production.rb +67 -0
  79. data/spec/dummy/config/environments/test.rb +37 -0
  80. data/spec/dummy/config/fedora.yml +14 -0
  81. data/spec/dummy/config/initializers/action_dispatch_http_upload_monkey_patch.rb +12 -0
  82. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  83. data/spec/dummy/config/initializers/devise.rb +240 -0
  84. data/spec/dummy/config/initializers/hydra_config.rb +28 -0
  85. data/spec/dummy/config/initializers/inflections.rb +15 -0
  86. data/spec/dummy/config/initializers/mime_types.rb +12 -0
  87. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  88. data/spec/dummy/config/initializers/session_store.rb +8 -0
  89. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  90. data/spec/dummy/config/jetty.yml +5 -0
  91. data/spec/dummy/config/locales/devise.en.yml +59 -0
  92. data/spec/dummy/config/locales/en.yml +5 -0
  93. data/spec/dummy/config/role_map_cucumber.yml +10 -0
  94. data/spec/dummy/config/role_map_development.yml +12 -0
  95. data/spec/dummy/config/role_map_production.yml +2 -0
  96. data/spec/dummy/config/role_map_test.yml +15 -0
  97. data/spec/dummy/config/routes.rb +66 -0
  98. data/spec/dummy/config/solr.yml +10 -0
  99. data/spec/dummy/db/development.sqlite3 +0 -0
  100. data/spec/dummy/db/migrate/20130415215624_devise_create_users.rb +46 -0
  101. data/spec/dummy/db/migrate/20130415215633_create_searches.rb +16 -0
  102. data/spec/dummy/db/migrate/20130415215634_create_bookmarks.rb +18 -0
  103. data/spec/dummy/db/migrate/20130415215635_remove_editable_fields_from_bookmarks.rb +12 -0
  104. data/spec/dummy/db/migrate/20130415215636_add_user_types_to_bookmarks_searches.rb +16 -0
  105. data/spec/dummy/db/schema.rb +53 -0
  106. data/spec/dummy/db/seeds.rb +7 -0
  107. data/spec/dummy/db/test.sqlite3 +0 -0
  108. data/spec/dummy/doc/README_FOR_APP +2 -0
  109. data/spec/dummy/fedora_conf/conf/development/fedora.fcfg +953 -0
  110. data/spec/dummy/fedora_conf/conf/test/fedora.fcfg +953 -0
  111. data/spec/dummy/lib/generators/test_app_generator.rb +26 -0
  112. data/spec/dummy/log/development.log +78 -0
  113. data/spec/dummy/log/test.log +2372 -0
  114. data/spec/dummy/public/404.html +26 -0
  115. data/spec/dummy/public/422.html +26 -0
  116. data/spec/dummy/public/500.html +25 -0
  117. data/spec/dummy/public/favicon.ico +0 -0
  118. data/spec/dummy/public/index.html +241 -0
  119. data/spec/dummy/public/robots.txt +5 -0
  120. data/spec/dummy/script/rails +6 -0
  121. data/spec/dummy/solr_conf/conf/schema.xml +433 -0
  122. data/spec/dummy/solr_conf/conf/solrconfig.xml +158 -0
  123. data/spec/dummy/solr_conf/solr.xml +35 -0
  124. data/spec/dummy/test/performance/browsing_test.rb +12 -0
  125. data/spec/dummy/test/test_helper.rb +13 -0
  126. data/spec/factories/users.rb +13 -0
  127. data/spec/helpers/records_helper_spec.rb +20 -0
  128. data/spec/models/bookmark_spec.rb +7 -0
  129. data/spec/spec_helper.rb +23 -0
  130. data/spec/support/Gemfile +12 -0
  131. data/spec/support/audio.rb +18 -0
  132. data/spec/support/dummy_generator.rb +26 -0
  133. data/spec/support/lib/generators/test_app_generator.rb +26 -0
  134. metadata +410 -0
@@ -0,0 +1,28 @@
1
+ # The following lines determine which user attributes your hydrangea app will use
2
+ # This configuration allows you to use the out of the box ActiveRecord associations between users and user_attributes
3
+ # It also allows you to specify your own user attributes
4
+ # The easiest way to override these methods would be to create your own module to include in User
5
+ # For example you could create a module for your local LDAP instance called MyLocalLDAPUserAttributes:
6
+ # User.send(:include, MyLocalLDAPAttributes)
7
+ # As long as your module includes methods for full_name, affiliation, and photo the personalization_helper should function correctly
8
+ #
9
+
10
+ # windows doesn't properly require hydra-head (from the gemfile), so we need to require it explicitly here:
11
+ require 'hydra/head' unless defined? Hydra
12
+
13
+ if Hydra.respond_to?(:configure)
14
+ Hydra.configure(:shared) do |config|
15
+ # This specifies the solr field names of permissions-related fields.
16
+ # You only need to change these values if you've indexed permissions by some means other than the Hydra's built-in tooling.
17
+ # If you change these, you must also update the permissions request handler in your solrconfig.xml to return those values
18
+ indexer = Solrizer::Descriptor.new(:string, :stored, :indexed, :multivalued)
19
+ config[:permissions] = {
20
+ :discover => {:group =>ActiveFedora::SolrService.solr_name("discover_access_group", indexer), :individual=>ActiveFedora::SolrService.solr_name("discover_access_person", indexer)},
21
+ :read => {:group =>ActiveFedora::SolrService.solr_name("read_access_group", indexer), :individual=>ActiveFedora::SolrService.solr_name("read_access_person", indexer)},
22
+ :edit => {:group =>ActiveFedora::SolrService.solr_name("edit_access_group", indexer), :individual=>ActiveFedora::SolrService.solr_name("edit_access_person", indexer)},
23
+ :owner => ActiveFedora::SolrService.solr_name("depositor", indexer),
24
+ :embargo_release_date => ActiveFedora::SolrService.solr_name("embargo_release_date", Solrizer::Descriptor.new(:date, :stored, :indexed))
25
+ }
26
+
27
+ end
28
+ end
@@ -0,0 +1,15 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # ActiveSupport::Inflector.inflections do |inflect|
6
+ # inflect.plural /^(ox)$/i, '\1en'
7
+ # inflect.singular /^(ox)en/i, '\1'
8
+ # inflect.irregular 'person', 'people'
9
+ # inflect.uncountable %w( fish sheep )
10
+ # end
11
+ #
12
+ # These inflection rules are supported but not enabled by default:
13
+ # ActiveSupport::Inflector.inflections do |inflect|
14
+ # inflect.acronym 'RESTful'
15
+ # end
@@ -0,0 +1,12 @@
1
+ # Be sure to restart your server when you modify this file.Mime::Type.register_alias "text/plain", :refworks_marc_txt
2
+ Mime::Type.register_alias "text/plain", :openurl_kev
3
+ Mime::Type.register "application/x-endnote-refer", :endnote
4
+ Mime::Type.register "application/marc", :marc
5
+ Mime::Type.register "application/marcxml+xml", :marcxml,
6
+ ["application/x-marc+xml", "application/x-marcxml+xml",
7
+ "application/marc+xml"]
8
+
9
+
10
+ # Add new mime types for use in respond_to blocks:
11
+ # Mime::Type.register "text/richtext", :rtf
12
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ Dummy::Application.config.secret_token = '1b0b6b6ff3e3cd66e93cbc48ec160b031fc5fc755ea85b3c248142d4d9cbe1d0ee6209f8afff44cf16b71bf4c7b1abbfddbd1b4c5bcbc53f78c0ff80c413549f'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
4
+
5
+ # Use the database for sessions instead of the cookie-based default,
6
+ # which shouldn't be used to store highly confidential information
7
+ # (create the session table with "rails generate session_migration")
8
+ # Dummy::Application.config.session_store :active_record_store
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ #
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json]
9
+ end
10
+
11
+ # Disable root element in JSON by default.
12
+ ActiveSupport.on_load(:active_record) do
13
+ self.include_root_in_json = false
14
+ end
@@ -0,0 +1,5 @@
1
+ default:
2
+ jetty_port: 8983
3
+ java_opts:
4
+ - "-XX:MaxPermSize=128m"
5
+ - "-Xmx256m"
@@ -0,0 +1,59 @@
1
+ # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2
+
3
+ en:
4
+ devise:
5
+ confirmations:
6
+ confirmed: "Your account was successfully confirmed. You are now signed in."
7
+ send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes."
8
+ send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes."
9
+ failure:
10
+ already_authenticated: "You are already signed in."
11
+ inactive: "Your account was not activated yet."
12
+ invalid: "Invalid email or password."
13
+ invalid_token: "Invalid authentication token."
14
+ locked: "Your account is locked."
15
+ not_found_in_database: "Invalid email or password."
16
+ timeout: "Your session expired, please sign in again to continue."
17
+ unauthenticated: "You need to sign in or sign up before continuing."
18
+ unconfirmed: "You have to confirm your account before continuing."
19
+ mailer:
20
+ confirmation_instructions:
21
+ subject: "Confirmation instructions"
22
+ reset_password_instructions:
23
+ subject: "Reset password instructions"
24
+ unlock_instructions:
25
+ subject: "Unlock Instructions"
26
+ omniauth_callbacks:
27
+ failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
28
+ success: "Successfully authenticated from %{kind} account."
29
+ passwords:
30
+ no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
31
+ send_instructions: "You will receive an email with instructions about how to reset your password in a few minutes."
32
+ send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
33
+ updated: "Your password was changed successfully. You are now signed in."
34
+ updated_not_active: "Your password was changed successfully."
35
+ registrations:
36
+ destroyed: "Bye! Your account was successfully cancelled. We hope to see you again soon."
37
+ signed_up: "Welcome! You have signed up successfully."
38
+ signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
39
+ signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
40
+ signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please open the link to activate your account."
41
+ update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address."
42
+ updated: "You updated your account successfully."
43
+ sessions:
44
+ signed_in: "Signed in successfully."
45
+ signed_out: "Signed out successfully."
46
+ unlocks:
47
+ send_instructions: "You will receive an email with instructions about how to unlock your account in a few minutes."
48
+ send_paranoid_instructions: "If your account exists, you will receive an email with instructions about how to unlock it in a few minutes."
49
+ unlocked: "Your account has been unlocked successfully. Please sign in to continue."
50
+ errors:
51
+ messages:
52
+ already_confirmed: "was already confirmed, please try signing in"
53
+ confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
54
+ expired: "has expired, please request a new one"
55
+ not_found: "not found"
56
+ not_locked: "was not locked"
57
+ not_saved:
58
+ one: "1 error prohibited this %{resource} from being saved:"
59
+ other: "%{count} errors prohibited this %{resource} from being saved:"
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
@@ -0,0 +1,10 @@
1
+ archivist:
2
+ - archivist1@example.com
3
+ donor:
4
+ - donor1@example.com
5
+ researcher:
6
+ - researcher1@example.com
7
+ patron:
8
+ - patron1@example.com
9
+ admin_policy_object_editor:
10
+ - archivist1@example.com
@@ -0,0 +1,12 @@
1
+ uva-only:
2
+ - uva-only
3
+ archivist:
4
+ - archivist1@example.com
5
+ donor:
6
+ - donor1@example.com
7
+ researcher:
8
+ - researcher1@example.com
9
+ patron:
10
+ - patron1@example.com
11
+ admin_policy_object_editor:
12
+ - archivist1@example.com
@@ -0,0 +1,2 @@
1
+ uva-only:
2
+ public:
@@ -0,0 +1,15 @@
1
+ archivist:
2
+ - archivist1@example.com
3
+ - archivist2@example.com
4
+ - leland_himself@example.com
5
+ admin_policy_object_editor:
6
+ - archivist1@example.com
7
+ donor:
8
+ - donor1@example.com
9
+ - leland_himself@example.com
10
+ researcher:
11
+ - archivist1@example.com
12
+ - researcher1@example.com
13
+ patron:
14
+ - patron1@example.com
15
+ - leland_himself@example.com
@@ -0,0 +1,66 @@
1
+ Dummy::Application.routes.draw do
2
+ mount HydraEditor::Engine => "/"
3
+ root :to => "catalog#index"
4
+
5
+ Blacklight.add_routes(self)
6
+ HydraHead.add_routes(self)
7
+
8
+ devise_for :users
9
+
10
+ # The priority is based upon order of creation:
11
+ # first created -> highest priority.
12
+
13
+ # Sample of regular route:
14
+ # match 'products/:id' => 'catalog#view'
15
+ # Keep in mind you can assign values other than :controller and :action
16
+
17
+ # Sample of named route:
18
+ # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
19
+ # This route can be invoked with purchase_url(:id => product.id)
20
+
21
+ # Sample resource route (maps HTTP verbs to controller actions automatically):
22
+ # resources :products
23
+
24
+ # Sample resource route with options:
25
+ # resources :products do
26
+ # member do
27
+ # get 'short'
28
+ # post 'toggle'
29
+ # end
30
+ #
31
+ # collection do
32
+ # get 'sold'
33
+ # end
34
+ # end
35
+
36
+ # Sample resource route with sub-resources:
37
+ # resources :products do
38
+ # resources :comments, :sales
39
+ # resource :seller
40
+ # end
41
+
42
+ # Sample resource route with more complex sub-resources
43
+ # resources :products do
44
+ # resources :comments
45
+ # resources :sales do
46
+ # get 'recent', :on => :collection
47
+ # end
48
+ # end
49
+
50
+ # Sample resource route within a namespace:
51
+ # namespace :admin do
52
+ # # Directs /admin/products/* to Admin::ProductsController
53
+ # # (app/controllers/admin/products_controller.rb)
54
+ # resources :products
55
+ # end
56
+
57
+ # You can have the root of your site routed with "root"
58
+ # just remember to delete public/index.html.
59
+ # root :to => 'welcome#index'
60
+
61
+ # See how all your routes lay out with "rake routes"
62
+
63
+ # This is a legacy wild controller route that's not recommended for RESTful applications.
64
+ # Note: This route will make all actions in every controller accessible via GET requests.
65
+ # match ':controller(/:action(/:id))(.:format)'
66
+ end
@@ -0,0 +1,10 @@
1
+ # This is a sample config file that does not have multiple solr instances. You will also need to be sure to
2
+ # edit the fedora.yml file to match the solr URL for active-fedora.
3
+ development:
4
+ url: http://localhost:8983/solr/development
5
+ test: &TEST
6
+ url: <%= "http://127.0.0.1:#{ENV['TEST_JETTY_PORT'] || 8983}/solr/test" %>
7
+ cucumber:
8
+ <<: *TEST
9
+ production:
10
+ url: http://your.production.server:8080/bl_solr/core0
Binary file
@@ -0,0 +1,46 @@
1
+ class DeviseCreateUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table(:users) do |t|
4
+ ## Database authenticatable
5
+ t.string :email, :null => false, :default => ""
6
+ t.string :encrypted_password, :null => false, :default => ""
7
+
8
+ ## Recoverable
9
+ t.string :reset_password_token
10
+ t.datetime :reset_password_sent_at
11
+
12
+ ## Rememberable
13
+ t.datetime :remember_created_at
14
+
15
+ ## Trackable
16
+ t.integer :sign_in_count, :default => 0
17
+ t.datetime :current_sign_in_at
18
+ t.datetime :last_sign_in_at
19
+ t.string :current_sign_in_ip
20
+ t.string :last_sign_in_ip
21
+
22
+ ## Confirmable
23
+ # t.string :confirmation_token
24
+ # t.datetime :confirmed_at
25
+ # t.datetime :confirmation_sent_at
26
+ # t.string :unconfirmed_email # Only if using reconfirmable
27
+
28
+ ## Lockable
29
+ # t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
30
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
31
+ # t.datetime :locked_at
32
+
33
+ ## Token authenticatable
34
+ # t.string :authentication_token
35
+
36
+
37
+ t.timestamps
38
+ end
39
+
40
+ add_index :users, :email, :unique => true
41
+ add_index :users, :reset_password_token, :unique => true
42
+ # add_index :users, :confirmation_token, :unique => true
43
+ # add_index :users, :unlock_token, :unique => true
44
+ # add_index :users, :authentication_token, :unique => true
45
+ end
46
+ end
@@ -0,0 +1,16 @@
1
+ # -*- encoding : utf-8 -*-
2
+ class CreateSearches < ActiveRecord::Migration
3
+ def self.up
4
+ create_table :searches do |t|
5
+ t.text :query_params
6
+ t.integer :user_id
7
+
8
+ t.timestamps
9
+ end
10
+ add_index :searches, :user_id
11
+ end
12
+
13
+ def self.down
14
+ drop_table :searches
15
+ end
16
+ end
@@ -0,0 +1,18 @@
1
+ # -*- encoding : utf-8 -*-
2
+ class CreateBookmarks < ActiveRecord::Migration
3
+ def self.up
4
+ create_table :bookmarks do |t|
5
+ t.integer :user_id, :null=>false
6
+ t.text :url
7
+ t.string :document_id
8
+ t.string :title
9
+ t.text :notes
10
+ t.timestamps
11
+ end
12
+ end
13
+
14
+ def self.down
15
+ drop_table :bookmarks
16
+ end
17
+
18
+ end
@@ -0,0 +1,12 @@
1
+ # -*- encoding : utf-8 -*-
2
+ class RemoveEditableFieldsFromBookmarks < ActiveRecord::Migration
3
+ def self.up
4
+ remove_column :bookmarks, :notes
5
+ remove_column :bookmarks, :url
6
+ end
7
+
8
+ def self.down
9
+ add_column :bookmarks, :notes, :text
10
+ add_column :bookmarks, :url, :string
11
+ end
12
+ end
@@ -0,0 +1,16 @@
1
+ # -*- encoding : utf-8 -*-
2
+ class AddUserTypesToBookmarksSearches < ActiveRecord::Migration
3
+ def self.up
4
+ add_column :searches, :user_type, :string
5
+ add_column :bookmarks, :user_type, :string
6
+ Search.reset_column_information
7
+ Bookmark.reset_column_information
8
+ Search.update_all("user_type = 'user'")
9
+ Bookmark.update_all("user_type = 'user'")
10
+ end
11
+
12
+ def self.down
13
+ remove_column :searches, :user_type
14
+ remove_column :bookmarks, :user_type
15
+ end
16
+ end
@@ -0,0 +1,53 @@
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 => 20130415215636) do
15
+
16
+ create_table "bookmarks", :force => true do |t|
17
+ t.integer "user_id", :null => false
18
+ t.string "document_id"
19
+ t.string "title"
20
+ t.datetime "created_at", :null => false
21
+ t.datetime "updated_at", :null => false
22
+ t.string "user_type"
23
+ end
24
+
25
+ create_table "searches", :force => true do |t|
26
+ t.text "query_params"
27
+ t.integer "user_id"
28
+ t.datetime "created_at", :null => false
29
+ t.datetime "updated_at", :null => false
30
+ t.string "user_type"
31
+ end
32
+
33
+ add_index "searches", ["user_id"], :name => "index_searches_on_user_id"
34
+
35
+ create_table "users", :force => true do |t|
36
+ t.string "email", :default => "", :null => false
37
+ t.string "encrypted_password", :default => "", :null => false
38
+ t.string "reset_password_token"
39
+ t.datetime "reset_password_sent_at"
40
+ t.datetime "remember_created_at"
41
+ t.integer "sign_in_count", :default => 0
42
+ t.datetime "current_sign_in_at"
43
+ t.datetime "last_sign_in_at"
44
+ t.string "current_sign_in_ip"
45
+ t.string "last_sign_in_ip"
46
+ t.datetime "created_at", :null => false
47
+ t.datetime "updated_at", :null => false
48
+ end
49
+
50
+ add_index "users", ["email"], :name => "index_users_on_email", :unique => true
51
+ add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
52
+
53
+ end