Thymeleaf loops and iterating - html

this is my template : http://pastebin.com/Gmdmqwxa
Whenever I add comment it is adding always to the first question on the list, even if I click on the others question 'Add Comment' button.However, the remove button works just fine for all the questions.
I think i know what it is working like that, so i thought i could use iterStat or something like that to iterate through questions, and then set th:action with iterStat, but its not working
<div th:each="question, iterStat : ${person.questions}" >
th:action="#{'/newComment/' + ${iterStat.current}}"
Maybe anyone has different idea how to fix this issue ?

Related

Problem With Thymeleaf Background Image Url

I'm working on a Spring Boot project and I am using Thymeleaf. In one of my view page let's call it dashboard.html, I need to change background image.
I can change images source with Thymeleaf.
Example 1
<img th:src="'/uploads/' + ${dashboard.dashboard_photo}" alt="" class="img-fluid" />
Works fine..
But, I cannot change background image with Thymeleaf...
<div class="banner_w3lspvt" th:style="'background: url('/uploads/' + ${dashboard.dashboard_photo});'">
I tried everything I found. Yes I know the same question was asked before but none of these answers helped me at all.
Welcome to SO. When you ask a question, please try to provide as much information as possible about the issue, like the stack trace, the log, or the unexpected behaviour.
Meanwhile, try the following:
th:style="'background: url(/uploads/' + ${dashboard.dashboard_photo} + ');'"
I think Literal substitutions work well for expressions like that. For example:
<div class="banner_w3lspvt" th:style="|background: url(/uploads/${dashboard.dashboard_photo});|">

VS code Error : settings.json property expected (bug)

enter image description here
When I use VS Code, a problem notice likes that(in the above image) is printed.
Although I want to fix it and really don't want to see it, I can't find any way to fix.
I am very painful about just seeing that error message all the time.
Please give me some helps.
You opened a { parenthesis at line 2784 and didn't close it. You should close it. --> }
Also, you have an extra comma , at 2793 that you have to remove.
Not use {}, because you may already mess your settings.json before.
so my suggestion as follows:
// in/your/settings.json/file
...
setting0_name:[setting0.0, setting0.1],
seting1_name : settings,
...

Umbraco 7 Multiple Textbox pulling "System.String[]"

I am currently using Umbraco 7.1.8 and I have just finished my final template however I wanted to create a tag like list for the client to add in as they wish.
I have a multiple textbox with the alias workUndertaken however when I call it, it echos System.String[].
My code is pretty simple - I called it two different ways to ensure it wasn't an issue with one method.
<p>#Model.Content.GetPropertyValue("workUndertaken")</p>
<p>#Umbraco.Field("workUndertaken")</p>
Does anyone know where I am going wrong?
Sorry got the answer almost instantly. Was hard to find.
So I will post the answer with the code I am now using. Hopefully others find this useful.
#{
if (Model.Content.GetPropertyValue<string[]>("workUndertaken").Length > 0) {
<ul>
#foreach (var item in Model.Content.GetPropertyValue<string[]>("workUndertaken")) {
<li>#item</li>
}
</ul>
}
}

Choosing 'selected' menu item in WP collapsible mobile menu

Someone was able to so quickly help me with a problem I'd spent hours and hours on, that I'm hoping I'll get lucky and someone can point me in the right direction on this one, too.
I didn't see anyone else with quite my issue here - and I'm new to working with WP templates instead of plain old HTML/CSS/JS stuff.
Basically - on a site we did (www.opted.org) with a purchased WP theme - I can't get the mobile version collapsible menu to stop defaulting on page load to the last item in the Main Menu.
So instead of something that makes sense - like About ASCO, or even being able to add "Select Page" - the drop down shows "-- past issues"
I don't care how I fix it really, but the client just doesn't want that page to be the default. I tried adding an extra menu item at the end called "Select Page" with an href='#' and using CSS to hide it on screens above 480px - but I couldn't get it to work no matter how I tried to refer to it.
I feel like this should be easy - but I don't know where to set the selected LI among the many WP files.
Thanks!!
I had a look at the plugin.js file on the site www.opted.org.
On line 22, there is 'header' : false // Boolean: Show header instead of the active item
and on line 41 there is jQuery('<option/>').text('Navigation')
Try setting line 22 to true, and text('Navigation') to your 'Select Page' if you prefer that over the text 'Navigation'
Or, according to the tinynav.js page (http://tinynav.viljamis.com/), you can customize that as an option like this:
$("#nav").tinyNav({
active: 'selected', // String: Set the "active" class
header: 'Navigation', // String: Specify text for "header" and show header instead of the active item
label: '' // String: Sets the <label> text for the <select> (if not set, no label will be added)
});
In your main.js file, your calling it on line 14. You should add that header: 'Navigation', option there.
It's hard to answer this question without knowing how the theme you are using works. However, you can certainly change the selected attribute using javascript.
Here's the code you would use to set it to 'About Asco' using jQuery:
jQuery('.tinynav').val('/about-asco/')
alternatively (a little clearer, but more verbose):
jQuery('.tinynav option:first').prop('selected', true);

Update panel in asp.net

I am using two update panel..in nested way.. can i use like this and also
in my project im using clientscript.RegisterScript along with update panel , its not giving any error but , my pop up is not being displayed when i click one item on grid. the pop up is in update panel which is inside (nested)..
can anyone help ???
Thank you
RegisterScript may not work well with updatepanel. use PageRequestManager.add_endRequest method to hook-up client script in this scenario.
if (window.Sys){
var prmx = window.Sys.WebForms.PageRequestManager.getInstance();
prmx.add_endRequest(function() {
alert('insert your code here...');
});
}
also make sure there is no javascript erros during page load.