Revision 1933ffd6
b/snf-cyclades-app/synnefo/ui/new_ui/ui/Gruntfile.js | ||
---|---|---|
39 | 39 |
dist: { |
40 | 40 |
files: { |
41 | 41 |
'javascripts/okeanos.js': ['javascripts/okeanos-scripts/common.js', 'javascripts/okeanos-scripts/checkboxes-radiobuttons.js', 'javascripts/okeanos-scripts/wizard.js', 'javascripts/okeanos-scripts/sshkeys-wizard.js'], |
42 |
'javascripts/okeanos-ember.js': ['javascripts/okeanos-ember/app.js', 'javascripts/okeanos-ember/obj.js', 'javascripts/okeanos-ember/ember-all.js'],
|
|
42 |
'javascripts/okeanos-ember.js': ['javascripts/okeanos-ember/app.js', 'javascripts/okeanos-ember/obj.js', 'javascripts/okeanos-ember/routers.js', 'javascripts/okeanos-ember/controllers.js', 'javascripts/okeanos-ember/views.js', 'javascripts/okeanos-ember/components.js'],
|
|
43 | 43 |
} |
44 | 44 |
}, |
45 | 45 |
}, |
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/okeanos-ember.js | ||
---|---|---|
5 | 5 |
LOG_TRANSITIONS: true, // To have Ember write out transition events to the log (it can be helpful to see exactly what is going on with the router) |
6 | 6 |
}); |
7 | 7 |
|
8 |
Synnefo.ApplicationAdapter = DS.FixtureAdapter.extend();;Ember.Inflector.inflector.uncountable('account'); |
|
8 |
Synnefo.ApplicationAdapter = DS.FixtureAdapter.extend();;/* Objects */ |
|
9 |
|
|
10 |
Ember.Inflector.inflector.uncountable('account'); |
|
9 | 11 |
|
10 | 12 |
Synnefo.Account = DS.Model.extend({ |
11 | 13 |
email: DS.attr('string') |
... | ... | |
188 | 190 |
action: 'is this a function?' |
189 | 191 |
}] |
190 | 192 |
}; |
191 |
;/* Mapping */ |
|
193 |
|
|
194 |
Synnefo.wizards = { |
|
195 |
vmWizard: { |
|
196 |
// each step must have a headline |
|
197 |
stepsHeadlines: [ |
|
198 |
{ |
|
199 |
title:'Select an OS', |
|
200 |
subtitle:'Choose your preferred image' |
|
201 |
}, |
|
202 |
{ |
|
203 |
title:'Select CPUs, RAM and Disk Size', |
|
204 |
subtitle:'Available options are filtered based on the selected image' |
|
205 |
}, |
|
206 |
{ |
|
207 |
title:'Virtual machine custom options', |
|
208 |
subtitle:'tba' |
|
209 |
}, |
|
210 |
{ |
|
211 |
title:'Confirm your settings', |
|
212 |
subtitle:'Confirm that the options you have selected are correct' |
|
213 |
}, |
|
214 |
], |
|
215 |
stepsContent: ['step-1', 'step-2', 'step-3', 'step-4'] |
|
216 |
}, |
|
217 |
networkWizard: {} |
|
218 |
};/* Mapping */ |
|
192 | 219 |
|
193 | 220 |
Synnefo.Router.map(function() { |
194 | 221 |
// I defined the above resource to extend its Route |
... | ... | |
214 | 241 |
}, |
215 | 242 |
}); |
216 | 243 |
|
244 |
|
|
245 |
/* Items Routes */ |
|
246 |
|
|
217 | 247 |
Synnefo.SectionsRoute = Ember.Route.extend({ |
218 | 248 |
modelName: undefined, |
219 | 249 |
model: function() { |
... | ... | |
230 | 260 |
} |
231 | 261 |
}); |
232 | 262 |
|
233 |
Synnefo.CreateRoute = Ember.Route.extend({ |
|
234 |
model: function(){ |
|
235 |
return {name: 'vm-wizard'} |
|
236 |
}, |
|
237 |
renderTemplate: function(controller) { |
|
238 |
this.render('wizard',{controller: controller}); |
|
239 |
} |
|
240 |
}); |
|
241 | 263 |
|
242 | 264 |
Synnefo.VmsRoute = Synnefo.SectionsRoute.extend({ |
243 | 265 |
modelName: 'vm' |
... | ... | |
259 | 281 |
modelName: 'userImage' |
260 | 282 |
}); |
261 | 283 |
|
262 |
Synnefo.VmsCreateRoute = Synnefo.CreateRoute.extend({}); |
|
263 |
|
|
264 |
Synnefo.NetworksCreateRoute = Synnefo.CreateRoute.extend({}); |
|
265 | 284 |
|
266 |
Synnefo.VolumesCreateRoute = Synnefo.CreateRoute.extend({});
|
|
285 |
/* Wizards Routes */
|
|
267 | 286 |
|
268 |
Synnefo.SnapshotsCreateRoute = Synnefo.CreateRoute.extend({}); |
|
287 |
Synnefo.CreateRoute = Ember.Route.extend({ |
|
288 |
model: function(){ |
|
289 |
return [{name: 'vm-wizard'}] |
|
290 |
}, |
|
291 |
renderTemplate: function(controller) { |
|
292 |
this.render('wizard',{controller: controller}); |
|
293 |
}, |
|
294 |
/* beforeModel: function() { |
|
295 |
this._super(); |
|
296 |
console.log('beforeModel ',this.get('router.url')) |
|
297 |
this.previousRoute = this.get('router.url'); // should return the current path but some times it returns the path where the user was before (when i dont type the url of the wizard) |
|
298 |
}, |
|
299 |
previousRoute: undefined,*/ |
|
300 |
actions: { |
|
301 |
closeWizard: function() { |
|
302 |
history.back(); |
|
303 |
} |
|
304 |
} |
|
305 |
}); |
|
269 | 306 |
|
270 |
Synnefo.ImagesCreateRoute = Synnefo.CreateRoute.extend({}); |
|
307 |
Synnefo.VmsCreateRoute = Synnefo.CreateRoute.extend({ |
|
308 |
model: function() { |
|
309 |
return Synnefo.wizards.vmWizard; |
|
310 |
} |
|
311 |
}); |
|
271 | 312 |
|
313 |
Synnefo.NetworksCreateRoute = Synnefo.CreateRoute.extend(); |
|
272 | 314 |
|
315 |
Synnefo.VolumesCreateRoute = Synnefo.CreateRoute.extend(); |
|
273 | 316 |
|
317 |
Synnefo.SnapshotsCreateRoute = Synnefo.CreateRoute.extend(); |
|
274 | 318 |
|
275 |
/* Controllers */ |
|
319 |
Synnefo.ImagesCreateRoute = Synnefo.CreateRoute.extend({});;/* Controllers */
|
|
276 | 320 |
|
277 | 321 |
Synnefo.ApplicationController = Ember.Controller.extend({ |
278 | 322 |
updateCurrentPath: function() { |
... | ... | |
291 | 335 |
}); |
292 | 336 |
|
293 | 337 |
|
338 |
/* Items Controllers */ |
|
294 | 339 |
|
295 | 340 |
Synnefo.ElemsController = Ember.ArrayController.extend({ |
296 | 341 |
type: undefined, |
... | ... | |
303 | 348 |
return Synnefo.conf.sectors.findBy('destination', this.get('type')).icon.replace('outline', 'full'); |
304 | 349 |
}.property(), |
305 | 350 |
hasOS: function(){ |
306 |
if(Synnefo.get('currentPath') == "vms")
|
|
351 |
if(Synnefo.get('currentPath') === "vms" || Synnefo.get('currentPath') === "vms.index")
|
|
307 | 352 |
return true; |
308 | 353 |
else return false; |
309 | 354 |
}.property(), |
310 | 355 |
hasTags: function(){ |
311 |
if(Synnefo.get('currentPath') == "vms") |
|
356 |
if(Synnefo.get('currentPath') == "vms" || Synnefo.get('currentPath') === "vms.index")
|
|
312 | 357 |
return true; |
313 | 358 |
else return false; |
314 | 359 |
}.property(), |
... | ... | |
337 | 382 |
}); |
338 | 383 |
|
339 | 384 |
|
385 |
/* Controllers for each Item */ |
|
340 | 386 |
|
341 | 387 |
Synnefo.ElemController = Ember.ObjectController.extend({ |
342 | 388 |
needs: [], |
... | ... | |
382 | 428 |
}); |
383 | 429 |
|
384 | 430 |
|
385 |
/* Views */ |
|
431 |
/* Controllers for Wizards */ |
|
432 |
|
|
433 |
Synnefo.CreateController = Ember.ObjectController.extend({ |
|
434 |
currentStep: undefined, |
|
435 |
|
|
436 |
totalStep: function() { |
|
437 |
return this.get('stepsContent').length; |
|
438 |
}.property(), |
|
439 |
|
|
440 |
init: function() { |
|
441 |
this._super(); |
|
442 |
this.set('currentStep', 1) |
|
443 |
}, |
|
444 |
btnLeftLabel: function(){ |
|
445 |
return (this.get('currentStep') === 1)?'CANCEL':'PREVIOUS'; |
|
446 |
}.property('currentStep'), |
|
447 |
|
|
448 |
btnRightLabel: function(){ |
|
449 |
return (this.get('currentStep') === this.get('totalStep'))?'CREATE':'NEXT'; |
|
450 |
}.property('currentStep'), |
|
451 |
|
|
452 |
actions: { |
|
453 |
moveNext: function() { |
|
454 |
var self = this; |
|
455 |
var step = this.get('currentStep'); |
|
456 |
|
|
457 |
if(step!== this.get('totalStep')) { |
|
458 |
step++; |
|
459 |
this.set('currentStep', step); |
|
460 |
} |
|
461 |
else |
|
462 |
this.get('target').send('closeWizard'); |
|
463 |
}, |
|
464 |
moveBack: function() { |
|
465 |
var step = this.get('currentStep'); |
|
466 |
|
|
467 |
if(step === 1) { |
|
468 |
this.get('target').send('closeWizard'); |
|
469 |
} |
|
470 |
else { |
|
471 |
step--; |
|
472 |
this.set('currentStep', step); |
|
473 |
} |
|
474 |
} |
|
475 |
}, |
|
476 |
}); |
|
477 |
|
|
478 |
Synnefo.VmsCreateController =Synnefo.CreateController.extend({ |
|
479 |
|
|
480 |
});; /* Views */ |
|
481 |
|
|
482 |
Synnefo.ApplicationView = Ember.View.extend({ |
|
483 |
classNames: ['content'] |
|
484 |
}); |
|
485 |
|
|
486 |
|
|
487 |
/* Navigation Menu */ |
|
386 | 488 |
|
387 | 489 |
Synnefo.NavIconView = Ember.View.extend({ |
388 | 490 |
tagName: 'span', |
389 |
click: function(e) {
|
|
491 |
click: function() { |
|
390 | 492 |
var parentEl = this.$().parent('a'); |
391 | 493 |
var currentEl = this.$().parents('li').siblings('li').find('a.current'); |
392 | 494 |
|
... | ... | |
407 | 509 |
}); |
408 | 510 |
|
409 | 511 |
|
512 |
/* Items Parts */ |
|
513 |
|
|
410 | 514 |
Synnefo.ElemView = Ember.View.extend({ |
411 | 515 |
// templateName: 'elem', |
412 | 516 |
addNewBtn: false, |
... | ... | |
450 | 554 |
Synnefo.ImmediateActionView = Ember.View.extend({ |
451 | 555 |
templateName: 'actions', |
452 | 556 |
classNames: ['actions'] |
453 |
}) |
|
557 |
}); |
|
558 |
|
|
559 |
|
|
560 |
/* Wizard */ |
|
561 |
|
|
562 |
Synnefo.WizardHeadersView = Ember.CollectionView.extend({ |
|
563 |
tagName: 'ul', |
|
564 |
classNames:['nums'], |
|
565 |
content: Synnefo.wizards.vmWizard.stepsHeadlines, |
|
566 |
counter: 0, |
|
567 |
setCurrentHeader: function() { |
|
568 |
step = this.get('controller').get('currentStep'); |
|
569 |
console.log('* step', step); |
|
570 |
return step; |
|
571 |
}.property('controller.currentStep'), |
|
572 |
didInsertElement: function() { |
|
573 |
console.log('collecton inserted'); |
|
574 |
this.setCurrentHeader; |
|
575 |
}, |
|
576 |
itemViewClass: Ember.View.extend({ |
|
577 |
templateName: 'wizardStepHeader', |
|
578 |
classNameBindings: ['isCurrent:current::', 'isFirst:preselected', 'isPast:past::'], |
|
579 |
index: undefined, |
|
580 |
isCurrent: false, |
|
581 |
isFirst: false, |
|
582 |
init: function() { |
|
583 |
this._super(); |
|
584 |
console.log('init'); |
|
585 |
var prevIndex = this.get('parentView').get('counter'); |
|
586 |
prevIndex++; |
|
587 |
console.log('prevIndex', prevIndex) |
|
588 |
this.get('parentView').set('counter', prevIndex); |
|
589 |
this.set('index', prevIndex); |
|
590 |
if(prevIndex === 1) { |
|
591 |
this.set('isFirst', true); |
|
592 |
// this.set('isCurrent', true); |
|
593 |
} |
|
594 |
console.log('current', this.isVisible) |
|
595 |
}, |
|
596 |
isCurrent: function() { |
|
597 |
return this.index === this.get('controller').get('currentStep'); |
|
598 |
}.property('controller.currentStep'), |
|
599 |
|
|
600 |
isPast: function() { |
|
601 |
return this.index < this.get('controller').get('currentStep'); |
|
602 |
}.property('controller.currentStep'), |
|
603 |
|
|
604 |
didInsertElement: function() { |
|
605 |
} |
|
606 |
}), |
|
607 |
}); |
|
454 | 608 |
|
455 |
/* Components */ |
|
609 |
// The only buttons that are views are the buttons that move the wizard |
|
610 |
// The reason is that they shouldn't be isolated from the surrounding |
|
611 |
// (Their labels changes depanding the current step) |
|
612 |
Synnefo.WizardBtnBackView = Ember.View.extend({ |
|
613 |
classNames: ['nav', 'prev'], |
|
614 |
tagName: 'a', |
|
615 |
templateName: 'components/btns-span', |
|
616 |
content: function(){ |
|
617 |
return this.get('controller').get('btnLeftLabel'); |
|
618 |
}.property('controller.btnLeftLabel'), |
|
619 |
click: function() { |
|
620 |
this.get('controller').send('moveBack'); |
|
621 |
} |
|
622 |
}); |
|
623 |
|
|
624 |
Synnefo.WizardBtnNextView = Ember.View.extend({ |
|
625 |
classNames: ['nav', 'next'], |
|
626 |
tagName: 'a', |
|
627 |
templateName: 'components/btns-span', |
|
628 |
content: function(){ |
|
629 |
return this.get('controller').get('btnRightLabel'); |
|
630 |
}.property('controller.btnRightLabel'), |
|
631 |
click: function() { |
|
632 |
this.get('controller').send('moveNext'); |
|
633 |
} |
|
634 |
}); |
|
635 |
|
|
636 |
;/* Components */ |
|
456 | 637 |
|
457 | 638 |
Synnefo.Btn1Component = Ember.Component.extend({ |
458 | 639 |
tagName: 'a', |
459 | 640 |
click: function() { |
460 | 641 |
this.sendAction("action", this.get('param')); |
642 |
}, |
|
643 |
content: undefined // will be set if we want to print a message inside the span |
|
644 |
}); |
|
645 |
|
|
646 |
Synnefo.BtnsSpanComponent = Ember.Component.extend({ |
|
647 |
tagName: 'a', |
|
648 |
templateName: 'components/btns-span', |
|
649 |
click: function() { |
|
650 |
this.sendAction("action"); |
|
461 | 651 |
} |
462 | 652 |
}); |
463 | 653 |
|
654 |
|
|
655 |
/* Wizard Buttons */ |
|
656 |
|
|
657 |
Synnefo.Close1Component = Synnefo.BtnsSpanComponent.extend({ |
|
658 |
classNames: ['close'], |
|
659 |
spanClass: 'snf-close' // has to be modified to array of strings |
|
660 |
}); |
|
661 |
// there's another close icon to confirm/info modals |
|
662 |
|
|
663 |
|
|
664 |
/* |
|
665 |
|
|
666 |
Back and Next buttons are constructed as views and not as components |
|
667 |
|
|
668 |
{{cancel-1 action="moveBack" step=currentStep minStep=1}} |
|
669 |
{{next-1 action="moveNext" step=currentStep maxStep=totalStep}} |
|
670 |
|
|
671 |
Synnefo.Cancel1Component = Synnefo.BtnsSpanComponent.extend({ |
|
672 |
// classNameBindings: ['el3'], the element that should be focused when the user goes to the next step |
|
673 |
content: 'CANCEL', |
|
674 |
click: function(){ |
|
675 |
var currentStep =this.get('step'); |
|
676 |
var minStep =this.get('minStep'); |
|
677 |
console.log('minStep ', minStep); |
|
678 |
this.sendAction(); |
|
679 |
if(currentStep === minStep) |
|
680 |
this.set('content', 'CANCEL'); |
|
681 |
else |
|
682 |
this.set('content', 'PREVIOUS'); |
|
683 |
|
|
684 |
} |
|
685 |
}); |
|
686 |
|
|
687 |
Synnefo.Next1Component = Synnefo.BtnsSpanComponent.extend({ |
|
688 |
classNames: ['nav', 'next'], |
|
689 |
// classNameBindings: ['el3'], the element that should be focused when the user goes to the next step |
|
690 |
content: 'NEXT', |
|
691 |
click: function() { |
|
692 |
var currentStep =this.get('step'); |
|
693 |
var maxStep =this.get('maxStep'); |
|
694 |
this.sendAction('action'); |
|
695 |
if(currentStep === maxStep) |
|
696 |
this.set('content', 'CREATE'); |
|
697 |
else |
|
698 |
this.set('content', 'NEXT'); |
|
699 |
} |
|
700 |
}); */ |
|
701 |
|
|
702 |
|
|
703 |
/* Add New Item */ |
|
704 |
|
|
464 | 705 |
Synnefo.AddNewComponent = Ember.Component.extend({ |
465 | 706 |
templateName: 'snfElem', |
466 | 707 |
addNewBtn: true, |
... | ... | |
503 | 744 |
} |
504 | 745 |
}); |
505 | 746 |
|
747 |
|
|
748 |
/* Login Menu */ |
|
749 |
|
|
506 | 750 |
Synnefo.LoginMenuComponent = Ember.Component.extend({ |
507 | 751 |
classNames: ['login'], |
508 | 752 |
didInsertElement: function() { |
... | ... | |
517 | 761 |
} |
518 | 762 |
}); |
519 | 763 |
|
764 |
|
|
765 |
/* Checkboxes and Radiobuttons */ |
|
766 |
|
|
520 | 767 |
Synnefo.SnfCheckboxComponent = Ember.Component.extend({ |
521 | 768 |
tagName: 'a', |
522 | 769 |
classNames: ['check'], |
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/okeanos-ember/components.js | ||
---|---|---|
1 |
/* Components */ |
|
2 |
|
|
3 |
Synnefo.Btn1Component = Ember.Component.extend({ |
|
4 |
tagName: 'a', |
|
5 |
click: function() { |
|
6 |
this.sendAction("action", this.get('param')); |
|
7 |
}, |
|
8 |
content: undefined // will be set if we want to print a message inside the span |
|
9 |
}); |
|
10 |
|
|
11 |
Synnefo.BtnsSpanComponent = Ember.Component.extend({ |
|
12 |
tagName: 'a', |
|
13 |
templateName: 'components/btns-span', |
|
14 |
click: function() { |
|
15 |
this.sendAction("action"); |
|
16 |
} |
|
17 |
}); |
|
18 |
|
|
19 |
|
|
20 |
/* Wizard Buttons */ |
|
21 |
|
|
22 |
Synnefo.Close1Component = Synnefo.BtnsSpanComponent.extend({ |
|
23 |
classNames: ['close'], |
|
24 |
spanClass: 'snf-close' // has to be modified to array of strings |
|
25 |
}); |
|
26 |
// there's another close icon to confirm/info modals |
|
27 |
|
|
28 |
|
|
29 |
/* |
|
30 |
|
|
31 |
Back and Next buttons are constructed as views and not as components |
|
32 |
|
|
33 |
{{cancel-1 action="moveBack" step=currentStep minStep=1}} |
|
34 |
{{next-1 action="moveNext" step=currentStep maxStep=totalStep}} |
|
35 |
|
|
36 |
Synnefo.Cancel1Component = Synnefo.BtnsSpanComponent.extend({ |
|
37 |
// classNameBindings: ['el3'], the element that should be focused when the user goes to the next step |
|
38 |
content: 'CANCEL', |
|
39 |
click: function(){ |
|
40 |
var currentStep =this.get('step'); |
|
41 |
var minStep =this.get('minStep'); |
|
42 |
console.log('minStep ', minStep); |
|
43 |
this.sendAction(); |
|
44 |
if(currentStep === minStep) |
|
45 |
this.set('content', 'CANCEL'); |
|
46 |
else |
|
47 |
this.set('content', 'PREVIOUS'); |
|
48 |
|
|
49 |
} |
|
50 |
}); |
|
51 |
|
|
52 |
Synnefo.Next1Component = Synnefo.BtnsSpanComponent.extend({ |
|
53 |
classNames: ['nav', 'next'], |
|
54 |
// classNameBindings: ['el3'], the element that should be focused when the user goes to the next step |
|
55 |
content: 'NEXT', |
|
56 |
click: function() { |
|
57 |
var currentStep =this.get('step'); |
|
58 |
var maxStep =this.get('maxStep'); |
|
59 |
this.sendAction('action'); |
|
60 |
if(currentStep === maxStep) |
|
61 |
this.set('content', 'CREATE'); |
|
62 |
else |
|
63 |
this.set('content', 'NEXT'); |
|
64 |
} |
|
65 |
}); */ |
|
66 |
|
|
67 |
|
|
68 |
/* Add New Item */ |
|
69 |
|
|
70 |
Synnefo.AddNewComponent = Ember.Component.extend({ |
|
71 |
templateName: 'snfElem', |
|
72 |
addNewBtn: true, |
|
73 |
selectable: false, |
|
74 |
icon: function() { |
|
75 |
baseIcon = Synnefo.conf.sectors.findBy('destination', this.get('type')).icon; |
|
76 |
return baseIcon.replace('outline', 'create-full'); |
|
77 |
}.property(), |
|
78 |
tagName: 'li', |
|
79 |
status: 'add-new', |
|
80 |
classNameBindings: ['status'], |
|
81 |
attributeBindings: ['data-status, data-reveal-id'], |
|
82 |
'data-reveal-id': function(){ |
|
83 |
if(addNewBtn) |
|
84 |
return /*this.get('type').substring(0, type.length - 1)+*/'-wizard'; |
|
85 |
else |
|
86 |
return undefined; |
|
87 |
}.property(), |
|
88 |
'data-status': function() { |
|
89 |
return this.status; |
|
90 |
}.property(), |
|
91 |
name: function() { |
|
92 |
var msg = 'Create New '; |
|
93 |
var btnType = this.get('type') |
|
94 |
switch(btnType){ |
|
95 |
case 'vms': |
|
96 |
return msg + 'Machine'; |
|
97 |
case 'networks': |
|
98 |
return msg + 'Network'; |
|
99 |
case 'volumes': |
|
100 |
return msg + 'Volume'; |
|
101 |
case 'snapshots': |
|
102 |
return msg + 'Snapshot'; |
|
103 |
case 'images': |
|
104 |
return '+ Upload New Image'; |
|
105 |
} |
|
106 |
}.property(), |
|
107 |
click: function () { |
|
108 |
this.sendAction('action'); |
|
109 |
} |
|
110 |
}); |
|
111 |
|
|
112 |
|
|
113 |
/* Login Menu */ |
|
114 |
|
|
115 |
Synnefo.LoginMenuComponent = Ember.Component.extend({ |
|
116 |
classNames: ['login'], |
|
117 |
didInsertElement: function() { |
|
118 |
var self = this.$(); |
|
119 |
self.mouseenter(function(e){ |
|
120 |
self.find('ul').stop(true, true).slideDown(200); |
|
121 |
}); |
|
122 |
self.mouseleave(function(e){ |
|
123 |
self.find('ul').stop(true, true).slideUp(200); |
|
124 |
}); |
|
125 |
|
|
126 |
} |
|
127 |
}); |
|
128 |
|
|
129 |
|
|
130 |
/* Checkboxes and Radiobuttons */ |
|
131 |
|
|
132 |
Synnefo.SnfCheckboxComponent = Ember.Component.extend({ |
|
133 |
tagName: 'a', |
|
134 |
classNames: ['check'], |
|
135 |
templateName: 'components/select-btn', |
|
136 |
initState: function() { |
|
137 |
return this.get('initState'); |
|
138 |
}.property(), |
|
139 |
didInsertElement: function() { |
|
140 |
var el = this.$(); |
|
141 |
var self =this; |
|
142 |
this.setInitClasses(); |
|
143 |
el.click(function(e) { |
|
144 |
e.preventDefault(); |
|
145 |
e.stopPropagation(); |
|
146 |
self.changeState(el); |
|
147 |
// ui.entitiesActionsEnabled(); |
|
148 |
}); |
|
149 |
}, |
|
150 |
setInitClasses: function() { |
|
151 |
var self =this.$(); |
|
152 |
switch(this.initState){ |
|
153 |
case 'unchecked': { |
|
154 |
this.uncheck(self); |
|
155 |
break; |
|
156 |
} |
|
157 |
case 'prechecked': { |
|
158 |
self.find('span').addClass('prechecked') |
|
159 |
this.check(self); |
|
160 |
break; |
|
161 |
} |
|
162 |
} |
|
163 |
}, |
|
164 |
// used to be in ui.checkbox |
|
165 |
changeState : function(checkbox_link) { |
|
166 |
$(checkbox_link).find('.snf-checkbox-unchecked, .snf-checkbox-checked').toggleClass('snf-checkbox-unchecked snf-checkbox-checked'); |
|
167 |
$(checkbox_link).closest('li').toggleClass('selected'); |
|
168 |
}, |
|
169 |
check : function(checkbox_link) { |
|
170 |
$(checkbox_link).find('span').removeClass('snf-checkbox-unchecked').addClass('snf-checkbox-checked'); |
|
171 |
$(checkbox_link).closest('li').addClass('selected'); |
|
172 |
}, |
|
173 |
uncheck : function(checkbox_link) { |
|
174 |
$(checkbox_link).find('span').removeClass('snf-checkbox-checked').addClass('snf-checkbox-unchecked'); |
|
175 |
$(checkbox_link).closest('li').removeClass('selected'); |
|
176 |
}, |
|
177 |
|
|
178 |
reset: function(area) { |
|
179 |
$(area).find('.snf-radio-checked').not('.prechecked').toggleClass('snf-radio-checked snf-radio-unchecked'); |
|
180 |
$(area).find('.snf-radio-unchecked.prechecked').toggleClass('snf-radio-checked snf-radio-unchecked'); |
|
181 |
}, |
|
182 |
}); |
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/okeanos-ember/controllers.js | ||
---|---|---|
1 |
/* Controllers */ |
|
2 |
|
|
3 |
Synnefo.ApplicationController = Ember.Controller.extend({ |
|
4 |
updateCurrentPath: function() { |
|
5 |
// we need the set because ElemsController gets the value of current path in every transition |
|
6 |
Synnefo.set('currentPath', this.get('currentPath')) |
|
7 |
return this.get('currentPath'); |
|
8 |
}.observes('currentPath'), |
|
9 |
|
|
10 |
pageTitle : function() { |
|
11 |
var currentPath =this.get('currentPath'); |
|
12 |
if(currentPath!== 'index') return Synnefo.conf.sectors.findBy('destination', this.get('currentPath')).title; |
|
13 |
else return 'Home'; |
|
14 |
}.property('currentPath'), |
|
15 |
|
|
16 |
// name: "okeanos application", |
|
17 |
}); |
|
18 |
|
|
19 |
|
|
20 |
/* Items Controllers */ |
|
21 |
|
|
22 |
Synnefo.ElemsController = Ember.ArrayController.extend({ |
|
23 |
type: undefined, |
|
24 |
itemController: function(){ |
|
25 |
var type = this.type; |
|
26 |
return type.substring(0, type.length - 1); |
|
27 |
}.property(), |
|
28 |
icon: function() { |
|
29 |
// should this be placed in ElemsView? |
|
30 |
return Synnefo.conf.sectors.findBy('destination', this.get('type')).icon.replace('outline', 'full'); |
|
31 |
}.property(), |
|
32 |
hasOS: function(){ |
|
33 |
if(Synnefo.get('currentPath') === "vms" || Synnefo.get('currentPath') === "vms.index") |
|
34 |
return true; |
|
35 |
else return false; |
|
36 |
}.property(), |
|
37 |
hasTags: function(){ |
|
38 |
if(Synnefo.get('currentPath') == "vms" || Synnefo.get('currentPath') === "vms.index") |
|
39 |
return true; |
|
40 |
else return false; |
|
41 |
}.property(), |
|
42 |
}); |
|
43 |
|
|
44 |
Synnefo.VmsController = Synnefo.ElemsController.extend({ |
|
45 |
type: 'vms' |
|
46 |
}); |
|
47 |
|
|
48 |
|
|
49 |
Synnefo.NetworksController = Synnefo.ElemsController.extend({ |
|
50 |
type: 'networks' |
|
51 |
}); |
|
52 |
|
|
53 |
Synnefo.VolumesController = Synnefo.ElemsController.extend({ |
|
54 |
type: 'volumes' |
|
55 |
}); |
|
56 |
|
|
57 |
|
|
58 |
Synnefo.SnapshotsController = Synnefo.ElemsController.extend({ |
|
59 |
type: 'snapshots' |
|
60 |
}); |
|
61 |
|
|
62 |
Synnefo.ImagesController = Synnefo.ElemsController.extend({ |
|
63 |
type: 'images' |
|
64 |
}); |
|
65 |
|
|
66 |
|
|
67 |
/* Controllers for each Item */ |
|
68 |
|
|
69 |
Synnefo.ElemController = Ember.ObjectController.extend({ |
|
70 |
needs: [], |
|
71 |
actionsList: Synnefo.conf.userActions, |
|
72 |
setAvailableActions: function() { |
|
73 |
var parent = this.needs; |
|
74 |
var self = this; |
|
75 |
return this.actionsList.filter(function(el) { |
|
76 |
return _.contains(el['snf-components'], self.get('controllers.'+parent).type) &&( _.contains(el['enabled-status'], self.get('model.status')) || _.contains(el['enabled-status'], 'all')); |
|
77 |
}) |
|
78 |
}.property(), |
|
79 |
createBtn: false, |
|
80 |
actions: { |
|
81 |
shutdown: function(param) { |
|
82 |
this.set('model.status', 'shutting'); |
|
83 |
}, |
|
84 |
destroyElement: function(param) { |
|
85 |
var element = this.get('model'); |
|
86 |
element.deleteRecord(); |
|
87 |
element.save(); |
|
88 |
} |
|
89 |
} |
|
90 |
}); |
|
91 |
|
|
92 |
Synnefo.VmController = Synnefo.ElemController.extend({ |
|
93 |
needs: ['vms'] |
|
94 |
}); |
|
95 |
|
|
96 |
Synnefo.NetworkController = Synnefo.ElemController.extend({ |
|
97 |
needs: ['networks'] |
|
98 |
}); |
|
99 |
|
|
100 |
Synnefo.VolumeController = Synnefo.ElemController.extend({ |
|
101 |
needs: ['volumes'] |
|
102 |
}); |
|
103 |
|
|
104 |
Synnefo.SnapshotController = Synnefo.ElemController.extend({ |
|
105 |
needs: ['snapshots'] |
|
106 |
}); |
|
107 |
|
|
108 |
Synnefo.ImageController = Synnefo.ElemController.extend({ |
|
109 |
needs: ['images'] |
|
110 |
}); |
|
111 |
|
|
112 |
|
|
113 |
/* Controllers for Wizards */ |
|
114 |
|
|
115 |
Synnefo.CreateController = Ember.ObjectController.extend({ |
|
116 |
currentStep: undefined, |
|
117 |
|
|
118 |
totalStep: function() { |
|
119 |
return this.get('stepsContent').length; |
|
120 |
}.property(), |
|
121 |
|
|
122 |
init: function() { |
|
123 |
this._super(); |
|
124 |
this.set('currentStep', 1) |
|
125 |
}, |
|
126 |
btnLeftLabel: function(){ |
|
127 |
return (this.get('currentStep') === 1)?'CANCEL':'PREVIOUS'; |
|
128 |
}.property('currentStep'), |
|
129 |
|
|
130 |
btnRightLabel: function(){ |
|
131 |
return (this.get('currentStep') === this.get('totalStep'))?'CREATE':'NEXT'; |
|
132 |
}.property('currentStep'), |
|
133 |
|
|
134 |
actions: { |
|
135 |
moveNext: function() { |
|
136 |
var self = this; |
|
137 |
var step = this.get('currentStep'); |
|
138 |
|
|
139 |
if(step!== this.get('totalStep')) { |
|
140 |
step++; |
|
141 |
this.set('currentStep', step); |
|
142 |
} |
|
143 |
else |
|
144 |
this.get('target').send('closeWizard'); |
|
145 |
}, |
|
146 |
moveBack: function() { |
|
147 |
var step = this.get('currentStep'); |
|
148 |
|
|
149 |
if(step === 1) { |
|
150 |
this.get('target').send('closeWizard'); |
|
151 |
} |
|
152 |
else { |
|
153 |
step--; |
|
154 |
this.set('currentStep', step); |
|
155 |
} |
|
156 |
} |
|
157 |
}, |
|
158 |
}); |
|
159 |
|
|
160 |
Synnefo.VmsCreateController =Synnefo.CreateController.extend({ |
|
161 |
|
|
162 |
}); |
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/okeanos-ember/ember-all.js | ||
---|---|---|
42 | 42 |
|
43 | 43 |
Synnefo.CreateRoute = Ember.Route.extend({ |
44 | 44 |
model: function(){ |
45 |
return {name: 'vm-wizard'}
|
|
45 |
return [{name: 'vm-wizard'}]
|
|
46 | 46 |
}, |
47 | 47 |
renderTemplate: function(controller) { |
48 | 48 |
this.render('wizard',{controller: controller}); |
49 |
}, |
|
50 |
/* beforeModel: function() { |
|
51 |
this._super(); |
|
52 |
console.log('beforeModel ',this.get('router.url')) |
|
53 |
this.previousRoute = this.get('router.url'); // should return the current path but some times it returns the path where the user was before (when i dont type the url of the wizard) |
|
54 |
}, |
|
55 |
previousRoute: undefined,*/ |
|
56 |
actions: { |
|
57 |
closeWizard: function() { |
|
58 |
history.back(); |
|
59 |
} |
|
49 | 60 |
} |
50 | 61 |
}); |
51 | 62 |
|
... | ... | |
69 | 80 |
modelName: 'userImage' |
70 | 81 |
}); |
71 | 82 |
|
72 |
Synnefo.VmsCreateRoute = Synnefo.CreateRoute.extend({}); |
|
83 |
Synnefo.VmsCreateRoute = Synnefo.CreateRoute.extend({ |
|
84 |
model: function() { |
|
85 |
return Synnefo.conf.wizards.findBy('name', 'vm-wizard').data; |
|
86 |
} |
|
87 |
}); |
|
73 | 88 |
|
74 | 89 |
Synnefo.NetworksCreateRoute = Synnefo.CreateRoute.extend({}); |
75 | 90 |
|
... | ... | |
113 | 128 |
return Synnefo.conf.sectors.findBy('destination', this.get('type')).icon.replace('outline', 'full'); |
114 | 129 |
}.property(), |
115 | 130 |
hasOS: function(){ |
116 |
if(Synnefo.get('currentPath') == "vms") |
|
131 |
console.log('hasOS ', Synnefo.get('currentPath')) |
|
132 |
if(Synnefo.get('currentPath') === "vms" || Synnefo.get('currentPath') === "vms.index") |
|
117 | 133 |
return true; |
118 | 134 |
else return false; |
119 | 135 |
}.property(), |
120 | 136 |
hasTags: function(){ |
121 |
if(Synnefo.get('currentPath') == "vms") |
|
137 |
if(Synnefo.get('currentPath') == "vms" || Synnefo.get('currentPath') === "vms.index")
|
|
122 | 138 |
return true; |
123 | 139 |
else return false; |
124 | 140 |
}.property(), |
... | ... | |
147 | 163 |
}); |
148 | 164 |
|
149 | 165 |
|
166 |
Synnefo.VmsCreateController = Ember.ObjectController.extend({}); |
|
150 | 167 |
|
151 | 168 |
Synnefo.ElemController = Ember.ObjectController.extend({ |
152 | 169 |
needs: [], |
... | ... | |
192 | 209 |
}); |
193 | 210 |
|
194 | 211 |
|
212 |
Synnefo.CreateController = Ember.ArrayController.extend({ |
|
213 |
actions: { |
|
214 |
moveNext: function() { |
|
215 |
console.log('move to next step'); |
|
216 |
} |
|
217 |
} |
|
218 |
}); |
|
219 |
|
|
220 |
Synnefo.VmsCreateController =Synnefo.CreateController.extend({ |
|
221 |
|
|
222 |
}); |
|
223 |
|
|
224 |
|
|
195 | 225 |
/* Views */ |
196 | 226 |
|
227 |
Synnefo.ApplicationView = Ember.View.extend({ |
|
228 |
classNames: ['content'] |
|
229 |
}) |
|
230 |
|
|
197 | 231 |
Synnefo.NavIconView = Ember.View.extend({ |
198 | 232 |
tagName: 'span', |
199 |
click: function(e) {
|
|
233 |
click: function() { |
|
200 | 234 |
var parentEl = this.$().parent('a'); |
201 | 235 |
var currentEl = this.$().parents('li').siblings('li').find('a.current'); |
202 | 236 |
|
... | ... | |
217 | 251 |
}); |
218 | 252 |
|
219 | 253 |
|
254 |
Synnefo.WizardHeadersView = Ember.CollectionView.extend({ |
|
255 |
tagName: 'ul', |
|
256 |
classNames:['nums'], |
|
257 |
content: Synnefo.conf.wizards.findBy('name', 'vm-wizard').data[0].stepsHeadlines, |
|
258 |
counter: 0, |
|
259 |
itemViewClass: Ember.View.extend({ |
|
260 |
templateName: 'wizardStepHeader', |
|
261 |
classNameBindings: ['isCurrent:current', 'isFirst:preselected'], |
|
262 |
index: undefined, |
|
263 |
isCurrent: false, |
|
264 |
isFirst: false, |
|
265 |
init: function() { |
|
266 |
this._super(); |
|
267 |
console.log('init'); |
|
268 |
var prevIndex = this.get('parentView').get('counter'); |
|
269 |
prevIndex++; |
|
270 |
console.log('prevIndex', prevIndex) |
|
271 |
this.get('parentView').set('counter', prevIndex); |
|
272 |
this.set('index', prevIndex); |
|
273 |
if(prevIndex === 1) { |
|
274 |
this.set('isFirst', true); |
|
275 |
this.set('isCurrent', true); |
|
276 |
} |
|
277 |
console.log('current', this.isCurrent) |
|
278 |
}, |
|
279 |
didInsertElement: function() { |
|
280 |
} |
|
281 |
}), |
|
282 |
}); |
|
283 |
|
|
284 |
|
|
220 | 285 |
Synnefo.ElemView = Ember.View.extend({ |
221 | 286 |
// templateName: 'elem', |
222 | 287 |
addNewBtn: false, |
... | ... | |
268 | 333 |
tagName: 'a', |
269 | 334 |
click: function() { |
270 | 335 |
this.sendAction("action", this.get('param')); |
336 |
}, |
|
337 |
content: undefined // will be set if we want to print a message inside the span |
|
338 |
}); |
|
339 |
|
|
340 |
Synnefo.BtnsSpanComponent = Ember.Component.extend({ |
|
341 |
tagName: 'a', |
|
342 |
templateName: 'components/btns-span', |
|
343 |
click: function() { |
|
344 |
this.sendAction("action"); |
|
271 | 345 |
} |
346 |
}) |
|
347 |
|
|
348 |
Synnefo.Close1Component = Synnefo.BtnsSpanComponent.extend({ |
|
349 |
classNames: ['close'], |
|
350 |
}); |
|
351 |
|
|
352 |
// there's another close to modals |
|
353 |
|
|
354 |
Synnefo.Cancel1Component = Synnefo.BtnsSpanComponent.extend({ |
|
355 |
classNames: ['nav', 'prev'], |
|
356 |
// classNameBindings: ['el3'], the element that should be focused when the user goes to the next step |
|
357 |
content: 'CANCEL' |
|
358 |
}); |
|
359 |
|
|
360 |
Synnefo.Next1Component = Synnefo.BtnsSpanComponent.extend({ |
|
361 |
classNames: ['nav', 'next'], |
|
362 |
// classNameBindings: ['el3'], the element that should be focused when the user goes to the next step |
|
363 |
content: 'NEXT' |
|
272 | 364 |
}); |
273 | 365 |
|
274 | 366 |
Synnefo.AddNewComponent = Ember.Component.extend({ |
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/okeanos-ember/obj.js | ||
---|---|---|
1 |
/* Objects */ |
|
2 |
|
|
1 | 3 |
Ember.Inflector.inflector.uncountable('account'); |
2 | 4 |
|
3 | 5 |
Synnefo.Account = DS.Model.extend({ |
... | ... | |
181 | 183 |
action: 'is this a function?' |
182 | 184 |
}] |
183 | 185 |
}; |
186 |
|
|
187 |
Synnefo.wizards = { |
|
188 |
vmWizard: { |
|
189 |
// each step must have a headline |
|
190 |
stepsHeadlines: [ |
|
191 |
{ |
|
192 |
title:'Select an OS', |
|
193 |
subtitle:'Choose your preferred image' |
|
194 |
}, |
|
195 |
{ |
|
196 |
title:'Select CPUs, RAM and Disk Size', |
|
197 |
subtitle:'Available options are filtered based on the selected image' |
|
198 |
}, |
|
199 |
{ |
|
200 |
title:'Virtual machine custom options', |
|
201 |
subtitle:'tba' |
|
202 |
}, |
|
203 |
{ |
|
204 |
title:'Confirm your settings', |
|
205 |
subtitle:'Confirm that the options you have selected are correct' |
|
206 |
}, |
|
207 |
], |
|
208 |
stepsContent: ['step-1', 'step-2', 'step-3', 'step-4'] |
|
209 |
}, |
|
210 |
networkWizard: {} |
|
211 |
} |
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/okeanos-ember/routers.js | ||
---|---|---|
1 |
/* Mapping */ |
|
2 |
|
|
3 |
Synnefo.Router.map(function() { |
|
4 |
// I defined the above resource to extend its Route |
|
5 |
this.resource('sections', {'path':'/'}); |
|
6 |
for(var i=0; i<Synnefo.conf.sectors.length; i++) |
|
7 |
this.resource(Synnefo.conf.sectors[i].destination, function() { |
|
8 |
// this.route('grid'); |
|
9 |
// this.route('list'); |
|
10 |
this.route('create'); |
|
11 |
}); |
|
12 |
}); |
|
13 |
|
|
14 |
|
|
15 |
/* Routes */ |
|
16 |
|
|
17 |
Synnefo.ApplicationRoute = Ember.Route.extend({ |
|
18 |
model: function() { |
|
19 |
return {email: 'athina@mail.com'}; |
|
20 |
}, |
|
21 |
redirect: function() { |
|
22 |
// have to set vm navigation icon full |
|
23 |
this.transitionTo('vms'); |
|
24 |
}, |
|
25 |
}); |
|
26 |
|
|
27 |
|
|
28 |
/* Items Routes */ |
|
29 |
|
|
30 |
Synnefo.SectionsRoute = Ember.Route.extend({ |
|
31 |
modelName: undefined, |
|
32 |
model: function() { |
|
33 |
return this.store.find(this.modelName); |
|
34 |
}, |
|
35 |
renderTemplate: function(controller) { |
|
36 |
this.render('snfElems', {controller: controller}); |
|
37 |
}, |
|
38 |
actions: { |
|
39 |
openWizard: function() { |
|
40 |
var wizardType = this.routeName; |
|
41 |
this.transitionTo(wizardType+'.create') |
|
42 |
} |
|
43 |
} |
|
44 |
}); |
|
45 |
|
|
46 |
|
|
47 |
Synnefo.VmsRoute = Synnefo.SectionsRoute.extend({ |
|
48 |
modelName: 'vm' |
|
49 |
}); |
|
50 |
|
|
51 |
Synnefo.NetworksRoute = Synnefo.SectionsRoute.extend({ |
|
52 |
modelName: 'network' |
|
53 |
}); |
|
54 |
|
|
55 |
Synnefo.VolumesRoute = Synnefo.SectionsRoute.extend({ |
|
56 |
modelName: 'volume' |
|
57 |
}); |
|
58 |
|
|
59 |
Synnefo.SnapshotsRoute = Synnefo.SectionsRoute.extend({ |
|
60 |
modelName: 'snapshot' |
|
61 |
}); |
|
62 |
|
|
63 |
Synnefo.ImagesRoute = Synnefo.SectionsRoute.extend({ |
|
64 |
modelName: 'userImage' |
|
65 |
}); |
|
66 |
|
|
67 |
|
|
68 |
/* Wizards Routes */ |
|
69 |
|
|
70 |
Synnefo.CreateRoute = Ember.Route.extend({ |
|
71 |
model: function(){ |
|
72 |
return [{name: 'vm-wizard'}] |
|
73 |
}, |
|
74 |
renderTemplate: function(controller) { |
|
75 |
this.render('wizard',{controller: controller}); |
|
76 |
}, |
|
77 |
/* beforeModel: function() { |
|
78 |
this._super(); |
|
79 |
console.log('beforeModel ',this.get('router.url')) |
|
80 |
this.previousRoute = this.get('router.url'); // should return the current path but some times it returns the path where the user was before (when i dont type the url of the wizard) |
|
81 |
}, |
|
82 |
previousRoute: undefined,*/ |
|
83 |
actions: { |
|
84 |
closeWizard: function() { |
|
85 |
history.back(); |
|
86 |
} |
|
87 |
} |
|
88 |
}); |
|
89 |
|
|
90 |
Synnefo.VmsCreateRoute = Synnefo.CreateRoute.extend({ |
|
91 |
model: function() { |
|
92 |
return Synnefo.wizards.vmWizard; |
|
93 |
} |
|
94 |
}); |
|
95 |
|
|
96 |
Synnefo.NetworksCreateRoute = Synnefo.CreateRoute.extend(); |
|
97 |
|
|
98 |
Synnefo.VolumesCreateRoute = Synnefo.CreateRoute.extend(); |
|
99 |
|
|
100 |
Synnefo.SnapshotsCreateRoute = Synnefo.CreateRoute.extend(); |
|
101 |
|
|
102 |
Synnefo.ImagesCreateRoute = Synnefo.CreateRoute.extend({}); |
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/okeanos-ember/views.js | ||
---|---|---|
1 |
/* Views */ |
|
2 |
|
|
3 |
Synnefo.ApplicationView = Ember.View.extend({ |
|
4 |
classNames: ['content'] |
|
5 |
}); |
|
6 |
|
|
7 |
|
|
8 |
/* Navigation Menu */ |
|
9 |
|
|
10 |
Synnefo.NavIconView = Ember.View.extend({ |
|
11 |
tagName: 'span', |
|
12 |
click: function() { |
|
13 |
var parentEl = this.$().parent('a'); |
|
14 |
var currentEl = this.$().parents('li').siblings('li').find('a.current'); |
|
15 |
|
|
16 |
ui.replaceClass(currentEl, 'full', 'outline', 'snf-'); |
|
17 |
ui.replaceClass(parentEl, 'outline', 'full', 'snf-'); |
|
18 |
} |
|
19 |
|
|
20 |
}); |
|
21 |
|
|
22 |
Synnefo.NavigationView = Ember.CollectionView.extend({ |
|
23 |
tagName: "ul", |
|
24 |
classNames: ['icons-nav'], |
|
25 |
|
|
26 |
content: Synnefo.conf.sectors, |
|
27 |
itemViewClass: Ember.View.extend({ |
|
28 |
templateName: "navigationItem" |
|
29 |
}), |
|
30 |
}); |
|
31 |
|
|
32 |
|
|
33 |
/* Items Parts */ |
|
34 |
|
|
35 |
Synnefo.ElemView = Ember.View.extend({ |
|
36 |
// templateName: 'elem', |
|
37 |
addNewBtn: false, |
|
38 |
templateName: 'snfElem', |
|
39 |
tagName: 'li', |
|
40 |
selectable: true, |
|
41 |
initSelect: 'unchecked', |
|
42 |
classNameBindings: ['status'], |
|
43 |
attributeBindings: ['data-status'], |
|
44 |
'data-status': function() { |
|
45 |
return this.status; |
|
46 |
}.property(), |
|
47 |
status: function() { |
|
48 |
return this.get('controller.status'); |
|
49 |
}.property('controller.status') |
|
50 |
}); |
|
51 |
|
|
52 |
Synnefo.ImgWrapView = Ember.View.extend({ |
|
53 |
templateName: 'img-wrap', |
|
54 |
classNames: ['img-wrap'], |
|
55 |
icon: function() { |
|
56 |
var parentView = this.get('parentView'); |
|
57 |
var addNewBtn = parentView.get('addNewBtn'); |
|
58 |
if(addNewBtn) |
|
59 |
return parentView.get('icon'); |
|
60 |
else |
|
61 |
return parentView.get('controller').get('parentController').get('icon'); |
|
62 |
}.property() |
|
63 |
}); |
|
64 |
|
|
65 |
Synnefo.NameView = Ember.View.extend({ |
|
66 |
templateName: 'name', |
|
67 |
tagName: 'h4', |
|
68 |
name: function() { |
|
69 |
// the name may be defined inside the parent view or in its model or controller |
|
70 |
return this.get('parentView').get('controller').get('name'); |
|
71 |
}.property() |
|
72 |
}); |
|
73 |
|
|
74 |
// to be changed |
|
75 |
Synnefo.ImmediateActionView = Ember.View.extend({ |
|
76 |
templateName: 'actions', |
|
77 |
classNames: ['actions'] |
|
78 |
}); |
|
79 |
|
|
80 |
|
|
81 |
/* Wizard */ |
|
82 |
|
|
83 |
Synnefo.WizardHeadersView = Ember.CollectionView.extend({ |
|
84 |
tagName: 'ul', |
|
85 |
classNames:['nums'], |
|
86 |
content: Synnefo.wizards.vmWizard.stepsHeadlines, |
|
87 |
counter: 0, |
|
88 |
setCurrentHeader: function() { |
|
89 |
step = this.get('controller').get('currentStep'); |
|
90 |
console.log('* step', step); |
|
91 |
return step; |
|
92 |
}.property('controller.currentStep'), |
|
93 |
didInsertElement: function() { |
|
94 |
console.log('collecton inserted'); |
|
95 |
this.setCurrentHeader; |
|
96 |
}, |
|
97 |
itemViewClass: Ember.View.extend({ |
|
98 |
templateName: 'wizardStepHeader', |
|
99 |
classNameBindings: ['isCurrent:current::', 'isFirst:preselected', 'isPast:past::'], |
|
100 |
index: undefined, |
|
101 |
isCurrent: false, |
|
102 |
isFirst: false, |
|
103 |
init: function() { |
|
104 |
this._super(); |
|
105 |
console.log('init'); |
|
106 |
var prevIndex = this.get('parentView').get('counter'); |
|
107 |
prevIndex++; |
|
108 |
console.log('prevIndex', prevIndex) |
|
109 |
this.get('parentView').set('counter', prevIndex); |
|
110 |
this.set('index', prevIndex); |
|
111 |
if(prevIndex === 1) { |
|
112 |
this.set('isFirst', true); |
|
113 |
// this.set('isCurrent', true); |
|
114 |
} |
|
115 |
console.log('current', this.isVisible) |
|
116 |
}, |
|
117 |
isCurrent: function() { |
|
118 |
return this.index === this.get('controller').get('currentStep'); |
|
119 |
}.property('controller.currentStep'), |
|
120 |
|
|
121 |
isPast: function() { |
|
122 |
return this.index < this.get('controller').get('currentStep'); |
|
123 |
}.property('controller.currentStep'), |
|
124 |
|
|
125 |
didInsertElement: function() { |
|
126 |
} |
|
127 |
}), |
|
128 |
}); |
|
129 |
|
|
130 |
// The only buttons that are views are the buttons that move the wizard |
|
131 |
// The reason is that they shouldn't be isolated from the surrounding |
|
132 |
// (Their labels changes depanding the current step) |
|
133 |
Synnefo.WizardBtnBackView = Ember.View.extend({ |
|
134 |
classNames: ['nav', 'prev'], |
|
135 |
tagName: 'a', |
|
136 |
templateName: 'components/btns-span', |
|
137 |
content: function(){ |
|
138 |
return this.get('controller').get('btnLeftLabel'); |
|
139 |
}.property('controller.btnLeftLabel'), |
|
140 |
click: function() { |
|
141 |
this.get('controller').send('moveBack'); |
|
142 |
} |
|
143 |
}); |
|
144 |
|
|
145 |
Synnefo.WizardBtnNextView = Ember.View.extend({ |
|
146 |
classNames: ['nav', 'next'], |
|
147 |
tagName: 'a', |
|
148 |
templateName: 'components/btns-span', |
|
149 |
content: function(){ |
|
150 |
return this.get('controller').get('btnRightLabel'); |
|
151 |
}.property('controller.btnRightLabel'), |
|
152 |
click: function() { |
|
153 |
this.get('controller').send('moveNext'); |
|
154 |
} |
|
155 |
}); |
|
156 |
|
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/templates.js | ||
---|---|---|
238 | 238 |
/**/) { |
239 | 239 |
this.compilerInfo = [4,'>= 1.0.0']; |
240 | 240 |
helpers = this.merge(helpers, Ember.Handlebars.helpers); data = data || {}; |
241 |
var buffer = '', helper, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression; |
|
242 |
|
|
243 |
|
|
244 |
data.buffer.push("<section class=\"overlay-area-custom\">\n <div id=\"vm-wizard\" class=\"overlay-div wizard\">\n <div class=\"top\">\n <div class=\"numbers\">\n <div class=\"row\">\n "); |
|
245 |
data.buffer.push(escapeExpression((helper = helpers['close-1'] || (depth0 && depth0['close-1']),options={hash:{ |
|
246 |
'action': ("closeWizard") |
|
247 |
},hashTypes:{'action': "STRING"},hashContexts:{'action': depth0},contexts:[],types:[],data:data},helper ? helper.call(depth0, options) : helperMissing.call(depth0, "close-1", options)))); |
|
248 |
data.buffer.push("\n "); |
|
249 |
data.buffer.push(escapeExpression((helper = helpers.collection || (depth0 && depth0.collection),options={hash:{},hashTypes:{},hashContexts:{},contexts:[depth0],types:["ID"],data:data},helper ? helper.call(depth0, "Synnefo.WizardHeadersView", options) : helperMissing.call(depth0, "collection", "Synnefo.WizardHeadersView", options)))); |
|
250 |
data.buffer.push("\n </div>\n </div>\n </div>\n <div class=\"middle\"></div>\n <div class=\"bottom\">\n <div class=\"row\">\n "); |
|
251 |
data.buffer.push(escapeExpression(helpers.view.call(depth0, "Synnefo.WizardBtnBackView", {hash:{},hashTypes:{},hashContexts:{},contexts:[depth0],types:["ID"],data:data}))); |
|
252 |
data.buffer.push("\n "); |
|
253 |
data.buffer.push(escapeExpression(helpers.view.call(depth0, "Synnefo.WizardBtnNextView", {hash:{},hashTypes:{},hashContexts:{},contexts:[depth0],types:["ID"],data:data}))); |
|
254 |
data.buffer.push("\n \n </div>\n </div>\n </div>\n</section>"); |
|
255 |
return buffer; |
|
241 | 256 |
|
257 |
}); |
|
258 |
|
|
259 |
Ember.TEMPLATES["wizardStepHeader"] = Ember.Handlebars.template(function anonymous(Handlebars,depth0,helpers,partials,data |
|
260 |
/**/) { |
|
261 |
this.compilerInfo = [4,'>= 1.0.0']; |
|
262 |
helpers = this.merge(helpers, Ember.Handlebars.helpers); data = data || {}; |
|
263 |
var buffer = '', stack1; |
|
242 | 264 |
|
243 | 265 |
|
244 |
data.buffer.push("<section class=\"overlay-area-custom\">\n <div id=\"vm-wizard\" class=\"overlay-div wizard\">\n <h2>Wizard</h2>\n </div>\n</section>"); |
|
266 |
data.buffer.push("<em><span>"); |
|
267 |
stack1 = helpers._triageMustache.call(depth0, "view.index", {hash:{},hashTypes:{},hashContexts:{},contexts:[depth0],types:["ID"],data:data}); |
|
268 |
if(stack1 || stack1 === 0) { data.buffer.push(stack1); } |
|
269 |
data.buffer.push("</span></em>\n<p><strong>"); |
|
270 |
stack1 = helpers._triageMustache.call(depth0, "view.content.title", {hash:{},hashTypes:{},hashContexts:{},contexts:[depth0],types:["ID"],data:data}); |
|
271 |
if(stack1 || stack1 === 0) { data.buffer.push(stack1); } |
|
272 |
data.buffer.push("</strong> "); |
|
273 |
stack1 = helpers._triageMustache.call(depth0, "view.content.subtitle", {hash:{},hashTypes:{},hashContexts:{},contexts:[depth0],types:["ID"],data:data}); |
|
274 |
if(stack1 || stack1 === 0) { data.buffer.push(stack1); } |
|
275 |
data.buffer.push("</p>"); |
|
276 |
return buffer; |
|
245 | 277 |
|
246 | 278 |
}); |
247 | 279 |
|
... | ... | |
261 | 293 |
|
262 | 294 |
}); |
263 | 295 |
|
296 |
Ember.TEMPLATES["components/btns-span"] = Ember.Handlebars.template(function anonymous(Handlebars,depth0,helpers,partials,data |
|
297 |
/**/) { |
|
298 |
this.compilerInfo = [4,'>= 1.0.0']; |
|
299 |
helpers = this.merge(helpers, Ember.Handlebars.helpers); data = data || {}; |
|
300 |
var buffer = '', stack1, escapeExpression=this.escapeExpression; |
|
301 |
|
|
302 |
|
|
303 |
data.buffer.push("<span "); |
|
304 |
data.buffer.push(escapeExpression(helpers['bind-attr'].call(depth0, {hash:{ |
|
305 |
'class': ("view.spanClass") |
|
306 |
},hashTypes:{'class': "STRING"},hashContexts:{'class': depth0},contexts:[],types:[],data:data}))); |
|
307 |
data.buffer.push(">"); |
|
308 |
stack1 = helpers._triageMustache.call(depth0, "view.content", {hash:{},hashTypes:{},hashContexts:{},contexts:[depth0],types:["ID"],data:data}); |
|
309 |
if(stack1 || stack1 === 0) { data.buffer.push(stack1); } |
|
310 |
data.buffer.push("</span>"); |
|
311 |
return buffer; |
|
312 |
|
|
313 |
}); |
|
314 |
|
|
264 | 315 |
Ember.TEMPLATES["components/login-menu"] = Ember.Handlebars.template(function anonymous(Handlebars,depth0,helpers,partials,data |
265 | 316 |
/**/) { |
266 | 317 |
this.compilerInfo = [4,'>= 1.0.0']; |
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/templates/components/btns-span.hbs | ||
---|---|---|
1 |
<span {{bind-attr class="view.spanClass"}}>{{view.content}}</span> |
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/templates/wizard.hbs | ||
---|---|---|
1 | 1 |
<section class="overlay-area-custom"> |
2 | 2 |
<div id="vm-wizard" class="overlay-div wizard"> |
3 |
<h2>Wizard</h2> |
|
3 |
<div class="top"> |
|
4 |
<div class="numbers"> |
|
5 |
<div class="row"> |
|
6 |
{{close-1 action="closeWizard"}} |
|
7 |
{{collection Synnefo.WizardHeadersView}} |
|
8 |
</div> |
|
9 |
</div> |
|
10 |
</div> |
|
11 |
<div class="middle"></div> |
|
12 |
<div class="bottom"> |
|
13 |
<div class="row"> |
|
14 |
{{view Synnefo.WizardBtnBackView}} |
|
15 |
{{view Synnefo.WizardBtnNextView}} |
|
16 |
{{!-- {{cancel-1 action="moveBack" step=currentStep minStep=1}} |
|
17 |
{{next-1 action="moveNext" step=currentStep maxStep=totalStep}} --}} |
|
18 |
</div> |
|
19 |
</div> |
|
4 | 20 |
</div> |
5 | 21 |
</section> |
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/templates/wizardStepHeader.hbs | ||
---|---|---|
1 |
<em><span>{{view.index}}</span></em> |
|
2 |
<p><strong>{{view.content.title}}</strong> {{view.content.subtitle}}</p> |
b/snf-cyclades-app/synnefo/ui/new_ui/ui/sass/_animations.scss | ||
---|---|---|
44 | 44 |
} |
45 | 45 |
} |
46 | 46 |
|
47 |
// test animations for wizard header |
|
48 |
|
|
49 |
|
|
50 |
@include keyframes( fadeIn) { |
|
51 |
0% { |
|
52 |
display: none; |
|
53 |
opacity: 0; |
|
54 |
} |
|
55 |
10% { |
|
56 |
display: inline; |
|
57 |
opacity: 0.1; |
|
58 |
} |
|
59 |
100% { |
|
60 |
opacity: 1; |
|
61 |
} |
|
62 |
} |
|
47 | 63 |
|
48 | 64 |
|
49 | 65 |
// temp |
b/snf-cyclades-app/synnefo/ui/new_ui/ui/sass/_common.scss | ||
---|---|---|
306 | 306 |
|
307 | 307 |
|
308 | 308 |
/* Layout ----------------------------------------------- */ |
309 |
html,body { |
|
309 |
html,body, .content {
|
|
310 | 310 |
height:100%; |
311 | 311 |
} |
312 | 312 |
|
b/snf-cyclades-app/synnefo/ui/new_ui/ui/sass/_wizards.scss | ||
---|---|---|
108 | 108 |
} |
109 | 109 |
&.current{ |
110 | 110 |
float: left; |
111 |
animation: fadeIn 0.7s; |
|
112 |
-webkit-animation: fadeIn 0.7s; |
|
111 | 113 |
p { |
112 | 114 |
display: inline-block; |
113 | 115 |
} |
... | ... | |
122 | 124 |
} |
123 | 125 |
} |
124 | 126 |
} |
127 |
&.past { |
|
128 |
display: none; |
|
129 |
} |
|
125 | 130 |
} |
126 | 131 |
} |
127 | 132 |
} |
b/snf-cyclades-app/synnefo/ui/new_ui/ui/stylesheets/app.css | ||
---|---|---|
7032 | 7032 |
|
7033 | 7033 |
/* Layout ----------------------------------------------- */ |
7034 | 7034 |
/* line 309, ../sass/_common.scss */ |
7035 |
html, body { |
|
7035 |
html, body, .content {
|
|
7036 | 7036 |
height: 100%; |
7037 | 7037 |
} |
7038 | 7038 |
|
... | ... | |
8910 | 8910 |
} |
8911 | 8911 |
} |
8912 | 8912 |
|
8913 |
/* line 50, ../sass/_animations.scss */ |
|
8913 |
@-webkit-keyframes fadeIn { |
|
8914 |
/* line 51, ../sass/_animations.scss */ |
|
8915 |
0% { |
|
8916 |
display: none; |
|
8917 |
opacity: 0; |
|
8918 |
} |
|
8919 |
|
|
8920 |
/* line 55, ../sass/_animations.scss */ |
|
8921 |
10% { |
|
8922 |
display: inline; |
|
8923 |
opacity: 0.1; |
|
8924 |
} |
|
8925 |
|
|
8926 |
/* line 59, ../sass/_animations.scss */ |
|
8927 |
100% { |
|
8928 |
opacity: 1; |
|
8929 |
} |
|
8930 |
} |
|
8931 |
|
|
8932 |
@-moz-keyframes fadeIn { |
|
8933 |
/* line 51, ../sass/_animations.scss */ |
|
8934 |
0% { |
|
8935 |
display: none; |
|
8936 |
opacity: 0; |
|
8937 |
} |
|
8938 |
|
|
8939 |
/* line 55, ../sass/_animations.scss */ |
|
8940 |
10% { |
|
8941 |
display: inline; |
|
8942 |
opacity: 0.1; |
|
8943 |
} |
|
8944 |
|
|
8945 |
/* line 59, ../sass/_animations.scss */ |
|
8946 |
100% { |
Also available in: Unified diff