framework7 icon indicating copy to clipboard operation
framework7 copied to clipboard

Confusion regarding external API calls and packaging

Open rex opened this issue 12 years ago • 12 comments

Hello all. I apologize for bothering you guys, I really do feel like kind of a jackass that I can't seem to figure this out on my own and if it's not too much trouble I have just two questions that I am confident are RTFM answers.

  1. In the readme it is indicated that a server needs to be running in order to use the application to support the ajax calls the app makes. Must this server remain the node.js server, or can I use my existing rails application to power this application? If I am able to use my existing rails app (which would, of course, be highly preferred), how best do I query the application using the Framework7 ajax library?

  2. Regarding deployment, is it safe to consider this framework a non-native web application that is simply amazingly responsive, beautiful, and exactly matches the iOS 7 style? Or is this a framework in the spirit of PhoneGap or Cordova that runs natively on the device?

Again, I am very sorry that these questions seem so inept. It's been a really long few weeks at work and I'm burnt out. I just felt the compelling need to ask because I needed only look at the website for 30 seconds before I realized just how many things I can use this for in my day-to-day that would make my life so much better.

I really appreciate any assistance you can provide! Thank you!

Pierce

rex avatar Mar 26 '14 10:03 rex

Don't feel bad there's no manual yet to RTFM. :)

My understanding is that any HTTP server will work. You should be able to use your Rails app as the backend server, since I do myself.

As for "how to query the application", you should simply link to a valid URL in your app. As long as your app responds with some HTML content to insert into the page, it should work. I'll give an example. Take a look at kitchen-sink/index.html. If you scroll down a bit (search for messages.html) you'll see a simple HTML link (<a>) to messages.html. When you click that, a request is sent to the server and the contents of kitchen-sink/messages.html is returned. Note that messages.html is not a complete HTML page, but only the parts that need to be swapped out.

I'm going to be using this on a web site only, not for PhoneGap or Cordova, but I'm sure it could be used for anything. It's native HTML, CSS, and Javascript, so it's certainly "native" web code.

-- Peter

ptb avatar Mar 26 '14 11:03 ptb

Mate you aren't the only one waiting patiently for a manual or anything of that type :) I am so lost its scary.

byroncoetsee avatar Mar 26 '14 11:03 byroncoetsee

@ptb everything is correct. I will also add my explanation @rex

  1. Server is required for Ajax requests only, because Browser doesn't allow them from local file:// protocol. And of course it could be any HTTP server (Node, Ruby, Apache, etc.) About querying app, you actually shouldn't worry about, everything is required for dynamic loading of pages is already there. As @ptb said all you need is just a correct link to required HTML page. But of course if you need to do some custom Ajax calls, then you are free to use any lib you like.

  2. Also as @ptb answered it is just a native HTML, CSS and JS, so you can use it as a mobile website, webapp or wrap it with Phonegap to native app. But keep in mind that on the current stage it has some problems with support on none Webkit browsers and Android.

nolimits4web avatar Mar 26 '14 12:03 nolimits4web

@ptb and @nolimits4web I cannot tell you how much I appreciate your taking the time to give me such a detailed response and overview. Now that I have a clearer picture of what's going on it should have been painfully obvious from the beginning. I am extremely excited to start integrating this into the server admin application I'm building.

Now that my mind is wandering, I thought of two more questions/curiosities.

  1. @ptb - You mentioned that you already have this integrated in your rails app. Is the entire app built for the mobile site specifically? Or have you found a way to serve only views/layouts built for Framework7 if an iOS user agent is detected? I'm trying to avoid building a separate application using the same codebase just for this, and as I'm relatively new to rails I can't think of a way to change the entire view rendering structure based on useragent.

  2. @nolimits4web and @ptb - Since it's a client-side app running a pretty standard web stack, I should be able to compile the templates and serve them directly from the client, correct? You seem pretty adamant that server-side rendering of the views is required, and especially as the author of this software you know infinitely more about the codebase than I ever will :-P It would just be a tremendous boost if I could handle all the view rendering on the client and only communicate with the server via JSON.

You guys are great. I am beside myself with excitement about this framework, you have done an absolutely incredible job. As I start my journey down the rabbit hole I will make an honest effort to contribute whatever I possibly can in the way of documentation and bug reports.

Thank you again!

rex avatar Mar 26 '14 18:03 rex

  1. I haven't yet integrated this with my rails app, so far I'm just using Rails as a really intelligent web server. Rails gives me the entire toolset I'm used to using, so I'm more comfortable with it than the Node.js equivalents. This project has been my first real introduction to Node, Less, and Grunt. I only first heard of this project on Friday, so I'm just as new as you are. I do have a lot of experience building web interfaces for iOS, just not with this particular framework.

For my project, I'm planning on adding an ios7 class to the <html> element (see the end of this thread for an example of how it could be done) and requiring that class in front of any CSS class declarations. I don't know yet if @nolimits4web will be willing to integrate that idea into this project.

  1. Boy are you in luck. ;) A couple weeks ago, I was working on a fully client-side Javascript project with Rails, Backbone, Chaplin, and rails-compiled client-side Haml Coffee templates all communicating with Rails via JSON. It's different than working exclusively with Rails, but it certainly can be done: https://github.com/ptb/chaplin_rest

The majority of this project is all @nolimits4web, if anything I'm a very late addition. He deserves all the credit. :)

ptb avatar Mar 26 '14 18:03 ptb

Funny you say that, because this is actually my first month of using rails. And I am completely in love. I love rails the way a fat kid loves donuts. Except possibly more love. I've been developing in Node/Express/Mongo/Backbone/Handlebars for a year and a half or so now, and working with rails has been a delight beyond my greatest imaginings.

That idea sounds pretty solid to me. I am really primarily concerned with how to actually differentiate what views to serve entirely. The entire application isn't a SPA (boss doesn't like taking time to do things the right way) and using this framework would require entirely restructuring the way that views are served if I plan on integrating it into the existing app. Which might not end up happening, which would be no big deal. Just more to learn :)

That repo looks fantastic! I starred it and will take a closer look later tonight. I must say, I've been intimidated as all hell by Devise, I may or may not end up using your Devise auth code to teach myself how on earth to implement it.

And to @nolimits4web the credit shall go then, if you insist! I am just fascinated by everything about how this was executed. The animations run with zero jank. Smooth as a baby's butt. And the interface... It's just.... It's a carbon copy of the iOS 7 interface. I very literally have no idea how @nolimits4web (and you too, dammit, @ptb) got it so close. Absolutely indistinguishable from the "real thing".

I really do think that's where most of my confusion early came from. It looks absolutely identical to the native interface and I couldn't imagine it being anything other than a compiled native application.

It's been a long time since I've been as excited about a project as I am right now. How best would I be able to contribute? I know that there's a dire need for documentation, but as far as code goes I would really, really love to help out as well. I am not a guru by any means but I consider myself to be extremely proficient in javascript and really do think I could help out.

rex avatar Mar 26 '14 20:03 rex

Guys, thanks for your kind words. We can make it much much better together;) At the moment i really really need help with two things:

  • docs, i can write docs about JS api, but it is pretty problematic for me to describe HTML layout well, and its different combination, especially because English is not my native language:)
  • demo apps. We need ready to use demo apps, like local business app, travel app, hotel app, news app, company app, e-store app, etc. So developsers/users can have fast start with it, just download and start to restyle and fill up with their content

nolimits4web avatar Mar 29 '14 14:03 nolimits4web

@nolimits4web You guys have done a great job, and I'd like to contribute as much as I can. I'll get working on the demo apps over the weekend. I think I'll start with e-comm demo. Do you have any apps that I can draw some inspirations from?

thilak-rao avatar Apr 04 '14 06:04 thilak-rao

Hey @xthilakx! Don't have such apps but you can search on appstore for apps of your largest local retailers. But i guess it should be simple:

  1. Page with product categories (list view/media list)
  2. Page with list of products in selected category (probably also media list with thumb, title, price)
  3. Page of single product, custom layout - photo, maybe like picture carousel (could be easily made with https://github.com/nolimits4web/Swiper), price, availability, description, add-to-cart button, product properties/tech spec
  4. Shopping cart page, also list view?:) with swipe-to-delete list elements to remove from cart
  5. Something like user settings page, where he can fill his personal and delivery data
  6. News and Offers pages - list of news and offers and detail page for each one
  7. And few static pages with info about Shop/Company (custom layout, simple text page), delivery terms & conditions, info about payment methods, contacts page (with google maps)

nolimits4web avatar Apr 05 '14 20:04 nolimits4web

I think i can close it for now because all docs are already released

nolimits4web avatar May 31 '14 13:05 nolimits4web

Hi Guys, Thanks for making such an easy to use framework. I want to ask following simple question

  1. When Framework7 requests a template page (e.g. contact.html) from web server, is it possible to add some header information in the request as I need to set the authorization header in it?
  2. When the app is built by phone gap for native use, does it still makes the web server calls for template pages (html) or some how picks it locally?

Kinds Regards Mansoor

msarfraz avatar Sep 27 '14 05:09 msarfraz

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Jun 26 '18 10:06 lock[bot]