Sha256: a29a79f71bdc24f79fcfffdc6aab7ff955168316eb3daa04478aae30b4b36397

Contents?: true

Size: 1.98 KB

Versions: 12

Compression:

Stored size: 1.98 KB

Contents

//General popup ~ singleton

var Modal = function(){
    var $popup = $(".modal"),
    $header = $popup.find(".header"),
    $content = $popup.find(".content"),
    $footer = $popup.find('footer');


    this.$header = $header.find(".header-text");
    this.$content_header = $content.find(".question");
    this.$content_text = $content.find(".text");
    this.$content_other_html = $content.find(".other_html");
    this.$footer = $footer.find(".footer-text");

    Modal.prototype.setHeader = function(text){
        //can be a type of content like ERROR, INFORMATION, QUESTION, etc
        this.$header.text(text);

        return this;
    }

    Modal.prototype.setContentHeader = function(qtext){
        //can set a secondary header/title like , a question or something general
        this.$content_header.text(qtext);

        return this;
    }

    Modal.prototype.setContentText = function(text){
        // can set a text for the content section, we can have some details for it
        this.$content_text.text(text);

        return this;
    }

    Modal.prototype.setOtherHtml = function(html){
        //can set some html code like ajax loader, etc
        this.$content_other_html.html(html);

        return this;
    }

    Modal.prototype.setFooter = function(text){
        //set the footer text
        this.$footer.text(text);

        return this;
    }

    Modal.prototype.getPopupReference = function(){

        return $popup;
    }

    Modal.prototype.init = function(options){
       console.log("Modal - Init");
        if(options){
            options.type && this.$header.text(options.type);
            options.content_head && this.$content_header.text(options.content_head);
            options.content_text && this.$content_text.text(options.content_text);
            options.footer && this.$footer.text(options.footer);
        }
    }

    if(arguments.callee._singletonInstance)
        return arguments.callee._singletonInstance;
    arguments.callee._singletonInstance = this;
}

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
waterfall_bourbon_neat_rails-1.4.2 app/assets/javascripts/modal.js
waterfall_bourbon_neat_rails-1.4.1 app/assets/javascripts/modal.js
waterfall_bourbon_neat_rails-1.4.0 app/assets/javascripts/modal.js
waterfall_bourbon_neat_rails-1.3.2 app/assets/javascripts/modal.js
waterfall_bourbon_neat_rails-1.3.1 app/assets/javascripts/modal.js
waterfall_bourbon_neat_rails-1.3.0 app/assets/javascripts/modal.js
waterfall_bourbon_neat_rails-1.2.8 app/assets/javascripts/modal.js
waterfall_bourbon_neat_rails-1.2.7 app/assets/javascripts/modal.js
waterfall_bourbon_neat_rails-1.2.5 app/assets/javascripts/modal.js
waterfall_bourbon_neat_rails-1.2.3 app/assets/javascripts/modal.js
waterfall_bourbon_neat_rails-1.2.2 app/assets/javascripts/modal.js
waterfall_bourbon_neat_rails-1.2.1 app/assets/javascripts/modal.js