I have 2 page's for my view. One to display it, the other for draggable views. Any chance of adding a edit tab like nodes have so that if I have the correct permissions I can see/click on the edit button and land on the draggable views page?

URL Example:
.com/normal-view - has tab to edit page
.com/normal-view/edit - has tab back that says view (this is the draggable view)

Comments

sevi’s picture

Actually this isn't a task of DraggableViews.
Anyway, I tried my best because it sounds very useful.

Copy the code snippet to the header of your view (edit view: "Basic settings" section: "Header" option):

<ul class="tabs primary">
<li<?php echo (arg(0) != 'your_view_to_edit' ? ' class="active"' : ''); ?>><?php echo l('View', 'your_view_to_view'); ?></li>
<li<?php echo (arg(0) == 'your_view_to_edit' ? ' class="active"' : ''); ?>><?php echo l('Edit', 'your_view_to_edit'); ?></li>
</ul>

Replace your_view_to_view and your_view_to_edit with your views.

Greetings,
sevi

edit: arg(1) became arg(0)

sevi’s picture

What I forgot to say: You have to activate "PHP Filter" module in advance and choose Input format: "PHP code".

If you want to check permissions simply return on failure:

<?php if (!user_access('administer views')) return; ?>
<ul class="tabs primary">
<li<?php echo (arg(0) != 'your_view_to_edit' ? ' class="active"' : ''); ?>><?php echo l('View', 'your_view_to_view'); ?></li>
<li<?php echo (arg(0) == 'your_view_to_edit' ? ' class="active"' : ''); ?>><?php echo l('Edit', 'your_view_to_edit'); ?></li>
</ul>

edit: choose input format: "PHP code"

mikeytown2’s picture

Status: Active » Fixed

Awesome, this is quite handy! Here's the code I used

<?php if (!user_access('administer views')) return; ?>
<br />
<ul class="tabs primary">
<li<?php echo (arg(1) != 'edit' ? ' class="active"' : ''); ?>><?php echo l('View', 'my-view'); ?></li>
<li<?php echo (arg(1) == 'edit' ? ' class="active"' : ''); ?>><?php echo l('Edit Order', 'my-view/edit'); ?></li>
</ul>

Added the line break so the views hover edit button doesn't get in the way.

mikeytown2’s picture

This got me thinking... what if there where some sort of wizard for really simple draggable views? Select the view and it adds a new view page for DraggableViews and adds all the correct settings (like this code snippet) to the 2 views.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

hefox’s picture

For others looking into this

Should be able to use views menu settings, right?

Default menu task

viewname/view == default tab
viewname/edit == menu tab

butler360’s picture

"what if there where some sort of wizard for really simple draggable views?"

I would also find this extremely useful. That little PHP snippet is great for a site end-user.

And can the views menus be set to show or not show depending on permissions?

shopdogg’s picture

subscribe