Is there a way to add a notice on a toolbox page? I’d like to add reminder on the groups page (/livewhale?refresh=1groups) so that we remember to check some things when we add or edit groups…
Thanks,
-= G =-
Is there a way to add a notice on a toolbox page? I’d like to add reminder on the groups page (/livewhale?refresh=1groups) so that we remember to check some things when we add or edit groups…
Thanks,
-= G =-
Yep! I think _ingredients/backend/backend.js is the easiest way to do this, here’s an example:
(function ($, LW) {
if (livewhale.page == 'groups') {
$('div.main').prepend("<br/><br/><div class=\"lw_notice\"><p>Custom text.</p></div>");
}
}(livewhale.jQuery, livewhale));
We do this sort of thing all the time using backend.js. I usually just target the page ID…
$('body#groups #main').prepend('<div class="alert alert-danger">alert text</div>');
ah great - thanks guys!
-= G =-
sorry - looks like I should have found that in docs…
@karl Is there an “official” way to add a message like this to a backend page for a specific group and/or profile/blurb type? I’ve made it work by checking for specific text in the source code, like…
// Add message to Fac/Staff Profiles list in History group
if ( $('#profiles_list .lw-current-group').attr('title') == '66' && $('#page_profiles_list').text() == 'Faculty and Staff' )
Just wondering if there is a cleaner way.
Sure Jon, the on-page livewhale JavaScript variable (sometimes you’ll see referenced as LW in core code) is a good source of truth when it comes to a lot of info about back-end interfaces.
For instance,
if (livewhale.gid == 3 && livewhale.page == 'blurbs_edit')
I don’t see blurb/profile type (tid) in that JSON object currently, so maybe livewhale.request could be checked for the presence of ‘&tid=6’? Or look for $('body.blurbs_type_6').length? Otherwise I’ll make a note we could expose that var to the livewhale JS object in core to make this kind of JS customization a little easier.
I like that idea. Thanks for the other suggestions too.