update and save for mini panels would be welcome addition. I find myself doing save-check result-cannot remember which mini panel i edited-ahh that one-edit-content-change-repeat process over and over again :) fix should be as easy as drupal_get_destination() on form page and drupal_goto() after saving changes, since this has mini panels ui has clear url and no overlay stuff.

Comments

henrijs.seso’s picture

or maybe not that simple... I could not find proper places for these functions.

Letharion’s picture

Status: Active » Postponed (maintainer needs more info)

Hello mansspams :)
I don't entirely understand what you mean. Could you please elaborate? It sounds like you could make good use of features to keep track of what's edited, and what's not?

henrijs.seso’s picture

Version: 6.x-3.x-dev » 7.x-3.x-dev

Hi,

Sorry for unclear OP. I am now little more familiar with how issue queue works. Minipanel edit form has only save button that closes edit form. I find myself missing update and save button that would not redirect to minipanels list but just save settings without redirect (or redirect back to step).

Letharion’s picture

Status: Postponed (maintainer needs more info) » Active

For future reference, it's important to set the status to active when you've answered the maintainers question :) I was just about to close this issue due to inactivity when I saw you had answered.

michaelfavia’s picture

FWIW you CAN actually edit and save already created minipanels at this url i found by mistake

/admin/structure/mini-panels/list/MINI_NAME_HERE/edit/content

I dont know why this isnt linked form the dropdown on the management page. There is probably a good reason. :)

michaelfavia’s picture

Sorry i misunderstood this post because i scanned right over the "breadcrumb like" editing modes of the minipanel interface thanks to earl for pointing it out.

I totally understand your question now and my feedback provides no value. Moving along.

rogical’s picture

Title: update and save for mini panels » Don't redirect on update and save for mini panels

Anmonying the same.

It seems the restrict of ctools wizard form, I tried form[#redirect] (can't save settings) and destination (lose destination after submit), both doesn't work well.

TheMGamer’s picture

bumb

timmarwick’s picture

Issue summary: View changes

Quick workaround to implement (via your own custom module) a "removal" of the *ANNOYING* post-submit redirect in the mini-panels edit wizard:

/**
 * Implements hook_form_FORM_ID_alter().
 * FORM_ID => ctools_export_ui_edit_item_wizard_form
 */
function MY_MODULE_form_ctools_export_ui_edit_item_wizard_form_alter(&$form, &$form_state) {
  // inject our own submit handler
  if ($form_state['op'] != 'add') {
    $form['#submit'][] = 'MY_MODULE_form_ctools_export_ui_edit_item_wizard_form_submit';
  }
}

/**
 * Custom submit handler for ctools_export_ui_edit_item_wizard_form
 */
function MY_MODULE_form_ctools_export_ui_edit_item_wizard_form_submit($form, &$form_state) {
  // add a redirect back to the page we submitted from.
  $form_state['redirect'] = "admin/structure/mini-panels/list/{$form_state['item']->name}/edit/{$form_state['step']}";
}
loopduplicate’s picture

Here's a bit of javascript that will add a "Save and Edit" button to the form. There's probably a more elegant way of doing this. I use this on my local environment.


(function($, Drupal, window, document, undefined) {
  Drupal.behaviors.minisaveedit = {
    attach: function() {

      
      var pathname = window.location.pathname;
      while (pathname.charAt(0) === '/') {
        pathname = pathname.substr(1);
      }

      $('#edit-buttons' + ':not(.processed)')
          .addClass('processed')
          .append('<input type="button" id="saveedit" value="Save and Edit" class="btn">');
      $(document).on('click', '#saveedit', function() {
        var $form = $('#ctools-export-ui-edit-item-wizard-form');
        var action = $form.attr('action');
        var getQueryVariable = function(variable) {
          var query = window.location.search.substring(1);
          var vars = query.split("&");
          for (var i = 0; i < vars.length; i++) {
            var pair = vars[i].split("=");
            if (pair[0] == variable) {
              return pair[1];
            }
          }
          return(false);
        };
        var destination = getQueryVariable('destination');
        if (destination === false) {
          var newdest = action + '?destination=' + pathname;
          $form.attr('action', newdest);
        }
        
        $('#edit-return').trigger('click');

      });

    }
  };
})(jQuery, Drupal, this, this.document);

I do the following in a custom module called minipsaveedit to get the js file to load when the mini panels content edit form loads:


/**
 * Implements hook_form_FORM_ID_alter().
 */
function minipsaveedit_form_ctools_export_ui_edit_item_wizard_form_alter(&$form, &$form_state) {
  $current_path = drupal_get_path_alias();
  if (substr($current_path, 0, 32) === 'admin/structure/mini-panels/list' &&
      substr($current_path, -12, 12) === 'edit/content') {
    $form['#attached']['js'][] = drupal_get_path('module', 'minipsaveedit') . '/js/minipsaveedit.js';
  }
}

If I had more time, I'd figure out the right way to do this. But anyway, a Save and Edit button really helps me out so I thought I'd share.

Cheers,
Jeff

popstas’s picture

popstas’s picture

Solution #9 don't work, redirect stops, but form stops save.
Solution #10 seems big.

Here is another solution, combined from #9 and #10:

function MODULE_form_ctools_export_ui_edit_item_wizard_form_alter(&$form, &$form_state, $form_id) {
  $mini_panel_url = "/admin/structure/mini-panels/list/{$form_state['item']->name}/edit/{$form_state['step']}";
  if ($form['#action'] == $mini_panel_url) {
    $form['#action'] = $form['#action'] . '?destination=' . $mini_panel_url;
  }
}
rudi teschner’s picture

#12 works. I think this should be implemented in the module directly, working with minipanels is really annoying due to the redirect.

markdc’s picture

#12 works for me as well. I can also confirm that working with Mini Panels is extremely annoying due to this.
Thank you, popstas!

rudi teschner’s picture

Small Update: It works for the default language, but still redirects to the mini panel listing for other languages.

delacosta456’s picture

#12 works for me as well.