Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DMDesign
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Amanda Ghassaei
DMDesign
Commits
0ad17853
Commit
0ad17853
authored
9 years ago
by
Amanda Ghassaei
Browse files
Options
Downloads
Patches
Plain Diff
ribbon through require
parent
12e9c1c2
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
js/main.js
+4
-3
4 additions, 3 deletions
js/main.js
js/menus/Ribbon.js
+67
-65
67 additions, 65 deletions
js/menus/Ribbon.js
with
71 additions
and
68 deletions
js/main.js
+
4
−
3
View file @
0ad17853
...
...
@@ -27,6 +27,7 @@ requirejs.config({
//UI
navbar
:
'
menus/Navbar
'
,
navViewMenu
:
'
menus/NavViewMenu
'
,
//view dropdown
ribbon
:
'
menus/Ribbon
'
,
menuWrapper
:
'
menus/MenuWrapperView
'
,
menuParent
:
'
menus/MenuParentView
'
,
latticeMenu
:
'
menus/LatticeMenuView
'
,
...
...
@@ -61,12 +62,12 @@ requirejs.config({
});
//init stuff
requirejs
([
'
appState
'
,
'
lattice
'
,
'
menuWrapper
'
,
'
navbar
'
,
'
threeModel
'
,
'
threeView
'
,
'
analytics
'
,
'
flatUI
'
],
function
(
appState
,
lattice
,
MenuWrapper
,
Navbar
,
three
,
ThreeView
){
requirejs
([
'
appState
'
,
'
lattice
'
,
'
menuWrapper
'
,
'
navbar
'
,
'
ribbon
'
,
'
threeModel
'
,
'
threeView
'
,
'
analytics
'
,
'
flatUI
'
],
function
(
appState
,
lattice
,
MenuWrapper
,
Navbar
,
Ribbon
,
three
,
ThreeView
){
new
MenuWrapper
({
model
:
appState
});
new
Navbar
({
model
:
appState
});
//
new Ribbon({model:appState});
new
Ribbon
({
model
:
appState
});
new
ThreeView
({
model
:
three
});
...
...
This diff is collapsed.
Click to expand it.
js/menus/Ribbon.js
+
67
−
65
View file @
0ad17853
...
...
@@ -2,73 +2,75 @@
* Created by fab on 3/18/15.
*/
Ribbon
=
Backbone
.
View
.
extend
({
el
:
"
#navRibbon
"
,
events
:
{
"
click .ribbonCellMode
"
:
"
_updateCellMode
"
,
"
click .ribbonDeleteMode
"
:
"
_updateDeleteMode
"
,
"
click .highlightMode
"
:
"
_updateHighlightMode
"
,
"
click .cellsVisible
"
:
"
_updateCellVisibility
"
},
initialize
:
function
(){
_
.
bindAll
(
this
,
"
render
"
);
this
.
listenTo
(
this
.
model
,
"
change:ribbonIsVisible
"
,
this
.
_changeVisibility
);
this
.
listenTo
(
this
.
model
,
"
change:cellMode
"
,
this
.
render
);
this
.
listenTo
(
this
.
model
,
"
change:deleteMode
"
,
this
.
render
);
this
.
listenTo
(
this
.
model
,
"
change:highlightMode
"
,
this
.
render
);
this
.
listenTo
(
this
.
model
,
"
change:cellsVisible
"
,
this
.
render
);
this
.
listenTo
(
globals
.
lattice
,
"
change:cellType change:connectionType
"
,
this
.
render
);
this
.
render
();
},
_updateCellMode
:
function
(
e
){
e
.
preventDefault
();
globals
.
appState
.
set
(
"
cellMode
"
,
$
(
e
.
target
).
data
(
"
type
"
));
},
_updateDeleteMode
:
function
(
e
){
e
.
preventDefault
();
globals
.
appState
.
set
(
"
deleteMode
"
,
!
globals
.
appState
.
get
(
"
deleteMode
"
));
},
_updateHighlightMode
:
function
(
e
){
e
.
preventDefault
();
globals
.
appState
.
set
(
"
highlightMode
"
,
!
globals
.
appState
.
get
(
"
highlightMode
"
));
},
_updateCellVisibility
:
function
(
e
){
e
.
preventDefault
();
globals
.
appState
.
set
(
"
cellsVisible
"
,
!
globals
.
appState
.
get
(
"
cellsVisible
"
));
},
_changeVisibility
:
function
(){
var
state
=
this
.
model
.
get
(
"
ribbonIsVisible
"
);
if
(
state
)
this
.
$el
.
show
();
else
this
.
$el
.
hide
();
},
render
:
function
(){
this
.
$el
.
html
(
this
.
template
(
_
.
extend
(
globals
.
lattice
.
toJSON
(),
this
.
model
.
toJSON
(),
globals
.
plist
)));
},
template
:
_
.
template
(
'
\
<div class="btn-toolbar">
\
<div class="btn-group">
\
<a data-type="cell" class="btn btn-primary btn-ribbon ribbonCellMode<% if (cellMode == "cell"){ %> ribbon-selected<% } %>" href="#"><img data-type="cell" src="assets/imgs/cell-sm.png"></a>
\
<% if (allPartTypes[cellType][connectionType]){ %>
\
<a data-type="part" class="btn btn-primary btn-ribbon ribbonCellMode<% if (cellMode == "part"){ %> ribbon-selected<% } %>" href="#"><img data-type="part" src="assets/imgs/part-sm.png"></a>
\
<% } %>
\
<a class="btn btn-primary btn-ribbon ribbonDeleteMode<% if (deleteMode){ %> ribbon-selected"<% } %>"><span class="fui-cross"></span></a>
\
define
([
'
jquery
'
,
'
underscore
'
,
'
backbone
'
,
'
lattice
'
,
'
plist
'
],
function
(
$
,
_
,
Backbone
,
lattice
,
plist
){
return
Backbone
.
View
.
extend
({
el
:
"
#navRibbon
"
,
events
:
{
"
click .ribbonCellMode
"
:
"
_updateCellMode
"
,
"
click .ribbonDeleteMode
"
:
"
_updateDeleteMode
"
,
"
click .highlightMode
"
:
"
_updateHighlightMode
"
,
"
click .cellsVisible
"
:
"
_updateCellVisibility
"
},
initialize
:
function
(){
_
.
bindAll
(
this
,
"
render
"
);
this
.
listenTo
(
this
.
model
,
"
change:ribbonIsVisible
"
,
this
.
_changeVisibility
);
this
.
listenTo
(
this
.
model
,
"
change:cellMode
"
,
this
.
render
);
this
.
listenTo
(
this
.
model
,
"
change:deleteMode
"
,
this
.
render
);
this
.
listenTo
(
this
.
model
,
"
change:highlightMode
"
,
this
.
render
);
this
.
listenTo
(
this
.
model
,
"
change:cellsVisible
"
,
this
.
render
);
this
.
listenTo
(
lattice
,
"
change:cellType change:connectionType
"
,
this
.
render
);
this
.
render
();
},
_updateCellMode
:
function
(
e
){
e
.
preventDefault
();
this
.
model
.
set
(
"
cellMode
"
,
$
(
e
.
target
).
data
(
"
type
"
));
},
_updateDeleteMode
:
function
(
e
){
e
.
preventDefault
();
this
.
model
.
set
(
"
deleteMode
"
,
!
this
.
model
.
get
(
"
deleteMode
"
));
},
_updateHighlightMode
:
function
(
e
){
e
.
preventDefault
();
this
.
model
.
set
(
"
highlightMode
"
,
!
this
.
model
.
get
(
"
highlightMode
"
));
},
_updateCellVisibility
:
function
(
e
){
e
.
preventDefault
();
this
.
model
.
set
(
"
cellsVisible
"
,
!
this
.
model
.
get
(
"
cellsVisible
"
));
},
_changeVisibility
:
function
(){
var
state
=
this
.
model
.
get
(
"
ribbonIsVisible
"
);
if
(
state
)
this
.
$el
.
show
();
else
this
.
$el
.
hide
();
},
render
:
function
(){
this
.
$el
.
html
(
this
.
template
(
_
.
extend
(
lattice
.
toJSON
(),
this
.
model
.
toJSON
(),
plist
)));
},
template
:
_
.
template
(
'
\
<div class="btn-toolbar">
\
<div class="btn-group">
\
<a data-type="cell" class="btn btn-primary btn-ribbon ribbonCellMode<% if (cellMode == "cell"){ %> ribbon-selected<% } %>" href="#"><img data-type="cell" src="assets/imgs/cell-sm.png"></a>
\
<% if (allPartTypes[cellType][connectionType]){ %>
\
<a data-type="part" class="btn btn-primary btn-ribbon ribbonCellMode<% if (cellMode == "part"){ %> ribbon-selected<% } %>" href="#"><img data-type="part" src="assets/imgs/part-sm.png"></a>
\
<% } %>
\
<a class="btn btn-primary btn-ribbon ribbonDeleteMode<% if (deleteMode){ %> ribbon-selected"<% } %>"><span class="fui-cross"></span></a>
\
</div>
\
</div>
\
</div>
\
'
)
'
)
});
});
//<a class="btn btn-primary btn-ribbon highlightMode<% if (highlightMode){ %> ribbon-selected<% } %>" href="#"><img data-type="part" src="assets/imgs/cursor-light.png"></a>\
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment