Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Amanda Ghassaei
DMDesign
Commits
40cbc1d0
Commit
40cbc1d0
authored
Sep 10, 2015
by
Amanda Ghassaei
Browse files
properties synced
parent
068abffb
Changes
3
Hide whitespace changes
Inline
Side-by-side
js/SerialMonitor/SerialMonitor.js
View file @
40cbc1d0
...
...
@@ -5,11 +5,13 @@
define
([
'
backbone
'
],
function
(
Backbone
){
return
Backbone
.
Model
.
extend
({
var
SerialMonitor
=
Backbone
.
Model
.
extend
({
defaults
:
{
autoscroll
:
tru
e
autoscroll
:
fals
e
}
});
return
new
SerialMonitor
();
});
\ No newline at end of file
js/SerialMonitor/SerialMonitorView.js
View file @
40cbc1d0
...
...
@@ -11,13 +11,48 @@ define(['jquery', 'underscore', 'commParentMenu', 'serialComm', 'text!SerialMoni
el
:
"
#serialMonitorView
"
,
events
:
{
"
click #clearMonitor
"
:
"
_clear
"
"
click #clearMonitor
"
:
"
_clear
"
,
"
change input:checkbox
"
:
"
_clickCheckbox
"
},
__initialize
:
function
(){
this
.
render
();
},
_clickCheckbox
:
function
(
e
){
e
.
preventDefault
();
var
$target
=
$
(
e
.
target
);
$target
.
blur
();
var
property
=
$target
.
data
(
"
property
"
);
if
(
!
property
)
{
console
.
warn
(
"
no property associated with checkbox input
"
);
return
;
}
this
.
_toggleProperty
(
$target
,
property
);
},
_toggleProperty
:
function
(
$target
,
property
){
//val = !val
var
owner
=
this
.
_getPropertyOwner
(
$target
);
if
(
owner
)
this
.
_setOwnerProperty
(
owner
,
property
,
!
(
this
.
_getOwnerProperty
(
owner
,
property
)));
},
_getPropertyOwner
:
function
(
$target
){
if
(
$target
.
hasClass
(
"
serialMonitor
"
))
return
this
.
model
;
return
null
;
},
_getOwnerProperty
:
function
(
owner
,
property
){
if
(
owner
instanceof
Backbone
.
Model
)
return
owner
.
get
(
property
);
return
owner
[
property
];
},
_setOwnerProperty
:
function
(
owner
,
property
,
value
){
if
(
owner
instanceof
Backbone
.
Model
)
owner
.
set
(
property
,
value
);
else
{
owner
[
property
]
=
value
;
}
},
_makeTemplateJSON
:
function
(){
return
this
.
model
.
toJSON
();
},
...
...
js/SerialMonitor/main.js
View file @
40cbc1d0
...
...
@@ -35,6 +35,6 @@ require.config({
});
require
([
'
serialMonitorView
'
,
'
serialMonitor
'
],
function
(
SerialMonitorView
,
S
erialMonitor
){
new
SerialMonitorView
({
model
:
new
S
erialMonitor
()
});
require
([
'
serialMonitorView
'
,
'
serialMonitor
'
],
function
(
SerialMonitorView
,
s
erialMonitor
){
new
SerialMonitorView
({
model
:
s
erialMonitor
});
});
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment