enju_leaf 1.1.4 → 1.2.0.beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.rdoc +3 -3
- data/app/assets/javascripts/autocomplete_agent.js +30 -0
- data/app/assets/javascripts/{menu.enju.js → enju.menu.js} +5 -0
- data/app/assets/javascripts/enju_leaf.js +3 -3
- data/app/assets/javascripts/portlets.js +2 -2
- data/app/assets/stylesheets/enju.css +52 -18
- data/app/assets/stylesheets/enju_leaf.css +2 -0
- data/app/controllers/concerns/enju_leaf/controller.rb +225 -0
- data/app/controllers/my_accounts_controller.rb +9 -7
- data/app/controllers/names_controller.rb +60 -0
- data/app/controllers/page_controller.rb +5 -4
- data/app/controllers/profiles_controller.rb +13 -4
- data/app/controllers/roles_controller.rb +11 -2
- data/app/controllers/user_export_files_controller.rb +13 -3
- data/app/controllers/user_groups_controller.rb +12 -3
- data/app/controllers/user_import_files_controller.rb +14 -4
- data/app/controllers/user_import_results_controller.rb +11 -1
- data/app/jobs/user_export_file_job.rb +7 -0
- data/app/jobs/user_import_file_job.rb +7 -0
- data/app/mailers/notifier.rb +0 -2
- data/app/models/concerns/calculate_stat.rb +35 -0
- data/app/models/concerns/enju_leaf/enju_user.rb +309 -0
- data/app/models/concerns/export_file.rb +19 -0
- data/app/models/concerns/import_file.rb +89 -0
- data/app/models/concerns/master_model.rb +38 -0
- data/app/models/profile.rb +2 -2
- data/app/models/user_export_file.rb +0 -2
- data/app/models/user_group.rb +0 -3
- data/app/models/user_import_file.rb +0 -1
- data/app/policies/application_policy.rb +53 -0
- data/app/policies/name_policy.rb +21 -0
- data/app/policies/profile_policy.rb +55 -0
- data/app/policies/role_policy.rb +21 -0
- data/app/policies/user_export_file_policy.rb +21 -0
- data/app/policies/user_group_policy.rb +22 -0
- data/app/policies/user_import_file_policy.rb +21 -0
- data/app/policies/user_import_result_policy.rb +21 -0
- data/app/views/devise/sessions/{new.mobile.erb → new.html+phone.erb} +0 -0
- data/app/views/layouts/{application.mobile.erb → application.html+phone.erb} +0 -0
- data/app/views/layouts/application.html.erb +2 -2
- data/app/views/layouts/devise/{passwords.mobile.erb → passwords.html+phone.erb} +0 -0
- data/app/views/layouts/devise/{sessions.mobile.erb → sessions.html+phone.erb} +0 -0
- data/app/views/my_accounts/{show.mobile.erb → show.html+phone.erb} +0 -0
- data/app/views/my_accounts/show.html.erb +3 -3
- data/app/views/names/_form.html.erb +41 -0
- data/app/views/names/edit.html.erb +6 -0
- data/app/views/names/index.html.erb +37 -0
- data/app/views/names/new.html.erb +5 -0
- data/app/views/names/show.html.erb +34 -0
- data/app/views/page/{403.mobile.erb → 403.html+phone.erb} +0 -0
- data/app/views/page/{404.mobile.erb → 404.html+phone.erb} +0 -0
- data/app/views/page/{500.mobile.erb → 500.html+phone.erb} +0 -0
- data/app/views/page/_footer.html+phone.erb +3 -0
- data/app/views/page/_footer.html.erb +3 -10
- data/app/views/page/{_index.mobile.erb → _index.html+phone.erb} +0 -0
- data/app/views/page/_menu.html.erb +1 -1
- data/app/views/page/{_mobile.mobile.erb → _mobile.html+phone.erb} +0 -0
- data/app/views/page/{_search_form.mobile.erb → _search_form.html+phone.erb} +0 -0
- data/app/views/page/_select_locale.html.erb +1 -1
- data/app/views/page/configuration.html.erb +1 -1
- data/app/views/page/{index.mobile.erb → index.html+phone.erb} +0 -0
- data/app/views/profiles/edit.html.erb +1 -1
- data/app/views/profiles/index.html.erb +5 -5
- data/app/views/profiles/{show.mobile.erb → show.html+phone.erb} +0 -0
- data/app/views/profiles/show.html.erb +9 -4
- data/app/views/roles/index.html.erb +2 -2
- data/app/views/roles/show.html.erb +1 -1
- data/app/views/user_groups/_form.html.erb +1 -1
- data/app/views/user_groups/index.html.erb +4 -4
- data/app/views/user_groups/show.html.erb +2 -2
- data/config/locales/translation_ja.yml +2 -2
- data/config/routes.rb +1 -4
- data/db/migrate/20151126005552_add_provider_to_identity.rb +5 -0
- data/db/migrate/20160627232219_add_most_recent_to_user_import_file_transitions.rb +9 -0
- data/db/migrate/20160627232316_add_most_recent_to_user_export_file_transitions.rb +9 -0
- data/lib/enju_leaf/engine.rb +4 -8
- data/lib/enju_leaf/helper.rb +1 -1
- data/lib/enju_leaf/version.rb +1 -1
- data/lib/enju_leaf.rb +0 -249
- data/lib/generators/enju_leaf/setup/setup_generator.rb +19 -26
- data/lib/generators/enju_leaf/setup/templates/config/initializers/enju_leaf.rb +1 -0
- data/lib/tasks/enju_leaf_tasks.rake +2 -2
- data/spec/controllers/profiles_controller_spec.rb +22 -12
- data/spec/controllers/user_export_files_controller_spec.rb +9 -10
- data/spec/controllers/user_groups_controller_spec.rb +9 -9
- data/spec/controllers/user_import_files_controller_spec.rb +6 -6
- data/spec/controllers/user_import_results_controller_spec.rb +3 -3
- data/spec/dummy/app/controllers/application_controller.rb +6 -7
- data/spec/dummy/app/models/user.rb +4 -5
- data/spec/dummy/config/application.rb +6 -38
- data/spec/dummy/config/environments/development.rb +22 -18
- data/spec/dummy/config/environments/production.rb +46 -34
- data/spec/dummy/config/environments/test.rb +19 -14
- data/spec/dummy/config/initializers/enju_leaf.rb +2 -0
- data/spec/dummy/config/routes.rb +5 -1
- data/spec/dummy/db/migrate/20151213070943_add_translation_table_to_library_group.rb +13 -0
- data/spec/dummy/db/migrate/20151213072705_add_footer_banner_to_library_group.rb +9 -0
- data/spec/dummy/db/schema.rb +15 -0
- data/spec/factories/profile.rb +6 -6
- data/spec/models/user_export_file_spec.rb +1 -1
- data/spec/models/user_import_file_spec.rb +5 -5
- data/spec/rails_helper.rb +4 -11
- data/spec/routing/users_spec.rb +14 -0
- data/spec/spec_helper.rb +1 -1
- data/spec/support/devise.rb +2 -2
- data/spec/views/my_accounts/show.html.erb_spec.rb +43 -0
- data/spec/views/page/about.html.erb_spec.rb +0 -3
- data/spec/views/page/advanced_search.html.erb_spec.rb +1 -4
- data/spec/views/page/configuration.html.erb_spec.rb +0 -3
- data/spec/views/page/export.html.erb_spec.rb +0 -3
- data/spec/views/page/import.html.erb_spec.rb +0 -3
- data/spec/views/page/index.html.erb_spec.rb +1 -4
- data/spec/views/page/opensearch.xml.builder_spec.rb +1 -4
- data/spec/views/page/statistics.html.erb_spec.rb +0 -3
- data/spec/views/profiles/edit.html.erb_spec.rb +11 -14
- data/spec/views/profiles/index.html.erb_spec.rb +3 -4
- data/spec/views/profiles/show.html.erb_spec.rb +3 -8
- data/spec/views/user_import_results/index.html.erb_spec.rb +0 -3
- data/vendor/assets/javascripts/jquery.highlight.js +97 -56
- metadata +114 -288
- data/app/assets/javascripts/tab_view.js +0 -4
- data/app/models/enju_leaf/ability.rb +0 -102
- data/app/views/page/_footer.mobile.erb +0 -3
- data/app/workers/user_export_file_queue.rb +0 -7
- data/app/workers/user_import_file_queue.rb +0 -7
- data/config/initializers/resque.rb +0 -1
- data/lib/enju_leaf/calculate_stat.rb +0 -42
- data/lib/enju_leaf/controller.rb +0 -24
- data/lib/enju_leaf/export_file.rb +0 -26
- data/lib/enju_leaf/import_file.rb +0 -99
- data/lib/enju_leaf/master_model.rb +0 -42
- data/lib/enju_leaf/user.rb +0 -317
- data/lib/plugins/ext/mobylette/resolvers/chained_fallback_resolver.rb +0 -73
- data/lib/plugins/ext/mobylette.rb +0 -2
- data/lib/plugins/ext/sunspot/abstract_search.rb +0 -12
- data/lib/plugins/ext/sunspot/dismax.rb +0 -41
- data/lib/plugins/ext/sunspot/start_record.rb +0 -55
- data/lib/plugins/ext/sunspot.rb +0 -3
- data/lib/plugins/ext.rb +0 -2
- data/lib/plugins.rb +0 -2
- data/spec/dummy/config/application.yml +0 -47
- data/spec/routing/accounts_spec.rb +0 -14
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bddebc600e5d6d8fb8f3a0117cbd5bdaab34c711
|
|
4
|
+
data.tar.gz: ab1f301430da8166e9ac10b9d7b94c39dc607ffb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5b2285b9dfdb9d0ecd2e6abdb888d9694336645b16d29369c73a45e29345f53ed9db4db4d2fd3496407d7abe6dfb87344ba3b5fb6ab923c69ac19f3319c33e1f
|
|
7
|
+
data.tar.gz: d31402743602b18a903e83c0ada8a6c33124cfc5a7561089e08c3b0666986fe441d999e94e12b2560cf8c322411d980e76e2b8546eb58df10a531de0480d3126
|
data/README.rdoc
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
= Next-L Enju Leaf
|
|
2
|
-
{<img src="https://travis-ci.org/next-l/enju_leaf.svg?branch=1.
|
|
3
|
-
{<img src="https://coveralls.io/repos/next-l/
|
|
4
|
-
{<img src="https://hakiri.io/github/next-l/enju_leaf/1.
|
|
2
|
+
{<img src="https://travis-ci.org/next-l/enju_leaf.svg?branch=1.2" alt="Build Status" />}[https://travis-ci.org/next-l/enju_leaf]
|
|
3
|
+
{<img src="https://coveralls.io/repos/next-l/enju_leaf/badge.svg?branch=1.2&service=github" alt="Coverage Status" />}[https://coveralls.io/github/next-l/enju_leaf?branch=1.2]
|
|
4
|
+
{<img src="https://hakiri.io/github/next-l/enju_leaf/1.2.svg" alt="security" />}[https://hakiri.io/github/next-l/enju_leaf/1.2]
|
|
5
5
|
|
|
6
6
|
Next-L Enju Leaf は、{Project Next-L}[http://www.next-l.jp] で開発している図書館管理システムです。
|
|
7
7
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
$(document).ready(function(){
|
|
2
|
+
$("#creator_form").on('cocoon:after-insert', function(e, added_task){
|
|
3
|
+
$('.creator_full_name').focus(function(){
|
|
4
|
+
$(this).autocomplete({
|
|
5
|
+
minLength: 1,
|
|
6
|
+
//source: '/agents.json'
|
|
7
|
+
source: function(request, response){
|
|
8
|
+
$.ajax({
|
|
9
|
+
url: '/agents.json',
|
|
10
|
+
datatype: 'json',
|
|
11
|
+
data: {
|
|
12
|
+
query: request.term + '*'
|
|
13
|
+
},
|
|
14
|
+
success: function(data) {
|
|
15
|
+
response(data);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
},
|
|
19
|
+
select: function(event, ui){
|
|
20
|
+
//console.log(added_task[0].getElementsByTagName('input')[0]);
|
|
21
|
+
added_task[0].getElementsByTagName('input')[0].value = ui.item.agent_id;
|
|
22
|
+
}
|
|
23
|
+
}).data("ui-autocomplete")._renderItem = function(ul, item) {
|
|
24
|
+
return $( "<li>" )
|
|
25
|
+
.append( "<a>" + item.label + "<br>" + item.desc + "</a>" )
|
|
26
|
+
.appendTo(ul);
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
//= require jquery.shortcut
|
|
5
5
|
//= require jquery.cookie
|
|
6
6
|
//= require jquery.ui.menubar
|
|
7
|
-
//= require menu.enju
|
|
8
7
|
//= require select_locale
|
|
9
8
|
//= require portlets
|
|
10
|
-
//= require
|
|
9
|
+
//= require enju.menu
|
|
11
10
|
//= require jquery.powertip
|
|
12
|
-
//= require
|
|
11
|
+
//= require cocoon
|
|
12
|
+
//= require autocomplete_agent
|
|
@@ -22,7 +22,7 @@ function saveOrder(year, month, day, root_path) {
|
|
|
22
22
|
function restoreOrder() {
|
|
23
23
|
$(".column").each(function(index, value) {
|
|
24
24
|
var columnId = value.id;
|
|
25
|
-
var cookieName = "listOrder" + columnId
|
|
25
|
+
var cookieName = "listOrder" + columnId;
|
|
26
26
|
var cookie = $.cookie(cookieName);
|
|
27
27
|
if ( cookie == null ) { return; }
|
|
28
28
|
var IDs = cookie.split(",");
|
|
@@ -32,7 +32,7 @@ function restoreOrder() {
|
|
|
32
32
|
continue;
|
|
33
33
|
}
|
|
34
34
|
var portletId = toks[0];
|
|
35
|
-
var visible = toks[1]
|
|
35
|
+
var visible = toks[1];
|
|
36
36
|
var portlet = $(".column")
|
|
37
37
|
.find('#' + portletId)
|
|
38
38
|
.appendTo($('#' + columnId));
|
|
@@ -129,10 +129,6 @@ div#pickup_book_jacket{
|
|
|
129
129
|
text-align: center;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
img.book_jacket{
|
|
133
|
-
border: 1px solid;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
132
|
img.screen_shot{
|
|
137
133
|
border: 0;
|
|
138
134
|
}
|
|
@@ -341,7 +337,18 @@ li{
|
|
|
341
337
|
}
|
|
342
338
|
|
|
343
339
|
input.resource_title{
|
|
344
|
-
width:
|
|
340
|
+
width: 100%;
|
|
341
|
+
box-sizing: border-box;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
input.resource_name{
|
|
345
|
+
width: 80%;
|
|
346
|
+
box-sizing: border-box;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
input.resource_subject{
|
|
350
|
+
width: 50%;
|
|
351
|
+
box-sizing: border-box;
|
|
345
352
|
}
|
|
346
353
|
|
|
347
354
|
input.resource_locale{
|
|
@@ -358,19 +365,25 @@ input.resource_zip_code{
|
|
|
358
365
|
}
|
|
359
366
|
|
|
360
367
|
input.resource_url{
|
|
361
|
-
width:
|
|
368
|
+
width: 100%;
|
|
369
|
+
box-sizing: border-box;
|
|
362
370
|
}
|
|
363
371
|
|
|
364
|
-
input.resource_isbn_issn
|
|
365
|
-
width:
|
|
372
|
+
input.resource_isbn_issn{
|
|
373
|
+
width: 20em;
|
|
366
374
|
ime-mode: disabled;
|
|
367
375
|
}
|
|
368
376
|
|
|
369
|
-
input.
|
|
377
|
+
input.resource_identifier, input.resource_user_number, input.resource_user, input.resource_item_identifier{
|
|
370
378
|
width: 20em;
|
|
371
379
|
ime-mode: disabled;
|
|
372
380
|
}
|
|
373
381
|
|
|
382
|
+
input.resource_identifier_body{
|
|
383
|
+
width: 40em;
|
|
384
|
+
ime-mode: disabled;
|
|
385
|
+
}
|
|
386
|
+
|
|
374
387
|
input.resource_integer{
|
|
375
388
|
width: 5em;
|
|
376
389
|
ime-mode: disabled;
|
|
@@ -398,18 +411,11 @@ input.short_name{
|
|
|
398
411
|
}
|
|
399
412
|
|
|
400
413
|
textarea{
|
|
401
|
-
width:
|
|
414
|
+
width: 100%;
|
|
415
|
+
box-sizing: border-box;
|
|
402
416
|
height: 10em;
|
|
403
417
|
}
|
|
404
418
|
|
|
405
|
-
p#post_to_twitter{
|
|
406
|
-
margin-left: 10px;
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
input.twitter_text{
|
|
410
|
-
width:40em;
|
|
411
|
-
}
|
|
412
|
-
|
|
413
419
|
textarea#message_body{
|
|
414
420
|
width: 40em;
|
|
415
421
|
height: 20em;
|
|
@@ -531,6 +537,10 @@ div.book_jacket{
|
|
|
531
537
|
width: 190px;
|
|
532
538
|
}
|
|
533
539
|
|
|
540
|
+
div.book_jacket img.book_jacket{
|
|
541
|
+
border: 1px solid rgba(0, 0, 0, 0.25);
|
|
542
|
+
}
|
|
543
|
+
|
|
534
544
|
div.search_form{
|
|
535
545
|
margin-bottom: 10px;
|
|
536
546
|
}
|
|
@@ -539,3 +549,27 @@ div.search_form{
|
|
|
539
549
|
|
|
540
550
|
.enju_table_header{
|
|
541
551
|
}
|
|
552
|
+
|
|
553
|
+
.bold {
|
|
554
|
+
font-weight: bold;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
.normal-weight {
|
|
558
|
+
font-weight: normal;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
.right {
|
|
562
|
+
text-align: right;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
.center {
|
|
566
|
+
text-align: center;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
.nowrap {
|
|
570
|
+
white-space: nowrap;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
.display-none {
|
|
574
|
+
display: none;
|
|
575
|
+
}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
module EnjuLeaf
|
|
2
|
+
module Controller
|
|
3
|
+
extend ActiveSupport::Concern
|
|
4
|
+
|
|
5
|
+
included do
|
|
6
|
+
before_action :get_library_group, :set_locale, :set_available_languages, :set_mobile_request
|
|
7
|
+
before_action :store_current_location, unless: :devise_controller?
|
|
8
|
+
rescue_from Pundit::NotAuthorizedError, with: :render_403
|
|
9
|
+
#rescue_from ActiveRecord::RecordNotFound, with: :render_404
|
|
10
|
+
rescue_from Errno::ECONNREFUSED, with: :render_500_nosolr
|
|
11
|
+
#rescue_from ActionView::MissingTemplate, with: :render_404_invalid_format
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
private
|
|
15
|
+
|
|
16
|
+
def render_403
|
|
17
|
+
return if performed?
|
|
18
|
+
if user_signed_in?
|
|
19
|
+
respond_to do |format|
|
|
20
|
+
format.html {render template: 'page/403', status: 403}
|
|
21
|
+
#format.html.phone {render template: 'page/403', status: 403}
|
|
22
|
+
format.xml {render template: 'page/403', status: 403}
|
|
23
|
+
format.json { render text: '{"error": "forbidden"}' }
|
|
24
|
+
format.rss {render template: 'page/403.xml', status: 403}
|
|
25
|
+
end
|
|
26
|
+
else
|
|
27
|
+
respond_to do |format|
|
|
28
|
+
format.html { redirect_to main_app.new_user_session_url }
|
|
29
|
+
#format.html.phone { redirect_to new_user_session_url }
|
|
30
|
+
format.xml { render template: 'page/403', status: 403 }
|
|
31
|
+
format.json { render text: '{"error": "forbidden"}' }
|
|
32
|
+
format.rss { render template: 'page/403.xml', status: 403 }
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def render_404
|
|
38
|
+
return if performed?
|
|
39
|
+
respond_to do |format|
|
|
40
|
+
format.html { render template: 'page/404', status: 404 }
|
|
41
|
+
#format.html.phone { render template: 'page/404', status: 404 }
|
|
42
|
+
format.xml { render template: 'page/404', status: 404 }
|
|
43
|
+
format.json { render text: '{"error": "not_found"}' }
|
|
44
|
+
format.rss { render template: 'page/404.xml', status: 404 }
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def render_404_invalid_format
|
|
49
|
+
return if performed?
|
|
50
|
+
render file: "#{Rails.root}/public/404", formats: [:html]
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def render_500
|
|
54
|
+
return if performed?
|
|
55
|
+
respond_to do |format|
|
|
56
|
+
format.html {render file: "#{Rails.root}/public/500", layout: false, status: 500}
|
|
57
|
+
#format.html.phone {render file: "#{Rails.root}/public/500", layout: false, status: 500}
|
|
58
|
+
format.xml {render template: 'page/500', status: 500}
|
|
59
|
+
format.json { render text: '{"error": "server_error"}' }
|
|
60
|
+
format.xml {render template: 'page/500.xml', status: 500}
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def render_500_nosolr
|
|
65
|
+
Rails.logger.fatal("please confirm that the Solr is running.")
|
|
66
|
+
return if performed?
|
|
67
|
+
#flash[:notice] = t('page.connection_failed')
|
|
68
|
+
respond_to do |format|
|
|
69
|
+
format.html {render template: "page/500_nosolr", layout: false, status: 500}
|
|
70
|
+
#format.html.phone {render template: "page/500_nosolr", layout: false, status: 500}
|
|
71
|
+
format.xml {render template: 'page/500', status: 500}
|
|
72
|
+
format.json { render text: '{"error": "server_error"}' }
|
|
73
|
+
format.xml {render template: 'page/500.xml', status: 500}
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def after_sign_in_path_for(resource)
|
|
78
|
+
session[:locale] = nil
|
|
79
|
+
super
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def set_locale
|
|
83
|
+
if params[:locale]
|
|
84
|
+
unless I18n.available_locales.include?(params[:locale].to_s.intern)
|
|
85
|
+
raise InvalidLocaleError
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
if user_signed_in?
|
|
89
|
+
locale = params[:locale] || session[:locale] || current_user.profile.try(:locale).try(:to_sym)
|
|
90
|
+
else
|
|
91
|
+
locale = params[:locale] || session[:locale]
|
|
92
|
+
end
|
|
93
|
+
if locale
|
|
94
|
+
I18n.locale = @locale = session[:locale] = locale.to_sym
|
|
95
|
+
else
|
|
96
|
+
I18n.locale = @locale = session[:locale] = I18n.default_locale
|
|
97
|
+
end
|
|
98
|
+
rescue InvalidLocaleError
|
|
99
|
+
@locale = I18n.default_locale
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def default_url_options(options={})
|
|
103
|
+
{locale: nil}
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def set_available_languages
|
|
107
|
+
if Rails.env == 'production'
|
|
108
|
+
@available_languages = Rails.cache.fetch('available_languages'){
|
|
109
|
+
Language.where(iso_639_1: I18n.available_locales.map{|l| l.to_s}).select([:id, :iso_639_1, :name, :native_name, :display_name, :position]).all
|
|
110
|
+
}
|
|
111
|
+
else
|
|
112
|
+
@available_languages = Language.where(iso_639_1: I18n.available_locales.map{|l| l.to_s})
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def reset_params_session
|
|
117
|
+
session[:params] = nil
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def not_found
|
|
121
|
+
raise ActiveRecord::RecordNotFound
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def access_denied
|
|
125
|
+
raise Pundit::NotAuthorizedError
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def get_user
|
|
129
|
+
@user = User.where(username: params[:user_id]).first if params[:user_id]
|
|
130
|
+
#authorize! :show, @user if @user
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
def get_user_group
|
|
134
|
+
@user_group = UserGroup.find(params[:user_group_id]) if params[:user_group_id]
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def convert_charset
|
|
138
|
+
case params[:format]
|
|
139
|
+
when 'csv'
|
|
140
|
+
return unless LibraryGroup.site_config.settings[:csv_charset_conversion]
|
|
141
|
+
# TODO: 他の言語
|
|
142
|
+
if @locale.to_sym == :ja
|
|
143
|
+
headers["Content-Type"] = "text/csv; charset=Shift_JIS"
|
|
144
|
+
response.body = NKF::nkf('-Ws', response.body)
|
|
145
|
+
end
|
|
146
|
+
when 'xml'
|
|
147
|
+
if @locale.to_sym == :ja
|
|
148
|
+
headers["Content-Type"] = "application/xml; charset=Shift_JIS"
|
|
149
|
+
response.body = NKF::nkf('-Ws', response.body)
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
def store_page
|
|
155
|
+
if request.get? and request.format.try(:html?) and !request.xhr?
|
|
156
|
+
flash[:page] = params[:page] if params[:page].to_i > 0
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
def set_role_query(user, search)
|
|
161
|
+
role = user.try(:role) || Role.default_role
|
|
162
|
+
search.build do
|
|
163
|
+
with(:required_role_id).less_than_or_equal_to role.id
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
def get_version
|
|
168
|
+
@version = params[:version_id].to_i if params[:version_id]
|
|
169
|
+
@version = nil if @version == 0
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
def clear_search_sessions
|
|
173
|
+
session[:query] = nil
|
|
174
|
+
session[:params] = nil
|
|
175
|
+
session[:search_params] = nil
|
|
176
|
+
session[:manifestation_ids] = nil
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
def api_request?
|
|
180
|
+
true unless params[:format].nil? or params[:format] == 'html'
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
def get_top_page_content
|
|
184
|
+
if defined?(EnjuNews)
|
|
185
|
+
@news_feeds = Rails.cache.fetch('news_feed_all'){NewsFeed.order(:position)}
|
|
186
|
+
@news_posts = NewsPost.limit(LibraryGroup.site_config.settings[:news_post_number_top_page] || 10)
|
|
187
|
+
end
|
|
188
|
+
@libraries = Library.real
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
def set_mobile_request
|
|
192
|
+
case params[:view]
|
|
193
|
+
when 'phone'
|
|
194
|
+
session[:enju_view] = :phone
|
|
195
|
+
when 'desktop'
|
|
196
|
+
session[:enju_view] = :desktop
|
|
197
|
+
when 'reset'
|
|
198
|
+
session[:enju_view] = nil
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
case session[:enju_view].try(:to_sym)
|
|
202
|
+
when :phone
|
|
203
|
+
request.variant = :phone
|
|
204
|
+
when :desktop
|
|
205
|
+
request.variant = nil
|
|
206
|
+
else
|
|
207
|
+
request.variant = :phone if browser.device.mobile?
|
|
208
|
+
end
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
def move_position(resource, direction, redirect = true)
|
|
212
|
+
if ['higher', 'lower'].include?(direction)
|
|
213
|
+
resource.send("move_#{direction}")
|
|
214
|
+
if redirect
|
|
215
|
+
redirect_to url_for(controller: resource.class.to_s.pluralize.underscore)
|
|
216
|
+
return
|
|
217
|
+
end
|
|
218
|
+
end
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
def store_current_location
|
|
222
|
+
store_location_for(:user, request.url)
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
end
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
class MyAccountsController < ApplicationController
|
|
2
|
-
|
|
2
|
+
before_action :authenticate_user!
|
|
3
|
+
before_action :set_profile
|
|
3
4
|
|
|
4
5
|
def show
|
|
5
|
-
@profile = current_user.profile
|
|
6
|
-
|
|
7
6
|
respond_to do |format|
|
|
8
7
|
format.html
|
|
8
|
+
format.html.phone
|
|
9
9
|
format.json { render json: @profile }
|
|
10
10
|
end
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
def edit
|
|
14
|
-
@profile = current_user.profile
|
|
15
14
|
prepare_options
|
|
16
15
|
end
|
|
17
16
|
|
|
18
17
|
def update
|
|
19
|
-
@profile = current_user.profile
|
|
20
18
|
user_attrs = [
|
|
21
19
|
:id, :email, :current_password, :password, :password_confirmation
|
|
22
20
|
]
|
|
@@ -32,7 +30,7 @@ class MyAccountsController < ApplicationController
|
|
|
32
30
|
|
|
33
31
|
if saved
|
|
34
32
|
if @profile.save
|
|
35
|
-
|
|
33
|
+
bypass_sign_in(current_user)
|
|
36
34
|
format.html { redirect_to my_account_url, notice: t('controller.successfully_updated', model: t('activerecord.models.user')) }
|
|
37
35
|
format.json { head :no_content }
|
|
38
36
|
else
|
|
@@ -52,7 +50,6 @@ class MyAccountsController < ApplicationController
|
|
|
52
50
|
end
|
|
53
51
|
|
|
54
52
|
def destroy
|
|
55
|
-
@profile = current_user.profile
|
|
56
53
|
@profile.destroy
|
|
57
54
|
|
|
58
55
|
respond_to do |format|
|
|
@@ -62,6 +59,11 @@ class MyAccountsController < ApplicationController
|
|
|
62
59
|
end
|
|
63
60
|
|
|
64
61
|
private
|
|
62
|
+
def set_profile
|
|
63
|
+
@profile = current_user.profile
|
|
64
|
+
authorize @profile
|
|
65
|
+
end
|
|
66
|
+
|
|
65
67
|
def profile_params
|
|
66
68
|
attrs = [
|
|
67
69
|
:full_name, :full_name_transcription, :user_number,
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
class NamesController < ApplicationController
|
|
2
|
+
before_action :set_name, only: [:show, :edit, :update, :destroy]
|
|
3
|
+
before_action :check_policy, only: [:index, :new, :create]
|
|
4
|
+
|
|
5
|
+
# GET /names
|
|
6
|
+
def index
|
|
7
|
+
@names = Name.paginate(params[:page])
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# GET /names/1
|
|
11
|
+
def show
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# GET /names/new
|
|
15
|
+
def new
|
|
16
|
+
@name = Name.new
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# GET /names/1/edit
|
|
20
|
+
def edit
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# POST /names
|
|
24
|
+
def create
|
|
25
|
+
@name = Name.new(name_params)
|
|
26
|
+
|
|
27
|
+
if @name.save
|
|
28
|
+
redirect_to @name, notice: 'Name was successfully created.'
|
|
29
|
+
else
|
|
30
|
+
render :new
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# PATCH/PUT /names/1
|
|
35
|
+
def update
|
|
36
|
+
if @name.update(name_params)
|
|
37
|
+
redirect_to @name, notice: 'Name was successfully updated.'
|
|
38
|
+
else
|
|
39
|
+
render :edit
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# DELETE /names/1
|
|
44
|
+
def destroy
|
|
45
|
+
@name.destroy
|
|
46
|
+
redirect_to names_url, notice: 'Name was successfully destroyed.'
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
private
|
|
50
|
+
# Use callbacks to share common setup or constraints between actions.
|
|
51
|
+
def set_name
|
|
52
|
+
@name = Name.find(params[:id])
|
|
53
|
+
authorize @name
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Only allow a trusted parameter "white list" through.
|
|
57
|
+
def name_params
|
|
58
|
+
params.require(:name).permit(:first_name, :middle_name, :last_name, :language_id, :profile_id, :position)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
class PageController < ApplicationController
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
before_action :skip_authorization
|
|
3
|
+
before_action :clear_search_sessions, only: [:index, :advanced_search]
|
|
4
|
+
before_action :authenticate_user!, except: [:index, :advanced_search, :about, :add_on, :msie_accelerator, :opensearch, :statistics, :routing_error]
|
|
5
|
+
before_action :check_librarian, except: [:index, :advanced_search, :about, :add_on, :msie_accelerator, :opensearch, :statistics, :routing_error]
|
|
6
6
|
helper_method :get_libraries
|
|
7
7
|
|
|
8
8
|
# トップページを表示します。
|
|
@@ -40,6 +40,7 @@ class PageController < ApplicationController
|
|
|
40
40
|
|
|
41
41
|
respond_to do |format|
|
|
42
42
|
format.html
|
|
43
|
+
format.html.phone
|
|
43
44
|
end
|
|
44
45
|
end
|
|
45
46
|
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
|
2
1
|
class ProfilesController < ApplicationController
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
before_action :set_profile, only: [:show, :edit, :update, :destroy]
|
|
3
|
+
before_action :check_policy, only: [:index, :new, :create]
|
|
4
|
+
before_action :prepare_options, only: [:new, :edit]
|
|
6
5
|
|
|
7
6
|
# GET /profiles
|
|
8
7
|
# GET /profiles.json
|
|
@@ -60,6 +59,7 @@ class ProfilesController < ApplicationController
|
|
|
60
59
|
|
|
61
60
|
respond_to do |format|
|
|
62
61
|
format.html # show.html.erb
|
|
62
|
+
format.html.phone
|
|
63
63
|
format.json { render json: @profile }
|
|
64
64
|
end
|
|
65
65
|
end
|
|
@@ -163,6 +163,15 @@ class ProfilesController < ApplicationController
|
|
|
163
163
|
end
|
|
164
164
|
|
|
165
165
|
private
|
|
166
|
+
def set_profile
|
|
167
|
+
@profile = Profile.find(params[:id])
|
|
168
|
+
authorize @profile
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
def check_policy
|
|
172
|
+
authorize Profile
|
|
173
|
+
end
|
|
174
|
+
|
|
166
175
|
def profile_params
|
|
167
176
|
attrs = [
|
|
168
177
|
:full_name, :full_name_transcription,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
class RolesController < ApplicationController
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
before_action :set_role, only: [:show, :edit, :update, :destroy]
|
|
3
|
+
before_action :check_policy, only: [:index, :new, :create]
|
|
4
4
|
|
|
5
5
|
# GET /roles
|
|
6
6
|
# GET /roles.json
|
|
@@ -46,6 +46,15 @@ class RolesController < ApplicationController
|
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
private
|
|
49
|
+
def set_role
|
|
50
|
+
@role = Role.find(params[:id])
|
|
51
|
+
authorize @role
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def check_policy
|
|
55
|
+
authorize Role
|
|
56
|
+
end
|
|
57
|
+
|
|
49
58
|
def role_params
|
|
50
59
|
params.require(:role).permit(:name, :display_name, :note)
|
|
51
60
|
end
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
class UserExportFilesController < ApplicationController
|
|
2
|
-
|
|
2
|
+
before_action :set_user_export_file, only: [:show, :edit, :update, :destroy]
|
|
3
|
+
before_action :check_policy, only: [:index, :new, :create]
|
|
3
4
|
|
|
4
5
|
# GET /user_export_files
|
|
5
6
|
# GET /user_export_files.json
|
|
@@ -60,7 +61,7 @@ class UserExportFilesController < ApplicationController
|
|
|
60
61
|
respond_to do |format|
|
|
61
62
|
if @user_export_file.save
|
|
62
63
|
if @user_export_file.mode == 'export'
|
|
63
|
-
|
|
64
|
+
UserExportFileJob.perform_later(@user_export_file)
|
|
64
65
|
end
|
|
65
66
|
format.html { redirect_to @user_export_file, notice: t('export.successfully_created', model: t('activerecord.models.user_export_file')) }
|
|
66
67
|
format.json { render json: @user_export_file, status: :created, location: @user_export_file }
|
|
@@ -77,7 +78,7 @@ class UserExportFilesController < ApplicationController
|
|
|
77
78
|
respond_to do |format|
|
|
78
79
|
if @user_export_file.update_attributes(user_export_file_params)
|
|
79
80
|
if @user_export_file.mode == 'export'
|
|
80
|
-
|
|
81
|
+
UserExportFileJob.perform_later(@user_export_file)
|
|
81
82
|
end
|
|
82
83
|
format.html { redirect_to @user_export_file, notice: t('controller.successfully_updated', model: t('activerecord.models.user_export_file')) }
|
|
83
84
|
format.json { head :no_content }
|
|
@@ -100,6 +101,15 @@ class UserExportFilesController < ApplicationController
|
|
|
100
101
|
end
|
|
101
102
|
|
|
102
103
|
private
|
|
104
|
+
def set_user_export_file
|
|
105
|
+
@user_export_file = UserExportFile.find(params[:id])
|
|
106
|
+
authorize @user_export_file
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def check_policy
|
|
110
|
+
authorize UserExportFile
|
|
111
|
+
end
|
|
112
|
+
|
|
103
113
|
def user_export_file_params
|
|
104
114
|
params.require(:user_export_file).permit(:mode)
|
|
105
115
|
end
|