draft_box 0.0.3 → 0.0.4
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 +4 -4
- data/app/controllers/draft_box/application_controller.rb +5 -0
- data/app/controllers/draft_box/attachments_controller.rb +10 -0
- data/app/controllers/draft_box/emails_controller.rb +31 -0
- data/app/models/draft_box/attachment.rb +7 -0
- data/app/models/draft_box/email.rb +14 -0
- data/config/routes.rb +7 -0
- data/lib/draft_box/version.rb +1 -1
- metadata +9 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df1480e5f5f34ba3e74ca9d1da1126ffe5de868a99c1e85dbfc50ef78489446f
|
4
|
+
data.tar.gz: 566c5480ab8a6367deee4090e30e908b9abe0b6116290e77469c17315874be67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba24288561491471a5baf1d346a5033c50515479b08a496195c9eaaf40245ca318268f0854200e406a3943af06438b16c970d8dea2ea794757de1fd1e1344536
|
7
|
+
data.tar.gz: caf7c0b06cdc1a2dfdfa6adac128981b27b54954cbeebbc6f5715ec1f65528ac9393acacbd44545b7d8db56d98e698dbc6ff36f2d83a9496f70b082812494b44
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module DraftBox
|
2
|
+
class AttachmentsController < ApplicationController
|
3
|
+
def show
|
4
|
+
@email = DraftBox::Email.find(params[:email_id])
|
5
|
+
@attachment = @email.attachments.find(params[:id])
|
6
|
+
|
7
|
+
send_data @attachment.data, filename: @attachment.filename, type: @attachment.content_type
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
unless Rails.respond_to?(:autoloaders) && Rails.autoloaders.zeitwerk_enabled?
|
2
|
+
require_dependency 'draft_box/application_controller'
|
3
|
+
end
|
4
|
+
|
5
|
+
module DraftBox
|
6
|
+
class EmailsController < ApplicationController
|
7
|
+
before_action :set_emails, only: [:index, :show]
|
8
|
+
|
9
|
+
def index; end
|
10
|
+
|
11
|
+
def show
|
12
|
+
@email = DraftBox::Email.find(params[:id])
|
13
|
+
end
|
14
|
+
|
15
|
+
def destroy
|
16
|
+
DraftBox::Email.find(params[:id]).destroy!
|
17
|
+
redirect_to draft_box.emails_path
|
18
|
+
end
|
19
|
+
|
20
|
+
def destroy_all
|
21
|
+
DraftBox::Email.destroy_all
|
22
|
+
redirect_to draft_box.emails_path
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def set_emails
|
28
|
+
@emails = DraftBox::Email.includes(:attachments).order(created_at: :desc)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module DraftBox
|
2
|
+
class Email < ApplicationRecord
|
3
|
+
self.table_name = 'draft_box_emails'
|
4
|
+
|
5
|
+
has_many :attachments, class_name: 'DraftBox::Attachment', dependent: :destroy, foreign_key: :draft_box_email_id
|
6
|
+
|
7
|
+
if connection.class.to_s.match?(/mysql/i)
|
8
|
+
serialize :recipients, coder: JSON
|
9
|
+
serialize :carbon_copies, coder: JSON
|
10
|
+
serialize :blind_copies, coder: JSON
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
data/config/routes.rb
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
DraftBox::Engine.routes.draw do
|
2
|
+
get '/', to: 'emails#index', as: :emails
|
3
|
+
get '/:id', to: 'emails#show', as: :email
|
4
|
+
delete '/', to: 'emails#destroy_all', as: :destroy_all
|
5
|
+
delete '/:id', to: 'emails#destroy', as: :destroy
|
6
|
+
get '/:email_id/attachments/:id', to: 'attachments#show', as: :attachment
|
7
|
+
end
|
data/lib/draft_box/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: draft_box
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paweł Dąbrowski
|
@@ -17,6 +17,12 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
+
- app/controllers/draft_box/application_controller.rb
|
21
|
+
- app/controllers/draft_box/attachments_controller.rb
|
22
|
+
- app/controllers/draft_box/emails_controller.rb
|
23
|
+
- app/models/draft_box/attachment.rb
|
24
|
+
- app/models/draft_box/email.rb
|
25
|
+
- config/routes.rb
|
20
26
|
- lib/draft_box.rb
|
21
27
|
- lib/draft_box/delivery_method.rb
|
22
28
|
- lib/draft_box/engine.rb
|
@@ -24,7 +30,7 @@ files:
|
|
24
30
|
- lib/generators/draft_box/install_generator.rb
|
25
31
|
- lib/generators/draft_box/templates/attachments_migration.rb
|
26
32
|
- lib/generators/draft_box/templates/emails_migration.rb
|
27
|
-
homepage:
|
33
|
+
homepage: https://github.com/paweldabrowski/draft_box
|
28
34
|
licenses: []
|
29
35
|
metadata: {}
|
30
36
|
post_install_message:
|
@@ -42,7 +48,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
42
48
|
- !ruby/object:Gem::Version
|
43
49
|
version: '0'
|
44
50
|
requirements: []
|
45
|
-
rubygems_version: 3.
|
51
|
+
rubygems_version: 3.2.32
|
46
52
|
signing_key:
|
47
53
|
specification_version: 4
|
48
54
|
summary: A web interface for browsing Ruby on Rails sent emails with support for distributed
|