enju_message 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +36 -0
- data/app/controllers/message_requests_controller.rb +62 -0
- data/app/controllers/message_templates_controller.rb +18 -0
- data/app/controllers/messages_controller.rb +155 -0
- data/app/helpers/messages_helper.rb +2 -0
- data/app/models/message.rb +86 -0
- data/app/models/message_request.rb +87 -0
- data/app/models/message_template.rb +42 -0
- data/app/views/layouts/messages.html.erb +24 -0
- data/app/views/message_requests/edit.html.erb +40 -0
- data/app/views/message_requests/index.html.erb +58 -0
- data/app/views/message_requests/new.html.erb +40 -0
- data/app/views/message_requests/show.html.erb +55 -0
- data/app/views/message_templates/_form.html.erb +27 -0
- data/app/views/message_templates/edit.html.erb +13 -0
- data/app/views/message_templates/index.html.erb +44 -0
- data/app/views/message_templates/new.html.erb +12 -0
- data/app/views/message_templates/show.html.erb +33 -0
- data/app/views/messages/_form.html.erb +37 -0
- data/app/views/messages/edit.html.erb +42 -0
- data/app/views/messages/index.atom.builder +15 -0
- data/app/views/messages/index.html.erb +66 -0
- data/app/views/messages/index.rss.builder +41 -0
- data/app/views/messages/new.html.erb +43 -0
- data/app/views/messages/show.html.erb +48 -0
- data/app/views/notifier/message_notification.en.text.erb +14 -0
- data/app/views/notifier/message_notification.ja.text.erb +14 -0
- data/config/routes.rb +9 -0
- data/db/fixtures/message_templates.yml +54 -0
- data/db/migrate/149_create_message_templates.rb +18 -0
- data/db/migrate/154_create_messages.rb +24 -0
- data/db/migrate/20080819181903_create_message_requests.rb +20 -0
- data/db/migrate/20110913115320_add_lft_and_rgt_to_message.rb +11 -0
- data/lib/enju_message/engine.rb +17 -0
- data/lib/enju_message/version.rb +3 -0
- data/lib/enju_message.rb +4 -0
- data/lib/tasks/enju_message_tasks.rake +5 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +9 -0
- data/test/dummy/app/assets/stylesheets/application.css +7 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config/application.rb +45 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +30 -0
- data/test/dummy/config/environments/production.rb +60 -0
- data/test/dummy/config/environments/test.rb +39 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +10 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +58 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +0 -0
- data/test/dummy/log/test.log +3 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +26 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/enju_message_test.rb +7 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/test_helper.rb +10 -0
- metadata +337 -0
@@ -0,0 +1,55 @@
|
|
1
|
+
<div id="content_detail" class="ui-corner-all">
|
2
|
+
<h1 class="title"><%= t('page.showing', :model => t('activerecord.models.message_request')) -%></h1>
|
3
|
+
<div id="content_list">
|
4
|
+
<p id="notice"><%= notice %></p>
|
5
|
+
|
6
|
+
<p>
|
7
|
+
<strong><%= t('message.sender') -%>:</strong>
|
8
|
+
<%= link_to @message_request.sender.username, @message_request.sender -%>
|
9
|
+
</p>
|
10
|
+
|
11
|
+
<p>
|
12
|
+
<strong><%= t('message.receiver') -%>:</strong>
|
13
|
+
<%= link_to @message_request.receiver.username, @message_request.receiver -%>
|
14
|
+
</p>
|
15
|
+
|
16
|
+
<p>
|
17
|
+
<strong><%= t('page.created_at') -%>:</strong>
|
18
|
+
<%= l(@message_request.created_at) -%>
|
19
|
+
</p>
|
20
|
+
|
21
|
+
<p>
|
22
|
+
<strong><%= t('page.updated_at') -%>:</strong>
|
23
|
+
<%= l(@message_request.updated_at) -%>
|
24
|
+
</p>
|
25
|
+
|
26
|
+
<p>
|
27
|
+
<strong><%= t('activerecord.attributes.message_request.sent_at') -%>:</strong>
|
28
|
+
<%= l(@message_request.sent_at) if @message_request.sent_at -%>
|
29
|
+
</p>
|
30
|
+
|
31
|
+
<p>
|
32
|
+
<strong><%= t('activerecord.models.message_template') -%>:</strong>
|
33
|
+
<%= link_to @message_request.message_template.status, message_template_path(@message_request.message_template) -%>
|
34
|
+
</p>
|
35
|
+
|
36
|
+
<p>
|
37
|
+
<strong><%= t('activerecord.attributes.message.subject') -%>:</strong>
|
38
|
+
<%= @message_request.subject -%>
|
39
|
+
</p>
|
40
|
+
|
41
|
+
<div>
|
42
|
+
<strong><%= t('activerecord.attributes.message.body') -%>:</strong>
|
43
|
+
<%= raw auto_link(simple_format(h(@message_request.body))) -%>
|
44
|
+
</div>
|
45
|
+
|
46
|
+
</div>
|
47
|
+
</div>
|
48
|
+
|
49
|
+
<div id="submenu" class="ui-corner-all">
|
50
|
+
<ul>
|
51
|
+
<li><%= link_to t('page.edit'), edit_message_request_path(@message_request) -%></li>
|
52
|
+
<li><%= back_to_index(flash[:page_info]) -%></li>
|
53
|
+
<li><%= link_to t('message.send'), new_message_path(:message_request_id => @message_request.id) -%></li>
|
54
|
+
</ul>
|
55
|
+
</div>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<%= simple_form_for(@message_template, :validate => true) do |f| %>
|
2
|
+
<%= f.error_notification %>
|
3
|
+
|
4
|
+
<div class="field">
|
5
|
+
<%= f.label :status %><br />
|
6
|
+
<%= f.text_field :status, :class => 'resource_title' %>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<div class="field">
|
10
|
+
<%= f.label :locale %><br />
|
11
|
+
<%= f.select(:locale, @available_languages.collect{|language| [language.display_name.localize, language.iso_639_1]}) %>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<div class="field">
|
15
|
+
<%= f.label :title %><br />
|
16
|
+
<%= f.text_field :title, :class => 'resource_title' %>
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<div class="field">
|
20
|
+
<%= f.label :body %><br />
|
21
|
+
<%= f.text_area :body, :class => 'resource_textarea' %>
|
22
|
+
</div>
|
23
|
+
|
24
|
+
<div class="actions">
|
25
|
+
<%= f.submit %>
|
26
|
+
</div>
|
27
|
+
<% end %>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<div id="content_detail" class="ui-corner-all">
|
2
|
+
<h1 class="title"><%= t('page.editing', :model => t('activerecord.models.message_template')) -%></h1>
|
3
|
+
<div id="content_list">
|
4
|
+
<%= render 'form' %>
|
5
|
+
</div>
|
6
|
+
</div>
|
7
|
+
|
8
|
+
<div id="submenu" class="ui-corner-all">
|
9
|
+
<ul>
|
10
|
+
<li><%= link_to t('page.show'), @message_template -%></li>
|
11
|
+
<li><%= link_to t('page.back'), message_templates_path -%></li>
|
12
|
+
</ul>
|
13
|
+
</div>
|
@@ -0,0 +1,44 @@
|
|
1
|
+
<div id="content_detail" class="ui-corner-all">
|
2
|
+
<h1 class="title"><%= t('page.listing', :model => t('activerecord.models.message_template')) -%></h1>
|
3
|
+
<div id="content_list">
|
4
|
+
|
5
|
+
<table class="index">
|
6
|
+
<tr>
|
7
|
+
<th id="position"></th>
|
8
|
+
<th><%= t('activerecord.attributes.message_template.status') -%></th>
|
9
|
+
<th><%= t('activerecord.attributes.message_template.locale') -%></th>
|
10
|
+
<th><%= t('activerecord.attributes.message_template.title') -%></th>
|
11
|
+
<th></th>
|
12
|
+
</tr>
|
13
|
+
|
14
|
+
<%- @message_templates.each do |message_template| -%>
|
15
|
+
<tr class="line<%= cycle("0", "1") -%>">
|
16
|
+
<td>
|
17
|
+
<%- if can? :update, message_template -%>
|
18
|
+
<%= move_position(message_template) -%>
|
19
|
+
<%- end -%>
|
20
|
+
</td>
|
21
|
+
<td><%= link_to message_template.status, message_template -%></td>
|
22
|
+
<td><%= message_template.locale -%></td>
|
23
|
+
<td><%= message_template.title -%></td>
|
24
|
+
<td>
|
25
|
+
<%- if can? :update, message_template -%>
|
26
|
+
<%= link_to t('page.edit'), edit_message_template_path(message_template) -%>
|
27
|
+
<% end %>
|
28
|
+
<%- if can? :destroy, message_template -%>
|
29
|
+
<%= link_to t('page.destroy'), message_template, :confirm => t('page.are_you_sure'), :method => :delete -%>
|
30
|
+
<%- end -%>
|
31
|
+
</td>
|
32
|
+
</tr>
|
33
|
+
<%- end -%>
|
34
|
+
</table>
|
35
|
+
|
36
|
+
<%= will_paginate(@message_templates) -%>
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
|
40
|
+
<div id="submenu" class="ui-corner-all">
|
41
|
+
<ul>
|
42
|
+
<li><%= link_to t('page.new', :model => t('activerecord.models.message_template')), new_message_template_path -%></li>
|
43
|
+
</ul>
|
44
|
+
</div>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<div id="content_detail" class="ui-corner-all">
|
2
|
+
<h1 class="title"><%= t('page.new', :model => t('activerecord.models.message_template')) -%></h1>
|
3
|
+
<div id="content_list">
|
4
|
+
<%= render 'form' %>
|
5
|
+
</div>
|
6
|
+
</div>
|
7
|
+
|
8
|
+
<div id="submenu" class="ui-corner-all">
|
9
|
+
<ul>
|
10
|
+
<li><%= link_to t('page.back'), message_templates_path -%></li>
|
11
|
+
</ul>
|
12
|
+
</div>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<div id="content_detail" class="ui-corner-all">
|
2
|
+
<h1 class="title"><%= t('page.showing', :model => t('activerecord.models.message_template')) -%></h1>
|
3
|
+
<div id="content_list">
|
4
|
+
<p id="notice"><%= notice %></p>
|
5
|
+
|
6
|
+
<p>
|
7
|
+
<strong><%= t('activerecord.attributes.message_template.status') -%>:</strong>
|
8
|
+
<%= @message_template.status -%>
|
9
|
+
</p>
|
10
|
+
|
11
|
+
<p>
|
12
|
+
<strong><%= t('activerecord.attributes.message_template.locale') -%>:</strong>
|
13
|
+
<%= @message_template.locale -%>
|
14
|
+
</p>
|
15
|
+
|
16
|
+
<p>
|
17
|
+
<strong><%= t('activerecord.attributes.message_template.title') -%>:</strong>
|
18
|
+
<%= @message_template.title -%>
|
19
|
+
</p>
|
20
|
+
|
21
|
+
<p>
|
22
|
+
<strong><%= t('activerecord.attributes.message_template.body') -%>:</strong><br />
|
23
|
+
<%= @message_template.body.gsub("\n", '<br />') -%>
|
24
|
+
</p>
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
|
28
|
+
<div id="submenu" class="ui-corner-all">
|
29
|
+
<ul>
|
30
|
+
<li><%= link_to t('page.edit'), edit_message_template_path(@message_template) -%></li>
|
31
|
+
<li><%= back_to_index(flash[:page_info]) -%></li>
|
32
|
+
</ul>
|
33
|
+
</div>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<%= form_for(@message) do |f| %>
|
2
|
+
<% if @message.errors.any? %>
|
3
|
+
<div id="error_explanation">
|
4
|
+
<h2><%= pluralize(@message.errors.count, "error") %> prohibited this message from being saved:</h2>
|
5
|
+
|
6
|
+
<ul>
|
7
|
+
<% @message.errors.full_messages.each do |msg| %>
|
8
|
+
<li><%= msg %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<div class="field">
|
15
|
+
<%= f.label :sender_id %><br />
|
16
|
+
<%= f.text_field :sender_id %>
|
17
|
+
</div>
|
18
|
+
<div class="field">
|
19
|
+
<%= f.label :receiver_id %><br />
|
20
|
+
<%= f.text_field :receiver_id %>
|
21
|
+
</div>
|
22
|
+
<div class="field">
|
23
|
+
<%= f.label :state %><br />
|
24
|
+
<%= f.text_field :state %>
|
25
|
+
</div>
|
26
|
+
<div class="field">
|
27
|
+
<%= f.label :subject %><br />
|
28
|
+
<%= f.text_field :subject %>
|
29
|
+
</div>
|
30
|
+
<div class="field">
|
31
|
+
<%= f.label :body %><br />
|
32
|
+
<%= f.text_area :body %>
|
33
|
+
</div>
|
34
|
+
<div class="actions">
|
35
|
+
<%= f.submit %>
|
36
|
+
</div>
|
37
|
+
<% end %>
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<div id="content_detail" class="ui-corner-all">
|
2
|
+
<h1 class="title"><%= t('page.editing', :model => t('activerecord.models.message')) -%></h1>
|
3
|
+
<div id="content_list">
|
4
|
+
|
5
|
+
<%= form_for(@message) do |f| -%>
|
6
|
+
<%= f.error_messages -%>
|
7
|
+
|
8
|
+
<div class="field">
|
9
|
+
<%= f.label t('message.sender') -%><br />
|
10
|
+
<%= @message.sender.username -%>
|
11
|
+
<%= f.hidden_field :sender_id -%>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<div class="field">
|
15
|
+
<%= f.label t('message.receiver') -%><br />
|
16
|
+
<%= f.text_field :recipient, :class => 'resource_title', :value => @message.receiver.username -%>
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<div class="field">
|
20
|
+
<%= f.label :subject -%><br />
|
21
|
+
<%= f.text_field :subject, :class => 'resource_title' -%>
|
22
|
+
</div>
|
23
|
+
|
24
|
+
<div class="field">
|
25
|
+
<%= f.label :body -%><br />
|
26
|
+
<%= f.text_area :body, :id => 'message_body' -%>
|
27
|
+
</div>
|
28
|
+
|
29
|
+
<div class="actions">
|
30
|
+
<%= f.submit %>
|
31
|
+
</div>
|
32
|
+
<%- end -%>
|
33
|
+
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
|
37
|
+
<div id="submenu" class="ui-corner-all">
|
38
|
+
<ul>
|
39
|
+
<li><%= link_to t('page.show'), @message -%></li>
|
40
|
+
<li><%= link_to t('page.listing', :model => t('activerecord.models.message')), messages_path -%></li>
|
41
|
+
</ul>
|
42
|
+
</div>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
atom_feed do |feed|
|
2
|
+
feed.title "#{@user.username}'s Inbox"
|
3
|
+
feed.updated(@messages.first ? @messages.first.created_at : Time.zone.now)
|
4
|
+
|
5
|
+
@messages.each do |message|
|
6
|
+
feed.entry(message, :url => message_url(message)) do |entry|
|
7
|
+
entry.title message.subject
|
8
|
+
entry.content message.body, :type => 'html'
|
9
|
+
|
10
|
+
entry.author do |author|
|
11
|
+
author.name message.sender.login
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
<div id="content_detail" class="ui-corner-all">
|
2
|
+
<h1 class="title"><%= t('activerecord.models.message') -%></h1>
|
3
|
+
<div id="content_list">
|
4
|
+
<%= form_for :messages, :url => messages_path, :html => {:method => 'get'} do -%>
|
5
|
+
<p>
|
6
|
+
<%= t('page.search_term') -%>: <%= search_field_tag 'query', h(@query), {:id => 'search_form_top', :class => 'search_form', :placeholder => t('page.search_term')} -%>
|
7
|
+
<%= submit_tag t('page.search') -%>
|
8
|
+
</p>
|
9
|
+
<%- end -%>
|
10
|
+
|
11
|
+
<%= form_for :message, :url => destroy_selected_messages_path do |form| -%>
|
12
|
+
<table class="index">
|
13
|
+
<tr>
|
14
|
+
<th></th>
|
15
|
+
<th><%= t('activerecord.attributes.message.subject') -%></th>
|
16
|
+
<th><%= t('activerecord.attributes.message.sender') -%></th>
|
17
|
+
<th><%= t('message.sent_at') -%></th>
|
18
|
+
</tr>
|
19
|
+
<%- @messages.each do |message| -%>
|
20
|
+
<tr class="line<%= cycle("0", "1") -%>">
|
21
|
+
<td>
|
22
|
+
<% if can? :delete, message %>
|
23
|
+
<input id="delete_<%=h message.id -%>" name="delete[]" type="checkbox" value="<%=h message.id %>" class="checkbox" />
|
24
|
+
<% end %>
|
25
|
+
</td>
|
26
|
+
<td>
|
27
|
+
<% unless message.read? %><strong><% end %>
|
28
|
+
<%= link_to message.subject, message -%>
|
29
|
+
<% unless message.read? %></strong><% end %>
|
30
|
+
</td>
|
31
|
+
<td><%= link_to message.sender.username, message.sender -%></td>
|
32
|
+
<td><%= l(message.created_at) -%></td>
|
33
|
+
</tr>
|
34
|
+
<%- end -%>
|
35
|
+
<tr>
|
36
|
+
<td colspan="4"><%= submit_tag t('message.delete') -%></td>
|
37
|
+
</tr>
|
38
|
+
</table>
|
39
|
+
<%- end -%>
|
40
|
+
<%= will_paginate(@messages) -%>
|
41
|
+
</div>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<div id="submenu" class="ui-corner-all">
|
45
|
+
<ul>
|
46
|
+
<% mode = params[:mode].to_s %>
|
47
|
+
<%- @message_facet.each do |facet| -%>
|
48
|
+
<li>
|
49
|
+
<% facet.value ? facet_mode = 'read' : facet_mode = 'unread' %>
|
50
|
+
<%- if facet_mode == mode -%><strong><%- end -%>
|
51
|
+
<%= link_to t("message.#{facet_mode}"), url_for(params.merge(:page => nil, :mode => facet_mode)) -%>
|
52
|
+
(<%= facet.count -%>)
|
53
|
+
<%- if facet_mode == mode -%></strong><%- end -%>
|
54
|
+
</li>
|
55
|
+
<%- end -%>
|
56
|
+
<% if mode.present? %>
|
57
|
+
<li><%= link_to t('page.remove_this_facet'), url_for(params.merge(:mode => nil, :page => nil)) -%></li>
|
58
|
+
<% end %>
|
59
|
+
</ul>
|
60
|
+
|
61
|
+
<ul>
|
62
|
+
<% if can? :create, Message %>
|
63
|
+
<li><%= link_to t('page.new', :model => t('activerecord.models.message')), new_message_path -%></li>
|
64
|
+
<% end %>
|
65
|
+
</ul>
|
66
|
+
</div>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
xml.instruct! :xml, :version=>"1.0"
|
2
|
+
xml.rss('version' => "2.0",
|
3
|
+
'xmlns:opensearch' => "http://a9.com/-/spec/opensearch/1.1/",
|
4
|
+
'xmlns:atom' => "http://www.w3.org/2005/Atom"){
|
5
|
+
xml.channel{
|
6
|
+
if @user
|
7
|
+
xml.title t('message.user_message', :login_name => @user.username)
|
8
|
+
xml.link messages_url(@user, :format => :rss)
|
9
|
+
else
|
10
|
+
xml.title t('message.library_group_message', :library_group_name => @library_group.display_name.localize)
|
11
|
+
xml.link messages_url(:format => :rss)
|
12
|
+
end
|
13
|
+
xml.description "Next-L Enju, an open source integrated library system developed by Project Next-L"
|
14
|
+
xml.language @locale.to_s
|
15
|
+
xml.ttl "60"
|
16
|
+
if @user
|
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
|
+
else
|
20
|
+
xml.tag! "atom:link", :rel => 'self', :href => messages_url(:format => :rss)
|
21
|
+
xml.tag! "atom:link", :rel => 'alternate', :href => messages_url
|
22
|
+
end
|
23
|
+
#xml.tag! "atom:link", :rel => 'search', :type => 'application/opensearchdescription+xml', :href => "http://#{request.host_with_port}/page/opensearch"
|
24
|
+
unless params[:query].blank?
|
25
|
+
xml.tag! "opensearch:totalResults", @messages.total_entries
|
26
|
+
xml.tag! "opensearch:startIndex", @messages.offset + 1
|
27
|
+
xml.tag! "opensearch:itemsPerPage", @messages.per_page
|
28
|
+
#xml.tag! "opensearch:Query", :role => 'request', :searchTerms => params[:query], :startPage => (params[:page] || 1)
|
29
|
+
end
|
30
|
+
@messages.each do |message|
|
31
|
+
xml.item do
|
32
|
+
xml.title message.subject
|
33
|
+
#xml.description(message.title)
|
34
|
+
# rfc822
|
35
|
+
xml.pubDate message.created_at.utc.rfc822
|
36
|
+
xml.link message_url(message)
|
37
|
+
xml.guid message_url(message), :isPermaLink => "true"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
}
|
41
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<div id="content_detail" class="ui-corner-all">
|
2
|
+
<h1 class="title"><%= t('page.new', :model => t('activerecord.models.message')) -%></h1>
|
3
|
+
<div id="content_list">
|
4
|
+
<fieldset>
|
5
|
+
|
6
|
+
<%= simple_form_for(@message, :url => messages_path, :validate => true) do |f| -%>
|
7
|
+
<%= f.error_notification -%>
|
8
|
+
|
9
|
+
<div class="field">
|
10
|
+
<label for="message_recepient"><%= t('message.recipient') -%>:</label>
|
11
|
+
<%- if @message.recipient -%>
|
12
|
+
<%= link_to @message.recipient, user_path(@message.recipient) -%>
|
13
|
+
<%= f.hidden_field :recipient, :value => @message.recipient -%>
|
14
|
+
<%- else -%>
|
15
|
+
<%= f.text_field :recipient, :class => 'resource_title', :value => @message.recipient -%>
|
16
|
+
<%- end -%>
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<div class="field">
|
20
|
+
<%= f.label :subject -%>:
|
21
|
+
<%= f.text_field :subject, :class => 'resource_title' -%>
|
22
|
+
</div>
|
23
|
+
|
24
|
+
<div class="field">
|
25
|
+
<%= f.label :body -%>:<br />
|
26
|
+
<%= f.text_area :body, :id => 'message_body' -%>
|
27
|
+
</div>
|
28
|
+
|
29
|
+
<div class="field">
|
30
|
+
<%= f.hidden_field :parent_id -%>
|
31
|
+
<%= f.submit t('message.send') -%>
|
32
|
+
</div>
|
33
|
+
<%- end -%>
|
34
|
+
</fieldset>
|
35
|
+
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<div id="submenu" class="ui-corner-all">
|
40
|
+
<ul>
|
41
|
+
<li><%= link_to t('page.listing', :model => t('activerecord.models.message')), messages_path -%></li>
|
42
|
+
</ul>
|
43
|
+
</div>
|
@@ -0,0 +1,48 @@
|
|
1
|
+
<div id="content_detail" class="ui-corner-all">
|
2
|
+
<h1 class="title"><%= t('activerecord.models.message') -%></h1>
|
3
|
+
<div id="content_list">
|
4
|
+
<p id="notice"><%= notice %></p>
|
5
|
+
|
6
|
+
<fieldset>
|
7
|
+
<p>
|
8
|
+
<label for="message_receiver_name" ><strong><%= t('message.receiver') -%>:</strong></label>
|
9
|
+
<%= link_to @message.receiver.username, @message.receiver -%>
|
10
|
+
</p>
|
11
|
+
<p>
|
12
|
+
<label for="message_sender_name" ><strong><%= t('message.sender') -%>:</strong></label>
|
13
|
+
<%= link_to @message.sender.username, @message.sender -%>
|
14
|
+
</p>
|
15
|
+
|
16
|
+
<p>
|
17
|
+
<label for="message_sent_at" ><strong><%= t('message.sent_at') -%>:</strong></label>
|
18
|
+
<%= l(@message.created_at) -%>
|
19
|
+
</p>
|
20
|
+
|
21
|
+
<p>
|
22
|
+
<label for="message_subject" ><strong><%= t('activerecord.attributes.message.subject') -%>:</strong></label>
|
23
|
+
<%= @message.subject -%>
|
24
|
+
</p>
|
25
|
+
|
26
|
+
<p>
|
27
|
+
<label for="message_body" ><strong><%= t('activerecord.attributes.message.body') -%>:</strong></label>
|
28
|
+
<%= raw auto_link(simple_format(h(@message.body))) -%>
|
29
|
+
</p>
|
30
|
+
|
31
|
+
</fieldset>
|
32
|
+
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
|
36
|
+
<div id="submenu" class="ui-corner-all">
|
37
|
+
<ul>
|
38
|
+
<% if request.referer %>
|
39
|
+
<li><%= link_to t('page.back'), :back -%></li>
|
40
|
+
<% else %>
|
41
|
+
<li><%= link_to t('page.listing', :model => t('activerecord.models.message')), messages_path -%></li>
|
42
|
+
<% end %>
|
43
|
+
<li><%= link_to t('message.reply'), new_message_path(:parent_id => @message.id) -%></li>
|
44
|
+
<% if can? :destroy, :message %>
|
45
|
+
<li><%= link_to t('page.destroy'), @message, :confirm => t('page.are_you_sure'), :method => :delete -%></li>
|
46
|
+
<% end %>
|
47
|
+
</ul>
|
48
|
+
</div>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<%=h @message.receiver.patron.full_name -%> :
|
2
|
+
|
3
|
+
A new message arrived from <%=h @sender_name -%>.
|
4
|
+
<%=h messages_url %>
|
5
|
+
|
6
|
+
-----
|
7
|
+
|
8
|
+
<%= @message.body %>
|
9
|
+
|
10
|
+
-----
|
11
|
+
|
12
|
+
--
|
13
|
+
<%=h LibraryGroup.system_name(@message.receiver.locale) %>
|
14
|
+
<%=h LibraryGroup.site_config.url %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<%=h @message.receiver.patron.full_name -%> さん
|
2
|
+
|
3
|
+
<%=h @sender_name -%> さんから新しいメッセージが届きました。
|
4
|
+
<%=h messages_url %>
|
5
|
+
|
6
|
+
-----
|
7
|
+
|
8
|
+
<%= @message.body %>
|
9
|
+
|
10
|
+
-----
|
11
|
+
|
12
|
+
--
|
13
|
+
<%=h LibraryGroup.system_name(@message.receiver.locale) %>
|
14
|
+
<%=h LibraryGroup.site_config.url %>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
message_template_00001:
|
2
|
+
id: 1
|
3
|
+
status: reservation_accepted_for_patron
|
4
|
+
title: Reservation accepted
|
5
|
+
body: Reservation accepted
|
6
|
+
position: 1
|
7
|
+
message_template_00002:
|
8
|
+
id: 2
|
9
|
+
status: item_received
|
10
|
+
title: Item received
|
11
|
+
body: Item received
|
12
|
+
position: 2
|
13
|
+
message_template_00003:
|
14
|
+
id: 3
|
15
|
+
status: reservation_expired_for_patron
|
16
|
+
title: Reservation expired
|
17
|
+
body: Reservation expired
|
18
|
+
position: 3
|
19
|
+
message_template_00004:
|
20
|
+
id: 4
|
21
|
+
status: reservation_expired_for_library
|
22
|
+
title: Reservation expired
|
23
|
+
body: Reservation expired
|
24
|
+
position: 4
|
25
|
+
message_template_00005:
|
26
|
+
id: 5
|
27
|
+
status: reservation_canceled_for_patron
|
28
|
+
title: Reservation canceled
|
29
|
+
body: Reservation canceled
|
30
|
+
position: 5
|
31
|
+
message_template_00006:
|
32
|
+
id: 6
|
33
|
+
status: reservation_canceled_for_library
|
34
|
+
title: Reservation canceled
|
35
|
+
body: Reservation canceled
|
36
|
+
position: 6
|
37
|
+
message_template_00007:
|
38
|
+
id: 7
|
39
|
+
status: recall_item
|
40
|
+
title: Recall item
|
41
|
+
body: Recall item
|
42
|
+
position: 7
|
43
|
+
message_template_00008:
|
44
|
+
id: 8
|
45
|
+
status: recall_overdue_item
|
46
|
+
title: Recall overdue item
|
47
|
+
body: Recall overdue item
|
48
|
+
position: 8
|
49
|
+
message_template_00009:
|
50
|
+
id: 9
|
51
|
+
status: reservation_accepted_for_library
|
52
|
+
title: Reservation accepted
|
53
|
+
body: Reservation accepted
|
54
|
+
position: 9
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreateMessageTemplates < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :message_templates do |t|
|
4
|
+
t.string :status, :null => false
|
5
|
+
t.text :title, :null => false
|
6
|
+
t.text :body, :null => false
|
7
|
+
t.integer :position
|
8
|
+
t.string :locale, :default => I18n.default_locale.to_s
|
9
|
+
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
add_index :message_templates, :status, :unique => true
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.down
|
16
|
+
drop_table :message_templates
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class CreateMessages < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :messages, :force => true do |t|
|
4
|
+
t.datetime :read_at
|
5
|
+
t.integer :receiver_id, :sender_id
|
6
|
+
t.string :subject, :null => false
|
7
|
+
t.text :body
|
8
|
+
t.integer :message_request_id
|
9
|
+
t.string :state
|
10
|
+
t.integer :parent_id
|
11
|
+
|
12
|
+
t.timestamps
|
13
|
+
end
|
14
|
+
|
15
|
+
add_index :messages, :sender_id
|
16
|
+
add_index :messages, :receiver_id
|
17
|
+
add_index :messages, :message_request_id
|
18
|
+
add_index :messages, :parent_id
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.down
|
22
|
+
drop_table :messages
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class CreateMessageRequests < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :message_requests do |t|
|
4
|
+
t.integer :sender_id
|
5
|
+
t.integer :receiver_id
|
6
|
+
t.integer :message_template_id
|
7
|
+
t.datetime :sent_at
|
8
|
+
t.datetime :deleted_at
|
9
|
+
t.text :body
|
10
|
+
t.string :state
|
11
|
+
|
12
|
+
t.timestamps
|
13
|
+
end
|
14
|
+
add_index :message_requests, :state
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.down
|
18
|
+
drop_table :message_requests
|
19
|
+
end
|
20
|
+
end
|