I'm working on a navbar and I'm trying to have a button on the bar be in the format:
(icon)(text)
Here's the excerpt from the jade file:
a(href="/signup")
h3 Sign Up
span(style="font-size: 1.25em; margin-top:2%" href="/graphing").glyphicon.glyphicon-pencil
Currently this produces:
(text)(icon)
How can I have it so the span is inside the h3, but is BEFORE the text in jade?
You should use a piped text:
a(href="/signup")
h3
span(style="font-size: 1.25em; margin-top:2%" href="/graphing").glyphicon.glyphicon-pencil
| Sign Up
From The documentation:
Piped Text
The simplest way of adding plain text to templates is to prefix the line with a | character (pronounced "pipe").
Related
If I didn't use verbatim with Text
Ex:
Text("Reach out to us on info#eyva.io for any queries!")
.foregroundColor(Color.white)
.font(Font.custom("Poppins-Regular", size: getFontSize(value: 16)))
Output:
And, if I used verbatim with
Text(verbatim: "Reach out to us on info#eyva.io for any queries!")
Ex:
Text(verbatim: "Reach out to us on info#eyva.io for any queries!")
.foregroundColor(Color.white)
.font(Font.custom("Poppins-Regular", size: getFontSize(value: 16)))
Output:
Email clickable functionality not working if I used verbatim with Text()
I want to with email clickable.
Try the below code It will help you:
Text(.init("Reach out to us on [cinfo#eyva.io](cinfo#eyva.io) for any queries!"))
.accentColor(.red)
here in the () round bracket, you have to write the link and in [] square bracket the respective text you want to see, here you want to show the email so in both brackets I wrote the email id modify as you want.
I have a custom field with some HTML code in it:
<h1>A H1 Heading</h1>
<h2>A H2 Heading</h2>
<b>Rich Text</b><br>
fsdfafsdaf df fsda f asdfa f asdfsa fa sfd<br>
<ol><li>numbered list</li><li>fgdsfsd f sa</li></ol>Another List<br>
<ul><li>bulleted</li></ul>
I also have another non-stored field where I want to display the plain text version of the above using REGEXP_REPLACE, while preserving the carriage returns/line breaks, maybe even converting <br> and <br/> to \r\n
However the patterns etc... seem to be different in NetSuite fields compared to using ?replace(...) in freemarker... and I'm terrible with remembering regexp patterns :)
Assuming the html text is stored in custitem_htmltext what expression could i use as the default value of the NetSuite Text Area custom field to display the html code above as:
A H1 Heading
A H2 Heading
Rich Text
fsdfafsdaf df fsda f asdfa f asdfsa fa sfd
etc...
I understand the bulleted or numbered lists will look crap.
My current non-working formula is:
REGEXP_REPLACE({custitem_htmltext},'<[^<>]*>','')
I've also tried:
REGEXP_REPLACE({custitem_htmltext},'<[^>]+>','') - didn't work
When you use a Text Area type of custom field and input HTML, NetSuite seems to change the control characters ('<' and '>') to HTML entities ('<' and '>'). You can see this if you input the HTML and then change the field type to Long Text.
If you change both fields to Long Text, and re-input the data and formula, the REGEXP_REPLACE() should work as expected.
From what I have learned recently, Netsuite encodes data by default to URL format, so from < to < and > to >.
Try using triple handlebars e.g. {{{custitem_htmltext}}}
https://docs.celigo.com/hc/en-us/articles/360038856752-Handlebars-syntax
This should stop the default behaviour and allow you to use in a formula/saved search.
How to change the font color of Hello alone in "Hello World" using javascript/some other method?
I tried the following code,
var s= session.getCommonUserName()
s.fontcolor("green")
"Hello"+" "+ s.toUpperCase()
where i tried to change just the color of the username alone. But it failed.
I wouldn't bother to send down unformatted HTML to the client and then let the client do the JavaScript work. You create a computed field and give it the data type HTML (that keeps HTML you create intact) and use SSJS. So no JS needs to execute at the client side:
var cu = session.getCommonUserName();
return "Hello"+" <span style=\"color : green\">"+ cu.toUpperCase()+"</span>";
Don't forget to cross your t, dot your i and finish a statement with a semicolon :-)
If you want to do it with client java script, then you must do something like this:
dojo.style("html_element_id", "color", "green");
So in your case you can have have something like:
<p><span id="span1">Hello</span> World.</p>
Or you can do it directly if you don't need to change it with CJS:
<p><span style="color:green">Hello</span> World</p>
one way to do it is to wrap your 'hello' in a html span and then change the color of that span.
<span id='myspan'>hello</span> world
javascript code:
document.getElementById('myspan').style.color='green';
Went old school on this one...
Say you want to put your formatted text in a div
<div id="test">
</div>
Then you need the following javascript to do so:
div = document.getElementById("test");
hello = document.createElement("span");
hello.innerHTML = "Hello"
hello.style.color = "green";
div.appendChild(hello);
div.appendChild(document.createTextNode(" world!"));
I'm starting to play with jade and got stuck with this:
I want to output something like:
hey! this
is pre
text!!!
I use tabs for indentation in templates and if I write spaces at the beginning of lines I get not both tabs & spaces indentation error.
My jade template:
div
pre. hey! this
is pre
text!!!
Have also tried with "|" syntax.
So, how can I output this? Thanks in advance ^_^
My mistake, was simple or just mistyped something:
pre
| hey! this
| is pre
| text!!!
Also got it to work using as the first "space" character and "." syntax
pre.
hey! this
is pre
text!
I came up with this:
view.jade
a.nav
i.user
nbsp
| Me
style.css
nbsp {
width: 0.5em;
display: inline-block;
white-space: nowrap;
}
I am using jQuery AutoComplete plugin.
I have the data which has special characters as '/-&
When user clicks the text area, the autocomplete drop down shows the data correctly
for example:
don't drink
When user selects the text (don't drink)
In my textarea it load the value as ASCII characters:
don't drink
How can I have the data to load as normal data.
This is my autocomplete code:
var directions ="don't drink/ Once a Day/ Take More/ You'are Good";
directions = directions.split("/");
$("#TextArea").autocomplete(directions, {
matchContains: true,
minChars: 1
});
You can add formatResult to your autocomplete options specifying a function that decodes the result that's output to the text box.