[owncloud-devel] DOM messed up after loading new #app-content as TemplateResponse via Ajax

Bernhard Posselt dev at bernhard-posselt.com
Fri Apr 10 11:54:13 GMT 2015


Your problem is the TemplateResponse itself here
https://github.com/marmuDev/oc-app-bck/blob/master/controller/pagecontroller.php

You have to pass in the renderAs parameter which needs to be blank
because otherwise it will return a fully render the full ownCloud interface
More in here:
https://doc.owncloud.org/server/8.0/developer_manual/app/controllers.html#templates

Apart from that I'd recommend to use clientside templates

Some other quick things:
*
https://github.com/marmuDev/oc-app-bck/blob/master/controller/pagecontroller.php#L100
is done automatically for you and can be removed
*
https://github.com/marmuDev/oc-app-bck/blob/master/controller/pagecontroller.php#L105
use listTrashBin($dir='', $sort='name', $sortdirection=false)
*
https://github.com/marmuDev/oc-app-bck/blob/master/controller/pagecontroller.php#L121
Don't use the header method but return a Response with the
Http::STATUS_NOT_FOUND and get rid of the exit()
* You should get rid of private apis like OC_Log, and pass the stuff
into the constructor like log, translation, userId by using their public
interfaces. Check this for a complete listing
https://doc.owncloud.org/server/8.0/developer_manual/app/container.html#predefined-core-services

On 04/10/2015 01:09 PM, Marcus Mundt wrote:
> Dear hopefully more experienced app developers,
>
> I split up my app in several part.* templates to be loaded, when
> clicked on a navigation link.
>
> When loading another template into my #app-content my DOM gets messed
> up. There is another content-wrapper within the app-content-wrapper.
> Resulting in redundant header, nav and content wrapper in app-content.
>
> I checked my DIVs and everything seems ok. The TemplateResponses seem
> to return more than there is coded into them. I got a hint on the IRC
> channel to check my main template and the part.* templates. Still no
> luck. Is there maybe a common mistake I'm overlooking?
>
> main.php:
> https://github.com/marmuDev/oc-app-bck/blob/master/templates/main.php
> part.navigation.php:
> https://github.com/marmuDev/oc-app-bck/blob/master/templates/part.navigation.php
> part.recent.php:
> https://github.com/marmuDev/oc-app-bck/blob/master/templates/part.recent.php
> part.help.php:
> https://github.com/marmuDev/oc-app-bck/blob/master/templates/part.help.php
> navigation.js:
> https://github.com/marmuDev/oc-app-bck/blob/master/js/navigation.js
>
> my app (quite messy) on github: https://github.com/marmuDev/oc-app-bck
>
> Would be awesome if someone could take a short look into my code. Any
> hint is highly appreciated!
>
> Cheers,
> Marcus
> _______________________________________________
> Devel mailing list
> Devel at owncloud.org
> http://mailman.owncloud.org/mailman/listinfo/devel




More information about the Devel mailing list