Base scaffolding of a sequence builder page

pull/104/head
Rick Carlino 2014-12-08 07:16:14 -06:00
parent 42ea4f52f7
commit 9ac49d0027
9 changed files with 119 additions and 64 deletions

2
.gitignore vendored
View File

@ -41,4 +41,4 @@ pickle-email-*.html
.rvmrc
# Ignore application configuration
/config/application.yml
.DS_Store
.DS_Store

Binary file not shown.

View File

@ -0,0 +1,6 @@
# The sequence controller supports the WYSIWYG sequence editor.
angular.module('FarmBot').controller "SequenceController", [
'$scope'
($scope) ->
$scope.hello = 'world'
]

View File

@ -1,70 +1,69 @@
# Used for _CREATION_ of _OUTBOUND_ messages.
angular.module("FarmBot").factory 'Command', [() ->
class Command
create: (type, args = {}) ->
unless Command.all.hasOwnProperty(type)
args = type
type = 'error'
return Command.all[type](args)
class Command
create: (type, args = {}) ->
unless Command.all.hasOwnProperty(type)
args = type
type = 'error'
return Command.all[type](args)
@all:
single_command: (_args) ->
message_type: 'single_command'
time_stamp: Date.now()
@all:
single_command: (_args) ->
message_type: 'single_command'
time_stamp: Date.now()
read_status: (_args) ->
message_type: 'read_status'
time_stamp: Date.now()
read_status: (_args) ->
message_type: 'read_status'
time_stamp: Date.now()
pin_on: (pin_number) ->
message_type: "single_command",
time_stamp: Date.now(),
command:
action: "PIN WRITE",
pin: pin_number,
value1: 1,
mode: 0,
pin_on: (pin_number) ->
message_type: "single_command",
time_stamp: Date.now(),
command:
action: "PIN WRITE",
pin: pin_number,
value1: 1,
mode: 0,
pin_off: (pin_number) ->
message_type: "single_command",
time_stamp: Date.now(),
command:
action: "PIN WRITE",
pin: pin_number,
value1: 0,
mode: 0,
pin_off: (pin_number) ->
message_type: "single_command",
time_stamp: Date.now(),
command:
action: "PIN WRITE",
pin: pin_number,
value1: 0,
mode: 0,
move_abs: (x, y, z) ->
message_type: 'single_command'
time_stamp: new Date()
command:
action: 'MOVE ABSOLUTE'
x: x
y: y
z: z
speed: 100
delay: 0
move_abs: (x, y, z) ->
message_type: 'single_command'
time_stamp: new Date()
command:
action: 'MOVE ABSOLUTE'
x: x
y: y
z: z
speed: 100
delay: 0
error: (nope) ->
msg = "Unknown FarmBot message type #{nope}"
console.warn(msg)
return error: "Unknown message type #{nope}"
error: (nope) ->
msg = "Unknown FarmBot message type #{nope}"
console.warn(msg)
return error: "Unknown message type #{nope}"
# write_parameters: (args) ->
# message_type: 'write_parameters'
# time_stamp: Date.now()
# paramets: args
# write_parameters: (args) ->
# message_type: 'write_parameters'
# time_stamp: Date.now()
# paramets: args
# read_parameters: (_args) ->
# message_type: 'read_parameters'
# time_stamp: Date.now()
# read_parameters: (_args) ->
# message_type: 'read_parameters'
# time_stamp: Date.now()
# read_logs: (_args) ->
# message_type: 'read_logs'
# time_stamp: Date.now()
# read_logs: (_args) ->
# message_type: 'read_logs'
# time_stamp: Date.now()
# crop_schedule_update: (_args) ->
# message_type: 'crop_schedule_update'
# time_stamp: Date.now()
new Command
]
# crop_schedule_update: (_args) ->
# message_type: 'crop_schedule_update'
# time_stamp: Date.now()
angular.module("FarmBot").factory 'Command', [() -> new Command ]

View File

@ -14,5 +14,8 @@ app.config [
).when("/movement",
templateUrl: "movement.html"
controller: "MovementController"
).when("/sequence",
templateUrl: "sequence.html"
controller: "SequenceController"
).otherwise redirectTo: "/movement"
]

View File

@ -30,8 +30,11 @@ class DeviceService
.error(@ajaxError)
create: (device) ->
ok = (data) =>
@current = data # Set new one to current one.
@list.push(data)
@$http.post("api/devices", device)
.success((data) => @list.push(data))
.success(ok)
.error(@ajaxError)
remove: (device) ->

View File

@ -5,5 +5,7 @@
= render partial: "dashboard/ng-partials/movement"
%script{:id => "settings.html", :type => "text/ng-template"}
= render partial: "dashboard/ng-partials/settings"
%script{:id => "sequence.html", :type => "text/ng-template"}
= render partial: "dashboard/ng-partials/sequence"
%div{'ng-view' => true}
loading...

View File

@ -0,0 +1,40 @@
.row.controlPageRow
.large-4.columns
.pricing-table
.title
Basic Operations
.description
These are the most basic operations that FarmBot can execute. Drag them to the right to <strong>BUILD A SEQUENCE</strong> of operations.
.pt-body
Hello, world!
.pricing-table
.title
Saved Sequences
.description
Drag <strong>SAVED SEQUENCES</strong> to the right to <strong>BUILD A SEQUENCE</strong> that is even bigger.
.pt-body
Hello, world!
.large-8.columns
.pricing-table
.title
Build A Sequence
.description
Drag basic operations and / or save sequences into this area to build a sequence.
.pt-body
%form
%label Sequence Name:
%input{type: 'text'}
%select
%option{value: 'stuff'} Stuff
%option{value: 'moar'} Moar!
%input.button{type: 'submit', value: 'Save'}
.pt-body
.pricing-table
.title
Move Relative
.pt-body
%p
Nothing on this page works yet. I'm just building the interface.
.pt-body

View File

@ -18,10 +18,12 @@
%section.top-bar-section
%ul.left
-if current_user
%li{class: ("active" if current_page? page_path('#/settings'))}
= link_to 'Control', '/dashboard#/movement'
%li{class: ("active" if current_page? page_path('#/settings'))}
%li
= link_to 'Controls', '/dashboard#/movement'
%li
= link_to 'Devices', '/dashboard#/settings'
%li
= link_to 'Sequences', '/dashboard#/sequence'
%li{class: ("active" if current_page? page_path('help'))}
= link_to 'Help', page_path('help')
%ul.right