adds a generic dialog with a dropdown
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/96d134ac Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/96d134ac Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/96d134ac Branch: refs/heads/master Commit: 96d134acb14a7b6dfeaa96fc18e2c7d066a55866 Parents: ed73d85 Author: Jeremy Mitchell <mitchell...@gmail.com> Authored: Wed Feb 15 22:04:48 2017 -0700 Committer: Dewayne Richardson <dewr...@apache.org> Committed: Fri Feb 17 08:33:17 2017 -0700 ---------------------------------------------------------------------- traffic_ops/experimental/ui/app/src/app.js | 1 + .../dialog/select/DialogSelectController.js | 39 ++++++++++++++++++++ .../dialog/select/dialog.select.tpl.html | 35 ++++++++++++++++++ .../src/common/modules/dialog/select/index.js | 21 +++++++++++ 4 files changed, 96 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/96d134ac/traffic_ops/experimental/ui/app/src/app.js ---------------------------------------------------------------------- diff --git a/traffic_ops/experimental/ui/app/src/app.js b/traffic_ops/experimental/ui/app/src/app.js index 0c2e50f..2a73e6d 100644 --- a/traffic_ops/experimental/ui/app/src/app.js +++ b/traffic_ops/experimental/ui/app/src/app.js @@ -152,6 +152,7 @@ var trafficOps = angular.module('trafficOps', [ require('./common/modules/dialog/confirm').name, require('./common/modules/dialog/delete').name, require('./common/modules/dialog/reset').name, + require('./common/modules/dialog/select').name, require('./common/modules/header').name, require('./common/modules/message').name, require('./common/modules/navigation').name, http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/96d134ac/traffic_ops/experimental/ui/app/src/common/modules/dialog/select/DialogSelectController.js ---------------------------------------------------------------------- diff --git a/traffic_ops/experimental/ui/app/src/common/modules/dialog/select/DialogSelectController.js b/traffic_ops/experimental/ui/app/src/common/modules/dialog/select/DialogSelectController.js new file mode 100644 index 0000000..1906be4 --- /dev/null +++ b/traffic_ops/experimental/ui/app/src/common/modules/dialog/select/DialogSelectController.js @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +var DialogSelectController = function(params, collection, $scope, $uibModalInstance) { + + $scope.params = params; + + $scope.collection = collection; + + $scope.selectedItemId = null; + + $scope.select = function() { + $uibModalInstance.close($scope.selectedItemId); + }; + + $scope.cancel = function () { + $uibModalInstance.dismiss('cancel'); + }; + +}; + +DialogSelectController.$inject = ['params', 'collection', '$scope', '$uibModalInstance']; +module.exports = DialogSelectController; http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/96d134ac/traffic_ops/experimental/ui/app/src/common/modules/dialog/select/dialog.select.tpl.html ---------------------------------------------------------------------- diff --git a/traffic_ops/experimental/ui/app/src/common/modules/dialog/select/dialog.select.tpl.html b/traffic_ops/experimental/ui/app/src/common/modules/dialog/select/dialog.select.tpl.html new file mode 100644 index 0000000..98ba8e1 --- /dev/null +++ b/traffic_ops/experimental/ui/app/src/common/modules/dialog/select/dialog.select.tpl.html @@ -0,0 +1,35 @@ +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<div class="modal-header"> + <button type="button" class="close" ng-click="cancel()"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button> + <h4 class="modal-title">{{params.title}}</h4> +</div> +<div class="modal-body"> + <p>{{params.message}}</p> + <form name="selectForm" novalidate> + <select id="cdn" name="cdn" class="form-control" ng-model="selectedItemId" ng-options="item.id as item.name for item in collection" required> + <option value="">Select...</option> + </select> + </form> +</div> +<div class="modal-footer"> + <button class="btn action-btn" ng-click="cancel()">Cancel</button> + <button class="btn btn-link" ng-disabled="selectForm.$invalid" ng-click="select()">Submit</button> +</div> http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/96d134ac/traffic_ops/experimental/ui/app/src/common/modules/dialog/select/index.js ---------------------------------------------------------------------- diff --git a/traffic_ops/experimental/ui/app/src/common/modules/dialog/select/index.js b/traffic_ops/experimental/ui/app/src/common/modules/dialog/select/index.js new file mode 100644 index 0000000..909ab74 --- /dev/null +++ b/traffic_ops/experimental/ui/app/src/common/modules/dialog/select/index.js @@ -0,0 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +module.exports = angular.module('trafficOps.dialog.select', []) + .controller('DialogSelectController', require('./DialogSelectController'));