All social share buttons (links) removing parameter after hash in URL - social-networking

I am having great trouble with sharing link which includes #id parameters in URL.
URL Example:
http://localhost/mysite/20/civitas-animum-genito-invenit-solutionem-ascendens-piratae?show=36#a36
So here all social channels posting URL before #36
http://localhost/q2a-16/20/civitas-animum-genito-invenit-solutionem-ascendens-piratae?show=36
This is very important since #36 is a id of the sub-content (anchor jump)
All Sharing Links(buttons)
$this->output('<a class="btn btn-tweet" target="_parent" href="javascript: void(0)" onClick="window.open(\'https://twitter.com/share?text='.$title.'&url='.$url.'&via=ME_HERE&wrap_links=true\', \'tweet\', \'toolbar=0,status=0,width=548,height=325,resizable=yes\');" ><i class="fa fa-twitter"></i></a>');
$this->output('<a class="btn btn-facebook" href="javascript: void(0)" onClick="window.open(\'http://www.facebook.com/sharer.php?u='.$url.'\', \'sharer\', \'toolbar=0,status=0,width=548,height=325,resizable=yes\');" target="_parent"><i class="fa fa-facebook"></i></a>');
$this->output('<a class="btn btn-google" href="https://plus.google.com/share?url='.$url.'" onclick="javascript:window.open(this.href, \'\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600\');return false;"><i class="fa fa-google-plus"></i></a>');
$this->output('<a class="btn btn-linkedin" href="http://www.linkedin.com/shareArticle?mini=true&url='.$url.'&title='.$title.'&summary='.$desc.'&source='.$url.'" onclick="javascript:window.open(this.href, \'\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600\');return false;"><i class="fa fa-linkedin"></i></a>');
Any solution to get full URL including #id?

Try %23 instead of #, It will work!
http://localhost/mysite/20/civitas...piratae?show=36%23a36

Related

Crispy forms overriding Input css_class

