Fix tests

This commit is contained in:
Jamil Bou Kheir
2020-07-21 21:47:27 -05:00
parent e78b012971
commit 78275a5186
8 changed files with 390 additions and 775 deletions

View File

@@ -33,7 +33,7 @@ jobs:
uses: actions/setup-elixir@v1
with:
elixir-version: "1.10.4"
otp-version: "23.0.2"
otp-version: "23.0.3"
- name: Install Dependencies
run: mix deps.get --only test
- name: Setup Database

View File

@@ -1,4 +1,4 @@
elixir 1.10.4-otp-23
erlang 23.0.2
erlang 23.0.3
nodejs 10.20.1
python 3.7.7

File diff suppressed because it is too large Load Diff

View File

@@ -12,10 +12,10 @@
"qrcode": "^1.4.4"
},
"devDependencies": {
"@babel/core": "^7.10.4",
"@babel/core": "^7.10.5",
"@babel/preset-env": "^7.10.4",
"@fortawesome/fontawesome-free": "^5.13.1",
"autoprefixer": "^9.8.4",
"@fortawesome/fontawesome-free": "^5.14.0",
"autoprefixer": "^9.8.5",
"babel-loader": "^8.1.0",
"bulma": "^0.9.0",
"copy-webpack-plugin": "^5.1.1",

View File

@@ -43,13 +43,15 @@ defmodule FgHttpWeb.RuleController do
def edit(conn, %{"id" => id}) do
rule = Rules.get_rule!(id)
device = Devices.get_device!(rule.device_id)
changeset = Rules.change_rule(rule)
render(conn, "edit.html", rule: rule, changeset: changeset)
render(conn, "edit.html", rule: rule, device: device, changeset: changeset)
end
def update(conn, %{"id" => id, "rule" => rule_params}) do
rule = Rules.get_rule!(id)
device = Devices.get_device!(rule.device_id)
case Rules.update_rule(rule, rule_params) do
{:ok, rule} ->
@@ -58,7 +60,7 @@ defmodule FgHttpWeb.RuleController do
|> redirect(to: Routes.device_rule_path(conn, :index, rule.device_id))
{:error, changeset} ->
render(conn, "edit.html", rule: rule, changeset: changeset)
render(conn, "edit.html", rule: rule, device: device, changeset: changeset)
end
end

View File

@@ -1,48 +1,52 @@
<div class="columns">
<div class="column is-4 is-offset-4">
<h3 class="title">Sign Up</h3>
<hr>
<div class="content">
<h3 class="title">Sign Up</h3>
<hr>
<%= form_for @changeset, Routes.user_path(@conn, :create), fn f -> %>
<%= if @changeset.action do %>
<div>
<p>Oops, something went wrong! Please check the errors below.</p>
<%= form_for @changeset, Routes.user_path(@conn, :create), fn f -> %>
<%= if @changeset.action do %>
<div>
<p>Oops, something went wrong! Please check the errors below.</p>
</div>
<% end %>
<div class="field">
<%= label(f, :email, class: "label") %>
<div class="control">
<%= text_input(f, :email, class: "input") %>
</div>
<p class="help">
<%= error_tag f, :email %>
</p>
</div>
<div class="field">
<%= label(f, :password, class: "label") %>
<div class="control">
<%= password_input(f, :password, class: "input") %>
</div>
<p class="help">
<%= error_tag f, :password %>
</p>
</div>
<div class="field">
<%= label(f, :password_confirmation, class: "label") %>
<div class="control">
<%= password_input(f, :password_confirmation, class: "input") %>
</div>
<p class="help">
<%= error_tag f, :password_confirmation %>
</p>
</div>
<div class="field">
<div class="control">
<%= submit "Sign Up", class: "button is-primary" %>
</div>
</div>
<% end %>
<div class="field">
<%= label(f, :email, class: "label") %>
<div class="control">
<%= text_input(f, :email, class: "input") %>
</div>
<p class="help">
<%= error_tag f, :email %>
</p>
</div>
<div class="field">
<%= label(f, :password, class: "label") %>
<div class="control">
<%= password_input(f, :password, class: "input") %>
</div>
<p class="help">
<%= error_tag f, :password %>
</p>
</div>
<div class="field">
<%= label(f, :password_confirmation, class: "label") %>
<div class="control">
<%= password_input(f, :password_confirmation, class: "input") %>
</div>
<p class="help">
<%= error_tag f, :password_confirmation %>
</p>
</div>
<div class="field">
<div class="control">
<%= submit "Sign Up", class: "button is-primary" %>
</div>
</div>
<% end %>
</div>
</div>
</div>

View File

@@ -1,23 +1,27 @@
<div class="content">
<h3>Your Account</h3>
<div class="columns">
<div class="column is-4 is-offset-4">
<div class="content">
<h3>Your Account</h3>
<dl>
<dt>
<strong>Email</strong>
</dt>
<dd><%= @user.email %></dd>
<dl>
<dt>
<strong>Email</strong>
</dt>
<dd><%= @user.email %></dd>
<dt><strong>Last signed in at</strong></dt>
<dd><%= @session.last_signed_in_at %></dd>
</dl>
<dt><strong>Last signed in at</strong></dt>
<dd><%= @session.last_signed_in_at %></dd>
</dl>
<div class="level">
<%= link("Edit", to: Routes.user_path(@conn, :edit), class: "button is-primary") %>
<%= link "Delete your account",
to: Routes.user_path(@conn, :delete),
method: :delete,
data: [confirm: "Are you sure?"],
class: "button is-danger"
%>
<div class="level">
<%= link("Edit", to: Routes.user_path(@conn, :edit), class: "button is-primary") %>
<%= link "Delete your account",
to: Routes.user_path(@conn, :delete),
method: :delete,
data: [confirm: "Are you sure?"],
class: "button is-danger"
%>
</div>
</div>
</div>
</div>

View File

@@ -8,6 +8,10 @@ defmodule FgHttpWeb.DeviceView do
"rule"
|> Inflex.inflect(num_rules)
|> (&("#{num_rules} " <> &1)).()
|> reverse_concat(num_rules)
end
defp reverse_concat(word, number) do
"#{number}" <> "#{word}"
end
end