Skip to content
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

Different templates/controllers/views for different platforms #94

Open
Globegitter opened this issue Nov 15, 2014 · 7 comments
Open

Different templates/controllers/views for different platforms #94

Globegitter opened this issue Nov 15, 2014 · 7 comments

Comments

@Globegitter
Copy link

The idea was mentioned in this issue: #32, to add support for platform specific files such as my-template.android.hbs or my-controller.ios.js.

I think that would be a great addition to have, because sometimes you have to apply some fixes or workarounds that are dependent on only one platform but it can make the overall template/controller quite cluttered up. What do you think?

@billybonks
Copy link
Contributor

By cluttered up you mean making those fixes without this functionality, i agree with that.

If you where worried about to many .platform.ext files you could libraryfi them as ember-addons.

overall i am keen for this functionality.

@jakecraige
Copy link
Contributor

I like the idea and would support getting this into here, though I've yet to find much of a use for it personally.

I've had success with ember-cli-cordova-utils and doing a {{#if device.isAndroid}} or a this.device.get('isAndroid') to handle specific cases. Most thinks I have to change per platform are pretty minor.

Out of curiosity, what sort of case do you need to completely swap the entire template/controller/etc.. ?

@billybonks
Copy link
Contributor

My used case, would be sharing the controllers mixins etc between mobile and desktop, but probably having different templates, but that could be done via library, then sharing it in 2 repos

@jakecraige
Copy link
Contributor

Desktop and mobile does seem useful. We have been considering making some apps that do this sort of thing and this could definitely help if that's the case

@runspired
Copy link
Contributor

Our app is desktop, mobile, and android and there are a few special considerations based on platform. Currently desktop v. tablet v. phone is done by utilizing a base repository as an ember-addon and then adding in the platform dependent alterations. It would be interesting, but perhaps a little too aggressive to start combining all of these concerns into a single repo.

@mgenev
Copy link

mgenev commented Feb 18, 2015

I also would like this separation possible. We often end up writing whole different templates for mobile (in the browser) to avoid too much logic in a huge template which would have both behaviors... Right now we use the resolver to make the choice for the appropriate template. Would be pretty neat if the build knows what to do in a cordova deployment's case.

@Leooo
Copy link

Leooo commented Nov 30, 2015

It would be very useful to have dedicated templates for mobile versions: see Rails' views_mobile/, views_tablet/ folders, which are parsed first in case there is a different template for mobile versions (with a fallback to the views/ folder when there is no template overriding it).

If anyone knows how to add this kind of behaviour in Ember-CLI I would be grateful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants