├── README.md ├── app.js ├── contact.html ├── css ├── app.css └── app.less ├── index.html ├── js ├── contact │ ├── contact.hbs │ ├── contactController.js │ └── contactView.js ├── contactModel.js ├── list │ ├── contact-list-item.hbs │ ├── listController.js │ └── listView.js └── router.js └── lib ├── css ├── framework7.css ├── framework7.min.css ├── framework7.rtl.css ├── framework7.rtl.min.css └── ionicons.css ├── fonts ├── ionicons.eot ├── ionicons.svg ├── ionicons.ttf └── ionicons.woff ├── framework7.js ├── framework7.min.js ├── handlebars.js ├── hbs.js ├── require.js └── text.js /README.md: -------------------------------------------------------------------------------- 1 | Framework7-MVC-base 2 | ======================== 3 | 4 | This app shows you example of using beautiful mobile framework - Framework7 in MVC way for building data-driven contacts application. 5 | 6 | ##### Additional js libraries: 7 | - Handlebars - templating library (http://handlebarsjs.com/) 8 | - RequireJS - for asynchronous javascript modules loading (http://requirejs.org/) 9 | - Additional RequireJS plugins for handlebars templates loading: 10 | - text (https://github.com/requirejs/text) 11 | - hbs (https://github.com/epeli/requirejs-hbs) 12 | 13 | And amazing mobile-icons library: 14 | - ionicons (http://ionicons.com/) 15 | 16 | 17 | Some notes about "how it works". 18 | ----- 19 | 20 | Application entry point: app.js file. 21 | It's used for RequireJs and Framework7 initial configuration. 22 | Also it starts application routing. 23 | 24 | Router has two methods: 25 | + ```Router.init()``` - initialize routing - handle Framework7 page events - pageBeforeInit and pageBeforeAnimation. 26 | More about Framework7 page events here: 27 | http://www.idangero.us/framework7/docs/pages.html#page-events 28 | 29 | + ```Router.load(contollerName, query)``` - load selected controller, query - optional object with some parameters 30 | This method is useful for loading in already rendered page (for example popup) 31 | 32 | 33 | Suggested application code structure is convenient, especially for large projects: 34 | ``` js/moduleName1/moduleName1View.js 35 | js/moduleName1/moduleName1Controller.js 36 | js/moduleName1/some_templates.hbs 37 | js/router.js 38 | js/model.js 39 | ``` 40 | 41 | License 42 | ---- 43 | 44 | MIT 45 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | require.config({ 2 | paths: { 3 | handlebars: "lib/handlebars", 4 | text: "lib/text", 5 | hbs: "lib/hbs" 6 | }, 7 | shim: { 8 | handlebars: { 9 | exports: "Handlebars" 10 | } 11 | } 12 | }); 13 | define('app', ['js/router'], function(Router) { 14 | Router.init(); 15 | var f7 = new Framework7({ 16 | modalTitle: 'F7-MVC-Base', 17 | animateNavBackIcon: true 18 | }); 19 | var mainView = f7.addView('.view-main', { 20 | dynamicNavbar: true 21 | }); 22 | return { 23 | f7: f7, 24 | mainView: mainView, 25 | router: Router 26 | }; 27 | }); -------------------------------------------------------------------------------- /contact.html: -------------------------------------------------------------------------------- 1 |
17 |