Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TSV出力のファイルの拡張子を.textから.txtに変更 #1602

Merged
merged 3 commits into from
Apr 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/controllers/picture_files_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,14 @@ def render_image(file)
disposition = 'inline'
end

if @picture_file.picture.path
if @picture_file.picture.path && file
if ENV['ENJU_STORAGE'] == 's3'
send_data file, filename: File.basename(@picture_file.picture_file_name), type: @picture_file.picture_content_type, disposition: disposition
elsif File.exist?(file) && File.file?(file)
send_file file, filename: File.basename(@picture_file.picture_file_name), type: @picture_file.picture_content_type, disposition: disposition
end
else
render body: nil
end
end
end
8 changes: 4 additions & 4 deletions app/views/agent_import_results/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@
<ul>
<li>
<% if @agent_import_file %>
<%= link_to((image_tag 'icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), agent_import_results_path(agent_import_file_id: @agent_import_file.id, format: :text)) -%>
(<%= link_to 'TSV', agent_import_results_path(agent_import_file_ud: @agent_import_file.id, format: :text) -%>)
<%= link_to((image_tag 'icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), agent_import_results_path(agent_import_file_id: @agent_import_file.id, format: :txt)) -%>
(<%= link_to 'TSV', agent_import_results_path(agent_import_file_ud: @agent_import_file.id, format: :txt) -%>)
<% else %>
<%= link_to((image_tag 'icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), agent_import_results_path(format: :text, locale: @locale.to_s)) -%>
(<%= link_to 'TSV', agent_import_results_path(format: :text, locale: @locale.to_s) -%>)
<%= link_to((image_tag 'icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), agent_import_results_path(format: :txt, locale: @locale.to_s)) -%>
(<%= link_to 'TSV', agent_import_results_path(format: :txt, locale: @locale.to_s) -%>)
<% end %>
</li>
</ul>
Expand Down
4 changes: 2 additions & 2 deletions app/views/checkouts/_index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
<%= link_to image_tag('icons/feed.png', size: '16x16', class: 'enju_icon', alt: 'RSS'), checkouts_path(format: :rss) -%>
</li>
<li>
<%= link_to 'TSV', checkouts_path(format: :text, locale: @locale.to_s) -%>
<%= link_to image_tag('icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), checkouts_path(format: :text, locale: @locale.to_s) -%>
<%= link_to 'TSV', checkouts_path(format: :txt, locale: @locale.to_s) -%>
<%= link_to image_tag('icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), checkouts_path(format: :txt, locale: @locale.to_s) -%>
</li>
</ul>
</div>
4 changes: 2 additions & 2 deletions app/views/checkouts/_index_item.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
<%= link_to image_tag('icons/feed.png', size: '16x16', class: 'enju_icon', alt: 'RSS'), item_checkouts_path(item, format: :rss) -%>
</li>
<li>
<%= link_to 'TSV', item_checkouts_path(item, format: :text, locale: @locale.to_s) -%>
<%= link_to image_tag('icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), item_checkouts_path(item, format: :text, locale: @locale.to_s) -%>
<%= link_to 'TSV', item_checkouts_path(item, format: :txt, locale: @locale.to_s) -%>
<%= link_to image_tag('icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), item_checkouts_path(item, format: :txt, locale: @locale.to_s) -%>
</li>
</ul>
</div>
4 changes: 2 additions & 2 deletions app/views/checkouts/_index_overdue.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
<%= link_to image_tag('icons/feed.png', size: '16x16', class: 'enju_icon', alt: 'RSS'), url_for(filtered_params.merge(format: :rss, days_overdue: params[:days_overdue])) -%>
</li>
<li>
<%= link_to 'TSV', url_for(filtered_params.merge(format: :text, days_overdue: params[:days_overdue], locale: @locale.to_s)) -%>
<%= link_to image_tag('icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), url_for(filtered_params.merge(format: :text, days_overdue: params[:days_overdue], locale: @locale.to_s)) -%>
<%= link_to 'TSV', url_for(filtered_params.merge(format: :txt, days_overdue: params[:days_overdue], locale: @locale.to_s)) -%>
<%= link_to image_tag('icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), url_for(filtered_params.merge(format: :txt, days_overdue: params[:days_overdue], locale: @locale.to_s)) -%>
</li>
</ul>
</div>
8 changes: 4 additions & 4 deletions app/views/checkouts/_index_user.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@
<%= link_to image_tag('icons/feed.png', size: '16x16', class: 'enju_icon', alt: 'RSS'), checkouts_path(user_id: user.username, format: :rss, days_overdue: 1) -%>
</li>
<li>
<%= link_to 'TSV', checkouts_path(user_id: user.username, format: :text, days_overdue: 1, locale: @locale.to_s) -%>
<%= link_to image_tag('icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), checkouts_path(user_id: user.username, format: :text, days_overdue: 1, locale: @locale.to_s) -%>
<%= link_to 'TSV', checkouts_path(user_id: user.username, format: :txt, days_overdue: 1, locale: @locale.to_s) -%>
<%= link_to image_tag('icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), checkouts_path(user_id: user.username, format: :txt, days_overdue: 1, locale: @locale.to_s) -%>
</li>
<%- else -%>
<li>
<%= link_to 'RSS', checkouts_path(user_id: user.username, format: :rss) -%>
<%= link_to image_tag('icons/feed.png', size: '16x16', class: 'enju_icon', alt: 'RSS'), checkouts_path(user_id: user.username, format: :rss) -%>
</li>
<li>
<%= link_to 'TSV', checkouts_path(user_id: user.username, format: :text, locale: @locale.to_s) -%>
<%= link_to image_tag('icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), checkouts_path(user_id: user.username, format: :text, locale: @locale.to_s) -%>
<%= link_to 'TSV', checkouts_path(user_id: user.username, format: :txt, locale: @locale.to_s) -%>
<%= link_to image_tag('icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), checkouts_path(user_id: user.username, format: :txt, locale: @locale.to_s) -%>
</li>
<%- end -%>
</ul>
Expand Down
4 changes: 2 additions & 2 deletions app/views/event_import_files/_results.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<h2><%= t('activerecord.models.event_import_result') %></h2>
<p>
<%= link_to((image_tag 'icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), event_import_results_path(event_import_file_id: @event_import_file.id, format: :text, locale: @locale.to_s)) -%>
(<%= link_to 'TSV', event_import_results_path(event_import_file_id: @event_import_file.id, format: :text, locale: @locale.to_s) -%>)
<%= link_to((image_tag 'icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), event_import_results_path(event_import_file_id: @event_import_file.id, format: :txt, locale: @locale.to_s)) -%>
(<%= link_to 'TSV', event_import_results_path(event_import_file_id: @event_import_file.id, format: :txt, locale: @locale.to_s) -%>)
</p>

<table class="table table-striped index">
Expand Down
8 changes: 4 additions & 4 deletions app/views/events/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,16 @@
<%- if @library -%>
<%= link_to (image_tag 'icons/feed.png', size: '16x16', class: 'enju_icon', alt: t('page.feed')), url_for(filtered_params.merge(library_id: @library.name, format: :rss, page: nil)) -%>
(<%= link_to 'RSS', url_for(filtered_params.merge(library_id: @library.name, format: :rss, page: nil)) -%>)
<%= link_to (image_tag 'icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), url_for(filtered_params.merge(library_id: @library.name, format: :text, locale: @locale.to_s)) -%>
(<%= link_to 'TSV', url_for(filtered_params.merge(library_id: @library.name, format: :text, locale: @locale.to_s)) -%>)
<%= link_to (image_tag 'icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), url_for(filtered_params.merge(library_id: @library.name, format: :txt, locale: @locale.to_s)) -%>
(<%= link_to 'TSV', url_for(filtered_params.merge(library_id: @library.name, format: :txt, locale: @locale.to_s)) -%>)
<br />
<%= link_to (image_tag 'icons/calendar.png', size: '16x16', class: 'enju_icon', alt: 'iCalendar'), url_for(filtered_params.merge(library_id: @library.name, format: :ics, locale: @locale.to_s)) -%>
(<%= link_to 'iCalendar', url_for(filtered_params.merge(library_id: @library.name, format: :ics, locale: @locale.to_s)) -%>)
<%- else -%>
<%= link_to (image_tag 'icons/feed.png', size: '16x16', class: 'enju_icon', alt: t('page.feed')), url_for(filtered_params.merge(format: :rss)) -%>
(<%= link_to 'RSS', url_for(filtered_params.merge(format: :rss)) -%>)
<%= link_to (image_tag 'icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), url_for(filtered_params.merge(format: :text, locale: @locale.to_s)) -%>
(<%= link_to 'TSV', url_for(filtered_params.merge(format: :text, locale: @locale.to_s)) -%>)
<%= link_to (image_tag 'icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), url_for(filtered_params.merge(format: :txt, locale: @locale.to_s)) -%>
(<%= link_to 'TSV', url_for(filtered_params.merge(format: :txt, locale: @locale.to_s)) -%>)
<br />
<%= link_to (image_tag 'icons/calendar.png', size: '16x16', class: 'enju_icon', alt: 'iCalendar'), url_for(filtered_params.merge(format: :ics, locale: @locale.to_s)) -%>
(<%= link_to 'iCalendar', url_for(filtered_params.merge(format: :ics, locale: @locale.to_s)) -%>)
Expand Down
4 changes: 2 additions & 2 deletions app/views/inventory_files/_results.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<h2><%= t('activerecord.models.inventory') %></h2>

<p>
<%= link_to((image_tag 'icons/page_white_excel.png', size: '16x16', alt: 'TSV', class: 'enju_icon'), inventories_path(inventory_file_id: @inventory_file.id, format: :text)) -%>
(<%= link_to 'TSV', inventories_path(inventory_file_id: @inventory_file.id, format: :text) -%>)
<%= link_to((image_tag 'icons/page_white_excel.png', size: '16x16', alt: 'TSV', class: 'enju_icon'), inventories_path(inventory_file_id: @inventory_file.id, format: :txt)) -%>
(<%= link_to 'TSV', inventories_path(inventory_file_id: @inventory_file.id, format: :txt) -%>)
</p>

<table class="table table-striped index">
Expand Down
2 changes: 1 addition & 1 deletion app/views/manifestation_checkout_stats/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@
<% end %>
<h4><%= t('page.export') -%></h4>
<ul>
<li><%= link_to 'TSV', manifestation_checkout_stat_path(@manifestation_checkout_stat, format: :text, locale: @locale.to_s) -%></li>
<li><%= link_to 'TSV', manifestation_checkout_stat_path(@manifestation_checkout_stat, format: :txt, locale: @locale.to_s) -%></li>
</ul>
</div>
2 changes: 1 addition & 1 deletion app/views/manifestation_reserve_stats/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@
<% end %>
<h4><%= t('page.export') -%></h4>
<ul>
<li><%= link_to 'TSV', manifestation_reserve_stat_path(@manifestation_reserve_stat, format: :text, locale: @locale.to_s) -%></li>
<li><%= link_to 'TSV', manifestation_reserve_stat_path(@manifestation_reserve_stat, format: :txt, locale: @locale.to_s) -%></li>
</ul>
</div>
2 changes: 1 addition & 1 deletion app/views/manifestations/_export_detail.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<ul>
<li><%= link_to 'RDF/XML', manifestation_url(@manifestation, format: :rdf) %></li>
<li><%= link_to 'MODS', manifestation_url(@manifestation, format: :mods) %></li>
<li><%= link_to 'TSV', manifestation_url(@manifestation, format: :text) %></li>
<li><%= link_to 'TSV', manifestation_url(@manifestation, format: :txt) %></li>
<li><%= link_to 'JSON', manifestation_url(@manifestation, format: :json) %></li>
</ul>
2 changes: 1 addition & 1 deletion app/views/manifestations/_export_list.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<ul>
<li><%= link_to 'RDF/XML', url_for(request.params.merge(format: :rdf, only_path: true)) %>
<li><%= link_to 'MODS', url_for(request.params.merge(format: :mods, only_path: true)) %></li>
<li><%= link_to 'TSV', url_for(request.params.merge(format: :text, only_path: true)) %></li>
<li><%= link_to 'TSV', url_for(request.params.merge(format: :txt, only_path: true)) %></li>
<li><%= link_to 'JSON', url_for(request.params.merge(format: :json, only_path: true)) %></li>
</ul>
2 changes: 1 addition & 1 deletion app/views/profiles/_checkout_list.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<%= t('activerecord.models.checkout') %>
<%= link_to image_tag('icons/date.png', size: '16x16', class: 'enju_icon', alt: 'iCalendar'), checkouts_path(icalendar_token: current_user.profile.checkout_icalendar_token, format: :ics) if current_user.profile.checkout_icalendar_token? %>
<%= link_to image_tag('icons/feed.png', size: '16x16', class: 'enju_icon', alt: 'RSS'), checkouts_path(user_id: current_user.username, format: :rss) %>
<%= link_to image_tag('icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), checkouts_path(user_id: current_user.username, format: :text) %>
<%= link_to image_tag('icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), checkouts_path(user_id: current_user.username, format: :txt) %>
</h2>
<% if profile.user %>
<%= render 'checkouts/list', checkouts: profile.user.checkouts.order('created_at DESC').page(params[:page]) %>
Expand Down
8 changes: 4 additions & 4 deletions app/views/reserves/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@
<%- if @user -%>
<%= link_to image_tag('icons/feed.png', size: '16x16', class: 'enju_icon', alt: t('page.feed')), url_for(filtered_params.merge(user_id: @user.username, format: :rss)) -%>
(<%= link_to 'RSS', url_for(filtered_params.merge(user_id: @user.username, format: :rss)) -%>)
<%= link_to image_tag('icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), url_for(filtered_params.merge(user_id: @user.username, format: :text, locale: @locale.to_s)) -%>
(<%= link_to 'TSV', url_for(filtered_params.merge(user_id: @user.username, format: :text, locale: @locale.to_s)) -%>)
<%= link_to image_tag('icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), url_for(filtered_params.merge(user_id: @user.username, format: :txt, locale: @locale.to_s)) -%>
(<%= link_to 'TSV', url_for(filtered_params.merge(user_id: @user.username, format: :txt, locale: @locale.to_s)) -%>)
<%- else -%>
<%= link_to image_tag('icons/feed.png', size: '16x16', class: 'enju_icon', alt: t('page.feed')), url_for(filtered_params.merge(format: :rss)) -%>
(<%= link_to 'RSS', url_for(filtered_params.merge(format: :rss)) -%>)
<%= link_to image_tag('icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), url_for(filtered_params.merge(format: :text, locale: @locale.to_s)) -%>
(<%= link_to 'TSV', url_for(filtered_params.merge(format: :text, locale: @locale.to_s)) -%>)
<%= link_to image_tag('icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), url_for(filtered_params.merge(format: :txt, locale: @locale.to_s)) -%>
(<%= link_to 'TSV', url_for(filtered_params.merge(format: :txt, locale: @locale.to_s)) -%>)
<%- end -%>
</p>
</div>
4 changes: 2 additions & 2 deletions app/views/resource_import_files/_results.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<h2><%= t('activerecord.models.resource_import_result') %></h2>

<p>
<%= link_to((image_tag 'icons/page_white_excel.png', size: '16x16', alt: 'TSV', class: 'enju_icon'), resource_import_results_path(resource_import_file_id: @resource_import_file.id, format: :text)) -%>
(<%= link_to 'TSV', resource_import_results_path(resource_import_file_id: @resource_import_file.id, format: :text) -%>)
<%= link_to((image_tag 'icons/page_white_excel.png', size: '16x16', alt: 'TSV', class: 'enju_icon'), resource_import_results_path(resource_import_file_id: @resource_import_file.id, format: :txt)) -%>
(<%= link_to 'TSV', resource_import_results_path(resource_import_file_id: @resource_import_file.id, format: :txt) -%>)
</p>

<table class="table table-striped index">
Expand Down
2 changes: 1 addition & 1 deletion app/views/user_checkout_stats/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@
<% end %>
<h4><%= t('page.export') -%></h4>
<ul>
<li><%= link_to 'TSV', user_checkout_stat_path(@user_checkout_stat, format: :text, locale: @locale.to_s) -%></li>
<li><%= link_to 'TSV', user_checkout_stat_path(@user_checkout_stat, format: :txt, locale: @locale.to_s) -%></li>
</ul>
</div>
4 changes: 2 additions & 2 deletions app/views/user_import_files/_results.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<h2><%= t('activerecord.models.user_import_result') %></h2>
<p>
<%= link_to((image_tag 'icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), user_import_results_path(user_import_file_id: @user_import_file.id, format: :text, locale: @locale.to_s)) -%>
(<%= link_to 'TSV', user_import_results_path(user_import_file_id: @user_import_file.id, format: :text, locale: @locale.to_s) -%>)
<%= link_to((image_tag 'icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), user_import_results_path(user_import_file_id: @user_import_file.id, format: :txt, locale: @locale.to_s)) -%>
(<%= link_to 'TSV', user_import_results_path(user_import_file_id: @user_import_file.id, format: :txt, locale: @locale.to_s) -%>)
</p>

<table class="table table-striped index">
Expand Down
2 changes: 1 addition & 1 deletion app/views/user_reserve_stats/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@
<% end %>
<h4><%= t('page.export') -%></h4>
<ul>
<li><%= link_to 'TSV', user_reserve_stat_path(@user_reserve_stat, format: :text, locale: @locale.to_s) -%></li>
<li><%= link_to 'TSV', user_reserve_stat_path(@user_reserve_stat, format: :txt, locale: @locale.to_s) -%></li>
</ul>
</div>
33 changes: 33 additions & 0 deletions spec/system/checkouts_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
require 'rails_helper'

RSpec.describe 'Checkouts', type: :system do
include Devise::Test::IntegrationHelpers
fixtures :all

before(:each) do
CarrierType.find_by(name: 'volume').update(attachment: File.open("#{Rails.root.to_s}/app/assets/images/icons/book.png"))
end

describe 'When logged in as Librarian' do
it 'should contain query params in the facet' do
sign_in users(:librarian1)
visit checkout_path(checkouts(:checkout_00001))
expect(page).to have_content '利用者番号'
expect(page).to have_content checkouts(:checkout_00001).user.username
expect(page).to have_content checkouts(:checkout_00001).user.profile.user_number
end
end

describe 'When not logged in', solr: true do
before(:each) do
Checkout.reindex
end

it 'should contain query params in the facet' do
sign_in users(:librarian1)
visit checkouts_path(days_overdue: 10)
expect(page).to have_link 'RSS', href: checkouts_path(format: :rss, days_overdue: 10)
expect(page).to have_link 'TSV', href: checkouts_path(format: :txt, days_overdue: 10, locale: 'ja')
end
end
end
15 changes: 15 additions & 0 deletions spec/system/reserves_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require 'rails_helper'

RSpec.describe 'Reserves', type: :system do
include Devise::Test::IntegrationHelpers
fixtures :all

describe 'When logged in as Librarian' do
it 'should contain user information' do
sign_in users(:librarian1)
visit reserves_path(format: :text)
expect(page).to have_content reserves(:reserve_00001).user.username
expect(page).to have_content reserves(:reserve_00001).manifestation.original_title
end
end
end
14 changes: 14 additions & 0 deletions spec/system/user_group_has_checkout_types.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require 'rails_helper'

RSpec.describe 'UserGroupHasCheckoutType', type: :system do
include Devise::Test::IntegrationHelpers
fixtures :all

describe 'When logged in as Librarian' do
it 'should render' do
sign_in users(:librarian1)
visit edit_user_group_has_checkout_path(user_group_has_checkout_types(:user_group_has_checkout_type_00001))
expect(page).to have_field :user_group_id
end
end
end