<label class="pull-right">[% l('Start Date') %]</label>
</div>
<div class="form-group col-lg-6">
- <div class="pull-left"><eg-date-input ng-model="ssub.start_date"></eg-date-input></div>
+ <div class="pull-left"><eg-date-input ng-model="ssub.start_date" focus-me="ssub._focus_me"></eg-date-input></div>
</div>
</div>
</div>
<input class="form-control" type="text" ng-model="ssub.expected_date_offset"></input>
</div>
<div class="form-group col-sm-1">
- <button class="btn btn-sm btn-warning" ng-click="add_distribution(ssub)">[% l('Add distribution') %]</button>
+ <button class="btn btn-sm btn-warning" ng-click="add_distribution(ssub, true)">[% l('Add distribution') %]</button>
</div>
</div>
<div class="row form-inline pad-vert" ng-repeat="sdist in ssub.distributions">
</div>
<div class="col-sm-3">
<label>[% l('Label') %]</label>
- <input class="form-control" type="text" required ng-model="sdist.label"></input>
+ <input class="form-control" type="text" required ng-model="sdist.label" focus-me="sdist._focus_me"></input>
</div>
<div class="col-sm-2">
<label>[% l('OPAC Display') %]
</select>
</div>
<div class="col-sm-1" style="padding-left:0"><!-- Yes, it's terrible. But, nested grid alignment... -->
- <button class="btn btn-sm btn-info" ng-click="add_stream(sdist)">[% l('Add copy stream') %]</button>
+ <button class="btn btn-sm btn-info" ng-click="add_stream(sdist, true)">[% l('Add copy stream') %]</button>
</div>
</div>
<div class="row form-inline pad-vert">
</div>
<div class="col-sm-8">
<label>[% l('Send to') %]</label>
- <eg-basic-combo-box list="localStreamNames" on-select="dirtyForm" selected="sstr.routing_label"></eg-basic-combo-box>
+ <eg-basic-combo-box list="localStreamNames" on-select="dirtyForm" selected="sstr.routing_label" focus-me="sstr._focus_me"></eg-basic-combo-box>
</div>
</div>
</div>
var new_ssub = egCore.idl.toTypedHash(new egCore.idl.ssub());
new_ssub._isnew = true;
new_ssub.record_entry = $scope.bibId;
+ new_ssub._focus_me = true;
$scope.subscriptions.push(new_ssub);
$scope.add_distribution(new_ssub); // since we know we want at least one distribution
}
- $scope.add_distribution = function(ssub) {
+ $scope.add_distribution = function(ssub, grab_focus) {
var new_sdist = egCore.idl.toTypedHash(new egCore.idl.sdist());
new_sdist._isnew = true;
new_sdist.subscription = ssub.id;
if (!angular.isArray(ssub.distributions)){
ssub.distributions = [];
}
+ if (grab_focus) {
+ new_sdist._focus_me = true;
+ ssub._focus_me = false;
+ }
ssub.distributions.push(new_sdist);
$scope.add_stream(new_sdist); // since we know we want at least one stream
}
ssub.distributions.splice(to_remove, 1);
}
}
- $scope.add_stream = function(sdist) {
+ $scope.add_stream = function(sdist, grab_focus) {
var new_sstr = egCore.idl.toTypedHash(new egCore.idl.sstr());
new_sstr.distribution = sdist.id;
new_sstr._isnew = true;
+ if (grab_focus) {
+ new_sstr._focus_me = true;
+ sdist._has_focus = false; // and take focus away from a newly created sdist
+ }
if (!angular.isArray(sdist.streams)){
sdist.streams = [];
}