Ironed out some final details with the device settings page. Began work on device overview page
parent
7cd0cd3163
commit
2502f3d268
|
@ -0,0 +1,8 @@
|
|||
# The overview controller provides an indepth view of a device as well as fine-
|
||||
# grained controll options.
|
||||
|
||||
app = angular.module('FarmBot')
|
||||
|
||||
controller = ($scope, Restangular) ->
|
||||
|
||||
app.controller "OverviewController", ['$scope', 'Restangular', controller]
|
|
@ -1,6 +1,10 @@
|
|||
# The deivce settings controller mostly handles SkyNet configuration options.
|
||||
# If you're storing things related to a particular device and it's not an action
|
||||
# it probably belongs in here.
|
||||
|
||||
app = angular.module('FarmBot')
|
||||
|
||||
controller = ($scope, Restangular, Device) ->
|
||||
controller = ($scope, Restangular) ->
|
||||
$scope.devices = Restangular.all('devices').getList().$object
|
||||
|
||||
$scope.device = {}
|
||||
|
@ -12,24 +16,15 @@ controller = ($scope, Restangular, Device) ->
|
|||
$scope.selectDevice = (device) ->
|
||||
$scope.device = device
|
||||
|
||||
# Since the form is used for creation and editing, we need a way of knowing if
|
||||
# it's new (POST) or old (PUT).
|
||||
$scope.isNew = (device) ->
|
||||
!_.find($scope.devices, $$hash_key: $scope.device.$$hashkey)
|
||||
|
||||
$scope.createDevice = ->
|
||||
if $scope.isNew($scope.device)
|
||||
# How does this even work!? Looks like the wrong order, but it works??
|
||||
if typeof($scope.device._id) != 'undefined'
|
||||
$scope.device.put().then (data) ->
|
||||
$scope.device = {}
|
||||
else
|
||||
$scope.devices.post($scope.device).then (data) ->
|
||||
$scope.devices.push(data)
|
||||
$scope.device = {}
|
||||
else
|
||||
$scope.device.put().then (data) ->
|
||||
$scope.device = {}
|
||||
|
||||
|
||||
app.controller "DeviceController", [
|
||||
'$scope'
|
||||
'Restangular'
|
||||
"DeviceService"
|
||||
controller
|
||||
]
|
||||
app.controller "SettingsController", ['$scope', 'Restangular', controller]
|
|
@ -19,8 +19,11 @@ app.config [
|
|||
$routeProvider.when("/main",
|
||||
templateUrl: "main.html"
|
||||
controller: "MainController"
|
||||
).when("/devices",
|
||||
templateUrl: "devices.html"
|
||||
controller: "DeviceController"
|
||||
).when("/settings",
|
||||
templateUrl: "settings.html"
|
||||
controller: "SettingsController"
|
||||
).when("/overview",
|
||||
templateUrl: "overview.html"
|
||||
controller: "OverviewController"
|
||||
).otherwise redirectTo: "/main"
|
||||
]
|
|
@ -1,9 +0,0 @@
|
|||
app = angular.module("FarmBot")
|
||||
|
||||
deviceService = (Restangular) ->
|
||||
return {}
|
||||
|
||||
app.service "DeviceService", [
|
||||
"Restangular"
|
||||
deviceService
|
||||
]
|
|
@ -1,8 +1,10 @@
|
|||
%div{'ng-app' => 'FarmBot'}
|
||||
// TODO: Write a view helper that traverses /views/dashboard/ng-partials and
|
||||
// includes them here.
|
||||
%script{:id => "devices.html", :type => "text/ng-template"}
|
||||
= render partial: "dashboard/ng-partials/devices"
|
||||
%script{:id => "overview.html", :type => "text/ng-template"}
|
||||
= render partial: "dashboard/ng-partials/overview"
|
||||
%script{:id => "settings.html", :type => "text/ng-template"}
|
||||
= render partial: "dashboard/ng-partials/settings"
|
||||
%script{:id => "main.html", :type => "text/ng-template"}
|
||||
= render partial: "dashboard/ng-partials/main"
|
||||
%div{'ng-view' => true}
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
.row
|
||||
%h1 Manage FarmBot Device Overview
|
||||
%h3 Eventually, this will be the home of device control and metrics. Stay tuned!
|
||||
.row
|
||||
.large-6.columns
|
||||
.panel
|
||||
.container.clearfix
|
||||
.large-4.columns Gantry (X)
|
||||
.large-4.columns
|
||||
%span.label.round.success>
|
||||
%i.fi-plus
|
||||
46
|
||||
%span.label.round.alert
|
||||
%i.fi-minus
|
||||
.large-4.columns Jog to:
|
||||
%br/
|
||||
.container.clearfix
|
||||
.large-4.columns Cross-Slide (Y)
|
||||
.large-4.columns
|
||||
%span.label.round.success>
|
||||
%i.fi-plus
|
||||
46
|
||||
%span.label.round.alert
|
||||
%i.fi-minus
|
||||
.large-4.columns Jog to:
|
||||
%br/
|
||||
.container.clearfix
|
||||
.large-4.columns Tool Mount (Z)
|
||||
.large-4.columns
|
||||
%span.label.round.success>
|
||||
%i.fi-plus
|
||||
46
|
||||
%span.label.round.alert
|
||||
%i.fi-minus
|
||||
.large-4.columns Jog to:
|
||||
%br/
|
||||
%br/
|
||||
%ul.button-group.even-3
|
||||
%li
|
||||
%a.button.small{href: "#"} Jog to Home
|
||||
%li
|
||||
%a.button.small{href: "#"} Calibrate
|
||||
%li
|
||||
%a.button.small.alert{href: "#"} Shutdown
|
||||
.large-6.columns
|
|
@ -1,6 +1,6 @@
|
|||
.row
|
||||
.large-12.columns
|
||||
%h1 Manage FarmBot Device Settings {{ status }}
|
||||
%h1 Manage FarmBot Device Settings
|
||||
%form{ng_submit: 'createDevice()'}
|
||||
%fieldset
|
||||
%legend FarmBot Settings
|
|
@ -19,9 +19,12 @@
|
|||
%ul.left
|
||||
-if current_user
|
||||
%li{class: ("active" if current_page? page_path('dashboard'))}
|
||||
= link_to 'Dashboard', page_path('dashboard')
|
||||
%li{class: ("active" if current_page? page_path('data'))}
|
||||
= link_to 'Data', page_path('data') # TODO: View helper for these items.
|
||||
= link_to 'STUB', page_path('dashboard')
|
||||
%li{class: ("active" if current_page? page_path('#/settings'))}
|
||||
= link_to 'Device Overview', '/dashboard#/overview'
|
||||
// TODO: Add CSS rul based on hash fragment.
|
||||
%li{class: ("active" if current_page? page_path('#/settings'))}
|
||||
= link_to 'Device Settings', '/dashboard#/settings'
|
||||
%li{class: ("active" if current_page? page_path('help'))}
|
||||
= link_to 'Help', page_path('help')
|
||||
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
/ = javascript_include_tag "device_panel"
|
||||
.row{"ng-app" => "FarmBot", "ng-controller" => "DeviceController"}
|
||||
.large-12.columns
|
||||
%h1 Manage FarmBot Device Settings {{ status }}
|
||||
%form
|
||||
%fieldset
|
||||
%legend FarmBot Settings
|
||||
.row
|
||||
.large-12.columns
|
||||
%label Friendly Name
|
||||
%input{placeholder: "Franny the FarmBot", type: "text"}/
|
||||
.row
|
||||
.large-6.columns
|
||||
%label Skynet UUID
|
||||
%input{placeholder: "ad698900-2546-11e3-87fb-c560cb0ca47b", type: "text"}/
|
||||
.large-6.columns
|
||||
%label Skynet Security Token
|
||||
%input{placeholder: "4bbd2jm242dl5wmimbwz4rvlu77m0a4i", type: "text"}/
|
||||
.row
|
||||
.large-12.columns
|
||||
%button.button
|
||||
%i.fi-check{style: 'font-size: 18px;'}
|
||||
Store Settings
|
||||
%table
|
||||
%thead
|
||||
%tr
|
||||
%th{width: '90%'} Friendly Name
|
||||
%th{width: '5%'} Delete
|
||||
%th{width: '5%'} Edit
|
||||
%tbody
|
||||
%tr{'ng-repeat' => 'device in devices'}
|
||||
%td
|
||||
{{ device.name }}
|
||||
%td
|
||||
%button.tiny.alert.button
|
||||
%i.fi-x{style: 'font-size: 18px;'}
|
||||
%td
|
||||
%button.tiny.button
|
||||
%i.fi-wrench{style: 'font-size: 18px;'}
|
Loading…
Reference in New Issue