We need to generate secret key for development environment.
mix phoenix.gen.secret
# ednkXywWll1d2svDEpbA39R5kfkc9l96j0+u7A8MgKM+pbwbeDsuYB8MP2WUW1hf
Let's generate User model and controller.
# Has one external dependency except for Gettext: https://github.com/rrrene/html_sanitize_ex | |
defmodule MyApp.Gettext do | |
@doc """ | |
A helper for translations with links. | |
Pass in the translation string which must include | |
`%{link_start}`/`%{link_end}`. For multiple URLs, use | |
`%{link_start_<0,1,2...>}`. |
defmodule MyAppWeb.GettextTest do | |
use ExUnit.Case | |
import MyAppWeb.Gettext | |
# A unit test for Gettext translations that checks if the original and the translation | |
# use the same HTML tags. | |
# | |
# Uses Floki to parse HTML. | |
describe "translations" do |
{ | |
"lib/**/views/*_view.ex": { | |
"type": "view", | |
"alternate": "test/{dirname}/views/{basename}_view_test.exs", | |
"template": [ | |
"defmodule {dirname|camelcase|capitalize}.{basename|camelcase|capitalize}View do", | |
" use {dirname|camelcase|capitalize}, :view", | |
"end" | |
] | |
}, |
defmodule MyAppWeb.InputHelper do | |
use Phoenix.HTML | |
def input(form, field, opts \\ []) do | |
type = Phoenix.HTML.Form.input_type(form, field) | |
wrapper_classes = Keyword.get_values(opts, :wrapper_class) ++ ["row", "form-group"] | |
inputs_classes = Keyword.get_values(opts, :input_class) ++ ["form-control"] | |
if form.errors[field], do: inputs_classes = inputs_classes ++ ["form-control-danger"] |
# Requirements | |
* Python 2.7 | |
* Google Chrome | |
* ChromeDriver - WebDriver for Chrome | |
- Download the latest chromedrive which is 2.28 from here - https://sites.google.com/a/chromium.org/chromedriver/downloads | |
- Extract and move `chromedriver` file to `/usr/local/bin/chromedriver` | |
- git clone https://github.com/li-xinyang/OS_FrontendMaster-dl | |
- cd OS_FrontendMaster-dl |
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |