Whether Calendar Helper Plugin works fine for rails3? - ruby-on-rails-plugins

Whether Calendar Helper Plugin works fine for rails3 ?

I haven't tried it but fount the following with Rails on its github issues:
When rendering sass it doesn't seem to render links from a "render_calendar_cell" method properly any longer in rails 3, probably due to the new implicit "raw".
If skipping raw it renders the links but outputs escaped text.
= raw calendar(:year => #year, :month => #month, :first_day_of_week => 1) do |d|
- render_calendar_cell(d) / returns <a href> link
https://github.com/topfunky/calendar_helper/issues#issue/4

Related

Internationalization with Messages not working in Production - Play Framework

I'm running a Play Framework (2.3) + Scala app and I've just started translating it.
I have the following configuration:
application.langs="en,es"
and also have the messages and messages.es files. I want the application to show the messages according to the browser's language, so I've changed it to ES.
When I run it in my pc everything looks fine, but once I deploy it it doesn't work. I've checked that both conf files for local and prod have the same values. I've also checked the request's Accept-Language parameter and it includes "es". The browser is still in ES.
I thought maybe I could change the languages' order in application.langs, but I want "en" to be my default language.
Can anyone help me?
UPDATE:
I've deployed a modification that prints the value of lang:
#()(implicit lang: Lang)
#import play.api.Play.current
[...]
lang = #lang.code,
date = #(new java.util.Date().format("yyyy-MM-dd HH:mm"))
and I get different results in localhost and prod:
Localhost: lang = es-ES, date = 2018-02-20 16:37
Production: lang = en-US, date = 2018-02-20 16:44
It seems in localhost the language is correctly overwritten for the browser language, but in production it doesn't. Does this make sense?
UPDATE 2:
So, I've been testing some theories... I think it might not be a Play Framework thing. Here is what I found:
Running the app in localhost, I changed the browser's language => the app's language doesn't change, it keeps showing ES
When replacing the "es" in application.langs for "fr" the app shows in EN, doesn't matter which is the browser's language
Renaming messages.es to messages.fr (the content is kept in ES) also has no effect, the app shows in EN.
Throughout these tests, the value of #lang.code is always the same: lang = es-ES. On the other hand, Lang.applicables changes from step 1 to 2: langList = Lang(en,)Lang(fr,).
What I gather from this is that it doesn't matter what language I set in the app, there's another place where the Lang is set and coincidently, it is set as es-ES in localhost and as en-US in Production. It has probably something to do with the Locale of the server. Can this be changed?
Solved it! I added an implicit parameter Lang to my template so it would get the value from the request header Accept-Languages. I then saw that #lang.code changed to "es"!
Just to be clear, you need to add this implicit Lang to ALL your templates, or it will just go back to a "default" Lang that I'm still not sure about where it comes from. So I have a main.scala.html that calls #header(), #footer(), etc. I added the implicit to all of them:
#()(content: Html)(implicit lang: Lang)
<!DOCTYPE html>
<html>
<head>
[...]
#analytics()
</head>
<body>
<div id="header">
#header()
</div>
#content
#footer()
</body>
</html>

How to change soundcloud's Visual Player to classic style player setting visual:false via Ruby

I'm currently using the soundcloud gem and omembed endpoint however I am unable to change the player's visual=true to visual=false which results in getting the new styled visual player widget. Even when I add visual=false as an option I get visual=true and visual=false and it seems visual=true wins out since it is the first value returned in the url...Anyone fix this via the Ruby SDK?
Figured it out. When setting the visual parameter to false in oembed you'll actually notice two visual params in your src url. The first will still be true and then the second will be what you called in oembed. Unfortunately this doesn't supercede the first visual=true setting. You'll need to use some jquery to alter the incoming url's visual parameter. Contrary to all documentation on the subject, this must not be set to false but must actually be removed completely...See below:
$(document).ready(function(){ $("iframe").each(function() {
var src = $(this).attr('src');
if(src.indexOf('https://w.soundcloud.com/player/?') != -1 && src.indexOf('visual=true') != -1) {
$(this).attr('src', src.replace('visual=true', ' '));
} }); });
It's basically replacing the visual param with a blank space for any url's containing soundcloud.com/player...You can then use the omembed parameters in your controller as intended like show_artwork etc. once this is done.

TYPO3 new record appearing on wrong location in Backend List

I'm developing a new extension using ExtBase in TYPO3 (4.7) for a client.
I have however the strangest problem. In the back-end, my possible, new record types are - as usual - listed in the Insert new record Backend List. Usually each of these record-types are preceded by the module name (actually they are grouped right after the module name).. However, in my case, 1 or 2 of the record-types of any other extension appear within my extension's list as well.. I've been trying to figure out pretty much all that I can, I even copied the extension over to an entirely different TYPO3 installation, but the same problem persists..
If of any extension some records appear just below my extension's title, and I delete that particular extension, just some other record-types appear of another extension.
What's going on here??
Short & late answer:
i guess you have defined the title of your models in two different ways or with a non-existent languagefile in your ext_tables.php. Something like this:
Model1:
$TCA['tx_aaext_domain_model_one'] = array(
'ctrl' => array(
'title' => 'LLL:EXT:bn_news/Resources/Private/Language/locallang_db.xml:tx_bnnews_domain_model_categories',
Model2:
$TCA['tx_aaext_domain_model_two'] = array(
'ctrl' => array(
'title' => 'Static Title',
and/or your extension-name has an underscore like aa_extension, then this error can happen.
Make sure that both title-definitions are dynamic and begin with "LLL:EXT:" and point to an existing translation. Everything should be fine now.
Long answer will be to long :)

Render comments form in any page

I want to know how to render a comments form of a specific node in any page (ex. user profile). I've trying with drupal_get_form but it shows an error.
drupal_get_form('mytype_node_form', array('nid' => $nid));
Solutions & clues are welcome :)
First of all, you should use the proper ID of the comment form: 'comment_form' instead of 'mytype_node_form'.
The code
drupal_get_form('comment_form', array('nid' => $nid));
used to work for me in Drupal 6. In Drupal 7, function comment_form() is expecting an object parameter instead of array. This code should work for you:
$comment = new stdClass;
$comment->nid = $nid;
$form = drupal_get_form('comment_form', $comment);

Typo3 eID, how to access config

I've just created an eID in Typo3. I can't figure out how to access the config data for my plugin from the Typo3 instance.
I've tried the code from the link but it doesn't want to work. I keep getting an exception "No TypoScript template found! " on the call " $TSFE->getConfigArray(); "
http://lists.typo3.org/pipermail/typo3-dev/2006-December/021392.html
Any ideas?
Thanks.
In eID mode, only a small part of the regular TYPO3 frontend is loaded. Unfortunately TypoScript is not loaded. To still access the TypoScript configuration you need manually load the components it needs to do so. Unfortunately this can be a bit of a pain in the butt. So in some cases it might be easier to just load a page containing a single plugin that doesn't contain anything else (without headers etc.).
If you do want to load the TypoScript templates yourself, you can try something like the following:
require_once(PATH_tslib.'class.tslib_fe.php');
require_once(PATH_t3lib.'class.t3lib_userauth.php' );
require_once(PATH_tslib.'class.tslib_feuserauth.php');
require_once(PATH_t3lib.'class.t3lib_cs.php');
require_once(PATH_tslib.'class.tslib_content.php') ;
require_once(PATH_t3lib.'class.t3lib_tstemplate.php');
require_once(PATH_t3lib.'class.t3lib_page.php');
$TSFEclassName = t3lib_div::makeInstanceClassName('tslib_fe');
$id = isset($HTTP_GET_VARS['id'])?$HTTP_GET_VARS['id']:0;
$GLOBALS['TSFE'] = new $TSFEclassName($TYPO3_CONF_VARS, $id, '0', 1, '','','','');
$GLOBALS['TSFE']->connectToMySQL();
$GLOBALS['TSFE']->initFEuser();
$GLOBALS['TSFE']->fetch_the_id();
$GLOBALS['TSFE']->getPageAndRootline();
$GLOBALS['TSFE']->initTemplate();
$GLOBALS['TSFE']->tmpl->getFileName_backPath = PATH_site;
$GLOBALS['TSFE']->forceTemplateParsing = 1;
$GLOBALS['TSFE']->getConfigArray();
$cObj = t3lib_div::makeInstance('tslib_cObj');
This initializes the TSFE and cObj but is also used to load and parse the TypoScript templates. You might need to make some modifications to (probably kick some things out)
The code came from one of the comments on the following blog post: http://sebastiaandejonge.com/blog/articles/2010/september/21/bringing-ajax-to-your-frontend-plugins/
Good luck!