enju_flower 0.1.0.pre11 → 0.1.0.pre12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/views/layouts/patrons.html.erb +2 -2
- data/app/views/manifestations/_index_form_contributor.html.erb +1 -1
- data/app/views/manifestations/_index_form_creator.html.erb +1 -1
- data/app/views/manifestations/_index_form_publisher.html.erb +1 -1
- data/app/views/manifestations/_manifestation_list.html.erb +6 -6
- data/app/views/manifestations/_show_creators.html.erb +4 -4
- data/app/views/manifestations/_show_creators.mobile.erb +4 -4
- data/app/views/manifestations/_title.html.erb +3 -3
- data/app/views/manifestations/_title.mobile.erb +3 -3
- data/app/views/manifestations/index.atom.builder +2 -2
- data/app/views/manifestations/index.html.erb +3 -3
- data/app/views/manifestations/index.opds.builder +2 -2
- data/app/views/manifestations/index.sru.builder +6 -6
- data/lib/enju_flower/version.rb +1 -1
- data/spec/controllers/manifestations_controller_spec.rb +5 -5
- data/spec/dummy/app/models/ability.rb +31 -31
- data/spec/dummy/app/models/{local_patron.rb → local_agent.rb} +1 -1
- data/spec/dummy/app/models/user.rb +5 -99
- data/spec/dummy/config/environments/test.rb +1 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/{001_create_patrons.rb → 001_create_agents.rb} +8 -8
- data/spec/dummy/db/migrate/012_create_owns.rb +2 -2
- data/spec/dummy/db/migrate/015_create_creates.rb +2 -2
- data/spec/dummy/db/migrate/035_create_reserves.rb +1 -1
- data/spec/dummy/db/migrate/047_create_produces.rb +2 -2
- data/spec/dummy/db/migrate/125_create_donates.rb +2 -2
- data/spec/dummy/db/migrate/20080830154109_create_realizes.rb +2 -2
- data/spec/dummy/db/migrate/{20080905191442_create_patron_types.rb → 20080905191442_create_agent_types.rb} +2 -2
- data/spec/dummy/db/migrate/20081028083142_create_agent_import_files.rb +22 -0
- data/spec/dummy/db/migrate/20090519203307_create_participates.rb +2 -2
- data/spec/dummy/db/migrate/{20090812151902_create_patron_relationship_types.rb → 20090812151902_create_agent_relationship_types.rb} +2 -2
- data/spec/dummy/db/migrate/20091012101112_add_dcndl_schema.rb +2 -2
- data/spec/dummy/db/migrate/20100606073747_create_agent_relationships.rb +13 -0
- data/spec/dummy/db/migrate/20100814091104_add_position_to_agent_relationship.rb +11 -0
- data/spec/dummy/db/migrate/20100925074559_create_agent_import_results.rb +12 -0
- data/spec/dummy/db/migrate/20110301121550_add_birth_date_and_death_date_to_agent.rb +11 -0
- data/spec/dummy/db/migrate/20111201155456_create_users.rb +0 -8
- data/spec/dummy/db/migrate/20120413161403_add_fingerprint_to_agent_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/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/schema.rb +152 -140
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/solr/data/test/index/{_1g9.frq → _23i.frq} +0 -0
- data/spec/dummy/solr/data/test/index/{_1g9.nrm → _23i.nrm} +1 -1
- data/spec/dummy/solr/data/test/index/{_1g9.prx → _23i.prx} +0 -0
- data/spec/dummy/solr/data/test/index/{_1g9.tii → _23i.tii} +0 -0
- data/spec/dummy/solr/data/test/index/{_1g9.tis → _23i.tis} +0 -0
- data/spec/dummy/solr/data/test/index/{_1gb.frq → _23k.frq} +0 -0
- data/spec/dummy/solr/data/test/index/{_1gb.nrm → _23k.nrm} +1 -1
- data/spec/dummy/solr/data/test/index/{_1gb.prx → _23k.prx} +0 -0
- data/spec/dummy/solr/data/test/index/{_1gb.tii → _23k.tii} +0 -0
- data/spec/dummy/solr/data/test/index/{_1gb.tis → _23k.tis} +0 -0
- data/spec/dummy/solr/data/test/index/segments.gen +0 -0
- data/spec/dummy/solr/data/test/index/segments_2u7 +0 -0
- data/spec/factories/{patron.rb → agent.rb} +3 -3
- data/spec/factories/agent_relationship.rb +6 -0
- data/spec/factories/agent_relationship_type.rb +5 -0
- data/spec/factories/agent_type.rb +5 -0
- data/spec/factories/create.rb +1 -1
- data/spec/factories/donate.rb +1 -1
- data/spec/factories/library.rb +13 -0
- data/spec/factories/own.rb +1 -1
- data/spec/factories/produce.rb +1 -1
- data/spec/factories/realize.rb +1 -1
- data/spec/factories/user.rb +33 -11
- data/spec/fixtures/{patron_relationship_types.yml → agent_relationship_types.yml} +4 -4
- data/spec/fixtures/{patron_relationships.yml → agent_relationships.yml} +4 -4
- data/spec/fixtures/{patron_types.yml → agent_types.yml} +4 -4
- data/spec/fixtures/{patrons.yml → agents.yml} +47 -47
- data/spec/fixtures/creates.yml +8 -8
- data/spec/fixtures/donates.yml +4 -4
- data/spec/fixtures/owns.yml +3 -3
- data/spec/fixtures/picture_files.yml +1 -1
- data/spec/fixtures/produces.yml +20 -20
- data/spec/fixtures/realizes.yml +11 -11
- metadata +103 -107
- data/spec/dummy/app/mailers/notifier.rb +0 -40
- data/spec/dummy/db/migrate/20081028083142_create_patron_import_files.rb +0 -22
- data/spec/dummy/db/migrate/20100606073747_create_patron_relationships.rb +0 -13
- data/spec/dummy/db/migrate/20100814091104_add_position_to_patron_relationship.rb +0 -11
- data/spec/dummy/db/migrate/20100925074559_create_patron_import_results.rb +0 -12
- data/spec/dummy/db/migrate/20110301121550_add_birth_date_and_death_date_to_patron.rb +0 -11
- data/spec/dummy/db/migrate/20120413161403_add_fingerprint_to_patron_import_file.rb +0 -5
- data/spec/dummy/db/migrate/20120413170720_add_error_message_to_patron_import_file.rb +0 -5
- data/spec/dummy/db/migrate/20120415060323_rename_patron_import_file_imported_at_to_executed_at.rb +0 -9
- data/spec/dummy/db/migrate/20120511072422_add_patron_identifier_to_patron.rb +0 -6
- data/spec/dummy/db/migrate/20120602141129_add_edit_mode_to_patron_import_file.rb +0 -5
- data/spec/dummy/solr/data/test/index/segments_1zb +0 -0
- data/spec/factories/patron_relationship.rb +0 -6
- data/spec/factories/patron_relationship_type.rb +0 -5
- data/spec/factories/patron_type.rb +0 -5
- data/spec/fixtures/patron_import_files.yml +0 -47
- data/spec/fixtures/patron_import_results.yml +0 -29
- /data/spec/dummy/solr/data/test/index/{_1g9.fdt → _23i.fdt} +0 -0
- /data/spec/dummy/solr/data/test/index/{_1g9.fdx → _23i.fdx} +0 -0
- /data/spec/dummy/solr/data/test/index/{_1g9.fnm → _23i.fnm} +0 -0
- /data/spec/dummy/solr/data/test/index/{_1ga.fdt → _23j.fdt} +0 -0
- /data/spec/dummy/solr/data/test/index/{_1ga.fdx → _23j.fdx} +0 -0
- /data/spec/dummy/solr/data/test/index/{_1ga.fnm → _23j.fnm} +0 -0
- /data/spec/dummy/solr/data/test/index/{_1ga.frq → _23j.frq} +0 -0
- /data/spec/dummy/solr/data/test/index/{_1ga.nrm → _23j.nrm} +0 -0
- /data/spec/dummy/solr/data/test/index/{_1ga.prx → _23j.prx} +0 -0
- /data/spec/dummy/solr/data/test/index/{_1ga.tii → _23j.tii} +0 -0
- /data/spec/dummy/solr/data/test/index/{_1ga.tis → _23j.tis} +0 -0
- /data/spec/dummy/solr/data/test/index/{_1gb.fdt → _23k.fdt} +0 -0
- /data/spec/dummy/solr/data/test/index/{_1gb.fdx → _23k.fdx} +0 -0
- /data/spec/dummy/solr/data/test/index/{_1gb.fnm → _23k.fnm} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f015a77e10d34c4504527bd9308a867f00b66b0
|
4
|
+
data.tar.gz: 0614fc761afb6b3b8451732664ca5772afb3e39b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40eee03f3a20cf56eeb0deebbbde2720a459497d34bef2d0bf3bf6688bb0b3fa88bd0eadd3aaaa381f31a90d2b6637b173febed254f3eabc459c58445aeb6db1
|
7
|
+
data.tar.gz: ed3b4c55344614cea42755ebe3ddf52955d5c09294ab9502010470543d5af84990001b891333fd370013320409ab5b04541b91fa3731c89374dddcfdbb42c00d
|
@@ -5,8 +5,8 @@
|
|
5
5
|
<title><%= title(controller.controller_name) %></title>
|
6
6
|
<%= render 'page/include' %>
|
7
7
|
<%- if controller.action_name == 'index' -%>
|
8
|
-
<%= auto_discovery_link_tag(:rss, url_for(params.merge(:format => 'rss', :page => nil, :commit => nil, :only_path => true)), :title => (t('
|
9
|
-
<%= auto_discovery_link_tag(:atom, url_for(params.merge(:format => 'atom', :page => nil, :commit => nil, :only_path => true)), :title => (t('
|
8
|
+
<%= auto_discovery_link_tag(:rss, url_for(params.merge(:format => 'rss', :page => nil, :commit => nil, :only_path => true)), :title => (t('agent.library_group_agent', :library_group_name => @library_group.display_name.localize) + " (RSS)")) %>
|
9
|
+
<%= auto_discovery_link_tag(:atom, url_for(params.merge(:format => 'atom', :page => nil, :commit => nil, :only_path => true)), :title => (t('agent.library_group_agent', :library_group_name => @library_group.display_name.localize) + " (Atom)")) %>
|
10
10
|
<%- end -%>
|
11
11
|
</head>
|
12
12
|
<body>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<div class="search_form">
|
2
|
-
<%= form_for :manifestations, :url => contributor_manifestations_path(@
|
2
|
+
<%= form_for :manifestations, :url => contributor_manifestations_path(@index_agent[:contributor]), :html => {:method => 'get'} do -%>
|
3
3
|
<p>
|
4
4
|
<%= label_tag :search_form_top, t('page.search_term') -%>:
|
5
5
|
<%= search_field_tag 'query', h(@query), {:id => 'search_form_top', :class => 'search_form', :placeholder => t('page.search_term')} -%>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<div class="search_form">
|
2
|
-
<%= form_for :manifestations, :url => creator_manifestations_path(@
|
2
|
+
<%= form_for :manifestations, :url => creator_manifestations_path(@index_agent[:creator]), :html => {:method => 'get'} do -%>
|
3
3
|
<p>
|
4
4
|
<%= label_tag :search_form_top, t('page.search_term') -%>:
|
5
5
|
<%= search_field_tag 'query', h(@query), {:id => 'search_form_top', :class => 'search_form', :placeholder => t('page.search_term')} -%>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<div class="search_form">
|
2
|
-
<%= form_for :manifestations, :url => publisher_manifestations_path(@
|
2
|
+
<%= form_for :manifestations, :url => publisher_manifestations_path(@index_agent[:publisher]), :html => {:method => 'get'} do -%>
|
3
3
|
<p>
|
4
4
|
<%= label_tag :search_form_top, t('page.search_term') -%>:
|
5
5
|
<%= search_field_tag 'query', h(@query), {:id => 'search_form_top', :class => 'search_form', :placeholder => t('page.search_term')} -%>
|
@@ -6,9 +6,9 @@
|
|
6
6
|
<%= link_to manifestation.original_title, manifestation -%>
|
7
7
|
<%= form_icon(manifestation.carrier_type) -%>
|
8
8
|
<%= link_to image_tag('icons/world_go.png', :size => '16x16', :alt => ('Web')), manifestation.access_address if manifestation.access_address? -%>
|
9
|
-
<%=
|
10
|
-
<%=
|
11
|
-
<%=
|
9
|
+
<%= agents_list(manifestation.creators.readable_by(current_user)) -%>
|
10
|
+
<%= agents_list(manifestation.contributors.readable_by(current_user)) -%>
|
11
|
+
<%= agents_list(manifestation.publishers.readable_by(current_user)) -%>
|
12
12
|
<%- if manifestation.pub_date? -%>
|
13
13
|
(<%= manifestation.pub_date -%>)
|
14
14
|
<%- end -%>
|
@@ -20,9 +20,9 @@
|
|
20
20
|
<%= link_to manifestation.original_title, manifestation -%>
|
21
21
|
<%= form_icon(manifestation.carrier_type) -%>
|
22
22
|
<%= link_to image_tag('icons/world_go.png', :size => '16x16', :alt => ('Web')), manifestation.access_address if manifestation.access_address? -%>
|
23
|
-
<%=
|
24
|
-
<%=
|
25
|
-
<%=
|
23
|
+
<%= agents_list(manifestation.creators.readable_by(current_user)) -%>
|
24
|
+
<%= agents_list(manifestation.contributors.readable_by(current_user)) -%>
|
25
|
+
<%= agents_list(manifestation.publishers.readable_by(current_user)) -%>
|
26
26
|
<%- if manifestation.pub_date? -%>
|
27
27
|
(<%= manifestation.pub_date -%>)
|
28
28
|
<%- end -%>
|
@@ -1,17 +1,17 @@
|
|
1
1
|
<%- if params[:mode] == 'show_all_creators' -%>
|
2
|
-
<%=
|
2
|
+
<%= agents_list(manifestation.creators.readable_by(current_user)) %>
|
3
3
|
<%- if manifestation.creators.readable_by(current_user).size > 5 -%>
|
4
4
|
(<a href="#" onclick="$.ajax({data:'authenticity_token=' + encodeURIComponent('<%= form_authenticity_token %>'), success:function(request){$('#creator_list_<%= manifestation.id %>').html(request);}, type:'get', url:'<%= manifestation_path(manifestation, :index_num => manifestation.id, :mode => 'show_creators') %>'}); return false;"><%= t('page.hide') %></a>)
|
5
5
|
<%- end -%>
|
6
6
|
<%- else -%>
|
7
|
-
<%=
|
7
|
+
<%= agents_list(manifestation.creators.readable_by(current_user)[0..2]) %>
|
8
8
|
<%- if manifestation.creators.readable_by(current_user).size > 5 -%>
|
9
9
|
(<a href="#" onclick="$.ajax({data:'authenticity_token=' + encodeURIComponent('<%= form_authenticity_token %>'), success:function(request){$('#creator_list_<%= manifestation.id %>').html(request);}, type:'get', url:'<%= manifestation_path(manifestation, :index_num => manifestation.id, :mode => 'show_all_creators') %>'}); return false;"><%= t('page.show_all') %></a>)
|
10
10
|
<%- end -%>
|
11
11
|
<%- end -%>
|
12
12
|
|
13
|
-
<%=
|
14
|
-
<%=
|
13
|
+
<%= agents_list(manifestation.contributors.readable_by(current_user)) %>
|
14
|
+
<%= agents_list(manifestation.publishers.readable_by(current_user)) %>
|
15
15
|
<%- if manifestation.pub_date.present? -%>
|
16
16
|
(<%= manifestation.pub_date -%>)
|
17
17
|
<%- end -%>
|
@@ -1,17 +1,17 @@
|
|
1
1
|
<%- if params[:mode] == 'show_all_creators' -%>
|
2
|
-
<%=
|
2
|
+
<%= agents_list(manifestation.creators.readable_by(current_user)) %>
|
3
3
|
<%- if manifestation.creators.readable_by(current_user).size > 5 -%>
|
4
4
|
(<a href="#" onclick="$.ajax({data:'authenticity_token=' + encodeURIComponent('<%= form_authenticity_token %>'), success:function(request){$('#creator_list_<%= manifestation.id %>').html(request);}, type:'get', url:'<%= manifestation_path(manifestation, :index_num => manifestation.id, :mode => 'show_creators') %>'}); return false;"><%= t('page.hide') %></a>)
|
5
5
|
<%- end -%>
|
6
6
|
<%- else -%>
|
7
|
-
<%=
|
7
|
+
<%= agents_list(manifestation.creators.readable_by(current_user)[0..2]) %>
|
8
8
|
<%- if manifestation.creators.readable_by(current_user).size > 5 -%>
|
9
9
|
(<a href="#" onclick="$.ajax({data:'authenticity_token=' + encodeURIComponent('<%= form_authenticity_token %>'), success:function(request){$('#creator_list_<%= manifestation.id %>').html(request);}, type:'get', url:'<%= manifestation_path(manifestation, :index_num => manifestation.id, :mode => 'show_all_creators') %>'}); return false;"><%= t('page.show_all') %></a>)
|
10
10
|
<%- end -%>
|
11
11
|
<%- end -%>
|
12
12
|
|
13
|
-
<%=
|
14
|
-
<%=
|
13
|
+
<%= agents_list(manifestation.contributors.readable_by(current_user)) %>
|
14
|
+
<%= agents_list(manifestation.publishers.readable_by(current_user)) %>
|
15
15
|
<%- if manifestation.pub_date.present? -%>
|
16
16
|
(<%= manifestation.pub_date -%>)
|
17
17
|
<%- end -%>
|
@@ -7,13 +7,13 @@
|
|
7
7
|
<p>
|
8
8
|
<%= manifestation.statement_of_responsibility %><br />
|
9
9
|
<%- unless manifestation.creators.readable_by(current_user).empty? -%>
|
10
|
-
<%= t('
|
10
|
+
<%= t('agent.creator') -%>: <%= agents_list(manifestation.creators.readable_by(current_user), :itemprop => 'author') -%>
|
11
11
|
<%- end -%>
|
12
12
|
<%- unless manifestation.contributors.readable_by(current_user).empty? -%>
|
13
|
-
<%= t('
|
13
|
+
<%= t('agent.contributor') -%>: <%= agents_list(manifestation.contributors.readable_by(current_user), :itemprop => 'editor') -%>
|
14
14
|
<%- end -%>
|
15
15
|
<%- unless manifestation.publishers.readable_by(current_user).empty? -%>
|
16
|
-
<%= t('
|
16
|
+
<%= t('agent.publisher') -%>: <%= agents_list(manifestation.publishers.readable_by(current_user), :itemprop => 'publisher') -%>
|
17
17
|
<% end %>
|
18
18
|
<%- if manifestation.date_of_publication? -%>
|
19
19
|
<meta itemprop="publishDate" content="<%= manifestation.date_of_publication.iso8601 %>" />
|
@@ -7,13 +7,13 @@
|
|
7
7
|
<p>
|
8
8
|
<%= manifestation.statement_of_responsibility %><br />
|
9
9
|
<%- unless manifestation.creators.readable_by(current_user).empty? -%>
|
10
|
-
<%= t('
|
10
|
+
<%= t('agent.creator') -%>: <%= agents_list(manifestation.creators.readable_by(current_user), :itemprop => 'author') -%>
|
11
11
|
<%- end -%>
|
12
12
|
<%- unless manifestation.contributors.readable_by(current_user).empty? -%>
|
13
|
-
<%= t('
|
13
|
+
<%= t('agent.contributor') -%>: <%= agents_list(manifestation.contributors.readable_by(current_user), :itemprop => 'editor') -%>
|
14
14
|
<%- end -%>
|
15
15
|
<%- unless manifestation.publishers.readable_by(current_user).empty? -%>
|
16
|
-
<%= t('
|
16
|
+
<%= t('agent.publisher') -%>: <%= agents_list(manifestation.publishers.readable_by(current_user), :itemprop => 'publisher') -%>
|
17
17
|
<% end %>
|
18
18
|
<%- if manifestation.date_of_publication? -%>
|
19
19
|
<meta itemprop="publishDate" content="<%= manifestation.date_of_publication.iso8601 %>" />
|
@@ -9,9 +9,9 @@ atom_feed(:url => manifestations_url(:format => :atom)) do |feed|
|
|
9
9
|
entry.content(manifestation.tags.join(' '), :type => 'html')
|
10
10
|
end
|
11
11
|
|
12
|
-
manifestation.creators.readable_by(current_user).each do |
|
12
|
+
manifestation.creators.readable_by(current_user).each do |agent|
|
13
13
|
entry.author do |author|
|
14
|
-
author.name(
|
14
|
+
author.name(agent.full_name)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -4,11 +4,11 @@
|
|
4
4
|
<%= render 'manifestations/title', :manifestation => @manifestation if @manifestation -%>
|
5
5
|
|
6
6
|
<% case %>
|
7
|
-
<% when @
|
7
|
+
<% when @index_agent[:creator] %>
|
8
8
|
<%= render 'index_form_creator' %>
|
9
|
-
<% when @
|
9
|
+
<% when @index_agent[:contributor] %>
|
10
10
|
<%= render 'index_form_contributor' %>
|
11
|
-
<% when @
|
11
|
+
<% when @index_agent[:publisher] %>
|
12
12
|
<%= render 'index_form_publisher' %>
|
13
13
|
<% when @manifestation %>
|
14
14
|
<%= render 'index_form_manifestation' %>
|
@@ -14,9 +14,9 @@ atom_feed(:url => manifestations_url(:format => :atom),
|
|
14
14
|
entry.content(manifestation.tags.join(' '), :type => 'html')
|
15
15
|
end
|
16
16
|
|
17
|
-
manifestation.creators.readable_by(current_user).each do |
|
17
|
+
manifestation.creators.readable_by(current_user).each do |agent|
|
18
18
|
entry.author do |author|
|
19
|
-
author.name(
|
19
|
+
author.name(agent.full_name)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -71,14 +71,14 @@ def get_record(manifestation)
|
|
71
71
|
'xsi:schemaLocation' => "info:srw/schema/1/dc-v1.1 http://www.loc.gov/standards/sru/dc-schema.xsd" do
|
72
72
|
cache([:manifestation => manifestation.id, :fragment => 'index_sru', :role => current_user_role_name, :locale => @locale]) do
|
73
73
|
xml.tag! 'dc:title', manifestation.original_title
|
74
|
-
manifestation.creators.readable_by(current_user).each do |
|
75
|
-
xml.tag! 'dc:creator',
|
74
|
+
manifestation.creators.readable_by(current_user).each do |agent|
|
75
|
+
xml.tag! 'dc:creator', agent.full_name
|
76
76
|
end
|
77
|
-
manifestation.contributors.each do |
|
78
|
-
xml.tag! 'dc:contributor',
|
77
|
+
manifestation.contributors.each do |agent|
|
78
|
+
xml.tag! 'dc:contributor', agent.full_name
|
79
79
|
end
|
80
|
-
manifestation.publishers.each do |
|
81
|
-
xml.tag! 'dc:publisher',
|
80
|
+
manifestation.publishers.each do |agent|
|
81
|
+
xml.tag! 'dc:publisher', agent.full_name
|
82
82
|
end
|
83
83
|
if defined?(EnjuSubject)
|
84
84
|
manifestation.subjects.each do |subject|
|
data/lib/enju_flower/version.rb
CHANGED
@@ -121,7 +121,7 @@ describe ManifestationsController do
|
|
121
121
|
it "should get index with publisher_id" do
|
122
122
|
get :index, :publisher_id => 1
|
123
123
|
response.should be_success
|
124
|
-
assigns(:manifestations).collect(&:id).should eq
|
124
|
+
assigns(:manifestations).collect(&:id).should eq Agent.find(1).manifestations.order('created_at DESC').collect(&:id)
|
125
125
|
end
|
126
126
|
|
127
127
|
it "should get index with query" do
|
@@ -188,9 +188,9 @@ describe ManifestationsController do
|
|
188
188
|
assigns(:manifestation).should eq(Manifestation.find(1))
|
189
189
|
end
|
190
190
|
|
191
|
-
it "should show manifestation with
|
192
|
-
get :show, :id => 3, :
|
193
|
-
assigns(:manifestation).should eq assigns(:
|
191
|
+
it "should show manifestation with agent who does not produce it" do
|
192
|
+
get :show, :id => 3, :agent_id => 3
|
193
|
+
assigns(:manifestation).should eq assigns(:agent).manifestations.find(3)
|
194
194
|
response.should be_success
|
195
195
|
end
|
196
196
|
end
|
@@ -209,7 +209,7 @@ describe ManifestationsController do
|
|
209
209
|
end
|
210
210
|
|
211
211
|
#it "should show myself" do
|
212
|
-
# get :show, :id => users(:user1).
|
212
|
+
# get :show, :id => users(:user1).agent
|
213
213
|
# response.should be_success
|
214
214
|
#end
|
215
215
|
end
|
@@ -26,10 +26,10 @@
|
|
26
26
|
ManifestationRelationship,
|
27
27
|
ManifestationRelationshipType,
|
28
28
|
Own,
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
Agent,
|
30
|
+
AgentImportFile,
|
31
|
+
AgentRelationship,
|
32
|
+
AgentRelationshipType,
|
33
33
|
PictureFile,
|
34
34
|
Produce,
|
35
35
|
ProduceType,
|
@@ -47,7 +47,7 @@
|
|
47
47
|
Language,
|
48
48
|
License,
|
49
49
|
MediumOfPerformance,
|
50
|
-
|
50
|
+
AgentType,
|
51
51
|
RequestStatusType,
|
52
52
|
RequestType
|
53
53
|
] if LibraryGroup.site_config.network_access_allowed?(ip_address)
|
@@ -61,8 +61,8 @@
|
|
61
61
|
Language,
|
62
62
|
License,
|
63
63
|
MediumOfPerformance,
|
64
|
-
|
65
|
-
|
64
|
+
AgentImportResult,
|
65
|
+
AgentType,
|
66
66
|
RequestStatusType,
|
67
67
|
RequestType,
|
68
68
|
ResourceImportResult
|
@@ -74,12 +74,12 @@
|
|
74
74
|
can [:destroy, :delete], Manifestation do |manifestation|
|
75
75
|
manifestation.items.empty? and !manifestation.series_master?
|
76
76
|
end
|
77
|
-
can [:index, :create],
|
78
|
-
can :show,
|
79
|
-
|
77
|
+
can [:index, :create], Agent
|
78
|
+
can :show, Agent do |agent|
|
79
|
+
agent.required_role_id <= 3
|
80
80
|
end
|
81
|
-
can [:update, :destroy, :delete],
|
82
|
-
!
|
81
|
+
can [:update, :destroy, :delete], Agent do |agent|
|
82
|
+
!agent.user.try(:has_role?, 'Librarian') and agent.required_role_id <= 3
|
83
83
|
end
|
84
84
|
can :manage, [
|
85
85
|
Create,
|
@@ -88,8 +88,8 @@
|
|
88
88
|
ImportRequest,
|
89
89
|
ManifestationRelationship,
|
90
90
|
Own,
|
91
|
-
|
92
|
-
|
91
|
+
AgentImportFile,
|
92
|
+
AgentRelationship,
|
93
93
|
PictureFile,
|
94
94
|
Produce,
|
95
95
|
Realize,
|
@@ -106,9 +106,9 @@
|
|
106
106
|
Language,
|
107
107
|
License,
|
108
108
|
ManifestationRelationshipType,
|
109
|
-
|
110
|
-
|
111
|
-
|
109
|
+
AgentImportResult,
|
110
|
+
AgentRelationshipType,
|
111
|
+
AgentType,
|
112
112
|
RequestStatusType,
|
113
113
|
RequestType,
|
114
114
|
ResourceImportResult,
|
@@ -123,15 +123,15 @@
|
|
123
123
|
can [:show, :edit], Manifestation do |manifestation|
|
124
124
|
manifestation.required_role_id <= 2
|
125
125
|
end
|
126
|
-
can :index,
|
127
|
-
can :update,
|
128
|
-
|
126
|
+
can :index, Agent
|
127
|
+
can :update, Agent do |agent|
|
128
|
+
agent.user == user
|
129
129
|
end
|
130
|
-
can :show,
|
131
|
-
#if
|
130
|
+
can :show, Agent do |agent|
|
131
|
+
#if agent.user == user
|
132
132
|
# true
|
133
|
-
#elsif
|
134
|
-
true if
|
133
|
+
#elsif agent.user != user
|
134
|
+
true if agent.required_role_id <= 2 #name == 'Administrator'
|
135
135
|
#end
|
136
136
|
end
|
137
137
|
can :index, PictureFile
|
@@ -157,8 +157,8 @@
|
|
157
157
|
ManifestationRelationshipType,
|
158
158
|
MediumOfPerformance,
|
159
159
|
Own,
|
160
|
-
|
161
|
-
|
160
|
+
AgentRelationship,
|
161
|
+
AgentRelationshipType,
|
162
162
|
Produce,
|
163
163
|
Realize,
|
164
164
|
SeriesStatement
|
@@ -168,9 +168,9 @@
|
|
168
168
|
can :show, Manifestation do |manifestation|
|
169
169
|
manifestation.required_role_id == 1
|
170
170
|
end
|
171
|
-
can :index,
|
172
|
-
can :show,
|
173
|
-
|
171
|
+
can :index, Agent
|
172
|
+
can :show, Agent do |agent|
|
173
|
+
agent.required_role_id == 1 #name == 'Guest'
|
174
174
|
end
|
175
175
|
can :read, [
|
176
176
|
CarrierType,
|
@@ -188,8 +188,8 @@
|
|
188
188
|
ManifestationRelationshipType,
|
189
189
|
MediumOfPerformance,
|
190
190
|
Own,
|
191
|
-
|
192
|
-
|
191
|
+
AgentRelationship,
|
192
|
+
AgentRelationshipType,
|
193
193
|
PictureFile,
|
194
194
|
Produce,
|
195
195
|
Realize,
|
@@ -1,102 +1,8 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
1
2
|
class User < ActiveRecord::Base
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
:recoverable, :rememberable, :trackable, :validatable
|
3
|
+
devise :database_authenticatable, #:registerable,
|
4
|
+
:recoverable, :rememberable, :trackable, #, :validatable
|
5
|
+
:lockable, :lock_strategy => :none, :unlock_strategy => :none
|
6
6
|
|
7
|
-
|
8
|
-
attr_accessible :email, :password, :password_confirmation, :remember_me
|
9
|
-
|
10
|
-
has_one :patron
|
11
|
-
has_one :user_has_role
|
12
|
-
has_one :role, :through => :user_has_role
|
13
|
-
belongs_to :user_group
|
14
|
-
belongs_to :required_role, :class_name => 'Role', :foreign_key => 'required_role_id'
|
15
|
-
has_many :checkouts, :dependent => :nullify
|
16
|
-
has_many :reserves, :dependent => :destroy
|
17
|
-
has_many :reserved_manifestations, :through => :reserves, :source => :manifestation
|
18
|
-
has_many :checkout_stat_has_users
|
19
|
-
has_many :user_checkout_stats, :through => :checkout_stat_has_users
|
20
|
-
has_many :reserve_stat_has_users
|
21
|
-
has_many :user_reserve_stats, :through => :reserve_stat_has_users
|
22
|
-
has_many :baskets, :dependent => :destroy
|
23
|
-
belongs_to :library
|
24
|
-
|
25
|
-
before_destroy :check_item_before_destroy
|
26
|
-
|
27
|
-
extend FriendlyId
|
28
|
-
friendly_id :username
|
29
|
-
|
30
|
-
def check_item_before_destroy
|
31
|
-
# TODO: 貸出記録を残す場合
|
32
|
-
if checkouts.size > 0
|
33
|
-
raise 'This user has items still checked out.'
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def reset_checkout_icalendar_token
|
38
|
-
self.checkout_icalendar_token = Devise.friendly_token
|
39
|
-
end
|
40
|
-
|
41
|
-
def delete_checkout_icalendar_token
|
42
|
-
self.checkout_icalendar_token = nil
|
43
|
-
end
|
44
|
-
|
45
|
-
def checked_item_count
|
46
|
-
checkout_count = {}
|
47
|
-
CheckoutType.all.each do |checkout_type|
|
48
|
-
# 資料種別ごとの貸出中の冊数を計算
|
49
|
-
checkout_count[:"#{checkout_type.name}"] = self.checkouts.count_by_sql(["
|
50
|
-
SELECT count(item_id) FROM checkouts
|
51
|
-
WHERE item_id IN (
|
52
|
-
SELECT id FROM items
|
53
|
-
WHERE checkout_type_id = ?
|
54
|
-
)
|
55
|
-
AND user_id = ? AND checkin_id IS NULL", checkout_type.id, self.id]
|
56
|
-
)
|
57
|
-
end
|
58
|
-
return checkout_count
|
59
|
-
end
|
60
|
-
|
61
|
-
def reached_reservation_limit?(manifestation)
|
62
|
-
return true if self.user_group.user_group_has_checkout_types.available_for_carrier_type(manifestation.carrier_type).where(:user_group_id => self.user_group.id).collect(&:reservation_limit).max.to_i <= self.reserves.waiting.size
|
63
|
-
false
|
64
|
-
end
|
65
|
-
|
66
|
-
def has_role?(role_in_question)
|
67
|
-
return false unless role
|
68
|
-
return true if role.name == role_in_question
|
69
|
-
case role.name
|
70
|
-
when 'Administrator'
|
71
|
-
return true
|
72
|
-
when 'Librarian'
|
73
|
-
return true if role_in_question == 'User'
|
74
|
-
else
|
75
|
-
false
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
if defined?(EnjuMessage)
|
80
|
-
has_many :sent_messages, :foreign_key => 'sender_id', :class_name => 'Message'
|
81
|
-
has_many :received_messages, :foreign_key => 'receiver_id', :class_name => 'Message'
|
82
|
-
|
83
|
-
def send_message(status, options = {})
|
84
|
-
MessageRequest.transaction do
|
85
|
-
request = MessageRequest.new
|
86
|
-
request.sender = User.find(1)
|
87
|
-
request.receiver = self
|
88
|
-
request.message_template = MessageTemplate.localized_template(status, self.locale)
|
89
|
-
request.save_message_body(options)
|
90
|
-
request.sm_send_message!
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
def patron
|
96
|
-
LocalPatron.new(self)
|
97
|
-
end
|
98
|
-
|
99
|
-
def full_name
|
100
|
-
username
|
101
|
-
end
|
7
|
+
enju_leaf_user_model
|
102
8
|
end
|
Binary file
|
@@ -1,6 +1,6 @@
|
|
1
|
-
class
|
1
|
+
class CreateAgents < ActiveRecord::Migration
|
2
2
|
def change
|
3
|
-
create_table :
|
3
|
+
create_table :agents do |t|
|
4
4
|
t.integer :user_id
|
5
5
|
t.string :last_name
|
6
6
|
t.string :middle_name
|
@@ -35,7 +35,7 @@ class CreatePatrons < ActiveRecord::Migration
|
|
35
35
|
t.datetime :date_of_death
|
36
36
|
t.integer :language_id, :default => 1, :null => false
|
37
37
|
t.integer :country_id, :default => 1, :null => false
|
38
|
-
t.integer :
|
38
|
+
t.integer :agent_type_id, :default => 1, :null => false
|
39
39
|
t.integer :lock_version, :default => 0, :null => false
|
40
40
|
t.text :note
|
41
41
|
t.integer :required_role_id, :default => 1, :null => false
|
@@ -44,10 +44,10 @@ class CreatePatrons < ActiveRecord::Migration
|
|
44
44
|
t.text :email
|
45
45
|
t.text :url
|
46
46
|
end
|
47
|
-
add_index :
|
48
|
-
add_index :
|
49
|
-
add_index :
|
50
|
-
add_index :
|
51
|
-
add_index :
|
47
|
+
add_index :agents, :user_id, :unique => true
|
48
|
+
add_index :agents, :language_id
|
49
|
+
add_index :agents, :country_id
|
50
|
+
add_index :agents, :required_role_id
|
51
|
+
add_index :agents, :full_name
|
52
52
|
end
|
53
53
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
class CreateOwns < ActiveRecord::Migration
|
2
2
|
def change
|
3
3
|
create_table :owns do |t|
|
4
|
-
t.references :
|
4
|
+
t.references :agent, :null => false
|
5
5
|
t.references :item, :null => false
|
6
6
|
t.integer :position
|
7
7
|
t.timestamps
|
8
8
|
end
|
9
|
-
add_index :owns, :
|
9
|
+
add_index :owns, :agent_id
|
10
10
|
add_index :owns, :item_id
|
11
11
|
end
|
12
12
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
class CreateCreates < ActiveRecord::Migration
|
2
2
|
def change
|
3
3
|
create_table :creates do |t|
|
4
|
-
t.references :
|
4
|
+
t.references :agent, :null => false
|
5
5
|
t.references :work, :null => false
|
6
6
|
t.integer :position
|
7
7
|
t.timestamps
|
8
8
|
end
|
9
|
-
add_index :creates, :
|
9
|
+
add_index :creates, :agent_id
|
10
10
|
add_index :creates, :work_id
|
11
11
|
end
|
12
12
|
end
|
@@ -11,7 +11,7 @@ class CreateReserves < ActiveRecord::Migration
|
|
11
11
|
t.datetime :expired_at
|
12
12
|
t.datetime :deleted_at
|
13
13
|
t.string :state
|
14
|
-
t.boolean :
|
14
|
+
t.boolean :expiration_notice_to_agent, :default => false
|
15
15
|
t.boolean :expiration_notice_to_library, :default => false
|
16
16
|
end
|
17
17
|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
class CreateProduces < ActiveRecord::Migration
|
2
2
|
def change
|
3
3
|
create_table :produces do |t|
|
4
|
-
t.references :
|
4
|
+
t.references :agent, :null => false
|
5
5
|
t.references :manifestation, :null => false
|
6
6
|
t.integer :position
|
7
7
|
t.timestamps
|
8
8
|
end
|
9
|
-
add_index :produces, :
|
9
|
+
add_index :produces, :agent_id
|
10
10
|
add_index :produces, :manifestation_id
|
11
11
|
end
|
12
12
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
class CreateDonates < ActiveRecord::Migration
|
2
2
|
def change
|
3
3
|
create_table :donates do |t|
|
4
|
-
t.integer :
|
4
|
+
t.integer :agent_id, :null => false
|
5
5
|
t.integer :item_id, :null => false
|
6
6
|
|
7
7
|
t.timestamps
|
8
8
|
end
|
9
|
-
add_index :donates, :
|
9
|
+
add_index :donates, :agent_id
|
10
10
|
add_index :donates, :item_id
|
11
11
|
end
|
12
12
|
end
|