Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I want draggable and sortable contents by admin. So, installed jQuery UI and put this code in my main.js:

$(function() {
    $( ".panels-flexible-region" ).sortable({
      revert: true
    });
    $( "#makyaj .views-row" ).draggable({
      connectToSortable: ".panels-flexible-region",
      helper: "clone",
      revert: "invalid"
    });
    $( "ul, li" ).disableSelection();
  });

Yes, it works. But i want use this option only admin user. Whether View Sort Type: Jquery Draggable and qhat sets the admin users so they can see it.

Is it possible? Can i integration Views and jQuery UI Draggable?

share|improve this question

2 Answers

up vote 1 down vote accepted

You can do something along these lines in a custom module...

function mymodule_init() {
  global $user;

  if ($user->uid==1) { // super/admin user, add role based logic if needed or desired
    drupal_add_js('path/to/admin-only.js');
  }
}

...where 'path/to/admin-only.js' is a file containing JS you want added only for your admin/super user. Look into drupal_add_js() for more information.

share|improve this answer

I know this isn't exactly what you asked for, but have you considered using the draggable views module? It does what you aim to do without you having to code anything.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.