-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from dwyl/edit-response
Edit response
- Loading branch information
Showing
87 changed files
with
2,611 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
https://github.com/dscout/wkhtmltopdf-buildpack.git | ||
https://github.com/HashNuke/heroku-buildpack-elixir.git | ||
https://github.com/gjaldon/heroku-buildpack-phoenix-static.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,5 +27,4 @@ erl_crash.dump | |
cover | ||
|
||
# Environment Variables | ||
|
||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
web: MIX_ENV=prod mix run priv/repo/seeds.exs && mix phoenix.server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,9 +53,21 @@ We recommend reading: https://github.com/dwyl/learn-phoenix-framework | |
|
||
### Get Started in _2 Minutes_ | ||
|
||
|
||
+ Clone the Git repository: `git clone [email protected]:dwyl/feedback.git && cd feedback` | ||
+ Install dependencies with `mix deps.get && npm install` | ||
+ Create and migrate your database with `mix ecto.create && mix ecto.migrate` | ||
+ Set environment variables: | ||
+ ADMIN_EMAIL - the email that you want to log in with (must also be verified by AWS) | ||
+ ADMIN_PASSWORD - the password you want to log in with | ||
+ SECRET_KEY_BASE - taken from `config.exs` | ||
+ TARGET_EMAIL - verified SES email for testing | ||
+ SES_SERVER - your SES server | ||
+ SES_PORT - your SES port | ||
+ SMTP_USERNAME - your SMTP username | ||
+ SMTP_PASSWORD - your SMTP password | ||
+ Run `priv/repo/seeds.exs` | ||
+ Run `source .env` to load your environment variables | ||
+ Start Phoenix endpoint with `mix phoenix.server` | ||
|
||
Now visit [`localhost:4000`](http://localhost:4000) from your web browser. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
always_rebuild=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
defmodule Feedback.Email do | ||
use Bamboo.Phoenix, view: Feedback.FeedbackView | ||
|
||
def send_email(to_email_address, subject, message) do | ||
new_email() | ||
|> to(to_email_address) | ||
|> from(System.get_env("ADMIN_EMAIL")) # also needs to be a validated email | ||
|> subject(subject) | ||
|> text_body(message) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
defmodule Feedback.Mailer do | ||
use Bamboo.Mailer, otp_app: :feedback | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
defmodule Feedback.Repo.Migrations.AddMoodToFeedback do | ||
use Ecto.Migration | ||
|
||
def change do | ||
alter table(:feedback) do | ||
add :mood, :string | ||
end | ||
end | ||
end |
9 changes: 9 additions & 0 deletions
9
priv/repo/migrations/20170413200800_add_privacy_to_feedback.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
defmodule Feedback.Repo.Migrations.AddPrivacyToFeedback do | ||
use Ecto.Migration | ||
|
||
def change do | ||
alter table(:feedback) do | ||
add :private, :boolean | ||
end | ||
end | ||
end |
9 changes: 9 additions & 0 deletions
9
priv/repo/migrations/20170413213659_add_public_to_feedback.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
defmodule Feedback.Repo.Migrations.AddPublicToFeedback do | ||
use Ecto.Migration | ||
|
||
def change do | ||
alter table(:feedback) do | ||
add :public, :boolean | ||
end | ||
end | ||
end |
9 changes: 9 additions & 0 deletions
9
priv/repo/migrations/20170413214226_remove_private_from_feedback.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
defmodule Feedback.Repo.Migrations.RemovePrivateFromFeedback do | ||
use Ecto.Migration | ||
|
||
def change do | ||
alter table(:feedback) do | ||
remove :private | ||
end | ||
end | ||
end |
9 changes: 9 additions & 0 deletions
9
priv/repo/migrations/20170418184335_add_responded_at_to_feedback.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
defmodule Feedback.Repo.Migrations.AddRespondedAtToFeedback do | ||
use Ecto.Migration | ||
|
||
def change do | ||
alter table(:feedback) do | ||
add :responded_at, :date | ||
end | ||
end | ||
end |
9 changes: 9 additions & 0 deletions
9
priv/repo/migrations/20170418191425_remove_responded_from_feedback.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
defmodule Feedback.Repo.Migrations.RemoveRespondedFromFeedback do | ||
use Ecto.Migration | ||
|
||
def change do | ||
alter table(:feedback) do | ||
remove :responded | ||
end | ||
end | ||
end |
10 changes: 10 additions & 0 deletions
10
priv/repo/migrations/20170419174138_add_edit_to_feedback.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
defmodule Feedback.Repo.Migrations.AddEditToFeedback do | ||
use Ecto.Migration | ||
|
||
def change do | ||
alter table(:feedback) do | ||
add :edit, :boolean | ||
add :edited, :boolean | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
defmodule Feedback.Repo.Migrations.CreateResponse do | ||
use Ecto.Migration | ||
|
||
def change do | ||
create table(:response) do | ||
add :response, :text | ||
add :edit, :boolean | ||
add :edited, :boolean | ||
add :feedback_id, references(:feedback, on_delete: :delete_all) | ||
|
||
timestamps() | ||
end | ||
|
||
create index(:response, [:feedback_id]) | ||
end | ||
end |
9 changes: 9 additions & 0 deletions
9
priv/repo/migrations/20170425155958_remove_response_from_feedback.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
defmodule Feedback.Repo.Migrations.RemoveResponseFromFeedback do | ||
use Ecto.Migration | ||
|
||
def change do | ||
alter table(:feedback) do | ||
remove :response | ||
end | ||
end | ||
end |
9 changes: 9 additions & 0 deletions
9
priv/repo/migrations/20170425160206_remove_responded_at_from_feedback.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
defmodule Feedback.Repo.Migrations.RemoveRespondedAtFromFeedback do | ||
use Ecto.Migration | ||
|
||
def change do | ||
alter table(:feedback) do | ||
remove :responded_at | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
# Script for populating the database. You can run it as: | ||
# | ||
# mix run priv/repo/seeds.exs | ||
# | ||
# Inside the script, you can read and write to any of your | ||
# repositories directly: | ||
# | ||
# Feedback.Repo.insert!(%Feedback.SomeModel{}) | ||
# | ||
# We recommend using the bang functions (`insert!`, `update!` | ||
# and so on) as they will fail if something goes wrong. | ||
alias Feedback.{Repo, User} | ||
|
||
case Repo.get_by(User, first_name: "Admin") do | ||
nil -> | ||
Repo.insert! %User{ | ||
first_name: "Admin", | ||
last_name: "Account", | ||
email: System.get_env("ADMIN_EMAIL"), | ||
password: System.get_env("ADMIN_PASSWORD"), | ||
password_hash: Comeonin.Bcrypt.hashpwsalt(System.get_env("ADMIN_PASSWORD")) | ||
} | ||
_user -> IO.puts "Admin already in database" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
defmodule Feedback.RoomChannelTest do | ||
use Feedback.ChannelCase | ||
alias Feedback.RoomChannel | ||
|
||
setup do | ||
{:ok, _, socket} = | ||
socket("responded", %{body: "body"}) | ||
|> subscribe_and_join(RoomChannel, "room:lobby") | ||
|
||
{:ok, socket: socket} | ||
end | ||
|
||
test "responded replies with status ok", %{socket: socket} do | ||
push socket, "responded", %{body: "body"} | ||
assert_broadcast "responded", %{body: "body"} | ||
leave socket | ||
end | ||
end |
Oops, something went wrong.