Sounds like a lot of job for this little feature, you probably need to change the core and look at the loaded node if it has a template, if not modify the buttons-property of the TinyMCE-plugin. Or dose anyone else know a better way to solve it?
yup, can't do without touching the core, unless you fiddle around with jquery and "hide" the preview button based on the values in the templates dropdown list. For some inspiration have a look at this package (not for production use, but shows how to do some stuff in the backend without touching the core)
Dirk, thanks! I am really interested to hide it using jQuery. I looked at the source of that package but I don't get it. Would you mind telling me how to do it or is it something very hard?
You could check if the current page has any template and based on that insert this code:
$(document).ready(function() { // Hide element $("body_T1_cut").hide(); });
But i'm not sure how to hook in to the edit content page? An ugly way would be to make a custom data type that readerns the jQuery, but it sounds like dirty coding to me!
We are talking about this page: /umbraco/editContent.aspx?
As you say, it's an Umbraco page and a part of the core framework so changing it is not a good idea. I'm not sure if my approch is good but I think it may work. If you make a custom datatype and insert in the current document you will be able to run the code when editContent.aspx loads without changing the core. This may not be the best way, I'm not sure.
How to hide Preview button on documents with no templates
If a document has no template, clicking preview will show the "intentionally ugly" error page.
I do have a lot of items with no template (eg. News item, Downloadable file, etc).
How do I hide the preview button on these documents?
Thanks in advance!
Sounds like a lot of job for this little feature, you probably need to change the core and look at the loaded node if it has a template, if not modify the buttons-property of the TinyMCE-plugin. Or dose anyone else know a better way to solve it?
yup, can't do without touching the core, unless you fiddle around with jquery and "hide" the preview button based on the values in the templates dropdown list. For some inspiration have a look at this package (not for production use, but shows how to do some stuff in the backend without touching the core)
Cheers,
/Dirk
Dirk, thanks! I am really interested to hide it using jQuery. I looked at the source of that package but I don't get it. Would you mind telling me how to do it or is it something very hard?
You could check if the current page has any template and based on that insert this code:
$(document).ready(function() {
// Hide element
$("body_T1_cut").hide();
});
But i'm not sure how to hook in to the edit content page? An ugly way would be to make a custom data type that readerns the jQuery, but it sounds like dirty coding to me!
@Dirk - Do you have any ideas?
Thanks Markus! Where am I supposed to put in that javascript?
I mean, this is an Umbraco page, not a custom section or anything...
We are talking about this page: /umbraco/editContent.aspx?
As you say, it's an Umbraco page and a part of the core framework so changing it is not a good idea. I'm not sure if my approch is good but I think it may work. If you make a custom datatype and insert in the current document you will be able to run the code when editContent.aspx loads without changing the core. This may not be the best way, I'm not sure.
More on custom datatypes: http://www.nibble.be/?p=50
Thanks Markus! Alright, I just hacked it in into umbraco/editContent.aspx. It seems to work.
This is what I added:
For umbraco < 7 you could also use this to inject your custom script:
https://our.umbraco.org/projects/backoffice-extensions/backoffice-power-scripts/
I'd like to do this in umbraco 7, any ideas?
is working on a reply...