From 9e99f7d64a61064c51e95e3a9f355c8c04951500 Mon Sep 17 00:00:00 2001 From: "John Jerald E. De Chavez" Date: Mon, 27 Nov 2023 14:09:02 +0800 Subject: [PATCH] Updated edge framework snippets (#378) * Added csrfToken snippet and Updated csrfField snippet * Added bouncer ctx instance * Added i18n instance and helper snippets * Added app.nodeEnvironment snippet --- snippets/frameworks/edge.json | 44 +++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/snippets/frameworks/edge.json b/snippets/frameworks/edge.json index ce606181..b8660080 100644 --- a/snippets/frameworks/edge.json +++ b/snippets/frameworks/edge.json @@ -107,6 +107,11 @@ "body": ["@cannot('${1:ability}', ${2:args})", " $3", "@end"], "description": "Edge: cannot tag from @adonisjs/bouncer allows you write conditionals around the bouncer permissions." }, + "edge: Bouncer ctx.bouncer instance": { + "prefix": "bouncer.allows()", + "body": ["await bouncer.allows('${1:ability}')"], + "description": "Edge: Reference to the ctx.bouncer instance" + }, "edge: Debugger": { "prefix": "@debugger", "body": ["@debugger"], @@ -132,6 +137,11 @@ "body": "app", "description": "Reference to application instance" }, + "edge: app.nodeEnvironment": { + "prefix": "app.nodeEnvironment", + "body": "app.nodeEnvironment", + "description": "Get current node environment" + }, "edge: asset": { "prefix": "asset", "body": "asset('${1:filePath}')", @@ -169,8 +179,13 @@ }, "edge: csrfField": { "prefix": "csrfField()", - "body": "csrfField()", - "description": "Add csrfField input field to form" + "body": "{{ csrfField() }}", + "description": "Add csrfField hidden input field to form" + }, + "edge: csrfToken": { + "prefix": "csrfToken", + "body": "{{ csrfToken }}", + "description": "Add inline csrf token as content" }, "edge: dashCase": { "prefix": "dashCase", @@ -326,5 +341,30 @@ "prefix": "truncate", "body": "truncate(${1:value}, ${2:100})", "description": "Truncate string after given characters count" + }, + "edge: i18n.locale": { + "prefix": "i18n.locale", + "body": "{{ i18n.locale }}", + "description": "An instance of i18n for the default locale is shared with the templates as a global property" + }, + "edge: i18n.formatNumber()": { + "prefix": "i18n.formatNumber()", + "body": "{{ i18n.formatNumber(${1:value}) }}", + "description": "An instance of i18n and set formatNumber" + }, + "edge: t": { + "prefix": "t", + "body": "t('${1:value}')", + "description": "The t helper is an alias for the i18n.formatMessage method" + }, + "edge: getDefaultLocale": { + "prefix": "getDefaultLocale()", + "body": "{{ getDefaultLocale() }}", + "description": "Returns the default locale for the application" + }, + "edge: getSupportedLocales": { + "prefix": "getSupportedLocales()", + "body": "{{ getSupportedLocales() }}", + "description": "Returns an array of the supported locales" } }