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.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/subjects_controller.rb +3 -45
  3. data/app/models/enju_subject/ability.rb +4 -12
  4. data/app/models/subject.rb +4 -10
  5. data/app/models/subject_heading_type.rb +1 -3
  6. data/app/models/subject_sweeper.rb +1 -4
  7. data/app/views/manifestations/_subject_detail.html.erb +1 -1
  8. data/app/views/subjects/_form.html.erb +4 -14
  9. data/app/views/subjects/index.html.erb +44 -5
  10. data/app/views/subjects/show.html.erb +6 -36
  11. data/config/locales/translation_en.yml +0 -16
  12. data/config/locales/translation_ja.yml +1 -17
  13. data/config/routes.rb +4 -31
  14. data/db/migrate/20130504195916_add_subject_heading_type_id_to_subject.rb +5 -0
  15. data/lib/enju_subject/version.rb +1 -1
  16. data/lib/generators/enju_subject/setup/templates/db/fixtures/subject_heading_types.yml +31 -0
  17. data/spec/controllers/subjects_controller_spec.rb +0 -17
  18. data/spec/dummy/app/models/ability.rb +4 -12
  19. data/spec/dummy/db/development.sqlite3 +0 -0
  20. data/spec/dummy/db/schema.rb +5 -26
  21. data/spec/dummy/db/test.sqlite3 +0 -0
  22. data/spec/dummy/solr/data/test/index/segments.gen +0 -0
  23. data/spec/dummy/solr/data/test/index/segments_1ss +0 -0
  24. data/spec/fixtures/subjects.yml +5 -0
  25. data/spec/routing/subjects_routing_spec.rb +0 -4
  26. metadata +10 -37
  27. data/app/controllers/subject_heading_type_has_subjects_controller.rb +0 -80
  28. data/app/controllers/work_has_subjects_controller.rb +0 -107
  29. data/app/models/subject_heading_type_has_subject.rb +0 -22
  30. data/app/models/work_has_subject.rb +0 -32
  31. data/app/views/subjects/_index.html.erb +0 -48
  32. data/app/views/subjects/_index_work.html.erb +0 -60
  33. data/app/views/subjects/_show_work_list.html.erb +0 -15
  34. data/app/views/subjects/show.js.erb +0 -1
  35. data/app/views/work_has_subjects/_form.html.erb +0 -24
  36. data/app/views/work_has_subjects/edit.html.erb +0 -29
  37. data/app/views/work_has_subjects/index.html.erb +0 -31
  38. data/app/views/work_has_subjects/new.html.erb +0 -42
  39. data/app/views/work_has_subjects/show.html.erb +0 -25
  40. data/db/migrate/20080606052544_create_work_has_subjects.rb +0 -18
  41. data/db/migrate/20090208044541_create_subject_heading_type_has_subjects.rb +0 -16
  42. data/spec/controllers/subject_heading_type_has_subjects_controller_spec.rb +0 -447
  43. data/spec/controllers/work_has_subjects_controller_spec.rb +0 -439
  44. data/spec/dummy/solr/data/test/index/segments_1n5 +0 -0
  45. data/spec/factories/work_has_subject.rb +0 -6
  46. data/spec/fixtures/subject_heading_type_has_subjects.yml +0 -24
  47. data/spec/fixtures/work_has_subjects.yml +0 -33
  48. data/spec/models/subject_heading_type_has_subject_spec.rb +0 -20
  49. data/spec/models/work_has_subject_spec.rb +0 -21
@@ -1,60 +0,0 @@
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
- <h2 class="resource_title">
5
- [W]
6
- <%= link_to @work.original_title, @work -%>
7
- </h2>
8
-
9
- <%= form_for :subjects, :url => work_subjects_path(@work), :html => {:method => 'get'} do -%>
10
- <p>
11
- <%= t('page.search_term') -%>: <%= search_field_tag 'query', h(@query), {:id => 'search_form_top', :class => 'search_form', :placeholder => t('page.search_term')} -%>
12
- <%= submit_tag t('page.search') -%>
13
- <%- if can? :create, WorkHasSubject -%>
14
- <%= render 'page/add' %>
15
- <%- end -%>
16
- </p>
17
- <%- end -%>
18
-
19
- <table class="table table-striped index">
20
- <tr>
21
- <th><%= t('activerecord.attributes.subject.term') -%></th>
22
- <th></th>
23
- <th></th>
24
- </tr>
25
- <%- subjects.each do |subject| -%>
26
- <tr class="line<%= cycle("0", "1") -%>">
27
- <td><%= link_to subject.term, subject -%></td>
28
- <td>
29
- <%- if can? :update, subject -%>
30
- <%= link_to t('page.edit'), edit_subject_path(subject) -%>
31
- <% end %>
32
- </td>
33
- <td>
34
- <%- if params[:mode] == 'add' -%>
35
- <%- if can? :update, subject -%>
36
- <%= link_to t('page.edit'), edit_subject_path(subject) -%>
37
- <%= link_to t('page.add'), new_work_work_has_subject_path(@work, :subject_id => subject.id) unless @work.subjects.include?(subject) -%>
38
- <% end %>
39
- <%- else -%>
40
- <%- has_subject = @work.work_has_subjects.find_by_subject_id(subject) -%>
41
- <%- if can? :delete, has_subject -%>
42
- <%= link_to t('page.destroy'), work_work_has_subject_path(@work, has_subject), :data => {:confirm => t('page.are_you_sure')}, :method => :delete -%>
43
- <% end %>
44
- <%- end -%>
45
- </td>
46
- </tr>
47
- <%- end -%>
48
- </table>
49
-
50
- <%= paginate(subjects) -%>
51
- </div>
52
- </div>
53
-
54
- <div id="submenu" class="ui-corner-all">
55
- <ul>
56
- <%- if can? :create, Subject -%>
57
- <li><%= link_to t('page.new', :model => t('activerecord.models.subject')), new_work_subject_path(@work) -%></li>
58
- <%- end -%>
59
- </ul>
60
- </div>
@@ -1,15 +0,0 @@
1
- <div id="work">
2
- <h2 class="resource_title"><%= t('page.listing', :model => t('activerecord.models.work')) -%></h2>
3
- <table class="index">
4
- <%- @works.each do |work| -%>
5
- <tr class="line<%= cycle("0", "1") -%>">
6
- <td>
7
- [W]
8
- <%= render 'manifestations/show_index', :manifestation => work -%>
9
- </td>
10
- </tr>
11
- <%- end -%>
12
- </table>
13
-
14
- <%= paginate(@works, :param_name => :work_page, :remote => true) -%>
15
- </div>
@@ -1 +0,0 @@
1
- $("#work").html("<%= escape_javascript(render("show_work_list")) %>");
@@ -1,24 +0,0 @@
1
- <%= form_for(@work_has_subject) do |f| %>
2
- <% if @work_has_subject.errors.any? %>
3
- <div id="errorExplanation">
4
- <h2><%= pluralize(@work_has_subject.errors.count, "error") %> prohibited this work_has_subject from being saved:</h2>
5
- <ul>
6
- <% @work_has_subject.errors.full_messages.each do |msg| %>
7
- <li><%= msg %></li>
8
- <% end %>
9
- </ul>
10
- </div>
11
- <% end %>
12
-
13
- <div class="field">
14
- <%= f.label :work_id %><br />
15
- <%= f.text_field :work_id %>
16
- </div>
17
- <div class="field">
18
- <%= f.label :subject_id %><br />
19
- <%= f.text_field :subject_id %>
20
- </div>
21
- <div class="actions">
22
- <%= f.submit %>
23
- </div>
24
- <% end %>
@@ -1,29 +0,0 @@
1
- <div id="content_detail" class="ui-corner-all">
2
- <h1 class="title"><%= t('page.editing', :model => t('activerecord.models.work_has_subject')) -%></h1>
3
- <div id="content_list">
4
-
5
- <%= form_for(@work_has_subject) do |f| -%>
6
- <%= f.error_messages -%>
7
-
8
- <div class="field">
9
- <%= f.label :work -%><br />
10
- <%= f.text_field :work_id -%>
11
- </div>
12
- <div class="field">
13
- <%= f.label :subject -%><br />
14
- <%= f.text_field :subject_id -%>
15
- </div>
16
- <div class="actions">
17
- <%= f.submit %>
18
- </div>
19
- <%- end -%>
20
-
21
- </div>
22
- </div>
23
-
24
- <div id="submenu" class="ui-corner-all">
25
- <ul>
26
- <li><%= link_to t('page.show'), @work_has_subject -%></li>
27
- <li><%= link_to t('page.back'), work_has_subjects_path -%></li>
28
- </ul>
29
- </div>
@@ -1,31 +0,0 @@
1
- <div id="content_detail" class="ui-corner-all">
2
- <h1 class="title"><%= t('page.listing', :model => t('activerecord.models.work_has_subject')) -%></h1>
3
- <div id="content_list">
4
-
5
- <table class="table table-striped index">
6
- <tr>
7
- <th><%= t('activerecord.models.subject') -%></th>
8
- <th><%= t('activerecord.attributes.work_has_subject.work') -%></th>
9
- </tr>
10
-
11
- <%- @work_has_subjects.each do |work_has_subject| -%>
12
- <tr class="line<%= cycle("0", "1") -%>">
13
- <td><%= link_to work_has_subject.subject.term, work_has_subject.subject -%></td>
14
- <!-- TODO: Manifestation以外 -->
15
- <td><%= link_to work_has_subject.work.original_title, work_has_subject.work -%></td>
16
- <td><%= link_to t('page.show'), work_has_subject -%></td>
17
- <td><%= link_to t('page.edit'), edit_work_has_subject_path(work_has_subject) -%></td>
18
- <td><%= link_to t('page.destroy'), work_has_subject, :data => {:confirm => t('page.are_you_sure')}, :method => :delete -%></td>
19
- </tr>
20
- <%- end -%>
21
- </table>
22
-
23
- <%= paginate(@work_has_subjects) -%>
24
- </div>
25
- </div>
26
-
27
- <div id="submenu" class="ui-corner-all">
28
- <ul>
29
- <li><%= link_to t('page.new', :model => t('activerecord.models.work_has_subject')), new_work_has_subject_path -%></li>
30
- </ul>
31
- </div>
@@ -1,42 +0,0 @@
1
- <div id="content_detail" class="ui-corner-all">
2
- <h1 class="title"><%= t('page.new', :model => t('activerecord.models.work_has_subject')) -%></h1>
3
- <div id="content_list">
4
-
5
- <%= form_for(@work_has_subject) do |f| -%>
6
- <%= f.error_messages -%>
7
-
8
- <div class="field">
9
- <%= f.label :work -%><br />
10
- <%- if @work_has_subject.work -%>
11
- <%= link_to @work_has_subject.work.original_title, @work_has_subject.work -%>
12
- <%= f.hidden_field :work_id -%>
13
- <%- else -%>
14
- <%= f.text_field :work_id -%>
15
- <%- end -%>
16
- </div>
17
- <div class="field">
18
- <%= f.label :subject -%><br />
19
- <%- if @work_has_subject.subject -%>
20
- <%= link_to @work_has_subject.subject.term, @work_has_subject.subject -%>
21
- <%= f.hidden_field :subject_id -%>
22
- <%- else -%>
23
- <%= f.text_field :subject_id -%>
24
- <%- end -%>
25
- </div>
26
- <div class="actions">
27
- <%= f.submit %>
28
- </div>
29
- <%- end -%>
30
-
31
- </div>
32
- </div>
33
-
34
- <div id="submenu" class="ui-corner-all">
35
- <ul>
36
- <%- if @work -%>
37
- <li><%= link_to t('page.listing', :model => t('activerecord.models.work')), work_subjects_path(@work) -%></li>
38
- <%- else -%>
39
- <li><%= back_to_index -%></li>
40
- <%- end -%>
41
- </ul>
42
- </div>
@@ -1,25 +0,0 @@
1
- <div id="content_detail" class="ui-corner-all">
2
- <h1 class="title"><%= t('page.showing', :model => t('activerecord.models.work_has_subject')) -%></h1>
3
- <div id="content_list">
4
- <p id="notice"><%= notice %></p>
5
-
6
- <p>
7
- <strong><%= t('activerecord.attributes.work_has_subject.work') -%>:</strong>
8
- <!-- TODO: Manifestation以外 -->
9
- <%= link_to @work_has_subject.work.original_title, @work_has_subject.work if @work_has_subject.work -%>
10
- </p>
11
-
12
- <p>
13
- <strong><%= t('activerecord.attributes.work_has_subject.subject') -%>:</strong>
14
- <%= link_to @work_has_subject.subject.term, @work_has_subject.subject -%>
15
- </p>
16
-
17
- </div>
18
- </div>
19
-
20
- <div id="submenu" class="ui-corner-all">
21
- <ul>
22
- <li><%= link_to t('page.listing', :model => t('activerecord.models.work_has_subject')), work_has_subjects_path -%></li>
23
- <li><%= link_to t('page.listing', :model => t('activerecord.models.subject')), subjects_path -%></li>
24
- </ul>
25
- </div>
@@ -1,18 +0,0 @@
1
- class CreateWorkHasSubjects < ActiveRecord::Migration
2
- def self.up
3
- create_table :work_has_subjects do |t|
4
- t.references :subject, :polymorphic => true
5
- #t.references :subjectable, :polymorphic => true
6
- t.integer :work_id #, :null => false
7
- t.integer :position
8
-
9
- t.timestamps
10
- end
11
- add_index :work_has_subjects, :subject_id
12
- add_index :work_has_subjects, :work_id
13
- end
14
-
15
- def self.down
16
- drop_table :work_has_subjects
17
- end
18
- end
@@ -1,16 +0,0 @@
1
- class CreateSubjectHeadingTypeHasSubjects < ActiveRecord::Migration
2
- def self.up
3
- create_table :subject_heading_type_has_subjects do |t|
4
- t.integer :subject_id, :null => false
5
- t.string :subject_type
6
- t.integer :subject_heading_type_id, :null => false
7
-
8
- t.timestamps
9
- end
10
- add_index :subject_heading_type_has_subjects, :subject_id
11
- end
12
-
13
- def self.down
14
- drop_table :subject_heading_type_has_subjects
15
- end
16
- end