- Install the following in
assets
:
npm install --save bootstrap jquery popper.js
npm install --save-dev sass-loader@7.3.1 node-sass
- Rename
assets/app.css
toassets/app.scss
- Edit
webpack.config.js
to addsass-loader
and enablescss
compilation:
defmodule App.RegistrationController do | |
use App.Web, :controller | |
alias App.{Registration, Repo} | |
def new(conn, _params) do | |
changeset = Registration.changeset(%Registration{}) | |
render conn, :new, changeset: changeset | |
end | |
def create(conn, %{"registration" => registration_params}) do |
defmodule App.Registration do | |
use App.Web, :model | |
alias App.{Account, User, Membership, Repo} | |
embedded_schema do | |
field :email | |
field :org_name | |
end | |
@required_fields ~w(email org_name)a |
defmodule ExBs.Components.Form do | |
@moduledoc """ | |
Helpers for building Phoenix forms with Bootstrap components. | |
""" | |
import ExBs.Config, only: [translation_fn: 0] | |
import ExBs.Components.Form.Input, only: [input: 3] | |
alias Phoenix.HTML.{Form, Tag} |
# | |
# 2 - REVERSAL | |
# | |
# The quickest way to reverse an array is to swap elements at either end, and repeat | |
# while moving up from the left and down from the right. | |
# | |
# [ a b c d e f ] | |
# [ f a ] - Step 1 we switched A[0] with A[-1] | |
# [ e b ] - Step 2 we switched A[1] with A[-2] | |
# [ d c ] - Step 3 we switched A[2] with A[-3] |
assets
:npm install --save bootstrap jquery popper.js
npm install --save-dev sass-loader@7.3.1 node-sass
assets/app.css
to assets/app.scss
webpack.config.js
to add sass-loader
and enable scss
compilation:class SignedUrlsController < ApplicationController | |
def s3 | |
# Create client and set bucket | |
client = AWS::S3.new | |
bucket = client.buckets[ENV['S3_BUCKET']] | |
# Extract file extension since we're renaming the file | |
extension = File.extname(params[:image_name]).downcase | |
# Get mime-type from extension |
Estrutura anterior:
/
+ I001
+ new
+ processed
+ I002
+ new
+ processed
This setup was used successfully on a DigitalOcean VPS. After much trial and error, and following a number of disparate guides and tutorials, I was able to distil the process to the information found in this gist.
Before getting started, you should create a new server droplet. Login to verify that everything is working correctly.
ssh root@xxx.xxx.xx.xx
var _pc_resizeIFrame = function(iframe) { | |
iframe.height = iframe.contentDocument.body.scrollHeight; | |
} | |
document.querySelectorAll(".pc-iframe").forEach(function(iframe) { | |
window.onload = function () { | |
_pc_resizeIFrame(iframe); | |
}; | |
window.onresize = function () { | |
_pc_resizeIFrame(iframe); |
defmodule App.Membership do | |
# ... | |
def changeset(struct, params \\ %{}) do | |
struct | |
# ... | |
|> put_role | |
|> cast_assoc(:user, required: true) | |
end | |
defp put_role(changeset) do |