Giter VIP home page Giter VIP logo

ordnungjs's Introduction

Ordnung.js

A framework for building maintainable frontend applications

Getting Started

This project can be used with bower. This will install both the concatenated and minified files, along with the sourcemap for both of them. It will also install the dependencies needed to run the project

bower install ordnung

Ordnung is only dependent on Require.js and Knockout.js. With these three files you are ready to make your own awesome single page application!

Development

The rest of this readme is for contributors to this project.

This project requires node.js, grunt and bower. Download and install node js on your machine. Next install bower and grunt from the terminal:

npm install -g bower
npm install -g grunt-cli

Installation

This project uses grunt for installation, building and testing. With grunt and bower installed, the grunt command can be used to perform any of the other tasks. Before grunt can be used, some node packages must be installed:

npm install

Fetching Dependencies

Download the dependencies using bower:

grunt install

Building the project

Grunt can be used to concatenate the AMD modules and minify them:

grunt build

Running Tests

karma is used for automatic testing. In development a test server can be started, and the tests will be automatically run when a file changes:

grunt test

Connect to the test server by opening one or more browsers and navigating to http://localhost:9876

Buildserver

On the build server all of these steps (installing dependencies, building the project and running tests) can be done with the default grunt commant:

grunt

Releasing a new version

Grunt can be used to create a new version. This will commit the latest changes, increment the version and tag the commit with v..:

grunt release

License

Copyright ©2013 Marius Gundersen All Rights Reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

ordnungjs's People

Contributors

mariusgundersen avatar

Stargazers

 avatar

Watchers

 avatar James Cloos avatar  avatar

ordnungjs's Issues

There should be an event that the current page has changed

This event should include both the current url and the path segments, split on /.

For example, when navigating to /user/marius/1234, it would produce the following event:

thePageHasChanged('/user/marius1234', ['user', 'marius', '1234']);

Executable.prototype.execute should return a promise

When executing a command/query there should be a way to react to the result/success/failure, without using the success, result, error callbacks. This is useful when the executable can be called from multiple places but should have a different success callback.

Add anonymous bindings

There should be a special type of bindings/viewmodels that only work on the selected element, not its children. This usually involves a single custom binding, so instead of having a viewmodel, a binding and a stopBinding, it could be something like this:

<div data-binding="slideIn: {width:200}">
  <!-- other content here -->
</div>

which would be translated to something like this:

<div data-viewmodel="AnonymousVM" data-bind="slideIn: {width:200}, stopBinding: true">
  <!-- other content here -->
</div>

Add qvc.command or qvc.query, which immediately invokes the executable

Instead of having to create the command or query and then executing it, have it immediately execute.

qvc.command("DoSomething", {
    param1:true, 
    param2:45
  }).success(function(){
    callback();
  });

This should not fetch the validation constraints, since they are not needed. It still needs to extend the parameters, in case the server returns a validation result.

Make sure that an observable isn't extended multiple times!

Add a callback on page load, so other declarative components can be used

In the config there should be hooks for when the page has loaded and when the page has been bound to viewmodels, so other declarative components can be used. These hooks should take the element of the current page (ie, the outlet) and a callback for when the page is destroyed (so event listeners can be released). An example:

ordnung.config({
  spa:{
    onPageLoaded: function(pageElement, onPageElementDestroyed){
      myDeclarativeLibrary.findInElement(pageElement);
      onPageElementDestroyed(function(){
        mDeclarativeLibrary.release(pageElement);
      }
    }
  }
}).start();

Pages cannot contain templates

When ordnung copies script tags it does not copy the type of the script. All script tags are interpreted as JavaScript. This means knockout templates cannot be used.

In addition, a page should be able to contain templates for that page. This requires nesting though! It might work, but the template must be prefixed with the path of the current page

Have a way to get all the invalid fields of a command/query

Currently there is no simple way to find all the invalid fields. One solution would be to attach a callback which is called whenever the executable is executed, but validation fails. The parameter passed to this callback would be a list of invalid fields

ajax does not handle url with query strings

If the url passed to ajax has a queryString, then an additional question mark is added to the end. It should add an ampersand with the rest of the query string behind it

Safari does not urlDecode the path, causing hashNavigation to fail with paths containing special characters, like æ, ø, å

This shows up when you listen to the ordnung.thePageHasChanged event, where segments now contains %C3%B8 instead of ø. This can lead templates containing special characters not to load on safari (iOS and OSX).

To fix this, call decodeURIComponent on the path segments before calling the pageChanged listener from the hashNavigation class.

This needs thourogh testing, which must be run on safari!

Add support for pushState navigation

Instead of using hash based navigation, use pushState when navigating to a new page.

This requires that a few issues need to be solved:

  • global link listener?
  • global form submit
  • programmatic navigation

commands and queries should have a way to abort the previous execution if it is executed while busy

This would be great for scenarios where throttle is used to trigger a query. If the user types slowly, triggering many queries, then subsequent executions are discarded until the request finishes.

The syntax would probably be something like this:

qvc.createQuery("Search", {query:query}).blockWhileBusy(false);

This probably requires an abort method on the executable. It could be used from within beforeExecute to create this effect.

data-loading is not enough, there should be a data-page-status with more detailed information

data-loading is true after the page has loaded, but before the viewmodel has been applied. This screws up css selectors. There should instead be a data-page-status with the following states:

  • Loading (the template or page is being loaded)
  • Rendering (the innerHTML is updating)
  • Applying ViewModels (The viewmodels are loading and running)
  • Active (Loading is done, the page can be used)

Better names for these states are needed

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.