enju_event 0.3.5 → 0.4.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/Rakefile +1 -1
  4. data/app/controllers/event_import_files_controller.rb +0 -1
  5. data/app/controllers/event_import_results_controller.rb +4 -4
  6. data/app/controllers/events_controller.rb +1 -1
  7. data/app/controllers/places_controller.rb +1 -1
  8. data/app/models/event.rb +37 -49
  9. data/app/models/event_category.rb +9 -7
  10. data/app/models/event_export_file.rb +9 -12
  11. data/app/models/event_import_file.rb +9 -5
  12. data/app/models/event_import_result.rb +1 -6
  13. data/app/views/event_categories/_form.html.erb +1 -1
  14. data/app/views/event_categories/index.html.erb +1 -1
  15. data/app/views/event_categories/show.html.erb +1 -1
  16. data/app/views/event_import_files/new.html.erb +2 -2
  17. data/app/views/event_import_files/show.html.erb +74 -70
  18. data/app/views/event_import_results/index.html.erb +12 -1
  19. data/app/views/event_import_results/index.txt.erb +3 -0
  20. data/app/views/events/_form.html.erb +2 -2
  21. data/app/views/events/index.atom.builder +2 -2
  22. data/app/views/events/index.html+phone.erb +2 -2
  23. data/app/views/events/index.html.erb +5 -5
  24. data/app/views/events/index.ics.erb +1 -1
  25. data/app/views/events/index.json.jbuilder +1 -1
  26. data/app/views/events/index.rss.builder +2 -2
  27. data/app/views/events/index.txt.erb +4 -0
  28. data/app/views/events/show.html+phone.erb +3 -3
  29. data/app/views/events/show.html.erb +3 -3
  30. data/app/views/layouts/calendar.html.erb +4 -4
  31. data/app/views/participates/index.html.erb +1 -1
  32. data/app/views/participates/show.html.erb +1 -1
  33. data/app/views/picture_files/_index_event.html.erb +1 -1
  34. data/config/locales/translation_en.yml +0 -1
  35. data/config/locales/translation_ja.yml +0 -1
  36. data/db/migrate/20190630153136_add_display_name_translations_to_event.rb +6 -0
  37. data/lib/enju_event/engine.rb +1 -0
  38. data/lib/enju_event/version.rb +1 -1
  39. data/lib/generators/enju_event/setup/setup_generator.rb +3 -3
  40. data/lib/generators/enju_event/setup/templates/db/fixtures/event_categories.yml +35 -6
  41. data/spec/controllers/event_import_results_controller_spec.rb +2 -2
  42. data/spec/controllers/events_controller_spec.rb +2 -2
  43. data/spec/dummy/bin/bundle +1 -1
  44. data/spec/dummy/bin/setup +1 -3
  45. data/spec/dummy/bin/update +4 -2
  46. data/spec/dummy/bin/yarn +3 -3
  47. data/spec/dummy/config/database.yml +70 -9
  48. data/spec/dummy/config/initializers/assets.rb +1 -1
  49. data/spec/dummy/config/initializers/mime_types.rb +0 -1
  50. data/spec/dummy/db/migrate/154_create_messages.rb +4 -8
  51. data/spec/dummy/db/migrate/20080819181903_create_message_requests.rb +3 -3
  52. data/spec/dummy/db/migrate/20180107162659_add_constraints_to_most_recent_for_message_transitions.rb +1 -1
  53. data/spec/dummy/db/migrate/20180107162711_add_constraints_to_most_recent_for_message_request_transitions.rb +1 -1
  54. data/spec/dummy/db/migrate/20190630113817_add_display_name_translations_to_library_group.rb +12 -0
  55. data/spec/dummy/db/migrate/{20181026064038_add_login_banner_to_library_group.rb → 20190630115523_add_login_banner_translations_to_library_group.rb} +1 -1
  56. data/spec/dummy/db/migrate/20190630151446_add_display_name_translations_to_role.rb +5 -0
  57. data/spec/dummy/db/migrate/20190712163038_add_display_name_translations_to_carrier_type.rb +21 -0
  58. data/spec/dummy/db/migrate/20190713114940_add_profile_id_to_user.rb +5 -0
  59. data/spec/dummy/db/migrate/20190713115451_add_full_name_translations_to_profile.rb +5 -0
  60. data/spec/dummy/db/schema.rb +148 -266
  61. data/spec/dummy/db/test.sqlite3 +0 -0
  62. data/spec/factories/event_category.rb +4 -2
  63. data/spec/factories/library.rb +2 -0
  64. data/spec/fixtures/agent_types.yml +11 -11
  65. data/spec/fixtures/event_categories.yml +14 -13
  66. data/spec/fixtures/event_export_files.yml +1 -1
  67. data/spec/fixtures/events.yml +22 -29
  68. data/spec/fixtures/libraries.yml +30 -32
  69. data/spec/fixtures/library_groups.yml +44 -20
  70. data/spec/fixtures/shelves.yml +16 -15
  71. data/spec/models/event_category_spec.rb +8 -7
  72. data/spec/models/event_export_file_spec.rb +1 -1
  73. data/spec/models/event_spec.rb +14 -13
  74. data/spec/rails_helper.rb +5 -1
  75. data/spec/system/events_spec.rb +0 -5
  76. metadata +256 -389
  77. data/app/views/event_import_files/_results.html.erb +0 -26
  78. data/app/views/event_import_results/index.text.ruby +0 -5
  79. data/app/views/events/index.text.ruby +0 -7
  80. data/app/views/layouts/mailer.html.erb +0 -13
  81. data/app/views/layouts/mailer.text.erb +0 -1
  82. data/config/brakeman.ignore +0 -66
  83. data/spec/dummy/app/assets/config/manifest.js +0 -5
  84. data/spec/dummy/db/migrate/20080830172106_create_exemplifies.rb +0 -13
  85. data/spec/dummy/db/migrate/20090831220301_create_lending_policies.rb +0 -21
  86. data/spec/dummy/db/migrate/20091202124834_create_versions.rb +0 -18
  87. data/spec/dummy/db/migrate/20110627122938_add_number_of_day_to_notify_overdue_to_user_group.rb +0 -13
  88. data/spec/dummy/db/migrate/20121116033446_add_doi_to_manifestation.rb +0 -6
  89. data/spec/dummy/db/migrate/20150421023923_create_identities.rb +0 -14
  90. data/spec/dummy/db/migrate/20151126005552_add_provider_to_identity.rb +0 -5
  91. data/spec/dummy/db/migrate/20151213070943_add_translation_table_to_library_group.rb +0 -18
  92. data/spec/dummy/db/migrate/20151213072705_add_footer_banner_to_library_group.rb +0 -22
  93. data/spec/dummy/db/migrate/20160506144040_create_isbn_records.rb +0 -11
  94. data/spec/dummy/db/migrate/20181030072731_add_not_null_to_position_on_carrier_type.rb +0 -14
  95. data/spec/dummy/db/migrate/20181030074920_add_not_null_to_position_on_library.rb +0 -14
  96. data/spec/dummy/db/migrate/20190208135957_create_active_storage_tables.active_storage.rb +0 -27
  97. data/spec/dummy/db/migrate/20190311154610_create_periodicals.rb +0 -10
  98. data/spec/dummy/db/migrate/20190314151124_add_full_name_translations_to_create.rb +0 -7
  99. data/spec/dummy/db/migrate/20190818075603_add_memo_to_manifestation.rb +0 -5
  100. data/spec/dummy/db/migrate/20190818075628_add_memo_to_item.rb +0 -5
  101. data/spec/dummy/db/migrate/20191219122214_create_custom_properties.rb +0 -12
  102. data/spec/dummy/db/migrate/20200425072340_create_manifestation_custom_properties.rb +0 -12
  103. data/spec/dummy/db/migrate/20200425072349_create_item_custom_properties.rb +0 -12
  104. data/spec/dummy/db/migrate/20200425074758_create_manifestation_custom_values.rb +0 -12
  105. data/spec/dummy/db/migrate/20200425074822_create_item_custom_values.rb +0 -12
  106. data/spec/mailers/event_export_spec.rb +0 -5
  107. data/spec/mailers/event_import_spec.rb +0 -5
  108. data/spec/mailers/previews/event_export_preview.rb +0 -4
  109. data/spec/mailers/previews/event_import_preview.rb +0 -4
  110. data/spec/system/event_import_results_spec.rb +0 -17
  111. data/spec/views/event_import_results/index.text.ruby_spec.rb +0 -22
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 27b0c9dc4dc6da8c3186d98a1f4c6c99b9f95e4305f8c96b50297a5e692e3d86
4
- data.tar.gz: c5298009340080f52bce7d1f9a698cf10b5772071b8ca4348b9129c348127a1b
3
+ metadata.gz: 63a31bb020f3875c6255cb7a9df0a42a725699153d9bae594d91d67de835bc31
4
+ data.tar.gz: 7efbfc7e8433e334c28b188b274bdc8ad1e78a4cf91f6124a43ee61e0ff7ae08
5
5
  SHA512:
