-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Body now showing if default language is not "und" (undefined) #239
Comments
@quiquee Yes, the entire multi-lingual features of DrupalGap core need some attention. I've only ever had to support English, so I haven't had the opportunity (or multi lingual capabilities myself) to thoroughly test this. I see from your example URL that the language code of the node is 'fr', but all the field's on the node have their language code set to 'und'. If you've reopened/submitted an issue for that with Services, will you please post it here. From my recollection, DrupalGap looks to the entity's language code, then tries to use that to render the fields on the entity using that language code. I don't know if it is checking for a null language code, then falling back to und. To help DrupalGap accommodate this potential mismatch of language codes. I'd essentially use grep to look for the word 'language' anywhere in the source code:
That'll reveal the majority of the places that need to be taken into consideration. I think I'd start with the drupalgap_entity_render_content function, and somewhere in there (and/or before/after) we need to check for null/undefined on the entity's language code (e.g. fr), and if it isn't present, fall back to und. |
Yep, sounds good , I already grepped through the code and landed in that Thanks On Sat, Apr 5, 2014 at 5:54 PM, Tyler Frankenstein <[email protected]
|
@quiquee Was the node in question created with DrupalGap? If so, it may be DrupalGap improperly setting the language code on the fields when it does the POST. Set debug to true in settings.js, try creating a node from the app, and watch the console.log(). You'll see the JSON object it sends to the server. Does it set the language property on the node, and fields, or does it just ignore it and use 'und' only on the fields? |
No the node was not created with DrupalGap. I am having problems to log in from ripple and it doesnt look that it is linked to cross-domain scripting. It looks more like if the login response is not yet loaded when the postprocess hook is called. // drupalgap.js:8222 var response = JSON.parse(result.responseText); The error is: 200 - OK jdrupal-7.x-1.0-rc2.min.js:23 POST: http://localhost/?q=drupalgap/user/login.json jdrupal-7.x-1.0-rc2.min.js:22 200 - OK jdrupal-7.x-1.0-rc2.min.js:23 user_services_postprocess - SyntaxError: Unexpected token u drupalgap.js:8222 POST: http://localhost/?q=drupalgap/system/connect.json jdrupal-7.x-1.0-rc2.min.js:22 200 - OK jdrupal-7.x-1.0-rc2.min.js:23 I tried using a proxy locally and as well running all from the same machine. The issue is always the same with ripple for something that works ok when tested in a device or in the emulator. Any help or clue for debugging would be greatly welcome. Thank you |
@quiquee In user_services_postprocess(), I'd recommend doing this:
And then look around in the response object that is printed to the console. The post process hook shouldn't be invoked until after the user login post is complete, so I'm not quite sure what is happening there. I usually disable the "Cross Domain Proxy" in Ripple for localhost, and haven't had any login problems. You may have to launch chrome from a terminal with the disable security flag if connecting to a remote site: |
I can't see the output of dpm(result) as there is no result.responseText in if (!result.responseText) { return;} dpm(result); var response = JSON.parse(result.responseText); I checked the result object with dpm and I dont see anything like |
I have now ripple working correctly and I can develop locally and mirror changes to my server. Things are now much easier. The issue was that the content of the node didnt show. function node_page_view_pageshow(nid) { try { node_load(nid, { success: function(node) { // Build the node display. var body = node.content; // If the node.content is not populated ... // issue reported in https://github.com/signalpoint/DrupalGap/issues/239 if (!body) { body = node.body.und[0].value; } var build = { 'theme': 'node', // @todo - is this line of code doing anything? 'node': node, // @todo - this is a core field and should by fetched from entity.js 'title': {'markup': node.title}, 'content': {'markup': body} }; |
Hi @signalpoint you update this in a commit in drupalgap project in drupal.org? or how update this issue, i have same proble |
@jomarocas Usually it is enough to just download the latest drupalgap.min.js file: http://drupalgap.org/download - there are more details here: http://docs.drupalgap.org/7/Install/Upgrading - other than that, following Drupal module update procedures (or downloading the latest dev snapshot of the DrupalGap module) will update everything on the Drupal site. |
My website has french as default language.
The service delivers content tagged by language , but for some reason the content appears under "und" in the response (undefined)
This was supposed to be fixed in the service module some time ago, so I am trying to reopen it. In the meantime, I think it would be good practice to be safe and show the content under "und" if there is no content in the node language.
For an example point here:
http://www.padelfirst.com/?q=drupalgap/node/2.json
The text was updated successfully, but these errors were encountered: