enju_nii 0.1.0.pre10 → 0.1.0.pre11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/nii_types_controller.rb +74 -11
- data/app/models/cinii_book.rb +5 -5
- data/app/models/nii_type.rb +1 -1
- data/app/views/cinii_books/index.html.erb +2 -2
- data/app/views/nii_types/edit.html.erb +2 -2
- data/app/views/nii_types/index.html.erb +2 -2
- data/app/views/nii_types/new.html.erb +2 -2
- data/app/views/nii_types/show.html.erb +2 -2
- data/lib/enju_nii/cinii_book.rb +1 -1
- data/lib/enju_nii/version.rb +1 -1
- data/lib/enju_nii.rb +1 -1
- data/spec/cassette_library/CiniiBook/should_import_a_bibliographic_record.yml +341 -324
- data/spec/cassette_library/CiniiBook/should_search_bibliographic_records.yml +140 -122
- data/spec/cassette_library/CiniiBooksController/GET_index/should_get_index.yml +88 -80
- data/spec/dummy/app/models/user.rb +5 -25
- data/spec/dummy/config/boot.rb +2 -2
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/001_create_agents.rb +0 -3
- data/spec/dummy/db/migrate/{20111201155513_add_devise_to_users.rb → 002_devise_create_users.rb} +18 -16
- data/spec/dummy/db/migrate/005_create_manifestations.rb +0 -1
- data/spec/dummy/db/migrate/006_create_items.rb +0 -3
- data/spec/dummy/db/migrate/041_create_roles.rb +13 -0
- data/spec/dummy/db/migrate/059_create_libraries.rb +28 -0
- data/spec/dummy/db/migrate/069_create_shelves.rb +15 -0
- data/spec/dummy/db/migrate/080_create_library_groups.rb +2 -10
- data/spec/dummy/db/migrate/120_create_baskets.rb +12 -0
- data/spec/dummy/db/migrate/124_create_bookstores.rb +17 -0
- data/spec/dummy/db/migrate/130_create_request_status_types.rb +12 -0
- data/spec/dummy/db/migrate/131_create_request_types.rb +12 -0
- data/spec/dummy/db/migrate/133_create_agent_merges.rb +15 -0
- data/spec/dummy/db/migrate/134_create_agent_merge_lists.rb +13 -0
- data/spec/dummy/db/migrate/20081006090811_create_subscriptions.rb +17 -0
- data/spec/dummy/db/migrate/20081006093246_create_subscribes.rb +14 -0
- data/spec/dummy/db/migrate/20081023092436_create_search_engines.rb +17 -0
- data/spec/dummy/db/migrate/20081028083142_create_agent_import_files.rb +0 -2
- data/spec/dummy/db/migrate/20081028083208_create_resource_import_files.rb +0 -2
- data/spec/dummy/db/migrate/20100129142347_create_import_requests.rb +0 -1
- data/spec/dummy/db/migrate/20100314190054_add_opening_hour_to_library.rb +9 -0
- data/spec/dummy/db/migrate/{20111201163718_create_user_has_roles.rb → 20100606065209_create_user_has_roles.rb} +2 -0
- data/spec/dummy/db/migrate/20100925074559_create_agent_import_results.rb +0 -1
- data/spec/dummy/db/migrate/20110627035057_create_series_statement_merges.rb +1 -1
- data/spec/dummy/db/migrate/20120105074911_add_isil_to_library.rb +5 -0
- data/spec/dummy/db/migrate/{20111201121844_create_roles.rb → 20120129014038_create_budget_types.rb} +2 -2
- data/spec/dummy/db/migrate/20120319173203_create_accepts.rb +14 -0
- data/spec/dummy/db/migrate/20120510140958_add_closed_to_shelf.rb +5 -0
- data/spec/dummy/db/migrate/20130221154434_add_additional_attributes_to_user.rb +1 -11
- data/spec/dummy/db/migrate/20130412083556_add_latitude_and_longitude_to_library.rb +6 -0
- data/spec/dummy/db/migrate/20130506175834_create_identifiers.rb +1 -0
- data/spec/dummy/db/migrate/20130509185724_add_statement_of_responsibility_to_manifestation.rb +5 -0
- data/spec/dummy/db/migrate/20140110122216_create_user_import_files.rb +18 -0
- data/spec/dummy/db/migrate/20140110131010_create_user_import_results.rb +11 -0
- data/spec/dummy/db/migrate/20140122054321_create_profiles.rb +20 -0
- data/spec/dummy/db/migrate/20140519170214_create_resource_import_file_transitions.rb +14 -0
- data/spec/dummy/db/migrate/20140519171220_create_import_request_transitions.rb +14 -0
- data/spec/dummy/db/migrate/20140524020735_create_agent_import_file_transitions.rb +14 -0
- data/spec/dummy/db/migrate/20140524074813_create_user_import_file_transitions.rb +14 -0
- data/spec/dummy/db/migrate/20140610123439_drop_email_unique_constraint_enju_leaf_rc10.rb +11 -0
- data/spec/dummy/db/migrate/20140614065404_create_resource_export_files.rb +11 -0
- data/spec/dummy/db/migrate/20140614141500_create_resource_export_file_transitions.rb +14 -0
- data/spec/dummy/db/migrate/20140628072217_add_user_encoding_to_user_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20140628073524_add_user_encoding_to_agent_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20140628073535_add_user_encoding_to_resource_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20140709113413_create_user_export_files.rb +11 -0
- data/spec/dummy/db/migrate/20140709113905_create_user_export_file_transitions.rb +14 -0
- data/spec/dummy/db/migrate/20140720140916_add_binding_item_identifier_to_item.rb +8 -0
- data/spec/dummy/db/migrate/20140720170714_add_default_library_id_to_user_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20140720170735_add_default_user_group_id_to_user_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20140721151416_add_default_shelf_id_to_resource_import_file.rb +5 -0
- data/spec/dummy/db/migrate/{20130511144310_add_manifestation_id_to_item.rb → 20140802082007_add_manifestation_id_to_item.rb} +1 -0
- data/spec/dummy/db/migrate/20140811031145_add_expired_at_to_profile.rb +5 -0
- data/spec/dummy/db/migrate/20140813182425_add_publication_place_to_manifestation.rb +5 -0
- data/spec/dummy/db/schema.rb +604 -314
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/fixtures/library_groups.yml +0 -2
- data/spec/fixtures/users.yml +0 -28
- data/spec/models/cinii_book_spec.rb +3 -3
- data/spec/spec_helper.rb +6 -1
- metadata +129 -31
- data/spec/dummy/db/migrate/20100222124420_add_allow_bookmark_external_url_to_library_group.rb +0 -9
- data/spec/dummy/db/migrate/20110115022329_add_position_to_library_group.rb +0 -9
- data/spec/dummy/db/migrate/20111009183423_add_ndc_to_manifestation.rb +0 -9
- data/spec/dummy/db/migrate/20111020063828_remove_dsbl_from_library_group.rb +0 -11
- data/spec/dummy/db/migrate/20111201155456_create_users.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ca4b76d89be9270d7d461b92a99b954e8ad23f5
|
4
|
+
data.tar.gz: 7fabd04e6df18842071a3f253fc4620fd8265f4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46bedd5230aecfa4c0b3ed34143ae5cd0e130d8f6a0cf33cf2fb5121a80e11369cd1946473b363883e73aeb413ea2b819ae0618fff351877dbf64d7ab0497f43
|
7
|
+
data.tar.gz: 23ccb56a1a96bc72896507732a6cfefa25b7aaaf638d74db98d120c4c79d7d1e5062039c7e199429f29a14bc72b21bcc52b2863fd7c6246b78860e81d64a580a
|
@@ -1,20 +1,83 @@
|
|
1
|
-
class NiiTypesController <
|
2
|
-
respond_to :html, :json
|
3
|
-
before_filter :check_client_ip_address
|
1
|
+
class NiiTypesController < ApplicationController
|
4
2
|
load_and_authorize_resource
|
3
|
+
# GET /nii_types
|
4
|
+
# GET /nii_types.json
|
5
|
+
def index
|
6
|
+
@nii_types = NiiType.all
|
5
7
|
|
8
|
+
respond_to do |format|
|
9
|
+
format.html # index.html.erb
|
10
|
+
format.json { render json: @nii_types }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
# GET /nii_types/1
|
15
|
+
# GET /nii_types/1.json
|
16
|
+
def show
|
17
|
+
respond_to do |format|
|
18
|
+
format.html # show.html.erb
|
19
|
+
format.json { render json: @nii_type }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# GET /nii_types/new
|
24
|
+
# GET /nii_types/new.json
|
25
|
+
def new
|
26
|
+
@nii_type = NiiType.new
|
27
|
+
|
28
|
+
respond_to do |format|
|
29
|
+
format.html # new.html.erb
|
30
|
+
format.json { render json: @nii_type }
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# GET /nii_types/1/edit
|
35
|
+
def edit
|
36
|
+
end
|
37
|
+
|
38
|
+
# POST /nii_types
|
39
|
+
# POST /nii_types.json
|
40
|
+
def create
|
41
|
+
@nii_type = NiiType.new(params[:nii_type])
|
42
|
+
|
43
|
+
respond_to do |format|
|
44
|
+
if @nii_type.save
|
45
|
+
format.html { redirect_to @nii_type, notice: t('controller.successfully_created', model: t('activerecord.models.nii_type')) }
|
46
|
+
format.json { render json: @nii_type, status: :created, location: @nii_type }
|
47
|
+
else
|
48
|
+
format.html { render action: "new" }
|
49
|
+
format.json { render json: @nii_type.errors, status: :unprocessable_entity }
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# PUT /nii_types/1
|
55
|
+
# PUT /nii_types/1.json
|
6
56
|
def update
|
7
|
-
|
8
|
-
|
9
|
-
@nii_type.insert_at(params[:position])
|
10
|
-
redirect_to nii_types_url
|
57
|
+
if params[:move]
|
58
|
+
move_position(@nii_type, params[:move])
|
11
59
|
return
|
12
60
|
end
|
13
|
-
|
61
|
+
|
62
|
+
respond_to do |format|
|
63
|
+
if @nii_type.update_attributes(params[:nii_type])
|
64
|
+
format.html { redirect_to @nii_type, notice: t('controller.successfully_updated', model: t('activerecord.models.nii_type')) }
|
65
|
+
format.json { head :no_content }
|
66
|
+
else
|
67
|
+
format.html { render action: "edit" }
|
68
|
+
format.json { render json: @nii_type.errors, status: :unprocessable_entity }
|
69
|
+
end
|
70
|
+
end
|
14
71
|
end
|
15
72
|
|
16
|
-
|
17
|
-
|
18
|
-
|
73
|
+
# DELETE /nii_types/1
|
74
|
+
# DELETE /nii_types/1.json
|
75
|
+
def destroy
|
76
|
+
@nii_type.destroy
|
77
|
+
|
78
|
+
respond_to do |format|
|
79
|
+
format.html { redirect_to nii_types_url, notice: t('controller.successfully_deleted', model: t('activerecord.models.nii_type')) }
|
80
|
+
format.json { head :no_content }
|
81
|
+
end
|
19
82
|
end
|
20
83
|
end
|
data/app/models/cinii_book.rb
CHANGED
@@ -41,21 +41,21 @@ class CiniiBook
|
|
41
41
|
if query
|
42
42
|
cnt = self.per_page
|
43
43
|
page = 1 if page.to_i < 1
|
44
|
-
doc = Nokogiri::XML(Manifestation.search_cinii_book(query, {:
|
44
|
+
doc = Nokogiri::XML(Manifestation.search_cinii_book(query, {p: page, count: cnt, raw: true}).to_s)
|
45
45
|
items = doc.xpath('//xmlns:item').collect{|node| self.new node }
|
46
46
|
total_entries = doc.at('//opensearch:totalResults').content.to_i
|
47
47
|
|
48
|
-
{:
|
48
|
+
{items: items, total_entries: total_entries}
|
49
49
|
else
|
50
|
-
{:
|
50
|
+
{items: [], total_entries: 0}
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
54
|
def self.import_ncid(ncid)
|
55
|
-
manifestation = Manifestation.where(:
|
55
|
+
manifestation = Manifestation.where(ncid: ncid).first
|
56
56
|
return if manifestation
|
57
57
|
url = "http://ci.nii.ac.jp/ncid/#{ncid}.rdf"
|
58
|
-
doc = Nokogiri::XML(
|
58
|
+
doc = Nokogiri::XML(Faraday.get(url).body)
|
59
59
|
Manifestation.import_record_from_cinii_books(doc)
|
60
60
|
end
|
61
61
|
|
data/app/models/nii_type.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
<div id="content_detail" class="ui-corner-all">
|
1
|
+
<div id="content_detail" class="ui-corner-all ui-widget-content">
|
2
2
|
<h1 class="title"><%= t('enju_nii.import_from_cinii_books') %></h1>
|
3
3
|
<div id="content_list">
|
4
4
|
<p id="notice"><%= notice %></p>
|
@@ -45,5 +45,5 @@
|
|
45
45
|
</div>
|
46
46
|
</div>
|
47
47
|
|
48
|
-
<div id="submenu" class="ui-corner-all">
|
48
|
+
<div id="submenu" class="ui-corner-all ui-widget-content">
|
49
49
|
</div>
|
@@ -1,11 +1,11 @@
|
|
1
|
-
<div id="content_detail" class="ui-corner-all">
|
1
|
+
<div id="content_detail" class="ui-corner-all ui-widget-content">
|
2
2
|
<h1 class="title"><%= t('page.editing', :model => t('activerecord.models.nii_type')) -%></h1>
|
3
3
|
<div id="content_list">
|
4
4
|
<%= render 'form' %>
|
5
5
|
</div>
|
6
6
|
</div>
|
7
7
|
|
8
|
-
<div id="submenu" class="ui-corner-all">
|
8
|
+
<div id="submenu" class="ui-corner-all ui-widget-content">
|
9
9
|
<ul>
|
10
10
|
<li><%= link_to t('page.show'), @nii_type -%></li>
|
11
11
|
<li><%= link_to t('page.back'), nii_types_path -%></li>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<div id="content_detail" class="ui-corner-all">
|
1
|
+
<div id="content_detail" class="ui-corner-all ui-widget-content">
|
2
2
|
<h1 class="title"><%= t('page.listing', :model => t('activerecord.models.nii_type')) -%></h1>
|
3
3
|
<div id="content_list">
|
4
4
|
|
@@ -38,7 +38,7 @@
|
|
38
38
|
</div>
|
39
39
|
</div>
|
40
40
|
|
41
|
-
<div id="submenu" class="ui-corner-all">
|
41
|
+
<div id="submenu" class="ui-corner-all ui-widget-content">
|
42
42
|
<ul>
|
43
43
|
<li><%= link_to t('page.new', :model => t('activerecord.models.nii_type')), new_nii_type_path -%></li>
|
44
44
|
</ul>
|
@@ -1,11 +1,11 @@
|
|
1
|
-
<div id="content_detail" class="ui-corner-all">
|
1
|
+
<div id="content_detail" class="ui-corner-all ui-widget-content">
|
2
2
|
<h1 class="title"><%= t('page.new', :model => t('activerecord.models.nii_type')) -%></h1>
|
3
3
|
<div id="content_list">
|
4
4
|
<%= render 'form' %>
|
5
5
|
</div>
|
6
6
|
</div>
|
7
7
|
|
8
|
-
<div id="submenu" class="ui-corner-all">
|
8
|
+
<div id="submenu" class="ui-corner-all ui-widget-content">
|
9
9
|
<ul>
|
10
10
|
<li><%= link_to t('page.back'), nii_types_path -%></li>
|
11
11
|
</ul>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<div id="content_detail" class="ui-corner-all">
|
1
|
+
<div id="content_detail" class="ui-corner-all ui-widget-content">
|
2
2
|
<h1 class="title"><%= t('page.showing', :model => t('activerecord.models.nii_type')) -%></h1>
|
3
3
|
<div id="content_list">
|
4
4
|
<p>
|
@@ -19,7 +19,7 @@
|
|
19
19
|
</div>
|
20
20
|
</div>
|
21
21
|
|
22
|
-
<div id="submenu" class="ui-corner-all">
|
22
|
+
<div id="submenu" class="ui-corner-all ui-widget-content">
|
23
23
|
<ul>
|
24
24
|
<li><%= link_to t('page.edit'), edit_nii_type_path(@nii_type) -%></li>
|
25
25
|
<li><%= back_to_index -%></li>
|
data/lib/enju_nii/cinii_book.rb
CHANGED
data/lib/enju_nii/version.rb
CHANGED