Git Product home page Git Product logo

simple-data's Introduction

Running it locally

In windows, in command prompt, execute serve. Then, access it on http://localhost:8888/index.html.

What to do on starting a new project based on this repo

  1. In index.html, renamed the title tag <title>TrendUI</title> to the new name.
  2. The angularjs main app module and other modules are reffered from the index at bottom of the html file:
<script src="app/ui/main.controller.js"></script>
<script src="app/ui/modal.controller.js"></script>
<script src="app/ui/app.js"></script>
<script src="app/ui/app.routes.js"></script>
  1. Go to app/ui/ directory.
  2. Related to that, maybe changed the brand name in the app/ui/html/navbar.html. Find this tag <span><a class="navbar-brand" href="">TrendUI</a></span> and replaced TrendUI to the new name.
  3. And also in app/ui/json/about.json. This is when user click on the about button on the right side of the navbar. Note: Currently there is a bug when serving this app in github pages without custom name, the about.json file will always be referred to the main default github pages username.github.io. So right now, we have to manually specify the relative path name to the about.json file in main.controller.js, simply change trendui after 'paths' : [ to the proper relative paths:
this.aboutOpts = {
  templateUrl : 'app/ui/html/about.html',
  config : function() {
    return {
      'get' : {
        'paths' : [ 'trendui/app/ui/json/about.json' ],
        'key' : 'init'
      }
    };
  }
};

Note: This issue is not appear to be an issue for github pages with custom domain name.

Adding a new page

  1. Create a new html file in the app/ui/html/.
  2. Register the route to the page in app/ui/app.routes.js. Add another to $routeProvider, for example:
.when("/newpage", {
  templateUrl : 'app/ui/html/newpage.html'
})
  1. To make the link appear in the navbar, simply register it in the app/ui/main.controller.js in function MainController.prototype._initHeader for example adding a new page is:
this.navbar = {
  templateUrl : 'app/ui/html/navbar.html',
  pages: [
    {
      "name" : "Home", "path" : "/", "ra" : false
    }, {
      "name" : "Blog", "path" : "/blog", "ra" : false
    }, {
      "name" : "New Page", "path" : "/newpage", "ra" : false
    }
  ]
};

Note: ra var in the entry of pages is a work in progress for feature required authentication/authorisation. 4. If the page required any controller process, add ng-init="ctrl._initBody()" in any early tag in the html file. 5. Then, in the app/ui/main.controller.js, define what needs to be done based on the url path:

MainController.prototype._initBody = function() {
  if (this._location.path() === '/') {
    /* Anything that needs to be executed in home page goes here... */
  }

  if (this._location.path() === '/blog') {
    /* Anything that needs to be executed in path /blog goes here... */
  }

  if (this._location.path() === '/newpage') {
    /* Anything that needs to be executed in path /newpage goes here... */
  }
};

simple-data's People

Watchers

mjunaidi avatar  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.