I've often wondered why there is no option to include a universal user javascript file with Fabrik. (Or is there, and I'm missing something?)
It's great that there is an option to include javascript for any list, form, or detail view - but there are many times where I find myself creating redundant javascript code in various form_xx.js or list_xx.js files that I want included in ALL my lists (and/or forms).
Can I suggest/propose including the option to include a universal user javascript file that gets loaded with the fabrik core files? e.g. /media/com_fabrik/js/fabrik_user.js
For example - I want to add this javascript code to the form views for ALL my forms.
What it does is append a 'footnote' to the Fabrik 'Action Buttons' in any form - 'telling' the user what the star and asterisk icons next to the labels mean. (See attachment).
I don't want to have to do this in php - for each view template - I just want to be able to do this at one place, in one file.
That is being done with this code...
The problem is - I have inserted that code at the end of the fabrik.js file and have to do so every time I update from github. (Or insert it in EVERY form_xx.js file in my project)
It sure would be nice if I could just include that code in ONE 'fabrik_user.js' file - and no longer have to worry about that.
Before I write a pull request at Github to do this, I need some feedback to be assured it will work and is or isn't a good idea.
It's great that there is an option to include javascript for any list, form, or detail view - but there are many times where I find myself creating redundant javascript code in various form_xx.js or list_xx.js files that I want included in ALL my lists (and/or forms).
Can I suggest/propose including the option to include a universal user javascript file that gets loaded with the fabrik core files? e.g. /media/com_fabrik/js/fabrik_user.js
For example - I want to add this javascript code to the form views for ALL my forms.
What it does is append a 'footnote' to the Fabrik 'Action Buttons' in any form - 'telling' the user what the star and asterisk icons next to the labels mean. (See attachment).
I don't want to have to do this in php - for each view template - I just want to be able to do this at one place, in one file.
That is being done with this code...
JavaScript:
if (jQuery("i.icon-question-sign.small").length > 0 && jQuery("i.icon-star.small").length > 0) {
jQuery(".fabrikActions").children("div").last().append('<div style="display:inline-block;margin-top:-3px;"><ul style="display:block;margin:0 0 0 45px;list-style:none;"><li><i data-isicon="true" class="icon-question-sign small "></i>= Hover mouse pointer for tip</li><li><i data-isicon="true" class="icon-star small "></i>= Validation required</li></ul></div>');
} else if(jQuery("i.icon-question-sign.small").length > 0) {
jQuery(".fabrikActions").children("div").last().append('<div style="display:inline-block;margin-top:5px;"><ul style="display:block;margin:0 0 0 45px;list-style:none;"><li><i data-isicon="true" class="icon-question-sign small "></i>= Hover mouse pointer for tip</li></ul></div>');
} else if(jQuery("i.icon-star.small").length > 0) {
jQuery(".fabrikActions").children("div").last().append('<div style="display:inline-block;margin-top:5px;"><ul style="display:block;margin:0 0 0 45px;list-style:none;"><li><i data-isicon="true" class="icon-star small "></i>= Validation required</li></ul></div>');
}
The problem is - I have inserted that code at the end of the fabrik.js file and have to do so every time I update from github. (Or insert it in EVERY form_xx.js file in my project)
It sure would be nice if I could just include that code in ONE 'fabrik_user.js' file - and no longer have to worry about that.
Before I write a pull request at Github to do this, I need some feedback to be assured it will work and is or isn't a good idea.