Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prompt dialog (solution source code included) #137

Open
ghost opened this issue Sep 10, 2015 · 1 comment
Open

prompt dialog (solution source code included) #137

ghost opened this issue Sep 10, 2015 · 1 comment
Assignees

Comments

@ghost
Copy link

ghost commented Sep 10, 2015

Hi,

Your plugin is so helpful. Here is my minor contribution:

I have included the solution for prompt dialog but I don't know how to use Git, sorry. Here is it:

promtCtrl line 93:

/**
 * Prompt Dialog Controller
 */
ctrlrs.controller('promptDialogCtrl',['$scope','$modalInstance','$translate','data',function($scope,$modalInstance,$translate,data){
    //-- Variables -----//

    $scope.header = (angular.isDefined(data.header)) ? data.header : $translate.instant('DIALOGS_CONFIRM');
    $scope.msg = (angular.isDefined(data.msg)) ? data.msg : $translate.instant('DIALOGS_ERROR_MSG');
    $scope.icon = (angular.isDefined(data.fa) && angular.equals(data.fa,true)) ? 'fa fa-warning' : 'glyphicon glyphicon-warning-sign';

    //-- Methods -----//
    $scope.ok = function(){
        $modalInstance.close($scope.outputText);
    };

    $scope.cancel = function(){
        $modalInstance.dismiss();
        $scope.$destroy();
    }; // end close
}]); // end ErrorDialogCtrl

prompt method on dialogs

/**
* prompt Dialog
*
* @param header string
* @param msg string
* @param opts object
*/
prompt : function(header,msg,opts){
opts = _setOpts(opts);

                return $modal.open({
                    templateUrl : '/dialogs/prompt.html',
                    controller : 'promptDialogCtrl',
                    backdrop: opts.bd,
                    backdropClass: opts.bdc,
                    keyboard: opts.kb,
                    windowClass: opts.wc,
                    size: opts.ws,
                    animation: opts.anim,
                    resolve : {
                        data : function(){
                            return {
                                header : angular.copy(header),
                                msg : angular.copy(msg),
                                fa : _fa
                            };
                        }
                    }
                }); // end modal.open
            }, // end prompt

Template sample:

    <div class="modal-header dialog-header-prompt">
    <button type="button" class="close" ng-click="cancel()" class="pull-right">&times;</button>
    <h4 class="modal-title text-info"><span class="{{icon}}"></span> {{header}}</h4>
   </div>
<div class="modal-body">
    <div class=" text-info"  ng-bind-html="msg"></div>
    <div class="input-message"><input ng-model="outputText"></div>


</div>

<div class="modal-footer">
    <button type="button" class="btn btn-primary " ng-click="ok()">{{"dialogs_ok" | translate}}
    </button>
    <button type="button" class="btn btn-default" ng-click="cancel()">{{"dialogs_cancel" | translate}}
    </button>
</div>

Thank you

@m-e-conroy
Copy link
Owner

Hey, thanks. I'll try to include it when I can. I'm fairly busy lately so when I have some down time I'll add it.

@m-e-conroy m-e-conroy self-assigned this Sep 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant