FAQ Database Discussion Community

How to assign variable in fluid?

I want viewhelper that can be helpful to assign variable in fluid, I dont want variable to be passed from controller.

Why isn't the format date of the Rails view being properly displayed with the initializer?

On my view view, I have the following format I want to output: <tr> <th>Released:</th> <td> <%= movie.release_at.to_s(:release_date) %> (<%= time_ago_in_words(movie.release_at) %>) </td> </tr> The exact format I want is "Month Day, Year", so I created an initialize file with the following: Date::DATE_FORMATS[:default] = "%B %e, %Y" My database schema...

Error when adding data attributes to rails button_to

I'm trying to add a data- attribute to button in my rails application. When I view the app I get the following error. error /app/views/versions/_full.html.erb:60: syntax error, unexpected ',', expecting => ...GI::escape version.plist_url}", class:"download-btn btn-prim... ... ^ /app/views/versions/_full.html.erb:62: syntax error, unexpected ',', expecting => ...ild_number}, version.plist_url, class: 'download-btn btn-pri... ......

How to use link_to_if with HAML

I'm trying to figure out how to write in HAML the use of link_to_if helper with a do block. I tried this one but it generate an error : = link_to_if(test, my_text, my_path) do - some_other_text Error : syntax error, unexpected ';', expecting ')' end;_hamlout.buffer << _hamlout.f... I know I...

Output nested tags with one single ViewHelper

I have a TYPO3 project with an extension using Extbase and to implement lazy loading and retina images while maintaining compatibility if javascript is disabled, I need to generate some output like this: <noscript data-src-small="small.jpg" data-src-large="large.jpg" data-width="300" data-height="200"> <img src="small.jpg" width="300" height="200"> </noscript> So I wrote a custom ViewHelper (or...

ZF2 - overriding navigation menu view helper function

I'm trying to extend the Zend\View\Helper\Navigation\Menu helper class with my own and override accept function. Based on ZF2 register custom helper for navigation question, my Menu helper class looks like this: <?php namespace Application\View\Helper\Navigation; use Zend\View\Helper\Navigation\Menu as ZendMenu; use Zend\Navigation\Page\AbstractPage; class Menu extends ZendMenu { public function accept(AbstractPage $page, $recursive...

Rails options_for_select return value only

I working on a project in Rails and trying to figure out how to return just the value, using options_for_select. For example. options_for_select([["Dollar", "$"], ["Kroner", "DKK"]]) # => <option value="$">Dollar</option> # => <option value="DKK">Kroner</option> I only want to return $ or DKK (i.e the value) instead of the full <option...

What is the best practice to create a custom helper function in php Laravel 5?

I have the default created_at date keep printing out as an MySQL format : 2015-06-12 09:01:26. I wanted to print it as my own way like 12/2/2017, and other formats in the future. I created a file called DataHelper.php and store it at /app/Helpers/DateHelper.php - and it looks like this...