enju_trunk_subject 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +36 -0
- data/app/controllers/classification_types_controller.rb +13 -0
- data/app/controllers/classifications_controller.rb +114 -0
- data/app/controllers/subject_has_classifications_controller.rb +97 -0
- data/app/controllers/subject_heading_type_has_subjects_controller.rb +80 -0
- data/app/controllers/subject_heading_types_controller.rb +13 -0
- data/app/controllers/subject_types_controller.rb +13 -0
- data/app/controllers/subjects_controller.rb +216 -0
- data/app/controllers/work_has_subjects_controller.rb +107 -0
- data/app/models/classification.rb +89 -0
- data/app/models/classification_type.rb +20 -0
- data/app/models/enju_subject/ability.rb +55 -0
- data/app/models/subject.rb +100 -0
- data/app/models/subject_has_classification.rb +37 -0
- data/app/models/subject_heading_type.rb +21 -0
- data/app/models/subject_heading_type_has_subject.rb +22 -0
- data/app/models/subject_type.rb +20 -0
- data/app/models/work_has_subject.rb +35 -0
- data/app/views/classification_types/_form.html.erb +19 -0
- data/app/views/classification_types/edit.html.erb +13 -0
- data/app/views/classification_types/index.html.erb +45 -0
- data/app/views/classification_types/new.html.erb +12 -0
- data/app/views/classification_types/show.html.erb +30 -0
- data/app/views/classifications/_form.html.erb +27 -0
- data/app/views/classifications/edit.html.erb +13 -0
- data/app/views/classifications/index.html.erb +54 -0
- data/app/views/classifications/new.html.erb +12 -0
- data/app/views/classifications/show.html.erb +34 -0
- data/app/views/manifestations/_classification_detail.html.erb +14 -0
- data/app/views/manifestations/_subject_detail.html.erb +14 -0
- data/app/views/manifestations/_subject_facet.html.erb +18 -0
- data/app/views/manifestations/_subject_form.html.erb +21 -0
- data/app/views/subject_has_classifications/edit.html.erb +30 -0
- data/app/views/subject_has_classifications/index.html.erb +38 -0
- data/app/views/subject_has_classifications/new.html.erb +32 -0
- data/app/views/subject_has_classifications/show.html.erb +22 -0
- data/app/views/subject_heading_type_has_subjects/edit.html.erb +28 -0
- data/app/views/subject_heading_type_has_subjects/index.html.erb +30 -0
- data/app/views/subject_heading_type_has_subjects/new.html.erb +27 -0
- data/app/views/subject_heading_type_has_subjects/show.html.erb +23 -0
- data/app/views/subject_heading_types/_form.html.erb +19 -0
- data/app/views/subject_heading_types/edit.html.erb +13 -0
- data/app/views/subject_heading_types/index.html.erb +43 -0
- data/app/views/subject_heading_types/new.html.erb +12 -0
- data/app/views/subject_heading_types/show.html.erb +27 -0
- data/app/views/subject_types/_form.html.erb +19 -0
- data/app/views/subject_types/edit.html.erb +13 -0
- data/app/views/subject_types/index.html.erb +43 -0
- data/app/views/subject_types/new.html.erb +12 -0
- data/app/views/subject_types/show.html.erb +29 -0
- data/app/views/subjects/_form.html.erb +42 -0
- data/app/views/subjects/_index.html.erb +48 -0
- data/app/views/subjects/_index_classification.html.erb +57 -0
- data/app/views/subjects/_index_work.html.erb +60 -0
- data/app/views/subjects/_show_work_list.html.erb +15 -0
- data/app/views/subjects/edit.html.erb +13 -0
- data/app/views/subjects/index.atom.builder +10 -0
- data/app/views/subjects/index.html.erb +7 -0
- data/app/views/subjects/index.rss.builder +29 -0
- data/app/views/subjects/new.html.erb +12 -0
- data/app/views/subjects/show.html.erb +69 -0
- data/app/views/subjects/show.js.erb +1 -0
- data/app/views/work_has_subjects/_form.html.erb +24 -0
- data/app/views/work_has_subjects/edit.html.erb +29 -0
- data/app/views/work_has_subjects/index.html.erb +31 -0
- data/app/views/work_has_subjects/new.html.erb +42 -0
- data/app/views/work_has_subjects/show.html.erb +25 -0
- data/config/locales/translation_en.yml +35 -0
- data/config/locales/translation_ja.yml +39 -0
- data/config/routes.rb +7 -0
- data/db/fixtures/classification_types.yml +7 -0
- data/db/fixtures/subject_types.yml +28 -0
- data/db/migrate/029_create_subjects.rb +28 -0
- data/db/migrate/142_create_classifications.rb +19 -0
- data/db/migrate/144_create_classification_types.rb +16 -0
- data/db/migrate/145_create_subject_heading_types.rb +16 -0
- data/db/migrate/146_create_subject_types.rb +16 -0
- data/db/migrate/20110913120629_add_lft_and_rgt_to_classification.rb +11 -0
- data/db/migrate/20140427142354_add_classifiation_identifier_to_classification.rb +6 -0
- data/lib/enju_subject.rb +33 -0
- data/lib/enju_subject/engine.rb +8 -0
- data/lib/enju_subject/manifestation.rb +31 -0
- data/lib/enju_subject/master_model.rb +41 -0
- data/lib/enju_subject/version.rb +3 -0
- data/lib/generators/enju_subject/setup/USAGE +8 -0
- data/lib/generators/enju_subject/setup/setup_generator.rb +10 -0
- data/lib/generators/enju_subject/setup/templates/db/fixtures/classification_types.yml +13 -0
- data/lib/generators/enju_subject/setup/templates/db/fixtures/subject_heading_types.yml +39 -0
- data/lib/generators/enju_subject/setup/templates/db/fixtures/subject_types.yml +28 -0
- data/lib/tasks/enju_subject_tasks.rake +19 -0
- data/spec/controllers/classification_types_controller_spec.rb +445 -0
- data/spec/controllers/classifications_controller_spec.rb +441 -0
- data/spec/controllers/subject_heading_types_controller_spec.rb +445 -0
- data/spec/controllers/subject_types_controller_spec.rb +447 -0
- data/spec/controllers/subjects_controller_spec.rb +437 -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 +47 -0
- data/spec/dummy/app/helpers/application_helper.rb +21 -0
- data/spec/dummy/app/models/ability.rb +59 -0
- data/spec/dummy/app/models/setting.rb +4 -0
- data/spec/dummy/app/models/user.rb +43 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +46 -0
- data/spec/dummy/config/application.yml +38 -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 +207 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -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/devise.en.yml +57 -0
- data/spec/dummy/config/locales/en.yml +18 -0
- data/spec/dummy/config/locales/ja.yml +18 -0
- data/spec/dummy/config/routes.rb +60 -0
- data/spec/dummy/db/fixtures/roles.yml +25 -0
- data/spec/dummy/db/migrate/001_create_agents.rb +53 -0
- data/spec/dummy/db/migrate/005_create_manifestations.rb +56 -0
- data/spec/dummy/db/migrate/006_create_items.rb +24 -0
- data/spec/dummy/db/migrate/012_create_owns.rb +12 -0
- data/spec/dummy/db/migrate/015_create_creates.rb +12 -0
- data/spec/dummy/db/migrate/047_create_produces.rb +12 -0
- data/spec/dummy/db/migrate/059_create_libraries.rb +28 -0
- data/spec/dummy/db/migrate/069_create_shelves.rb +15 -0
- data/spec/dummy/db/migrate/073_create_carrier_types.rb +11 -0
- data/spec/dummy/db/migrate/077_create_user_groups.rb +12 -0
- data/spec/dummy/db/migrate/080_create_library_groups.rb +18 -0
- data/spec/dummy/db/migrate/112_create_frequencies.rb +12 -0
- data/spec/dummy/db/migrate/117_create_form_of_works.rb +12 -0
- data/spec/dummy/db/migrate/120_create_baskets.rb +12 -0
- data/spec/dummy/db/migrate/124_create_bookstores.rb +17 -0
- data/spec/dummy/db/migrate/125_create_donates.rb +12 -0
- data/spec/dummy/db/migrate/130_create_request_status_types.rb +12 -0
- data/spec/dummy/db/migrate/131_create_request_types.rb +12 -0
- data/spec/dummy/db/migrate/20080830154109_create_realizes.rb +13 -0
- data/spec/dummy/db/migrate/20080830172106_create_exemplifies.rb +13 -0
- data/spec/dummy/db/migrate/20080905191442_create_agent_types.rb +12 -0
- data/spec/dummy/db/migrate/20081006090811_create_subscriptions.rb +17 -0
- data/spec/dummy/db/migrate/20081006093246_create_subscribes.rb +14 -0
- data/spec/dummy/db/migrate/20081023092436_create_search_engines.rb +17 -0
- data/spec/dummy/db/migrate/20081025083323_create_countries.rb +28 -0
- data/spec/dummy/db/migrate/20081025083905_create_languages.rb +23 -0
- data/spec/dummy/db/migrate/20081027150907_create_picture_files.rb +15 -0
- data/spec/dummy/db/migrate/20081028083142_create_agent_import_files.rb +22 -0
- data/spec/dummy/db/migrate/20081028083208_create_resource_import_files.rb +22 -0
- data/spec/dummy/db/migrate/20090705133942_add_attachments_picture_to_picture_file.rb +15 -0
- data/spec/dummy/db/migrate/20090705212043_add_attachments_attachment_to_manifestation.rb +15 -0
- data/spec/dummy/db/migrate/20090719201843_create_extents.rb +12 -0
- data/spec/dummy/db/migrate/20090720091106_create_medium_of_performances.rb +12 -0
- data/spec/dummy/db/migrate/20090720091429_create_content_types.rb +12 -0
- data/spec/dummy/db/migrate/20090812151902_create_agent_relationship_types.rb +12 -0
- data/spec/dummy/db/migrate/20091012101112_add_dcndl_schema.rb +27 -0
- data/spec/dummy/db/migrate/20091025080447_create_licenses.rb +12 -0
- data/spec/dummy/db/migrate/20091202124834_create_versions.rb +18 -0
- data/spec/dummy/db/migrate/20091214131723_create_series_statements.rb +13 -0
- data/spec/dummy/db/migrate/20100129142347_create_import_requests.rb +15 -0
- data/spec/dummy/db/migrate/20100211105551_add_admin_networks_to_library_group.rb +9 -0
- data/spec/dummy/db/migrate/20100223121519_rename_series_statement_title_to_original_title.rb +13 -0
- data/spec/dummy/db/migrate/20100321235924_add_series_statement_identifier_to_series_statement.rb +10 -0
- data/spec/dummy/db/migrate/20100525124311_create_manifestation_relationships.rb +13 -0
- data/spec/dummy/db/migrate/20100606073747_create_agent_relationships.rb +13 -0
- data/spec/dummy/db/migrate/20100607044753_create_manifestation_relationship_types.rb +12 -0
- data/spec/dummy/db/migrate/20100814091104_add_position_to_agent_relationship.rb +11 -0
- data/spec/dummy/db/migrate/20100925043847_create_resource_import_results.rb +15 -0
- data/spec/dummy/db/migrate/20100925074559_create_agent_import_results.rb +12 -0
- data/spec/dummy/db/migrate/20101212070145_add_acquired_at_to_item.rb +9 -0
- data/spec/dummy/db/migrate/20110222073537_add_url_to_library_group.rb +9 -0
- data/spec/dummy/db/migrate/20110301035123_add_pub_date_to_manifestation.rb +9 -0
- data/spec/dummy/db/migrate/20110301121550_add_birth_date_and_death_date_to_agent.rb +11 -0
- data/spec/dummy/db/migrate/20110425133109_add_issn_to_series_statement.rb +9 -0
- data/spec/dummy/db/migrate/20110603184217_add_edit_mode_to_resource_import_file.rb +9 -0
- data/spec/dummy/db/migrate/20110618091240_add_periodical_to_series_statement.rb +9 -0
- data/spec/dummy/db/migrate/20110619064807_add_edition_string_to_manifestation.rb +9 -0
- data/spec/dummy/db/migrate/20110620173525_add_bookstore_id_to_item.rb +11 -0
- data/spec/dummy/db/migrate/20110627034940_create_series_statement_merge_lists.rb +9 -0
- data/spec/dummy/db/migrate/20110627035057_create_series_statement_merges.rb +12 -0
- data/spec/dummy/db/migrate/20110627122938_add_number_of_day_to_notify_overdue_to_user_group.rb +13 -0
- data/spec/dummy/db/migrate/20110820131417_create_series_has_manifestations.rb +13 -0
- data/spec/dummy/db/migrate/20110916053430_rename_manifestation_number_list_to_number_string.rb +13 -0
- data/spec/dummy/db/migrate/20110916091020_add_volume_number_to_manifestation.rb +13 -0
- data/spec/dummy/db/migrate/20110916103953_add_manifestaiton_id_to_series_statement.rb +10 -0
- data/spec/dummy/db/migrate/20110918162329_add_note_to_series_statement.rb +9 -0
- data/spec/dummy/db/migrate/20111009183423_add_ndc_to_manifestation.rb +9 -0
- data/spec/dummy/db/migrate/20111124110059_create_create_types.rb +12 -0
- data/spec/dummy/db/migrate/20111124110319_create_realize_types.rb +12 -0
- data/spec/dummy/db/migrate/20111124110355_create_produce_types.rb +12 -0
- data/spec/dummy/db/migrate/20111124112131_add_create_type_to_create.rb +7 -0
- data/spec/dummy/db/migrate/20111201121844_create_roles.rb +12 -0
- data/spec/dummy/db/migrate/20111201155456_create_users.rb +8 -0
- data/spec/dummy/db/migrate/20111201155513_add_devise_to_users.rb +49 -0
- data/spec/dummy/db/migrate/20111201163718_create_user_has_roles.rb +10 -0
- data/spec/dummy/db/migrate/20120105074911_add_isil_to_library.rb +5 -0
- data/spec/dummy/db/migrate/20120125152919_add_title_subseries_transcription_to_series_statement.rb +6 -0
- data/spec/dummy/db/migrate/20120129014038_create_budget_types.rb +12 -0
- data/spec/dummy/db/migrate/20120129020544_add_budget_type_id_to_item.rb +6 -0
- data/spec/dummy/db/migrate/20120319120638_add_content_type_id_to_manifestation.rb +6 -0
- data/spec/dummy/db/migrate/20120319173203_create_accepts.rb +14 -0
- data/spec/dummy/db/migrate/20120410104851_add_year_of_publication_to_manifestation.rb +5 -0
- data/spec/dummy/db/migrate/20120413072700_add_picture_meta_to_picture_file.rb +5 -0
- data/spec/dummy/db/migrate/20120413100352_add_fingerprint_to_picture_file.rb +5 -0
- data/spec/dummy/db/migrate/20120413161340_add_fingerprint_to_resource_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20120413161403_add_fingerprint_to_agent_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20120413170705_add_error_message_to_resource_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20120413170720_add_error_message_to_agent_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20120415060308_rename_resource_import_file_imported_at_to_executed_at.rb +9 -0
- data/spec/dummy/db/migrate/20120415164821_add_attachment_meta_to_manifestation.rb +5 -0
- data/spec/dummy/db/migrate/20120418081407_add_month_of_publication_to_manifestation.rb +5 -0
- data/spec/dummy/db/migrate/20120510140958_add_closed_to_shelf.rb +5 -0
- data/spec/dummy/db/migrate/20120511072422_add_agent_identifier_to_agent.rb +6 -0
- data/spec/dummy/db/migrate/20120602141129_add_edit_mode_to_agent_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20130221154434_add_additional_attributes_to_user.rb +26 -0
- data/spec/dummy/db/migrate/20130421093852_add_periodical_to_manifestation.rb +5 -0
- data/spec/dummy/db/migrate/20130421155019_add_creator_string_to_series_statement.rb +7 -0
- data/spec/dummy/db/migrate/20130421164124_add_series_master_to_series_statement.rb +5 -0
- data/spec/dummy/db/migrate/20130506175303_create_identifier_types.rb +12 -0
- data/spec/dummy/db/migrate/20130506175834_create_identifiers.rb +15 -0
- data/spec/dummy/db/migrate/20130509185724_add_statement_of_responsibility_to_manifestation.rb +5 -0
- data/spec/dummy/db/schema.rb +901 -0
- data/spec/dummy/db/seeds.rb +32 -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/spec/fixtures/subjects.yml +72 -0
- data/spec/dummy/test/fixtures/user_groups.yml +13 -0
- data/spec/dummy/test/fixtures/user_has_roles.yml +9 -0
- data/spec/dummy/test/fixtures/users.yml +11 -0
- data/spec/dummy/test/unit/user_group_test.rb +7 -0
- data/spec/dummy/test/unit/user_has_role_test.rb +7 -0
- data/spec/dummy/test/unit/user_test.rb +7 -0
- data/spec/factories/classification.rb +6 -0
- data/spec/factories/classification_type.rb +5 -0
- data/spec/factories/manifestation.rb +6 -0
- data/spec/factories/subject.rb +7 -0
- data/spec/factories/subject_heading_type.rb +5 -0
- data/spec/factories/subject_heading_type_has_subject.rb +6 -0
- data/spec/factories/subject_type.rb +5 -0
- data/spec/factories/user.rb +34 -0
- data/spec/fixtures/agent_types.yml +35 -0
- data/spec/fixtures/agents.yml +143 -0
- data/spec/fixtures/carrier_types.yml +51 -0
- data/spec/fixtures/classification_types.yml +188 -0
- data/spec/fixtures/classifications.yml +118 -0
- data/spec/fixtures/languages.yml +1901 -0
- data/spec/fixtures/library_groups.yml +33 -0
- data/spec/fixtures/manifestations.yml +22 -0
- data/spec/fixtures/roles.yml +21 -0
- data/spec/fixtures/shtsv.tsv +3 -0
- data/spec/fixtures/subject_heading_types.yml +39 -0
- data/spec/fixtures/subject_types.yml +42 -0
- data/spec/fixtures/subjects.yml +80 -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/classification_spec.rb +46 -0
- data/spec/models/classification_type_spec.rb +21 -0
- data/spec/models/subject_heading_type_spec.rb +21 -0
- data/spec/models/subject_spec.rb +33 -0
- data/spec/models/subject_type_spec.rb +21 -0
- data/spec/requests/subjects_spec.rb +9 -0
- data/spec/routing/subject_heading_types_routing_spec.rb +35 -0
- data/spec/routing/subject_types_routing_spec.rb +35 -0
- data/spec/routing/subjects_routing_spec.rb +35 -0
- data/spec/spec_helper.rb +45 -0
- data/spec/support/controller_macros.rb +48 -0
- data/spec/support/devise.rb +3 -0
- metadata +675 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZTk0ZTg2MjgwNWNjMGYyNjVmYmQ3MjI0ODljY2M2ZGQyNGY3YjBiYQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MmUwYTNlMzQwZTk0ZDYwY2UxYzJjMmNlNjkzODk5OTBlY2FjMDUxZQ==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
Mjg5Y2RjNDk3ZThkMmJmYjBjOTRlNjA5YjBkNTA2NzcwOWM5N2ZmMmVhYTI0
|
10
|
+
ZTc5OGZhOGU1ZjYwY2U2ZjJmMDE0NjAxNDIwMjM2YmNlODYyYzAxNTI4OGU1
|
11
|
+
ZjgzOWY0OTBjMTAxZGMyMjVmZDNjMjAyM2RhZmEyNDhkZWExNmU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YzRmOGQ2YzVhZTU3MDY1NDMxZWUwNjU1ODFhMjNlZTBiNmFjMzU3M2ZjYzFl
|
14
|
+
MTE3ODFlZjlkZmNhOTQwY2E4Zjg4NWRjODc5ZDgxMTljYTUwZWZkODdiNWMz
|
15
|
+
ZTQxZmVlZDM4ZTRlOGY0MjMxYzBhOWU2OGU0ZmI3ZGU3Njc4ZmE=
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2012 Kosuke Tanabe
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'rdoc/task'
|
9
|
+
rescue LoadError
|
10
|
+
require 'rdoc/rdoc'
|
11
|
+
require 'rake/rdoctask'
|
12
|
+
RDoc::Task = Rake::RDocTask
|
13
|
+
end
|
14
|
+
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
17
|
+
rdoc.title = 'EnjuSubject'
|
18
|
+
rdoc.options << '--line-numbers'
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
+
end
|
22
|
+
|
23
|
+
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
24
|
+
load 'rails/tasks/engine.rake'
|
25
|
+
|
26
|
+
|
27
|
+
Bundler::GemHelper.install_tasks
|
28
|
+
|
29
|
+
require 'rspec/core'
|
30
|
+
require 'rspec/core/rake_task'
|
31
|
+
|
32
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
33
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
34
|
+
end
|
35
|
+
|
36
|
+
task :default => :spec
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class ClassificationTypesController < InheritedResources::Base
|
2
|
+
respond_to :html, :json
|
3
|
+
load_and_authorize_resource
|
4
|
+
|
5
|
+
def update
|
6
|
+
@classification_type = ClassificationType.find(params[:id])
|
7
|
+
if params[:move]
|
8
|
+
move_position(@classification_type, params[:move])
|
9
|
+
return
|
10
|
+
end
|
11
|
+
update!
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
class ClassificationsController < ApplicationController
|
3
|
+
load_and_authorize_resource :except => [:index]
|
4
|
+
before_filter :get_subject, :get_classification_type
|
5
|
+
after_filter :solr_commit, :only => [:create, :update, :destroy]
|
6
|
+
|
7
|
+
# GET /classifications
|
8
|
+
# GET /classifications.json
|
9
|
+
def index
|
10
|
+
search = Sunspot.new_search(Classification)
|
11
|
+
query = params[:query].to_s.strip
|
12
|
+
unless query.blank?
|
13
|
+
@query = query.dup
|
14
|
+
search.build do
|
15
|
+
fulltext query
|
16
|
+
end
|
17
|
+
end
|
18
|
+
unless params[:mode] == 'add'
|
19
|
+
subject = @subject
|
20
|
+
classification_type = @classification_type
|
21
|
+
search.build do
|
22
|
+
with(:subject_ids).equal_to subject.id if subject
|
23
|
+
with(:classification_type_id).equal_to classification_type.id if classification_type
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
page = params[:page] || 1
|
28
|
+
search.query.paginate(page.to_i, Classification.default_per_page)
|
29
|
+
@classifications = search.execute!.results
|
30
|
+
|
31
|
+
session[:params] = {} unless session[:params]
|
32
|
+
session[:params][:classification] = params
|
33
|
+
|
34
|
+
respond_to do |format|
|
35
|
+
format.html # index.html.erb
|
36
|
+
format.json { render :json => @classifications }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# GET /classifications/1
|
41
|
+
# GET /classifications/1.json
|
42
|
+
def show
|
43
|
+
respond_to do |format|
|
44
|
+
format.html # show.html.erb
|
45
|
+
format.json { render :json => @classification }
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# GET /classifications/new
|
50
|
+
# GET /classifications/new.json
|
51
|
+
def new
|
52
|
+
@classification_types = ClassificationType.all
|
53
|
+
@classification = Classification.new
|
54
|
+
@classification.classification_type = @classification_type
|
55
|
+
|
56
|
+
respond_to do |format|
|
57
|
+
format.html # new.html.erb
|
58
|
+
format.json { render :json => @classification }
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# GET /classifications/1/edit
|
63
|
+
def edit
|
64
|
+
@classification_types = ClassificationType.all
|
65
|
+
end
|
66
|
+
|
67
|
+
# POST /classifications
|
68
|
+
# POST /classifications.json
|
69
|
+
def create
|
70
|
+
@classification = Classification.new(params[:classification])
|
71
|
+
|
72
|
+
respond_to do |format|
|
73
|
+
if @classification.save
|
74
|
+
format.html { redirect_to @classification, :notice => t('controller.successfully_created', :model => t('activerecord.models.classification')) }
|
75
|
+
format.json { render :json => @classification, :status => :created, :location => @classification }
|
76
|
+
else
|
77
|
+
@classification_types = ClassificationType.all
|
78
|
+
format.html { render :action => "new" }
|
79
|
+
format.json { render :json => @classification.errors, :status => :unprocessable_entity }
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# PUT /classifications/1
|
85
|
+
# PUT /classifications/1.json
|
86
|
+
def update
|
87
|
+
respond_to do |format|
|
88
|
+
if @classification.update_attributes(params[:classification])
|
89
|
+
format.html { redirect_to @classification, :notice => t('controller.successfully_updated', :model => t('activerecord.models.classification')) }
|
90
|
+
format.json { head :no_content }
|
91
|
+
else
|
92
|
+
@classification_types = ClassificationType.all
|
93
|
+
format.html { render :action => "edit" }
|
94
|
+
format.json { render :json => @classification.errors, :status => :unprocessable_entity }
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
# DELETE /classifications/1
|
100
|
+
# DELETE /classifications/1.json
|
101
|
+
def destroy
|
102
|
+
@classification = Classification.find(params[:id])
|
103
|
+
@classification.destroy
|
104
|
+
|
105
|
+
respond_to do |format|
|
106
|
+
format.html { redirect_to classifications_url }
|
107
|
+
format.json { head :no_content }
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
def get_classification_type
|
112
|
+
@classification_type = ClassificationType.find(params[:classification_type_id]) rescue nil
|
113
|
+
end
|
114
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
class SubjectHasClassificationsController < ApplicationController
|
2
|
+
load_and_authorize_resource
|
3
|
+
before_filter :get_subject
|
4
|
+
before_filter :get_classification
|
5
|
+
|
6
|
+
# GET /subject_has_classifications
|
7
|
+
# GET /subject_has_classifications.json
|
8
|
+
def index
|
9
|
+
case when @subject
|
10
|
+
@subject_has_classifications = @subject.subject_has_classifications.page(params[:page])
|
11
|
+
when @classification
|
12
|
+
@subject_has_classifications = @classification.subject_has_classifications.page(params[:page])
|
13
|
+
else
|
14
|
+
@subject_has_classifications = SubjectHasClassification.page(params[:page])
|
15
|
+
end
|
16
|
+
|
17
|
+
respond_to do |format|
|
18
|
+
format.html # index.html.erb
|
19
|
+
format.json { render :json => @subject_has_classifications }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# GET /subject_has_classifications/1
|
24
|
+
# GET /subject_has_classifications/1.json
|
25
|
+
def show
|
26
|
+
respond_to do |format|
|
27
|
+
format.html # show.html.erb
|
28
|
+
format.json { render :json => @subject_has_classification }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# GET /subject_has_classifications/new
|
33
|
+
# GET /subject_has_classifications/new.json
|
34
|
+
def new
|
35
|
+
@subject_has_classification = SubjectHasClassification.new
|
36
|
+
@subject_has_classification.subject = @subject
|
37
|
+
@subject_has_classification.classification = @classification
|
38
|
+
|
39
|
+
respond_to do |format|
|
40
|
+
format.html # new.html.erb
|
41
|
+
format.json { render :json => @subject_has_classification }
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# GET /subject_has_classifications/1/edit
|
46
|
+
def edit
|
47
|
+
end
|
48
|
+
|
49
|
+
# POST /subject_has_classifications
|
50
|
+
# POST /subject_has_classifications.json
|
51
|
+
def create
|
52
|
+
@subject_has_classification = SubjectHasClassification.new(params[:subject_has_classification])
|
53
|
+
|
54
|
+
respond_to do |format|
|
55
|
+
if @subject_has_classification.save
|
56
|
+
format.html { redirect_to @subject_has_classification, :notice => t('controller.successfully_created', :model => t('activerecord.models.subject_has_classification')) }
|
57
|
+
format.json { render :json => @subject_has_classification, :status => :created, :location => @subject_has_classification }
|
58
|
+
else
|
59
|
+
format.html { render :action => "new" }
|
60
|
+
format.json { render :json => @subject_has_classification.errors, :status => :unprocessable_entity }
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# PUT /subject_has_classifications/1
|
66
|
+
# PUT /subject_has_classifications/1.json
|
67
|
+
def update
|
68
|
+
respond_to do |format|
|
69
|
+
if @subject_has_classification.update_attributes(params[:subject_has_classification])
|
70
|
+
format.html { redirect_to @subject_has_classification, :notice => t('controller.successfully_updated', :model => t('activerecord.models.subject_has_classification')) }
|
71
|
+
format.json { head :no_content }
|
72
|
+
else
|
73
|
+
format.html { render :action => "edit" }
|
74
|
+
format.json { render :json => @subject_has_classification.errors, :status => :unprocessable_entity }
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# DELETE /subject_has_classifications/1
|
80
|
+
# DELETE /subject_has_classifications/1.json
|
81
|
+
def destroy
|
82
|
+
@subject_has_classification.destroy
|
83
|
+
|
84
|
+
respond_to do |format|
|
85
|
+
format.html {
|
86
|
+
if @subject
|
87
|
+
redirect_to subject_subject_has_classifications_url(@subject)
|
88
|
+
elsif @classification
|
89
|
+
redirect_to classification_subject_has_classifications_url(@classification)
|
90
|
+
else
|
91
|
+
redirect_to subject_has_classifications_url
|
92
|
+
end
|
93
|
+
}
|
94
|
+
format.json { head :no_content }
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
class SubjectHeadingTypeHasSubjectsController < ApplicationController
|
2
|
+
load_and_authorize_resource
|
3
|
+
cache_sweeper :subject_sweeper, :only => [:create, :update, :destroy]
|
4
|
+
|
5
|
+
# GET /subject_heading_type_has_subjects
|
6
|
+
# GET /subject_heading_type_has_subjects.json
|
7
|
+
def index
|
8
|
+
@subject_heading_type_has_subjects = SubjectHeadingTypeHasSubject.page(params[:page])
|
9
|
+
|
10
|
+
respond_to do |format|
|
11
|
+
format.html # index.html.erb
|
12
|
+
format.json { render :json => @subject_heading_type_has_subjects }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# GET /subject_heading_type_has_subjects/1
|
17
|
+
# GET /subject_heading_type_has_subjects/1.json
|
18
|
+
def show
|
19
|
+
respond_to do |format|
|
20
|
+
format.html # show.html.erb
|
21
|
+
format.json { render :json => @subject_heading_type_has_subject }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# GET /subject_heading_type_has_subjects/new
|
26
|
+
# GET /subject_heading_type_has_subjects/new.json
|
27
|
+
def new
|
28
|
+
@subject_heading_type_has_subject = SubjectHeadingTypeHasSubject.new
|
29
|
+
|
30
|
+
respond_to do |format|
|
31
|
+
format.html # new.html.erb
|
32
|
+
format.json { render :json => @subject_heading_type_has_subject }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# GET /subject_heading_type_has_subjects/1/edit
|
37
|
+
def edit
|
38
|
+
end
|
39
|
+
|
40
|
+
# POST /subject_heading_type_has_subjects
|
41
|
+
# POST /subject_heading_type_has_subjects.json
|
42
|
+
def create
|
43
|
+
@subject_heading_type_has_subject = SubjectHeadingTypeHasSubject.new(params[:subject_heading_type_has_subject])
|
44
|
+
|
45
|
+
respond_to do |format|
|
46
|
+
if @subject_heading_type_has_subject.save
|
47
|
+
format.html { redirect_to @subject_heading_type_has_subject, :notice => 'SubjectHeadingTypeHasSubject was successfully created.' }
|
48
|
+
format.json { render :json => @subject_heading_type_has_subject, :status => :created, :location => @subject_heading_type_has_subject }
|
49
|
+
else
|
50
|
+
format.html { render :action => "new" }
|
51
|
+
format.json { render :json => @subject_heading_type_has_subject.errors, :status => :unprocessable_entity }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# PUT /subject_heading_type_has_subjects/1
|
57
|
+
# PUT /subject_heading_type_has_subjects/1.json
|
58
|
+
def update
|
59
|
+
respond_to do |format|
|
60
|
+
if @subject_heading_type_has_subject.update_attributes(params[:subject_heading_type_has_subject])
|
61
|
+
format.html { redirect_to @subject_heading_type_has_subject, :notice => 'SubjectHeadingTypeHasSubject was successfully updated.' }
|
62
|
+
format.json { head :no_content }
|
63
|
+
else
|
64
|
+
format.html { render :action => "edit" }
|
65
|
+
format.json { render :json => @subject_heading_type_has_subject.errors, :status => :unprocessable_entity }
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# DELETE /subject_heading_type_has_subjects/1
|
71
|
+
# DELETE /subject_heading_type_has_subjects/1.json
|
72
|
+
def destroy
|
73
|
+
@subject_heading_type_has_subject.destroy
|
74
|
+
|
75
|
+
respond_to do |format|
|
76
|
+
format.html { redirect_to subject_heading_type_has_subjects_url }
|
77
|
+
format.json { head :no_content }
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class SubjectHeadingTypesController < InheritedResources::Base
|
2
|
+
respond_to :html, :json
|
3
|
+
load_and_authorize_resource
|
4
|
+
|
5
|
+
def update
|
6
|
+
@subject_heading_type = SubjectHeadingType.find(params[:id])
|
7
|
+
if params[:move]
|
8
|
+
move_position(@subject_heading_type, params[:move])
|
9
|
+
return
|
10
|
+
end
|
11
|
+
update!
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class SubjectTypesController < InheritedResources::Base
|
2
|
+
respond_to :html, :json
|
3
|
+
load_and_authorize_resource
|
4
|
+
|
5
|
+
def update
|
6
|
+
@subject_type = SubjectType.find(params[:id])
|
7
|
+
if params[:move]
|
8
|
+
move_position(@subject_type, params[:move])
|
9
|
+
return
|
10
|
+
end
|
11
|
+
update!
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,216 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
class SubjectsController < ApplicationController
|
3
|
+
load_and_authorize_resource :except => :index
|
4
|
+
authorize_resource :only => :index
|
5
|
+
before_filter :get_work, :get_subject_heading_type, :get_classification
|
6
|
+
before_filter :prepare_options, :only => [:new, :edit]
|
7
|
+
after_filter :solr_commit, :only => [:create, :update, :destroy]
|
8
|
+
|
9
|
+
# GET /subjects
|
10
|
+
# GET /subjects.json
|
11
|
+
def index
|
12
|
+
sort = {:sort_by => 'created_at', :order => 'desc'}
|
13
|
+
case params[:sort_by]
|
14
|
+
when 'name'
|
15
|
+
sort[:sort_by] = 'term'
|
16
|
+
end
|
17
|
+
sort[:order] = 'asc' if params[:order] == 'asc'
|
18
|
+
|
19
|
+
search = Subject.search(:include => [:works])
|
20
|
+
query = params[:query].to_s.strip
|
21
|
+
unless query.blank?
|
22
|
+
@query = query.dup
|
23
|
+
query = query.gsub(' ', ' ')
|
24
|
+
search.build do
|
25
|
+
fulltext query
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
search.build do
|
30
|
+
order_by sort[:sort_by], sort[:order]
|
31
|
+
end
|
32
|
+
|
33
|
+
unless params[:mode] == 'add'
|
34
|
+
work = @work
|
35
|
+
classification = @classification
|
36
|
+
subject_heading_type = @subject_heading_type
|
37
|
+
search.build do
|
38
|
+
with(:work_ids).equal_to work.id if work
|
39
|
+
with(:classification_ids).equal_to classification.id if classification
|
40
|
+
with(:subject_heading_type_ids).equal_to subject_heading_type.id if subject_heading_type
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
role = current_user.try(:role) || Role.default_role
|
45
|
+
search.build do
|
46
|
+
with(:required_role_id).less_than_or_equal_to role.id
|
47
|
+
end
|
48
|
+
|
49
|
+
page = params[:page] || 1
|
50
|
+
search.query.paginate(page.to_i, Subject.default_per_page)
|
51
|
+
@subjects = search.execute!.results
|
52
|
+
session[:params] = {} unless session[:params]
|
53
|
+
session[:params][:subject] = params
|
54
|
+
|
55
|
+
flash[:page_info] = {:page => page, :query => query}
|
56
|
+
|
57
|
+
respond_to do |format|
|
58
|
+
format.html # index.html.erb
|
59
|
+
format.json { render :json => @subjects }
|
60
|
+
format.rss
|
61
|
+
format.atom
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# GET /subjects/1
|
66
|
+
# GET /subjects/1.json
|
67
|
+
def show
|
68
|
+
if params[:term]
|
69
|
+
subject = Subject.where(:term => params[:term]).first
|
70
|
+
redirected_to subject
|
71
|
+
return
|
72
|
+
end
|
73
|
+
|
74
|
+
if @work
|
75
|
+
@subject = @work.subjects.find(params[:id])
|
76
|
+
#else
|
77
|
+
# @subject = Subject.find(params[:id])
|
78
|
+
end
|
79
|
+
search = Sunspot.new_search(Manifestation)
|
80
|
+
subject = @subject
|
81
|
+
search.build do
|
82
|
+
with(:subject_ids).equal_to subject.id if subject
|
83
|
+
end
|
84
|
+
page = params[:work_page] || 1
|
85
|
+
search.query.paginate(page.to_i, Manifestation.default_per_page)
|
86
|
+
@works = search.execute!.results
|
87
|
+
|
88
|
+
respond_to do |format|
|
89
|
+
format.html # show.html.erb
|
90
|
+
format.json { render :json => @subject }
|
91
|
+
format.js
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
# GET /subjects/new
|
96
|
+
def new
|
97
|
+
@subject = Subject.new
|
98
|
+
@subject.classification_id = @classification.id if @classification
|
99
|
+
@subject.subject_heading_type_id = @subject_heading_type.id if @subject_heading_type
|
100
|
+
|
101
|
+
respond_to do |format|
|
102
|
+
format.html # new.html.erb
|
103
|
+
format.json { render :json => @subject }
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
# GET /subjects/1/edit
|
108
|
+
def edit
|
109
|
+
if @work
|
110
|
+
@subject = @work.subjects.find(params[:id])
|
111
|
+
else
|
112
|
+
@subject = Subject.find(params[:id])
|
113
|
+
@subject.subject_heading_type_id = @subject.subject_heading_type.id if @subject.subject_heading_type.present?
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
# POST /subjects
|
118
|
+
# POST /subjects.json
|
119
|
+
def create
|
120
|
+
if @work
|
121
|
+
@subject = @work.subjects.new(params[:subject])
|
122
|
+
else
|
123
|
+
@subject = Subject.new(params[:subject])
|
124
|
+
end
|
125
|
+
classification = Classification.find(@subject.classification_id) if @subject.classification_id.present?
|
126
|
+
subject_heading_type = SubjectHeadingType.find(@subject.subject_heading_type_id) if @subject.subject_heading_type_id.present?
|
127
|
+
|
128
|
+
respond_to do |format|
|
129
|
+
if @subject.save
|
130
|
+
#@subject.classifications << classification if classification
|
131
|
+
@subject.subject_heading_types << subject_heading_type if subject_heading_type
|
132
|
+
# @subject.subject_heading_type = subject_heading_type if subject_heading_type
|
133
|
+
format.html { redirect_to @subject, :notice => t('controller.successfully_created', :model => t('activerecord.models.subject')) }
|
134
|
+
format.json { render :json => @subject, :status => :created, :location => @subject }
|
135
|
+
else
|
136
|
+
@classification = classification
|
137
|
+
@subject_heading_type = subject_heading_type
|
138
|
+
prepare_options
|
139
|
+
format.html { render :action => "new" }
|
140
|
+
format.json { render :json => @subject.errors, :status => :unprocessable_entity }
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
# PUT /subjects/1
|
146
|
+
# PUT /subjects/1.json
|
147
|
+
def update
|
148
|
+
if @work
|
149
|
+
@subject = @work.subjects.find(params[:id])
|
150
|
+
else
|
151
|
+
@subject.assign_attributes(params[:subject])
|
152
|
+
end
|
153
|
+
|
154
|
+
classification = Classification.find(@subject.classification_id) if @subject.classification_id.present?
|
155
|
+
subject_heading_type = SubjectHeadingType.find(@subject.subject_heading_type_id) if @subject.subject_heading_type_id.present?
|
156
|
+
|
157
|
+
respond_to do |format|
|
158
|
+
if @subject.save
|
159
|
+
subject_heading_types = []
|
160
|
+
subject_heading_types << subject_heading_type if subject_heading_type
|
161
|
+
@subject.subject_heading_types = subject_heading_types
|
162
|
+
|
163
|
+
format.html { redirect_to @subject, :notice => t('controller.successfully_updated', :model => t('activerecord.models.subject')) }
|
164
|
+
format.json { head :no_content }
|
165
|
+
else
|
166
|
+
@classification = classification
|
167
|
+
@subject_heading_type = subject_heading_type
|
168
|
+
prepare_options
|
169
|
+
format.html { render :action => "edit" }
|
170
|
+
format.json { render :json => @subject.errors, :status => :unprocessable_entity }
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
# DELETE /subjects/1
|
176
|
+
# DELETE /subjects/1.json
|
177
|
+
def destroy
|
178
|
+
if @work
|
179
|
+
@subject = @work.subjects.find(params[:id])
|
180
|
+
#else
|
181
|
+
# @subject = Subject.find(params[:id])
|
182
|
+
end
|
183
|
+
@subject.destroy
|
184
|
+
|
185
|
+
respond_to do |format|
|
186
|
+
format.html { redirect_to subjects_url }
|
187
|
+
format.json { head :no_content }
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
# GET /subjects/search_name.json
|
192
|
+
def search_name
|
193
|
+
struct_subject = Struct.new(:id, :text, :term_transcription)
|
194
|
+
if params[:subject_id]
|
195
|
+
a = Subject.where(id: params[:subject_id]).select("id, term").first
|
196
|
+
result = nil
|
197
|
+
result = struct_subject.new(a.id, a.term)
|
198
|
+
else
|
199
|
+
subjects = Subject.where("term like '%#{params[:search_phrase]}%'").select("id, term, term_transcription").limit(10)
|
200
|
+
result = []
|
201
|
+
subjects.each do |subject|
|
202
|
+
result << struct_subject.new(subject.id, subject.term, subject.term_transcription)
|
203
|
+
end
|
204
|
+
end
|
205
|
+
respond_to do |format|
|
206
|
+
format.json { render :text => result.to_json }
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
private
|
211
|
+
|
212
|
+
def prepare_options
|
213
|
+
@subject_heading_types = SubjectHeadingType.select([:id, :display_name, :position])
|
214
|
+
@subject_types = SubjectType.all
|
215
|
+
end
|
216
|
+
end
|