Consider the following Groovlet:
html.html
{
head {
title("Groovy Test")
}
body {
center {
img(src:"getPlot.groovy?name=name&value=value")
}
}
}
Is there a better way to generate the URL? I'm looking to eliminate the explicit var/vals from the URL.
You could use UrlRewriteFilter for this. It's like mod_rewrite but implemented as a servlet filter.
Related
I'm working on a Vue project and I want to display images that are stored in Firebase Storage. However, when I put in the downloadURL of an image in a HTML img tag for the source, it doesn't display. Is there a step in between or do I have to change the rules?
img tag result:
img source:
https://firebasestorage.googleapis.com/v0/b/vueauth-9e069.appspot.com/o/user-uploads%2Fimages%2FGitHub-Mark.png?alt=media&token=55ca40dd-58af-46b9-8e7a-1cead6d9c031
Firebase storage rules:
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write: if request.auth != true;
}
}
}
I was wondering if there is a good practice on how to write your HTML code in order to get better Sentry.io breadcrumbs inside of the issues.
It's not possible to identify the elements that the user has interacted and I think using CSS class or IDs for it is not the ideal - although we can customize the breadcrumbs, looks like it's not a good practice to get the text inside the tag as per some issues found on Sentry Github repository.
I was thinking about aria-label, does anyone has any advices on it?
Right now is very hard to understand the user steps when reading the breadcrumbs.
This can be solved using the beforeBreadcrumb hook / filtering events.
Simply add
beforeBreadcrumb(breadcrumb, hint) {
if (breadcrumb.category === 'ui.click') {
const { target } = hint.event;
if (target.ariaLabel) {
breadcrumb.message = target.ariaLabel;
}
}
return breadcrumb;
}
... to your Sentry.init() configuration.
Sentry.init({
dsn:...
Resulting in something like this:
Sentry.init({
dsn: '....',
beforeBreadcrumb(breadcrumb, hint) {
if (breadcrumb.category === 'ui.click') {
const { target } = hint.event;
if (target.ariaLabel) {
breadcrumb.message = target.ariaLabel;
}
}
return breadcrumb;
}
});
More about this here: sentry.io filtering events documentation
I am trying to find a way to use alternative headers in Razor Web Pages without using two _SiteLayout pages, with each _SiteLayout rendering a different _header page.
I’m trying to achieve this - If the default.cshtml page is called use header-1, if any other page is called use header-2.
I have tried all sorts of different logic with no joy, including: IsCurrentPage, Request.QueryString, Request.Url; and CurrentPage.Name.
E.G.
#if ((Request.QueryString["Default"] == null))
{
#RenderPage("/shared/_header-1.cshtml")
}
else
{
#RenderPage("/shared/_header-2.chtml")
}
And
#{
var pageUrl = this.Request.Url;
}
#if (pageUrl = "http://mycompany/Default.cshtml/") {
#RenderPage("/shared/_header-1.cshtml");
}
else
{
#RenderPage("/shared/_header-2.cshtml");
}
Does anyone have a simple method to achieve this please?
Although, I spent a long time on this, not long after posting I found an answer thanks to: Erik Philips
Add to _SiteLayout:
#if (IsSectionDefined("customHeader"))
{
#RenderSection("customHeader")
}
else
{
#RenderPage("/shared/_header.cshtml")
}
Add to default page
#section customHeader{
This is custom header
}
The common header doesn't get called in the Default page, because customHeader is specified instead; whereas, all other pages use the normal header
I would like to know whether is it possible to insert an input tag in Json file? I would like to add a checkbox in here
{
"data1":"here"
}
{"row"[{
"DATA1" :"<input type='checkbox'/>"
},
{
"DATA2" :"<input type='text'/>"
}
]}
Like this?
No. The closest you could get would probably be to represent a checkbox as a string.
{
"data1":"<input type=\"checkbox\"/>"
}
Then you would be able to insert that string as html into the DOM somewhere (assuming this is for an HTML webpage)
document.getElementById("someid").innerHTML = myJSONObject.data1;
Depending on what you are trying to do you might be able to use a function that returns a checkbox.
{
"data1":function(){
var box = document.createElement("input");
box.setAttribute("type", "checkbox");
return box;
}
}
Then in your code that parses the JSON you would need to call the data1 property as a function
var myCheckboxFromJSONFile = myJSONObject.data1();
I had found the solution.
Hopefully it can help any newbies outside
{
"data1":"<input type='checkbox'>"
}
Don't use double quotes(") use single quotes(')
I would like to use wildcard selection for :hover and active
My current css is:
a.trigger
And I transformed it to:
a[id*='trigger-'] {
}
I also need the same for hover and active. Can I do that?
a.trigger:hover {
}
a.active.trigger {
}
How can I transform that using wildcard?
a.active.[id*='trigger-'] {
}
I’m not really clear what you’re asking, but is this the answer?
a[id*='trigger-']:hover,
a[id*='trigger-']:active {
}