6
- metadata.gz: 63640ab077e20f166c74c854980d1e7763d9c985a725a2d5e1cedf10030808e14d4ce7c36d19f34224cae9e4e84e556f06c89eedd8637ad5f812a2592dc4c00f
7
- data.tar.gz: f171242671fd67136c9a5e1fe83fb36cfc0a03a40c8b704ad45f4de63145f5ea84e1406087b230c4799d86038f42879cd723e7cc5ddcc40d1980bf31e73620da
6
+ metadata.gz: d271fbf21f3e5a5d95a61a58c839aefb0066eac738cc9654f8bfec4bcb0e5ee093af6d53f99e51a667256563ca5b22b78e9e4b2ac896830b5560a598a1d298b4
7
+ data.tar.gz: '058e66132258e9348ae9312059b4bafc36d875c5c6561105e8547756b8bdd1ced620ed018a30f4659b8e690795cfaba6adb9114b4055b7b4038edbf9e01d197f'
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # EnjuEvent
2
- [![Travis CI](https://travis-ci.com/next-l/enju_event.svg?branch=1.3)](https://travis-ci.com/next-l/enju_event)
3
- [![Coverage Status](https://coveralls.io/repos/github/next-l/enju_event/badge.svg?branch=1.3)](https://coveralls.io/github/next-l/enju_event?branch=1.3)
4
- [![security](https://hakiri.io/github/next-l/enju_event/1.3.svg)](https://hakiri.io/github/next-l/enju_event/1.3)
2
+ [![CircleCI](https://circleci.com/gh/next-l/enju_event.svg?style=svg)](https://circleci.com/gh/next-l/enju_event)
3
+ [![Coverage Status](https://coveralls.io/repos/github/next-l/enju_event/badge.svg?branch=master)](https://coveralls.io/github/next-l/enju_event?branch=master)
4
+ [![security](https://hakiri.io/github/next-l/enju_event/master.svg)](https://hakiri.io/github/next-l/enju_event/master)
5
5
 
6
6
  This project rocks and uses MIT-LICENSE.
7
7
 
data/Rakefile CHANGED
@@ -10,7 +10,7 @@ RDoc::Task.new(:rdoc) do |rdoc|
10
10
  rdoc.rdoc_dir = 'rdoc'
11
11
  rdoc.title = 'EnjuEvent'
12
12
  rdoc.options << '--line-numbers'
13
- rdoc.rdoc_files.include('README.rdoc')
13
+ rdoc.rdoc_files.include('README.md')
14
14
  rdoc.rdoc_files.include('lib/**/*.rb')
15
15
  end
16
16
 
@@ -22,7 +22,6 @@ class EventImportFilesController < ApplicationController
22
22
  file = @event_import_file.event_import.path
23
23
  end
24
24
  end
25
- @event_import_results = @event_import_file.event_import_results.page(params[:page])
26
25
 
27
26
  respond_to do |format|
28
27
  format.html # show.html.erb
@@ -5,17 +5,17 @@ class EventImportResultsController < ApplicationController
5
5
  # GET /event_import_results
6
6
  # GET /event_import_results.json
7
7
  def index
8
- @event_import_file = EventImportFile.find_by(id: params[:event_import_file_id])
8
+ @event_import_file = EventImportFile.where(id: params[:event_import_file_id]).first
9
9
  if @event_import_file
10
- @event_import_results = @event_import_file.event_import_results.order(created_at: :asc).page(params[:page])
10
+ @event_import_results = @event_import_file.event_import_results.page(params[:page])
11
11
  else
12
- @event_import_results = EventImportResult.order(created_at: :desc).page(params[:page])
12
+ @event_import_results = EventImportResult.page(params[:page])
13
13
  end
14
14
 
15
15
  respond_to do |format|
16
16
  format.html # index.html.erb
17
17
  format.json { render json: @event_import_results }
18
- format.text
18
+ format.txt
19
19
  end
20
20
  end
21
21
 
@@ -52,7 +52,7 @@ class EventsController < ApplicationController
52
52
  format.html.phone
53
53
  format.json
54
54
  format.rss { render layout: false }
55
- format.text
55
+ format.txt
56
56
  format.atom
57
57
  format.ics
58
58
  end
@@ -50,7 +50,7 @@ class PlacesController < ApplicationController
50
50
  # Use callbacks to share common setup or constraints between actions.
51
51
  def set_place
52
52
  @place = Place.find(params[:id])
53
- authorize @place
53
+ autorize @place
54
54
  end
55
55
 
56
56
  def check_policy
data/app/models/event.rb CHANGED
@@ -56,43 +56,30 @@ class Event < ApplicationRecord
56
56
  self.display_name = name if display_name.blank?
57
57
  end
58
58
 
59
- # CSVのヘッダ
60
- # @param [String] role 権限
61
- def self.csv_header(role: 'Guest')
62
- Event.new.to_hash(role: role).keys
63
- end
64
-
65
- # CSV出力用のハッシュ
66
- # @param [String] role 権限
67
- def to_hash(role: 'Guest')
68
- record = {
69
- name: name,
70
- display_name: display_name,
71
- event_category: event_category.try(:name),
72
- library: library.try(:name),
73
- start_at: start_at,
74
- end_at: end_at,
75
- all_day: all_day,
76
- note: note,
77
- created_at: created_at,
78
- updated_at: updated_at
59
+ def self.export(options = {format: :txt})
60
+ header = %w(
61
+ name
62
+ event_category
63
+ library
64
+ start_at
65
+ end_at
66
+ all_day
67
+ )
68
+ lines = []
69
+ Event.find_each.map{|e|
70
+ line = []
71
+ line << e.name
72
+ line << e.event_category.name
73
+ line << e.library.name
74
+ line << e.start_at
75
+ line << e.end_at
76
+ line << e.all_day
77
+ lines << line
79
78
  }
80
-
81
- record
82
- end
83
-
84
- # TSVでのエクスポート
85
- # @param [String] role 権限
86
- # @param [String] col_sep 区切り文字
87
- def self.export(role: 'Guest', col_sep: "\t")
88
- file = Tempfile.create('event_export') do |f|
89
- f.write Event.csv_header(role: role).to_csv(col_sep: col_sep)
90
- Event.find_each do |event|
91
- f.write event.to_hash(role: role).values.to_csv(col_sep: col_sep)
92
- end
93
-
94
- f.rewind
95
- f.read
79
+ if options[:format] == :txt
80
+ lines.map{|line| line.to_csv(col_sep: "\t")}.unshift(header.to_csv(col_sep: "\t")).join
81
+ else
82
+ event
96
83
  end
97
84
  end
98
85
  end
@@ -101,17 +88,18 @@ end
101
88
  #
102
89
  # Table name: events
103
90
  #
104
- # id :integer not null, primary key
105
- # library_id :integer not null
106
- # event_category_id :integer not null
107
- # name :string
108
- # note :text
109
- # start_at :datetime
110
- # end_at :datetime
111
- # all_day :boolean default(FALSE), not null
112
- # deleted_at :datetime
113
- # display_name :text
114
- # created_at :datetime
115
- # updated_at :datetime
116
- # place_id :integer
91
+ # id :integer not null, primary key
92
+ # library_id :integer not null
93
+ # event_category_id :integer not null
94
+ # name :string
95
+ # note :text
96
+ # start_at :datetime
97
+ # end_at :datetime
98
+ # all_day :boolean default(FALSE), not null
99
+ # deleted_at :datetime
100
+ # display_name :text
101
+ # created_at :datetime
102
+ # updated_at :datetime
103
+ # place_id :integer
104
+ # display_name_translations :jsonb not null
117
105
  #
@@ -4,17 +4,19 @@ class EventCategory < ApplicationRecord
4
4
  has_many :events
5
5
 
6
6
  paginates_per 10
7
+ translates :display_name
7
8
  end
8
9
 
9
10
  # == Schema Information
10
11
  #
11
12
  # Table name: event_categories
12
13
  #
13
- # id :integer not null, primary key
14
- # name :string not null
15
- # display_name :text
16
- # note :text
17
- # position :integer
18
- # created_at :datetime
19
- # updated_at :datetime
14
+ # id :integer not null, primary key
15
+ # name :string not null
16
+ # display_name :text
17
+ # note :text
18
+ # position :integer
19
+ # created_at :datetime
20
+ # updated_at :datetime
21
+ # display_name_translations :jsonb not null
20
22
  #
@@ -26,17 +26,14 @@ class EventExportFile < ApplicationRecord
26
26
  to: :state_machine
27
27
 
28
28
  def export!
29
- role_name = user.try(:role).try(:name)
30
- tsv = Event.export(role: role_name)
31
-
32
- EventExportFile.transaction do
33
- transition_to!(:started)
34
- role_name = user.try(:role).try(:name)
35
- self.event_export = StringIO.new(tsv)
36
- self.event_export.instance_write(:filename, "event_export.txt")
37
- save!
38
- transition_to!(:completed)
39
- end
29
+ transition_to!(:started)
30
+ tempfile = Tempfile.new(['event_export_file_', '.txt'])
31
+ file = Event.export(format: :txt)
32
+ tempfile.puts(file)
33
+ tempfile.close
34
+ self.event_export = File.new(tempfile.path, "r")
35
+ save!
36
+ transition_to!(:completed)
40
37
  mailer = EventExportMailer.completed(self)
41
38
  send_message(mailer)
42
39
  rescue => e
@@ -64,7 +61,7 @@ end
64
61
  # user_id :integer
65
62
  # event_export_file_name :string
66
63
  # event_export_content_type :string
67
- # event_export_file_size :integer
64
+ # event_export_file_size :bigint
68
65
  # event_export_updated_at :datetime
69
66
  # executed_at :datetime
70
67
  # created_at :datetime
@@ -51,7 +51,9 @@ class EventImportFile < ApplicationRecord
51
51
  rows.each do |row|
52
52
  row_num += 1
53
53
  next if row['dummy'].to_s.strip.present?
54
- event_import_result = EventImportResult.new(event_import_file_id: id, body: row.fields.join("\t"))
54
+ event_import_result = EventImportResult.new
55
+ event_import_result.assign_attributes({ event_import_file_id: id, body: row.fields.join("\t") })
56
+ event_import_result.save!
55
57
 
56
58
  event = Event.new
57
59
  event.name = row['name'].to_s.strip
@@ -65,10 +67,10 @@ class EventImportFile < ApplicationRecord
65
67
  else
66
68
  event.all_day = false
67
69
  end
68
- library = Library.find_by(name: row['library'])
70
+ library = Library.where(name: row['library']).first
69
71
  library = default_library || Library.web if library.blank?
70
72
  event.library = library
71
- event_category = EventCategory.find_by(name: row['event_category'])
73
+ event_category = EventCategory.where(name: row['event_category']).first
72
74
  event_category = default_event_category if event_category.blank?
73
75
  event.event_category = event_category
74
76
 
@@ -111,7 +113,7 @@ class EventImportFile < ApplicationRecord
111
113
  event = Event.find(row['id'].to_s.strip)
112
114
  event_category = EventCategory.where(name: row['event_category'].to_s.strip).first
113
115
  event.event_category = event_category if event_category
114
- library = Library.find_by(name: row['library'].to_s.strip)
116
+ library = Library.where(name: row['library'].to_s.strip).first
115
117
  event.library = library if library
116
118
  event.name = row['name'] if row['name'].to_s.strip.present?
117
119
  event.start_at = Time.zone.parse(row['start_at']) if row['start_at'].present?
@@ -181,7 +183,9 @@ class EventImportFile < ApplicationRecord
181
183
 
182
184
  def open_import_file(tempfile)
183
185
  file = CSV.open(tempfile, col_sep: "\t")
184
- header_columns = EventImportResult.header
186
+ header_columns = %w(
187
+ id name display_name library event_category start_at end_at all_day note dummy
188
+ )
185
189
  header = file.first
186
190
  ignored_columns = header - header_columns
187
191
  unless ignored_columns.empty?
@@ -1,4 +1,5 @@
1
1
  class EventImportResult < ApplicationRecord
2
+ default_scope { order('event_import_results.id') }
2
3
  scope :file_id, proc{|file_id| where(event_import_file_id: file_id)}
3
4
  scope :failed, -> { where(event_id: nil) }
4
5
 
@@ -6,12 +7,6 @@ class EventImportResult < ApplicationRecord
6
7
  belongs_to :event, optional: true
7
8
 
8
9
  validates :event_import_file_id, presence: true
9
-
10
- def self.header
11
- %w(
12
- id name display_name library event_category start_at end_at all_day note dummy
13
- )
14
- end
15
10
  end
16
11
 
17
12
  # == Schema Information
@@ -3,7 +3,7 @@
3
3
 
4
4
  <div class="field">
5
5
  <%= f.label :name %><br />
6
- <%= f.text_field :name, required: true %>
6
+ <%= f.text_field :name %>
7
7
  </div>
8
8
  <div class="field">
9
9
  <%= f.label :display_name %><br />
@@ -23,7 +23,7 @@
23
23
  </td>
24
24
  <td><%= event_category.name -%></td>
25
25
  <td>
26
- <%= link_to event_category.display_name.localize, event_category -%>
26
+ <%= link_to event_category.display_name, event_category -%>
27
27
  <br />
28
28
  <%= event_category.note %>
29
29
  </td>
@@ -10,7 +10,7 @@
10
10
 
11
11
  <p>
12
12
  <strong><%= t('activerecord.attributes.event_category.display_name') -%>:</strong>
13
- <%= @event_category.display_name.localize -%>
13
+ <%= @event_category.display_name -%>
14
14
  </p>
15
15
 
16
16
  <p>
@@ -34,13 +34,13 @@
34
34
 
35
35
  <div class="field">
36
36
  <%= f.label :default_event_category_id -%>
37
- <%= f.select(:default_event_category_id, @event_categories.collect{|e| [e.display_name.localize, e.id]}) -%><br />
37
+ <%= f.select(:default_event_category_id, @event_categories.collect{|e| [e.display_name, e.id]}) -%><br />
38
38
  <%= t('event_import_file.default_event_category') %>
39
39
  </div>
40
40
 
41
41
  <div class="field">
42
42
  <%= f.label :default_library_id -%>
43
- <%= f.select(:default_library_id, @libraries.collect{|l| [l.display_name.localize, l.id]}) -%><br />
43
+ <%= f.select(:default_library_id, @libraries.collect{|l| [l.display_name, l.id]}) -%><br />
44
44
  <%= t('event_import_file.default_library') %>
45
45
  </div>
46
46
 
@@ -1,81 +1,85 @@
1
1
  <div id="content_detail" class="ui-corner-all ui-widget-content">
2
- <h1 class="title"><%= t('page.showing', model: t('activerecord.models.event_import_file')) -%></h1>
3
- <div id="content_list">
4
- <p id="notice"><%= notice %></p>
5
-
6
- <p>
7
- <strong>Id:</strong>
8
- <%= @event_import_file.id -%>
9
- </p>
10
-
11
- <% if @event_import_file.event_import_file_name %>
12
- <p>
13
- <strong><%= t('activerecord.attributes.event_import_file.event_import_file_name') -%>:</strong>
14
- <%= link_to @event_import_file.event_import_file_name, event_import_file_path(@event_import_file, format: :download) %>
15
- (<%= @event_import_file.event_import_content_type -%>)
16
- </p>
17
-
18
- <p>
19
- <strong><%= t('activerecord.attributes.event_import_file.event_import_file_size') -%>:</strong>
20
- <%= @event_import_file.event_import_file_size -%>
21
- </p>
22
- <% end %>
2
+ <h1 class="title"><%= t('page.showing', model: t('activerecord.models.event_import_file')) -%></h1>
3
+ <div id="content_list">
4
+ <p id="notice"><%= notice %></p>
23
5
 
24
- <p>
25
- <strong><%= t('page.created_at') -%>:</strong>
26
- <%= l(@event_import_file.created_at) if @event_import_file.created_at -%>
27
- </p>
28
-
29
- <p>
30
- <strong><%= t('activerecord.attributes.event_import_file.executed_at') -%>:</strong>
31
- <%= l(@event_import_file.executed_at) if @event_import_file.executed_at -%>
32
- </p>
33
-
34
- <p>
35
- <strong><%= t('activerecord.attributes.event_import_file.edit_mode') -%>:</strong>
36
- <%= @event_import_file.edit_mode -%>
37
- </p>
38
-
39
- <p>
40
- <strong><%= t('activerecord.attributes.event_import_file.user_encoding') -%>:</strong>
41
- <%= @event_import_file.user_encoding -%>
42
- </p>
43
-
44
- <p>
45
- <strong><%= t('activerecord.attributes.event_import_file.default_event_category_id') -%>:</strong>
46
- <%= link_to @event_import_file.default_event_category.display_name.localize, @event_import_file.default_event_category if @event_import_file.default_event_category.try(:display_name) -%>
47
- </p>
48
-
49
- <p>
50
- <strong><%= t('activerecord.attributes.event_import_file.default_library_id') -%>:</strong>
51
- <%= link_to @event_import_file.default_library.display_name.localize, @event_import_file.default_library if @event_import_file.default_library.try(:display_name) -%>
52
- </p>
53
-
54
- <p>
55
- <strong><%= t('activerecord.attributes.event_import_file.state') -%>:</strong>
56
- <%= localized_state(@event_import_file.current_state) -%>
57
- </p>
58
-
59
- <p>
60
- <strong><%= t('activerecord.attributes.event_import_file.error_message') -%>:</strong>
61
- <%= simple_format(@event_import_file.error_message) -%>
62
- </p>
63
-
64
- <p>
65
- <strong><%= t('activerecord.models.user') -%>:</strong>
66
- <%= link_to @event_import_file.user.username, @event_import_file.user.profile if @event_import_file.user.try(:profile) -%>
67
- </p>
68
-
69
- <% if @event_import_results %>
70
- <%= render 'results' %>
71
- <% end %>
6
+ <p>
7
+ <strong>Id:</strong>
8
+ <%= @event_import_file.id -%>
9
+ </p>
10
+
11
+ <p>
12
+ <strong><%= t('activerecord.attributes.event_import_file.event_import_file_name') -%>:</strong>
13
+ <%= link_to @event_import_file.event_import_file_name, event_import_file_path(@event_import_file, format: :download) if @event_import_file.event_import_file_name %>
14
+ </p>
15
+
16
+ <p>
17
+ <strong><%= t('activerecord.attributes.event_import_file.event_import_content_type') -%>:</strong>
18
+ <%= @event_import_file.event_import_content_type -%>
19
+ </p>
20
+
21
+ <p>
22
+ <strong><%= t('activerecord.attributes.event_import_file.event_import_file_size') -%>:</strong>
23
+ <%= @event_import_file.event_import_file_size -%>
24
+ </p>
25
+
26
+ <p>
27
+ <strong><%= t('activerecord.attributes.event_import_file.event_import_fingerprint') -%>:</strong>
28
+ <%= @event_import_file.event_import_fingerprint -%>
29
+ </p>
30
+
31
+ <p>
32
+ <strong><%= t('page.created_at') -%>:</strong>
33
+ <%= l(@event_import_file.created_at) if @event_import_file.created_at -%>
34
+ </p>
35
+
36
+ <p>
37
+ <strong><%= t('activerecord.attributes.event_import_file.executed_at') -%>:</strong>
38
+ <%= l(@event_import_file.executed_at) if @event_import_file.executed_at -%>
39
+ </p>
72
40
 
73
- </div>
41
+ <p>
42
+ <strong><%= t('activerecord.attributes.event_import_file.edit_mode') -%>:</strong>
43
+ <%= @event_import_file.edit_mode -%>
44
+ </p>
45
+
46
+ <p>
47
+ <strong><%= t('activerecord.attributes.event_import_file.user_encoding') -%>:</strong>
48
+ <%= @event_import_file.user_encoding -%>
49
+ </p>
50
+
51
+ <p>
52
+ <strong><%= t('activerecord.attributes.event_import_file.default_event_category_id') -%>:</strong>
53
+ <%= link_to @event_import_file.default_event_category.display_name, @event_import_file.default_event_category if @event_import_file.default_event_category.try(:display_name) -%>
54
+ </p>
55
+
56
+ <p>
57
+ <strong><%= t('activerecord.attributes.event_import_file.default_library_id') -%>:</strong>
58
+ <%= link_to @event_import_file.default_library.display_name, @event_import_file.default_library if @event_import_file.default_library.try(:display_name) -%>
59
+ </p>
60
+
61
+ <p>
62
+ <strong><%= t('activerecord.attributes.event_import_file.state') -%>:</strong>
63
+ <%= localized_state(@event_import_file.current_state) -%>
64
+ </p>
65
+
66
+ <p>
67
+ <strong><%= t('activerecord.attributes.event_import_file.error_message') -%>:</strong>
68
+ <%= @event_import_file.error_message -%>
69
+ </p>
70
+
71
+ <p>
72
+ <strong><%= t('activerecord.models.user') -%>:</strong>
73
+ <%= link_to @event_import_file.user.username, @event_import_file.user.profile if @event_import_file.user.try(:profile) -%>
74
+ </p>
75
+
76
+ </div>
74
77
  </div>
75
78
 
76
79
  <div id="submenu" class="ui-corner-all ui-widget-content">
77
80
  <%= form_for(@event_import_file) do |f| %>
78
81
  <ul>
82
+ <li><%= link_to t('activerecord.models.event_import_result'), event_import_results_path(event_import_file_id: @event_import_file.id) -%></li>
79
83
  <li><%= back_to_index(flash[:page_info]) -%></li>
80
84
  <% if current_user.has_role?('Administrator') %>
81
85
  <li><%= link_to 'Resque', resque_path %></li>
@@ -21,7 +21,7 @@
21
21
  <br />
22
22
  <%=l event_import_result.created_at %>
23
23
  </td>
24
- <td><%= link_to event_import_result.event.display_name.localize, event_import_result.event if event_import_result.event %></td>
24
+ <td><%= link_to event_import_result.event.display_name, event_import_result.event if event_import_result.event %></td>
25
25
  <td>
26
26
  <%= link_to t('page.show'), event_import_result %>
27
27
  <%= link_to t('page.destroy'), event_import_result, data: {confirm: t('page.are_you_sure')}, method: :delete %>
@@ -36,4 +36,15 @@
36
36
  </div>
37
37
 
38
38
  <div id="submenu" class="ui-corner-all ui-widget-content">
39
+ <ul>
40
+ <li>
41
+ <% if @event_import_file %>
42
+ <%= 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) -%>
43
+ (<%= link_to 'TSV', event_import_results_path(event_import_file_id: @event_import_file.id, format: :txt, locale: @locale.to_s) -%>)
44
+ <% else %>
45
+ <%= link_to (image_tag 'icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), event_import_results_path(format: :txt, locale: @locale.to_s) -%>
46
+ (<%= link_to 'TSV', event_import_results_path(format: :txt, locale: @locale.to_s) -%>)
47
+ <% end %>
48
+ </li>
49
+ </ul>
39
50
  </div>
@@ -0,0 +1,3 @@
1
+ <%- @event_import_results.each do |event_import_result| -%>
2
+ <%= event_import_result.body %><%= "\n" -%>
3
+ <%- end -%>
@@ -3,12 +3,12 @@
3
3
 
4
4
  <div class="field">
5
5
  <%= f.label t('activerecord.models.event_category') -%><br />
6
- <%= f.select(:event_category_id, @event_categories.collect{|e| [e.display_name.localize, e.id]}) -%>
6
+ <%= f.select(:event_category_id, @event_categories.collect{|e| [e.display_name, e.id]}) -%>
7
7
  </div>
8
8
 
9
9
  <div class="field">
10
10
  <%= f.label t('activerecord.models.library') -%><br />
11
- <%= f.select(:library_id, @libraries.collect{|l| [l.display_name.localize, l.id]}) -%>
11
+ <%= f.select(:library_id, @libraries.collect{|l| [l.display_name, l.id]}) -%>
12
12
  </div>
13
13
 
14
14
  <div class="field">
@@ -1,10 +1,10 @@
1
1
  atom_feed(url: events_url(format: :atom)) do |feed|
2
- feed.title t('event.library_group_event', library_group_name: @library_group.display_name.localize)
2
+ feed.title t('event.library_group_event', library_group_name: @library_group.display_name)
3
3
  feed.updated(@events.first ? @events.first.created_at : Time.zone.now)
4
4
 
5
5
  @events.each do |event|
6
6
  feed.entry(event) do |entry|
7
- entry.title(event.display_name.localize)
7
+ entry.title(event.display_name)
8
8
  end
9
9
  end
10
10
  end
@@ -4,7 +4,7 @@
4
4
 
5
5
  <div data-role="content">
6
6
  <%- if @library -%>
7
- <h2><%= link_to @library.display_name.localize, @library -%></h2>
7
+ <h2><%= link_to @library.display_name, @library -%></h2>
8
8
  <%- else -%>
9
9
  <h2><%= t('event.all_libraries') -%></h2>
10
10
  <%- end -%>
@@ -39,7 +39,7 @@
39
39
  <ul data-role="listview">
40
40
  <%- @events.each_with_index do |event, i| -%>
41
41
  <li>
42
- <%= link_to event.display_name.localize, event -%>
42
+ <%= link_to event.display_name, event -%>
43
43
  <br />
44
44
  <%= l(event.start_at, format: :short) -%>
45
45
  -
@@ -4,7 +4,7 @@
4
4
  <p id="notice"><%= notice %></p>
5
5
 
6
6
  <%- if @library -%>
7
- <h2><%= link_to @library.display_name.localize, @library -%></h2>
7
+ <h2><%= link_to @library.display_name, @library -%></h2>
8
8
  <%- else -%>
9
9
  <h2><%= t('event.all_libraries') -%></h2>
10
10
  <%- end -%>
@@ -46,12 +46,12 @@
46
46
  <%- @events.each_with_index do |event, i| -%>
47
47
  <tr class="line<%= cycle("0", "1") -%>">
48
48
  <td>
49
- <%= link_to event.library.display_name.localize, event.library -%>
49
+ <%= link_to event.library.display_name, event.library -%>
50
50
  <br />
51
- <%= event.event_category.display_name.localize -%>
51
+ <%= event.event_category.display_name -%>
52
52
  </td>
53
53
  <td>
54
- <%= link_to event.display_name.localize, event -%>
54
+ <%= link_to event.display_name, event -%>
55
55
  <br />
56
56
  <%= l(event.start_at, format: :short) -%>
57
57
  -
@@ -97,7 +97,7 @@
97
97
  <ul>
98
98
  <li><%= link_to t('event.all_libraries'), url_for(filtered_params.merge(library_id: nil, page: nil)) -%></li>
99
99
  <%- @libraries.each do |library| -%>
100
- <li><%= link_to library.display_name.localize, url_for(filtered_params.merge(library_id: library.name, mode: params[:mode])) -%></li>
100
+ <li><%= link_to library.display_name, url_for(filtered_params.merge(library_id: library.name, mode: params[:mode])) -%></li>
101
101
  <%- end -%>
102
102
  </ul>
103
103
  <p>
@@ -3,7 +3,7 @@ events = @events
3
3
  RiCal.Calendar do
4
4
  events.each do |event|
5
5
  event do
6
- description event.display_name.localize
6
+ description event.display_name
7
7
  dtstart event.start_at
8
8
  dtend event.end_at
9
9
  location event.library.address