enju_message 0.1.14.pre14 → 0.1.14.pre15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/message_requests_controller.rb +5 -5
- data/app/controllers/messages_controller.rb +17 -17
- data/app/models/message.rb +34 -24
- data/app/models/message_request.rb +25 -30
- data/app/models/message_request_state_machine.rb +12 -0
- data/app/models/message_request_transition.rb +20 -0
- data/app/models/message_state_machine.rb +24 -0
- data/app/models/message_template.rb +3 -3
- data/app/models/message_transition.rb +20 -0
- data/app/views/layouts/messages.html.erb +3 -3
- data/app/views/message_requests/edit.html.erb +1 -1
- data/app/views/message_requests/index.html.erb +8 -8
- data/app/views/message_requests/new.html.erb +2 -2
- data/app/views/message_requests/show.html.erb +2 -2
- data/app/views/message_templates/_form.html.erb +4 -4
- data/app/views/message_templates/edit.html.erb +1 -1
- data/app/views/message_templates/index.html.erb +3 -3
- data/app/views/message_templates/new.html.erb +1 -1
- data/app/views/message_templates/show.html.erb +1 -1
- data/app/views/messages/_form.html.erb +0 -4
- data/app/views/messages/edit.html.erb +5 -5
- data/app/views/messages/index.atom.builder +2 -2
- data/app/views/messages/index.html.erb +7 -7
- data/app/views/messages/index.rss.builder +9 -9
- data/app/views/messages/new.html.erb +7 -7
- data/app/views/messages/show.html.erb +5 -5
- data/app/views/notifier/message_notification.en.text.erb +1 -1
- data/app/views/notifier/message_notification.ja.text.erb +1 -1
- data/config/initializers/statesman.rb +3 -0
- data/db/migrate/154_create_messages.rb +0 -1
- data/db/migrate/20080819181903_create_message_requests.rb +0 -2
- data/db/migrate/20140518111006_create_message_transitions.rb +14 -0
- data/db/migrate/20140518135713_create_message_request_transitions.rb +14 -0
- data/lib/enju_message/engine.rb +1 -1
- data/lib/enju_message/user.rb +2 -2
- data/lib/enju_message/version.rb +1 -1
- data/lib/generators/enju_message/setup/setup_generator.rb +2 -0
- data/lib/generators/enju_message/setup/templates/db/fixtures/message_templates.yml +41 -20
- data/lib/tasks/enju_message_tasks.rake +10 -0
- data/lib/tasks/message_template.rb +13 -0
- data/spec/controllers/message_requests_controller_spec.rb +15 -15
- data/spec/controllers/message_templates_controller_spec.rb +21 -21
- data/spec/controllers/messages_controller_spec.rb +7 -13
- data/spec/dummy/app/mailers/notifier.rb +6 -6
- data/spec/dummy/db/migrate/001_create_agents.rb +0 -2
- 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/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/20140628072217_add_user_encoding_to_user_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/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/20140811031145_add_expired_at_to_profile.rb +5 -0
- data/spec/dummy/db/schema.rb +105 -8
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/solr/default/data/index/_oj.fdt +0 -0
- data/spec/dummy/solr/default/data/index/{_n.si → _oj.si} +0 -0
- data/spec/dummy/solr/default/data/index/{_n_Lucene41_0.tim → _oj_Lucene41_0.tim} +0 -0
- data/spec/dummy/solr/default/data/index/segments.gen +0 -0
- data/spec/dummy/solr/default/data/index/segments_14v +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001460 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001461 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001462 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001463 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001464 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001465 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001466 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001467 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001468 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001469 +0 -0
- data/spec/factories/message.rb +2 -2
- data/spec/factories/profile.rb +10 -0
- data/spec/fixtures/agents.yml +0 -12
- data/spec/fixtures/message_requests.yml +0 -3
- data/spec/fixtures/messages.yml +0 -5
- data/spec/fixtures/profiles.yml +98 -0
- data/spec/fixtures/users.yml +3 -23
- data/spec/models/message_request_spec.rb +0 -2
- data/spec/models/message_spec.rb +2 -4
- data/spec/spec_helper.rb +3 -0
- metadata +95 -47
- data/spec/dummy/solr/default/data/index/_n.fdt +0 -0
- data/spec/dummy/solr/default/data/index/segments_15 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000030 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000031 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000032 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000033 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000034 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000035 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000036 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000037 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000038 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000039 +0 -0
- /data/spec/dummy/solr/default/data/index/{_n.fdx → _oj.fdx} +0 -0
- /data/spec/dummy/solr/default/data/index/{_n.fnm → _oj.fnm} +0 -0
- /data/spec/dummy/solr/default/data/index/{_n.nvd → _oj.nvd} +0 -0
- /data/spec/dummy/solr/default/data/index/{_n.nvm → _oj.nvm} +0 -0
- /data/spec/dummy/solr/default/data/index/{_n_Lucene41_0.doc → _oj_Lucene41_0.doc} +0 -0
- /data/spec/dummy/solr/default/data/index/{_n_Lucene41_0.pos → _oj_Lucene41_0.pos} +0 -0
- /data/spec/dummy/solr/default/data/index/{_n_Lucene41_0.tip → _oj_Lucene41_0.tip} +0 -0
@@ -1,5 +1,5 @@
|
|
1
1
|
<div id="content_detail" class="ui-corner-all ui-widget-content">
|
2
|
-
<h1 class="title"><%= t('page.editing', :
|
2
|
+
<h1 class="title"><%= t('page.editing', model: t('activerecord.models.message')) -%></h1>
|
3
3
|
<div id="content_list">
|
4
4
|
|
5
5
|
<%= form_for(@message) do |f| -%>
|
@@ -13,17 +13,17 @@
|
|
13
13
|
|
14
14
|
<div class="field">
|
15
15
|
<%= f.label t('message.receiver') -%><br />
|
16
|
-
<%= f.text_field :recipient, :
|
16
|
+
<%= f.text_field :recipient, class: 'resource_title', value: @message.receiver.username -%>
|
17
17
|
</div>
|
18
18
|
|
19
19
|
<div class="field">
|
20
20
|
<%= f.label :subject -%><br />
|
21
|
-
<%= f.text_field :subject, :
|
21
|
+
<%= f.text_field :subject, class: 'resource_title' -%>
|
22
22
|
</div>
|
23
23
|
|
24
24
|
<div class="field">
|
25
25
|
<%= f.label :body -%><br />
|
26
|
-
<%= f.text_area :body, :
|
26
|
+
<%= f.text_area :body, id: 'message_body' -%>
|
27
27
|
</div>
|
28
28
|
|
29
29
|
<div class="actions">
|
@@ -37,6 +37,6 @@
|
|
37
37
|
<div id="submenu" class="ui-corner-all ui-widget-content">
|
38
38
|
<ul>
|
39
39
|
<li><%= link_to t('page.show'), @message -%></li>
|
40
|
-
<li><%= link_to t('page.listing', :
|
40
|
+
<li><%= link_to t('page.listing', model: t('activerecord.models.message')), messages_path -%></li>
|
41
41
|
</ul>
|
42
42
|
</div>
|
@@ -3,9 +3,9 @@ atom_feed do |feed|
|
|
3
3
|
feed.updated(@messages.first ? @messages.first.created_at : Time.zone.now)
|
4
4
|
|
5
5
|
@messages.each do |message|
|
6
|
-
feed.entry(message, :
|
6
|
+
feed.entry(message, url: message_url(message)) do |entry|
|
7
7
|
entry.title message.subject
|
8
|
-
entry.content message.body, :
|
8
|
+
entry.content message.body, type: 'html'
|
9
9
|
|
10
10
|
entry.author do |author|
|
11
11
|
author.name message.sender.login
|
@@ -1,14 +1,14 @@
|
|
1
1
|
<div id="content_detail" class="ui-corner-all ui-widget-content">
|
2
2
|
<h1 class="title"><%= t('activerecord.models.message') -%></h1>
|
3
3
|
<div id="content_list">
|
4
|
-
<%= form_for :messages, :
|
4
|
+
<%= form_for :messages, url: messages_path, html: {method: 'get'} do -%>
|
5
5
|
<p>
|
6
|
-
<%= label_tag :search_form_top, t('page.search_term') -%>: <%= search_field_tag 'query', h(@query), {:
|
6
|
+
<%= label_tag :search_form_top, t('page.search_term') -%>: <%= search_field_tag 'query', h(@query), {id: 'search_form_top', class: 'search_form', placeholder: t('page.search_term')} -%>
|
7
7
|
<%= submit_tag t('page.search') -%>
|
8
8
|
</p>
|
9
9
|
<%- end -%>
|
10
10
|
|
11
|
-
<%= form_for :message, :
|
11
|
+
<%= form_for :message, url: destroy_selected_messages_path do |form| -%>
|
12
12
|
<table class="table table-striped index">
|
13
13
|
<tr>
|
14
14
|
<th></th>
|
@@ -28,7 +28,7 @@
|
|
28
28
|
<%= link_to message.subject, message -%>
|
29
29
|
<% unless message.read? %></strong><% end %>
|
30
30
|
</td>
|
31
|
-
<td><%= link_to message.sender.username, message.sender -%></td>
|
31
|
+
<td><%= link_to message.sender.username, message.sender.profile if message.sender.try(:profile) -%></td>
|
32
32
|
<td><%= l(message.created_at) -%></td>
|
33
33
|
</tr>
|
34
34
|
<%- end -%>
|
@@ -48,19 +48,19 @@
|
|
48
48
|
<li>
|
49
49
|
<% facet.value ? facet_mode = 'read' : facet_mode = 'unread' %>
|
50
50
|
<%- if facet_mode == mode -%><strong><%- end -%>
|
51
|
-
<%= link_to t("message.#{facet_mode}"), url_for(params.merge(:
|
51
|
+
<%= link_to t("message.#{facet_mode}"), url_for(params.merge(page: nil, mode: facet_mode, only_path: true)) -%>
|
52
52
|
(<%= facet.count -%>)
|
53
53
|
<%- if facet_mode == mode -%></strong><%- end -%>
|
54
54
|
</li>
|
55
55
|
<%- end -%>
|
56
56
|
<% if mode.present? %>
|
57
|
-
<li><%= link_to t('page.remove_this_facet'), url_for(params.merge(:
|
57
|
+
<li><%= link_to t('page.remove_this_facet'), url_for(params.merge(mode: nil, page: nil, only_path: true)) -%></li>
|
58
58
|
<% end %>
|
59
59
|
</ul>
|
60
60
|
|
61
61
|
<ul>
|
62
62
|
<% if can? :create, Message %>
|
63
|
-
<li><%= link_to t('page.new', :
|
63
|
+
<li><%= link_to t('page.new', model: t('activerecord.models.message')), new_message_path -%></li>
|
64
64
|
<% end %>
|
65
65
|
</ul>
|
66
66
|
</div>
|
@@ -4,23 +4,23 @@ xml.rss('version' => "2.0",
|
|
4
4
|
'xmlns:atom' => "http://www.w3.org/2005/Atom"){
|
5
5
|
xml.channel{
|
6
6
|
if @user
|
7
|
-
xml.title t('message.user_message', :
|
8
|
-
xml.link messages_url(@user, :
|
7
|
+
xml.title t('message.user_message', login_name: @user.username)
|
8
|
+
xml.link messages_url(@user, format: :rss)
|
9
9
|
else
|
10
|
-
xml.title t('message.library_group_message', :
|
11
|
-
xml.link messages_url(:
|
10
|
+
xml.title t('message.library_group_message', library_group_name: @library_group.display_name.localize)
|
11
|
+
xml.link messages_url(format: :rss)
|
12
12
|
end
|
13
13
|
xml.description "Next-L Enju, an open source integrated library system developed by Project Next-L"
|
14
14
|
xml.language @locale.to_s
|
15
15
|
xml.ttl "60"
|
16
16
|
if @user
|
17
|
-
xml.tag! "atom:link", :
|
18
|
-
xml.tag! "atom:link", :
|
17
|
+
xml.tag! "atom:link", rel: 'self', href: messages_url(format: :rss)
|
18
|
+
xml.tag! "atom:link", rel: 'alternate', href: messages_url(format: :rss)
|
19
19
|
else
|
20
|
-
xml.tag! "atom:link", :
|
21
|
-
xml.tag! "atom:link", :
|
20
|
+
xml.tag! "atom:link", rel: 'self', href: messages_url(format: :rss)
|
21
|
+
xml.tag! "atom:link", rel: 'alternate', href: messages_url
|
22
22
|
end
|
23
|
-
#xml.tag! "atom:link", :
|
23
|
+
#xml.tag! "atom:link", rel: 'search', type: 'application/opensearchdescription+xml', href: "http://#{request.host_with_port}/page/opensearch"
|
24
24
|
unless params[:query].blank?
|
25
25
|
xml.tag! "opensearch:totalResults", @messages.total_entries
|
26
26
|
xml.tag! "opensearch:startIndex", @messages.offset + 1
|
@@ -1,29 +1,29 @@
|
|
1
1
|
<div id="content_detail" class="ui-corner-all ui-widget-content">
|
2
|
-
<h1 class="title"><%= t('page.new', :
|
2
|
+
<h1 class="title"><%= t('page.new', model: t('activerecord.models.message')) -%></h1>
|
3
3
|
<div id="content_list">
|
4
4
|
<fieldset>
|
5
5
|
|
6
|
-
<%= simple_form_for(@message, :
|
6
|
+
<%= simple_form_for(@message, url: messages_path, validate: true) do |f| -%>
|
7
7
|
<%= f.error_notification -%>
|
8
8
|
|
9
9
|
<div class="field">
|
10
10
|
<label for="message_recepient"><%= t('message.recipient') -%>:</label>
|
11
11
|
<%- if @message.recipient -%>
|
12
12
|
<%= link_to @message.recipient, user_path(@message.recipient) -%>
|
13
|
-
<%= f.hidden_field :recipient, :
|
13
|
+
<%= f.hidden_field :recipient, value: @message.recipient -%>
|
14
14
|
<%- else -%>
|
15
|
-
<%= f.text_field :recipient, :
|
15
|
+
<%= f.text_field :recipient, class: 'resource_title', value: @message.recipient -%>
|
16
16
|
<%- end -%>
|
17
17
|
</div>
|
18
18
|
|
19
19
|
<div class="field">
|
20
20
|
<%= f.label :subject -%>:
|
21
|
-
<%= f.text_field :subject, :
|
21
|
+
<%= f.text_field :subject, class: 'resource_title' -%>
|
22
22
|
</div>
|
23
23
|
|
24
24
|
<div class="field">
|
25
25
|
<%= f.label :body -%>:<br />
|
26
|
-
<%= f.text_area :body, :
|
26
|
+
<%= f.text_area :body, id: 'message_body' -%>
|
27
27
|
</div>
|
28
28
|
|
29
29
|
<div class="field">
|
@@ -38,6 +38,6 @@
|
|
38
38
|
|
39
39
|
<div id="submenu" class="ui-corner-all ui-widget-content">
|
40
40
|
<ul>
|
41
|
-
<li><%= link_to t('page.listing', :
|
41
|
+
<li><%= link_to t('page.listing', model: t('activerecord.models.message')), messages_path -%></li>
|
42
42
|
</ul>
|
43
43
|
</div>
|
@@ -6,11 +6,11 @@
|
|
6
6
|
<fieldset>
|
7
7
|
<p>
|
8
8
|
<label for="message_receiver_name" ><strong><%= t('message.receiver') -%>:</strong></label>
|
9
|
-
<%= link_to @message.receiver.username, @message.receiver -%>
|
9
|
+
<%= link_to @message.receiver.username, @message.receiver.profile if @message.receiver.try(:profile) -%>
|
10
10
|
</p>
|
11
11
|
<p>
|
12
12
|
<label for="message_sender_name" ><strong><%= t('message.sender') -%>:</strong></label>
|
13
|
-
<%= link_to @message.sender.username, @message.sender -%>
|
13
|
+
<%= link_to @message.sender.username, @message.sender.profile if @message.sender.try(:profile) -%>
|
14
14
|
</p>
|
15
15
|
|
16
16
|
<p>
|
@@ -38,11 +38,11 @@
|
|
38
38
|
<% if request.referer %>
|
39
39
|
<li><%= link_to t('page.back'), :back -%></li>
|
40
40
|
<% else %>
|
41
|
-
<li><%= link_to t('page.listing', :
|
41
|
+
<li><%= link_to t('page.listing', model: t('activerecord.models.message')), messages_path -%></li>
|
42
42
|
<% end %>
|
43
|
-
<li><%= link_to t('message.reply'), new_message_path(:
|
43
|
+
<li><%= link_to t('message.reply'), new_message_path(parent_id: @message.id) -%></li>
|
44
44
|
<% if can? :delete, :message %>
|
45
|
-
<li><%= link_to t('page.destroy'), @message, :
|
45
|
+
<li><%= link_to t('page.destroy'), @message, data: {confirm: t('page.are_you_sure')}, method: :delete -%></li>
|
46
46
|
<% end %>
|
47
47
|
</ul>
|
48
48
|
</div>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateMessageTransitions < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :message_transitions do |t|
|
4
|
+
t.string :to_state
|
5
|
+
t.text :metadata, default: "{}"
|
6
|
+
t.integer :sort_key
|
7
|
+
t.integer :message_id
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
|
11
|
+
add_index :message_transitions, :message_id
|
12
|
+
add_index :message_transitions, [:sort_key, :message_id], unique: true
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateMessageRequestTransitions < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :message_request_transitions do |t|
|
4
|
+
t.string :to_state
|
5
|
+
t.text :metadata, default: "{}"
|
6
|
+
t.integer :sort_key
|
7
|
+
t.integer :message_request_id
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
|
11
|
+
add_index :message_request_transitions, :message_request_id
|
12
|
+
add_index :message_request_transitions, [:sort_key, :message_request_id], unique: true, name: "index_message_request_transitions_on_sort_key_and_request_id"
|
13
|
+
end
|
14
|
+
end
|
data/lib/enju_message/engine.rb
CHANGED
data/lib/enju_message/user.rb
CHANGED
@@ -18,9 +18,9 @@ module EnjuMessage
|
|
18
18
|
request = MessageRequest.new
|
19
19
|
request.sender = self.class.find(1)
|
20
20
|
request.receiver = self
|
21
|
-
request.message_template = MessageTemplate.localized_template(status,
|
21
|
+
request.message_template = MessageTemplate.localized_template(status, profile.locale)
|
22
22
|
request.save_message_body(options)
|
23
|
-
request.
|
23
|
+
request.transition_to!(:sent)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
data/lib/enju_message/version.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
class EnjuMessage::SetupGenerator < Rails::Generators::Base
|
2
2
|
source_root File.expand_path('../templates', __FILE__)
|
3
|
+
argument :file, :type => :string, :default => "all"
|
3
4
|
|
4
5
|
def copy_setup_files
|
5
6
|
directory("db/fixtures", "db/fixtures/enju_message")
|
7
|
+
return if file == 'fixture'
|
6
8
|
rake("enju_message_engine:install:migrations")
|
7
9
|
inject_into_file 'app/models/user.rb',
|
8
10
|
" enju_message_user_model\n", :after => "enju_leaf_user_model\n"
|
@@ -1,43 +1,43 @@
|
|
1
1
|
message_template_00001:
|
2
2
|
id: 1
|
3
3
|
status: reservation_accepted_for_patron
|
4
|
-
title:
|
5
|
-
body:
|
4
|
+
title: 予約を受け付けました
|
5
|
+
body: 予約を受け付けました。
|
6
6
|
position: 1
|
7
7
|
locale: ja
|
8
8
|
message_template_00002:
|
9
9
|
id: 2
|
10
10
|
status: item_received_for_patron
|
11
|
-
title:
|
12
|
-
body:
|
11
|
+
title: 資料を確保しました
|
12
|
+
body: 資料を確保しました。
|
13
13
|
position: 2
|
14
14
|
locale: ja
|
15
15
|
message_template_00003:
|
16
16
|
id: 3
|
17
17
|
status: reservation_expired_for_patron
|
18
|
-
title:
|
19
|
-
body:
|
18
|
+
title: 予約の期限が切れました
|
19
|
+
body: 予約の期限が切れました。
|
20
20
|
position: 3
|
21
21
|
locale: ja
|
22
22
|
message_template_00004:
|
23
23
|
id: 4
|
24
24
|
status: reservation_expired_for_library
|
25
|
-
title:
|
26
|
-
body:
|
25
|
+
title: 予約の期限が切れました
|
26
|
+
body: 予約の期限が切れました。
|
27
27
|
position: 4
|
28
28
|
locale: ja
|
29
29
|
message_template_00005:
|
30
30
|
id: 5
|
31
31
|
status: reservation_canceled_for_patron
|
32
|
-
title:
|
33
|
-
body:
|
32
|
+
title: 予約を取り消しました
|
33
|
+
body: 予約を取り消しました。
|
34
34
|
position: 5
|
35
35
|
locale: ja
|
36
36
|
message_template_00006:
|
37
37
|
id: 6
|
38
38
|
status: reservation_canceled_for_library
|
39
|
-
title:
|
40
|
-
body:
|
39
|
+
title: 予約を取り消しました
|
40
|
+
body: 予約を取り消しました。
|
41
41
|
position: 6
|
42
42
|
locale: ja
|
43
43
|
message_template_00007:
|
@@ -57,28 +57,49 @@ message_template_00008:
|
|
57
57
|
message_template_00009:
|
58
58
|
id: 9
|
59
59
|
status: reservation_accepted_for_library
|
60
|
-
title:
|
61
|
-
body:
|
60
|
+
title: 予約を受け付けました
|
61
|
+
body: 予約を受け付けました。
|
62
62
|
position: 9
|
63
63
|
locale: ja
|
64
64
|
message_template_00010:
|
65
65
|
id: 10
|
66
66
|
status: item_received_for_library
|
67
|
-
title:
|
68
|
-
body:
|
67
|
+
title: 資料を確保しました
|
68
|
+
body: 資料を確保しました。
|
69
69
|
position: 10
|
70
70
|
locale: ja
|
71
71
|
message_template_00011:
|
72
72
|
id: 11
|
73
73
|
status: reservation_postponed_for_patron
|
74
|
-
title:
|
75
|
-
body:
|
74
|
+
title: 予約を延期しました
|
75
|
+
body: 予約を延期しました。
|
76
76
|
position: 11
|
77
77
|
locale: ja
|
78
78
|
message_template_00012:
|
79
79
|
id: 12
|
80
80
|
status: reservation_postponed_for_library
|
81
|
-
title:
|
82
|
-
body:
|
81
|
+
title: 予約を延期しました
|
82
|
+
body: 予約を延期しました。
|
83
83
|
position: 12
|
84
84
|
locale: ja
|
85
|
+
message_template_00013:
|
86
|
+
id: 13
|
87
|
+
status: import_completed
|
88
|
+
title: インポートが完了しました
|
89
|
+
body: インポートが完了しました。
|
90
|
+
position: 13
|
91
|
+
locale: ja
|
92
|
+
message_template_00014:
|
93
|
+
id: 14
|
94
|
+
status: counting_completed
|
95
|
+
title: 集計が完了しました
|
96
|
+
body: 集計が完了しました。
|
97
|
+
position: 14
|
98
|
+
locale: ja
|
99
|
+
message_template_00015:
|
100
|
+
id: 15
|
101
|
+
status: export_completed
|
102
|
+
title: エクスポートが完了しました
|
103
|
+
body: エクスポートが完了しました。
|
104
|
+
position: 15
|
105
|
+
locale: ja
|
@@ -1,4 +1,6 @@
|
|
1
1
|
require 'active_record/fixtures'
|
2
|
+
require 'tasks/message_template'
|
3
|
+
|
2
4
|
namespace :enju_message do
|
3
5
|
desc "create initial records for enju_message"
|
4
6
|
task :setup => :environment do
|
@@ -11,4 +13,12 @@ namespace :enju_message do
|
|
11
13
|
task :send => :environment do
|
12
14
|
MessageRequest.send_messages if defined?(EnjuMessage)
|
13
15
|
end
|
16
|
+
|
17
|
+
desc "upgrade enju_message"
|
18
|
+
task :upgrade => :environment do
|
19
|
+
MessageTemplate.transaction do
|
20
|
+
update_message_template
|
21
|
+
end
|
22
|
+
puts 'enju_message: The upgrade completed successfully.'
|
23
|
+
end
|
14
24
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
def update_message_template
|
2
|
+
YAML.load(open('db/fixtures/enju_message/message_templates.yml').read).each do |line|
|
3
|
+
l = line[1].select!{|k, v| %w(status locale title body).include?(k)}
|
4
|
+
template = MessageTemplate.where(
|
5
|
+
status: l["status"], locale: l["locale"]
|
6
|
+
).first
|
7
|
+
if template
|
8
|
+
template.update_attributes!(l)
|
9
|
+
else
|
10
|
+
MessageTemplate.create!(l)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -7,7 +7,7 @@ describe MessageRequestsController do
|
|
7
7
|
|
8
8
|
describe "GET index" do
|
9
9
|
describe "When logged in as Administrator" do
|
10
|
-
|
10
|
+
login_fixture_admin
|
11
11
|
|
12
12
|
it "assigns all message_requests as @message_requests" do
|
13
13
|
get :index
|
@@ -16,7 +16,7 @@ describe MessageRequestsController do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
describe "When logged in as Librarian" do
|
19
|
-
|
19
|
+
login_fixture_librarian
|
20
20
|
|
21
21
|
it "assigns all message_requests as @message_requests" do
|
22
22
|
get :index
|
@@ -25,7 +25,7 @@ describe MessageRequestsController do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
describe "When logged in as User" do
|
28
|
-
|
28
|
+
login_fixture_user
|
29
29
|
|
30
30
|
it "assigns all message_requests as @message_requests" do
|
31
31
|
get :index
|
@@ -43,7 +43,7 @@ describe MessageRequestsController do
|
|
43
43
|
|
44
44
|
describe "GET show" do
|
45
45
|
describe "When logged in as Administrator" do
|
46
|
-
|
46
|
+
login_fixture_admin
|
47
47
|
|
48
48
|
it "assigns the requested message_request as @message_request" do
|
49
49
|
message_request = FactoryGirl.create(:message_request)
|
@@ -53,7 +53,7 @@ describe MessageRequestsController do
|
|
53
53
|
end
|
54
54
|
|
55
55
|
describe "When logged in as Librarian" do
|
56
|
-
|
56
|
+
login_fixture_librarian
|
57
57
|
|
58
58
|
it "assigns the requested message_request as @message_request" do
|
59
59
|
message_request = FactoryGirl.create(:message_request)
|
@@ -63,7 +63,7 @@ describe MessageRequestsController do
|
|
63
63
|
end
|
64
64
|
|
65
65
|
describe "When logged in as User" do
|
66
|
-
|
66
|
+
login_fixture_user
|
67
67
|
|
68
68
|
it "assigns the requested message_request as @message_request" do
|
69
69
|
message_request = FactoryGirl.create(:message_request)
|
@@ -83,7 +83,7 @@ describe MessageRequestsController do
|
|
83
83
|
|
84
84
|
describe "GET edit" do
|
85
85
|
describe "When logged in as Administrator" do
|
86
|
-
|
86
|
+
login_fixture_admin
|
87
87
|
|
88
88
|
it "assigns the requested message_request as @message_request" do
|
89
89
|
message_request = FactoryGirl.create(:message_request)
|
@@ -93,7 +93,7 @@ describe MessageRequestsController do
|
|
93
93
|
end
|
94
94
|
|
95
95
|
describe "When logged in as Librarian" do
|
96
|
-
|
96
|
+
login_fixture_librarian
|
97
97
|
|
98
98
|
it "assigns the requested message_request as @message_request" do
|
99
99
|
message_request = FactoryGirl.create(:message_request)
|
@@ -103,7 +103,7 @@ describe MessageRequestsController do
|
|
103
103
|
end
|
104
104
|
|
105
105
|
describe "When logged in as User" do
|
106
|
-
|
106
|
+
login_fixture_user
|
107
107
|
|
108
108
|
it "assigns the requested message_request as @message_request" do
|
109
109
|
message_request = FactoryGirl.create(:message_request)
|
@@ -129,7 +129,7 @@ describe MessageRequestsController do
|
|
129
129
|
end
|
130
130
|
|
131
131
|
describe "When logged in as Administrator" do
|
132
|
-
|
132
|
+
login_fixture_admin
|
133
133
|
|
134
134
|
describe "with valid params" do
|
135
135
|
it "updates the requested message_request" do
|
@@ -151,7 +151,7 @@ describe MessageRequestsController do
|
|
151
151
|
end
|
152
152
|
|
153
153
|
describe "When logged in as Librarian" do
|
154
|
-
|
154
|
+
login_fixture_librarian
|
155
155
|
|
156
156
|
describe "with valid params" do
|
157
157
|
it "updates the requested message_request" do
|
@@ -174,7 +174,7 @@ describe MessageRequestsController do
|
|
174
174
|
end
|
175
175
|
|
176
176
|
describe "When logged in as User" do
|
177
|
-
|
177
|
+
login_fixture_user
|
178
178
|
|
179
179
|
describe "with valid params" do
|
180
180
|
it "updates the requested message_request" do
|
@@ -223,7 +223,7 @@ describe MessageRequestsController do
|
|
223
223
|
end
|
224
224
|
|
225
225
|
describe "When logged in as Administrator" do
|
226
|
-
|
226
|
+
login_fixture_admin
|
227
227
|
|
228
228
|
it "destroys the requested message_request" do
|
229
229
|
delete :destroy, :id => @message_request.id
|
@@ -236,7 +236,7 @@ describe MessageRequestsController do
|
|
236
236
|
end
|
237
237
|
|
238
238
|
describe "When logged in as Librarian" do
|
239
|
-
|
239
|
+
login_fixture_librarian
|
240
240
|
|
241
241
|
it "destroys the requested message_request" do
|
242
242
|
delete :destroy, :id => @message_request.id
|
@@ -249,7 +249,7 @@ describe MessageRequestsController do
|
|
249
249
|
end
|
250
250
|
|
251
251
|
describe "When logged in as User" do
|
252
|
-
|
252
|
+
login_fixture_user
|
253
253
|
|
254
254
|
it "destroys the requested message_request" do
|
255
255
|
delete :destroy, :id => @message_request.id
|