Giter Site home page Giter Site logo

planner's Introduction

planner

######################################################################################## ########################################################################################

/!\ This project is no longer maintained. Read the guide and see this project instead.

######################################################################################## ########################################################################################

planner is a demo front-end web app using Angular Material and Firebase. The purpose of this project is to understand how setup quickly and easily an Angular project with a good architecture.

Test the app

Online : https://planner31.firebaseapp.com/ or from your computer:

Requirements

Developed with:

  • Node.js v4.4.1
  • npm v2.14.20
  • Gulp CLI v1.2.1 (if you don't have it run npm install --global gulp-cli)
  • Sass v3.4.22 (if you don't have it got here http://sass-lang.com/install)

Clone it !

Be sure to have previous requirements installed on your computer.

  • Clone the repo on your computer (or download it as zip).
  • Open your terminal and go to the project directory.
  • Run npm install.
  • Run gulp, you should see the server starting in the terminal.
  • Go to http://localhost:4000.

๐Ÿ˜„ Please feel free to fork this project and make pull requests ! ๐Ÿ˜„

Explanations

  • Calling order

    • app.config()
    • app.run()
    • app.controllers()
  • Gulp automates tasks like starting the server, browserify js files, watch changes automatically...

  • Browserify allows us to use require() in our js files like in Node.js but for front-end development. Because of Gulp browserify takes all the required files in the app/ directory and concatenate them into a single file understandable by browsers in public/js/.

    • To use require('nameOfDirectory') you must put in the directory a index.js file wich contains a require('file.js') for each file in the directory. (example in app/controllers/)
    • If we don't use browserify the browser cannot understand require() statements.
  • All calls to Firebase must be in a service not a controller (example in app/services/EventService.js).

  • To share data between controllers we must use a service and store the shared data and then notify controllers of the update (example in app/services/SharedService.js). Do not forget to inject the service in the controller (example in app/controllers/PlannerCtrl.js).

  • To use Firebase hosting juste install Firebase CLI (npm install -g firebase-tools) and then run in your project directory firebase init and firebase deploy.

Angular best practices

Naming and location conventions

Element Naming style Example File Location
Modules lowerCamelCase angularApp angularApp.js app/
Controllers Functionality + 'Ctrl' AdminCtrl AdminCtrl.js app/controllers/
Directives lowerCamelCase userInfo userInfo.js app/directives/
Filters lowerCamelCase userFilter userFilter.js app/filters/
Services UpperCamelCase User User.js app/services/
Views lowerCamelCase mail mail.ejs public/views/

Controllers structure

  • The structure of a controller's file is :
angular.module('nameModule').controller('NameCtrl', NameCtrl);

function NameCtrl() {
  var vm = this;
  //vm.fields...
  //vm.methods...
  ]
}
  • Example (app/controllers/PlannerCtrl.js):
angular.module('planner').controller('PlannerCtrl', PlannerCtrl);

function PlannerCtrl() {
  var vm = this;
  vm.schedules = [
    {
      id:'1',
      time:'8h - 10h',
    },
    {
      id:'2',
      time:'10h - 12h',
    }
  ]
  //...
}

License

This project is licensed under the MIT License. See the LICENSE file for details.

planner's People

Contributors

gautierdelorme avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

laurenieto

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.