Note the upgraded forum! If you are experiencing issues logging in, you may need to reset your password which should send an email. If the email doesn't arrive, be sure to check your spam folder just in case.

Preview of Recordset in Backend Only

Hi,
what would be the way to create a preview of a Simple Module entry only in the backend (best in a modal window)?

I tried to set the preview_path in my module to "/fuel/praemien/preview/{id}" and set up a preview() method in my model, but I guess that's the wrong place.

it should be also only accessible to logged in users.

Thanks for any hint.

Comments

  • I would setup your own controller and register a route (like normal CI). I would extend the Module.php controller so you get the authentication check.

    If you are wanting to launch it in a modal window, you can use the fuel.modalWindow function in your custom javascript code that is meant to launch a modal window that contains an iframe:

    fuel.modalWindow = function(html, cssClass, autoResize, onLoadCallback, onCloseCallback)
    

    Excerpt from custom_fields.js where it is used:

    var html = '<iframe src="' + url +'" id="add_edit_inline_iframe" class="inline_iframe" frameborder="0" scrolling="auto" style="border: none; height: 0px; width: 0px;"></iframe>';
    $modal = fuel.modalWindow(html, 'inline_edit_modal', true, onLoadCallback, onCloseCallback);
    
    

    More on adding javascript to your modules can be found here:
    http://docs.getfuelcms.com/general/javascript

  • Great! I was worrying about the auth check. I Will try that.
    Thanks for your help!

Sign In or Register to comment.