From 1c9ca0999071d9d2af48d912f25c1d125bccbd34 Mon Sep 17 00:00:00 2001 From: Chris Gross Date: Sun, 6 Jul 2014 12:47:44 -0400 Subject: [PATCH] added class options to buttons --- README.md | 4 +++- angular-prompt.html | 2 +- bower.json | 2 +- dist/angular-prompt.js | 2 +- dist/angular-prompt.min.js | 2 +- package.json | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index a534245..362a65e 100644 --- a/README.md +++ b/README.md @@ -85,13 +85,15 @@ function MyCtrl($scope, prompt) { A list of values available in a dropdown for the user to select as the input value. - #### options.buttons - Type: `Array` of `Object` with properties `label`,`cancel`, and `primary` + Type: `Array` of `Object` with properties `label`,`cancel`, `class`, and `primary` Default: `[{ label:'OK', primary: true }, { label:'Cancel', cancel: true }]` A list of the buttons to display on the dialog. The function returns a promise. That promise is resolved with either the button that was pressed, or in the case of input prompts, the value the user entered. If the user pressed a button where `cancel=true` or canceled the dialog another way (hit ESC, etc) then the promise is rejected. ## Release History + * v1.1.0 + * Added `class` option to buttons. * v1.0.1 * Updated modal template with correct modal title class. * Added bower_components to ignore in bower.json. diff --git a/angular-prompt.html b/angular-prompt.html index 14ce81d..13a66b0 100644 --- a/angular-prompt.html +++ b/angular-prompt.html @@ -28,6 +28,6 @@ \ No newline at end of file diff --git a/bower.json b/bower.json index 652bf2c..3a74c9b 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "angular-prompt", "description": "Angular service to easily display prompt and confirmation modals.", - "version": "1.0.2", + "version": "1.1.0", "main": [ "dist/angular-prompt.js" ], diff --git a/dist/angular-prompt.js b/dist/angular-prompt.js index 4b4ba0d..059c30b 100644 --- a/dist/angular-prompt.js +++ b/dist/angular-prompt.js @@ -134,7 +134,7 @@ angular.module('cgPrompt').run(['$templateCache', function($templateCache) { "\n" + " \n" + "
\n" + - " \n" + + " \n" + "
\n" + "" ); diff --git a/dist/angular-prompt.min.js b/dist/angular-prompt.min.js index 2992ced..b5cd85d 100644 --- a/dist/angular-prompt.min.js +++ b/dist/angular-prompt.min.js @@ -1 +1 @@ -angular.module("cgPrompt",["ui.bootstrap"]),angular.module("cgPrompt").factory("prompt",["$modal","$q",function(a,b){var c=function(c){var d={title:"",message:"",input:!1,label:"",value:"",values:!1,buttons:[{label:"Cancel",cancel:!0},{label:"OK",primary:!0}]};void 0===c&&(c={});for(var e in d)void 0===c[e]&&(c[e]=d[e]);var f=b.defer();return a.open({templateUrl:"angular-prompt.html",controller:"cgPromptCtrl",resolve:{options:function(){return c}}}).result.then(function(a){f.resolve(c.input?a.input:a.button)},function(){f.reject()}),f.promise};return c}]),angular.module("cgPrompt").controller("cgPromptCtrl",["$scope","options","$timeout",function(a,b,c){a.input={name:b.value},a.options=b,a.buttonClicked=function(c){return c.cancel?void a.$dismiss():b.input&&angular.element(document.querySelector("#cgPromptForm")).scope().cgPromptForm.$invalid?void(a.changed=!0):void a.$close({button:c,input:a.input.name})},a.submit=function(){var b;angular.forEach(a.options.buttons,function(a){a.primary&&(b=a)}),b&&a.buttonClicked(b)},c(function(){var a=document.querySelector("#cgPromptInput");a&&(a.select&&a.select(),a.focus&&a.focus())},100)}]),angular.module("cgPrompt").run(["$templateCache",function(a){"use strict";a.put("angular-prompt.html",'
\n \n \n \n
')}]); \ No newline at end of file +angular.module("cgPrompt",["ui.bootstrap"]),angular.module("cgPrompt").factory("prompt",["$modal","$q",function(a,b){var c=function(c){var d={title:"",message:"",input:!1,label:"",value:"",values:!1,buttons:[{label:"Cancel",cancel:!0},{label:"OK",primary:!0}]};void 0===c&&(c={});for(var e in d)void 0===c[e]&&(c[e]=d[e]);var f=b.defer();return a.open({templateUrl:"angular-prompt.html",controller:"cgPromptCtrl",resolve:{options:function(){return c}}}).result.then(function(a){f.resolve(c.input?a.input:a.button)},function(){f.reject()}),f.promise};return c}]),angular.module("cgPrompt").controller("cgPromptCtrl",["$scope","options","$timeout",function(a,b,c){a.input={name:b.value},a.options=b,a.buttonClicked=function(c){return c.cancel?void a.$dismiss():b.input&&angular.element(document.querySelector("#cgPromptForm")).scope().cgPromptForm.$invalid?void(a.changed=!0):void a.$close({button:c,input:a.input.name})},a.submit=function(){var b;angular.forEach(a.options.buttons,function(a){a.primary&&(b=a)}),b&&a.buttonClicked(b)},c(function(){var a=document.querySelector("#cgPromptInput");a&&(a.select&&a.select(),a.focus&&a.focus())},100)}]),angular.module("cgPrompt").run(["$templateCache",function(a){"use strict";a.put("angular-prompt.html",'
\n \n \n \n
')}]); \ No newline at end of file diff --git a/package.json b/package.json index bbc2a00..03788c4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-prompt", - "version": "1.0.2", + "version": "1.1.0", "description": "", "repository": { "type": "git",