oxen_message 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +5 -0
- data/Rakefile +37 -0
- data/app/assets/javascripts/message_attachments.js +2 -0
- data/app/assets/javascripts/message_headers.js +2 -0
- data/app/assets/javascripts/messages.js +2 -0
- data/app/assets/stylesheets/message_attachments.css +4 -0
- data/app/assets/stylesheets/message_headers.css +4 -0
- data/app/assets/stylesheets/messages.css +4 -0
- data/app/assets/stylesheets/scaffold.css +56 -0
- data/app/controllers/message_attachments_controller.rb +58 -0
- data/app/controllers/message_headers_controller.rb +58 -0
- data/app/controllers/messages_controller.rb +58 -0
- data/app/helpers/message_attachments_helper.rb +2 -0
- data/app/helpers/message_headers_helper.rb +2 -0
- data/app/helpers/messages_helper.rb +2 -0
- data/app/models/message.rb +47 -0
- data/app/models/message_attachment.rb +14 -0
- data/app/models/message_header.rb +35 -0
- data/app/views/message_attachments/_form.html.erb +33 -0
- data/app/views/message_attachments/edit.html.erb +6 -0
- data/app/views/message_attachments/index.html.erb +33 -0
- data/app/views/message_attachments/new.html.erb +5 -0
- data/app/views/message_attachments/show.html.erb +24 -0
- data/app/views/message_headers/_form.html.erb +33 -0
- data/app/views/message_headers/edit.html.erb +6 -0
- data/app/views/message_headers/index.html.erb +33 -0
- data/app/views/message_headers/new.html.erb +5 -0
- data/app/views/message_headers/show.html.erb +24 -0
- data/app/views/messages/_form.html.erb +45 -0
- data/app/views/messages/edit.html.erb +6 -0
- data/app/views/messages/index.html.erb +39 -0
- data/app/views/messages/new.html.erb +5 -0
- data/app/views/messages/show.html.erb +39 -0
- data/config/routes.rb +5 -0
- data/db/migrate/20160428184951_create_messages.rb +15 -0
- data/db/migrate/20160428185721_create_message_headers.rb +12 -0
- data/db/migrate/20160429154207_create_message_attachments.rb +12 -0
- data/lib/oxen_message/engine.rb +4 -0
- data/lib/oxen_message/version.rb +3 -0
- data/lib/oxen_message.rb +4 -0
- data/lib/tasks/oxen_message_tasks.rake +4 -0
- data/test/attachment_1 +1 -0
- data/test/controllers/message_attachments_controller_test.rb +54 -0
- data/test/controllers/message_headers_controller_test.rb +49 -0
- data/test/controllers/messages_controller_test.rb +49 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -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/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +29 -0
- data/test/dummy/config/application.rb +26 -0
- data/test/dummy/config/boot.rb +3 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +41 -0
- data/test/dummy/config/environments/production.rb +79 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +56 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/schema.rb +55 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +1335 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/1n/1nijQk-uoqjv9PWcMamVGfDjr6DDhmf7Mn707I8lqOY.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/5L/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/9E/9EqmKAvAth5B5ntHXaC6kOVHRuWpY9JJ6KPLMz0dJ4A.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/IL/ILglcZ1u_X-oNVqMCBNW_oRenepOWcPa6rlpARAvNnI.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/OI/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/Ol/Oln3MMdzv5_e_UGbwvYHI1HpkXn2d1bgiSmIEdJ2EhI.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/W0/W0fApdYc-Wps2xAzkagbPbSOC1sHgZeYCKowwLPduyU.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/X_/X_Bfd_ZktZLbTzbd502pbEiEXe4nmIo4tHGeSjCYiN0.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/hZ/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/jh/jh3Ykfy1u5Tuz-U1wOZ62zw8mUn13E39U9-fYthx-VA.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/lA/lACzkk4S2IWWkapPVLim00fm58CiN-BPvTjlBi_x9b0.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/ni/ni-Qm8GPg9Yd-VQG0unTzl8-mBJVl_pi3N0EzT8X_6Y.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/pE/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/rq/rqXmTYed3sl4dim5JQVyI2H-8OALJ1OVjLXF4r40msU.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/uk/ukypdbTQN1UvPJ1SKNkXUevo0IoqSBLt6tXpEOhu4sM.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/z-/z-A5FNCaFU9mausna8uCpPF7dT8R-zsa7n-CT-wU2Gc.cache +1 -0
- data/test/fixtures/message_attachments.yml +11 -0
- data/test/fixtures/message_headers.yml +13 -0
- data/test/fixtures/messages.yml +17 -0
- data/test/integration/navigation_test.rb +8 -0
- data/test/models/message_attachment_test.rb +21 -0
- data/test/models/message_header_test.rb +28 -0
- data/test/models/message_test.rb +10 -0
- data/test/oxen_message_test.rb +43 -0
- data/test/support/attachment_2 +1 -0
- data/test/test_helper.rb +34 -0
- metadata +361 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 68663d7b704f03b0a86b3f13115db081301d7cc5
|
|
4
|
+
data.tar.gz: a11e10091a4b19b007bef4accc425a9ddf568f2c
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: c0f6db55e76d067512cfd415b5ae3fd418187dea5a030d9d2fc2ef5ee6025a83e3be0864e7ed798e0f1bb0aaf41dd15de660c9ec23bf35e1a2e145eb1ee1cf22
|
|
7
|
+
data.tar.gz: d1f66404251745e125f9828907abd2d8a2b4a6d402ae0db3941907534ad64214493d454ddaf764c337e2934720d2cb313d9d81ea2765bc4a82c95a7a09ff9fd4
|
data/MIT-LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright 2016 Walther H Diechmann
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Bundler::GemHelper.install_tasks
|
|
2
|
+
begin
|
|
3
|
+
require 'bundler/setup'
|
|
4
|
+
rescue LoadError
|
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
require 'rdoc/task'
|
|
9
|
+
|
|
10
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
|
11
|
+
rdoc.rdoc_dir = 'rdoc'
|
|
12
|
+
rdoc.title = 'OxenMessage'
|
|
13
|
+
rdoc.options << '--line-numbers'
|
|
14
|
+
rdoc.rdoc_files.include('README.rdoc')
|
|
15
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
|
19
|
+
load 'rails/tasks/engine.rake'
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
load 'rails/tasks/statistics.rake'
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
require 'rake/testtask'
|
|
28
|
+
|
|
29
|
+
Rake::TestTask.new(:test) do |t|
|
|
30
|
+
t.libs << 'lib'
|
|
31
|
+
t.libs << 'test'
|
|
32
|
+
t.pattern = 'test/**/*_test.rb'
|
|
33
|
+
t.verbose = false
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
task default: :test
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
body { background-color: #fff; color: #333; }
|
|
2
|
+
|
|
3
|
+
body, p, ol, ul, td {
|
|
4
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
|
5
|
+
font-size: 13px;
|
|
6
|
+
line-height: 18px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
pre {
|
|
10
|
+
background-color: #eee;
|
|
11
|
+
padding: 10px;
|
|
12
|
+
font-size: 11px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
a { color: #000; }
|
|
16
|
+
a:visited { color: #666; }
|
|
17
|
+
a:hover { color: #fff; background-color:#000; }
|
|
18
|
+
|
|
19
|
+
div.field, div.actions {
|
|
20
|
+
margin-bottom: 10px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
#notice {
|
|
24
|
+
color: green;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.field_with_errors {
|
|
28
|
+
padding: 2px;
|
|
29
|
+
background-color: red;
|
|
30
|
+
display: table;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
#error_explanation {
|
|
34
|
+
width: 450px;
|
|
35
|
+
border: 2px solid red;
|
|
36
|
+
padding: 7px;
|
|
37
|
+
padding-bottom: 0;
|
|
38
|
+
margin-bottom: 20px;
|
|
39
|
+
background-color: #f0f0f0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
#error_explanation h2 {
|
|
43
|
+
text-align: left;
|
|
44
|
+
font-weight: bold;
|
|
45
|
+
padding: 5px 5px 5px 15px;
|
|
46
|
+
font-size: 12px;
|
|
47
|
+
margin: -7px;
|
|
48
|
+
margin-bottom: 0px;
|
|
49
|
+
background-color: #c00;
|
|
50
|
+
color: #fff;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
#error_explanation ul li {
|
|
54
|
+
font-size: 12px;
|
|
55
|
+
list-style: square;
|
|
56
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
class MessageAttachmentsController < ApplicationController
|
|
2
|
+
before_action :set_message_attachment, only: [:show, :edit, :update, :destroy]
|
|
3
|
+
|
|
4
|
+
# GET /message_attachments
|
|
5
|
+
def index
|
|
6
|
+
@message_attachments = MessageAttachment.all
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
# GET /message_attachments/1
|
|
10
|
+
def show
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# GET /message_attachments/new
|
|
14
|
+
def new
|
|
15
|
+
@message_attachment = MessageAttachment.new
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# GET /message_attachments/1/edit
|
|
19
|
+
def edit
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# POST /message_attachments
|
|
23
|
+
def create
|
|
24
|
+
@message_attachment = MessageAttachment.new(message_attachment_params)
|
|
25
|
+
|
|
26
|
+
if @message_attachment.save
|
|
27
|
+
redirect_to @message_attachment, notice: 'Message attachment was successfully created.'
|
|
28
|
+
else
|
|
29
|
+
render :new
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# PATCH/PUT /message_attachments/1
|
|
34
|
+
def update
|
|
35
|
+
if @message_attachment.update(message_attachment_params)
|
|
36
|
+
redirect_to @message_attachment, notice: 'Message attachment was successfully updated.'
|
|
37
|
+
else
|
|
38
|
+
render :edit
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# DELETE /message_attachments/1
|
|
43
|
+
def destroy
|
|
44
|
+
@message_attachment.destroy
|
|
45
|
+
redirect_to message_attachments_url, notice: 'Message attachment was successfully destroyed.'
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
private
|
|
49
|
+
# Use callbacks to share common setup or constraints between actions.
|
|
50
|
+
def set_message_attachment
|
|
51
|
+
@message_attachment = MessageAttachment.find(params[:id])
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Only allow a trusted parameter "white list" through.
|
|
55
|
+
def message_attachment_params
|
|
56
|
+
params.require(:message_attachment).permit(:account_id, :message_id, :inline, :file)
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
class MessageHeadersController < ApplicationController
|
|
2
|
+
before_action :set_message_header, only: [:show, :edit, :update, :destroy]
|
|
3
|
+
|
|
4
|
+
# GET /message_headers
|
|
5
|
+
def index
|
|
6
|
+
@message_headers = MessageHeader.all
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
# GET /message_headers/1
|
|
10
|
+
def show
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# GET /message_headers/new
|
|
14
|
+
def new
|
|
15
|
+
@message_header = MessageHeader.new
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# GET /message_headers/1/edit
|
|
19
|
+
def edit
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# POST /message_headers
|
|
23
|
+
def create
|
|
24
|
+
@message_header = MessageHeader.new(message_header_params)
|
|
25
|
+
|
|
26
|
+
if @message_header.save
|
|
27
|
+
redirect_to @message_header, notice: 'Message header was successfully created.'
|
|
28
|
+
else
|
|
29
|
+
render :new
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# PATCH/PUT /message_headers/1
|
|
34
|
+
def update
|
|
35
|
+
if @message_header.update(message_header_params)
|
|
36
|
+
redirect_to @message_header, notice: 'Message header was successfully updated.'
|
|
37
|
+
else
|
|
38
|
+
render :edit
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# DELETE /message_headers/1
|
|
43
|
+
def destroy
|
|
44
|
+
@message_header.destroy
|
|
45
|
+
redirect_to message_headers_url, notice: 'Message header was successfully destroyed.'
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
private
|
|
49
|
+
# Use callbacks to share common setup or constraints between actions.
|
|
50
|
+
def set_message_header
|
|
51
|
+
@message_header = MessageHeader.find(params[:id])
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Only allow a trusted parameter "white list" through.
|
|
55
|
+
def message_header_params
|
|
56
|
+
params.require(:message_header).permit(:account_id, :message_id, :name, :value)
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
class MessagesController < ApplicationController
|
|
2
|
+
before_action :set_message, only: [:show, :edit, :update, :destroy]
|
|
3
|
+
|
|
4
|
+
# GET /messages
|
|
5
|
+
def index
|
|
6
|
+
@messages = Message.all
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
# GET /messages/1
|
|
10
|
+
def show
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# GET /messages/new
|
|
14
|
+
def new
|
|
15
|
+
@message = Message.new
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# GET /messages/1/edit
|
|
19
|
+
def edit
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# POST /messages
|
|
23
|
+
def create
|
|
24
|
+
@message = Message.new(message_params)
|
|
25
|
+
|
|
26
|
+
if @message.save
|
|
27
|
+
redirect_to @message, notice: 'Message was successfully created.'
|
|
28
|
+
else
|
|
29
|
+
render :new
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# PATCH/PUT /messages/1
|
|
34
|
+
def update
|
|
35
|
+
if @message.update(message_params)
|
|
36
|
+
redirect_to @message, notice: 'Message was successfully updated.'
|
|
37
|
+
else
|
|
38
|
+
render :edit
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# DELETE /messages/1
|
|
43
|
+
def destroy
|
|
44
|
+
@message.destroy
|
|
45
|
+
redirect_to messages_url, notice: 'Message was successfully destroyed.'
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
private
|
|
49
|
+
# Use callbacks to share common setup or constraints between actions.
|
|
50
|
+
def set_message
|
|
51
|
+
@message = Message.find(params[:id])
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Only allow a trusted parameter "white list" through.
|
|
55
|
+
def message_params
|
|
56
|
+
params.require(:message).permit(:account_id, :template_id, :state, :flag, :incoming, :subject, :body)
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
class Message < AbstractResource
|
|
2
|
+
belongs_to :account
|
|
3
|
+
belongs_to :template
|
|
4
|
+
has_many :message_headers, dependent: :destroy
|
|
5
|
+
has_many :message_attachments, dependent: :destroy
|
|
6
|
+
|
|
7
|
+
attr_accessor :from, :cc, :bcc
|
|
8
|
+
|
|
9
|
+
def headers key
|
|
10
|
+
message_headers.where( name: key).first.value
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def set_headers key, val
|
|
14
|
+
f=message_headers.where(name: key).first || MessageHeader.new( message: self, key.to_sym => val)
|
|
15
|
+
f.value=val
|
|
16
|
+
f.save
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# getters for named headers
|
|
20
|
+
def from
|
|
21
|
+
headers "from"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def cc
|
|
25
|
+
headers "cc"
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def bcc
|
|
29
|
+
headers "bcc"
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# setters for named headers
|
|
33
|
+
def from=val
|
|
34
|
+
set_headers 'from', val
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def cc=val
|
|
38
|
+
set_headers 'cc', val
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def bcc=val
|
|
42
|
+
set_headers 'bcc', val
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
class MessageAttachment < ActiveRecord::Base
|
|
2
|
+
belongs_to :account
|
|
3
|
+
belongs_to :message
|
|
4
|
+
|
|
5
|
+
validates_associated :message
|
|
6
|
+
validate :file_readability
|
|
7
|
+
|
|
8
|
+
def file_readability
|
|
9
|
+
if file.blank? or !File.exist?(file) or !File.read(file)
|
|
10
|
+
errors.add(:file, "does not exist?!")
|
|
11
|
+
end
|
|
12
|
+
true
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
class MessageHeader < AbstractResource
|
|
2
|
+
belongs_to :account
|
|
3
|
+
belongs_to :message
|
|
4
|
+
|
|
5
|
+
attr_accessor :from, :cc, :bcc
|
|
6
|
+
|
|
7
|
+
def named_header key,val
|
|
8
|
+
self.name=key
|
|
9
|
+
self.value=val
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def from
|
|
13
|
+
self.value
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def cc
|
|
17
|
+
self.value
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def bcc
|
|
21
|
+
self.value
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def from= val
|
|
25
|
+
named_header 'from', val
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def cc= val
|
|
29
|
+
named_header 'cc', val
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def bcc= val
|
|
33
|
+
named_header 'bcc', val
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<%= form_for(@message_attachment) do |f| %>
|
|
2
|
+
<% if @message_attachment.errors.any? %>
|
|
3
|
+
<div id="error_explanation">
|
|
4
|
+
<h2><%= pluralize(@message_attachment.errors.count, "error") %> prohibited this message_attachment from being saved:</h2>
|
|
5
|
+
|
|
6
|
+
<ul>
|
|
7
|
+
<% @message_attachment.errors.full_messages.each do |message| %>
|
|
8
|
+
<li><%= message %></li>
|
|
9
|
+
<% end %>
|
|
10
|
+
</ul>
|
|
11
|
+
</div>
|
|
12
|
+
<% end %>
|
|
13
|
+
|
|
14
|
+
<div class="field">
|
|
15
|
+
<%= f.label :account_id %><br>
|
|
16
|
+
<%= f.text_field :account_id %>
|
|
17
|
+
</div>
|
|
18
|
+
<div class="field">
|
|
19
|
+
<%= f.label :message_id %><br>
|
|
20
|
+
<%= f.text_field :message_id %>
|
|
21
|
+
</div>
|
|
22
|
+
<div class="field">
|
|
23
|
+
<%= f.label :inline %><br>
|
|
24
|
+
<%= f.check_box :inline %>
|
|
25
|
+
</div>
|
|
26
|
+
<div class="field">
|
|
27
|
+
<%= f.label :file %><br>
|
|
28
|
+
<%= f.text_field :file %>
|
|
29
|
+
</div>
|
|
30
|
+
<div class="actions">
|
|
31
|
+
<%= f.submit %>
|
|
32
|
+
</div>
|
|
33
|
+
<% end %>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
|
2
|
+
|
|
3
|
+
<h1>Listing Message Attachments</h1>
|
|
4
|
+
|
|
5
|
+
<table>
|
|
6
|
+
<thead>
|
|
7
|
+
<tr>
|
|
8
|
+
<th>Account</th>
|
|
9
|
+
<th>Message</th>
|
|
10
|
+
<th>Inline</th>
|
|
11
|
+
<th>File</th>
|
|
12
|
+
<th colspan="3"></th>
|
|
13
|
+
</tr>
|
|
14
|
+
</thead>
|
|
15
|
+
|
|
16
|
+
<tbody>
|
|
17
|
+
<% @message_attachments.each do |message_attachment| %>
|
|
18
|
+
<tr>
|
|
19
|
+
<td><%= message_attachment.account %></td>
|
|
20
|
+
<td><%= message_attachment.message %></td>
|
|
21
|
+
<td><%= message_attachment.inline %></td>
|
|
22
|
+
<td><%= message_attachment.file %></td>
|
|
23
|
+
<td><%= link_to 'Show', message_attachment %></td>
|
|
24
|
+
<td><%= link_to 'Edit', edit_message_attachment_path(message_attachment) %></td>
|
|
25
|
+
<td><%= link_to 'Destroy', message_attachment, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
|
26
|
+
</tr>
|
|
27
|
+
<% end %>
|
|
28
|
+
</tbody>
|
|
29
|
+
</table>
|
|
30
|
+
|
|
31
|
+
<br>
|
|
32
|
+
|
|
33
|
+
<%= link_to 'New Message attachment', new_message_attachment_path %>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
|
2
|
+
|
|
3
|
+
<p>
|
|
4
|
+
<strong>Account:</strong>
|
|
5
|
+
<%= @message_attachment.account %>
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
<p>
|
|
9
|
+
<strong>Message:</strong>
|
|
10
|
+
<%= @message_attachment.message %>
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
<p>
|
|
14
|
+
<strong>Inline:</strong>
|
|
15
|
+
<%= @message_attachment.inline %>
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
<p>
|
|
19
|
+
<strong>File:</strong>
|
|
20
|
+
<%= @message_attachment.file %>
|
|
21
|
+
</p>
|
|
22
|
+
|
|
23
|
+
<%= link_to 'Edit', edit_message_attachment_path(@message_attachment) %> |
|
|
24
|
+
<%= link_to 'Back', message_attachments_path %>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<%= form_for(@message_header) do |f| %>
|
|
2
|
+
<% if @message_header.errors.any? %>
|
|
3
|
+
<div id="error_explanation">
|
|
4
|
+
<h2><%= pluralize(@message_header.errors.count, "error") %> prohibited this message_header from being saved:</h2>
|
|
5
|
+
|
|
6
|
+
<ul>
|
|
7
|
+
<% @message_header.errors.full_messages.each do |message| %>
|
|
8
|
+
<li><%= message %></li>
|
|
9
|
+
<% end %>
|
|
10
|
+
</ul>
|
|
11
|
+
</div>
|
|
12
|
+
<% end %>
|
|
13
|
+
|
|
14
|
+
<div class="field">
|
|
15
|
+
<%= f.label :account_id %><br>
|
|
16
|
+
<%= f.text_field :account_id %>
|
|
17
|
+
</div>
|
|
18
|
+
<div class="field">
|
|
19
|
+
<%= f.label :message_id %><br>
|
|
20
|
+
<%= f.text_field :message_id %>
|
|
21
|
+
</div>
|
|
22
|
+
<div class="field">
|
|
23
|
+
<%= f.label :name %><br>
|
|
24
|
+
<%= f.text_field :name %>
|
|
25
|
+
</div>
|
|
26
|
+
<div class="field">
|
|
27
|
+
<%= f.label :value %><br>
|
|
28
|
+
<%= f.text_area :value %>
|
|
29
|
+
</div>
|
|
30
|
+
<div class="actions">
|
|
31
|
+
<%= f.submit %>
|
|
32
|
+
</div>
|
|
33
|
+
<% end %>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
|
2
|
+
|
|
3
|
+
<h1>Listing Message Headers</h1>
|
|
4
|
+
|
|
5
|
+
<table>
|
|
6
|
+
<thead>
|
|
7
|
+
<tr>
|
|
8
|
+
<th>Account</th>
|
|
9
|
+
<th>Message</th>
|
|
10
|
+
<th>Name</th>
|
|
11
|
+
<th>Value</th>
|
|
12
|
+
<th colspan="3"></th>
|
|
13
|
+
</tr>
|
|
14
|
+
</thead>
|
|
15
|
+
|
|
16
|
+
<tbody>
|
|
17
|
+
<% @message_headers.each do |message_header| %>
|
|
18
|
+
<tr>
|
|
19
|
+
<td><%= message_header.account %></td>
|
|
20
|
+
<td><%= message_header.message %></td>
|
|
21
|
+
<td><%= message_header.name %></td>
|
|
22
|
+
<td><%= message_header.value %></td>
|
|
23
|
+
<td><%= link_to 'Show', message_header %></td>
|
|
24
|
+
<td><%= link_to 'Edit', edit_message_header_path(message_header) %></td>
|
|
25
|
+
<td><%= link_to 'Destroy', message_header, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
|
26
|
+
</tr>
|
|
27
|
+
<% end %>
|
|
28
|
+
</tbody>
|
|
29
|
+
</table>
|
|
30
|
+
|
|
31
|
+
<br>
|
|
32
|
+
|
|
33
|
+
<%= link_to 'New Message header', new_message_header_path %>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
|
2
|
+
|
|
3
|
+
<p>
|
|
4
|
+
<strong>Account:</strong>
|
|
5
|
+
<%= @message_header.account %>
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
<p>
|
|
9
|
+
<strong>Message:</strong>
|
|
10
|
+
<%= @message_header.message %>
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
<p>
|
|
14
|
+
<strong>Name:</strong>
|
|
15
|
+
<%= @message_header.name %>
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
<p>
|
|
19
|
+
<strong>Value:</strong>
|
|
20
|
+
<%= @message_header.value %>
|
|
21
|
+
</p>
|
|
22
|
+
|
|
23
|
+
<%= link_to 'Edit', edit_message_header_path(@message_header) %> |
|
|
24
|
+
<%= link_to 'Back', message_headers_path %>
|