Laravel Carbon date format weird in bootstrap popover - laravel-5

I'm displaying a datediff in my Laravel view (blade). I can show the time between two dates as follows:
$lengthOwned = Carbon\Carbon::now()->diffForHumans(new Carbon\Carbon($real_asset->real_owned_since));
echo($lengthOwned);
The echo statement displays this info correctly on my page, as does placing {{$lengthOwned}} anywhere in the blade. It displays like:
4 months after
for the difference between 01/03/2018 and today 05/11/2018
However, I need to display this in a bootstrap popover, and when I do I get the number, without the accompanying text. So instead of "4 months after" in the popover panel I just get "4". That means that "4 months after" and "12 years after" become just "4" and "12" - not good.
My popover code is:
<a href="#RE" data-toggle="popover" title="How long since acquired" data-content={{$lengthOwned}}>CLICK FOR TIME LAPSED</a>
with the following javaScript:
<script>
$(document).ready(function(){
$('[data-toggle="popover"]').popover();
});
</script>
Anyone have any suggestions as to why the carbon-provided text is missing/truncated?
I'm running Laravel 5.5, PHP 7 with XAMPP on Windows 10
Thanks in advance.

You're missing quotes for the value of data-content, right now you have:
<a data-content={{$lengthOwned}}>CLICK FOR TIME LAPSED</a>
this would render something like the following (which sets the value of data-content to 4 and adds two weird attributes):
<a data-content=4 months later>CLICK FOR TIME LAPSED</a>
Instead wrap the whole value within quotes:
<a data-content="{{$lengthOwned}}">CLICK FOR TIME LAPSED</a>

Related

Some kind of Dashboard in FullCalendar

yeah what more to describe
I have no clue how to do that. Setup fullcalendar, fetsch data and enter data works fine.
The last thing I needit is a Dashboard under the Calendar witch get the selected week that visible in the Calendar (would be great when act also with the prev and next Arrow Buttons form the Calendar), and get the summary Events from selected Week witch holds already the durration of the single Events.
Do you know what a mean? and shy asking would you be ma hero?
Maby i found the Solution
main.js
weekNumberClassNames: function(view, element){ $('#card-title').html(calWeek); }
Let the magic happen by every view change, it also the WeekNumber change
A big part is solved.

why does this happen in x-editable + ng-repeat

I have been exploring Angular X-editable project for a while and came across this odd behavior.
Whenever I click on any one of the 3 'select' components and try to change the value from the dropdown, the method 'showStatus(..)' gets fired for other components as well that are inside the ng-repeat boundary. (which you can check through the console.)
Can you please tell me why is this happening? Am I missing something.. ?
EDITED LINK -> Fiddle : http://jsfiddle.net/hrr4M/4/
<span ng-repeat="d in list" >
<a href="#" editable-select="d.status" e-ng-options="s.value as s.text for s in statuses">
{{ showStatus(d.status) }}
</a> <br/>
</span>
The problem you have is that your binding
{{ showStatus(d.status) }}
fires up the function for every item, because as every item gets populated, it just refreshes and fires again, all of them.
This is not the right place to set this up.
I set up a modified fiddle for you: http://jsfiddle.net/hrr4M/13/
Inside the link statement I added
onaftersave="showStatus($data)"
That way, you can fire a function after an item has been selected (see docs for onaftersave vs onbeforesave), and you can get the selected value using $data.
Now it works already. The problem is, that your binding is still using the same function, and therefore firing up all the time.
I duplicated the function and renamed it to repeatFiller with the same functionality but omitting the console logs, so you can see it works. You might tweak that a bit but I think it does what you need.

Dropdown in templated column for ultrawebgrid does not function properly

