in a web application (= multi user environment) I need to disable certain menu entries in a top bar, depending on the currently logged-in user etc. To keep consistency in the UI, hiding/omitting the menu entries is not an option. Adding disabled/inactive/whatsoever class which is the way to go on other foundation elements e.g. buttons is not supported by the framework, obviously.
<li><a class="disabled" href="#">Disabled Menu Entry</a></li>
Any ideas?
Your question has nothing to do "directly" with Foundation. Disabling and/or hiding elements is either a CSS thing or javascript. You can NOT directly disable an anchor tag but you can simulate it's "disabled behavior". Based on what logic you have, how you will determine if an anchor tag should be disabled, you can do the following:
<style>
.disabled-link {
text-decoration:none; // really not needed for the Top Bar, just for general technique
cursor: auto;
}
</style>
<script>
$(document).ready(function(){
$(".disabled-link").click(function(e){
e.preventDefault();
return false;
});
});
</script>
<a class="disabled-link" href="#">Disabled Menu Entry</a>
Take note that the disabled-link class should be applied there based on some logic, this depends on your server side code - you did not tell us what other tools you were using. If you are using ASP.Net, PHP or whatever.
Additionally you should remember to validate on the server as there is no way of stopping your users to circumvent the disabled behavior of the links.
Related
How to disable right clicking mathjax in shiny? For example, see
https://shiny.rstudio.com/gallery/mathjax.html
Ideally, I would like users not to be abe to interact with the mathjax text at all.
You can turn off the MathJax contextual menu by adding
<script type="tet/x-mathjax-config">
MathJax.Hub.Config({
showMathMenu: false
});
</script>
to your page just before the script that loads MathJax.js itself.
I would encourage you not to do this, however. There are important functions in the menu, including the controls for those using assistive technology like screen readers. Those users may need access to those controls to set things appropriately for their assistive needs. If you disable the menu, you may prevent them from being able to use your pages.
In case of MathJax 3 use the following syntax:
MathJax = {
options: {
renderActions: {
addMenu: []
}
}
};
a little CSS rule
mjx-container.MathJax {
pointer-events: none;
}
I have deployed my first page in Sitecore. But it is not rendered perfectly in Content editor preview mode.
Original html:
There is a nav menu and a banner below it. Behind them is a white transparent overlay & behind the overlay is a graffiti background image.
View from Experience editor:
The settings icon went offset. The white overlay is now above the Sitecore menu preventing the edits.
Error in browser console:
Uncaught TypeError: element.dispatchEvent is
not a function - prototype.js:5734
Uncaught TypeError:
element.attachEvent is not a function - prototype.js:5653
View in Content Editor:
It is rendered as if for a tablet, as you see the menu got shifted to the icon. I understand, it is because of the dimensions of the preview panel.
But, if this is the case, how will an author be able to edit/view the correct design.
Prototype.js is not a file being used by the site. So, it must be from Sitecore's.
Im guessing , certain CSS props, aren't being respected (Like position, transformnation).
Is this a bug. How to fix this. I have checked in different browsers (IE, chrome & firefox). It's the same
It looks like you are running into a conflict with prototype.js. Sitecore uses this in the experience editor.
If you are using jQuery in your site, there is a kb article about that here: https://kb.sitecore.net/articles/286042
To fix the issue, you need to run jQuery in no conflict mode. There are a few ways of doing that. Here is a simple example:
<!-- Putting jQuery into no-conflict mode. -->
<script src="prototype.js"></script>
<script src="jquery.js"></script>
<script>
var $j = jQuery.noConflict();
// $j is now an alias to the jQuery function; creating the new alias is optional.
$j(document).ready(function() {
$j( "div" ).hide();
});
// The $ variable now has the prototype meaning, which is a shortcut for
// document.getElementById(). mainDiv below is a DOM element, not a jQuery object.
window.onload = function() {
var mainDiv = $( "main" );
}
</script>
You can find more on the jQuery website: http://learn.jquery.com/using-jquery-core/avoid-conflicts-other-libraries/
You also need to be careful with your CSS - don't absolutely position elements to the top of your browser, always make sure they are relative to a container so that the Sitecore EE DOM elements can be added and positioned correctly.
I have an Ember.js component called table-viewer. It has a toolbar which is a div with buttons. I have another ember component called report-viewer. It contains a variety of things including a table-viewer.
I want to have report-viewer add some buttons to the toolbar. What I have works but breaks the Ember connection with the element so I can't change the button text after moving it. Is there a better way to do this?
I have a lot more components than I just said, so defining the complete toolbar in table-viewer and setting flags for what to show would be annoying to manage.
Below is what I currently have in table-viewer so that any component can add additional buttons to the toolbar:
Ember.$('#toolbar').append(Ember.$('#additionalToolbar').html());
Ember.$('#additionalToolbar').remove();
I figured it out! The following works without breaking Ember connections:
Ember.$('#additionalToolbar > button').appendTo(Ember.$('#toolbar'));
It's hard to say what the best approach is without seeing the relevant code. That said, my first suggestion would be a simple yield:
report-viewer/template.hbs
{{#table-viewer}}
<button>
Some button from the report viewer...
</button>
{{/table-viewer}}
table-viewer/template.hbs
<nav>
<button>
Button one
</button>
<button>
Button two
</button>
{{yield}}
</nav>
<table>
...
</table>
If you need more that one yield, you can achieve multiple named yields with this approach.
I'd also suggest splitting the toolbar out into its own component if you haven't already. It feels wrong to put a toolbar button as the block contents of the table-viewer component as I've done above.
I want to disable online ordering facility from open cart. I want to disable following features
My account
Wish List
shopping cart
Checkout
How to do those things? The reason is the disable it, Now is the very beginning of the web site. Latter we'll add those features too
You can always disable them with CSS? since you want to re-enable them later
for instance
In my store the cart button is .product-grid .cart .button
So just open your stylesheet.css file in catalog/view/theme/YOURTHEME/stylesheet/stylesheet.css
.product-grid .cart .button{
display:none
}
make sure you put it in the bottom of your stylesheet or it might not work since css looks for the last style
If you are not sure how to find all that info
Right click on your cart button inspect element
On the right side you will see a box Styles
Under it you will see the style like: .product-grid .cart .button
or something else depending on your theme
Is facebook 'like' only button (without counter) no longer possible?
How do I shut off the counter +'comment-bubble'? works g+,pinit etc - on these I easily using their HTML5 code generators create asyncronous buttons without counters - don't show any counter - see www.LazyBee.biz for clarification.
Any ideas?
How do I fix this code so no counter is shown (see under comments below):
Wwhy can't facebook do like all other major social players and let user opt out of the counter-swamp?
I have seen some people put the like button in an <div> and then make the width exactly the width of the button (without the counter) and put overflow: hidden in the CSS for the div. Basically the div acts as a matte of sorts.
Sure, just create a button yourself and use the API to initiate a like. See also How to trigger Facebook like button from custom button?
It is possible to generate the Facebook like button without the counter bubble.
In the code that Facebook's generator gives you there will be a parameter called data-layout, depending on the options you selected it will be one of four things: standard, box_count, button_count or button.
If you use button it will generate a single button with no counter.
EDIT:
I just noticed your comment with the code supplied by Facebook. If you change it to the following it will remove the counter:
<div class="fb-like" data-href="lazybee.biz " data-width="30" data-layout="button" data-show-faces="false" data-send="true"></div>