First commit
This commit is contained in:
commit
5018fc4fe6
1
.browserslistrc
Normal file
1
.browserslistrc
Normal file
@ -0,0 +1 @@
|
||||
defaults
|
38
.gitignore
vendored
Normal file
38
.gitignore
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
|
||||
#
|
||||
# If you find yourself ignoring temporary files generated by your text editor
|
||||
# or operating system, you probably want to add a global ignore instead:
|
||||
# git config --global core.excludesfile '~/.gitignore_global'
|
||||
|
||||
# Ignore bundler config.
|
||||
/.bundle
|
||||
|
||||
# Ignore all logfiles and tempfiles.
|
||||
/log/*
|
||||
/tmp/*
|
||||
!/log/.keep
|
||||
!/tmp/.keep
|
||||
|
||||
# Ignore pidfiles, but keep the directory.
|
||||
/tmp/pids/*
|
||||
!/tmp/pids/
|
||||
!/tmp/pids/.keep
|
||||
|
||||
# Ignore uploaded files in development.
|
||||
/storage/*
|
||||
!/storage/.keep
|
||||
|
||||
/public/assets
|
||||
.byebug_history
|
||||
|
||||
# Ignore master key for decrypting credentials and more.
|
||||
/config/master.key
|
||||
|
||||
/public/packs
|
||||
/public/packs-test
|
||||
/node_modules
|
||||
/yarn-error.log
|
||||
yarn-debug.log*
|
||||
.yarn-integrity
|
||||
|
||||
config/database.yml
|
1
.ruby-version
Normal file
1
.ruby-version
Normal file
@ -0,0 +1 @@
|
||||
ruby-2.7.2
|
BIN
.screenshots/PostDoc-Screenshot.png
Normal file
BIN
.screenshots/PostDoc-Screenshot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 46 KiB |
63
Gemfile
Normal file
63
Gemfile
Normal file
@ -0,0 +1,63 @@
|
||||
source 'https://rubygems.org'
|
||||
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
||||
|
||||
ruby '2.7.2'
|
||||
|
||||
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
||||
gem 'rails', '~> 6.0.3', '>= 6.0.3.4'
|
||||
# Use postgresql as the database for Active Record
|
||||
gem 'pg', '>= 0.18', '< 2.0'
|
||||
# Use Puma as the app server
|
||||
gem 'puma', '~> 4.1'
|
||||
# Use SCSS for stylesheets
|
||||
gem 'sass-rails', '>= 6'
|
||||
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
|
||||
gem 'webpacker', '~> 4.0'
|
||||
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
|
||||
gem 'turbolinks', '~> 5'
|
||||
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
||||
gem 'jbuilder', '~> 2.7'
|
||||
# Use Redis adapter to run Action Cable in production
|
||||
# gem 'redis', '~> 4.0'
|
||||
# Use Active Model has_secure_password
|
||||
# gem 'bcrypt', '~> 3.1.7'
|
||||
|
||||
# Use Active Storage variant
|
||||
# gem 'image_processing', '~> 1.2'
|
||||
|
||||
# Reduces boot times through caching; required in config/boot.rb
|
||||
gem 'bootsnap', '>= 1.4.2', require: false
|
||||
|
||||
# HTTP client
|
||||
gem 'faraday'
|
||||
|
||||
# Ruby Handlebars implementation
|
||||
gem 'ruby-handlebars'
|
||||
|
||||
# New view components
|
||||
gem "view_component", require: "view_component/engine"
|
||||
|
||||
group :development, :test do
|
||||
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
||||
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
|
||||
end
|
||||
|
||||
group :development do
|
||||
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
|
||||
gem 'web-console', '>= 3.3.0'
|
||||
gem 'listen', '~> 3.2'
|
||||
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
|
||||
gem 'spring'
|
||||
gem 'spring-watcher-listen', '~> 2.0.0'
|
||||
end
|
||||
|
||||
group :test do
|
||||
# Adds support for Capybara system testing and selenium driver
|
||||
gem 'capybara', '>= 2.15'
|
||||
gem 'selenium-webdriver'
|
||||
# Easy installation and use of web drivers to run system tests with browsers
|
||||
gem 'webdrivers'
|
||||
end
|
||||
|
||||
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
||||
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
236
Gemfile.lock
Normal file
236
Gemfile.lock
Normal file
@ -0,0 +1,236 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actioncable (6.0.3.4)
|
||||
actionpack (= 6.0.3.4)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (>= 0.6.1)
|
||||
actionmailbox (6.0.3.4)
|
||||
actionpack (= 6.0.3.4)
|
||||
activejob (= 6.0.3.4)
|
||||
activerecord (= 6.0.3.4)
|
||||
activestorage (= 6.0.3.4)
|
||||
activesupport (= 6.0.3.4)
|
||||
mail (>= 2.7.1)
|
||||
actionmailer (6.0.3.4)
|
||||
actionpack (= 6.0.3.4)
|
||||
actionview (= 6.0.3.4)
|
||||
activejob (= 6.0.3.4)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
actionpack (6.0.3.4)
|
||||
actionview (= 6.0.3.4)
|
||||
activesupport (= 6.0.3.4)
|
||||
rack (~> 2.0, >= 2.0.8)
|
||||
rack-test (>= 0.6.3)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
||||
actiontext (6.0.3.4)
|
||||
actionpack (= 6.0.3.4)
|
||||
activerecord (= 6.0.3.4)
|
||||
activestorage (= 6.0.3.4)
|
||||
activesupport (= 6.0.3.4)
|
||||
nokogiri (>= 1.8.5)
|
||||
actionview (6.0.3.4)
|
||||
activesupport (= 6.0.3.4)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
||||
activejob (6.0.3.4)
|
||||
activesupport (= 6.0.3.4)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (6.0.3.4)
|
||||
activesupport (= 6.0.3.4)
|
||||
activerecord (6.0.3.4)
|
||||
activemodel (= 6.0.3.4)
|
||||
activesupport (= 6.0.3.4)
|
||||
activestorage (6.0.3.4)
|
||||
actionpack (= 6.0.3.4)
|
||||
activejob (= 6.0.3.4)
|
||||
activerecord (= 6.0.3.4)
|
||||
marcel (~> 0.3.1)
|
||||
activesupport (6.0.3.4)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
minitest (~> 5.1)
|
||||
tzinfo (~> 1.1)
|
||||
zeitwerk (~> 2.2, >= 2.2.2)
|
||||
addressable (2.7.0)
|
||||
public_suffix (>= 2.0.2, < 5.0)
|
||||
bindex (0.8.1)
|
||||
bootsnap (1.5.1)
|
||||
msgpack (~> 1.0)
|
||||
builder (3.2.4)
|
||||
byebug (11.1.3)
|
||||
capybara (3.34.0)
|
||||
addressable
|
||||
mini_mime (>= 0.1.3)
|
||||
nokogiri (~> 1.8)
|
||||
rack (>= 1.6.0)
|
||||
rack-test (>= 0.6.3)
|
||||
regexp_parser (~> 1.5)
|
||||
xpath (~> 3.2)
|
||||
childprocess (3.0.0)
|
||||
concurrent-ruby (1.1.7)
|
||||
crass (1.0.6)
|
||||
erubi (1.10.0)
|
||||
faraday (1.1.0)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
ruby2_keywords
|
||||
ffi (1.13.1)
|
||||
globalid (0.4.2)
|
||||
activesupport (>= 4.2.0)
|
||||
i18n (1.8.5)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jbuilder (2.10.1)
|
||||
activesupport (>= 5.0.0)
|
||||
listen (3.3.3)
|
||||
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||
rb-inotify (~> 0.9, >= 0.9.10)
|
||||
loofah (2.8.0)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.5.9)
|
||||
mail (2.7.1)
|
||||
mini_mime (>= 0.1.1)
|
||||
marcel (0.3.3)
|
||||
mimemagic (~> 0.3.2)
|
||||
method_source (1.0.0)
|
||||
mimemagic (0.3.5)
|
||||
mini_mime (1.0.2)
|
||||
mini_portile2 (2.4.0)
|
||||
minitest (5.14.2)
|
||||
msgpack (1.3.3)
|
||||
multipart-post (2.1.1)
|
||||
nio4r (2.5.4)
|
||||
nokogiri (1.10.10)
|
||||
mini_portile2 (~> 2.4.0)
|
||||
parslet (1.8.2)
|
||||
pg (1.2.3)
|
||||
public_suffix (4.0.6)
|
||||
puma (4.3.7)
|
||||
nio4r (~> 2.0)
|
||||
rack (2.2.3)
|
||||
rack-proxy (0.6.5)
|
||||
rack
|
||||
rack-test (1.1.0)
|
||||
rack (>= 1.0, < 3)
|
||||
rails (6.0.3.4)
|
||||
actioncable (= 6.0.3.4)
|
||||
actionmailbox (= 6.0.3.4)
|
||||
actionmailer (= 6.0.3.4)
|
||||
actionpack (= 6.0.3.4)
|
||||
actiontext (= 6.0.3.4)
|
||||
actionview (= 6.0.3.4)
|
||||
activejob (= 6.0.3.4)
|
||||
activemodel (= 6.0.3.4)
|
||||
activerecord (= 6.0.3.4)
|
||||
activestorage (= 6.0.3.4)
|
||||
activesupport (= 6.0.3.4)
|
||||
bundler (>= 1.3.0)
|
||||
railties (= 6.0.3.4)
|
||||
sprockets-rails (>= 2.0.0)
|
||||
rails-dom-testing (2.0.3)
|
||||
activesupport (>= 4.2.0)
|
||||
nokogiri (>= 1.6)
|
||||
rails-html-sanitizer (1.3.0)
|
||||
loofah (~> 2.3)
|
||||
railties (6.0.3.4)
|
||||
actionpack (= 6.0.3.4)
|
||||
activesupport (= 6.0.3.4)
|
||||
method_source
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.20.3, < 2.0)
|
||||
rake (13.0.1)
|
||||
rb-fsevent (0.10.4)
|
||||
rb-inotify (0.10.1)
|
||||
ffi (~> 1.0)
|
||||
regexp_parser (1.8.2)
|
||||
ruby-handlebars (0.4.0)
|
||||
parslet (~> 1.6, >= 1.6.2)
|
||||
ruby2_keywords (0.0.2)
|
||||
rubyzip (2.3.0)
|
||||
sass-rails (6.0.0)
|
||||
sassc-rails (~> 2.1, >= 2.1.1)
|
||||
sassc (2.4.0)
|
||||
ffi (~> 1.9)
|
||||
sassc-rails (2.1.2)
|
||||
railties (>= 4.0.0)
|
||||
sassc (>= 2.0)
|
||||
sprockets (> 3.0)
|
||||
sprockets-rails
|
||||
tilt
|
||||
selenium-webdriver (3.142.7)
|
||||
childprocess (>= 0.5, < 4.0)
|
||||
rubyzip (>= 1.2.2)
|
||||
spring (2.1.1)
|
||||
spring-watcher-listen (2.0.1)
|
||||
listen (>= 2.7, < 4.0)
|
||||
spring (>= 1.2, < 3.0)
|
||||
sprockets (4.0.2)
|
||||
concurrent-ruby (~> 1.0)
|
||||
rack (> 1, < 3)
|
||||
sprockets-rails (3.2.2)
|
||||
actionpack (>= 4.0)
|
||||
activesupport (>= 4.0)
|
||||
sprockets (>= 3.0.0)
|
||||
thor (1.0.1)
|
||||
thread_safe (0.3.6)
|
||||
tilt (2.0.10)
|
||||
turbolinks (5.2.1)
|
||||
turbolinks-source (~> 5.2)
|
||||
turbolinks-source (5.2.0)
|
||||
tzinfo (1.2.8)
|
||||
thread_safe (~> 0.1)
|
||||
view_component (2.22.1)
|
||||
activesupport (>= 5.0.0, < 7.0)
|
||||
web-console (4.1.0)
|
||||
actionview (>= 6.0.0)
|
||||
activemodel (>= 6.0.0)
|
||||
bindex (>= 0.4.0)
|
||||
railties (>= 6.0.0)
|
||||
webdrivers (4.4.1)
|
||||
nokogiri (~> 1.6)
|
||||
rubyzip (>= 1.3.0)
|
||||
selenium-webdriver (>= 3.0, < 4.0)
|
||||
webpacker (4.3.0)
|
||||
activesupport (>= 4.2)
|
||||
rack-proxy (>= 0.6.1)
|
||||
railties (>= 4.2)
|
||||
websocket-driver (0.7.3)
|
||||
websocket-extensions (>= 0.1.0)
|
||||
websocket-extensions (0.1.5)
|
||||
xpath (3.2.0)
|
||||
nokogiri (~> 1.8)
|
||||
zeitwerk (2.4.2)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
bootsnap (>= 1.4.2)
|
||||
byebug
|
||||
capybara (>= 2.15)
|
||||
faraday
|
||||
jbuilder (~> 2.7)
|
||||
listen (~> 3.2)
|
||||
pg (>= 0.18, < 2.0)
|
||||
puma (~> 4.1)
|
||||
rails (~> 6.0.3, >= 6.0.3.4)
|
||||
ruby-handlebars
|
||||
sass-rails (>= 6)
|
||||
selenium-webdriver
|
||||
spring
|
||||
spring-watcher-listen (~> 2.0.0)
|
||||
turbolinks (~> 5)
|
||||
tzinfo-data
|
||||
view_component
|
||||
web-console (>= 3.3.0)
|
||||
webdrivers
|
||||
webpacker (~> 4.0)
|
||||
|
||||
RUBY VERSION
|
||||
ruby 2.7.2p137
|
||||
|
||||
BUNDLED WITH
|
||||
2.1.4
|
661
LICENSE.txt
Normal file
661
LICENSE.txt
Normal file
@ -0,0 +1,661 @@
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 2020 Tim Kächele
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
90
README.md
Normal file
90
README.md
Normal file
@ -0,0 +1,90 @@
|
||||
# PostDoc
|
||||
|
||||
PostDoc is a sendgrid mock api server that allows you to test your dynamic
|
||||
sendgrid templates in development or staging environments written in Ruby on Rails.
|
||||
|
||||
## What it does?
|
||||
|
||||
It provides you with a mock api for sending emails and an accompanying web interface
|
||||
to inspect the sent emails.
|
||||
|
||||
It validates the request payload with the sendgrid sandbox mode to check
|
||||
that all inputs are correct and then renders your html/plain text handlebars
|
||||
templates with the provided personalizations.
|
||||
|
||||
## What you need?
|
||||
|
||||
- a valid sendgrid api token
|
||||
|
||||
## Configuration
|
||||
|
||||
PostDoc generates a mock sendgrid api token for you, that you have to pass to
|
||||
your sendgrid api client library, additionally you have to override the host with
|
||||
the host where you run postdoc.
|
||||
|
||||
In ruby that looks something like this:
|
||||
|
||||
```ruby
|
||||
SendGrid::API.new(api_key: 'YOUR_POSTDOC_MOCK_TOKEN',
|
||||
host: 'POSTDOC_HOST')
|
||||
```
|
||||
|
||||
## Dependencies
|
||||
|
||||
- Ruby Version (MRI) 2.7.2
|
||||
- Postgresql 12.3
|
||||
- Node
|
||||
|
||||
## Setup
|
||||
|
||||
Install the correct ruby version
|
||||
|
||||
```shell
|
||||
$ rvm install 2.7.2
|
||||
```
|
||||
|
||||
Install the ruby dependencies
|
||||
|
||||
```shell
|
||||
$ bundle install --jobs=64
|
||||
```
|
||||
|
||||
Create your database file and fill in your postgres username/password
|
||||
|
||||
```shell
|
||||
$ cp config/database.yml.example config/database.yml
|
||||
```
|
||||
|
||||
Setup the database
|
||||
|
||||
```shell
|
||||
$ bundle exec rails db:setup
|
||||
```
|
||||
|
||||
Install the frontend dependencies
|
||||
|
||||
```shell
|
||||
$ yarn install --check-files
|
||||
```
|
||||
|
||||
Start a server
|
||||
|
||||
```shell
|
||||
$ bundle exec rails server
|
||||
```
|
||||
|
||||
## Credentials
|
||||
|
||||
The username/password for accessing the user interface in development mode
|
||||
are:
|
||||
|
||||
```txt
|
||||
username: postdoc
|
||||
password: postdoc
|
||||
```
|
||||
|
||||
You can override them in `config/secrets`.
|
||||
|
||||
## Screenshots
|
||||
|
||||
![PostDoc-Screenshot](./.screenshots/PostDoc-Screenshot.png)
|
6
Rakefile
Normal file
6
Rakefile
Normal file
@ -0,0 +1,6 @@
|
||||
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
||||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
||||
|
||||
require_relative 'config/application'
|
||||
|
||||
Rails.application.load_tasks
|
2
app/assets/config/manifest.js
Normal file
2
app/assets/config/manifest.js
Normal file
@ -0,0 +1,2 @@
|
||||
//= link_tree ../images
|
||||
//= link_directory ../stylesheets .css
|
0
app/assets/images/.keep
Normal file
0
app/assets/images/.keep
Normal file
4
app/channels/application_cable/channel.rb
Normal file
4
app/channels/application_cable/channel.rb
Normal file
@ -0,0 +1,4 @@
|
||||
module ApplicationCable
|
||||
class Channel < ActionCable::Channel::Base
|
||||
end
|
||||
end
|
4
app/channels/application_cable/connection.rb
Normal file
4
app/channels/application_cable/connection.rb
Normal file
@ -0,0 +1,4 @@
|
||||
module ApplicationCable
|
||||
class Connection < ActionCable::Connection::Base
|
||||
end
|
||||
end
|
11
app/components/email_list_entry_component.rb
Normal file
11
app/components/email_list_entry_component.rb
Normal file
@ -0,0 +1,11 @@
|
||||
class EmailListEntryComponent < ViewComponent::Base
|
||||
attr_reader :email
|
||||
def initialize(email:)
|
||||
@email = email
|
||||
end
|
||||
|
||||
def email_modifier_class
|
||||
return 'email--read' if email.read?
|
||||
'email--unread'
|
||||
end
|
||||
end
|
@ -0,0 +1,10 @@
|
||||
<%= link_to email_path(email), class: "no-link-appearance" do %>
|
||||
<article class="email <%= email_modifier_class %>">
|
||||
<span class="email__from">
|
||||
<%= email.from.email %>
|
||||
</span>
|
||||
<span class="email__to"><%= email.to.map(&:email).join(",") %></span>
|
||||
<b class="email__subject"><%= email.subject %></b>
|
||||
<span class="email__created-at"><%= l(email.created_at, format: :short) %></span>
|
||||
</article>
|
||||
<% end %>
|
12
app/components/modal_component.rb
Normal file
12
app/components/modal_component.rb
Normal file
@ -0,0 +1,12 @@
|
||||
class ModalComponent < ViewComponent::Base
|
||||
with_content_areas :body, :footer
|
||||
attr_reader :title
|
||||
|
||||
def initialize(title: nil)
|
||||
@title = title
|
||||
end
|
||||
|
||||
def has_title?
|
||||
title.present?
|
||||
end
|
||||
end
|
18
app/components/modal_component/modal_component.html.erb
Normal file
18
app/components/modal_component/modal_component.html.erb
Normal file
@ -0,0 +1,18 @@
|
||||
<div class="modal"
|
||||
data-controller="modal"
|
||||
data-modal-target="modal"
|
||||
data-action="click->modal#closeClickedOutside mousedown->modal#trackMouseDown mouseup->modal#trackMouseUp ajax:error->modal#error" >
|
||||
<div class="modal__popup">
|
||||
<% if has_title? %>
|
||||
<div class="modal__header">
|
||||
<%= title %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="modal__body">
|
||||
<%= body %>
|
||||
</div>
|
||||
<div class="modal__footer">
|
||||
<%= footer %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
21
app/controllers/api/base_controller.rb
Normal file
21
app/controllers/api/base_controller.rb
Normal file
@ -0,0 +1,21 @@
|
||||
module Api
|
||||
class BaseController < ActionController::Base
|
||||
before_action :authenticate_mailbox
|
||||
protect_from_forgery with: :null_session
|
||||
|
||||
def require_mailbox
|
||||
end
|
||||
|
||||
def authenticate_mailbox
|
||||
authenticate_or_request_with_http_token do |token, _options|
|
||||
puts token
|
||||
Mailbox.find_by(sendgrid_mock_api_token: token)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def current_mailbox
|
||||
@mailbox ||= authenticate_mailbox
|
||||
end
|
||||
end
|
||||
end
|
26
app/controllers/api/emails_controller.rb
Normal file
26
app/controllers/api/emails_controller.rb
Normal file
@ -0,0 +1,26 @@
|
||||
module Api
|
||||
class EmailsController < BaseController
|
||||
def create
|
||||
email_payload = request.request_parameters
|
||||
begin
|
||||
CreateEmail.new(current_mailbox).call(email_payload)
|
||||
rescue CreateEmail::InvalidRequest => exception
|
||||
request_result = exception.request_result
|
||||
request_body = JSON.parse(request_result.body)
|
||||
render(json: request_body, status: request_result.status)
|
||||
rescue CreateEmail::InvalidTemplate => _e
|
||||
response_payload = {
|
||||
'errors' => [
|
||||
{
|
||||
'message' => 'Could not find template with given id.',
|
||||
'field' => 'template_id',
|
||||
'help' => nil
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
render(json: response_payload, status: 400)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
15
app/controllers/application_controller.rb
Normal file
15
app/controllers/application_controller.rb
Normal file
@ -0,0 +1,15 @@
|
||||
class ApplicationController < ActionController::Base
|
||||
http_basic_authenticate_with(
|
||||
name: Rails.application.secrets.username,
|
||||
password: Rails.application.secrets.password)
|
||||
|
||||
helper_method :mailboxes, :current_mailbox
|
||||
|
||||
def mailboxes
|
||||
@mailboxes ||= Mailbox.all.order(name: :asc)
|
||||
end
|
||||
|
||||
def current_mailbox
|
||||
@mailbox
|
||||
end
|
||||
end
|
0
app/controllers/concerns/.keep
Normal file
0
app/controllers/concerns/.keep
Normal file
17
app/controllers/emails_controller.rb
Normal file
17
app/controllers/emails_controller.rb
Normal file
@ -0,0 +1,17 @@
|
||||
class EmailsController < ApplicationController
|
||||
before_action :set_email, only: [:show, :mark_as_read, :body_preview]
|
||||
|
||||
def show
|
||||
@selected = params[:selected]
|
||||
@email.mark_as_read! unless @email.read?
|
||||
end
|
||||
|
||||
def body_preview
|
||||
render(layout: false)
|
||||
end
|
||||
|
||||
def set_email
|
||||
@email = Email.find(params[:id])
|
||||
@mailbox = @email.mailbox
|
||||
end
|
||||
end
|
71
app/controllers/mailboxes_controller.rb
Normal file
71
app/controllers/mailboxes_controller.rb
Normal file
@ -0,0 +1,71 @@
|
||||
class MailboxesController < ApplicationController
|
||||
before_action :set_mailbox, only: [:show, :mark_all_as_read, :clear_mailbox, :details, :edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
if Mailbox.any?
|
||||
return redirect_to mailbox_path(Mailbox.first)
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@emails = @mailbox.emails.order(created_at: :desc)
|
||||
end
|
||||
|
||||
def details
|
||||
render(partial: 'details', layout: false)
|
||||
end
|
||||
|
||||
def new
|
||||
@mailbox = Mailbox.new
|
||||
render(layout: false)
|
||||
end
|
||||
|
||||
def create
|
||||
@mailbox = Mailbox.new(mailbox_params)
|
||||
if @mailbox.save
|
||||
flash[:success] = 'Successfully created mailbox.'
|
||||
redirect_to mailbox_path(@mailbox)
|
||||
else
|
||||
render partial: 'form', status: :bad_request, layout: false
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
render(layout: false)
|
||||
end
|
||||
|
||||
def update
|
||||
if @mailbox.update(mailbox_params)
|
||||
flash[:success] = 'Successfully updated'
|
||||
redirect_to mailbox_path(@mailbox)
|
||||
else
|
||||
render partial: 'form', status: :bad_request, layout: false
|
||||
end
|
||||
end
|
||||
|
||||
def mark_all_as_read
|
||||
@mailbox.mark_all_as_read!
|
||||
redirect_to mailbox_path(@mailbox)
|
||||
end
|
||||
|
||||
def clear_mailbox
|
||||
@mailbox.emails.destroy_all
|
||||
redirect_to mailbox_path(@mailbox)
|
||||
end
|
||||
|
||||
def destroy
|
||||
@mailbox.destroy
|
||||
flash[:success] = 'Successfully destroyed mailbox'
|
||||
redirect_to mailboxes_path
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def mailbox_params
|
||||
params.require(:mailbox).permit(:name, :sendgrid_api_token)
|
||||
end
|
||||
|
||||
def set_mailbox
|
||||
@mailbox = Mailbox.find(params[:id])
|
||||
end
|
||||
end
|
2
app/helpers/application_helper.rb
Normal file
2
app/helpers/application_helper.rb
Normal file
@ -0,0 +1,2 @@
|
||||
module ApplicationHelper
|
||||
end
|
2
app/helpers/mailbox_helper.rb
Normal file
2
app/helpers/mailbox_helper.rb
Normal file
@ -0,0 +1,2 @@
|
||||
module MailboxHelper
|
||||
end
|
6
app/javascript/channels/consumer.js
Normal file
6
app/javascript/channels/consumer.js
Normal file
@ -0,0 +1,6 @@
|
||||
// Action Cable provides the framework to deal with WebSockets in Rails.
|
||||
// You can generate new channels where WebSocket features live using the `rails generate channel` command.
|
||||
|
||||
import { createConsumer } from "@rails/actioncable"
|
||||
|
||||
export default createConsumer()
|
5
app/javascript/channels/index.js
Normal file
5
app/javascript/channels/index.js
Normal file
@ -0,0 +1,5 @@
|
||||
// Load all the channels within this directory and all subdirectories.
|
||||
// Channel files must be named *_channel.js.
|
||||
|
||||
const channels = require.context('.', true, /_channel\.js$/)
|
||||
channels.keys().forEach(channels)
|
26
app/javascript/controllers/alert_controller.js
Normal file
26
app/javascript/controllers/alert_controller.js
Normal file
@ -0,0 +1,26 @@
|
||||
// Visit The Stimulus Handbook for more details
|
||||
// https://stimulusjs.org/handbook/introduction
|
||||
//
|
||||
// This example controller works with specially annotated HTML like:
|
||||
//
|
||||
// <div data-controller="hello">
|
||||
// <h1 data-target="hello.output"></h1>
|
||||
// </div>
|
||||
|
||||
import { Controller } from "stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = [ "alert" ]
|
||||
|
||||
connect() {
|
||||
}
|
||||
|
||||
close(event) {
|
||||
event.preventDefault();
|
||||
this.removeAlert();
|
||||
}
|
||||
|
||||
removeAlert() {
|
||||
this.alertTarget.remove();
|
||||
}
|
||||
}
|
23
app/javascript/controllers/clipboard_controller.js
Normal file
23
app/javascript/controllers/clipboard_controller.js
Normal file
@ -0,0 +1,23 @@
|
||||
// Visit The Stimulus Handbook for more details
|
||||
// https://stimulusjs.org/handbook/introduction
|
||||
//
|
||||
// This example controller works with specially annotated HTML like:
|
||||
//
|
||||
// <div data-controller="hello">
|
||||
// <h1 data-target="hello.output"></h1>
|
||||
// </div>
|
||||
|
||||
import { Controller } from "stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = [ "source" ]
|
||||
|
||||
connect() {
|
||||
}
|
||||
|
||||
copy(event) {
|
||||
event.preventDefault();
|
||||
this.sourceTarget.select()
|
||||
document.execCommand("copy")
|
||||
}
|
||||
}
|
11
app/javascript/controllers/iframe_auto_height_controller.js
Normal file
11
app/javascript/controllers/iframe_auto_height_controller.js
Normal file
@ -0,0 +1,11 @@
|
||||
import { Controller } from "stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = [ "iframe" ]
|
||||
|
||||
connect() {
|
||||
}
|
||||
loaded(event) {
|
||||
this.iframeTarget.height = this.iframeTarget.contentWindow.document.body.scrollHeight
|
||||
}
|
||||
}
|
9
app/javascript/controllers/index.js
Normal file
9
app/javascript/controllers/index.js
Normal file
@ -0,0 +1,9 @@
|
||||
// Load all the controllers within this directory and all subdirectories.
|
||||
// Controller files must be named *_controller.js.
|
||||
|
||||
import { Application } from "stimulus"
|
||||
import { definitionsFromContext } from "stimulus/webpack-helpers"
|
||||
|
||||
const application = Application.start()
|
||||
const context = require.context("controllers", true, /_controller\.js$/)
|
||||
application.load(definitionsFromContext(context))
|
37
app/javascript/controllers/modal_controller.js
Normal file
37
app/javascript/controllers/modal_controller.js
Normal file
@ -0,0 +1,37 @@
|
||||
import { Controller } from "stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = [ "modal" ]
|
||||
|
||||
connect() {
|
||||
}
|
||||
|
||||
closeClickedOutside(event) {
|
||||
if (this.mouseClickDownTarget != this.mouseClickUpTarget) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.srcElement == this.modalTarget) {
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
|
||||
close(event) {
|
||||
this.modalTarget.remove();
|
||||
}
|
||||
|
||||
error() {
|
||||
this.modalTarget.classList.add("shake");
|
||||
setTimeout(() => {
|
||||
this.modalTarget.classList.remove("shake");
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
trackMouseDown(event) {
|
||||
this.mouseClickDownTarget = event.target
|
||||
}
|
||||
|
||||
trackMouseUp(event) {
|
||||
this.mouseClickUpTarget = event.target
|
||||
}
|
||||
}
|
19
app/javascript/controllers/remote_content_controller.js
Normal file
19
app/javascript/controllers/remote_content_controller.js
Normal file
@ -0,0 +1,19 @@
|
||||
import { Controller } from "stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = [ "outlet" ]
|
||||
|
||||
connect() {
|
||||
}
|
||||
|
||||
load(event) {
|
||||
event.preventDefault();
|
||||
fetch(event.target.href)
|
||||
.then((response) => {
|
||||
return response.text();
|
||||
})
|
||||
.then((html) => {
|
||||
this.outletTarget.innerHTML = html;
|
||||
})
|
||||
}
|
||||
}
|
16
app/javascript/controllers/remote_form_modal_controller.js
Normal file
16
app/javascript/controllers/remote_form_modal_controller.js
Normal file
@ -0,0 +1,16 @@
|
||||
import { Controller } from "stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = [ "container", "form" ]
|
||||
|
||||
connect() {
|
||||
}
|
||||
|
||||
handleSuccess() {
|
||||
}
|
||||
|
||||
handleError(event) {
|
||||
let [data, status, xhr] = event.detail;
|
||||
this.formTarget.innerHTML = xhr.responseText;
|
||||
}
|
||||
}
|
19
app/javascript/packs/application.js
Normal file
19
app/javascript/packs/application.js
Normal file
@ -0,0 +1,19 @@
|
||||
// This file is automatically compiled by Webpack, along with any other files
|
||||
// present in this directory. You're encouraged to place your actual application logic in
|
||||
// a relevant structure within app/javascript and only use these pack files to reference
|
||||
// that code so it'll be compiled.
|
||||
|
||||
require("@rails/ujs").start()
|
||||
require("turbolinks").start()
|
||||
require("@rails/activestorage").start()
|
||||
require("channels")
|
||||
|
||||
import '../stylesheets/application'
|
||||
// Uncomment to copy all static images under ../images to the output folder and reference
|
||||
// them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>)
|
||||
// or the `imagePath` JavaScript helper below.
|
||||
//
|
||||
// const images = require.context('../images', true)
|
||||
// const imagePath = (name) => images(name, true)
|
||||
|
||||
import "controllers"
|
39
app/javascript/stylesheets/_alerts.scss
Normal file
39
app/javascript/stylesheets/_alerts.scss
Normal file
@ -0,0 +1,39 @@
|
||||
.alert {
|
||||
border-radius: 5px;
|
||||
padding: 0.5rem 0.75rem;
|
||||
border: 1px solid;
|
||||
margin-bottom: 0.5rem;
|
||||
@extend .clearfix;
|
||||
}
|
||||
|
||||
.alert--success {
|
||||
background: $success-500;
|
||||
border-color: $success-700;
|
||||
}
|
||||
|
||||
.alert--warning {
|
||||
background: $warning-500;
|
||||
border-color: $warning-700;
|
||||
}
|
||||
|
||||
.alert--error {
|
||||
background: $danger-500;
|
||||
border-color: $danger-700;
|
||||
}
|
||||
|
||||
.alert__close {
|
||||
float: right;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.alert--success .alert__close {
|
||||
color: $success-900;
|
||||
}
|
||||
|
||||
.alert--warning .alert__close {
|
||||
color: $warning-900;
|
||||
}
|
||||
|
||||
.alert--error .alert__close {
|
||||
color: $danger-900;
|
||||
}
|
22
app/javascript/stylesheets/_animations.scss
Normal file
22
app/javascript/stylesheets/_animations.scss
Normal file
@ -0,0 +1,22 @@
|
||||
@keyframes shake {
|
||||
10%, 90% {
|
||||
transform: translate3d(-1px, 0, 0);
|
||||
}
|
||||
|
||||
20%, 80% {
|
||||
transform: translate3d(2px, 0, 0);
|
||||
}
|
||||
|
||||
30%, 50%, 70% {
|
||||
transform: translate3d(-4px, 0, 0);
|
||||
}
|
||||
|
||||
40%, 60% {
|
||||
transform: translate3d(4px, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
.shake {
|
||||
transform: translate3d(0, 0, 0);
|
||||
animation: shake 0.82s cubic-bezier(.36,.07,.19,.97) both;
|
||||
}
|
52
app/javascript/stylesheets/_buttons.scss
Normal file
52
app/javascript/stylesheets/_buttons.scss
Normal file
@ -0,0 +1,52 @@
|
||||
.button {
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
padding: 0.25rem 0.5rem;
|
||||
border-radius: 3px;
|
||||
border: 1px solid $grey-500;
|
||||
box-shadow: 0 1px 2px 0px $grey-700;
|
||||
outline: none;
|
||||
&:active {
|
||||
box-shadow: none;
|
||||
}
|
||||
&:focus {
|
||||
border-color: $grey-600;
|
||||
}
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.button--block {
|
||||
display: block;
|
||||
width: 70%;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.button--primary {
|
||||
background: $primary-500;
|
||||
border-color: $primary-600;
|
||||
color: $grey-100;
|
||||
&:active {
|
||||
background: $primary-600;
|
||||
}
|
||||
&:focus {
|
||||
border-color: $primary-800;
|
||||
}
|
||||
}
|
||||
|
||||
.button--danger {
|
||||
background: $danger-500;
|
||||
border-color: $danger-600;
|
||||
color: $grey-100;
|
||||
&:active {
|
||||
background: $danger-600;
|
||||
}
|
||||
&:focus {
|
||||
border-color: $danger-800;
|
||||
}
|
||||
}
|
||||
|
||||
.button-collection {
|
||||
margin-top: 0;
|
||||
}
|
72
app/javascript/stylesheets/_emails.scss
Normal file
72
app/javascript/stylesheets/_emails.scss
Normal file
@ -0,0 +1,72 @@
|
||||
.email {
|
||||
padding: 0.25rem 1rem;
|
||||
border: 1px solid $grey-400;
|
||||
border-radius: 5px;
|
||||
margin-bottom: 0.3rem;
|
||||
background: $grey-100;
|
||||
border: 2px solid $grey-400;
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
&:hover {
|
||||
background: $grey-200;
|
||||
}
|
||||
}
|
||||
|
||||
.email--no-chrome {
|
||||
border: none;
|
||||
background: none;
|
||||
}
|
||||
|
||||
.email--unread {
|
||||
border-left: 2px solid $warning-500;
|
||||
}
|
||||
|
||||
.email__from {
|
||||
@extend .text-overflow-truncate;
|
||||
flex-basis: 15%;
|
||||
margin-right: 0.5rem;
|
||||
}
|
||||
|
||||
.email__to {
|
||||
@extend .text-overflow-truncate;
|
||||
flex-basis: 30%;
|
||||
margin-right: 0.5rem;
|
||||
}
|
||||
|
||||
.email__subject {
|
||||
flex-basis: 50%;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
@extend .text-overflow-truncate;
|
||||
}
|
||||
|
||||
.email__created-at {
|
||||
flex-basis: 10%;
|
||||
text-align: right;
|
||||
@extend .text-overflow-truncate;
|
||||
}
|
||||
|
||||
|
||||
.email__preview {
|
||||
border: 1px solid $grey-500;
|
||||
border-radius: 5px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.email-address-list-entry {
|
||||
border-radius: 10px;
|
||||
padding: 0.125rem 0.35rem;
|
||||
border: 1px solid $grey-500;
|
||||
background: $grey-400;
|
||||
}
|
||||
|
||||
.email__preview--plaintext {
|
||||
font-family: monospace;
|
||||
font-size: 1.125rem;
|
||||
background: $grey-100;
|
||||
padding: 1rem;
|
||||
p:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
15
app/javascript/stylesheets/_headers.scss
Normal file
15
app/javascript/stylesheets/_headers.scss
Normal file
@ -0,0 +1,15 @@
|
||||
|
||||
.header {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.header--with-border {
|
||||
border-bottom: 1px solid $grey-500;
|
||||
}
|
||||
|
||||
.header--justified-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
65
app/javascript/stylesheets/_inputs.scss
Normal file
65
app/javascript/stylesheets/_inputs.scss
Normal file
@ -0,0 +1,65 @@
|
||||
.form-group {
|
||||
margin-bottom: 1rem;
|
||||
label {
|
||||
display: block;
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
}
|
||||
|
||||
input[type=text].form-control {
|
||||
display: block;
|
||||
font: inherit;
|
||||
width: 100%;
|
||||
outline: none;
|
||||
border: 1px solid $grey-500;
|
||||
box-shadow: 0 1px 2px 0px $grey-600;
|
||||
padding: 0.35rem 0.5rem;
|
||||
border-radius: 5px;
|
||||
&:focus {
|
||||
border-color: $primary-500;
|
||||
}
|
||||
}
|
||||
|
||||
input[disabled].form-control,
|
||||
input[readonly].form-control {
|
||||
background: $grey-400;
|
||||
}
|
||||
|
||||
input[type=submit].form-control {
|
||||
font: inherit;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
.error-message {
|
||||
color: $danger-500;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.field_with_errors {
|
||||
input[type=text].form-control {
|
||||
border-color: $danger-500;
|
||||
}
|
||||
}
|
||||
|
||||
.input-group {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
input[type=text].input-group__input {
|
||||
border-top-right-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
}
|
||||
|
||||
.input-group__append {
|
||||
padding: 0.35rem 0.5rem;
|
||||
border: 1px solid $grey-500;
|
||||
border-left: 0;
|
||||
border-top-right-radius: 5px;
|
||||
border-bottom-right-radius: 5px;
|
||||
box-shadow: 0 1px 2px 0px $grey-600;
|
||||
margin-bottom: 0;
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
}
|
||||
}
|
17
app/javascript/stylesheets/_layout.scss
Normal file
17
app/javascript/stylesheets/_layout.scss
Normal file
@ -0,0 +1,17 @@
|
||||
.main-content {
|
||||
margin-left: calc(min(20%, 300px) + 50px);
|
||||
margin-right: 50px;
|
||||
}
|
||||
|
||||
.width-50 {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.mb-2 {
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.centered {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
40
app/javascript/stylesheets/_modal.scss
Normal file
40
app/javascript/stylesheets/_modal.scss
Normal file
@ -0,0 +1,40 @@
|
||||
.modal {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background: rgba($grey-300, 0.6);
|
||||
}
|
||||
|
||||
.modal__popup {
|
||||
position: fixed;
|
||||
top: 50px;
|
||||
left: 30%;
|
||||
right: 30%;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
border: 1px solid $grey-500;
|
||||
overflow: hidden;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0 1px 2px 0px $grey-700;
|
||||
}
|
||||
|
||||
.modal__header {
|
||||
padding: 0.75rem 1rem;
|
||||
border-bottom: 1px solid $grey-500;
|
||||
background: $grey-400;
|
||||
}
|
||||
|
||||
.modal__body {
|
||||
padding: 1rem;
|
||||
padding-top: 1rem;
|
||||
background: $grey-100;
|
||||
}
|
||||
|
||||
.modal__footer {
|
||||
padding: 0.75rem 1rem;
|
||||
border-top: 1px solid $grey-500;
|
||||
background: $grey-400;
|
||||
}
|
||||
|
24
app/javascript/stylesheets/_nav.scss
Normal file
24
app/javascript/stylesheets/_nav.scss
Normal file
@ -0,0 +1,24 @@
|
||||
.nav-list {
|
||||
a {
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
padding-left: 1.5rem;
|
||||
padding-right: 1.5rem;
|
||||
padding-top: 0.4rem;
|
||||
padding-bottom: 0.4rem;
|
||||
margin-bottom: 0;
|
||||
margin-top: 0;
|
||||
&:hover {
|
||||
background: $grey-500;
|
||||
}
|
||||
&:active {
|
||||
background: $grey-600;
|
||||
}
|
||||
}
|
||||
margin-left: 0;
|
||||
padding-left: 0;
|
||||
.active {
|
||||
background: $grey-500;
|
||||
}
|
||||
}
|
13
app/javascript/stylesheets/_resets.scss
Normal file
13
app/javascript/stylesheets/_resets.scss
Normal file
@ -0,0 +1,13 @@
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.clearfix::before,
|
||||
.clearfix::after {
|
||||
content: " ";
|
||||
display: table;
|
||||
}
|
||||
|
||||
.clearfix::after {
|
||||
clear: both;
|
||||
}
|
39
app/javascript/stylesheets/_sidebar.scss
Normal file
39
app/javascript/stylesheets/_sidebar.scss
Normal file
@ -0,0 +1,39 @@
|
||||
html {
|
||||
background: $grey-200;
|
||||
}
|
||||
body {
|
||||
line-height: 1.3;
|
||||
font-family: 'Helvetica', Arial;
|
||||
color: $primary-900;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
width: 20%;
|
||||
max-width: 300px;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
overflow-y: auto;
|
||||
overflow-x: none;
|
||||
background: $grey-400;
|
||||
border-right: 1px solid $grey-500;
|
||||
}
|
||||
|
||||
.sidebar__inner-container {
|
||||
padding-left: 1.5rem;
|
||||
padding-right: 1.5rem;
|
||||
}
|
||||
|
||||
.sidebar-bottom {
|
||||
background: rgba($grey-200, 0.5);
|
||||
position: fixed;
|
||||
padding-top: 1rem;
|
||||
width: 20%;
|
||||
max-width: 300px;
|
||||
bottom: 20px;
|
||||
}
|
||||
|
||||
.content {
|
||||
margin-left: 350px;
|
||||
}
|
23
app/javascript/stylesheets/_tables.scss
Normal file
23
app/javascript/stylesheets/_tables.scss
Normal file
@ -0,0 +1,23 @@
|
||||
.table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
th {
|
||||
text-align: left;
|
||||
border-bottom: 1px solid $grey-500;
|
||||
padding-top: 0.5rem;
|
||||
padding-bottom: 0.5rem;
|
||||
vertical-align: center;
|
||||
}
|
||||
tr > td {
|
||||
padding-top: 0.5rem;
|
||||
padding-bottom: 0.5rem;
|
||||
padding-right: 0.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
.table--for-attributes {
|
||||
tr > td:first-child {
|
||||
font-weight: 600;
|
||||
min-width: 100px;
|
||||
}
|
||||
}
|
40
app/javascript/stylesheets/_typography.scss
Normal file
40
app/javascript/stylesheets/_typography.scss
Normal file
@ -0,0 +1,40 @@
|
||||
dd {
|
||||
padding-left: 0;
|
||||
margin-left: 0;
|
||||
&:nth-child(even) {
|
||||
font-weight: 600;
|
||||
margin-bottom: 0.25rem;
|
||||
|
||||
}
|
||||
&:nth-child(odd) {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
a {
|
||||
color: $primary-500;
|
||||
}
|
||||
|
||||
pre {
|
||||
margin-top: 0;
|
||||
overflow-y: auto
|
||||
}
|
||||
|
||||
.no-link-appearance {
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.text-center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.text-right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.text-overflow-truncate {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
51
app/javascript/stylesheets/_variables.scss
Normal file
51
app/javascript/stylesheets/_variables.scss
Normal file
@ -0,0 +1,51 @@
|
||||
// Colors
|
||||
|
||||
$primary-100: #C6CFF4;
|
||||
$primary-200: #99ACF2;
|
||||
$primary-300: #6B87EF;
|
||||
$primary-400: #5073F7;
|
||||
$primary-500: #3660FF;
|
||||
$primary-600: #2853F7;
|
||||
$primary-700: #2247D5;
|
||||
$primary-800: #13319F;
|
||||
$primary-900: #081854;
|
||||
|
||||
$grey-100: #FCFCFC;
|
||||
$grey-200: #F8F8F9;
|
||||
$grey-300: #F2F3F4;
|
||||
$grey-400: #E9EAEF;
|
||||
$grey-500: #D1D4E0;
|
||||
$grey-600: #9CA0AF;
|
||||
$grey-700: #7A7D8B;
|
||||
$grey-800: #555862;
|
||||
$grey-900: #2A2C36;
|
||||
|
||||
$success-100: #DEF4ED;
|
||||
$success-200: #BAE6D8;
|
||||
$success-300: #8DD8C0;
|
||||
$success-400: #72D3B3;
|
||||
$success-500: #36C697;
|
||||
$success-600: #25B485;
|
||||
$success-700: #179B70;
|
||||
$success-800: #14835F;
|
||||
$success-900: #1B5C47;
|
||||
|
||||
$warning-100: #FFF3DF;
|
||||
$warning-200: #FFD58E;
|
||||
$warning-300: #FAC873;
|
||||
$warning-400: #F6C064;
|
||||
$warning-500: #FFB73E;
|
||||
$warning-600: #FB9E02;
|
||||
$warning-700: #EA9608;
|
||||
$warning-800: #D38B13;
|
||||
$warning-900: #B57813;
|
||||
|
||||
$danger-100: #F7DADA;
|
||||
$danger-200: #F39C9C;
|
||||
$danger-300: #F47171;
|
||||
$danger-400: #F86F6F;
|
||||
$danger-500: #FF5D5D;
|
||||
$danger-600: #F73F3F;
|
||||
$danger-700: #E91414;
|
||||
$danger-800: #BF1111;
|
||||
$danger-900: #830F0F;
|
15
app/javascript/stylesheets/application.scss
Normal file
15
app/javascript/stylesheets/application.scss
Normal file
@ -0,0 +1,15 @@
|
||||
@import 'variables';
|
||||
@import 'resets';
|
||||
@import 'animations';
|
||||
@import 'typography';
|
||||
@import 'layout';
|
||||
@import 'buttons';
|
||||
@import 'alerts';
|
||||
@import 'inputs';
|
||||
@import 'sidebar';
|
||||
@import 'nav';
|
||||
@import 'modal';
|
||||
@import 'emails';
|
||||
@import 'headers';
|
||||
@import 'tables';
|
||||
|
7
app/jobs/application_job.rb
Normal file
7
app/jobs/application_job.rb
Normal file
@ -0,0 +1,7 @@
|
||||
class ApplicationJob < ActiveJob::Base
|
||||
# Automatically retry jobs that encountered a deadlock
|
||||
# retry_on ActiveRecord::Deadlocked
|
||||
|
||||
# Most jobs are safe to ignore if the underlying records are no longer available
|
||||
# discard_on ActiveJob::DeserializationError
|
||||
end
|
4
app/mailers/application_mailer.rb
Normal file
4
app/mailers/application_mailer.rb
Normal file
@ -0,0 +1,4 @@
|
||||
class ApplicationMailer < ActionMailer::Base
|
||||
default from: 'from@example.com'
|
||||
layout 'mailer'
|
||||
end
|
3
app/models/application_record.rb
Normal file
3
app/models/application_record.rb
Normal file
@ -0,0 +1,3 @@
|
||||
class ApplicationRecord < ActiveRecord::Base
|
||||
self.abstract_class = true
|
||||
end
|
0
app/models/concerns/.keep
Normal file
0
app/models/concerns/.keep
Normal file
64
app/models/email.rb
Normal file
64
app/models/email.rb
Normal file
@ -0,0 +1,64 @@
|
||||
class Email < ApplicationRecord
|
||||
belongs_to :mailbox
|
||||
validates :template_id, presence: true
|
||||
validates :rendered_html, presence: true
|
||||
validates :request_payload, presence: true
|
||||
validates :template_payload, presence: true
|
||||
validates :personalization_id, presence: true
|
||||
|
||||
validates :rendered_html, presence: true
|
||||
validates :rendered_plain_text, presence: true
|
||||
|
||||
def self.unread
|
||||
where(read_at: nil)
|
||||
end
|
||||
|
||||
def read?
|
||||
read_at.present?
|
||||
end
|
||||
|
||||
def mark_as_read!
|
||||
self.update(read_at: Time.zone.now)
|
||||
end
|
||||
|
||||
def from
|
||||
fields = request_payload['from']
|
||||
EmailAddress.new(email: fields['email'], name: fields['name'])
|
||||
end
|
||||
|
||||
def to
|
||||
personalization['to'].map do |fields|
|
||||
EmailAddress.new(email: fields['email'], name: fields['name'])
|
||||
end
|
||||
end
|
||||
|
||||
def cc
|
||||
return [] unless personalization['cc'].present?
|
||||
personalization['cc'].map do |fields|
|
||||
EmailAddress.new(email: fields['email'], name: fields['name'])
|
||||
end
|
||||
end
|
||||
|
||||
def bcc
|
||||
return [] unless personalization['bcc'].present?
|
||||
personalization['bcc'].map do |fields|
|
||||
EmailAddress.new(email: fields['email'], name: fields['name'])
|
||||
end
|
||||
end
|
||||
|
||||
def personalization
|
||||
request_payload['personalizations'][personalization_id]
|
||||
end
|
||||
|
||||
def link_to_template
|
||||
"https://mc.sendgrid.com/dynamic-templates/#{template_id}/version/#{template_version}/editor"
|
||||
end
|
||||
|
||||
def template_name
|
||||
template_payload['name']
|
||||
end
|
||||
|
||||
def template_version
|
||||
template_payload['versions'].last['id']
|
||||
end
|
||||
end
|
10
app/models/email_address.rb
Normal file
10
app/models/email_address.rb
Normal file
@ -0,0 +1,10 @@
|
||||
class EmailAddress
|
||||
attr_reader :email, :name
|
||||
def initialize(email: ,name: nil)
|
||||
@email = email
|
||||
@name = name
|
||||
end
|
||||
def to_s
|
||||
"<#{email}> #{name}".strip
|
||||
end
|
||||
end
|
30
app/models/mailbox.rb
Normal file
30
app/models/mailbox.rb
Normal file
@ -0,0 +1,30 @@
|
||||
class Mailbox < ApplicationRecord
|
||||
has_many :emails, dependent: :destroy
|
||||
|
||||
validates :name, presence: true
|
||||
|
||||
validates :sendgrid_mock_api_token, presence: true
|
||||
validates :sendgrid_mock_api_token, uniqueness: true
|
||||
|
||||
validates :sendgrid_api_token, presence: true
|
||||
|
||||
before_validation :generate_sendgrid_mock_api_token
|
||||
|
||||
def unread_count
|
||||
self.emails.unread.count
|
||||
end
|
||||
|
||||
def mark_all_as_read!
|
||||
self.emails.unread.update_all(read_at: Time.zone.now)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def generate_sendgrid_mock_api_token
|
||||
return if sendgrid_mock_api_token.present?
|
||||
self.sendgrid_mock_api_token = loop do
|
||||
token = SecureRandom.uuid
|
||||
break token unless self.class.exists?(sendgrid_mock_api_token: token)
|
||||
end
|
||||
end
|
||||
end
|
89
app/services/create_email.rb
Normal file
89
app/services/create_email.rb
Normal file
@ -0,0 +1,89 @@
|
||||
require 'handlebars_renderer'
|
||||
require 'sendgrid_client'
|
||||
|
||||
class CreateEmail
|
||||
class InvalidRequest < StandardError
|
||||
attr_reader :request_result
|
||||
def initialize(request_result)
|
||||
super()
|
||||
@request_result = request_result
|
||||
end
|
||||
end
|
||||
|
||||
class InvalidTemplate < StandardError
|
||||
end
|
||||
|
||||
attr_reader :mailbox,
|
||||
:handlebars_renderer,
|
||||
:sendgrid_client
|
||||
|
||||
def initialize(mailbox,
|
||||
handlebars_renderer: HandlebarsRenderer.new,
|
||||
sendgrid_client_class: SendgridClient)
|
||||
|
||||
@mailbox = mailbox
|
||||
@handlebars_renderer = handlebars_renderer
|
||||
@sendgrid_client = sendgrid_client_class.new(mailbox.sendgrid_api_token)
|
||||
end
|
||||
|
||||
def call(request_payload)
|
||||
validate_email_payload_against_sendgrid!(request_payload)
|
||||
template = retrieve_template_payload(template_id(request_payload))
|
||||
render_personalizations(request_payload, template)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def validate_email_payload_against_sendgrid!(request_payload)
|
||||
result = sendgrid_client.validate_request(request_payload)
|
||||
raise InvalidRequest.new(result.original_response) unless result.valid
|
||||
end
|
||||
|
||||
def retrieve_template_payload(template_id)
|
||||
result = sendgrid_client.get_template(template_id)
|
||||
raise InvalidTemplate if result.blank?
|
||||
result
|
||||
end
|
||||
|
||||
def render_personalizations(request_payload, template)
|
||||
request_payload['personalizations'].each_with_index do |personalization, index|
|
||||
template_version = latest_template_version(template)
|
||||
Email.new(mailbox: mailbox,
|
||||
request_payload: request_payload,
|
||||
template_payload: template,
|
||||
template_id: template_version['id'],
|
||||
personalization_id: index,
|
||||
rendered_html: render_html(template_version, personalization),
|
||||
rendered_plain_text: render_plaintext(template_version, personalization),
|
||||
subject: render_subject(template_version, personalization)
|
||||
).save!
|
||||
end
|
||||
end
|
||||
|
||||
def render_subject(template_version, personalization)
|
||||
handlebars_renderer.render(template_version['subject'],
|
||||
{ 'subject' => personalization['subject'] })
|
||||
end
|
||||
|
||||
def render_html(template_version, personalization)
|
||||
handlebars_renderer.render(template_version['html_content'],
|
||||
personalization['dynamic_template_data'])
|
||||
end
|
||||
|
||||
def render_plaintext(template_version, personalization)
|
||||
if template_version['generate_plain_content']
|
||||
document = Nokogiri::HTML(render_html(template_version, personalization))
|
||||
document.text()
|
||||
else
|
||||
handlebars_renderer.render(template_version['plain_content'], personalization)
|
||||
end
|
||||
end
|
||||
|
||||
def template_id(request_payload)
|
||||
request_payload['template_id']
|
||||
end
|
||||
|
||||
def latest_template_version(template)
|
||||
template['versions'].last
|
||||
end
|
||||
end
|
3
app/views/emails/_email_list.html.erb
Normal file
3
app/views/emails/_email_list.html.erb
Normal file
@ -0,0 +1,3 @@
|
||||
<% @emails.each do |email| %>
|
||||
<%= render(EmailListEntryComponent.new(email: email)) %>
|
||||
<% end %>
|
1
app/views/emails/body_preview.html.erb
Normal file
1
app/views/emails/body_preview.html.erb
Normal file
@ -0,0 +1 @@
|
||||
<%= raw(@email.rendered_html) %>
|
102
app/views/emails/show.html.erb
Normal file
102
app/views/emails/show.html.erb
Normal file
@ -0,0 +1,102 @@
|
||||
<table class="table table--for-attributes mb-2">
|
||||
<tr>
|
||||
<td>Mailbox:</td>
|
||||
<td><%= link_to @email.mailbox.name, mailbox_path(@email.mailbox) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>From:</td>
|
||||
<td><span class="email-address-list-entry"><%= @email.from %></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>To:</td>
|
||||
<td>
|
||||
<% @email.to.each do |email_address| %>
|
||||
<span class="email-address-list-entry"><%= email_address %></span>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% if @email.cc.any? %>
|
||||
<tr>
|
||||
<td>CC:</td>
|
||||
<td>
|
||||
<% @email.cc.each do |email_address| %>
|
||||
<span class="email-address-list-entry"><%= email_address %></span>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if @email.bcc.any? %>
|
||||
<tr>
|
||||
<td>BCC:</td>
|
||||
<td>
|
||||
<% @email.bcc.each do |email_address| %>
|
||||
<span class="email-address-list-entry"><%= email_address %></span>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<td>Subject:</td>
|
||||
<td><%= @email.subject %></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Template:</td>
|
||||
<td><%= link_to @email.template_name, @email.link_to_template, target: '_blank' %></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Received:</td>
|
||||
<td><%= l(@email.created_at, format: :long) %></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
<%= link_to "HTML",
|
||||
email_path(@email, selected: 'html'),
|
||||
class: 'button',
|
||||
'data-turbolinks-action': "replace" %>
|
||||
<%= link_to "Plain Text",
|
||||
email_path(@email, selected: 'plain_text'),
|
||||
class: 'button',
|
||||
'data-turbolinks-action': "replace" %>
|
||||
<%= link_to "Source",
|
||||
email_path(@email, selected: 'source'),
|
||||
class: 'button',
|
||||
'data-turbolinks-action': "replace" %>
|
||||
</p>
|
||||
<% if @selected == 'plain_text' %>
|
||||
<section>
|
||||
<h1>Plain Text</h1>
|
||||
<div class="email__preview email__preview--plaintext">
|
||||
<%= simple_format(@email.rendered_plain_text) %>
|
||||
</div>
|
||||
</section>
|
||||
<% elsif @selected == 'source' %>
|
||||
<section>
|
||||
<h2>Request</h2>
|
||||
<div class="email__preview email__preview--plaintext">
|
||||
<pre><%= JSON.pretty_generate(@email.request_payload) %></pre>
|
||||
</div>
|
||||
<h2>Personalization</h2>
|
||||
<div class="email__preview email__preview--plaintext">
|
||||
<pre><%= JSON.pretty_generate(@email.personalization) %></pre>
|
||||
</div>
|
||||
<h2>Template</h2>
|
||||
<div class="email__preview email__preview--plaintext">
|
||||
<pre><%= JSON.pretty_generate(@email.template_payload) %></pre>
|
||||
</div>
|
||||
</section>
|
||||
<% else %>
|
||||
<section>
|
||||
<h1>HTML</h1>
|
||||
<div class="email__preview">
|
||||
<iframe width="100%"
|
||||
src="<%= preview_email_path(@email) %>"
|
||||
frameborder="0"
|
||||
data-controller="iframe-auto-height"
|
||||
data-iframe-auto-height-target="iframe"
|
||||
data-action="load->iframe-auto-height#loaded"></iframe>
|
||||
</div>
|
||||
</section>
|
||||
<% end %>
|
25
app/views/layouts/application.html.erb
Normal file
25
app/views/layouts/application.html.erb
Normal file
@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Post Doc</title>
|
||||
<%= csrf_meta_tags %>
|
||||
<%= csp_meta_tag %>
|
||||
|
||||
<%= stylesheet_pack_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
|
||||
<meta name="turbolinks-cache-control" content="no-cache">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<%= render(partial: 'shared/sidebar') %>
|
||||
<main class="main-content">
|
||||
<% flash.keys.each do |key| %>
|
||||
<div class="alert alert--<%= key %>" data-controller="alert" data-alert-target="alert">
|
||||
<%= flash[key] %>
|
||||
<a href="#" data-action="click->alert#close" class="alert__close">×</a>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= yield %>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
13
app/views/layouts/mailer.html.erb
Normal file
13
app/views/layouts/mailer.html.erb
Normal file
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<style>
|
||||
/* Email styles need to be inline */
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<%= yield %>
|
||||
</body>
|
||||
</html>
|
1
app/views/layouts/mailer.text.erb
Normal file
1
app/views/layouts/mailer.text.erb
Normal file
@ -0,0 +1 @@
|
||||
<%= yield %>
|
38
app/views/mailboxes/_details.html.erb
Normal file
38
app/views/mailboxes/_details.html.erb
Normal file
@ -0,0 +1,38 @@
|
||||
<%= render ModalComponent.new(title: 'Mailbox Details') do |component| %>
|
||||
<% component.with(:body) do %>
|
||||
<dt>
|
||||
<dd>Name</dd>
|
||||
<dd>
|
||||
<%= @mailbox.name %>
|
||||
</dd>
|
||||
<dd>Mock API Token</dd>
|
||||
<dd>
|
||||
<div class="input-group" data-controller="clipboard">
|
||||
<input data-clipboard-target="source" type="text" class="input-group__input form-control" readonly value="<%= @mailbox.sendgrid_mock_api_token %>"/>
|
||||
<div class="input-group__append">
|
||||
<a data-action="click->clipboard#copy" href="#">Copy</a>
|
||||
</div>
|
||||
</div>
|
||||
</dd>
|
||||
<dd>Sendgrid API Token</dd>
|
||||
<dd>
|
||||
<input type="text" class="form-control" readonly value="<%= @mailbox.sendgrid_api_token.length.times.map { '*' }.join() %>"/>
|
||||
</dd>
|
||||
</dt>
|
||||
<p class="text-right">
|
||||
<%= link_to 'Edit',
|
||||
edit_mailbox_path,
|
||||
class: 'button',
|
||||
data: { action: 'click->remote-content#load' } %>
|
||||
<%= link_to 'Delete',
|
||||
mailbox_path(@mailbox),
|
||||
class: 'button button--danger',
|
||||
data: {
|
||||
confirm: 'Are you sure you want to delete this mailbox?',
|
||||
method: :delete } %>
|
||||
</p>
|
||||
<% end %>
|
||||
<% component.with(:footer) do %>
|
||||
<button data-action="click->modal#close" class="button">Close</button>
|
||||
<% end %>
|
||||
<% end %>
|
27
app/views/mailboxes/_form.html.erb
Normal file
27
app/views/mailboxes/_form.html.erb
Normal file
@ -0,0 +1,27 @@
|
||||
<%= form_for(@mailbox, remote: true, data: {
|
||||
controller: 'remote-form-modal',
|
||||
'remote-form-modal-target': 'form',
|
||||
'action': 'ajax:success->remote-form-modal#handleSuccess ajax:error->remote-form-modal#handleError' }) do |f| %>
|
||||
<div class="form-group">
|
||||
<%= f.label :name %>
|
||||
<%= f.text_field :name, class: 'form-control', autofocus: true %>
|
||||
<% if @mailbox.errors[:name].any? %>
|
||||
<p class="error-message">
|
||||
<% @mailbox.errors.full_messages_for(:name).each do |error_message| %>
|
||||
<%= error_message %>
|
||||
<% end %>
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= f.label :sendgrid_api_token %>
|
||||
<%= f.text_field :sendgrid_api_token, class: 'form-control' %>
|
||||
<% if @mailbox.errors[:sendgrid_api_token].any? %>
|
||||
<p class="error-message">
|
||||
<% @mailbox.errors.full_messages_for(:sendgrid_api_token).each do |error_message| %>
|
||||
<%= error_message %>
|
||||
<% end %>
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
9
app/views/mailboxes/edit.html.erb
Normal file
9
app/views/mailboxes/edit.html.erb
Normal file
@ -0,0 +1,9 @@
|
||||
<%= render ModalComponent.new(title: 'Edit Mailbox') do |component| %>
|
||||
<% component.with(:body) do %>
|
||||
<%= render('form') %>
|
||||
<% end %>
|
||||
<% component.with(:footer) do %>
|
||||
<button data-action="click->modal#close" class="button">Cancel</button>
|
||||
<input type="submit" form="edit_mailbox_<%= @mailbox.id %>" class="button button--primary" value="Save Mailbox">
|
||||
<% end %>
|
||||
<% end %>
|
11
app/views/mailboxes/index.html.erb
Normal file
11
app/views/mailboxes/index.html.erb
Normal file
@ -0,0 +1,11 @@
|
||||
<div>
|
||||
<p class="text-center">It seems you don't have any mailboxes yet.</p>
|
||||
<p class="text-center">Create your first mailbox now.</p>
|
||||
<div data-remote-content-url-value="<%= new_mailbox_path %>" data-controller="remote-content">
|
||||
<p class="text-center"><%= link_to 'New Mailbox',
|
||||
new_mailbox_path,
|
||||
class: "button button--primary",
|
||||
data: { action: 'click->remote-content#load' } %></p>
|
||||
<div data-remote-content-target="outlet"></div>
|
||||
</div>
|
||||
</div>
|
9
app/views/mailboxes/new.html.erb
Normal file
9
app/views/mailboxes/new.html.erb
Normal file
@ -0,0 +1,9 @@
|
||||
<%= render ModalComponent.new(title: 'New Mailbox') do |component| %>
|
||||
<% component.with(:body) do %>
|
||||
<%= render('form') %>
|
||||
<% end %>
|
||||
<% component.with(:footer) do %>
|
||||
<button data-action="click->modal#close" class="button">Cancel</button>
|
||||
<input type="submit" form="new_mailbox" class="button button--primary" value="Create Mailbox">
|
||||
<% end %>
|
||||
<% end %>
|
56
app/views/mailboxes/show.html.erb
Normal file
56
app/views/mailboxes/show.html.erb
Normal file
@ -0,0 +1,56 @@
|
||||
<section>
|
||||
<header class="header header--with-border">
|
||||
<div class="header--justified-header">
|
||||
<h1><%= @mailbox.name %> (<%= @mailbox.unread_count %>)</h1>
|
||||
<div data-controller="remote-content">
|
||||
<p>
|
||||
<%= link_to '🛈'.html_safe,
|
||||
details_mailbox_path(@mailbox),
|
||||
class: "button",
|
||||
data: { action: 'click->remote-content#load'} %>
|
||||
</p>
|
||||
<div data-remote-content-target="outlet"></div>
|
||||
</div>
|
||||
</div>
|
||||
<% if @emails.any? %>
|
||||
<p class="button-collection">
|
||||
<%= link_to 'Mark all as read',
|
||||
mark_all_as_read_mailbox_path(@mailbox),
|
||||
class: 'button button--primary',
|
||||
method: :post,
|
||||
'data-confirm': 'Are you sure you want to mark all emails as read?' %>
|
||||
<%= link_to 'Clear mailbox',
|
||||
clear_mailbox_mailbox_path(@mailbox),
|
||||
class: 'button button--danger',
|
||||
method: :post,
|
||||
'data-confirm': 'Are you sure you want to delete all emails?' %>
|
||||
</p>
|
||||
<% end %>
|
||||
</header>
|
||||
</section>
|
||||
|
||||
<% if @emails.any? %>
|
||||
<div class="email email--no-chrome">
|
||||
<b class="email__from">
|
||||
From
|
||||
</b>
|
||||
<b class="email__to">To</b>
|
||||
<b class="email__subject">Subject</b>
|
||||
<b class="email__created-at">Received At</b>
|
||||
</div>
|
||||
<% @emails.each do |email| %>
|
||||
<%= render(EmailListEntryComponent.new(email: email)) %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="text-center">
|
||||
<p>¯\_(ツ)_/¯</p>
|
||||
<p>You don't have any emails yet.</p>
|
||||
<p>Use this api token to send emails with sendgrid</p>
|
||||
<div class="width-50 centered input-group" data-controller="clipboard">
|
||||
<input data-clipboard-target="source" type="text" class="input-group__input form-control" readonly value="<%= @mailbox.sendgrid_mock_api_token %>"/>
|
||||
<div class="input-group__append">
|
||||
<a data-action="click->clipboard#copy" href="#">Copy</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
19
app/views/shared/_sidebar.html.erb
Normal file
19
app/views/shared/_sidebar.html.erb
Normal file
@ -0,0 +1,19 @@
|
||||
<div class="sidebar">
|
||||
<div class="sidebar__inner-container">
|
||||
<h1>PostDoc</h1>
|
||||
</div>
|
||||
<nav class="nav-list">
|
||||
<% mailboxes.each do |mailbox| %>
|
||||
<%= link_to mailbox.name, mailbox_path(mailbox), class: mailbox == current_mailbox ? 'active' : '' %>
|
||||
<% end %>
|
||||
</nav>
|
||||
<% if mailboxes.any? %>
|
||||
<div class="sidebar-bottom" data-remote-content-url-value="<%= new_mailbox_path %>" data-controller="remote-content">
|
||||
<%= link_to 'New Mailbox',
|
||||
new_mailbox_path,
|
||||
class: "button button--block button--primary",
|
||||
data: { action: 'click->remote-content#load' } %>
|
||||
<div data-remote-content-target="outlet"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
72
babel.config.js
Normal file
72
babel.config.js
Normal file
@ -0,0 +1,72 @@
|
||||
module.exports = function(api) {
|
||||
var validEnv = ['development', 'test', 'production']
|
||||
var currentEnv = api.env()
|
||||
var isDevelopmentEnv = api.env('development')
|
||||
var isProductionEnv = api.env('production')
|
||||
var isTestEnv = api.env('test')
|
||||
|
||||
if (!validEnv.includes(currentEnv)) {
|
||||
throw new Error(
|
||||
'Please specify a valid `NODE_ENV` or ' +
|
||||
'`BABEL_ENV` environment variables. Valid values are "development", ' +
|
||||
'"test", and "production". Instead, received: ' +
|
||||
JSON.stringify(currentEnv) +
|
||||
'.'
|
||||
)
|
||||
}
|
||||
|
||||
return {
|
||||
presets: [
|
||||
isTestEnv && [
|
||||
'@babel/preset-env',
|
||||
{
|
||||
targets: {
|
||||
node: 'current'
|
||||
}
|
||||
}
|
||||
],
|
||||
(isProductionEnv || isDevelopmentEnv) && [
|
||||
'@babel/preset-env',
|
||||
{
|
||||
forceAllTransforms: true,
|
||||
useBuiltIns: 'entry',
|
||||
corejs: 3,
|
||||
modules: false,
|
||||
exclude: ['transform-typeof-symbol']
|
||||
}
|
||||
]
|
||||
].filter(Boolean),
|
||||
plugins: [
|
||||
'babel-plugin-macros',
|
||||
'@babel/plugin-syntax-dynamic-import',
|
||||
isTestEnv && 'babel-plugin-dynamic-import-node',
|
||||
'@babel/plugin-transform-destructuring',
|
||||
[
|
||||
'@babel/plugin-proposal-class-properties',
|
||||
{
|
||||
loose: true
|
||||
}
|
||||
],
|
||||
[
|
||||
'@babel/plugin-proposal-object-rest-spread',
|
||||
{
|
||||
useBuiltIns: true
|
||||
}
|
||||
],
|
||||
[
|
||||
'@babel/plugin-transform-runtime',
|
||||
{
|
||||
helpers: false,
|
||||
regenerator: true,
|
||||
corejs: false
|
||||
}
|
||||
],
|
||||
[
|
||||
'@babel/plugin-transform-regenerator',
|
||||
{
|
||||
async: false
|
||||
}
|
||||
]
|
||||
].filter(Boolean)
|
||||
}
|
||||
}
|
114
bin/bundle
Executable file
114
bin/bundle
Executable file
@ -0,0 +1,114 @@
|
||||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
#
|
||||
# This file was generated by Bundler.
|
||||
#
|
||||
# The application 'bundle' is installed as part of a gem, and
|
||||
# this file is here to facilitate running it.
|
||||
#
|
||||
|
||||
require "rubygems"
|
||||
|
||||
m = Module.new do
|
||||
module_function
|
||||
|
||||
def invoked_as_script?
|
||||
File.expand_path($0) == File.expand_path(__FILE__)
|
||||
end
|
||||
|
||||
def env_var_version
|
||||
ENV["BUNDLER_VERSION"]
|
||||
end
|
||||
|
||||
def cli_arg_version
|
||||
return unless invoked_as_script? # don't want to hijack other binstubs
|
||||
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
|
||||
bundler_version = nil
|
||||
update_index = nil
|
||||
ARGV.each_with_index do |a, i|
|
||||
if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
|
||||
bundler_version = a
|
||||
end
|
||||
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
|
||||
bundler_version = $1
|
||||
update_index = i
|
||||
end
|
||||
bundler_version
|
||||
end
|
||||
|
||||
def gemfile
|
||||
gemfile = ENV["BUNDLE_GEMFILE"]
|
||||
return gemfile if gemfile && !gemfile.empty?
|
||||
|
||||
File.expand_path("../../Gemfile", __FILE__)
|
||||
end
|
||||
|
||||
def lockfile
|
||||
lockfile =
|
||||
case File.basename(gemfile)
|
||||
when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
|
||||
else "#{gemfile}.lock"
|
||||
end
|
||||
File.expand_path(lockfile)
|
||||
end
|
||||
|
||||
def lockfile_version
|
||||
return unless File.file?(lockfile)
|
||||
lockfile_contents = File.read(lockfile)
|
||||
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
|
||||
Regexp.last_match(1)
|
||||
end
|
||||
|
||||
def bundler_version
|
||||
@bundler_version ||=
|
||||
env_var_version || cli_arg_version ||
|
||||
lockfile_version
|
||||
end
|
||||
|
||||
def bundler_requirement
|
||||
return "#{Gem::Requirement.default}.a" unless bundler_version
|
||||
|
||||
bundler_gem_version = Gem::Version.new(bundler_version)
|
||||
|
||||
requirement = bundler_gem_version.approximate_recommendation
|
||||
|
||||
return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
|
||||
|
||||
requirement += ".a" if bundler_gem_version.prerelease?
|
||||
|
||||
requirement
|
||||
end
|
||||
|
||||
def load_bundler!
|
||||
ENV["BUNDLE_GEMFILE"] ||= gemfile
|
||||
|
||||
activate_bundler
|
||||
end
|
||||
|
||||
def activate_bundler
|
||||
gem_error = activation_error_handling do
|
||||
gem "bundler", bundler_requirement
|
||||
end
|
||||
return if gem_error.nil?
|
||||
require_error = activation_error_handling do
|
||||
require "bundler/version"
|
||||
end
|
||||
return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
||||
warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
|
||||
exit 42
|
||||
end
|
||||
|
||||
def activation_error_handling
|
||||
yield
|
||||
nil
|
||||
rescue StandardError, LoadError => e
|
||||
e
|
||||
end
|
||||
end
|
||||
|
||||
m.load_bundler!
|
||||
|
||||
if m.invoked_as_script?
|
||||
load Gem.bin_path("bundler", "bundle")
|
||||
end
|
9
bin/rails
Executable file
9
bin/rails
Executable file
@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env ruby
|
||||
begin
|
||||
load File.expand_path('../spring', __FILE__)
|
||||
rescue LoadError => e
|
||||
raise unless e.message.include?('spring')
|
||||
end
|
||||
APP_PATH = File.expand_path('../config/application', __dir__)
|
||||
require_relative '../config/boot'
|
||||
require 'rails/commands'
|
9
bin/rake
Executable file
9
bin/rake
Executable file
@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env ruby
|
||||
begin
|
||||
load File.expand_path('../spring', __FILE__)
|
||||
rescue LoadError => e
|
||||
raise unless e.message.include?('spring')
|
||||
end
|
||||
require_relative '../config/boot'
|
||||
require 'rake'
|
||||
Rake.application.run
|
36
bin/setup
Executable file
36
bin/setup
Executable file
@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env ruby
|
||||
require 'fileutils'
|
||||
|
||||
# path to your application root.
|
||||
APP_ROOT = File.expand_path('..', __dir__)
|
||||
|
||||
def system!(*args)
|
||||
system(*args) || abort("\n== Command #{args} failed ==")
|
||||
end
|
||||
|
||||
FileUtils.chdir APP_ROOT do
|
||||
# This script is a way to setup or update your development environment automatically.
|
||||
# This script is idempotent, so that you can run it at anytime and get an expectable outcome.
|
||||
# Add necessary setup steps to this file.
|
||||
|
||||
puts '== Installing dependencies =='
|
||||
system! 'gem install bundler --conservative'
|
||||
system('bundle check') || system!('bundle install')
|
||||
|
||||
# Install JavaScript dependencies
|
||||
# system('bin/yarn')
|
||||
|
||||
# puts "\n== Copying sample files =="
|
||||
# unless File.exist?('config/database.yml')
|
||||
# FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
|
||||
# end
|
||||
|
||||
puts "\n== Preparing database =="
|
||||
system! 'bin/rails db:prepare'
|
||||
|
||||
puts "\n== Removing old logs and tempfiles =="
|
||||
system! 'bin/rails log:clear tmp:clear'
|
||||
|
||||
puts "\n== Restarting application server =="
|
||||
system! 'bin/rails restart'
|
||||
end
|
17
bin/spring
Executable file
17
bin/spring
Executable file
@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
# This file loads Spring without using Bundler, in order to be fast.
|
||||
# It gets overwritten when you run the `spring binstub` command.
|
||||
|
||||
unless defined?(Spring)
|
||||
require 'rubygems'
|
||||
require 'bundler'
|
||||
|
||||
lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
|
||||
spring = lockfile.specs.detect { |spec| spec.name == 'spring' }
|
||||
if spring
|
||||
Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
|
||||
gem 'spring', spring.version
|
||||
require 'spring/binstub'
|
||||
end
|
||||
end
|
18
bin/webpack
Executable file
18
bin/webpack
Executable file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
|
||||
ENV["NODE_ENV"] ||= "development"
|
||||
|
||||
require "pathname"
|
||||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
||||
Pathname.new(__FILE__).realpath)
|
||||
|
||||
require "bundler/setup"
|
||||
|
||||
require "webpacker"
|
||||
require "webpacker/webpack_runner"
|
||||
|
||||
APP_ROOT = File.expand_path("..", __dir__)
|
||||
Dir.chdir(APP_ROOT) do
|
||||
Webpacker::WebpackRunner.run(ARGV)
|
||||
end
|
18
bin/webpack-dev-server
Executable file
18
bin/webpack-dev-server
Executable file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
|
||||
ENV["NODE_ENV"] ||= "development"
|
||||
|
||||
require "pathname"
|
||||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
||||
Pathname.new(__FILE__).realpath)
|
||||
|
||||
require "bundler/setup"
|
||||
|
||||
require "webpacker"
|
||||
require "webpacker/dev_server_runner"
|
||||
|
||||
APP_ROOT = File.expand_path("..", __dir__)
|
||||
Dir.chdir(APP_ROOT) do
|
||||
Webpacker::DevServerRunner.run(ARGV)
|
||||
end
|
11
bin/yarn
Executable file
11
bin/yarn
Executable file
@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env ruby
|
||||
APP_ROOT = File.expand_path('..', __dir__)
|
||||
Dir.chdir(APP_ROOT) do
|
||||
begin
|
||||
exec "yarnpkg", *ARGV
|
||||
rescue Errno::ENOENT
|
||||
$stderr.puts "Yarn executable was not detected in the system."
|
||||
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
|
||||
exit 1
|
||||
end
|
||||
end
|
5
config.ru
Normal file
5
config.ru
Normal file
@ -0,0 +1,5 @@
|
||||
# This file is used by Rack-based servers to start the application.
|
||||
|
||||
require_relative 'config/environment'
|
||||
|
||||
run Rails.application
|
73
config/CODE_OF_CONDUCT.txt
Normal file
73
config/CODE_OF_CONDUCT.txt
Normal file
@ -0,0 +1,73 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, gender identity and expression, level of experience,
|
||||
education, socio-economic status, nationality, personal appearance, race,
|
||||
religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community. Examples of
|
||||
representing a project or community include using an official project e-mail
|
||||
address, posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event. Representation of a project may be
|
||||
further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at {{ email }}. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
19
config/application.rb
Normal file
19
config/application.rb
Normal file
@ -0,0 +1,19 @@
|
||||
require_relative 'boot'
|
||||
|
||||
require 'rails/all'
|
||||
|
||||
# Require the gems listed in Gemfile, including any gems
|
||||
# you've limited to :test, :development, or :production.
|
||||
Bundler.require(*Rails.groups)
|
||||
|
||||
module Postdoc
|
||||
class Application < Rails::Application
|
||||
# Initialize configuration defaults for originally generated Rails version.
|
||||
config.load_defaults 6.0
|
||||
|
||||
# Settings in config/environments/* take precedence over those specified here.
|
||||
# Application configuration can go into files in config/initializers
|
||||
# -- all .rb files in that directory are automatically loaded after loading
|
||||
# the framework and any gems in your application.
|
||||
end
|
||||
end
|
4
config/boot.rb
Normal file
4
config/boot.rb
Normal file
@ -0,0 +1,4 @@
|
||||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
|
||||
|
||||
require 'bundler/setup' # Set up gems listed in the Gemfile.
|
||||
require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
|
10
config/cable.yml
Normal file
10
config/cable.yml
Normal file
@ -0,0 +1,10 @@
|
||||
development:
|
||||
adapter: async
|
||||
|
||||
test:
|
||||
adapter: test
|
||||
|
||||
production:
|
||||
adapter: redis
|
||||
url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
|
||||
channel_prefix: postdoc_production
|
85
config/database.yml.example
Normal file
85
config/database.yml.example
Normal file
@ -0,0 +1,85 @@
|
||||
# PostgreSQL. Versions 9.3 and up are supported.
|
||||
#
|
||||
# Install the pg driver:
|
||||
# gem install pg
|
||||
# On macOS with Homebrew:
|
||||
# gem install pg -- --with-pg-config=/usr/local/bin/pg_config
|
||||
# On macOS with MacPorts:
|
||||
# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
|
||||
# On Windows:
|
||||
# gem install pg
|
||||
# Choose the win32 build.
|
||||
# Install PostgreSQL and put its /bin directory on your path.
|
||||
#
|
||||
# Configure Using Gemfile
|
||||
# gem 'pg'
|
||||
#
|
||||
default: &default
|
||||
adapter: postgresql
|
||||
encoding: unicode
|
||||
# For details on connection pooling, see Rails configuration guide
|
||||
# https://guides.rubyonrails.org/configuring.html#database-pooling
|
||||
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
||||
|
||||
development:
|
||||
<<: *default
|
||||
database: postdoc_development
|
||||
|
||||
# The specified database role being used to connect to postgres.
|
||||
# To create additional roles in postgres see `$ createuser --help`.
|
||||
# When left blank, postgres will use the default role. This is
|
||||
# the same name as the operating system user that initialized the database.
|
||||
#username: postdoc
|
||||
|
||||
# The password associated with the postgres role (username).
|
||||
#password:
|
||||
|
||||
# Connect on a TCP socket. Omitted by default since the client uses a
|
||||
# domain socket that doesn't need configuration. Windows does not have
|
||||
# domain sockets, so uncomment these lines.
|
||||
#host: localhost
|
||||
|
||||
# The TCP port the server listens on. Defaults to 5432.
|
||||
# If your server runs on a different port number, change accordingly.
|
||||
#port: 5432
|
||||
|
||||
# Schema search path. The server defaults to $user,public
|
||||
#schema_search_path: myapp,sharedapp,public
|
||||
|
||||
# Minimum log levels, in increasing order:
|
||||
# debug5, debug4, debug3, debug2, debug1,
|
||||
# log, notice, warning, error, fatal, and panic
|
||||
# Defaults to warning.
|
||||
#min_messages: notice
|
||||
|
||||
# Warning: The database defined as "test" will be erased and
|
||||
# re-generated from your development database when you run "rake".
|
||||
# Do not set this db to the same as development or production.
|
||||
test:
|
||||
<<: *default
|
||||
database: postdoc_test
|
||||
|
||||
# As with config/credentials.yml, you never want to store sensitive information,
|
||||
# like your database password, in your source code. If your source code is
|
||||
# ever seen by anyone, they now have access to your database.
|
||||
#
|
||||
# Instead, provide the password as a unix environment variable when you boot
|
||||
# the app. Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
|
||||
# for a full rundown on how to provide these environment variables in a
|
||||
# production deployment.
|
||||
#
|
||||
# On Heroku and other platform providers, you may have a full connection URL
|
||||
# available as an environment variable. For example:
|
||||
#
|
||||
# DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
|
||||
#
|
||||
# You can use this database configuration with:
|
||||
#
|
||||
# production:
|
||||
# url: <%= ENV['DATABASE_URL'] %>
|
||||
#
|
||||
production:
|
||||
<<: *default
|
||||
database: postdoc_production
|
||||
username: postdoc
|
||||
password: <%= ENV['POSTDOC_DATABASE_PASSWORD'] %>
|
5
config/environment.rb
Normal file
5
config/environment.rb
Normal file
@ -0,0 +1,5 @@
|
||||
# Load the Rails application.
|
||||
require_relative 'application'
|
||||
|
||||
# Initialize the Rails application.
|
||||
Rails.application.initialize!
|
62
config/environments/development.rb
Normal file
62
config/environments/development.rb
Normal file
@ -0,0 +1,62 @@
|
||||
Rails.application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb.
|
||||
|
||||
# In the development environment your application's code is reloaded on
|
||||
# every request. This slows down response time but is perfect for development
|
||||
# since you don't have to restart the web server when you make code changes.
|
||||
config.cache_classes = false
|
||||
|
||||
# Do not eager load code on boot.
|
||||
config.eager_load = false
|
||||
|
||||
# Show full error reports.
|
||||
config.consider_all_requests_local = true
|
||||
|
||||
# Enable/disable caching. By default caching is disabled.
|
||||
# Run rails dev:cache to toggle caching.
|
||||
if Rails.root.join('tmp', 'caching-dev.txt').exist?
|
||||
config.action_controller.perform_caching = true
|
||||
config.action_controller.enable_fragment_cache_logging = true
|
||||
|
||||
config.cache_store = :memory_store
|
||||
config.public_file_server.headers = {
|
||||
'Cache-Control' => "public, max-age=#{2.days.to_i}"
|
||||
}
|
||||
else
|
||||
config.action_controller.perform_caching = false
|
||||
|
||||
config.cache_store = :null_store
|
||||
end
|
||||
|
||||
# Store uploaded files on the local file system (see config/storage.yml for options).
|
||||
config.active_storage.service = :local
|
||||
|
||||
# Don't care if the mailer can't send.
|
||||
config.action_mailer.raise_delivery_errors = false
|
||||
|
||||
config.action_mailer.perform_caching = false
|
||||
|
||||
# Print deprecation notices to the Rails logger.
|
||||
config.active_support.deprecation = :log
|
||||
|
||||
# Raise an error on page load if there are pending migrations.
|
||||
config.active_record.migration_error = :page_load
|
||||
|
||||
# Highlight code that triggered database queries in logs.
|
||||
config.active_record.verbose_query_logs = true
|
||||
|
||||
# Debug mode disables concatenation and preprocessing of assets.
|
||||
# This option may cause significant delays in view rendering with a large
|
||||
# number of complex assets.
|
||||
config.assets.debug = true
|
||||
|
||||
# Suppress logger output for asset requests.
|
||||
config.assets.quiet = true
|
||||
|
||||
# Raises error for missing translations.
|
||||
# config.action_view.raise_on_missing_translations = true
|
||||
|
||||
# Use an evented file watcher to asynchronously detect changes in source code,
|
||||
# routes, locales, etc. This feature depends on the listen gem.
|
||||
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
||||
end
|
112
config/environments/production.rb
Normal file
112
config/environments/production.rb
Normal file
@ -0,0 +1,112 @@
|
||||
Rails.application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb.
|
||||
|
||||
# Code is not reloaded between requests.
|
||||
config.cache_classes = true
|
||||
|
||||
# Eager load code on boot. This eager loads most of Rails and
|
||||
# your application in memory, allowing both threaded web servers
|
||||
# and those relying on copy on write to perform better.
|
||||
# Rake tasks automatically ignore this option for performance.
|
||||
config.eager_load = true
|
||||
|
||||
# Full error reports are disabled and caching is turned on.
|
||||
config.consider_all_requests_local = false
|
||||
config.action_controller.perform_caching = true
|
||||
|
||||
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
|
||||
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
|
||||
# config.require_master_key = true
|
||||
|
||||
# Disable serving static files from the `/public` folder by default since
|
||||
# Apache or NGINX already handles this.
|
||||
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
||||
|
||||
# Compress CSS using a preprocessor.
|
||||
# config.assets.css_compressor = :sass
|
||||
|
||||
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
||||
config.assets.compile = false
|
||||
|
||||
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
||||
# config.action_controller.asset_host = 'http://assets.example.com'
|
||||
|
||||
# Specifies the header that your server uses for sending files.
|
||||
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
||||
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
||||
|
||||
# Store uploaded files on the local file system (see config/storage.yml for options).
|
||||
config.active_storage.service = :local
|
||||
|
||||
# Mount Action Cable outside main process or domain.
|
||||
# config.action_cable.mount_path = nil
|
||||
# config.action_cable.url = 'wss://example.com/cable'
|
||||
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
|
||||
|
||||
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
||||
# config.force_ssl = true
|
||||
|
||||
# Use the lowest log level to ensure availability of diagnostic information
|
||||
# when problems arise.
|
||||
config.log_level = :debug
|
||||
|
||||
# Prepend all log lines with the following tags.
|
||||
config.log_tags = [ :request_id ]
|
||||
|
||||
# Use a different cache store in production.
|
||||
# config.cache_store = :mem_cache_store
|
||||
|
||||
# Use a real queuing backend for Active Job (and separate queues per environment).
|
||||
# config.active_job.queue_adapter = :resque
|
||||
# config.active_job.queue_name_prefix = "postdoc_production"
|
||||
|
||||
config.action_mailer.perform_caching = false
|
||||
|
||||
# Ignore bad email addresses and do not raise email delivery errors.
|
||||
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
||||
# config.action_mailer.raise_delivery_errors = false
|
||||
|
||||
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
||||
# the I18n.default_locale when a translation cannot be found).
|
||||
config.i18n.fallbacks = true
|
||||
|
||||
# Send deprecation notices to registered listeners.
|
||||
config.active_support.deprecation = :notify
|
||||
|
||||
# Use default logging formatter so that PID and timestamp are not suppressed.
|
||||
config.log_formatter = ::Logger::Formatter.new
|
||||
|
||||
# Use a different logger for distributed setups.
|
||||
# require 'syslog/logger'
|
||||
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
|
||||
|
||||
if ENV["RAILS_LOG_TO_STDOUT"].present?
|
||||
logger = ActiveSupport::Logger.new(STDOUT)
|
||||
logger.formatter = config.log_formatter
|
||||
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
||||
end
|
||||
|
||||
# Do not dump schema after migrations.
|
||||
config.active_record.dump_schema_after_migration = false
|
||||
|
||||
# Inserts middleware to perform automatic connection switching.
|
||||
# The `database_selector` hash is used to pass options to the DatabaseSelector
|
||||
# middleware. The `delay` is used to determine how long to wait after a write
|
||||
# to send a subsequent read to the primary.
|
||||
#
|
||||
# The `database_resolver` class is used by the middleware to determine which
|
||||
# database is appropriate to use based on the time delay.
|
||||
#
|
||||
# The `database_resolver_context` class is used by the middleware to set
|
||||
# timestamps for the last write to the primary. The resolver uses the context
|
||||
# class timestamps to determine how long to wait before reading from the
|
||||
# replica.
|
||||
#
|
||||
# By default Rails will store a last write timestamp in the session. The
|
||||
# DatabaseSelector middleware is designed as such you can define your own
|
||||
# strategy for connection switching and pass that into the middleware through
|
||||
# these configuration options.
|
||||
# config.active_record.database_selector = { delay: 2.seconds }
|
||||
# config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
|
||||
# config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
|
||||
end
|
49
config/environments/test.rb
Normal file
49
config/environments/test.rb
Normal file
@ -0,0 +1,49 @@
|
||||
# The test environment is used exclusively to run your application's
|
||||
# test suite. You never need to work with it otherwise. Remember that
|
||||
# your test database is "scratch space" for the test suite and is wiped
|
||||
# and recreated between test runs. Don't rely on the data there!
|
||||
|
||||
Rails.application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb.
|
||||
|
||||
config.cache_classes = false
|
||||
config.action_view.cache_template_loading = true
|
||||
|
||||
# Do not eager load code on boot. This avoids loading your whole application
|
||||
# just for the purpose of running a single test. If you are using a tool that
|
||||
# preloads Rails for running tests, you may have to set it to true.
|
||||
config.eager_load = false
|
||||
|
||||
# Configure public file server for tests with Cache-Control for performance.
|
||||
config.public_file_server.enabled = true
|
||||
config.public_file_server.headers = {
|
||||
'Cache-Control' => "public, max-age=#{1.hour.to_i}"
|
||||
}
|
||||
|
||||
# Show full error reports and disable caching.
|
||||
config.consider_all_requests_local = true
|
||||
config.action_controller.perform_caching = false
|
||||
config.cache_store = :null_store
|
||||
|
||||
# Raise exceptions instead of rendering exception templates.
|
||||
config.action_dispatch.show_exceptions = false
|
||||
|
||||
# Disable request forgery protection in test environment.
|
||||
config.action_controller.allow_forgery_protection = false
|
||||
|
||||
# Store uploaded files on the local file system in a temporary directory.
|
||||
config.active_storage.service = :test
|
||||
|
||||
config.action_mailer.perform_caching = false
|
||||
|
||||
# Tell Action Mailer not to deliver emails to the real world.
|
||||
# The :test delivery method accumulates sent emails in the
|
||||
# ActionMailer::Base.deliveries array.
|
||||
config.action_mailer.delivery_method = :test
|
||||
|
||||
# Print deprecation notices to the stderr.
|
||||
config.active_support.deprecation = :stderr
|
||||
|
||||
# Raises error for missing translations.
|
||||
# config.action_view.raise_on_missing_translations = true
|
||||
end
|
8
config/initializers/application_controller_renderer.rb
Normal file
8
config/initializers/application_controller_renderer.rb
Normal file
@ -0,0 +1,8 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# ActiveSupport::Reloader.to_prepare do
|
||||
# ApplicationController.renderer.defaults.merge!(
|
||||
# http_host: 'example.org',
|
||||
# https: false
|
||||
# )
|
||||
# end
|
14
config/initializers/assets.rb
Normal file
14
config/initializers/assets.rb
Normal file
@ -0,0 +1,14 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Version of your assets, change this if you want to expire all your assets.
|
||||
Rails.application.config.assets.version = '1.0'
|
||||
|
||||
# Add additional assets to the asset load path.
|
||||
# Rails.application.config.assets.paths << Emoji.images_path
|
||||
# Add Yarn node_modules folder to the asset load path.
|
||||
Rails.application.config.assets.paths << Rails.root.join('node_modules')
|
||||
|
||||
# Precompile additional assets.
|
||||
# application.js, application.css, and all non-JS/CSS in the app/assets
|
||||
# folder are already added.
|
||||
# Rails.application.config.assets.precompile += %w( admin.js admin.css )
|
7
config/initializers/backtrace_silencers.rb
Normal file
7
config/initializers/backtrace_silencers.rb
Normal file
@ -0,0 +1,7 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
||||
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
||||
|
||||
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
||||
# Rails.backtrace_cleaner.remove_silencers!
|
30
config/initializers/content_security_policy.rb
Normal file
30
config/initializers/content_security_policy.rb
Normal file
@ -0,0 +1,30 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Define an application-wide content security policy
|
||||
# For further information see the following documentation
|
||||
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
|
||||
|
||||
# Rails.application.config.content_security_policy do |policy|
|
||||
# policy.default_src :self, :https
|
||||
# policy.font_src :self, :https, :data
|
||||
# policy.img_src :self, :https, :data
|
||||
# policy.object_src :none
|
||||
# policy.script_src :self, :https
|
||||
# policy.style_src :self, :https
|
||||
# # If you are using webpack-dev-server then specify webpack-dev-server host
|
||||
# policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development?
|
||||
|
||||
# # Specify URI for violation reports
|
||||
# # policy.report_uri "/csp-violation-report-endpoint"
|
||||
# end
|
||||
|
||||
# If you are using UJS then enable automatic nonce generation
|
||||
# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
|
||||
|
||||
# Set the nonce only to specific directives
|
||||
# Rails.application.config.content_security_policy_nonce_directives = %w(script-src)
|
||||
|
||||
# Report CSP violations to a specified URI
|
||||
# For further information see the following documentation:
|
||||
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
|
||||
# Rails.application.config.content_security_policy_report_only = true
|
5
config/initializers/cookies_serializer.rb
Normal file
5
config/initializers/cookies_serializer.rb
Normal file
@ -0,0 +1,5 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Specify a serializer for the signed and encrypted cookie jars.
|
||||
# Valid options are :json, :marshal, and :hybrid.
|
||||
Rails.application.config.action_dispatch.cookies_serializer = :json
|
4
config/initializers/filter_parameter_logging.rb
Normal file
4
config/initializers/filter_parameter_logging.rb
Normal file
@ -0,0 +1,4 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Configure sensitive parameters which will be filtered from the log file.
|
||||
Rails.application.config.filter_parameters += [:password]
|
16
config/initializers/inflections.rb
Normal file
16
config/initializers/inflections.rb
Normal file
@ -0,0 +1,16 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Add new inflection rules using the following format. Inflections
|
||||
# are locale specific, and you may define rules for as many different
|
||||
# locales as you wish. All of these examples are active by default:
|
||||
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
||||
# inflect.plural /^(ox)$/i, '\1en'
|
||||
# inflect.singular /^(ox)en/i, '\1'
|
||||
# inflect.irregular 'person', 'people'
|
||||
# inflect.uncountable %w( fish sheep )
|
||||
# end
|
||||
|
||||
# These inflection rules are supported but not enabled by default:
|
||||
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
||||
# inflect.acronym 'RESTful'
|
||||
# end
|
4
config/initializers/mime_types.rb
Normal file
4
config/initializers/mime_types.rb
Normal file
@ -0,0 +1,4 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Add new mime types for use in respond_to blocks:
|
||||
# Mime::Type.register "text/richtext", :rtf
|
14
config/initializers/wrap_parameters.rb
Normal file
14
config/initializers/wrap_parameters.rb
Normal file
@ -0,0 +1,14 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# This file contains settings for ActionController::ParamsWrapper which
|
||||
# is enabled by default.
|
||||
|
||||
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
||||
ActiveSupport.on_load(:action_controller) do
|
||||
wrap_parameters format: [:json]
|
||||
end
|
||||
|
||||
# To enable root element in JSON for ActiveRecord objects.
|
||||
# ActiveSupport.on_load(:active_record) do
|
||||
# self.include_root_in_json = true
|
||||
# end
|
33
config/locales/en.yml
Normal file
33
config/locales/en.yml
Normal file
@ -0,0 +1,33 @@
|
||||
# Files in the config/locales directory are used for internationalization
|
||||
# and are automatically loaded by Rails. If you want to use locales other
|
||||
# than English, add the necessary files in this directory.
|
||||
#
|
||||
# To use the locales, use `I18n.t`:
|
||||
#
|
||||
# I18n.t 'hello'
|
||||
#
|
||||
# In views, this is aliased to just `t`:
|
||||
#
|
||||
# <%= t('hello') %>
|
||||
#
|
||||
# To use a different locale, set it with `I18n.locale`:
|
||||
#
|
||||
# I18n.locale = :es
|
||||
#
|
||||
# This would use the information in config/locales/es.yml.
|
||||
#
|
||||
# The following keys must be escaped otherwise they will not be retrieved by
|
||||
# the default I18n backend:
|
||||
#
|
||||
# true, false, on, off, yes, no
|
||||
#
|
||||
# Instead, surround them with single quotes.
|
||||
#
|
||||
# en:
|
||||
# 'true': 'foo'
|
||||
#
|
||||
# To learn more, please read the Rails Internationalization guide
|
||||
# available at https://guides.rubyonrails.org/i18n.html.
|
||||
|
||||
en:
|
||||
hello: "Hello world"
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user