I have a templated column. I am using a Dropdown as header template and based on the value of the dropdown user sets, I update sigle DB record. Header drop down has nothing to do with the contents of the cells of that column. Everything works fine when the page is loaded and dropdown functions as expected.
As soon as I click anywhere on the gid and then click on the drop down, it behaves in a weird fashion i.e. it expands and then collapses. If I double click on the drop down it works as expected.
I am not able to understand what happens when I click inside the grid so that my drop down only responds to double click and not single click.
Here is the code snippet:
<igtbl:TemplatedColumn BaseColumnName="Assigned" Key="Assigned" AllowResize="Free" AllowRowFiltering="False"
AllowUpdate="Yes" Width="80px" Type="Custom" EditorControlID="assignTo" IsBound="false">
<Header Caption="Assigned To" ClickAction="SortSingle">
<RowLayoutColumnInfo OriginX="15" />
</Header>
<HeaderTemplate>Assigned To <select id="AssignToDefault" width="40px" runat="server" name="AssignToDefault"><option value="0">-Select-</option><option value="1">User</option><option value="2">API</option></select>
</HeaderTemplate>
<Footer>
<RowLayoutColumnInfo OriginX="15" />
</Footer>
</igtbl:TemplatedColumn>
I am trying to solve the issue since long. Please help.
Found the answer on Infragistics Community:
http://community.infragistics.com/forums/p/67149/340326.aspx#340326
EDIT (in case link deprecates):
I tested your scenario and was able to replicate the behavior in IE8 but not in Firefox.I suggest that you try disabling the activation behavior of the grid to see if that makes a difference:
UltraWebGrid1.DisplayLayout.ActivationObject.AllowActivation = false;
Alternatively you may want to consider using the WebCombo control in this scenario as it seems to be unaffected by the issue.
Please note that the UltraWebGrid control is now outdated and as of .NetAdvantage 2011 Volume 2 is no longer included in our product package. I would suggest that you consider switching to the WebDataGrid/WebHieararchicalDataGrid. More information regarding these controls is available at:
http://help.infragistics.com/NetAdvantage/ASPNET/2011.2/CLR4.0/?page=Web_WebDataGrid_WebDataGrid.html
Additional samples demonstrating the features of these grids can be found at:
http://samples.infragistics.com/aspnet/
Thank you :)

selenium is able to find but unable to click on an unicode character

I am having trouble getting selenium RC to click on a button. There is a button on a page that has the character "pi" on it and I am trying to click on it. The html code looks something like this
<div id="abc">
<a class="my keys one" keystring="Pi" keyvalue="π"
π
</a>
</div>
This is what I have done so far -
selenium.click("//div[#id='abc']/a[1]");
This returns an OK but on the page, when I see visually, the button is not clicked (on click, the page has to do something).
I have tried other stuff like getting the Attribute and making it click on it, but doesnt work-
selenium.click(selenium.getAttribute("//div[#id='abc']/a[1]#keystring"));
I have even tried converting the above selenium.getAttribute to a unicode value and then clicking on it. That does not work too.
Also, I added a line to check if at least selenium thinks the character pi is present on the page. I used the unicode of pi-
selenium.isElementPresent("\u03c0");
On eclipse, when I run it, this shows up- isElementPresent[?, ] on session...
and returns a false.
I am stumped. Can anyone please point to me what is it that I am doing wrong?
i thin this may help you.
selenium.click("//a[#class='my keys one']");
or
selenium.click("xpath=//a[#class='my keys one'"]");
if it is not workin use css path.
I a similar issue. My button has a "black down-pointing triangle" on it and none of the other attributes are unique (the "class", "id", and "role" are reused over and over on the same page). The only unique thing I have is a "value" that is a symbol.
value="▼ "
I, too, would like to know if there is a way to click on this button.

PHP Ajax, how to update a number dynamically?

In my PHP application, I have a web page that says "New Leads: 0" The "0" is the result of a SQL statement.
My goal is to add Ajax code so the "0" updates dynamically, without having to refresh the page. When the number of rows increases in the database, I want the "New Leads: 0" to automatically increase.
My question is can you point me in the right direction of how I can code this?
Make a page that outputs the number, put the number into a <span id="the_number"> then call the load() function of jQuery on that span to fetch that page. Use the window.setInterval() function to make it periodically.

Resources