Fix button links of device_list & page titles
This commit is contained in:
parent
c9a46128df
commit
f22fd4ebcb
|
@ -47,15 +47,18 @@ class DeviceListView(View):
|
|||
|
||||
class DeviceDetailView(View):
|
||||
decorators = [login_required]
|
||||
template_name = 'inventory/device_details.html'
|
||||
template_name = 'inventory/device_detail.html'
|
||||
|
||||
def dispatch_request(self, id):
|
||||
lots = Lot.query.filter(Lot.owner_id == current_user.id)
|
||||
device = Device.query.filter(
|
||||
Device.owner_id == current_user.id).filter(Device.devicehub_id == id).one()
|
||||
|
||||
context = {'device': device,
|
||||
'lots': lots}
|
||||
context = {
|
||||
'device': device,
|
||||
'lots': lots,
|
||||
'page_title': 'Device {}'.format(device.devicehub_id),
|
||||
}
|
||||
return flask.render_template(self.template_name, **context)
|
||||
|
||||
|
||||
|
@ -139,20 +142,22 @@ class UploadSnapshotView(View):
|
|||
template_name = 'inventory/upload_snapshot.html'
|
||||
|
||||
def dispatch_request(self):
|
||||
context = {'page_title': 'Upload Snapshot'}
|
||||
lots = Lot.query.filter(Lot.owner_id == current_user.id).all()
|
||||
form = UploadSnapshotForm()
|
||||
if form.validate_on_submit():
|
||||
form.save()
|
||||
|
||||
return flask.render_template(self.template_name, form=form, lots=lots)
|
||||
return flask.render_template(self.template_name, form=form, lots=lots, **context)
|
||||
|
||||
|
||||
class CreateDeviceView(View):
|
||||
class DeviceCreateView(View):
|
||||
methods = ['GET', 'POST']
|
||||
decorators = [login_required]
|
||||
template_name = 'inventory/create_device.html'
|
||||
template_name = 'inventory/device_create.html'
|
||||
|
||||
def dispatch_request(self):
|
||||
context = {'page_title': 'New Device'}
|
||||
lots = Lot.query.filter(Lot.owner_id == current_user.id).all()
|
||||
form = NewDeviceForm()
|
||||
if form.validate_on_submit():
|
||||
|
@ -160,7 +165,7 @@ class CreateDeviceView(View):
|
|||
next_url = url_for('inventory.devices.devicelist')
|
||||
return flask.redirect(next_url)
|
||||
|
||||
return flask.render_template(self.template_name, form=form, lots=lots)
|
||||
return flask.render_template(self.template_name, form=form, lots=lots, **context)
|
||||
|
||||
|
||||
class TagListView(View):
|
||||
|
@ -227,10 +232,10 @@ class TagDetailView(View):
|
|||
return flask.render_template(self.template_name, **context)
|
||||
|
||||
|
||||
class TagDeviceAddView(View):
|
||||
class TagLinkDeviceView(View):
|
||||
methods = ['POST']
|
||||
decorators = [login_required]
|
||||
template_name = 'inventory/device_list.html'
|
||||
# template_name = 'inventory/device_list.html'
|
||||
|
||||
def dispatch_request(self):
|
||||
form = TagDeviceForm()
|
||||
|
@ -240,10 +245,10 @@ class TagDeviceAddView(View):
|
|||
return flask.redirect(request.referrer)
|
||||
|
||||
|
||||
class TagDeviceDeleteView(View):
|
||||
class TagUnlinkDeviceView(View):
|
||||
methods = ['POST', 'GET']
|
||||
decorators = [login_required]
|
||||
template_name = 'inventory/removeDevicestag.html'
|
||||
template_name = 'inventory/tag_unlink_device.html'
|
||||
|
||||
def dispatch_request(self, id):
|
||||
form = TagDeviceForm(delete=True, device=id)
|
||||
|
@ -265,10 +270,10 @@ devices.add_url_rule('/lot/add/', view_func=LotCreateView.as_view('lot_add'))
|
|||
devices.add_url_rule('/lot/<string:id>/del/', view_func=LotDeleteView.as_view('lot_del'))
|
||||
devices.add_url_rule('/lot/<string:id>/', view_func=LotUpdateView.as_view('lot_edit'))
|
||||
devices.add_url_rule('/upload-snapshot/', view_func=UploadSnapshotView.as_view('upload_snapshot'))
|
||||
devices.add_url_rule('/device/add/', view_func=CreateDeviceView.as_view('device_add'))
|
||||
devices.add_url_rule('/device/add/', view_func=DeviceCreateView.as_view('device_add'))
|
||||
devices.add_url_rule('/tag/', view_func=TagListView.as_view('taglist'))
|
||||
devices.add_url_rule('/tag/add/', view_func=TagAddView.as_view('tag_add'))
|
||||
devices.add_url_rule('/tag/unnamed/add/', view_func=TagAddUnnamedView.as_view('tag_unnamed_add'))
|
||||
devices.add_url_rule('/tag/<string:id>/', view_func=TagDetailView.as_view('tag_details'))
|
||||
devices.add_url_rule('/tag/devices/add/', view_func=TagDeviceAddView.as_view('tag_devices_add'))
|
||||
devices.add_url_rule('/tag/devices/<int:id>/del/', view_func=TagDeviceDeleteView.as_view('tag_devices_del'))
|
||||
devices.add_url_rule('/tag/devices/add/', view_func=TagLinkDeviceView.as_view('tag_devices_add'))
|
||||
devices.add_url_rule('/tag/devices/<int:id>/del/', view_func=TagUnlinkDeviceView.as_view('tag_devices_del'))
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
{% block main %}
|
||||
|
||||
<div class="pagetitle">
|
||||
<h1>{{ title }}</h1>
|
||||
<h1>{{ page_title }}</h1>
|
||||
<nav>
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="index.html">Inventory</a></li>
|
||||
<li class="breadcrumb-item">New Device</li>
|
||||
<li class="breadcrumb-item"><a href="{{ url_for('inventory.devices.devicelist')}}">Inventory</a></li>
|
||||
<li class="breadcrumb-item">{{ page_title }}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
</div><!-- End Page Title -->
|
||||
|
@ -19,7 +19,6 @@
|
|||
<div class="card-body">
|
||||
|
||||
<div class="pt-4 pb-2">
|
||||
<h5 class="card-title text-center pb-0 fs-4">New Device</h5>
|
||||
{% if form.form_errors %}
|
||||
<p class="text-danger">
|
||||
{% for error in form.form_errors %}
|
|
@ -7,8 +7,7 @@
|
|||
<nav>
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="{{ url_for('inventory.devices.devicelist')}}">Inventory</a></li>
|
||||
<li class="breadcrumb-item active">Details device</li>
|
||||
<li class="breadcrumb-item active">{{ device.devicehub_id }}</li>
|
||||
<li class="breadcrumb-item active">{{ page_title }}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
</div><!-- End Page Title -->
|
|
@ -61,13 +61,13 @@
|
|||
<li>
|
||||
<a href="javascript:void()" class="dropdown-item" data-bs-toggle="modal" data-bs-target="#addingLotModal">
|
||||
<i class="bi bi-plus"></i>
|
||||
Adding to a lot
|
||||
Add selected Devices to a lot
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="javascript:void()" class="dropdown-item" data-bs-toggle="modal" data-bs-target="#removeLotModal">
|
||||
<i class="bi bi-x"></i>
|
||||
Removing from a lot
|
||||
Remove selected devices from a lot
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -164,15 +164,8 @@
|
|||
</button>
|
||||
<ul class="dropdown-menu" aria-labelledby="btnExport">
|
||||
<li>
|
||||
<a href="javascript:openAdd()" class="dropdown-item">
|
||||
<i class="bi bi-plus"></i>
|
||||
Añadir dispositivos a lotes
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="javascript:openRemove()" class="dropdown-item">
|
||||
<i class="fa fa-fw fa-minus"></i>
|
||||
Eliminar dispisitvos de lotes
|
||||
<a href="#" class="dropdown-item">
|
||||
TODO: Not implemented
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -187,13 +180,13 @@
|
|||
<li>
|
||||
<a href="javascript:void()" class="dropdown-item" data-bs-toggle="modal" data-bs-target="#addingTagModal">
|
||||
<i class="bi bi-plus"></i>
|
||||
Adding Tag
|
||||
Add Tag to selected Devices
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="javascript:removeTag()" class="dropdown-item">
|
||||
<i class="bi bi-x"></i>
|
||||
Remove Tag
|
||||
Remove Tag from selected Devices
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
<h1>{{ title }}</h1>
|
||||
<nav>
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="index.html">Inventory</a></li>
|
||||
<!-- TODO@slamora replace with lot list URL when exists -->
|
||||
<li class="breadcrumb-item"><a href="#TODO-lot-list">Lots</a></li>
|
||||
<li class="breadcrumb-item">Lot</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
|
|
@ -2,13 +2,10 @@
|
|||
{% block main %}
|
||||
|
||||
<div class="pagetitle">
|
||||
<h1>{{ title }}</h1>
|
||||
<nav>
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="index.html">Inventory</a></li>
|
||||
<li class="breadcrumb-item">Tag</li>
|
||||
<li class="breadcrumb-item">Device</li>
|
||||
<li class="breadcrumb-item">Remove</li>
|
||||
<li class="breadcrumb-item"><a href="{{ url_for('inventory.devices.devicelist')}}">Inventory</a></li>
|
||||
<li class="breadcrumb-item">Unlink Tag from Device</li>
|
||||
</ol>
|
||||
</nav>
|
||||
</div><!-- End Page Title -->
|
||||
|
@ -21,7 +18,7 @@
|
|||
<div class="card-body">
|
||||
|
||||
<div class="pt-4 pb-2">
|
||||
<h5 class="card-title text-center pb-0 fs-4">Unlink tag of device</h5>
|
||||
<h1 class="card-title text-center pb-0 fs-4">Unlink Tag from Device</h1>
|
||||
<p class="text-center small">Please enter a code for the tag.</p>
|
||||
{% if form.form_errors %}
|
||||
<p class="text-danger">
|
|
@ -2,11 +2,11 @@
|
|||
{% block main %}
|
||||
|
||||
<div class="pagetitle">
|
||||
<h1>{{ title }}</h1>
|
||||
<h1>Inventory</h1>
|
||||
<nav>
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="index.html">Inventory</a></li>
|
||||
<li class="breadcrumb-item">Upload Snapshot</li>
|
||||
<li class="breadcrumb-item"><a href="{{ url_for('inventory.devices.devicelist')}}">Inventory</a></li>
|
||||
<li class="breadcrumb-item active">{{ page_title }}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
</div><!-- End Page Title -->
|
||||
|
|
Reference in New Issue