enju_nii 0.1.1 → 0.2.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +5 -5
- data/app/controllers/cinii_books_controller.rb +3 -6
- data/app/controllers/nii_types_controller.rb +13 -2
- data/app/models/nii_type.rb +0 -1
- data/app/policies/cinii_book_policy.rb +9 -0
- data/app/policies/nii_type_policy.rb +23 -0
- data/app/views/cinii_books/index.html.erb +5 -0
- data/app/views/nii_types/index.html.erb +3 -3
- data/config/locales/en.yml +1 -0
- data/config/locales/ja.yml +1 -0
- data/lib/enju_nii/version.rb +1 -1
- data/spec/cassette_library/cinii_books/index/cinii_books_search_menu/should_reflect_query_params_for_views.yml +139 -0
- data/spec/controllers/nii_types_controller_spec.rb +1 -1
- data/spec/dummy/app/controllers/application_controller.rb +6 -3
- data/spec/dummy/app/models/user.rb +1 -2
- data/spec/dummy/config/application.rb +4 -23
- data/spec/dummy/config/environments/test.rb +3 -1
- data/spec/dummy/config/initializers/enju_leaf.rb +2 -0
- data/spec/support/devise.rb +2 -2
- data/spec/views/cinii_books/index.html.erb_spec.rb +16 -0
- metadata +81 -36
- data/app/models/enju_nii/ability.rb +0 -17
- data/spec/dummy/app/models/ability.rb +0 -17
- data/spec/dummy/config/application.yml +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86ab26b86be90ae3d9a802ef1cbcabdde490cf16
|
4
|
+
data.tar.gz: ccb193e1f9241d8e6c0035741e6423e7bca0e1b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ca9a7f42ff9964fe0375792e0e11837d2071e7935445f6c238147d0fc6bc0752966c42feda90b347f54dfd491a092b2e8fbfdc5cf86632ce8e35db1e0c8b747
|
7
|
+
data.tar.gz: f51f14c7a769969e98e7f331566a78d57715092106bdda5d204785222e76c59bac705403870271d8c1760d1bd2bd4209e458df3a25dfb6a4ac2a29add9cefe59
|
data/README.rdoc
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
= EnjuNii
|
2
|
-
{<img src="https://travis-ci.org/next-l/enju_nii.svg?branch=1.
|
3
|
-
{<img src="https://coveralls.io/repos/next-l/enju_nii/badge.svg?branch=1.
|
4
|
-
{<img src="https://hakiri.io/github/next-l/enju_nii/1.
|
2
|
+
{<img src="https://travis-ci.org/next-l/enju_nii.svg?branch=1.2" alt="Build Status" />}[https://travis-ci.org/next-l/enju_nii]
|
3
|
+
{<img src="https://coveralls.io/repos/next-l/enju_nii/badge.svg?branch=1.2&service=github" alt="Coverage Status" />}[https://coveralls.io/github/next-l/enju_nii?branch=1.2]
|
4
|
+
{<img src="https://hakiri.io/github/next-l/enju_nii/1.2.svg" alt="security" />}[https://hakiri.io/github/next-l/enju_nii/1.2]
|
5
5
|
|
6
6
|
CiNii Booksから書誌をインポートするための Enju プラグインです。
|
7
7
|
|
@@ -9,11 +9,11 @@ CiNii Booksから書誌をインポートするための Enju プラグインで
|
|
9
9
|
|
10
10
|
お使いのenju_leafのGemfile に以下の行を追加してください。
|
11
11
|
|
12
|
-
gem 'enju_nii', github: "next-l/enju_nii", branch: '1.
|
12
|
+
gem 'enju_nii', github: "next-l/enju_nii", branch: '1.2'
|
13
13
|
|
14
14
|
gemをインストールします。
|
15
15
|
|
16
|
-
$
|
16
|
+
$ bundle update
|
17
17
|
|
18
18
|
インストールが完了したら、以下のコマンドでセットアップを行います。
|
19
19
|
|
@@ -1,6 +1,5 @@
|
|
1
1
|
class CiniiBooksController < ApplicationController
|
2
|
-
|
3
|
-
before_filter :check_librarian
|
2
|
+
before_action :check_policy, only: [:index, :create]
|
4
3
|
|
5
4
|
def index
|
6
5
|
if params[:page].to_i == 0
|
@@ -40,9 +39,7 @@ class CiniiBooksController < ApplicationController
|
|
40
39
|
end
|
41
40
|
|
42
41
|
private
|
43
|
-
def
|
44
|
-
|
45
|
-
access_denied
|
46
|
-
end
|
42
|
+
def check_policy
|
43
|
+
authorize CiniiBook
|
47
44
|
end
|
48
45
|
end
|
@@ -1,9 +1,11 @@
|
|
1
1
|
class NiiTypesController < ApplicationController
|
2
|
-
|
2
|
+
before_action :set_nii_type, only: [:show, :edit, :update, :destroy]
|
3
|
+
before_action :check_policy, only: [:index, :new, :create]
|
4
|
+
|
3
5
|
# GET /nii_types
|
4
6
|
# GET /nii_types.json
|
5
7
|
def index
|
6
|
-
@nii_types = NiiType.
|
8
|
+
@nii_types = NiiType.order(:position)
|
7
9
|
|
8
10
|
respond_to do |format|
|
9
11
|
format.html # index.html.erb
|
@@ -82,6 +84,15 @@ class NiiTypesController < ApplicationController
|
|
82
84
|
end
|
83
85
|
|
84
86
|
private
|
87
|
+
def set_nii_type
|
88
|
+
@nii_type = NiiType.find(params[:id])
|
89
|
+
authorize @nii_type
|
90
|
+
end
|
91
|
+
|
92
|
+
def check_policy
|
93
|
+
authorize NiiType
|
94
|
+
end
|
95
|
+
|
85
96
|
def nii_type_params
|
86
97
|
params.require(:nii_type).permit(:name, :display_name, :note)
|
87
98
|
end
|
data/app/models/nii_type.rb
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
class NiiTypePolicy < ApplicationPolicy
|
2
|
+
def index?
|
3
|
+
true
|
4
|
+
end
|
5
|
+
|
6
|
+
def show?
|
7
|
+
true
|
8
|
+
end
|
9
|
+
|
10
|
+
def create?
|
11
|
+
true if user.try(:has_role?, 'Administrator')
|
12
|
+
end
|
13
|
+
|
14
|
+
def update?
|
15
|
+
true if user.try(:has_role?, 'Administrator')
|
16
|
+
end
|
17
|
+
|
18
|
+
def destroy?
|
19
|
+
if user.try(:has_role?, 'Administrator')
|
20
|
+
true unless record.manifestations.exists?
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -45,5 +45,10 @@
|
|
45
45
|
</div>
|
46
46
|
</div>
|
47
47
|
|
48
|
+
<% if @query.present? %>
|
48
49
|
<div id="submenu" class="ui-corner-all ui-widget-content">
|
50
|
+
<ul>
|
51
|
+
<li><%= link_to t('enju_nii.same_query_in_cinii_books'), "http://ci.nii.ac.jp/books/search?q=#{u(@query)}" -%></li>
|
52
|
+
</ul>
|
49
53
|
</div>
|
54
|
+
<% end %>
|
@@ -13,7 +13,7 @@
|
|
13
13
|
<%- @nii_types.each do |nii_type| -%>
|
14
14
|
<tr class="line<%= cycle("0", "1") -%>">
|
15
15
|
<td>
|
16
|
-
<%- if
|
16
|
+
<%- if policy(nii_type).update? -%>
|
17
17
|
<%= move_position(nii_type) -%>
|
18
18
|
<%- end -%>
|
19
19
|
</td>
|
@@ -24,10 +24,10 @@
|
|
24
24
|
</td>
|
25
25
|
<td><%= nii_type.note -%></td>
|
26
26
|
<td>
|
27
|
-
<%- if
|
27
|
+
<%- if policy(nii_type).update? -%>
|
28
28
|
<%= link_to t('page.edit'), edit_nii_type_path(nii_type) -%>
|
29
29
|
<% end %>
|
30
|
-
<%- if
|
30
|
+
<%- if policy(nii_type).destroy? -%>
|
31
31
|
<%= link_to t('page.destroy'), nii_type, :data => {:confirm => t('page.are_you_sure')}, :method => :delete -%>
|
32
32
|
<% end -%>
|
33
33
|
</td>
|
data/config/locales/en.yml
CHANGED
data/config/locales/ja.yml
CHANGED
data/lib/enju_nii/version.rb
CHANGED
@@ -0,0 +1,139 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://ci.nii.ac.jp/books/opensearch/search?count=10&format=rss&p=1&q=test
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Date:
|
22
|
+
- Sat, 28 May 2016 12:41:00 GMT
|
23
|
+
Access-Control-Allow-Origin:
|
24
|
+
- "*"
|
25
|
+
Content-Type:
|
26
|
+
- application/rss+xml;charset=UTF-8
|
27
|
+
Transfer-Encoding:
|
28
|
+
- chunked
|
29
|
+
body:
|
30
|
+
encoding: UTF-8
|
31
|
+
string: |
|
32
|
+
<?xml version="1.0" encoding="UTF-8"?><rdf:RDF xmlns="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:cinii="http://ci.nii.ac.jp/ns/1.0/" xmlns:prism="http://prismstandard.org/namespaces/basic/2.0/" xmlns:dc="http://purl.org/dc/elements/1.1/">
|
33
|
+
<channel rdf:about="http://ci.nii.ac.jp/books/opensearch/search?p=1&q=test&count=10&format=rss">
|
34
|
+
<title>CiNii Books OpenSearch - 1 test 10</title>
|
35
|
+
<description>CiNii Books OpenSearch - 1 test 10</description>
|
36
|
+
<link>http://ci.nii.ac.jp/books/opensearch/search?p=1&q=test&count=10&format=rss</link>
|
37
|
+
<dc:date>2016-05-28T21:41:00+0900</dc:date>
|
38
|
+
<opensearch:totalResults>29061</opensearch:totalResults>
|
39
|
+
<opensearch:startIndex>0</opensearch:startIndex>
|
40
|
+
<opensearch:itemsPerPage>10</opensearch:itemsPerPage>
|
41
|
+
<items>
|
42
|
+
<rdf:Seq>
|
43
|
+
<rdf:li rdf:resource="http://ci.nii.ac.jp/ncid/BA14163266"/>
|
44
|
+
<rdf:li rdf:resource="http://ci.nii.ac.jp/ncid/BA00651454"/>
|
45
|
+
<rdf:li rdf:resource="http://ci.nii.ac.jp/ncid/BA76174068"/>
|
46
|
+
<rdf:li rdf:resource="http://ci.nii.ac.jp/ncid/BB18014323"/>
|
47
|
+
<rdf:li rdf:resource="http://ci.nii.ac.jp/ncid/BB05214487"/>
|
48
|
+
<rdf:li rdf:resource="http://ci.nii.ac.jp/ncid/BB05434188"/>
|
49
|
+
<rdf:li rdf:resource="http://ci.nii.ac.jp/ncid/BA10315759"/>
|
50
|
+
<rdf:li rdf:resource="http://ci.nii.ac.jp/ncid/BA42168202"/>
|
51
|
+
<rdf:li rdf:resource="http://ci.nii.ac.jp/ncid/BB17350970"/>
|
52
|
+
<rdf:li rdf:resource="http://ci.nii.ac.jp/ncid/BA50300600"/>
|
53
|
+
</rdf:Seq>
|
54
|
+
</items>
|
55
|
+
</channel>
|
56
|
+
<item rdf:about="http://ci.nii.ac.jp/ncid/BA14163266">
|
57
|
+
<title>The ETS Test Collection catalog</title>
|
58
|
+
<link>http://ci.nii.ac.jp/ncid/BA14163266</link>
|
59
|
+
<rdfs:seeAlso rdf:resource="http://ci.nii.ac.jp/ncid/BA14163266.rdf"/>
|
60
|
+
<dc:creator/>
|
61
|
+
<dc:publisher>Oryx Press</dc:publisher>
|
62
|
+
<cinii:ownerCount>0</cinii:ownerCount>
|
63
|
+
</item>
|
64
|
+
<item rdf:about="http://ci.nii.ac.jp/ncid/BA00651454">
|
65
|
+
<title>Nondestructive testing handbook</title>
|
66
|
+
<link>http://ci.nii.ac.jp/ncid/BA00651454</link>
|
67
|
+
<rdfs:seeAlso rdf:resource="http://ci.nii.ac.jp/ncid/BA00651454.rdf"/>
|
68
|
+
<dc:creator/>
|
69
|
+
<dc:publisher>American Society for Nondestructive Testing</dc:publisher>
|
70
|
+
<cinii:ownerCount>0</cinii:ownerCount>
|
71
|
+
</item>
|
72
|
+
<item rdf:about="http://ci.nii.ac.jp/ncid/BA76174068">
|
73
|
+
<title>California Test Bureau manual</title>
|
74
|
+
<link>http://ci.nii.ac.jp/ncid/BA76174068</link>
|
75
|
+
<rdfs:seeAlso rdf:resource="http://ci.nii.ac.jp/ncid/BA76174068.rdf"/>
|
76
|
+
<dc:creator/>
|
77
|
+
<dc:publisher>California Test Bureau</dc:publisher>
|
78
|
+
<cinii:ownerCount>0</cinii:ownerCount>
|
79
|
+
</item>
|
80
|
+
<item rdf:about="http://ci.nii.ac.jp/ncid/BB18014323">
|
81
|
+
<title>Nondestructive testing handbook</title>
|
82
|
+
<link>http://ci.nii.ac.jp/ncid/BB18014323</link>
|
83
|
+
<rdfs:seeAlso rdf:resource="http://ci.nii.ac.jp/ncid/BB18014323.rdf"/>
|
84
|
+
<dc:creator/>
|
85
|
+
<dc:publisher>American Society for Nondestructive Testing</dc:publisher>
|
86
|
+
<cinii:ownerCount>0</cinii:ownerCount>
|
87
|
+
</item>
|
88
|
+
<item rdf:about="http://ci.nii.ac.jp/ncid/BB05214487">
|
89
|
+
<title>Brooklands road test series</title>
|
90
|
+
<link>http://ci.nii.ac.jp/ncid/BB05214487</link>
|
91
|
+
<rdfs:seeAlso rdf:resource="http://ci.nii.ac.jp/ncid/BB05214487.rdf"/>
|
92
|
+
<dc:creator/>
|
93
|
+
<dc:publisher>Brooklands</dc:publisher>
|
94
|
+
<cinii:ownerCount>0</cinii:ownerCount>
|
95
|
+
</item>
|
96
|
+
<item rdf:about="http://ci.nii.ac.jp/ncid/BB05434188">
|
97
|
+
<title>Test-preparation guide</title>
|
98
|
+
<link>http://ci.nii.ac.jp/ncid/BB05434188</link>
|
99
|
+
<rdfs:seeAlso rdf:resource="http://ci.nii.ac.jp/ncid/BB05434188.rdf"/>
|
100
|
+
<dc:creator/>
|
101
|
+
<dc:publisher>Marshall Cavendish Education</dc:publisher>
|
102
|
+
<cinii:ownerCount>0</cinii:ownerCount>
|
103
|
+
</item>
|
104
|
+
<item rdf:about="http://ci.nii.ac.jp/ncid/BA10315759">
|
105
|
+
<title>Spot tests</title>
|
106
|
+
<link>http://ci.nii.ac.jp/ncid/BA10315759</link>
|
107
|
+
<rdfs:seeAlso rdf:resource="http://ci.nii.ac.jp/ncid/BA10315759.rdf"/>
|
108
|
+
<dc:creator/>
|
109
|
+
<dc:publisher>Elsevier</dc:publisher>
|
110
|
+
<cinii:ownerCount>0</cinii:ownerCount>
|
111
|
+
</item>
|
112
|
+
<item rdf:about="http://ci.nii.ac.jp/ncid/BA42168202">
|
113
|
+
<title>Orientamento</title>
|
114
|
+
<link>http://ci.nii.ac.jp/ncid/BA42168202</link>
|
115
|
+
<rdfs:seeAlso rdf:resource="http://ci.nii.ac.jp/ncid/BA42168202.rdf"/>
|
116
|
+
<dc:creator/>
|
117
|
+
<dc:publisher>Alpha test</dc:publisher>
|
118
|
+
<cinii:ownerCount>0</cinii:ownerCount>
|
119
|
+
</item>
|
120
|
+
<item rdf:about="http://ci.nii.ac.jp/ncid/BB17350970">
|
121
|
+
<title>Test</title>
|
122
|
+
<link>http://ci.nii.ac.jp/ncid/BB17350970</link>
|
123
|
+
<rdfs:seeAlso rdf:resource="http://ci.nii.ac.jp/ncid/BB17350970.rdf"/>
|
124
|
+
<dc:creator/>
|
125
|
+
<dc:publisher>Stiftung Warentest</dc:publisher>
|
126
|
+
<cinii:ownerCount>0</cinii:ownerCount>
|
127
|
+
</item>
|
128
|
+
<item rdf:about="http://ci.nii.ac.jp/ncid/BA50300600">
|
129
|
+
<title>Hypothesis testing</title>
|
130
|
+
<link>http://ci.nii.ac.jp/ncid/BA50300600</link>
|
131
|
+
<rdfs:seeAlso rdf:resource="http://ci.nii.ac.jp/ncid/BA50300600.rdf"/>
|
132
|
+
<dc:creator/>
|
133
|
+
<dc:publisher>Longman</dc:publisher>
|
134
|
+
<cinii:ownerCount>0</cinii:ownerCount>
|
135
|
+
</item>
|
136
|
+
</rdf:RDF>
|
137
|
+
http_version:
|
138
|
+
recorded_at: Sat, 28 May 2016 00:37:41 GMT
|
139
|
+
recorded_with: VCR 3.0.3
|
@@ -33,7 +33,7 @@ describe NiiTypesController do
|
|
33
33
|
it "assigns all nii_types as @nii_types" do
|
34
34
|
nii_type = NiiType.create! valid_attributes
|
35
35
|
get :index
|
36
|
-
expect(assigns(:nii_types)).to eq(NiiType.
|
36
|
+
expect(assigns(:nii_types)).to eq(NiiType.order(:position))
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
@@ -1,7 +1,10 @@
|
|
1
1
|
class ApplicationController < ActionController::Base
|
2
2
|
protect_from_forgery
|
3
|
+
include EnjuLeaf::Controller
|
4
|
+
include EnjuBiblio::Controller
|
5
|
+
include EnjuLibrary::Controller
|
6
|
+
before_action :set_paper_trail_whodunnit
|
7
|
+
after_action :verify_authorized
|
3
8
|
|
4
|
-
|
5
|
-
enju_biblio
|
6
|
-
enju_library
|
9
|
+
include Pundit
|
7
10
|
end
|
@@ -1,8 +1,7 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
class User < ActiveRecord::Base
|
3
2
|
devise :database_authenticatable, #:registerable,
|
4
3
|
:recoverable, :rememberable, :trackable, #, :validatable
|
5
4
|
:lockable, :lock_strategy => :none, :unlock_strategy => :none
|
6
5
|
|
7
|
-
|
6
|
+
include EnjuLeaf::EnjuUser
|
8
7
|
end
|
@@ -4,6 +4,8 @@ require 'rails/all'
|
|
4
4
|
|
5
5
|
Bundler.require(*Rails.groups)
|
6
6
|
require "enju_nii"
|
7
|
+
require "enju_leaf"
|
8
|
+
require "enju_subject"
|
7
9
|
|
8
10
|
module Dummy
|
9
11
|
class Application < Rails::Application
|
@@ -11,16 +13,6 @@ module Dummy
|
|
11
13
|
# Application configuration should go into files in config/initializers
|
12
14
|
# -- all .rb files in that directory are automatically loaded.
|
13
15
|
|
14
|
-
# Custom directories with classes and modules you want to be autoloadable.
|
15
|
-
# config.autoload_paths += %W(#{config.root}/extras)
|
16
|
-
|
17
|
-
# Only load the plugins named here, in the order given (default is alphabetical).
|
18
|
-
# :all can be used as a placeholder for all plugins not explicitly named.
|
19
|
-
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
20
|
-
|
21
|
-
# Activate observers that should always be running.
|
22
|
-
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
23
|
-
|
24
16
|
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
25
17
|
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
26
18
|
# config.time_zone = 'Central Time (US & Canada)'
|
@@ -29,19 +21,8 @@ module Dummy
|
|
29
21
|
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
30
22
|
# config.i18n.default_locale = :de
|
31
23
|
|
32
|
-
#
|
33
|
-
config.
|
34
|
-
|
35
|
-
# Configure sensitive parameters which will be filtered from the log file.
|
36
|
-
config.filter_parameters += [:password]
|
37
|
-
|
38
|
-
# Enable the asset pipeline
|
39
|
-
config.assets.enabled = true
|
40
|
-
|
41
|
-
# Version of your assets, change this if you want to expire all your assets
|
42
|
-
config.assets.version = '1.0'
|
24
|
+
# Do not swallow errors in after_commit/after_rollback callbacks.
|
25
|
+
config.active_record.raise_in_transactional_callbacks = true
|
43
26
|
end
|
44
27
|
end
|
45
28
|
|
46
|
-
require 'enju_leaf'
|
47
|
-
require 'enju_subject'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
Rails.application.configure do
|
2
2
|
# Settings specified here will take precedence over those in config/application.rb.
|
3
3
|
|
4
4
|
# The test environment is used exclusively to run your application's
|
@@ -39,4 +39,6 @@ Dummy::Application.configure do
|
|
39
39
|
|
40
40
|
# Raises error for missing translations
|
41
41
|
# config.action_view.raise_on_missing_translations = true
|
42
|
+
|
43
|
+
config.action_mailer.default_url_options = {:host => 'localhost:3000'}
|
42
44
|
end
|
data/spec/support/devise.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
RSpec.configure do |config|
|
2
|
-
config.include Devise::
|
3
|
-
config.include Devise::
|
2
|
+
config.include Devise::Test::ControllerHelpers, type: :controller
|
3
|
+
config.include Devise::Test::ControllerHelpers, type: :view
|
4
4
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require "spec_helper.rb"
|
2
|
+
|
3
|
+
describe "cinii_books/index" do
|
4
|
+
describe "cinii books search menu" do
|
5
|
+
it "should reflect query params for views", vcr: true do
|
6
|
+
params[:query] = "test"
|
7
|
+
assign(:query, "test")
|
8
|
+
books = CiniiBook.search(params[:query])
|
9
|
+
assign(:books, Kaminari.paginate_array(books[:items], total_count: books[:total_entries]).page(1).per(10))
|
10
|
+
render
|
11
|
+
expect(rendered).to include "http://ci.nii.ac.jp/books/search?q=test"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enju_nii
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0.beta.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kosuke Tanabe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: enju_biblio
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.1
|
19
|
+
version: 0.2.0.beta.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.1
|
26
|
+
version: 0.2.0.beta.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: faraday
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,6 +38,62 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: enju_leaf
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.2.0.beta.1
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.2.0.beta.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: enju_library
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.2.0.beta.1
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.2.0.beta.1
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: enju_manifestation_viewer
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.2.0.beta.1
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.2.0.beta.1
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: enju_subject
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.2.0.beta.1
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.2.0.beta.1
|
41
97
|
- !ruby/object:Gem::Dependency
|
42
98
|
name: sqlite3
|
43
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -56,16 +112,16 @@ dependencies:
|
|
56
112
|
name: mysql2
|
57
113
|
requirement: !ruby/object:Gem::Requirement
|
58
114
|
requirements:
|
59
|
-
- - "
|
115
|
+
- - ">="
|
60
116
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0
|
117
|
+
version: '0'
|
62
118
|
type: :development
|
63
119
|
prerelease: false
|
64
120
|
version_requirements: !ruby/object:Gem::Requirement
|
65
121
|
requirements:
|
66
|
-
- - "
|
122
|
+
- - ">="
|
67
123
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0
|
124
|
+
version: '0'
|
69
125
|
- !ruby/object:Gem::Dependency
|
70
126
|
name: pg
|
71
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -151,35 +207,21 @@ dependencies:
|
|
151
207
|
- !ruby/object:Gem::Version
|
152
208
|
version: '0'
|
153
209
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
156
|
-
requirements:
|
157
|
-
- - "~>"
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
version: 1.1.2
|
160
|
-
type: :development
|
161
|
-
prerelease: false
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
163
|
-
requirements:
|
164
|
-
- - "~>"
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: 1.1.2
|
167
|
-
- !ruby/object:Gem::Dependency
|
168
|
-
name: enju_subject
|
210
|
+
name: appraisal
|
169
211
|
requirement: !ruby/object:Gem::Requirement
|
170
212
|
requirements:
|
171
|
-
- - "
|
213
|
+
- - ">="
|
172
214
|
- !ruby/object:Gem::Version
|
173
|
-
version: 0
|
215
|
+
version: '0'
|
174
216
|
type: :development
|
175
217
|
prerelease: false
|
176
218
|
version_requirements: !ruby/object:Gem::Requirement
|
177
219
|
requirements:
|
178
|
-
- - "
|
220
|
+
- - ">="
|
179
221
|
- !ruby/object:Gem::Version
|
180
|
-
version: 0
|
222
|
+
version: '0'
|
181
223
|
- !ruby/object:Gem::Dependency
|
182
|
-
name:
|
224
|
+
name: coveralls
|
183
225
|
requirement: !ruby/object:Gem::Requirement
|
184
226
|
requirements:
|
185
227
|
- - ">="
|
@@ -207,8 +249,9 @@ files:
|
|
207
249
|
- app/helpers/cinii_books_helper.rb
|
208
250
|
- app/helpers/nii_types_helper.rb
|
209
251
|
- app/models/cinii_book.rb
|
210
|
-
- app/models/enju_nii/ability.rb
|
211
252
|
- app/models/nii_type.rb
|
253
|
+
- app/policies/cinii_book_policy.rb
|
254
|
+
- app/policies/nii_type_policy.rb
|
212
255
|
- app/views/cinii_books/index.html.erb
|
213
256
|
- app/views/layouts/cinii_books.html.erb
|
214
257
|
- app/views/nii_types/_form.html.erb
|
@@ -239,6 +282,7 @@ files:
|
|
239
282
|
- spec/cassette_library/CiniiBook/should_search_bibliographic_records.yml
|
240
283
|
- spec/cassette_library/CiniiBook/should_search_with_ncid.yml
|
241
284
|
- spec/cassette_library/CiniiBooksController/GET_index/should_get_index.yml
|
285
|
+
- spec/cassette_library/cinii_books/index/cinii_books_search_menu/should_reflect_query_params_for_views.yml
|
242
286
|
- spec/controllers/cinii_books_controller_spec.rb
|
243
287
|
- spec/controllers/nii_types_controller_spec.rb
|
244
288
|
- spec/dummy/Rakefile
|
@@ -246,7 +290,6 @@ files:
|
|
246
290
|
- spec/dummy/app/assets/stylesheets/application.css
|
247
291
|
- spec/dummy/app/controllers/application_controller.rb
|
248
292
|
- spec/dummy/app/helpers/application_helper.rb
|
249
|
-
- spec/dummy/app/models/ability.rb
|
250
293
|
- spec/dummy/app/models/user.rb
|
251
294
|
- spec/dummy/app/views/layouts/application.html.erb
|
252
295
|
- spec/dummy/bin/bundle
|
@@ -255,7 +298,6 @@ files:
|
|
255
298
|
- spec/dummy/bin/setup
|
256
299
|
- spec/dummy/config.ru
|
257
300
|
- spec/dummy/config/application.rb
|
258
|
-
- spec/dummy/config/application.yml
|
259
301
|
- spec/dummy/config/boot.rb
|
260
302
|
- spec/dummy/config/database.yml
|
261
303
|
- spec/dummy/config/environment.rb
|
@@ -264,6 +306,7 @@ files:
|
|
264
306
|
- spec/dummy/config/environments/test.rb
|
265
307
|
- spec/dummy/config/initializers/backtrace_silencers.rb
|
266
308
|
- spec/dummy/config/initializers/devise.rb
|
309
|
+
- spec/dummy/config/initializers/enju_leaf.rb
|
267
310
|
- spec/dummy/config/initializers/inflections.rb
|
268
311
|
- spec/dummy/config/initializers/mime_types.rb
|
269
312
|
- spec/dummy/config/initializers/secret_token.rb
|
@@ -433,6 +476,7 @@ files:
|
|
433
476
|
- spec/spec_helper.rb
|
434
477
|
- spec/support/controller_macros.rb
|
435
478
|
- spec/support/devise.rb
|
479
|
+
- spec/views/cinii_books/index.html.erb_spec.rb
|
436
480
|
homepage: https://github.com/next-l/enju_nii
|
437
481
|
licenses: []
|
438
482
|
metadata: {}
|
@@ -447,16 +491,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
447
491
|
version: '0'
|
448
492
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
449
493
|
requirements:
|
450
|
-
- - "
|
494
|
+
- - ">"
|
451
495
|
- !ruby/object:Gem::Version
|
452
|
-
version:
|
496
|
+
version: 1.3.1
|
453
497
|
requirements: []
|
454
498
|
rubyforge_project:
|
455
|
-
rubygems_version: 2.5.
|
499
|
+
rubygems_version: 2.5.1
|
456
500
|
signing_key:
|
457
501
|
specification_version: 4
|
458
502
|
summary: enju_nii plugin
|
459
503
|
test_files:
|
504
|
+
- spec/cassette_library/cinii_books/index/cinii_books_search_menu/should_reflect_query_params_for_views.yml
|
460
505
|
- spec/cassette_library/CiniiBook/should_import_a_bibliographic_record.yml
|
461
506
|
- spec/cassette_library/CiniiBook/should_import_a_bibliographic_record_with_dual_languages.yml
|
462
507
|
- spec/cassette_library/CiniiBook/should_search_bibliographic_records.yml
|
@@ -468,7 +513,6 @@ test_files:
|
|
468
513
|
- spec/dummy/app/assets/stylesheets/application.css
|
469
514
|
- spec/dummy/app/controllers/application_controller.rb
|
470
515
|
- spec/dummy/app/helpers/application_helper.rb
|
471
|
-
- spec/dummy/app/models/ability.rb
|
472
516
|
- spec/dummy/app/models/user.rb
|
473
517
|
- spec/dummy/app/views/layouts/application.html.erb
|
474
518
|
- spec/dummy/bin/bundle
|
@@ -476,7 +520,6 @@ test_files:
|
|
476
520
|
- spec/dummy/bin/rake
|
477
521
|
- spec/dummy/bin/setup
|
478
522
|
- spec/dummy/config/application.rb
|
479
|
-
- spec/dummy/config/application.yml
|
480
523
|
- spec/dummy/config/boot.rb
|
481
524
|
- spec/dummy/config/database.yml
|
482
525
|
- spec/dummy/config/environment.rb
|
@@ -485,6 +528,7 @@ test_files:
|
|
485
528
|
- spec/dummy/config/environments/test.rb
|
486
529
|
- spec/dummy/config/initializers/backtrace_silencers.rb
|
487
530
|
- spec/dummy/config/initializers/devise.rb
|
531
|
+
- spec/dummy/config/initializers/enju_leaf.rb
|
488
532
|
- spec/dummy/config/initializers/inflections.rb
|
489
533
|
- spec/dummy/config/initializers/mime_types.rb
|
490
534
|
- spec/dummy/config/initializers/secret_token.rb
|
@@ -656,3 +700,4 @@ test_files:
|
|
656
700
|
- spec/spec_helper.rb
|
657
701
|
- spec/support/controller_macros.rb
|
658
702
|
- spec/support/devise.rb
|
703
|
+
- spec/views/cinii_books/index.html.erb_spec.rb
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module EnjuNii
|
2
|
-
class Ability
|
3
|
-
include CanCan::Ability
|
4
|
-
|
5
|
-
def initialize(user, ip_address = '0.0.0.0')
|
6
|
-
case user.try(:role).try(:name)
|
7
|
-
when 'Administrator'
|
8
|
-
can [:read, :create, :update], NiiType
|
9
|
-
can [:destroy, :delete], NiiType do |nii_type|
|
10
|
-
true unless nii_type.manifestations.exists?
|
11
|
-
end if LibraryGroup.site_config.network_access_allowed?(ip_address)
|
12
|
-
else
|
13
|
-
can :read, NiiType
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
#module EnjuNii
|
2
|
-
class Ability
|
3
|
-
include CanCan::Ability
|
4
|
-
|
5
|
-
def initialize(user, ip_address = '0.0.0.0')
|
6
|
-
case user.try(:role).try(:name)
|
7
|
-
when 'Administrator'
|
8
|
-
can [:read, :update], NiiType
|
9
|
-
can [:destroy, :delete], NiiType do |nii_type|
|
10
|
-
true unless nii_type.manifestations.exists?
|
11
|
-
end if LibraryGroup.site_config.network_access_allowed?(ip_address)
|
12
|
-
else
|
13
|
-
can :read, NiiType
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
#end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
defaults: &defaults
|
2
|
-
enju:
|
3
|
-
web_hostname: localhost
|
4
|
-
web_port_number: 3000
|
5
|
-
|
6
|
-
family_name_first: true
|
7
|
-
max_number_of_results: 500
|
8
|
-
write_search_log_to_file: true
|
9
|
-
csv_charset_conversion: true
|
10
|
-
|
11
|
-
# Choose a locale from 'ca', 'de', 'fr', 'jp', 'uk', 'us'
|
12
|
-
#AMAZON_AWS_HOSTNAME = 'ecs.amazonaws.com'
|
13
|
-
amazon:
|
14
|
-
aws_hostname: ecs.amazonaws.jp
|
15
|
-
hostname: www.amazon.co.jp
|
16
|
-
access_key: REPLACE_WITH_YOUR_AMAZON_ACCESS_KEY
|
17
|
-
secret_access_key: REPLACE_WITH_YOUR_AMAZON_SECRET_ACCESS_KEY
|
18
|
-
|
19
|
-
# :google, :amazon
|
20
|
-
book_jacket:
|
21
|
-
source: :google
|
22
|
-
unknown_resource:
|
23
|
-
|
24
|
-
# :mozshot, :simpleapi, :heartrails, :thumbalizr
|
25
|
-
screenshot:
|
26
|
-
generator: :mozshot
|
27
|
-
|
28
|
-
uploaded_file:
|
29
|
-
storage: :local
|
30
|
-
|
31
|
-
development:
|
32
|
-
<<: *defaults
|
33
|
-
|
34
|
-
test:
|
35
|
-
<<: *defaults
|
36
|
-
|
37
|
-
production:
|
38
|
-
<<: *defaults
|