The current actions collapsable fieldset has some issues with some themes. The current code calls privatemsg-list.js which hides just the input element of the execute button, however many themes use the surrounding spans to theme the input buttons in their forms, in which case it causes odd partial button artifacts to appear in the form, in what should be a hidden button. A better fix would probably be to simply use AHAH on the select box, but in the interest of time I've implemented the following solution.
I have made the following changes to the privatemsg module to make it more compatible with all themes.
1. edit privatemsg.module, line 1917 to the following:
$form['submit'] = array(
'#prefix' => '<div class="privatemsg-op-button">',
'#suffix' => '</div>',
'#type' => 'submit',
'#value' => t('Execute'),
'#submit' => array('privatemsg_list_submit'),
'#attributes' => array('class' => 'privatemsg-action-button'),
);
and privatemsg-list.js to the following:
Drupal.behaviors.hideButtons = function (context) {
$("div.privatemsg-op-button").hide();
};
This makes sure all aspects of the button are hidden and plays much nicer with all themes.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | privatemsg_list_js_fixes.patch | 4.79 KB | berdir |
| #6 | privatemsg-634194.patch | 3.1 KB | raklar |
| #3 | privatemsg-634194.patch | 1.32 KB | raklar |
| #2 | privatemsg.patch | 1.05 KB | raklar |
Comments
Comment #1
berdirAHAH would be nice, but won't get in the 1.0 release so that's something for later...
Any chance you can provide a simple patch for your changes? That would be a lot easer to review and see what you have actually changed. See http://drupal.org/patch/create
Comment #2
raklar commentedHopefully this is correct format for patches....It's probably not exactly right since I just did it from my svn repository instead of the drupal cvs one.
I agree with your statement about AHAH, that's the whole reason I looked for a quick and simple alternative for my code and this seems to do the trick nicely.
Comment #3
raklar commentedOk here is a proper patch, I noticed I put it in the wrong version as it should be in the 6.x.1.x dev version.
Cheers
Comment #4
berdirThanks for working on it. Two things I've noticed:
- The indentation of the second part looks wrong, it seems that you have used tabs. You should only use 2 spaces per indentation.
- The privatemsg_filter.module contains two more buttons that work very similiar. Can you patch these too?
Comment #5
raklar commentedHi, sure I could probably find some time to look at it, not surprised about the indentation I had a major computer crash last week and still tweaking out all the pieces of my dev environment yet.
There's actually another issue I noticed in the privatemsg_new form that's messing up our theme I might have a quick look at well.
Comment #6
raklar commentedHi Again, just looking at privatemsg-filter.module and I don't think it has the exact same problem. looking at privatemsg_filter_form_privatemsg_list_alter, it does do an onchange on the dropdown, as far as I can tell it doesn't try to hide the add-submit or the tag-remove submit buttons, so this fix won't help that at the moment since the input element isn't being hidden.
I added a preffix and suffix to the two elements anyway so if in the future you want to hide them the code will work in the same way.
Cheers,
Comment #7
berdirIt is using the same class as privatemsg.module and those buttons are therefore hidden too. Your change does actually break that feature, that's maybe why you haven't noticed it.
It should work if you use the same class in your newly added div.
Comment #8
raklar commentedok, makes sense, as we don't use filters and I didn't install them untill after my other change.
Comment #9
berdirUpdates:
- Moved all JS-Handling, including onchange to the js-file
- Added a separate privatemsg-filter-list.js file for privatemsg_filter.module
Comment #10
berdirCommited to 6.x-1.x-dev, will port this to 7.x later.
Comment #11
naheemsays commentedI dislike the repercussions of this - Will any module adding to this actions area will need its own javascript handling now?
Comment #12
berdirIf they add their own buttons, then yes.
However, they should not do that unless they have a good reason, since the action bar is already quite full with stuff (and spans over two lines when you have long tags, we should shorten them...)
Comment #13
berdirAlso commited to 7.x-1.x-dev.