When there's no operation available, e. g. restricted by action permissions, the bulk operation drop down, shouldn't show up. Currently you just have one entry "Choose an operation", but nothing else.

Further I moved the single operation to the top, like the selector. I think this is more intuitive to users, as they might not want to scroll down.

Comments

gnindl’s picture

Status: Needs work » Needs review

Change status

infojunkie’s picture

Status: Needs review » Needs work

Hiding the drop down without explanation would confuse users as much or more than an empty selector. IMO there could be a message instead of the drop down saying something like "No operations found".

Re: moving the single operation to the top, that's already implemented in the latest dev.

infojunkie’s picture

Title: Hide operations selector if no operation available & move single operation to top » Hide operations selector if no operation available
Category: bug » feature

Renaming title to main issue.

fluxsauce’s picture

I agree with gnindl and appreciate the patch; I have a view that has role-based bulk operations, and some roles do not have access to those operations. Rather than giving someone a message that they don't have access to any roles or maintaining two, essentially duplicate versions of the same view, it's better to not show the options at all.

As a compromise, make it an option:

  • Hide VBO form if no operations are available
  • Show VBO form and status message if no operations are available: _____ (default status message: 'No operations are available')
  • Show VBO form even if no operations are available (this is the current default).
chintan4u’s picture

StatusFileSize
new36.58 KB

Hello Guys....!
I am also facing same problem.
Like FluxSauce ... I want to show VBO only to Admin & editor role .
I don't want show drop-down to normal users.

How to achieve this in correct manner ("the drupal way")

bojanz’s picture

The patch in the original post needs to be rerolled to include infojunkie's feedback from #2. That's the "drupal way"

gnindl’s picture

Status: Needs work » Needs review
StatusFileSize
new3.28 KB

A) I removed the code for moving a single operation to the top as it has been done in elsewhere

B) IMHO a message like "No operations found" would be very confusing for an END USER (If there are no operations available why the heck should you display anything?). It's just irritating. I see that it would be confusing for and administrator or developer if no message is displayed (module not enabled, code not working etc.). I think the end user's requirements should take precedence. Further I don't think showing an empty selector is a best practice for UX design.

Esculap’s picture

I'm having the same problem in drupal 7

infojunkie’s picture

Status: Needs review » Needs work

The patch in #7 is working well, but now we get a series of checkboxes that do nothing - since the action drop-down has been removed. I don't think that's good UX because the user is confused as to whether the actions are intentionally hidden or he's seeing a bug.

The comment in #5 hints that maybe the view should revert to a normal table style if there are no actions. Or just remove the checkboxes column.

Bevan’s picture

Title: Hide operations selector if no operation available » Hide operations selector & checkboxes if no operation available, Drupal 6

There are patches for this same feature but for versions 7.x-3.x-dev and 7.x-3.x-rc1 at #1618474: Hide operations selector & checkboxes if no operation available.

jyee’s picture

StatusFileSize
new458 bytes

The patch in #7 didn't work for me against the latest dev (commit 6aaa911 - 3 May 2012). Notably, it doesn't apply cleanly and when manually adding the if statement, it hid the VBO form along with the entire view.

I've attached a patch that keeps the form intact and simply sets the access to false, so that it isn't rendered (per the Form API). Note this isn't a solution, it's just a workaround, and it does not address the checkbox issue, so I won't even bother changing the status.

balagan’s picture

There is a module for it, just 2 days old https://drupal.org/project/vbo_hide

Bevan’s picture

Notes:

  • VBO Hide module hides VBO form if there are no rows/results/data to display. This patch hides VBO form if there are no operations.
  • VBO Hide module is for Drupal 7. This patch is for Drupal 6.
bojanz’s picture

Assigned: Unassigned » infojunkie

I'm not committing anything to D6 at this point. It's dead, Jim.
So let's leave it to infojunkie to decide.

infojunkie’s picture

Status: Needs work » Closed (won't fix)

I probably won't fix this unless there's an urgent (i.e., commercial) need. Contact me privately if this is the case.

Bevan’s picture

I alone have patched 2 or 3 commercial websites with this patch. This makes their upgrade path difficult.

infojunkie’s picture

Bevan, which patch are you referring to, #7 or #11?

Bevan’s picture

Probably both. I don't have access to check anymore.