Every time you choose to apply a rule(s), explicitly state the rule(s) in the output. You can abbreviate the rule description to a single word or phrase.
[Brief description ]
- [more description]
- [more description]
- [more description]
// assets/js/app.js | |
window._lazy_hooks = window._lazy_hooks || {}; | |
let lazyHook = function(hook) { | |
return { | |
mounted() { window._lazy_hooks[hook].mounted(...arguments) }, | |
beforeUpdate() { window._lazy_hooks[hook].beforeUpdate(...arguments) }, | |
updated() { window._lazy_hooks[hook].updated(...arguments) }, | |
destroyed() { window._lazy_hooks[hook].destroyed(...arguments) }, | |
disconnected() { window._lazy_hooks[hook].disconnected(...arguments) }, |
Problem: accidentally pressing 'Esc' when editing a form in a "standard" LiveView modal dialog will discard all edits.
Proposed solution: Make the modal show a confirmation window on close when there have been changes on the form.
LiveView v0.20 was used.
Table of content
defmodule TravelerWeb.SearchbarLive do | |
use TravelerWeb, :live_view | |
alias Phoenix.LiveView.JS | |
alias Traveler.Places | |
def mount(_params, _session, socket) do | |
socket = assign(socket, places: []) | |
{:ok, socket, layout: false} | |
end |
Security Advisories / Bulletins / vendors Responses linked to Log4Shell (CVE-2021-44228)
# 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 |