Skip to content
Snippets Groups Projects
Commit d94bf7e8 authored by Anton Sarukhanov's avatar Anton Sarukhanov
Browse files

Begin frontend

parent 1024117e
No related branches found
No related tags found
No related merge requests found
import os
from flask import Flask
from flask import Flask, render_template
from flask.ext.bower import Bower
from models import db
import models
......@@ -15,9 +16,12 @@ app.config.from_pyfile('config.py', silent=True)
# Database init
db.init_app(app)
Bower(app)
# Flask Web Routes
@app.route('/')
def just_testing():
return str("Hello World!")
def map():
return render_template('map.html')
if __name__ == '__main__':
# Run Flask
......
{
"name": "leaflet",
"version": "0.7.7",
"description": "JavaScript library for mobile-friendly interactive maps",
"main": [
"dist/leaflet.css",
"dist/leaflet-src.js",
"dist/images/layers-2x.png",
"dist/images/layers.png",
"dist/images/marker-icon-2x.png",
"dist/images/marker-icon.png",
"dist/images/marker-shadow.png"
],
"ignore": [
".*",
"CHANGELOG.json",
"FAQ.md",
"debug",
"spec",
"src",
"build"
],
"homepage": "https://github.com/Leaflet/Leaflet",
"_release": "0.7.7",
"_resolution": {
"type": "version",
"tag": "v0.7.7",
"commit": "197f9d43b7bbc73c0492bf62cd666a5a98038098"
},
"_source": "git://github.com/Leaflet/Leaflet.git",
"_target": "~0.7.7",
"_originalSource": "leaflet",
"_direct": true
}
\ No newline at end of file
This diff is collapsed.
Contributing to Leaflet
=======================
1. [Getting Involved](#getting-involved)
2. [Reporting Bugs](#reporting-bugs)
3. [Contributing Code](#contributing-code)
4. [Improving Documentation](#improving-documentation)
## Getting Involved
Third-party patches are absolutely essential on our quest to create the best mapping library that will ever exist.
However, they're not the only way to get involved with the development of Leaflet.
You can help the project tremendously by discovering and [reporting bugs](#reporting-bugs),
[improving documentation](#improving-documentation),
helping others on the [Leaflet forum](https://groups.google.com/forum/#!forum/leaflet-js)
and [GitHub issues](https://github.com/Leaflet/Leaflet/issues),
showing your support for your favorite feature suggestions on [Leaflet UserVoice page](http://leaflet.uservoice.com),
tweeting to [@LeafletJS](http://twitter.com/LeafletJS)
and spreading the word about Leaflet among your colleagues and friends.
## Reporting Bugs
Before reporting a bug on the project's [issues page](https://github.com/Leaflet/Leaflet/issues),
first make sure that your issue is caused by Leaflet, not your application code
(e.g. passing incorrect arguments to methods, etc.).
Second, search the already reported issues for similar cases,
and if it's already reported, just add any additional details in the comments.
After you made sure that you've found a new Leaflet bug,
here are some tips for creating a helpful report that will make fixing it much easier and quicker:
* Write a **descriptive, specific title**. Bad: *Problem with polylines*. Good: *Doing X in IE9 causes Z*.
* Include **browser, OS and Leaflet version** info in the description.
* Create a **simple test case** that demonstrates the bug (e.g. using [JSFiddle](http://jsfiddle.net/)).
* Check whether the bug can be reproduced in **other browsers**.
* Check if the bug occurs in the stable version, master, or both.
* *Bonus tip:* if the bug only appears in the master version but the stable version is fine,
use `git bisect` to find the exact commit that introduced the bug.
If you just want some help with your project,
try asking [on the Leaflet forum](https://groups.google.com/forum/#!forum/leaflet-js) instead.
## Contributing Code
### Considerations for Accepting Patches
While we happily accept patches, we're also commited to keeping Leaflet simple, lightweight and blazingly fast.
So bugfixes, performance optimizations and small improvements that don't add a lot of code
are much more likely to get accepted quickly.
Before sending a pull request with a new feature, first check if it's been discussed before already
(either on [GitHub issues](https://github.com/Leaflet/Leaflet/issues)
or [Leaflet UserVoice](http://leaflet.uservoice.com/)),
and then ask yourself two questions:
1. Are you sure that this new feature is important enough to justify its presense in the Leaflet core?
Or will it look better as a plugin in a separate repository?
2. Is it written in a simple, concise way that doesn't add bulk to the codebase?
If your feature or API improvement did get merged into master,
please consider submitting another pull request with the corresponding [documentation update](#improving-documentation).
### Setting up the Build System
To set up the Leaflet build system, install [Node](http://nodejs.org/),
then run the following commands in the project root:
```
npm install -g jake
npm install
```
You can build minified Leaflet by running `jake` (it will be built from source in the `dist` folder).
For a custom build with selected components, open `build/build.html` in the browser and follow the instructions from there.
### Making Changes to Leaflet Source
If you're not yet familiar with the way GitHub works (forking, pull requests, etc.),
be sure to check out the awesome [article about forking](https://help.github.com/articles/fork-a-repo)
on the GitHub Help website — it will get you started quickly.
You should always write each batch of changes (feature, bugfix, etc.) in **its own topic branch**.
Please do not commit to the `master` branch, or your unrelated changes will go into the same pull request.
You should also follow the code style and whitespace conventions of the original codebase.
In particular, use tabs for indentation and spaces for alignment.
Before commiting your changes, run `jake lint` to catch any JS errors in the code and fix them.
If you add any new files to the Leaflet source, make sure to also add them to `build/deps.js`
so that the build system knows about them.
Also, please make sure that you have [line endings configured properly](https://help.github.com/articles/dealing-with-line-endings) in Git! Otherwise the diff will show that all lines of a file were changed even if you touched only one.
Happy coding!
## Running the Tests
To run the tests from the command line,
install [PhantomJS](http://phantomjs.org/) (and make sure it's in your `PATH`),
then run:
```
jake test
```
To run all the tests in actual browsers at the same time, you can do:
```
jake test --ff --chrome --safari --ie
```
To run the tests in a browser manually, open `spec/index.html`.
## Code Coverage
To generate a detailed report about test coverage (which helps tremendously when working on test improvements), run:
```
jake test --cov
```
After that, open `spec/coverage/<environment>/index.html` in a browser to see the report.
From there you can click through folders/files to get details on their individual coverage.
## Improving Documentation
The code of the live Leaflet website that contains all documentation and examples is located in the `gh-pages` branch
and is automatically generated from a set of HTML and Markdown files by [Jekyll](https://github.com/mojombo/jekyll).
The easiest way to make little improvements such as fixing typos without even leaving the browser
is by editing one of the files with the online GitHub editor:
browse the [gh-pages branch](https://github.com/Leaflet/Leaflet/tree/gh-pages),
choose a certain file for editing (e.g. `reference.html` for API reference),
click the Edit button, make changes and follow instructions from there.
Once it gets merged, the changes will immediately appear on the website.
If you need to make edits in a local repository to see how it looks in the process, do the following:
1. [Install Ruby](http://www.ruby-lang.org/en/) if don't have it yet.
2. Run `gem install jekyll`.
3. Run `jekyll serve --watch` in the root `Leaflet` folder.
4. Open `localhost:4000` in your browser.
Now any file changes will be updated when you reload pages automatically.
After commiting the changes, just send a pull request.
If you need to update documentation according to a new feature that only appeared in the master version (not stable one),
you need to make changes to `gh-pages-master` branch instead of `gh-pages`.
It will get merged into the latter when released as stable.
## Thank You
Not only are we grateful for any contributions, &mdash; helping Leaflet and its community actually makes you AWESOME.
Join [this approved list of awesome people](https://github.com/Leaflet/Leaflet/graphs/contributors)
and help us push the limits of what's possible with online maps!
/*
Leaflet building, testing and linting scripts.
To use, install Node, then run the following commands in the project root:
npm install -g jake
npm install
To check the code for errors and build Leaflet from source, run "jake".
To run the tests, run "jake test".
For a custom build, open build/build.html in the browser and follow the instructions.
*/
var build = require('./build/build.js');
function hint(msg, paths) {
return function () {
console.log(msg);
jake.exec('node node_modules/jshint/bin/jshint -c ' + paths,
{printStdout: true}, function () {
console.log('\tCheck passed.\n');
complete();
});
}
}
desc('Check Leaflet source for errors with JSHint');
task('lint', {async: true}, hint('Checking for JS errors...', 'build/hintrc.js src'));
desc('Check Leaflet specs source for errors with JSHint');
task('lintspec', {async: true}, hint('Checking for specs JS errors...', 'spec/spec.hintrc.js spec/suites'));
desc('Combine and compress Leaflet source files');
task('build', {async: true}, function () {
build.build(complete);
});
desc('Run PhantomJS tests');
task('test', ['lint', 'lintspec'], {async: true}, function () {
build.test(complete);
});
task('default', ['test', 'build']);
jake.addListener('complete', function () {
process.exit();
});
Copyright (c) 2010-2013, Vladimir Agafonkin
Copyright (c) 2010-2011, CloudMade
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list
of conditions and the following disclaimer in the documentation and/or other materials
provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Leaflet Plugin Authoring Guide
One of the greatest things about Leaflet is its powerful plugin ecosystem.
The [Leaflet plugins page](http://leafletjs.com/plugins.html) lists dozens of awesome plugins, and more are being added every week.
This guide lists a number of best practices for publishing a Leaflet plugin that meets the quality standards of Leaflet itself.
1. [Presentation](#presentation)
- [Repository](#repository)
- [Name](#name)
- [Demo](#demo)
- [Readme](#readme)
- [License](#license)
2. [Code](#code)
- [File Structure](#file-structure)
- [Code Conventions](#code-conventions)
- [Plugin API](#plugin-api)
## Presentation
### Repository
The best place to put your Leaflet plugin to is a separate [GitHub](http://github.com) repository.
If you create a collection of plugins for different uses,
don't put them in one repo &mdash;
it's usually easier to work with small, self-contained plugins in individual repositories.
### Name
Most existing plugins follow the convention of naming plugins (and repos) like this: `Leaflet.MyPluginName`.
You can use other forms (e.g. "leaflet-my-plugin-name"),
just make sure to include the word "Leaflet" in the name so that it's obvious that it's a Leaflet plugin.
### Demo
The most essential thing to do when publishing a plugin is to include a demo that showcases what the plugin does &mdash;
it's usually the first thing people will look for.
The easiest way to put up a demo is using [GitHub Pages](http://pages.github.com/).
A good [starting point](https://help.github.com/articles/creating-project-pages-manually) is creating a `gh-pages` branch in your repo and adding an `index.html` page to it &mdash;
after pushing, it'll be published as `http://<user>.github.io/<repo>`.
### Readme
The next thing you need to have is a descriptive `README.md` in the root of the repo (or a link to a website with a similar content).
At a minimum it should contain the following items:
- name of the plugin
- a simple, concise description of what it does
- requirements
- Leaflet version
- other external dependencies (if any)
- browser / device compatibility
- links to demos
- instructions for including the plugin
- simple usage code example
- API reference (methods, options, events)
### License
Every open source repository should include a license.
If you don't know what open source license to choose for your code,
[MIT License](http://opensource.org/licenses/MIT) and [BSD 2-Clause License](http://opensource.org/licenses/BSD-2-Clause) are both good choices.
You can either put it in the repo as a `LICENSE` file or just link to the license from the Readme.
## Code
### File Structure
Keep the file structure clean and simple,
don't pile up lots of files in one place &mdash;
make it easy for a new person to find their way in your repo.
A barebones repo for a simple plugin would look like this:
```
my-plugin.js
README.md
```
An example of a more sophisticated plugin file structure:
```
/src - JS source files
/dist - minified plugin JS, CSS, images
/spec - test files
/lib - any external libraries/plugins if necessary
/examples - HTML examples of plugin usage
README.md
LICENSE
package.json
```
### Code Conventions
Everyone's tastes are different, but it's important to be consistent with whatever conventions you choose for your plugin.
For a good starting point, check out [Airbnb JavaScript Guide](https://github.com/airbnb/javascript).
Leaflet follows pretty much the same conventions
except for using smart tabs (hard tabs for indentation, spaces for alignment)
and putting a space after the `function` keyword.
### Plugin API
Never expose global variables in your plugin.<br>
If you have a new class, put it directly in the `L` namespace (`L.MyPlugin`).<br>
If you inherit one of the existing classes, make it a sub-property (`L.TileLayer.Banana`).<br>
If you want to add new methods to existing Leaflet classes, you can do it like this: `L.Marker.include({myPlugin: …})`.
Function, method and property names should be in `camelCase`.<br>
Class names should be in `CapitalizedCamelCase`.
If you have a lot of arguments in your function, consider accepting an options object instead
(putting default values where possible so that users don't need specify all of them):
```js
// bad
marker.myPlugin('bla', 'foo', null, {}, 5, 0);
// good
marker.myPlugin('bla', {
optionOne: 'foo',
optionThree: 5
});
```
And most importantly, keep it simple. Leaflet is all about *simplicity*.
<img src="http://leafletjs.com/docs/images/logo.png" alt="Leaflet" />
Leaflet is an open source JavaScript library for **mobile-friendly interactive maps**.
It is developed by [Vladimir Agafonkin][] of [MapBox][] with a team of dedicated [contributors][].
Weighing just about 30 KB of gzipped JS code, it has all the [features][] most developers ever need for online maps.
Leaflet is designed with *simplicity*, *performance* and *usability* in mind.
It works efficiently across all major desktop and mobile platforms out of the box,
taking advantage of HTML5 and CSS3 on modern browsers while being accessible on older ones too.
It can be extended with a huge amount of [plugins][],
has a beautiful, easy to use and [well-documented][] API
and a simple, readable [source code][] that is a joy to [contribute][] to.
For more info, docs and tutorials, check out the [official website][].<br>
For **Leaflet downloads** (including the built master version), check out the [download page][].
We're happy to meet new contributors.
If you want to **get involved** with Leaflet development, check out the [contribution guide][contribute].
Let's make the best mapping library that will ever exist,
and push the limits of what's possible with online maps!
[![Build Status](https://travis-ci.org/Leaflet/Leaflet.png?branch=master)](https://travis-ci.org/Leaflet/Leaflet)
[Vladimir Agafonkin]: http://agafonkin.com/en
[contributors]: https://github.com/Leaflet/Leaflet/graphs/contributors
[features]: http://leafletjs.com/features.html
[plugins]: http://leafletjs.com/plugins.html
[well-documented]: http://leafletjs.com/reference.html "Leaflet API reference"
[source code]: https://github.com/Leaflet/Leaflet "Leaflet GitHub repository"
[hosted on GitHub]: http://github.com/Leaflet/Leaflet
[contribute]: https://github.com/Leaflet/Leaflet/blob/master/CONTRIBUTING.md "A guide to contributing to Leaflet"
[official website]: http://leafletjs.com
[download page]: http://leafletjs.com/download.html
[MapBox]: https://mapbox.com
{
"name": "leaflet",
"version": "0.7.7",
"description": "JavaScript library for mobile-friendly interactive maps",
"main": [
"dist/leaflet.css",
"dist/leaflet-src.js",
"dist/images/layers-2x.png",
"dist/images/layers.png",
"dist/images/marker-icon-2x.png",
"dist/images/marker-icon.png",
"dist/images/marker-shadow.png"
],
"ignore": [
".*",
"CHANGELOG.json",
"FAQ.md",
"debug",
"spec",
"src",
"build"
]
}
{
"name": "leaflet",
"version": "0.7.7",
"description": "JavaScript library for mobile-friendly interactive maps",
"scripts": [
"dist/leaflet.js",
"dist/leaflet-src.js"
],
"images": [
"dist/images/layers-2x.png",
"dist/images/layers.png",
"dist/images/marker-icon-2x.png",
"dist/images/marker-icon.png",
"dist/images/marker-shadow.png"
],
"styles": [
"dist/leaflet.css"
],
"main": "dist/leaflet-src.js"
}
{
"name": "leaflet",
"version": "0.7.7",
"description": "JavaScript library for mobile-friendly interactive maps",
"devDependencies": {
"copyfiles": "^0.2.1",
"happen": "~0.2.0",
"jake": "~8.0.12",
"jshint": "~2.8.0",
"karma": "~0.13.14",
"karma-chrome-launcher": "^0.2.1",
"karma-coverage": "~0.5.3",
"karma-mocha": "~0.2.0",
"karma-phantomjs-launcher": "^0.2.1",
"mocha": "~2.3.3",
"tin": "^0.5.0",
"uglify-js": "~2.5.0"
},
"main": "dist/leaflet-src.js",
"scripts": {
"test": "jake test",
"build": "jake build",
"release": "./build/publish.sh"
},
"repository": {
"type": "git",
"url": "git://github.com/Leaflet/Leaflet.git"
},
"keywords": [
"gis",
"map"
]
}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>{% block title %}{% endblock %}</title>
{% block head %}
{% endblock %}
</head>
<body>
{% block body %}{% endblock %}
{% block body_end %}{% endblock %}
</body>
</html>
{% extends "base.html" %}
{% block title %}Bus Map{% endblock %}
{% block head %}
{{ super() }}
<link href="bower/leaflet/dist/leaflet.css" rel="stylesheet"/>
<style>
html, body {
width: 100%;
height: 100%;
border: 0;
margin: 0;
padding: 0;
}
#map {
height: 100%;
width: 100%;
}
</style>
{% endblock %}
{% block body %}
<div id="map"></div>
<script src="bower/leaflet/dist/leaflet.js"></script>
<script>
var mapDivId = "map";
var zoom = 14;
var center = [40.5, -74.45];
var mapOptions = {
minZoom: 14,
maxZoom: 18,
zoomControl: false,
};
var bounds = [
[40.400, -74.65], // sw
[40.600, -74.25], // ne
];
var boundsOptions = {
animate: false,
reset: true,
};
var osm = "<a href=\"http://openstreetmap.org\">OpenStreetMap</a>";
var tileUrl = 'http://{s}.tiles.antsar-static.com/{tileset}/{z}/{x}/{y}.png';
var tileOptions = {
subdomains: ['a', 'b', 'c', 'd', 'e'],
attribution: '&copy; ' + osm + ' Contributors',
tileset: 'rutgers-black',
errorTileUrl: 'http://tiles.antsar-static.com/generic/tile-blank-black.png',
};
var map = L.map(mapDivId, mapOptions)
.setView(center, zoom)
.setMaxBounds(bounds, boundsOptions);
L.tileLayer(tileUrl, tileOptions).addTo(map);
</script>
{% endblock %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment