defining empty list template in angular-ui-tree - angular-ui-tree

does anyone know if there's a way to define a template for an empty ui-tree list?
If the list model ist empty there will be a default
<div class="angular-ui-tree-empty"></div>
element generated (if not turned off by data-empty-placeholder-enabled), but I want to define some HTML for it by myself.
Thanks in advance,
Dennis

Related

Display raw text from custom field in Drupal

I'm trying to render a Block's Field as Plain Text as I need it used as part of HTML, I've tried using |RAW however I read it was unstable + it didn't work haha!
This is my existing HTML minified
Read More
However I would like to make it more useable
Read More
This would mean that when a user modifies the DrupalBlock HEX code it would change the color of the box. However the issues is when it's printed on the page it's looking like this
<div data-quickedit-field-id="#" class="field field--name-field-color field--type-string field--label-hidden field--item quickedit-field">FFFFFF</div>
the only thing I would like printed is "FFFFFF" with no div's
-
Here is my question: How do I display my Field_color as plain text when it prints?
You can use |raw : {{ content.field_color|raw }}.
If you need more information please ask.
I suggest you do a dump or kint of your content.field_color variable. You might be able to get some more information on it and get the answer!
Anyway, we have something similar in our project and the way we do it is by using a .getString() method.
{% set image_align = content.field_image_align['#items'][0].getString() %}
<div class="{{ image_align }}">
Our field is a list of values so you'll have to look for another array item to call the .getString() method on.

In Tritium, how do I add an attribute with no value assigned to it?

I have a normal tag:
...
I need it to look like this:
<a href="prefetchThisPage.html" data-prefetch> ... </a>
Why? jQuery Mobile feature: http://jquerymobile.com/demos/1.1.1/docs/pages/page-cache.html
The expected way below does not add the attribute, probably because Tritium ignores empty attributes.
attribute("data-prefetch")
Any ideas?
Great Question!
The best way to do this, is to set the value of the variable to the NAME of the variable.
I would do it like this:
$variable_name = "data-prefetch"
$("./a") {
attribute($variable_name, $variable_name)
}
This is an HTML5 convention and should work for the purposes you illustrated!
Tritium currently has a short circuit that converts attribute assignments like the following declaration:
attribute("data-prefetch", "")
Into the equivalent of removing the attribute.
I strongly recommend you file this issue with Moovweb's help desk so that they add support for adding attributes with no values.

can we write javascript code in jsp which is of with struts html tag library

this is phani kumar,
Actually, i am writing one page to show product details. In that i written code to display the
productid list in jsp page with the help of and tags
. but the main problem is, based on the selection of productid, i trying to show the product details(productname, productcost, productstock..like).But i am facing problems to work this.
I am trying it with javascript, but because of struts html taglibrary, i am getting problems here, could u please give me solutions to resolve this problem anyone.
and can anybody tell how to get dropdown selection value into javascript(if we are using tag library in struts)
How are you using javascript to create your view? You should be able to use
<logic:iterate>
to traverse your product collection, then
<bean:write .../>
to display information from each product.
<html:select>
will create a dropdown in your form. Use
<html:option>, <html:options>, or <html:optionsCollection>
to populate each item in the dropdown.

How to get id of an element when using Capybara for test (Rails)

I am using Capybara to write test in my application, but now i have a situation in which i need to read id of an element within capybara like
myid = page.find("#parentNode").first(".childClass").id
Consider i have the below HTML structure
<div id="parentNode">
<div id="childNode1" class="childClass">1</div>
<div id="childNode2" class="childClass">2</div>
</div>
Please Note : I am not trying to read the content of the child node, but the id. The above shown is for example.
Expected Output : childNode1 (id of first element with class childClass
You are almost near the answer. The only change is instead of calling id as method, you have to call it as attribute as follows
page.find("#parentNode").first(".childClass")[:id]
I would use some xpath instead of css in this case.
Note I am not that skilled in xpathing so I use css first to find parentNode.
find(#parentNode).find(:xpath, div[1]).id
Try that and see if it works.
optionally you can use css in the second find as well and use the class as criteria since it finds the first element anyway.
Got the answer..!!
We can use page.evaluate_script to achieve this. I used the below code
page.evaluate_script('$("#parentNode .childNode").first().attr("id")')
Hope this will help some one :)

naming form files using square brackets

I've noticed in some php applications, that form fields are labelled with [] in them.
Say a shopping cart page, that lists all the items where you can edit the quantity.
is the [] type naming used to get the correct row?
Just trying to figure out how I should name each textbox?
should it be like:
name="quantity-<%= items.RowId %>"
THen when I loop the form fields, I would get the index number?
This is done in PHP when you need to pass <select multiple="multiple"> to the server, otherwise PHP will catch only the first selected value.
Textboxes don't normally require such naming.
This might answer a few of your questions. Here, Phil Haack uses square brackets in order to bind to a model that contains a list.

Resources