Bonfire icon indicating copy to clipboard operation
Bonfire copied to clipboard

"alt+c : Jump to the Content context" doesn't work for sites installed in a subdirectory

Open sourcejedi opened this issue 12 years ago • 4 comments

It jumps to /admin/content, but my site is at /Bonfire so I get a 404.

This is implemented in JS code (which I think is buried in a migration). In which case it's not just a matter of adding site_url(); we need to export the site url to JS somehow.

sourcejedi avatar Nov 05 '12 14:11 sourcejedi

Maybe we should revisit how these are implemented, since it looks like the database stores the key combination and a name/key for the action, then the action and description are stored in the application config.

mwhitneysdsu avatar Nov 06 '12 14:11 mwhitneysdsu

To preserve the information with the issue: the ALT+C functionality is in bonfire/application/config/application.php (goto_content):

$config['ui.current_shortcuts'] = array(
    'form_save'      => array('description' => 'Save any form in the admin area.', 'action' => '$("input[name=submit]").click();return false;'),
    'create_new'     => array('description' => 'Create a new record in the module.', 'action' => 'document.location=$("a#create_new").attr("href");'),
    'select_all'     => array('description' => 'Select all records in an index page.', 'action' => '$("table input[type=checkbox]").click();return false;'),
    'delete'         => array('description' => 'Delete the record(s).', 'action' => '$("#delete-me.btn-danger").click();'),
    'module_index'   => array('description' => 'Return to the index of the current module.', 'action' => 'document.location=$("a#list").attr("href");'),
    'goto_content'   => array('description' => 'Jump to the Content context.', 'action' => "document.location='/" . SITE_AREA . "/content';"),
    'goto_reports'   => array('description' => 'Jump to the Reports context.', 'action' => "document.location='/" . SITE_AREA . "/reports';"),
    'goto_settings'  => array('description' => 'Jump to the Settings context.', 'action' => "document.location='/" . SITE_AREA . "/settings';"),
);

mwhitneysdsu avatar Nov 06 '12 14:11 mwhitneysdsu

So, if you change this:

'goto_content'   => array('description' => 'Jump to the Content context.', 'action' => "document.location='/" . SITE_AREA . "/content';"),

to:

'goto_content'   => array('description' => 'Jump to the Content context.', 'action' => "window.location.href=$('#tb_content').attr('href')"),

You should be fine, as long as your toolbar's top-level Content menu has the right URL in its href, and you haven't modified the id of the menu item.

I also changed the first part of the script based on http://stackoverflow.com/questions/2652816/what-is-the-difference-between-document-location-href-and-document-location (Also, as noted somewhere in the responses to above: https://developer.mozilla.org/en-US/docs/DOM/document.location indicates that in older mozilla-based browsers document.location is read-only).

mwhitneysdsu avatar Nov 06 '12 15:11 mwhitneysdsu

Apparently github has changed a few things, as it auto-closed this issue and pushed my changes through from my fork. Anyway, I'm re-opening this because I would prefer something a little more elegant. site_url() is not currently available from this location, but maybe something else is...

mwhitneysdsu avatar Nov 06 '12 16:11 mwhitneysdsu