I'd like to change the Bootstrap style of the second of my input buttons, which is specified in a layout object:
...,
Div( FormActions(
Submit( 'submit', 'Update', css_class='btn'),
Submit( 'next_button', 'Next>>', css_class='btn btn-warning'),
but the second Submit is generating this HTML
<input type="submit"
name="next_button"
value="Next>>"
class="btn btn-primary btn btn-warning"
id="submit-id-next_button"
/>
and btn-warning is not acted on because (I think) btn-primary earlier in the class list takes precedence. How can I get my css_classes to come first?
[edit] have found a work-around: replace that Submit with
HTML('''<button class="btn btn-warning" type="submit" name="next_button" value=0 >
Next</button>  '''),
Don't like it much.

Thymeleaf th:onclick event - calling confirm function

I am new to Thymeleaf. Recently I stumbled in the following situation. Here is a piece of my Thymeleaf html page:
<!-- an delete button link -->
<a th:href="#{/employees/delete(employeeId=${tempEmployee.emplId},firstName=${tempEmployee.firstName},lastName=${tempEmployee.lastName})}"
class="btn btn-danger btn-sm py-1 "
th:onclick="if(!(confirm('Are you sure you want to delete this employee ?') )) return false" >
Delete
</a>
This code works fine as intended. However I want to add employee name as part of the confirmation. Here is the code:
<!-- an delete button link -->
<a th:href="#{/employees/delete(employeeId=${tempEmployee.emplId},firstName=${tempEmployee.firstName},lastName=${tempEmployee.lastName})}"
class="btn btn-danger btn-sm py-1 "
th:onclick="if(!(confirm('Are you sure you want to delete this employee ' + '\'+${tempEmployee.firstName}+\'' +'?' ) )) return false" >
Delete
</a>
Unfortunately the result is:
Are you sure you want to delete this employee
'+${tempEmployee.firstName}+'.
Looks like Thymeleaf does not recognize ${tempEmployee.firstName}. It has no problem with it in th:href tag but does not like it in th:onclick.
I would appreciate if somebody can turn me into the right direction.
Not sure exactly what the problem is (though it may be related to onclick vs th:onclick. Regardless, I think a format more like this will work (with some added benefits like no JavaScript injection).
<!-- an delete button link -->
<a
th:href="#{/employees/delete(employeeId=${tempEmployee.emplId},firstName=${tempEmployee.firstName},lastName=${tempEmployee.lastName})}"
class="btn btn-danger btn-sm py-1 "
th:data-confirm-delete="|Are you sure you want to delete this employee ${tempEmployee.firstName}?|"
onclick="if (!confirm(this.getAttribute('data-confirm-delete'))) return false"
>
Delete
</a>
(Notice I'm using onlick and not th:onclick.
Instead of this line in above code ---onclick="if (!confirm(this.getAttribute('data-confirm-delete'))) return false">
You can write as:
onclick="return confirm(this.getAttribute('data-confirm-delete'))"

Refresh view content when there is change in database laravel

I am using laravel queue to upload a csv file. And, I have used a column completed on the database table.
So, by default the value of this column will be 0 and as soon as the job is completed this column's value will be updated to 1 for that particular row.
Similarly, during uploading phase, this value will be 2 and if some error occured during upload or if some row can't be imported then the value will be 3
On front end, I have a simple button like:
#if($r->completed == 1)
<a class="btn btn-xs btn-primary d-inline-block" href="{{url('/?property='.$r->id)}}">Property</a>
#elseif($r->completed == 2)
<a class="btn btn-xs btn-warning d-inline-block" href="#">Pending</a>
#elseif($r->completed == 3)
<a class="btn btn-xs btn-secondary d-inline-block" href="{{route('property.create',$r->id)}}">Par. Completed</a>
#else
<a class="btn btn-xs btn-secondary d-inline-block" href="{{route('property.create',$r->id)}}">Property</a>
#endif
Yeah, its working totally fine. Here, we need to refresh to check the recent status. However, my requirement is to update the status without refreshing the page.
After some searching, I find that sending ajax request on certain interval might be an option. However, it don't seems ideal, so I don't want to go with that.
Is there any better option available? Currently, I am using jquery/javascript (not any js framework like vue,react).

Send param in URL using OFBiz

I want to end a param in URL in OFBiz, but I get this error
from security
org.apache.ofbiz.webapp.event.EventHandlerException: Found URL parameter [twCompagneDeRecrutementId]
passed to secure (https) request-map with uri [showCompagne] with an event that calls service [showCompagne];
this is not allowed for security reasons! The data should be encrypted by making it part of the request body (a form field) instead of the request URL.
Moreover it would be kind if you could create a Jira sub-task of https://issues.apache.org/jira/browse/OFBIZ-2330 (check before if a sub-task for this error does not exist). If you are not sure how to create a Jira issue please have a look before at http://cwiki.apache.org/confluence/x/JIB2
This is my ftl
<#if listCompagne??>
<#list listCompagne as newCompagne>
<div style="display:flex; width:100%;">
<div style="padding:6px; width:24%;"><label>${newCompagne.nom}</label></div>
<div style="padding:6px; width:24%;"><label>${newCompagne.dateDebut ?date}</label></div>
<div style="padding:6px; width:24%;"><label>${newCompagne.dateFin ?date}</label></div>
<input type="hidden" value="${newCompagne.twCompagneDeRecrutementId}"/>
<div style="padding:6px; width:20%;"> <a class="btn btn-outline-danger btn-block " href="<#ofbizUrl>showCompagne?twCompagneDeRecrutementId=${newCompagne.twCompagneDeRecrutementId}</#ofbizUrl>">afficher</a>
</div>
</div>
</#list>
I don't use ofbiz , but you should send parameter in body instead of in query.
In your case I would add a form and submit it using hidden form input, form should be unique per iteration using index
<form action="<#ofbizUrl>showCompagne?</#ofbizUrl>" id="afficher${newCompagne?index}" method="post" style="display: none;">
<input type="hidden" name="twCompagneDeRecrutementId" value="${newCompagne.twCompagneDeRecrutementId}" />
</form>
<a class="btn btn-outline-danger btn-block "
href="javascript:;" onclick="javascript:
document.getElementById('afficher${newCompagne?index}').submit()">afficher</a>
the solution is to go to url.properties and change parameters.url.encrypt to no

TYPO3 7.6.18 - Hide link text

I have the following condition for a link. If the linked page is hidden there will be no link. That's fine!
<f:if condition="{data_item.tx_mask_link}">
<f:link.typolink parameter="{data_item.tx_mask_link}">
<i class="fa fa-angle-double-right"></i>
</f:link.typolink>
</f:if>
Is it also possible to hide
<i class="fa fa-angle-double-right"></i>
by the condition if the linked page is hidden?
You can use {data.hidden} for check out whether page is hidden or not. Let me give you straight example:
<f:if condition="{data_item.tx_mask_link}">
<f:link.typolink parameter="{data_item.tx_mask_link}">
<f:if condition="{data.hidden}!=0">
<i class="fa fa-angle-double-right"></i>
</f:if>
</f:link.typolink>
</f:if>
Here, check basic stuff {data_item.tx_mask_link} then if {data.hidden} not hidden then shows icon
Greetings!

Resources