Href onclick action open in new window - href

I'm displaying a pdf icon for the user to click which displays a pdf. I want to get this to open in a new window, is this possible?
I've tried
Onclick OpenWindows _TargetBlank
<a href="#Url.Action("GetPDF", "Content", new {
id = #item.ID
})">
<img src="~/Images/pdf.png" name="LinkToPdf" alt="#item.Image" height="60" width="60" />
</a>
For this to open in a new window

Try using this:
<img src="~/Images/pdf.png" name="LinkToPdf" alt="#item.Image" height="60" width="60" />
i added target="_blank". This tells the link to open in a blank tab.

Related

Passing values from Django template to javascript-ajax function

Now my template displays a table having a link on each row to display more details. Each row passes unique column_name, db_name, schema_name, tablenm combination to get more details.
<td>
<a href="{% url 'moreDetails' column_name=row.colname db_name=row.dbname schema_name=row.schemaname table_name=row.tablenm %} " target="_blank">
Values
</a>
</td>
The above code works , but open a new window for the result set. But, I would like to route it through a javascript(Jquery-django) and capture the result back in Javascript and display the result as a javascript message without refreshing the complete page.
How Can I pass there values (column_name, db_name, schema_name, tablenm) to the java script on the click event
I tried replacing href with button and set a value to it
<td>
<input type="button" value={% row.colname |","| row.dbname |","| row.schemaname |","| row.tablenm %} class="apireq" />
<td>
But seems not working. I welcome any help on this . Thanks In advance
Why not set them as data attributes?
<input type="button" class="apireq"
data-colname="{{row.colname}}"
data-dbname="{{row.dbname}}"
data-schemaname="{{row.schemaname}}"
data-tablenm="{{row.tablenm}}"
/>
Then in your click event handler you will have a reference to the button that generated the event, all you need to to is read the attributes off of it. And they are already parsed out so no worries there too.

Foundation 6 dropdown menu with input element

I am trying to have input in dropdown menu in founation, but once input is clicked, whole menu hides, how can I achieve such behaviour?
This is codepen of one of original examples, with just input added:
<input />
https://codepen.io/anon/pen/RqyroK
To achieve what you want you can change this line:
<ul class="dropdown menu" data-dropdown-menu>
To this:
<ul class="dropdown menu" data-dropdown-menu data-close-on-click-inside="false">
An explanation of all dropdown plugin options can be found here.

how to add icon in navbar odoo? after "Conversations" icon

Searched for it, as a result there is a file systray.xml in that three templates are there. that is all i found but when i try to add anything just like that file, it doesn't work.
I found a solution for this, what needs to be done is first create a template in an XML file, then render it using javascript widget.
XML file
<templates>
<t t-name="Icon">
<li>
<a class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false" title="Icon" href="#">
<i class="fa fa-envelope-open-o"/>
</a>
</li>
</t>
</templates>
JS file
odoo.define('your_module_name.icons', function (require) {
var SystrayMenu = require('web.SystrayMenu');
var Widget = require('web.Widget');
// Appends Icon template in system tray (navbar)
var IconMenu = Widget.extend({
template:'Icon',
});
SystrayMenu.Items.push(IconMenu);
});
This will do the work.

"The maximum amount of data that you can upload is NaN undefined" error is coming on uploading an image using "Upload Media" button in Sitecore

