Browse Source

Basic bikes page.

feature/bike-tracking
Drew Larson 8 years ago
parent
commit
2665d5e4da
  1. 22
      bikeshop_project/assets/js/bikes/index.jsx
  2. 7
      bikeshop_project/bike/templates/bikes.html
  3. 7
      bikeshop_project/bike/urls.py
  4. 12
      bikeshop_project/bike/views.py
  5. 2
      bikeshop_project/bikeshop/urls.py
  6. 1
      bikeshop_project/core/templates/dashboard.html

22
bikeshop_project/assets/js/bikes/index.jsx

@ -0,0 +1,22 @@
import React from 'react';
import ReactDOM from 'react-dom';
import injectTapEventPlugin from 'react-tap-event-plugin';
// Needed for onTouchTap
// http://stackoverflow.com/a/34015469/988941
injectTapEventPlugin();
class App extends React.Component {
render() {
return (
<div className="mdl-grid">
<div className="mdl-cell mdl-cell--12-col">
<h1>Bikes</h1>
</div>
</div>
);
}
}
ReactDOM.render(<App />, document.getElementById('root'));

7
bikeshop_project/bike/templates/bikes.html

@ -0,0 +1,7 @@
{% extends 'dashboard.html' %}
{% load render_bundle from webpack_loader %}
{% block content %}
<div id="root"></div>
{% render_bundle 'webpack' %}
{% render_bundle 'bikes' %}
{% endblock %}

7
bikeshop_project/bike/urls.py

@ -0,0 +1,7 @@
from django.conf.urls import url
from .views import BikesView
urlpatterns = [
url(r'^$', BikesView.as_view(), name='bikes')
]

12
bikeshop_project/bike/views.py

@ -1,3 +1,11 @@
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
from django.views.generic import TemplateView
# Create your views here.
@method_decorator(login_required, name='dispatch')
class BikesView(TemplateView):
template_name = 'bikes.html'
def get(self, request):
return self.render_to_response({})

2
bikeshop_project/bikeshop/urls.py

@ -24,6 +24,7 @@ from rest_framework_jwt.views import obtain_jwt_token
import registration
from core import urls as core_urls
from registration import urls as member_urls
from bike import urls as bike_urls
routeLists = [
registration.urls.apiRoutes,
@ -39,6 +40,7 @@ urlpatterns = [
url(r'^login/', login, {'template_name': 'login.html'}, name='login'),
url(r'^logout/', logout_then_login, name='logout'),
url(r'^members/', include(member_urls)),
url(r'^bikes/', include(bike_urls)),
url(r'^admin/', admin.site.urls),
url(r'^api/v1/', include(router.urls)),
url(r'^api/v1/token-auth/', obtain_jwt_token),

1
bikeshop_project/core/templates/dashboard.html

@ -47,6 +47,7 @@
<a class="mdl-navigation__link" href="{% url 'home' %}"><i class="mdl-color-text--blue-grey-400 material-icons" role="presentation">home</i>Home</a>
<a class="mdl-navigation__link" href="{% url 'member_new' %}"><i class="mdl-color-text--blue-grey-400 material-icons" role="presentation">person</i>New Member</a>
<a class="mdl-navigation__link" href="{% url 'members' %}"><i class="mdl-color-text--blue-grey-400 material-icons" role="presentation">people</i>Members</a>
<a class="mdl-navigation__link" href="{% url 'bikes' %}"><i class="mdl-color-text--blue-grey-400 material-icons" role="presentation">directions_bike</i>Bikes</a>
<div class="mdl-layout-spacer"></div>
{# <a class="mdl-navigation__link" href=""><i class="mdl-color-text--blue-grey-400 material-icons" role="presentation">help_outline</i><span class="visuallyhidden">Help</span></a>#}
</nav>

Loading…
Cancel
Save