From: Leila G. <lm...@ag...> - 2016-10-19 15:33:01
|
Thanks Demian. I used the code generator to re-do the static routes for the ajustocs page and that got everything working. I do like the idea of changing the existing HelpText view helper as you suggest. It would make it much easier to put customized content into the lightbox. I’ll put it on my to do list for PRs. Thanks! Leila *From:* Demian Katz [mailto:dem...@vi...] *Sent:* Wednesday, October 19, 2016 5:40 AM *To:* Leila Gonzales; vuf...@li... *Subject:* RE: [VuFind-Tech] VuFind 2.4 - how to use lightbox to show static content? Leila, Based on another review of your summarized changes, I think it’s possible that the route you need is not being set up correctly. Putting a ‘$staticRoutes’ element in the $config array won’t do anything. You need to use the route generator to expand the static routes into full route definitions instead. Try mimicking what’s happening here: https://github.com/vufind-org/vufind/blob/master/module/VuFind/config/module.config.php#L828 If you’re still having trouble, please share your full module.config.php and hopefully I can help you get it sorted out. One other thought that might be worth considering: what if we changed the existing HelpText view helper so that the ‘HelpTranslations’ path is a property rather than a hard-coded string? That way, it would be easier to subclass the helper and change the search path without having to duplicate any of the other code. It might even be possible, if we added a “setBasePath” method or added a constructor parameter, to construct your AjusTOC helper with a custom factory without having to actually create a subclass at all. If that would be helpful, please feel free to submit a PR to add this additional flexibility to the helper. - Demian *From:* Leila Gonzales [mailto:lm...@ag... <lm...@ag...>] *Sent:* Tuesday, October 18, 2016 6:58 PM *To:* Demian Katz; vuf...@li... *Subject:* RE: [VuFind-Tech] VuFind 2.4 - how to use lightbox to show static content? Hi Demian, I’ve done some more troubleshooting with the code, and the only way I can populate the lightbox is by using the following in my ajus.phtml file: <li><a href="<?=$this->url(*'help-home'*)?>?topic=AJUSvXXIXn5" class="ajustoc-link" title="<?=$this->transEsc('AJUS TOC')?>"><?=$this->transEsc('AJUS TOC')?></a></li> I updated my theme's lightbox.js file to include : // AJUS TOC links $('.ajustoc-link').click(function() { var split = this.href.split('='); return Lightbox.get('Ajus','Ajustocs',{topic:split[1]}); }); I also copied the VuFind/src/VuFind/View/Helper/Root/HelpText.php to my module’s directory, and renamed it to AjusTOC.php, updated the Factory.php file in the same directory, and registered it with the theme.config.php file. I also updated the ajustocs.phtml file to call AjusTOC() instead of helpText() It's weird that the only way I can get the lightbox to open is to use $this->url('help-home') rather than $this->url('ajus-ajustocs'). (I keep getting the “Route with name "ajus-ajustocs" not found” error otherwise). Any ideas on where to troubleshoot to figure this out? Thanks so much for your help with this, Leila *From:* Leila Gonzales [mailto:lm...@ag...] *Sent:* Tuesday, October 18, 2016 1:11 PM *To:* 'Demian Katz'; 'vuf...@li...' *Subject:* RE: [VuFind-Tech] VuFind 2.4 - how to use lightbox to show static content? Thanks Demian. Yes, I did clear the cache and after I did some more poking around in the code and I think I’m going to have to create a AjusText.php file (basically mimicking the HelpText.php file) in the View/Helper/Root/ directory and update the corresponding Factory class so that I can point to the right content directory. That might do the trick. We’ll see. Will let you know. Thanks, Leila *From:* Demian Katz [mailto:dem...@vi...] *Sent:* Tuesday, October 18, 2016 12:18 PM *To:* Leila Gonzales; vuf...@li... *Subject:* RE: [VuFind-Tech] VuFind 2.4 - how to use lightbox to show static content? Have you cleared out your local/cache/configs directory since making these changes? Is it possible the route definition is not being found because an old version of the module.config.php is being cached? I’ll consult with Chris and offer some more detailed suggestions if you need them – please let us know – but I thought I’d first see if this simple solution might help you move forward! - Demian *From:* Leila Gonzales [mailto:lm...@ag... <lm...@ag...>] *Sent:* Tuesday, October 18, 2016 3:03 PM *To:* vuf...@li... *Subject:* [VuFind-Tech] VuFind 2.4 - how to use lightbox to show static content? Hi all, One of our databases is running VuFind 2.4 and we’d like to display some static content in the lightbox. Ideally we’d like to do something similar to the Search Tips implementation. For example, on the following page ( http://www.coldregions.org/vufind/ajus/ajus), we’d like users to be able to click on the “Table of Contents” link and see the information in the lightbox. Is there a way I can set this up so that I can have a directory of static files that can be read into the lightbox? Basically I’m trying to mimic what happens with the Search Tips link (<li><a href="<?=$this->url('help-home')?>?topic=search" class="help-link" title="<?=$this->transEsc('Search Tips')?>"><?=$this->transEsc('Search Tips')?></a></li>). The idea is to be able to set up the call from the main page as: <li><a href="<?=$this->url(ajus-ajustocs')?>?topic=FILENAME" class="help-link" title="<?=$this->transEsc('AJUS TOC')?>"><?=$this->transEsc('AJUS TOC')?></a></li>), Currently I have the following code set up in my custom module and themes directories, but haven’t been able to get the pieces all working together. I’m getting a “Message*:* Route with name "ajustocs" not found “ error. Thanks for any tips or pointers to get me going in the right direction. module.config.php ------------------------ '$staticRoutes' => array( 'Ajus/Home', 'Ajus/Ajus', 'Ajus/Ar', 'Ajus/Asr', 'Ajus/Pob', 'Ajus/Asrusnc-igy', 'Ajus/Ajustocs', ), /* staticRoutes */ AJUSController.php ------------------------ public function ajustocsAction() { $this->layout()->setTemplate('layout/lightbox'); return $this->createViewModel( ['topic' => $this->params()->fromQuery('topic')] ); } Custom theme directory: templates/ajus/ajus.phtml -------------------------------------- <li><a href="<?=$this->url('ajus-ajustocs')?>?topic=AJUSvXXIXn5" class="help-link" title="<?=$this->transEsc('AJUS TOC')?>"><?=$this->transEsc('AJUS TOC')?></a></li> templates/ajus/ajustocs.phtml -------------------------------------- <p> AJUS TOC HOME </p> <? if ($help = $this->helpText()->render($topic)): ?> <? foreach ($this->helpText()->getWarnings() as $warning): ?> <p class="alert alert-warning"><?=$this->transEsc($warning)?></p> <? endforeach; ?> <?=$help?> <? else: ?> <p class="alert alert-danger"><?=$this->transEsc('help_page_missing')?></p> <? endif; ?> templates/ajus/AJUS_TOCS/AJUSvXXIXn5.phtml ----------------------------------------------- <p> Test page </p> Thanks for your help, Leila |