I am trying to upload media using below procedure:
Click on "Browse" of Image field in a sitecore item.
Click on "Upload Media" button.
Click on "Browse for Media files" and upload a new image.
By following the above procedure, I am getting this error message:
The maximum amount of data that you can upload is NaN undefined.
Hence the image doesn't upload. However I am able to upload image in Media Library and then after linking the same to the item but when trying to upload media directly from content item, I am getting the error.
How to solve this problem?
PFB Form tag statement
<form data-sc-id="Uploader" data-sc-databasename="master" data-sc-maxrequestlength="-1024" data-sc-executiontimeout="600" data-sc-destinationurl="/sitecore/media
library/Images/Social/Connector/download" data-sc-filesizeexceededtext="The maximum amount of data that you can upload is" data-sc-timeoutext="The media files could
not be uploaded. Please try again." class="sc-uploader row sc_Uploader_42 data-sc-registered" data-sc-require="/-/speak/v1/business/uploader.js" method="POST"
enctype="multipart/form-data">
<img class="sc-uploader-preview hide">
<div class="sc-uploader-content">
<span class="drag">
Drag and drop files here
<br>
or
<br>
</span>
<a href="#" class="btn btn-default sc-button sc_Button_14 data-sc-registered">
Browse for media files
<input class="sc-uploader-fileupload" type="file" name="files[]" multiple="" data-url="/api/sitecore/Media/Upload?
database=master&destinationUrl=/sitecore/media library/Images/Social/Connector/download">
</a>
<div class="sc-uploader-general-info">
<div class="sc-uploader-general-info-progressbar progress progress-success progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100"
style="display: none;">
<div class="bar data-sc-registered" data-bind="style: { width: globalPercentage() + '%' }" style="width: 0%;"></div>
</div>
<div class="sc-uploader-general-info-data" style="display: block;">
<div class="sc-uploader-general-info-data-col col1">
<div class="sc-uploader-general-info-data-uploadingData" style="display: none;"><span data-bind="text: uploadedSize" class="data-sc-
registered">0</span> of </div><span data-bind=" text: totalSize" class="data-sc-registered">11.2 Kb</span>
</div>
<div class="sc-uploader-general-info-data-col col2">|</div>
<div class="sc-uploader-general-info-data-col col3">
<div class="sc-uploader-general-info-data-uploadingData" style="display: none;">
<span data-bind=" text: uploadedFiles" class="data-sc-registered">0</span> of
</div>
<span data-bind=" text: totalFiles" class="data-sc-registered">1</span> <span data-bind=" visible: totalFiles() > 1" class="data-sc-registered"
style="display: none;">Files</span>
<span data-bind=" visible: totalFiles() === 1" class="data-sc-registered">File</span>
</div>
</div>
</div>
</div>
</form>
You need to check if you have set the maxRequestLength from the web.config or you can update it from the IIS.
Web.config Way
Navigate to the path: system.web/httpRuntime and check if you have an entry for httpRuntime. If not, you need to specify one as follows:
<httpRuntime maxRequestLength="512000" executionTimeout="3600" enableKernelOutputCache="false" relaxedUrlToFileSystemMapping="true" requestValidationMode="4.0" enableVersionHeader="false" />
Note that the length is in kilobytes
IIS Way
Open IIS
Click on the site you want to accept larger file sizes
In the main window double click ‘Request Filtering’
On the top tab right click to see options and select ‘Edit Feature Settings’
Now change the number in the field ‘Maximum allowed content length (bytes)’
If it is present, you may need to increase the length.
UPDATE
As you can see, the attribute data-sc-maxrequestlength="-1024" has a negative value and this is why the above error occurred. So, the issue is with the maxrequestlength.

Open a new window on click with ember

How can I open a new window when the user clicks on a link?
I have tried adding target="_blank" and bindAttr but it doesn't work.
The code that doesn't work:
<a target="_blank" {{action goToSettings href=true}}>App Settings</a>
or
<a {{bindAttr target="_blank"}} {{action goToSettings href=true}}>App Settings</a>
And this is the html output from the first example:
<a target="_blank" href="#/settings" data-ember-action="5">App Settings</a>
You have two choices:
send an action, and in the javascript that handles the action, call
window.open(...) to open a new window to a particular URL
Don't use an action and instead make it a static link or if you need to
dynamically vary the target URL, use <a target="_blank" {{bindAttr
href="yourBoundPropForTheUrl"}}>Click here</a>
This has been added to LinkView, and therefore is now supported directly in {{link-to}}.
Pull request is at https://github.com/emberjs/ember.js/pull/4718