mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-10 07:05:35 +00:00
UI changes, added utilitiy services, persistance, serialization
This commit is contained in:
@@ -2,15 +2,39 @@ angular.module('app').directive('componentSelect', [ function() {
|
||||
return {
|
||||
restrict: 'A',
|
||||
scope:{
|
||||
opts: '=', // Component Options object
|
||||
slot: '=', // Slot Object
|
||||
selectComponent: '&sc' // Select Component function
|
||||
opts: '=', // Component Options object
|
||||
},
|
||||
templateUrl: 'views/component_select.html',
|
||||
link: function (scope) {
|
||||
scope.use = function(id, component) {
|
||||
scope.selectComponent({s: scope.slot, id: id, c: component});
|
||||
};
|
||||
link: function(scope, element) {
|
||||
var list = [], o, id;
|
||||
var opts = scope.opts;
|
||||
//TODO: take current ship mass into account if provided
|
||||
// Generting the HTML in this manner is MUCH faster than using an angular template.
|
||||
for (id in opts) {
|
||||
o = opts[id];
|
||||
list.push('<li class="');
|
||||
list.push(o.name? 'lc' : 'c');
|
||||
if (false) { // Omit id if mass is exceeded making it 'disabled'
|
||||
list.push(' disabled"');
|
||||
} else {
|
||||
list.push('" id="');
|
||||
}
|
||||
list.push(id);
|
||||
list.push('">');
|
||||
list.push(o.class);
|
||||
list.push(o.rating);
|
||||
if(o.mode) {
|
||||
list.push('/' + o.mode);
|
||||
if(o.missile) {
|
||||
list.push(o.missile);
|
||||
}
|
||||
}
|
||||
if(o.name) {
|
||||
list.push(' ' + o.name);
|
||||
}
|
||||
list.push('</li>');
|
||||
}
|
||||
|
||||
element.html('<ul>' + list.join('') + '</ul>');
|
||||
}
|
||||
};
|
||||
}]);
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module('app').directive('shipRange', ['$rootScope','CalcJumpRange', function ($r, calcJumpRange) {
|
||||
angular.module('app').directive('shipRange', ['$rootScope','calcJumpRange', function ($r, calcJumpRange) {
|
||||
|
||||
return {
|
||||
restrict: 'A',
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
angular.module('app').directive('hardpoint', ['$rootScope', function ($r) {
|
||||
angular.module('app').directive('slotHardpoint', ['$rootScope', function ($r) {
|
||||
return {
|
||||
restrict: 'A',
|
||||
scope:{
|
||||
hp: '=',
|
||||
size: '=',
|
||||
opts: '='
|
||||
lbl: '=',
|
||||
},
|
||||
templateUrl: 'views/hardpoint.html',
|
||||
templateUrl: 'views/slot-hardpoint.html',
|
||||
link: function (scope) {
|
||||
scope.$r = $r;
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
angular.module('app').directive('slotDetails', ['$rootScope', function ($r) {
|
||||
angular.module('app').directive('slotInternal', ['$rootScope', function ($r) {
|
||||
return {
|
||||
restrict: 'A',
|
||||
scope:{
|
||||
c: '=',
|
||||
c: '=slot',
|
||||
lbl: '=',
|
||||
opts: '='
|
||||
},
|
||||
templateUrl: 'views/slot.html',
|
||||
templateUrl: 'views/slot-internal.html',
|
||||
link: function(scope) {
|
||||
scope.$r = $r;
|
||||
}
|
||||
Reference in New Issue
Block a user