Giter Site home page Giter Site logo

hinovana / tupai.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from deyunanhai/tupai.js

0.0 2.0 0.0 3.1 MB

tupai.js is a minimal and flexible javascript mvc framework. providing a robust set of features for building single and multi-page.

License: MIT License

Makefile 0.35% JavaScript 99.25% HTML 0.40%

tupai.js's Introduction

tupai.js is a minimal and flexible javascript mvc framework. providing a robust set of features for building single and multi-page.

Package

  • Namespaces are needed because there can be many functions, variables for classes in one program and they can conflict with the existing names of variables, functions and classes.

HTML Template

  • Roles of engineers and mark-up is clear.
  • Customizable template engine. (You can work with, such as mustache).

CLI

  • Automatic source code generation.
  • Start a test server.
  • Make files for release.
  • etc ...

Getting started

Install with npm. If you were not installed node, install node (Joyent, Inc,).

npm install tupaijs

Generate project Use tupaijs command.

tupaijs new helloworld

Start server.

cd helloworld; tupaijs server

Open in browser.

http://localhost:9800

That's ALL!!!

Creating master detail view

Generate controller.

tupaijs g controller sub

Edit templates/helloworld/Templates.html add an button to "div#helloworld.RootViewController.content".

<button data-ch-id="btnGotoSub">goto sub</button>

Edit templates/helloworld/Templates.html add an button to "div#helloworld.SubViewController.content".

<button data-ch-id="btnBack">back</button>

Edit RootViewController.js

First, in order to change the contents of the text that is displayed on the screen, viewInit function is modified as follows.

viewInit: function() {
    var view = new cp.View({
       template:cp.Templates.get('helloworld.RootViewController.content'),
        templateParameters: {
            lbl: 'RootViewController'
        }
    });
    this.setContentView(view);
},

ViewDidLoad function is as follows, adding the processing of the back button.

viewDidLoad: function (view) {
    var This = this;
    view.findViewById('btnGotoSub').bind('click', function() {
        This._window.transitWithHistory('/sub');
    });
},

Edit SubViewController.js

First, in order to change the contents of the text that is displayed on the screen, viewInit function is modified as follows.

viewInit: function() {
    var view = new cp.View({
        template: cp.Templates.get('helloworld.SubViewController.content'),
        templateParameters: {
            lbl: 'SubViewController'
        }
    });
    this.setContentView(view);
},

ViewDidLoad function is as follows, adding the processing of the back button.

var This = this;
view.findViewById('btnBack').bind('click', function() {
    This._window.back();
});

view source

License

MIT

Links

Web Site

Examples

API Documentation

Author

bocelli.hu [email protected]

tupai.js's People

Contributors

deyunanhai avatar dqneo avatar

Watchers

James Cloos avatar hinovana avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.