enju_subject 0.1.0.pre13 → 0.1.0.pre14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/subjects_controller.rb +3 -45
- data/app/models/enju_subject/ability.rb +4 -12
- data/app/models/subject.rb +4 -10
- data/app/models/subject_heading_type.rb +1 -3
- data/app/models/subject_sweeper.rb +1 -4
- data/app/views/manifestations/_subject_detail.html.erb +1 -1
- data/app/views/subjects/_form.html.erb +4 -14
- data/app/views/subjects/index.html.erb +44 -5
- data/app/views/subjects/show.html.erb +6 -36
- data/config/locales/translation_en.yml +0 -16
- data/config/locales/translation_ja.yml +1 -17
- data/config/routes.rb +4 -31
- data/db/migrate/20130504195916_add_subject_heading_type_id_to_subject.rb +5 -0
- data/lib/enju_subject/version.rb +1 -1
- data/lib/generators/enju_subject/setup/templates/db/fixtures/subject_heading_types.yml +31 -0
- data/spec/controllers/subjects_controller_spec.rb +0 -17
- data/spec/dummy/app/models/ability.rb +4 -12
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/schema.rb +5 -26
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/solr/data/test/index/segments.gen +0 -0
- data/spec/dummy/solr/data/test/index/segments_1ss +0 -0
- data/spec/fixtures/subjects.yml +5 -0
- data/spec/routing/subjects_routing_spec.rb +0 -4
- metadata +10 -37
- data/app/controllers/subject_heading_type_has_subjects_controller.rb +0 -80
- data/app/controllers/work_has_subjects_controller.rb +0 -107
- data/app/models/subject_heading_type_has_subject.rb +0 -22
- data/app/models/work_has_subject.rb +0 -32
- data/app/views/subjects/_index.html.erb +0 -48
- data/app/views/subjects/_index_work.html.erb +0 -60
- data/app/views/subjects/_show_work_list.html.erb +0 -15
- data/app/views/subjects/show.js.erb +0 -1
- data/app/views/work_has_subjects/_form.html.erb +0 -24
- data/app/views/work_has_subjects/edit.html.erb +0 -29
- data/app/views/work_has_subjects/index.html.erb +0 -31
- data/app/views/work_has_subjects/new.html.erb +0 -42
- data/app/views/work_has_subjects/show.html.erb +0 -25
- data/db/migrate/20080606052544_create_work_has_subjects.rb +0 -18
- data/db/migrate/20090208044541_create_subject_heading_type_has_subjects.rb +0 -16
- data/spec/controllers/subject_heading_type_has_subjects_controller_spec.rb +0 -447
- data/spec/controllers/work_has_subjects_controller_spec.rb +0 -439
- data/spec/dummy/solr/data/test/index/segments_1n5 +0 -0
- data/spec/factories/work_has_subject.rb +0 -6
- data/spec/fixtures/subject_heading_type_has_subjects.yml +0 -24
- data/spec/fixtures/work_has_subjects.yml +0 -33
- data/spec/models/subject_heading_type_has_subject_spec.rb +0 -20
- data/spec/models/work_has_subject_spec.rb +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f53eb252d1fbc6832322d735d57b15b11aa63269
|
4
|
+
data.tar.gz: 9736eb6d6466b072718346f43e7e27f5827a4f67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ff7f21843d3ea51a961d03d9fb4b54087caa3e66e69f05c174fbe62e4af4e106564d83ebad9df4605f742149032eb99bc725def840f8ba04ddc709bf11707a5
|
7
|
+
data.tar.gz: 4d0cee45a22718db76db002c067303aad88fbfc71fc4f416de65dadae46720e5bbad64ec99778e2665a5504312216dd811413243afd3d8f5b0603e81b11b07eb
|
@@ -2,7 +2,6 @@
|
|
2
2
|
class SubjectsController < ApplicationController
|
3
3
|
load_and_authorize_resource :except => :index
|
4
4
|
authorize_resource :only => :index
|
5
|
-
before_filter :get_work, :get_subject_heading_type
|
6
5
|
before_filter :prepare_options, :only => :new
|
7
6
|
after_filter :solr_commit, :only => [:create, :update, :destroy]
|
8
7
|
cache_sweeper :subject_sweeper, :only => [:create, :update, :destroy]
|
@@ -17,7 +16,7 @@ class SubjectsController < ApplicationController
|
|
17
16
|
end
|
18
17
|
sort[:order] = 'asc' if params[:order] == 'asc'
|
19
18
|
|
20
|
-
search = Subject.search
|
19
|
+
search = Subject.search
|
21
20
|
query = params[:query].to_s.strip
|
22
21
|
unless query.blank?
|
23
22
|
@query = query.dup
|
@@ -31,15 +30,6 @@ class SubjectsController < ApplicationController
|
|
31
30
|
order_by sort[:sort_by], sort[:order]
|
32
31
|
end
|
33
32
|
|
34
|
-
unless params[:mode] == 'add'
|
35
|
-
work = @work
|
36
|
-
subject_heading_type = @subject_heading_type
|
37
|
-
search.build do
|
38
|
-
with(:work_id).equal_to work.id if work
|
39
|
-
with(:subject_heading_type_ids).equal_to subject_heading_type.id if subject_heading_type
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
33
|
role = current_user.try(:role) || Role.default_role
|
44
34
|
search.build do
|
45
35
|
with(:required_role_id).less_than_or_equal_to role.id
|
@@ -70,11 +60,6 @@ class SubjectsController < ApplicationController
|
|
70
60
|
return
|
71
61
|
end
|
72
62
|
|
73
|
-
if @work
|
74
|
-
@subject = @work.subjects.find(params[:id])
|
75
|
-
#else
|
76
|
-
# @subject = Subject.find(params[:id])
|
77
|
-
end
|
78
63
|
search = Sunspot.new_search(Manifestation)
|
79
64
|
subject = @subject
|
80
65
|
search.build do
|
@@ -82,19 +67,16 @@ class SubjectsController < ApplicationController
|
|
82
67
|
end
|
83
68
|
page = params[:work_page] || 1
|
84
69
|
search.query.paginate(page.to_i, Manifestation.default_per_page)
|
85
|
-
@works = search.execute!.results
|
86
70
|
|
87
71
|
respond_to do |format|
|
88
72
|
format.html # show.html.erb
|
89
73
|
format.json { render :json => @subject }
|
90
|
-
format.js
|
91
74
|
end
|
92
75
|
end
|
93
76
|
|
94
77
|
# GET /subjects/new
|
95
78
|
def new
|
96
79
|
@subject = Subject.new
|
97
|
-
@subject.subject_heading_type_id = @subject_heading_type.id if @subject_heading_type
|
98
80
|
|
99
81
|
respond_to do |format|
|
100
82
|
format.html # new.html.erb
|
@@ -104,31 +86,18 @@ class SubjectsController < ApplicationController
|
|
104
86
|
|
105
87
|
# GET /subjects/1/edit
|
106
88
|
def edit
|
107
|
-
if @work
|
108
|
-
@subject = @work.subjects.find(params[:id])
|
109
|
-
#else
|
110
|
-
# @subject = Subject.find(params[:id])
|
111
|
-
end
|
112
|
-
@subject_types = SubjectType.all
|
113
89
|
end
|
114
90
|
|
115
91
|
# POST /subjects
|
116
92
|
# POST /subjects.json
|
117
93
|
def create
|
118
|
-
|
119
|
-
@subject = @work.subjects.new(params[:subject])
|
120
|
-
else
|
121
|
-
@subject = Subject.new(params[:subject])
|
122
|
-
end
|
123
|
-
subject_heading_type = SubjectHeadingType.find(@subject.subject_heading_type_id) if @subject.subject_heading_type_id.present?
|
94
|
+
@subject = Subject.new(params[:subject])
|
124
95
|
|
125
96
|
respond_to do |format|
|
126
97
|
if @subject.save
|
127
|
-
@subject.subject_heading_types << subject_heading_type if subject_heading_type
|
128
98
|
format.html { redirect_to @subject, :notice => t('controller.successfully_created', :model => t('activerecord.models.subject')) }
|
129
99
|
format.json { render :json => @subject, :status => :created, :location => @subject }
|
130
100
|
else
|
131
|
-
@subject_heading_type = subject_heading_type
|
132
101
|
prepare_options
|
133
102
|
format.html { render :action => "new" }
|
134
103
|
format.json { render :json => @subject.errors, :status => :unprocessable_entity }
|
@@ -139,12 +108,6 @@ class SubjectsController < ApplicationController
|
|
139
108
|
# PUT /subjects/1
|
140
109
|
# PUT /subjects/1.json
|
141
110
|
def update
|
142
|
-
if @work
|
143
|
-
@subject = @work.subjects.find(params[:id])
|
144
|
-
#else
|
145
|
-
# @subject = Subject.find(params[:id])
|
146
|
-
end
|
147
|
-
|
148
111
|
respond_to do |format|
|
149
112
|
if @subject.update_attributes(params[:subject])
|
150
113
|
format.html { redirect_to @subject, :notice => t('controller.successfully_updated', :model => t('activerecord.models.subject')) }
|
@@ -160,11 +123,6 @@ class SubjectsController < ApplicationController
|
|
160
123
|
# DELETE /subjects/1
|
161
124
|
# DELETE /subjects/1.json
|
162
125
|
def destroy
|
163
|
-
if @work
|
164
|
-
@subject = @work.subjects.find(params[:id])
|
165
|
-
#else
|
166
|
-
# @subject = Subject.find(params[:id])
|
167
|
-
end
|
168
126
|
@subject.destroy
|
169
127
|
|
170
128
|
respond_to do |format|
|
@@ -175,6 +133,6 @@ class SubjectsController < ApplicationController
|
|
175
133
|
|
176
134
|
private
|
177
135
|
def prepare_options
|
178
|
-
@
|
136
|
+
@subject_heading_types = SubjectHeadingType.select([:id, :display_name, :position])
|
179
137
|
end
|
180
138
|
end
|
@@ -7,10 +7,8 @@ module EnjuSubject
|
|
7
7
|
when 'Administrator'
|
8
8
|
can :manage, [
|
9
9
|
Classification,
|
10
|
-
Subject
|
11
|
-
SubjectHeadingTypeHasSubject
|
10
|
+
Subject
|
12
11
|
]
|
13
|
-
can :manage, WorkHasSubject
|
14
12
|
if LibraryGroup.site_config.network_access_allowed?(ip_address)
|
15
13
|
can [:read, :create, :update], ClassificationType
|
16
14
|
can [:destroy, :delete], ClassificationType do |classification_type|
|
@@ -30,32 +28,26 @@ module EnjuSubject
|
|
30
28
|
]
|
31
29
|
end
|
32
30
|
when 'Librarian'
|
33
|
-
can :manage, [
|
34
|
-
WorkHasSubject
|
35
|
-
]
|
36
31
|
can :read, [
|
37
32
|
Classification,
|
38
33
|
ClassificationType,
|
39
34
|
Subject,
|
40
35
|
SubjectType,
|
41
|
-
SubjectHeadingType
|
42
|
-
SubjectHeadingTypeHasSubject
|
36
|
+
SubjectHeadingType
|
43
37
|
]
|
44
38
|
when 'User'
|
45
39
|
can :read, [
|
46
40
|
Classification,
|
47
41
|
ClassificationType,
|
48
42
|
Subject,
|
49
|
-
SubjectHeadingType
|
50
|
-
WorkHasSubject
|
43
|
+
SubjectHeadingType
|
51
44
|
]
|
52
45
|
else
|
53
46
|
can :read, [
|
54
47
|
Classification,
|
55
48
|
ClassificationType,
|
56
49
|
Subject,
|
57
|
-
SubjectHeadingType
|
58
|
-
WorkHasSubject
|
50
|
+
SubjectHeadingType
|
59
51
|
]
|
60
52
|
end
|
61
53
|
end
|
data/app/models/subject.rb
CHANGED
@@ -1,25 +1,19 @@
|
|
1
1
|
class Subject < ActiveRecord::Base
|
2
2
|
attr_accessible :parent_id, :use_term_id, :term, :term_transcription,
|
3
|
-
:subject_type_id, :note, :required_role_id
|
3
|
+
:subject_type_id, :note, :required_role_id, :subject_heading_type_id
|
4
4
|
|
5
5
|
belongs_to :manifestation
|
6
6
|
belongs_to :subject_type
|
7
|
-
|
8
|
-
has_many :subject_heading_types, :through => :subject_heading_type_has_subjects
|
7
|
+
belongs_to :subject_heading_type
|
9
8
|
belongs_to :required_role, :class_name => 'Role', :foreign_key => 'required_role_id'
|
10
9
|
|
11
|
-
validates_associated :subject_type
|
12
|
-
validates_presence_of :term, :
|
13
|
-
|
14
|
-
attr_accessor :subject_heading_type_id
|
10
|
+
validates_associated :subject_type, :subject_heading_type
|
11
|
+
validates_presence_of :term, :subject_type_id #, :subject_heading_type_id
|
15
12
|
|
16
13
|
searchable do
|
17
14
|
text :term
|
18
15
|
time :created_at
|
19
16
|
integer :required_role_id
|
20
|
-
integer :work_id do
|
21
|
-
manifestation_id
|
22
|
-
end
|
23
17
|
end
|
24
18
|
|
25
19
|
normalize_attributes :term
|
@@ -1,9 +1,7 @@
|
|
1
1
|
class SubjectHeadingType < ActiveRecord::Base
|
2
2
|
attr_accessible :name, :display_name, :note
|
3
3
|
include MasterModel
|
4
|
-
|
5
|
-
has_many :subject_heading_type_has_subjects
|
6
|
-
has_many :subjects, :through => :subject_heading_type_has_subjects
|
4
|
+
has_many :subjects
|
7
5
|
end
|
8
6
|
|
9
7
|
# == Schema Information
|
@@ -1,6 +1,5 @@
|
|
1
1
|
class SubjectSweeper < ActionController::Caching::Sweeper
|
2
|
-
observe Subject, Classification
|
3
|
-
SubjectHeadingType
|
2
|
+
observe Subject, Classification
|
4
3
|
include ExpireEditableFragment
|
5
4
|
|
6
5
|
def after_save(record)
|
@@ -12,8 +11,6 @@ class SubjectSweeper < ActionController::Caching::Sweeper
|
|
12
11
|
end
|
13
12
|
when :Classification
|
14
13
|
expire_editable_fragment(record)
|
15
|
-
when :SubjectHeadingTypeHasSubject
|
16
|
-
expire_editable_fragment(record.subject)
|
17
14
|
end
|
18
15
|
end
|
19
16
|
|
@@ -5,7 +5,7 @@
|
|
5
5
|
<ul>
|
6
6
|
<%- manifestation.subjects.each do |subject| -%>
|
7
7
|
<li>
|
8
|
-
<%= link_to subject.term, manifestations_path(:query => "subject_sm:#{subject.term}") -%>
|
8
|
+
<%= link_to "#{subject.subject_heading_type.display_name.localize}: #{subject.term}", manifestations_path(:query => "subject_sm:#{subject.term}") -%>
|
9
9
|
</li>
|
10
10
|
<%- end -%>
|
11
11
|
</ul>
|
@@ -17,20 +17,10 @@
|
|
17
17
|
<%= f.label :note -%><br />
|
18
18
|
<%= f.text_area :note -%>
|
19
19
|
</div>
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
<%= f.hidden_field :classification_id -%>
|
25
|
-
</div>
|
26
|
-
<%- end -%>
|
27
|
-
<%- if @subject_heading_type -%>
|
28
|
-
<div class="field">
|
29
|
-
<%= f.label t('activerecord.models.subject_heading_type') -%>
|
30
|
-
<%= link_to @subject_heading_type.display_name.localize, @subject_heading_type -%>
|
31
|
-
<%= f.hidden_field :subject_heading_type_id -%>
|
32
|
-
</div>
|
33
|
-
<%- end -%>
|
20
|
+
<div class="field">
|
21
|
+
<%= f.label t('activerecord.models.subject_heading_type') -%>
|
22
|
+
<%= f.select(:subject_heading_type_id, @subject_heading_types.collect{|s| [s.display_name.localize, s.id]}) -%>
|
23
|
+
</div>
|
34
24
|
<div class="actions">
|
35
25
|
<%= f.submit %>
|
36
26
|
</div>
|
@@ -1,5 +1,44 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
<div id="content_detail" class="ui-corner-all">
|
2
|
+
<h1 class="title"><%= t('page.listing', :model => t('activerecord.models.subject')) -%></h1>
|
3
|
+
<div id="content_list">
|
4
|
+
|
5
|
+
<div class="search_form">
|
6
|
+
<%= form_for :subjects, :url => subjects_path, :html => {:method => 'get'} do -%>
|
7
|
+
<p>
|
8
|
+
<%= t('page.search_term') -%>: <%= search_field_tag 'query', h(@query), {:id => 'search_form_top', :class => 'search_form', :placeholder => t('page.search_term')} -%>
|
9
|
+
<%= submit_tag t('page.search') -%>
|
10
|
+
</p>
|
11
|
+
<%- end -%>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<table class="table table-striped index">
|
15
|
+
<tr>
|
16
|
+
<th><%= t('activerecord.attributes.subject.term') -%></th>
|
17
|
+
<th></th>
|
18
|
+
</tr>
|
19
|
+
<%- @subjects.each do |subject| -%>
|
20
|
+
<tr class="line<%= cycle("0", "1") -%>">
|
21
|
+
<td><%= link_to subject.term, subject -%></td>
|
22
|
+
<td>
|
23
|
+
<%- if can? :update, subject -%>
|
24
|
+
<%= link_to t('page.edit'), edit_subject_path(subject) -%>
|
25
|
+
<%- end -%>
|
26
|
+
<%- if can? :delete, subject -%>
|
27
|
+
<%= link_to t('page.destroy'), subject, :data => {:confirm => t('page.are_you_sure')}, :method => :delete -%>
|
28
|
+
<%- end -%>
|
29
|
+
</td>
|
30
|
+
</tr>
|
31
|
+
<%- end -%>
|
32
|
+
</table>
|
33
|
+
|
34
|
+
<%= paginate(@subjects) -%>
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<div id="submenu" class="ui-corner-all">
|
39
|
+
<ul>
|
40
|
+
<%- if can? :create, Subject -%>
|
41
|
+
<li><%= link_to t('page.new', :model => t('activerecord.models.subject')), new_subject_path -%></li>
|
42
|
+
<%- end -%>
|
43
|
+
</ul>
|
44
|
+
</div>
|
@@ -7,14 +7,10 @@
|
|
7
7
|
[S]
|
8
8
|
<%= @subject.term -%>
|
9
9
|
</h2>
|
10
|
-
<p>
|
11
|
-
(<%= link_to_wikipedia(@subject.term) -%>)
|
12
|
-
</p>
|
13
10
|
|
14
11
|
<p>
|
15
|
-
|
16
|
-
|
17
|
-
<%- end -%>
|
12
|
+
<strong><%= t('activerecord.models.subject_heading_type') -%>:</strong>
|
13
|
+
<%= link_to @subject.subject_heading_type.display_name.localize, @subject.subject_heading_type -%>
|
18
14
|
</p>
|
19
15
|
|
20
16
|
<p>
|
@@ -22,35 +18,10 @@
|
|
22
18
|
<%= @subject.term_transcription -%>
|
23
19
|
</p>
|
24
20
|
|
25
|
-
<
|
26
|
-
<
|
27
|
-
|
28
|
-
|
29
|
-
</ul>
|
30
|
-
<%= render 'subjects/show_work_list' -%>
|
31
|
-
<%- cache(:controller => :subjects, :action => :show, :id => @subject.id, :page => 'detail', :role => current_user_role_name, :locale => @locale, :subject_id => nil) do -%>
|
32
|
-
<div id="classification">
|
33
|
-
<table class="table table-striped index">
|
34
|
-
<tr>
|
35
|
-
<th><%= t('activerecord.attributes.classification.category') -%></th>
|
36
|
-
<th><%= t('activerecord.models.classification_type') -%></th>
|
37
|
-
</tr>
|
38
|
-
<%- @subject.classifications.each do |classification| -%>
|
39
|
-
<tr class="line<%= cycle("0", "1") -%>">
|
40
|
-
<td><%= link_to classification.category, classification -%></td>
|
41
|
-
<td><%= link_to classification.classification_type.name, classification.classification_type -%></td>
|
42
|
-
</tr>
|
43
|
-
<%- end -%>
|
44
|
-
</table>
|
45
|
-
|
46
|
-
<p>
|
47
|
-
<strong><%= t('activerecord.attributes.subject.note') -%>:</strong>
|
48
|
-
<%= @subject.note -%>
|
49
|
-
</p>
|
50
|
-
</div>
|
51
|
-
<%- end -%>
|
52
|
-
</div>
|
53
|
-
</div>
|
21
|
+
<p>
|
22
|
+
<strong><%= t('activerecord.attributes.subject.note') -%>:</strong>
|
23
|
+
<%= @subject.note -%>
|
24
|
+
</p>
|
54
25
|
</div>
|
55
26
|
|
56
27
|
<div id="submenu" class="ui-corner-all">
|
@@ -58,6 +29,5 @@
|
|
58
29
|
<li><%= back_to_index(flash[:page_info]) -%></li>
|
59
30
|
<li><%= link_to t('page.edit'), edit_subject_path(@subject) -%></li>
|
60
31
|
<li><%= link_to t('page.destroy'), subject_path(@subject), :data => {:confirm => t('page.are_you_sure')}, :method => :delete -%></li>
|
61
|
-
<li><%= link_to t('page.listing', :model => t('activerecord.models.subject_heading_type')), subject_subject_heading_types_path(@subject) -%></li>
|
62
32
|
</ul>
|
63
33
|
</div>
|
@@ -2,14 +2,10 @@ en:
|
|
2
2
|
activerecord:
|
3
3
|
models:
|
4
4
|
subject: Subject
|
5
|
-
work_has_subject: Resource has subject
|
6
5
|
subject_type: Subject type
|
7
6
|
subject_heading_type: Subject heading type
|
8
|
-
subject_heading_type_has_subject: Subject heading type to subject relationship
|
9
7
|
classification: Classification
|
10
8
|
classification_type: Classification type
|
11
|
-
subject_has_classification: Subject has classification
|
12
|
-
work: Work
|
13
9
|
|
14
10
|
attributes:
|
15
11
|
subject:
|
@@ -18,10 +14,6 @@ en:
|
|
18
14
|
scope_note: Scope note
|
19
15
|
note: Note
|
20
16
|
lock_version: Lock version
|
21
|
-
work_has_subject:
|
22
|
-
work: Work
|
23
|
-
subject: Subject
|
24
|
-
subjectable_type: Subjectable type
|
25
17
|
subject_type:
|
26
18
|
name: Name
|
27
19
|
display_name: Display name
|
@@ -32,7 +24,6 @@ en:
|
|
32
24
|
display_name: Display name
|
33
25
|
note: Note
|
34
26
|
position: Position
|
35
|
-
subject_heading_type_has_subject:
|
36
27
|
classification:
|
37
28
|
category: Category
|
38
29
|
name: Name
|
@@ -42,10 +33,3 @@ en:
|
|
42
33
|
display_name: Display name
|
43
34
|
note: Note
|
44
35
|
position: Position
|
45
|
-
subject_has_classification:
|
46
|
-
|
47
|
-
work_has_subject:
|
48
|
-
add_work: "Add a work"
|
49
|
-
add_subject: "Add a subject"
|
50
|
-
subjectable: "Subjectable"
|
51
|
-
|
@@ -2,14 +2,10 @@ ja:
|
|
2
2
|
activerecord:
|
3
3
|
models:
|
4
4
|
subject: 件名
|
5
|
-
work_has_subject: 資料と件名の関係
|
6
5
|
subject_type: 件名の種類
|
7
6
|
subject_heading_type: 件名標目の種類
|
8
|
-
subject_heading_type_has_subject: 件名標目と件名の関係
|
9
7
|
classification: 分類
|
10
|
-
classification_type:
|
11
|
-
subject_has_classification: 件名と分類の関係
|
12
|
-
work: 著作
|
8
|
+
classification_type: 分類の種類
|
13
9
|
|
14
10
|
attributes:
|
15
11
|
subject:
|
@@ -18,10 +14,6 @@ ja:
|
|
18
14
|
scope_note: スコープ注記
|
19
15
|
note: 注記
|
20
16
|
lock_version: ロックバージョン
|
21
|
-
work_has_subject:
|
22
|
-
work: 書いた資料
|
23
|
-
subject: 件名
|
24
|
-
subjectable_type: 件名付与対象の種類
|
25
17
|
subject_type:
|
26
18
|
name: 名前
|
27
19
|
display_name: 表示名
|
@@ -32,7 +24,6 @@ ja:
|
|
32
24
|
display_name: 表示名
|
33
25
|
note: 注記
|
34
26
|
position: 位置
|
35
|
-
subject_heading_type_has_subject:
|
36
27
|
classification:
|
37
28
|
category: カテゴリー
|
38
29
|
name: 名前
|
@@ -42,10 +33,3 @@ ja:
|
|
42
33
|
display_name: 表示名
|
43
34
|
note: 注記
|
44
35
|
position: 位置
|
45
|
-
subject_has_classification:
|
46
|
-
|
47
|
-
work_has_subject:
|
48
|
-
add_work: "書いた資料を追加する"
|
49
|
-
add_subject: "件名を追加する"
|
50
|
-
subjectable: "件名付与対象"
|
51
|
-
|
data/config/routes.rb
CHANGED
@@ -1,34 +1,7 @@
|
|
1
1
|
Rails.application.routes.draw do
|
2
|
-
resources :
|
3
|
-
resources :
|
4
|
-
|
5
|
-
end
|
6
|
-
resources :subject_heading_type_has_subjects
|
7
|
-
resources :classifications do
|
8
|
-
resources :subject_has_classifications
|
9
|
-
end
|
10
|
-
resources :classification_types do
|
11
|
-
resources :classifications
|
12
|
-
end
|
2
|
+
resources :subject_heading_types
|
3
|
+
resources :classification_types
|
4
|
+
resources :classifications
|
13
5
|
resources :subject_types
|
14
|
-
|
15
|
-
resources :work_has_subjects
|
16
|
-
|
17
|
-
resources :subjects do
|
18
|
-
resources :works, :controller => 'manifestations'
|
19
|
-
resources :subject_heading_types
|
20
|
-
resources :subject_has_classifications
|
21
|
-
resources :work_has_subjects
|
22
|
-
resources :classifications
|
23
|
-
end
|
24
|
-
|
25
|
-
resources :works, :controller => 'manifestations', :except => [:index, :new, :create] do
|
26
|
-
resources :subjects
|
27
|
-
resources :work_has_subjects
|
28
|
-
end
|
29
|
-
|
30
|
-
resources :manifestations do
|
31
|
-
resources :work_has_subjects
|
32
|
-
resources :subjects
|
33
|
-
end
|
6
|
+
resources :subjects
|
34
7
|
end
|
data/lib/enju_subject/version.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
---
|
2
|
+
subject_heading_type_00001:
|
3
|
+
name: NDLSH
|
4
|
+
display_name: NDLSH
|
5
|
+
updated_at: 2008-03-03 00:44:49.850140 +09:00
|
6
|
+
id: 1
|
7
|
+
note: ""
|
8
|
+
created_at: 2008-03-03 00:44:34.260739 +09:00
|
9
|
+
position: 1
|
10
|
+
subject_heading_type_00002:
|
11
|
+
name: BSH
|
12
|
+
display_name: BSH
|
13
|
+
updated_at: 2008-03-03 00:44:58.685360 +09:00
|
14
|
+
id: 2
|
15
|
+
note: ""
|
16
|
+
created_at: 2008-03-03 00:44:58.685360 +09:00
|
17
|
+
position: 2
|
18
|
+
|
19
|
+
# == Schema Information
|
20
|
+
#
|
21
|
+
# Table name: subject_heading_types
|
22
|
+
#
|
23
|
+
# id :integer not null, primary key
|
24
|
+
# name :string(255) not null
|
25
|
+
# display_name :text
|
26
|
+
# note :text
|
27
|
+
# position :integer
|
28
|
+
# created_at :datetime not null
|
29
|
+
# updated_at :datetime not null
|
30
|
+
#
|
31
|
+
|
@@ -45,12 +45,6 @@ describe SubjectsController do
|
|
45
45
|
response.should be_success
|
46
46
|
assigns(:subjects).should_not be_nil
|
47
47
|
end
|
48
|
-
|
49
|
-
it "assigns all subjects as @subjects with work_id" do
|
50
|
-
get :index, :work_id => 1
|
51
|
-
response.should be_success
|
52
|
-
assigns(:subjects).should_not be_nil
|
53
|
-
end
|
54
48
|
end
|
55
49
|
end
|
56
50
|
|
@@ -141,17 +135,6 @@ describe SubjectsController do
|
|
141
135
|
get :edit, :id => subject.id
|
142
136
|
assigns(:subject).should eq(subject)
|
143
137
|
end
|
144
|
-
|
145
|
-
it "should get edit with work" do
|
146
|
-
get :edit, :id => subjects(:subject_00001).id, :work_id => 1
|
147
|
-
assigns(:subject).should eq subjects(:subject_00001)
|
148
|
-
response.should be_success
|
149
|
-
end
|
150
|
-
|
151
|
-
it "should not get edit with missing work" do
|
152
|
-
get :edit, :id => subjects(:subject_00001).id, :work_id => 'missing'
|
153
|
-
response.should be_missing
|
154
|
-
end
|
155
138
|
end
|
156
139
|
|
157
140
|
describe "When logged in as Librarian" do
|
@@ -7,10 +7,8 @@
|
|
7
7
|
when 'Administrator'
|
8
8
|
can :manage, [
|
9
9
|
Classification,
|
10
|
-
Subject
|
11
|
-
SubjectHeadingTypeHasSubject
|
10
|
+
Subject
|
12
11
|
]
|
13
|
-
can :manage, WorkHasSubject
|
14
12
|
if LibraryGroup.site_config.network_access_allowed?(ip_address)
|
15
13
|
can [:read, :create, :update], ClassificationType
|
16
14
|
can [:destroy, :delete], ClassificationType do |classification_type|
|
@@ -31,16 +29,12 @@
|
|
31
29
|
end
|
32
30
|
can :read, Manifestation
|
33
31
|
when 'Librarian'
|
34
|
-
can :manage, [
|
35
|
-
WorkHasSubject
|
36
|
-
]
|
37
32
|
can :read, [
|
38
33
|
Classification,
|
39
34
|
ClassificationType,
|
40
35
|
Subject,
|
41
36
|
SubjectType,
|
42
|
-
SubjectHeadingType
|
43
|
-
SubjectHeadingTypeHasSubject
|
37
|
+
SubjectHeadingType
|
44
38
|
]
|
45
39
|
can :read, Manifestation
|
46
40
|
when 'User'
|
@@ -48,8 +42,7 @@
|
|
48
42
|
Classification,
|
49
43
|
ClassificationType,
|
50
44
|
Subject,
|
51
|
-
SubjectHeadingType
|
52
|
-
WorkHasSubject
|
45
|
+
SubjectHeadingType
|
53
46
|
]
|
54
47
|
can :read, Manifestation
|
55
48
|
else
|
@@ -57,8 +50,7 @@
|
|
57
50
|
Classification,
|
58
51
|
ClassificationType,
|
59
52
|
Subject,
|
60
|
-
SubjectHeadingType
|
61
|
-
WorkHasSubject
|
53
|
+
SubjectHeadingType
|
62
54
|
]
|
63
55
|
can :read, Manifestation
|
64
56
|
end
|
Binary file
|