I have registered a custom view for the faceted navigation, but I want to override the description slot.
In the body I have :
<metal:content-description fill-slot="content-description">
<metal:block define-macro="content-description">
My custom Description
</metal:block>
</metal:content-description>
<metal:content-core fill-slot="content-core">
<metal:block define-macro="content-core">
...
But this doesn't work, I've got the legacy description instead... The content-part is working.
Is there is something am I missing ?
It's not in the custom faceted preview template that you have to add the description.
You have to override the eea.facetednavigation.browser.template.view.pt and add your description.
<tal:left define="hidden python:request.set('disable_plone.leftcolumn', view.hide_left_column)" />
<tal:right define="hidden python:request.set('disable_plone.rightcolumn', view.hide_right_column)" />
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"
lang="en-US"
metal:use-macro="here/main_template/macros/master"
i18n:domain="eea">
<metal:jsslot fill-slot="javascript_head_slot">
<script type="text/javascript"
tal:content="string:jQuery(document).ready(function(evt){
Faceted.Load(evt, '${context/absolute_url}/');
});"></script>
<script type="text/javascript"
tal:content="string:jQuery(window).unload(function(){
Faceted.Unload();
});"></script>
</metal:jsslot>
<body>
<metal:content-description fill-slot="content-description">
<metal:block define-macro="content-description">
<div class="documentDescription" tal:condition="context/rich_description">
<tal:r tal:replace="structure context/rich_description">Description</tal:r>
</div>
</metal:block>
</metal:content-description>
<div metal:fill-slot="content-core">
<!-- Folder contents -->
<div class="faceted-form" metal:define-macro="widgets" id="faceted-form"
tal:define="mode view/mode | string:view" tal:attributes="data-mode mode">
<!-- Basic/Extended search -->
<div class="faceted-sections-buttons">
More filters
Less filters
</div>
<metal:widgets use-macro="here/##faceted_widgets/macros/widgets" />
<!-- Faceted version -->
<div style="display: none" id="faceted-version"
tal:content="here/##faceted_version|string:" />
</div>
</div>
</body>
</html>
Related
I've been trying to get a Javascript function to fire when my page's AJAX processing is triggered without success. Most of my time has been spent trying to get the OnBegin AjaxOption value working, but I have spent time with the global JQuery .ajaxSend handler as well (which I believe might not be compatible with ASP.NET MVC), both without success.
I've reduced my page to something pretty simple. My Index.cshtml for the project is:
#using SalePointWebItemInquiry.Controllers
#using System.Web.Mvc.Ajax
#{
ViewBag.Title = "Home Page";
}
#Scripts.Render("~/bundles/jquery", "~/bundles/jqueryval")
<script type="text/javascript">
function TestFunction() {
alert("Calling testfunction.");
}
</script>
#using (Ajax.BeginForm("PressButton",
"Home",
new AjaxOptions
{
OnBegin = "TestFunction"
}))
{
<div>
<input class="btn btn-default" type="submit" id="1" name="buttonType" value="Enter" />
</div>
}
The page that this renders is:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Home Page - My ASP.NET Application</title>
<link href="/Content/bootstrap.css" rel="stylesheet" />
<link href="/Content/site.css" rel="stylesheet" />
<script src="/Scripts/modernizr-2.6.2.js"></script>
</head>
<body>
<div class="container body-content bordered">
<script src="/Scripts/jquery-1.10.2.js"></script>
<script src="/Scripts/jquery.validate.js"></script>
<script src="/Scripts/jquery.validate.unobtrusive.js"></script>
<script type="text/javascript">
function TestFunction() {
alert("Calling testfunction.");
}
</script>
<form action="/Home/PressButton" data-ajax="true" data-ajax-begin="TestFunction" id="form0" method="post">
<div>
<input class="btn btn-default" type="submit" id="1" name="buttonType" value="Enter" />
</div>
</form>
<footer>
<div class="row">
<div class="col-md-5">
<p>© 2015 - Application</p>
</div>
<div class="col-md-7 text-right">
Version: Put version here
</div>
</div>
</footer>
</div>
<script src="/Scripts/jquery-1.10.2.js"></script>
<script src="/Scripts/bootstrap.js"></script>
<script src="/Scripts/respond.js"></script>
<!-- Visual Studio Browser Link -->
<script type="application/json" id="__browserLink_initializationData">
{"appName":"Internet Explorer","requestId":"d2eef5342ac64f3db1545856102f4a6f"}
</script>
<script type="text/javascript" src="http://localhost:53954/45ae7332668647b5a3795d87cd6ba1a9/browserLink" async="async"></script>
<!-- End Browser Link -->
</body>
</html>
Does anyone have any thoughts on why the TestFunction() Javascript function isn't firing when I click the ENTER button?
Solution:
Thanks for the help :). I wasn't properly referencing jquery.unobtrusive-ajax.js. The direct solution to my problem was to use Nuget to retrieve a Javascript package that wasn't local using this command at Nuget console:
Install-Package Microsoft.jQuery.Unobtrusive.Ajax
Since I didn't have jquery.unobtrusive-ajax.js locally, all of my attempts to reference it locally failed. I may have tried a CDN reference once or twice, but that never worked out and I had a lot of theories as to the cause of the problem at the time.
I didn't even have to change the code. This code in BundleConfig.cs automatically included the file once I had retrieved it:
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.unobtrusive*",
"~/Scripts/jquery.validate*"));
You have duplicated
<script src="/Scripts/jquery-1.10.2.js"></script>
Remove the second one and then you also need to add jquery.unobtrusive-ajax.js in order for Ajax.BeginForm() to work (other wise you just making a normal submit - and therefore TestFunction() will never be called)
Looks like you are loading your script before JQuery can load. Scripts need to load at the bottom of the page just before the body tag and after JQuery loads.
Please try
#section Scripts
{
<script type="text/javascript">
function TestFunction() {
alert("Calling testfunction.");
}
</script>
}
This will place the script after JQuery loads.
So I'm using a jQuery plug-in called Coin Slider. The slideshow seems to be working fine but I want to connect it with a database that I have created in the App_Date folder in Visual Studio 2010.
When clicked on a certain picture, I want the system to search the table in the database using the description of that particular image in the slideshow as a keyword. If the item exists in the database, it would go to the website mentioned in the href. Otherwise, it would display "item not found".
All I've done is make the slideshow.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="js/jquery-1.9.1.js" type="text/javascript"></script>
<script src="css/coin-slider/coin-slider.min.js" type="text/javascript"></script>
<link href="css/coin-slider/coin-slider-styles.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
$(document).ready(function () {
$('#coin-slider').coinslider();
});
</script>
</head>
<body>
<div id='coin-slider'>
<a href="the first website goes here" target="_blank">
<img src='1.jpg' >
<span>
Description goes here
</span>
</a>
<a href="the second website goes here">
<img src='2.jpg' >
<span>
Description goes here
</span>
</a>
</div>
</body>
</html>
Any help would be appreciated.
Is there a pattern or anything I can do to load remote asp.net views properly? I have my index page that basically looks like this:
Index page works fine using new kendo.mobile.Application(document.forms[0]):
<form runat="server">
<div data-role="view" id="indexPageInitialView"> ... </div>
<div data-role="view" id="indexPageOtherView"> ... </div>
</form>
Remote view page issue:
<form runat="server">
<div data-role="view" id="remoteView1"> ... </div>
<div data-role="view" id="remoteView2"> ... </div>
</form>
I know Kendo loads remote views that can be [at most] descendants within the body tag, so I am thinking I'm backed into a corner here.
Update
When I attempt to simply load the remote view that is surrounded with the form tag, I get this error:
Uncaught TypeError: Cannot call method 'getAttribute' of undefined kendo.all.min.js:9
kendo.initWidget kendo.all.min.js:9
w.extend._createView kendo.all.min.js:31
w.extend._createRemoteView kendo.all.min.js:31
(anonymous function) kendo.all.min.js:31
l jquery.min.js:2
c.fireWith jquery.min.js:2
T jquery.min.js:2
r
If I nest the form tag within the remote view, it works, however, that is not a viable solution.
Update 2
Here is a more complete example of my situation.
index.aspx:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Index</title>
</head>
<body>
<form runat="server">
<div id="indexPageInitialView" data-role="view">
<div data-role="content">
Load remote view
</div>
</div>
</form>
<script src="jquery.min.js"></script>
<script src="kendo.all.min.js"></script>
<script>
var app = new kendo.mobile.Application(document.forms[0]);
</script>
</body>
</html>
remote.aspx:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Remote</title>
</head>
<body>
<form runat="server">
<div id="remoteView1" data-role="view">
<div data-role="content">
<h1>Hi I am a remote view</h1>
</div>
</div>
</form>
</body>
</html>
Kendo will load only the first view found in the remote view. So if you make the call to remote view correctly, remoteView1 should load. If this is not the answer you are looking for, please post the full code in JSFiddle with more description.
I've been dealing with a plone upgrade and I think I'm almost done cleaning things up.
This latest error is getting me...
In the main_template I get an error:
Macro Expansion failed
exceptions.NameError: name 'pathexpr' is not defined
I traced it back to coming from the portlets_fetcher template. This one came out of the box but it's still throwing the error.
I don't get it, I see right there:
tal:define="pathexpr python:slot[0];
usemacro python:slot[1];"
anyone know why I'm getting this?
My troubleshooting, I got the error trying to edit the custom main_template. I didn't see pathexpr anywhere so I used the find tab on the skins folder and the only result was for portlets_fetcher. I copied portlets_fetcher to custom and saw the same error there.
edit: Here is the portlets_fetcher template:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
i18n:domain="plone">
<body>
<metal:leftcolumn define-macro="left_column"
tal:define="Iterator python:modules['Products.CMFPlone'].IndexIterator;
tabindex python:Iterator(pos=10000, mainSlot=False);"0
tal:condition="sl|nothing">
<metal:block tal:repeat="slot sl">
<tal:dontcrash tal:on-error="structure python:context.plone_log('Error %s on %s while rendering portlet %s'%(error.type, error.value, slot[0])) or
'<div class=\'error\'>Error %s on %s: %s</div>' % (error.type, slot[0], error.value)"
tal:define="pathexpr python:slot[0];
usemacro python:slot[1];">
<tal:block tal:condition="usemacro">
<metal:block metal:use-macro="python:path(pathexpr)" />
</tal:block>
<span tal:condition="not: usemacro"
tal:replace="structure python:path(pathexpr)" />
</tal:dontcrash>
</metal:block>
</metal:leftcolumn>
<metal:rightcolumn define-macro="right_column"
tal:define="Iterator python:modules['Products.CMFPlone'].IndexIterator;
tabindex python:Iterator(pos=20000, mainSlot=False);"
tal:condition="sr">
<metal:block tal:repeat="slot sr">
<tal:dontcrash tal:define="pathexpr python:slot[0];
usemacro python:slot[1];">
<tal:block tal:condition="usemacro">
<metal:block metal:use-macro="python:path(pathexpr)" />
</tal:block>
<span tal:condition="not: usemacro"
tal:replace="structure python:path(pathexpr)" />
</tal:dontcrash>
</metal:block>
</metal:rightcolumn>
</body>
</html>
and here is the main_template:
<metal:page define-macro="master"><metal:doctype define-slot="doctype"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"></metal:doctype>
<metal:block define-slot="top_slot" />
<metal:block use-macro="here/global_defines/macros/defines" />
<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="en"
lang="en"
tal:attributes="lang language;
xml:lang language">
<tal:cache tal:define="lang language;
charset site_properties/default_charset|string:utf-8">
<metal:cache use-macro="here/global_cache_settings/macros/cacheheaders">
Get the global cache headers located in global_cache_settings.
</metal:cache>
</tal:cache>
<head metal:use-macro="here/header/macros/html_header">
<metal:fillbase fill-slot="base">
<metal:baseslot define-slot="base">
<base href="" tal:attributes="href here/renderBase" />
</metal:baseslot>
</metal:fillbase>
<metal:headslot fill-slot="head_slot">
<metal:headslot define-slot="head_slot" />
<tal:comment replace="nothing"> A slot where you can insert elements in the header from a template </tal:comment>
</metal:headslot>
<metal:styleslot fill-slot="style_slot">
<tal:comment replace="nothing"> A slot where you can insert CSS in the header from a template </tal:comment>
<metal:styleslot define-slot="style_slot" />
</metal:styleslot>
<metal:cssslot fill-slot="css_slot">
<tal:comment replace="nothing"> This is deprecated, please use style_slot instead. </tal:comment>
<metal:cssslot define-slot="css_slot" />
</metal:cssslot>
<metal:javascriptslot fill-slot="javascript_head_slot">
<tal:comment replace="nothing"> A slot where you can insert javascript in the header from a template </tal:comment>
<metal:javascriptslot define-slot="javascript_head_slot" />
</metal:javascriptslot>
</head>
<body tal:attributes="class here/getSectionFromURL;
dir python:test(isRTL, 'rtl', 'ltr')">
<div id="visual-portal-wrapper">
<div id="portal-top" i18n:domain="plone">
<div id="portal-header">
<p class="hiddenStructure">
<a accesskey="2"
tal:attributes="href string:${current_page_url}#documentContent"
i18n:translate="label_skiptocontent">Skip to content.</a> |
<a accesskey="6"
tal:attributes="href string:${current_page_url}#portlet-navigation-tree"
i18n:translate="label_skiptonavigation">Skip to navigation</a>
</p>
<div metal:use-macro="here/global_siteactions/macros/site_actions">
Site-wide actions (Contact, Sitemap, Help, Style Switcher etc)
</div>
<!--div metal:use-macro="here/global_searchbox/macros/quick_search">
The quicksearch box, normally placed at the top right
</div-->
<a metal:use-macro="here/global_logo/macros/portal_logo">
The portal logo, linked to the portal root
</a>
<!--div metal:use-macro="here/global_skinswitcher/macros/skin_tabs">
The skin switcher tabs. Based on which role you have, you
get a selection of skins that you can switch between.
</div-->
<div metal:use-macro="here/global_sections/macros/portal_tabs">
The global sections tabs. (Welcome, News etc)
</div>
</div>
<div metal:use-macro="here/global_personalbar/macros/personal_bar">
The personal bar. (log in, logout etc...)
</div>
<!--div metal:use-macro="here/global_pathbar/macros/path_bar">
The breadcrumb navigation ("you are here")
</div-->
</div>
<!--div class="visualClear" id="clear-space-before-wrapper-table" /-->
<tal:comment replace="nothing">
The wrapper table. It contains the three columns. There's a table-less
alternative in the plone_tableless skin layer that you can use if you
prefer layouts that don't use tables.
</tal:comment>
<table id="portal-columns">
<tbody>
<tr>
<tal:comment replace="nothing"> Start of the left column </tal:comment>
<td id="portal-column-one"
metal:define-slot="column_one_slot"
tal:condition="sl">
<div class="visualPadding">
<metal:portlets define-slot="portlets_one_slot">
<metal:leftportlets use-macro="here/portlets_fetcher/macros/left_column">
This instruction gets the portlets (boxes) for the left column.
</metal:leftportlets>
</metal:portlets>
</div>
</td>
<tal:comment replace="nothing"> End of the left column </tal:comment>
<tal:comment replace="nothing"> Start of main content block </tal:comment>
<td id="portal-column-content"
tal:define="tabindex python:Iterator(pos=0, mainSlot=True)">
<metal:block define-slot="content">
<div id="content"
metal:define-macro="content"
tal:define="show_border python:here.showEditableBorder(template_id=template_id, actions=actions );"
tal:attributes="class python:test(show_border,'documentEditable','')">
<metal:ifborder tal:condition="show_border" >
<tal:block tal:condition="not:here/isAnonymousUser">
<div metal:use-macro="here/global_contentviews/macros/content_views">
The content views (View, Edit, Properties, Workflow)
</div>
<div metal:use-macro="here/global_contentviews/macros/content_actions">
The content bar
</div>
</tal:block>
</metal:ifborder>
<div class="documentContent" id="region-content">
<a name="documentContent"></a>
<div metal:use-macro="here/global_statusmessage/macros/portal_message">
Portal status message
</div>
<metal:bodytext metal:define-slot="main" tal:content="nothing">
Page body text
</metal:bodytext>
<metal:sub metal:define-slot="sub">
<metal:discussion use-macro="here/viewThreadsAtBottom/macros/discussionView" />
</metal:sub>
</div>
</div>
</metal:block>
</td>
<tal:comment replace="nothing"> End of main content block </tal:comment>
<tal:comment replace="nothing"> Start of right column </tal:comment>
<td id="portal-column-two"
metal:define-slot="column_two_slot"
tal:condition="sr">
<div class="visualPadding">
<metal:portlets define-slot="portlets_two_slot">
<metal:rightportlets use-macro="here/portlets_fetcher/macros/right_column">
This instruction gets the portlets (boxes) for the right column.
</metal:rightportlets>
</metal:portlets>
</div>
</td>
<tal:comment replace="nothing"> End of the right column </tal:comment>
</tr>
</tbody>
</table>
<tal:comment replace="nothing"> end column wrapper </tal:comment>
<div class="visualClear" id="clear-space-before-footer"><!-- --></div>
<hr class="netscape4" />
<metal:block i18n:domain="plone">
<metal:footer use-macro="here/footer/macros/portal_footer">
Footer
</metal:footer>
<metal:colophon use-macro="here/colophon/macros/colophon">
The colophon area - contains details about the production of
the site. Typically "powered by" buttons, standards, tools used.
</metal:colophon>
</metal:block>
</div>
</body>
</html>
</metal:page>
Appears that this wasn't the root of the issue. Will open another inquiry with proper info.
Thanks for looking!
I have a file upload control in asp.net which is used to upload image file. Now what I want is I have image control so when a user uploads a file, The image from that file should be visible in the image control before it is really upload on the server. When ever user changes the file, the change should be reflected in that image control. I dont want to use any additional button other than file upload control.
Is there any way to do this with javascript??
I think thats possible in HTML5 supported browsers
check the HTML5 FILE API http://www.w3.org/TR/FileAPI/
This works in FF3+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>input type=file & Firefox 3</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js" type="text/javascript"></script>
</head>
<body>
<h1>This works in Firefox 3+</h1>
<script type="text/javascript">
// <![CDATA[
function inputFileOnChange() {
if (document.getElementById('fichier').files) {
$("#dvFileName").html(document.getElementById('fichier').files.item(0).name);
$("#imgImage").attr("src" ,document.getElementById('fichier').files.item(0).getAsDataURL());
};
};
// ]]>
</script>
<div>
<input type="file" name="fichier" id="fichier" onchange="inputFileOnChange();" />
<br /><br />
<img id="imgImage" src="" width="200" height="200" alt="" />
<div id="dvFileName">
</div>
</div>
</body>
</html>