enju_bookmark 0.1.2.pre11 → 0.1.2.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/bookmark_stats/show.csv.erb +1 -1
- data/app/views/bookmark_stats/show.html.erb +1 -1
- data/lib/enju_bookmark/version.rb +1 -1
- data/spec/controllers/bookmarks_controller_spec.rb +4 -2
- data/spec/dummy/app/controllers/application_controller.rb +2 -72
- data/spec/dummy/app/models/user.rb +5 -24
- data/spec/dummy/config/application.rb +2 -3
- 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/{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 -5
- data/spec/dummy/db/migrate/20111201155513_add_devise_to_users.rb +6 -11
- 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 -146
- 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_qx +0 -0
- data/spec/factories/library.rb +13 -0
- data/spec/factories/user.rb +34 -6
- data/spec/fixtures/{patron_types.yml → agent_types.yml} +4 -4
- data/spec/fixtures/{patrons.yml → agents.yml} +46 -46
- data/spec/fixtures/library_groups.yml +6 -6
- data/spec/fixtures/user_groups.yml +51 -0
- data/spec/fixtures/users.yml +7 -0
- metadata +53 -59
- data/spec/dummy/app/models/role.rb +0 -46
- data/spec/dummy/app/models/user_group.rb +0 -36
- data/spec/dummy/app/models/user_has_role.rb +0 -22
- 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/20110918161853_rename_series_statement_manifestation_id_to_root_manifestation_id.rb +0 -13
- 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_eq +0 -0
- data/spec/fixtures/series_has_manifestations.yml +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90a1ecab7210db7ceb1ca8ba67c783244357025f
|
4
|
+
data.tar.gz: 6be75d37d73cbaf18ce9426b18f8617b06f567f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 377990ec2269ea54410af6721b8c3d848043a6358f7572f38b26a65193d3b3dc9fa160987ebd86696ad0e70fc6fe1db3621535703952a1ddf184f1f3c7537eef
|
7
|
+
data.tar.gz: 12d0128635a587316a0087a3f8f7c6aec7394bca3779b47c93e1a070e32aa3d97001699f515ddbcd7c467f17a9d145ccb722b2899485d2d0fd16958c50504bb1
|
@@ -1,4 +1,4 @@
|
|
1
1
|
<%=h @bookmark_stat.start_date -%>,<%=h @bookmark_stat.end_date -%><%= "\n" -%>
|
2
2
|
<%- @stats.each do |stat| -%>
|
3
|
-
"<%=h stat.manifestation.original_title -%>","<%= manifestation_url(stat.manifestation) -%>","<%=h stat.bookmarks_count -%>"<%= "\n" -%>
|
3
|
+
"<%=h stat.manifestation.original_title if stat.manifestation -%>","<%= manifestation_url(stat.manifestation) -%>","<%=h stat.bookmarks_count -%>"<%= "\n" -%>
|
4
4
|
<%- end -%>
|
@@ -31,7 +31,7 @@
|
|
31
31
|
<%- @stats.each do |stat| -%>
|
32
32
|
<tr class="line<%= cycle("0", "1") -%>">
|
33
33
|
<td>
|
34
|
-
<%= render 'manifestations/show_index', :manifestation => stat.manifestation -%>
|
34
|
+
<%= render 'manifestations/show_index', :manifestation => stat.manifestation if stat.manifestation -%>
|
35
35
|
</td>
|
36
36
|
<td><%= stat.bookmarks_count -%></td>
|
37
37
|
</tr>
|
@@ -423,8 +423,10 @@ describe BookmarksController do
|
|
423
423
|
end
|
424
424
|
|
425
425
|
it "should not update missing bookmark" do
|
426
|
-
|
427
|
-
|
426
|
+
lambda{
|
427
|
+
put :update, :id => 'missing', :bookmark => { }
|
428
|
+
}.should raise_error(ActiveRecord::RecordNotFound)
|
429
|
+
#response.should be_missing
|
428
430
|
end
|
429
431
|
|
430
432
|
it "should update bookmark without manifestation_id" do
|
@@ -1,76 +1,6 @@
|
|
1
1
|
class ApplicationController < ActionController::Base
|
2
2
|
protect_from_forgery
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
private
|
8
|
-
def render_403
|
9
|
-
return if performed?
|
10
|
-
if user_signed_in?
|
11
|
-
respond_to do |format|
|
12
|
-
format.html {render :template => 'page/403', :status => 403}
|
13
|
-
format.mobile {render :template => 'page/403', :status => 403}
|
14
|
-
format.xml {render :template => 'page/403', :status => 403}
|
15
|
-
format.json
|
16
|
-
end
|
17
|
-
else
|
18
|
-
respond_to do |format|
|
19
|
-
format.html {redirect_to new_user_session_url}
|
20
|
-
format.mobile {redirect_to new_user_session_url}
|
21
|
-
format.xml {render :template => 'page/403', :status => 403}
|
22
|
-
format.json
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def render_404
|
28
|
-
return if performed?
|
29
|
-
respond_to do |format|
|
30
|
-
format.html {render :template => 'page/404', :status => 404}
|
31
|
-
format.mobile {render :template => 'page/404', :status => 404}
|
32
|
-
format.xml {render :template => 'page/404', :status => 404}
|
33
|
-
format.json
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def not_found
|
38
|
-
raise ActiveRecord::RecordNotFound
|
39
|
-
end
|
40
|
-
|
41
|
-
def access_denied
|
42
|
-
raise CanCan::AccessDenied
|
43
|
-
end
|
44
|
-
|
45
|
-
def store_location
|
46
|
-
if request.get? and request.format.try(:html?) and !request.xhr?
|
47
|
-
session[:user_return_to] = request.fullpath
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def get_user
|
52
|
-
@user = User.where(:username => params[:user_id]).first if params[:user_id]
|
53
|
-
#authorize! :show, @user if @user
|
54
|
-
end
|
55
|
-
|
56
|
-
def solr_commit
|
57
|
-
Sunspot.commit
|
58
|
-
end
|
59
|
-
|
60
|
-
def convert_charset
|
61
|
-
case params[:format]
|
62
|
-
when 'csv'
|
63
|
-
return unless Setting.csv_charset_conversion
|
64
|
-
# TODO: 他の言語
|
65
|
-
if @locale.to_sym == :ja
|
66
|
-
headers["Content-Type"] = "text/csv; charset=Shift_JIS"
|
67
|
-
response.body = NKF::nkf('-Ws', response.body)
|
68
|
-
end
|
69
|
-
when 'xml'
|
70
|
-
if @locale.to_sym == :ja
|
71
|
-
headers["Content-Type"] = "application/xml; charset=Shift_JIS"
|
72
|
-
response.body = NKF::nkf('-Ws', response.body)
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
4
|
+
enju_leaf
|
5
|
+
enju_library
|
76
6
|
end
|
@@ -1,28 +1,9 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
1
2
|
class User < ActiveRecord::Base
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
:recoverable, :rememberable, :trackable, :validatable
|
6
|
-
|
7
|
-
# Setup accessible (or protected) attributes for your model
|
8
|
-
attr_accessible :email, :password, :password_confirmation, :remember_me
|
9
|
-
|
10
|
-
has_one :user_has_role
|
11
|
-
has_one :role, :through => :user_has_role
|
12
|
-
belongs_to :required_role, :class_name => 'Role', :foreign_key => 'required_role_id'
|
3
|
+
devise :database_authenticatable, #:registerable,
|
4
|
+
:recoverable, :rememberable, :trackable, #, :validatable
|
5
|
+
:lockable, :lock_strategy => :none, :unlock_strategy => :none
|
13
6
|
|
7
|
+
enju_leaf_user_model
|
14
8
|
enju_bookmark_user_model
|
15
|
-
|
16
|
-
def has_role?(role_in_question)
|
17
|
-
return false unless role
|
18
|
-
return true if role.name == role_in_question
|
19
|
-
case role.name
|
20
|
-
when 'Administrator'
|
21
|
-
return true
|
22
|
-
when 'Librarian'
|
23
|
-
return true if role_in_question == 'User'
|
24
|
-
else
|
25
|
-
false
|
26
|
-
end
|
27
|
-
end
|
28
9
|
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
|
@@ -1,13 +1,13 @@
|
|
1
1
|
class CreateRealizes < ActiveRecord::Migration
|
2
2
|
def change
|
3
3
|
create_table :realizes do |t|
|
4
|
-
t.references :
|
4
|
+
t.references :agent, :null => false
|
5
5
|
t.references :expression, :null => false
|
6
6
|
t.integer :position
|
7
7
|
|
8
8
|
t.timestamps
|
9
9
|
end
|
10
|
-
add_index :realizes, :
|
10
|
+
add_index :realizes, :agent_id
|
11
11
|
add_index :realizes, :expression_id
|
12
12
|
end
|
13
13
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class CreateAgentImportFiles < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :agent_import_files do |t|
|
4
|
+
t.integer :parent_id
|
5
|
+
t.string :content_type
|
6
|
+
t.integer :size
|
7
|
+
t.integer :user_id
|
8
|
+
t.text :note
|
9
|
+
t.datetime :executed_at
|
10
|
+
t.string :state
|
11
|
+
t.string :agent_import_file_name
|
12
|
+
t.string :agent_import_content_type
|
13
|
+
t.integer :agent_import_file_size
|
14
|
+
t.datetime :agent_import_updated_at
|
15
|
+
|
16
|
+
t.timestamps
|
17
|
+
end
|
18
|
+
add_index :agent_import_files, :parent_id
|
19
|
+
add_index :agent_import_files, :user_id
|
20
|
+
add_index :agent_import_files, :state
|
21
|
+
end
|
22
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
class
|
1
|
+
class CreateAgentRelationshipTypes < ActiveRecord::Migration
|
2
2
|
def change
|
3
|
-
create_table :
|
3
|
+
create_table :agent_relationship_types do |t|
|
4
4
|
t.string :name, :null => false
|
5
5
|
t.text :display_name
|
6
6
|
t.text :note
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class AddDcndlSchema < ActiveRecord::Migration
|
2
2
|
def self.up
|
3
3
|
add_column :manifestations, :title_alternative_transcription, :text
|
4
|
-
add_column :
|
4
|
+
add_column :agents, :full_name_alternative_transcription, :text
|
5
5
|
add_column :manifestations, :description, :text
|
6
6
|
add_column :manifestations, :abstract, :text
|
7
7
|
add_column :manifestations, :available_at, :timestamp
|
@@ -14,7 +14,7 @@ class AddDcndlSchema < ActiveRecord::Migration
|
|
14
14
|
|
15
15
|
def self.down
|
16
16
|
remove_column :manifestations, :title_alternative_transcription
|
17
|
-
remove_column :
|
17
|
+
remove_column :agents, :full_name_alternative_transcription
|
18
18
|
remove_column :manifestations, :description
|
19
19
|
remove_column :manifestations, :abstract
|
20
20
|
remove_column :manifestations, :available_at
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateAgentRelationships < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :agent_relationships do |t|
|
4
|
+
t.integer :parent_id
|
5
|
+
t.integer :child_id
|
6
|
+
t.integer :agent_relationship_type_id
|
7
|
+
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
add_index :agent_relationships, :parent_id
|
11
|
+
add_index :agent_relationships, :child_id
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class AddPositionToAgentRelationship < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
add_column :manifestation_relationships, :position, :integer
|
4
|
+
add_column :agent_relationships, :position, :integer
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.down
|
8
|
+
remove_column :agent_relationships, :position
|
9
|
+
remove_column :manifestation_relationships, :position
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class AddBirthDateAndDeathDateToAgent < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
add_column :agents, :birth_date, :string
|
4
|
+
add_column :agents, :death_date, :string
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.down
|
8
|
+
remove_column :agents, :death_date
|
9
|
+
remove_column :agents, :birth_date
|
10
|
+
end
|
11
|
+
end
|
@@ -19,25 +19,20 @@ class AddDeviseToUsers < ActiveRecord::Migration
|
|
19
19
|
t.string :current_sign_in_ip
|
20
20
|
t.string :last_sign_in_ip
|
21
21
|
|
22
|
-
## Encryptable
|
23
|
-
t.string :password_salt
|
24
|
-
|
25
22
|
## Confirmable
|
26
|
-
t.string :confirmation_token
|
27
|
-
t.datetime :confirmed_at
|
23
|
+
# t.string :confirmation_token
|
24
|
+
# t.datetime :confirmed_at
|
28
25
|
t.datetime :confirmation_sent_at
|
29
26
|
t.string :unconfirmed_email # Only if using reconfirmable
|
30
27
|
|
31
28
|
## Lockable
|
32
|
-
t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
|
33
|
-
t.string :unlock_token # Only if unlock strategy is :email or :both
|
34
|
-
t.datetime :locked_at
|
29
|
+
# t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
|
30
|
+
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
31
|
+
# t.datetime :locked_at
|
35
32
|
|
36
33
|
# Token authenticatable
|
37
|
-
t.string :authentication_token
|
38
|
-
|
34
|
+
# t.string :authentication_token
|
39
35
|
|
40
|
-
t.datetime :deleted_at
|
41
36
|
end
|
42
37
|
|
43
38
|
add_index :users, :email #, :unique => true
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class AddAdditionalAttributesToUser < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
add_column :users, :username, :string
|
4
|
+
add_column :users, :user_number, :string
|
5
|
+
add_column :users, :state, :string
|
6
|
+
add_column :users, :locale, :string
|
7
|
+
add_column :users, :deleted_at, :datetime
|
8
|
+
add_column :users, :expired_at, :datetime
|
9
|
+
add_column :users, :library_id, :integer, :default => 1, :null => false
|
10
|
+
add_column :users, :required_role_id, :integer, :default => 1, :null => false
|
11
|
+
add_column :users, :user_group_id, :integer, :default => 1, :null => false
|
12
|
+
add_column :users, :note, :text
|
13
|
+
add_column :users, :keyword_list, :text
|
14
|
+
|
15
|
+
add_column :users, :failed_attempts, :integer
|
16
|
+
add_column :users, :unlock_token, :string
|
17
|
+
add_column :users, :locked_at, :datetime
|
18
|
+
|
19
|
+
add_column :users, :confirmed_at, :datetime
|
20
|
+
|
21
|
+
add_index :users, :username, :unique => true
|
22
|
+
add_index :users, :user_group_id
|
23
|
+
add_index :users, :user_number, :unique => true
|
24
|
+
add_index :users, :unlock_token, :unique => true
|
25
|
+
end
|
26
|
+
end
|