* Clear history requests list and save to storage
*/
function clearHistoryList(ev) {
+
+ YangmanDesignService.disableMdMenuItem(ev);
+
var confirm = $mdDialog.confirm()
.title($filter('translate')('YANGMAN_DELETE_HISTORY_CONFIRM_TITLE'))
.textContent($filter('translate')('YANGMAN_DELETE_HISTORY_CONFIRM_TEXT'))
vm.requestList.clear();
vm.requestList.saveToStorage();
$scope.rootBroadcast('YANGMAN_REFRESH_HISTORY');
+ YangmanDesignService.enableMdMenuItem(ev);
+ }, function (){
+ YangmanDesignService.enableMdMenuItem(ev);
});
}
.ok($filter('translate')('YANGMAN_OK'))
.cancel($filter('translate')('YANGMAN_CANCEL'));
+ YangmanDesignService.disableMdMenuItem(ev);
+
$mdDialog.show(confirm).then(function (){
vm.collectionList.clear();
vm.collectionList.saveToStorage();
$scope.rootBroadcast('YANGMAN_REFRESH_COLLECTIONS');
+ YangmanDesignService.enableMdMenuItem(ev);
+ }, function () {
+ YangmanDesignService.enableMdMenuItem(ev);
});
}
self.list.forEach(addToListDateGroup);
function addToListDateGroup(elem){
- var groupName = roundTimestampToDate(elem.timestamp),
- dateGroupArr = self.dateGroups.filter(function(group){
- return group.name === groupName;
- }),
- dateGroup = null;
-
- if (dateGroupArr.length){
- dateGroup = dateGroupArr[0];
+ if (elem.timestamp){
+ var groupName = roundTimestampToDate(elem.timestamp),
+ dateGroupArr = self.dateGroups.filter(function(group){
+ return group.name === groupName;
+ }),
+ dateGroup = null;
+
+ if (dateGroupArr.length){
+ dateGroup = dateGroupArr[0];
+ }
+ else {
+ dateGroup = {
+ name: groupName,
+ longName: new Date(groupName).toDateString(),
+ requests: [],
+ };
+ self.dateGroups.push(dateGroup);
+ }
+ dateGroup.requests.push(elem);
}
- else {
- dateGroup = {
- name: groupName,
- longName: new Date(groupName).toDateString(),
- requests: [],
- };
- self.dateGroups.push(dateGroup);
- }
- dateGroup.requests.push(elem);
}
}
<md-dialog aria-label="Save to collection" ng-cloak>
- <form name="saveReqForm">
+ <form name="dialog.saveReqForm">
<md-toolbar>
<div class="md-toolbar-tools">
<h2>{{( dialog.duplicate ? 'YANGMAN_REQS_DUPLICATE' : 'YANGMAN_REQS_SAVE_TO_COL')| translate}}</h2>
</md-toolbar>
<md-dialog-content style="width: 400px;">
<div class="md-dialog-content" layout="column">
- <md-autocomplete
- md-selected-item="dialog.selectedItem"
- md-search-text="dialog.collectionName"
- md-items="item in dialog.getColAutocomplete()"
- md-floating-label="{{'YANGMAN_CREATING_COLLECTION'|translate}}"
- md-item-text="item"
- md-min-length="0">
- <md-item-template>
- <span md-highlight-text="dialog.collectionName" md-highlight-flags="^i">{{item}}</span>
- </md-item-template>
- <md-not-found>
+ <md-input-container>
+ <md-autocomplete
+ md-selected-item="dialog.selectedItem"
+ md-search-text="dialog.collectionName"
+ md-items="item in dialog.getColAutocomplete()"
+ md-floating-label="{{'YANGMAN_CREATING_COLLECTION'|translate}}"
+ md-item-text="item"
+ md-min-length="0"
+ ng-required="true">
+ <md-item-template>
+ <span md-highlight-text="dialog.collectionName" md-highlight-flags="^i">{{item}}</span>
+ </md-item-template>
+ <md-not-found>
<span ng-if="dialog.collectionName.length">
{{'YANGMAN_COLLECTION_NEW_COL_'| translate}} "{{dialog.collectionName}}" {{'YANGMAN_COLLECTION_WILL_BE_CREATED'| translate}}.
</span>
<span ng-if="dialog.collectionName.length === 0">
{{'YANGMAN_NO_COLLECTIONS'| translate}}
</span>
- </md-not-found>
- </md-autocomplete>
- <div ng-messages="saveReqForm.collectionName.$error" multiple md-auto-hide="false">
- <div ng-message="required">
- {{'YANGMAN_COLLECTION_NAME_REQUIRED'| translate}}
+ </md-not-found>
+ </md-autocomplete>
+ <input name="collectionName"
+ ng-model="dialog.collectionName"
+ ng-required="true" style="display: none;">
+ <div ng-messages="dialog.saveReqForm.collectionName.$error" multiple md-auto-hide="false">
+ <div ng-message="required">
+ {{'YANGMAN_COLLECTION_NAME_REQUIRED'| translate}}
+ </div>
</div>
- </div>
+ </md-input-container>
+
</div>
</md-dialog-content>
<md-dialog-actions layout="row">
<md-button ng-click="dialog.cancel()">
{{'YANGMAN_CANCEL'| translate}}
</md-button>
- <md-button ng-click="dialog.save()" ng-disabled="dialog.collectionName.length === 0">
+ <md-button ng-click="dialog.save()" ng-disabled="!dialog.saveReqForm.$valid">
{{'YANGMAN_SAVE'| translate}}
</md-button>
</md-dialog-actions>