view-helpers

ViewHelper for opening the page module view for a page

我只是一个虾纸丫 提交于 2020-05-31 04:59:11
问题 There is a ViewHelper for editing a record be.editRecord. Is there a ViewHelper for opening the page module view for a specific page? (This would be the same result you would get if clicking on a page in the page module.) 来源: https://stackoverflow.com/questions/61056869/viewhelper-for-opening-the-page-module-view-for-a-page

How to show a link_to helper only if it returns > 0

核能气质少年 提交于 2020-01-07 03:59:10
问题 I have this helper link link_to "", product_path(product, anchor: "disqus_thread"), data: { "disqus-identifier" => "#{url_for([product, {only_path: false}])}" }, class: "no-underline bold grey-text text-darken-3 margin-left" layout: application.rb %script{id: "dsq-count-scr", src: "https://url.disqus.com/count.js", async: "async"} _disqus.html.erb <div class="col-lg-8 col-lg-offset-2 big-top-space margin-bottom"> <div id="disqus_thread"></div> <script> var disqus_shortname = 'yourname'; var

How to Call a View Helper Method in JavaScript using Rails 3.1

故事扮演 提交于 2020-01-06 09:56:43
问题 I'm working on a simple app that needs to render a time. But the time must be formatted the way time_ago_in_words helper does. I'm getting the time data from a JSON object. Is it possible to trigger a view helper (time_ago_in_words) inside a JavaScript file? I'm using Rails 3.1 Thanks. 回答1: You can't do it from inside a javascript function. Ideally you would want a JSON equivalent to XML Builder where you could call the view helper methods from inside a .builder partial. This gem provides

TYPO3 - Howto disable cache for specific content element on a page?

为君一笑 提交于 2020-01-03 01:47:29
问题 Is it possible to disable the caching for one specific element on pages? I tried already the following typoscript, as described in this answer, but it is not working for me (TYPO3 v8): tt_content.textmedia.20 = USER_INT I am using ext:fluid_styled_content with custom CTypes. From my understanding the above typoscript should disable the caching for the content element "Text & Media" (just as an example). My custom element reads live data from an API using a ViewHelper. But the ViewHelper is

../this returns the view object inside inner loop when the parent and child have the same value

自作多情 提交于 2019-12-31 04:34:52
问题 I am just starting with handlebars and I am trying to do a simple double for loop in order to have all the day's time with 15 minute intervals. A very weird thing is happening where if the child and parent have the same values, the view object is being returned instead. This is my code: var handlebarsExpress = require('express-handlebars').create({ helpers: { for: function(from, to, incr, block) { var accum = ''; for(var i = from; i <= to; i += incr) { accum += block.fn(i); } return accum; }

Qt Assistant fails in linux with enableRemoteControl option

旧城冷巷雨未停 提交于 2019-12-25 03:13:35
问题 I have an application in Qt, trying to use assistant for help. It is working in windows, trying to make it work on Linux. Using this example if (process->state() == QProcess::Running) return; QString app = QLibraryInfo::location(QLibraryInfo::BinariesPath) + QDir::separator(); #if !defined(Q_OS_MAC) app += QLatin1String("assistant"); #else app += QLatin1String("Assistant.app/Contents/MacOS/Assistant"); #endif QStringList args; args << QLatin1String("-collectionFile") << "theHelpFile.qhc" <<

What is the difference between render() and renderStatic() and what should be used when writing a ViewHelper in TYPO3

让人想犯罪 __ 提交于 2019-12-23 23:23:03
问题 There are several examples for writing a custom ViewHelper and different ways to do things. I have seen examples with render() and with renderStatic (for example in Developing a Custom ViewHelper). In 24 Fluid Tips there is an explanation, but I don't understand it and it does not make it clear for me why there are 2 functions and what should be used where. Breaking changes (Render method arguments on ViewHelpers deprecated) and fragmented information in various places makes it difficult to

Erubis block helper throwing error with concat

a 夏天 提交于 2019-12-22 05:52:13
问题 I have a couple of block helpers, here's a simple example of what I'm doing: def wrap_foo foo, &block data = capture(&block) content = " <div class=\"foo\" id=\"#{foo}\"> #{data} </div>" concat( content ) end I'm just trying out erubis and it's giving me the following error: You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.<< Removing the call to concat removes the error but ends up with my wrapper not being

Erubis block helper throwing error with concat

a 夏天 提交于 2019-12-22 05:52:01
问题 I have a couple of block helpers, here's a simple example of what I'm doing: def wrap_foo foo, &block data = capture(&block) content = " <div class=\"foo\" id=\"#{foo}\"> #{data} </div>" concat( content ) end I'm just trying out erubis and it's giving me the following error: You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.<< Removing the call to concat removes the error but ends up with my wrapper not being

Is there a Fluid viewhelper to truncate an URL? If not, how do I make one?

房东的猫 提交于 2019-12-20 06:09:33
问题 In TYPO3's Fluid or in Fedext/vhs, is there a viewhelper that can convert http://www.stackoverflow.com/questions/ask into www.stackoverflow.com ? PS: that's the goal: <f:format.raw><f:link.external uri="{item.link}">{item.just-display-the-domain}</f:link.external></f:format.raw> EDIT (adapting the question to the answer I got): If I have to build a custom view helper, how do I proceed? 回答1: I really doubt if there would be any sensible reason for adding this kind of VH into the core, de facto