Permalink
Browse files

add dialog to main js and css files

  • Loading branch information...
1 parent a04e0be commit 871ae29450de79236fdef681db5caa510ed1a72f @alecgorge alecgorge committed May 28, 2011
Showing with 75 additions and 7 deletions.
  1. +18 −3 jquery.wysiwyg.css
  2. +55 −0 jquery.wysiwyg.js
  3. +2 −4 src/dialogs/default.js
View
@@ -74,6 +74,21 @@ div.wysiwyg iframe { border: 1px solid #999; clear: left;
-moz-box-shadow :inset 0 0 10px rgba(0, 0, 0, 0.4);
-webkit-box-shadow :inset 0 0 10px rgba(0, 0, 0, 0.4);
box-shadow :inset 0 0 10px rgba(0, 0, 0, 0.4);
-background-color:white; padding:0px; margin:0; display:block; width: 100%;
-}
-
+background-color:white; padding:0px; margin:0; display:block; width: 100%; }
+
+/* dialog */
+.wysiwyg-dialog { position:fixed; top:50px; left:50px; width:450px; height:300px; background:white; font:14px "Helvetic Neue", Helvetica,Arial,sans-serif; }
+.wysiwyg-dialog .wysiwyg-dialog-topbar { background:#333; border:1px #111 solid; color:white; padding:10px; position:relative; }
+.wysiwyg-dialog .wysiwyg-dialog-topbar .wysiwyg-dialog-close-wrapper .wysiwyg-dialog-close-button { color:white; text-decoration:none; display:block; padding:6px 10px; position:absolute; right:12px; top:50%; height:14px; margin-top:-12px; }
+.wysiwyg-dialog .wysiwyg-dialog-topbar .wysiwyg-dialog-close-wrapper a.wysiwyg-dialog-close-button:hover { background:#666; }
+.wysiwyg-dialog .wysiwyg-dialog-topbar .wysiwyg-dialog-title { font-size:20px; font-weight:bold; padding:5px; }
+.wysiwyg-dialog .wysiwyg-dialog-content { border:1px #ccc solid; border-top:0; padding:15px; }
+.wysiwyg-dialog form.wysiwyg fieldset { border:1px #ccc solid; }
+.wysiwyg-dialog form.wysiwyg legend { padding:7px; }
+.wysiwyg-dialog form.wysiwyg .form-row { clear:both; padding:4px 0; }
+.wysiwyg-dialog form.wysiwyg .form-row label, .wysiwyg-dialog form.wysiwyg .form-row .form-row-key { display:block; float:left; width:35%; text-align:right; padding:4px 5px; }
+.wysiwyg-dialog form.wysiwyg .form-row .form-row-value { display:block; float:left; width:55%; }
+.wysiwyg-dialog form.wysiwyg .form-row input.width-auto { width:auto; }
+.wysiwyg-dialog form.wysiwyg input.width-small { width:50px; min-width:50px; max-width:50px; }
+.wysiwyg-dialog form.wysiwyg input, .wysiwyg-dialog form.wysiwyg select { padding:2px; width:100%; margin:2px; }
+.wysiwyg-dialog form.wysiwyg input[type=submit], .wysiwyg-dialog form.wysiwyg input[type=reset] { padding:2px 7px; width:auto; }
View
@@ -2137,6 +2137,61 @@
}
});
+ $.wysiwyg.dialog.register("default", function () {
+ var that = this;
+
+ this._$dialog = null;
+
+ this.init = function() {
+ var abstractDialog = this,
+ content = this.options.content;
+
+ if(typeof content == 'object') {
+ if(typeof content.html == 'function') {
+ content = content.html();
+ }
+ else if(typeof content.toString == 'function') {
+ content = content.toString();
+ }
+ }
+
+ that._$dialog = $('<div class="wysiwyg-dialog"></div>');
+
+ var $topbar = $('<div class="wysiwyg-dialog-topbar"><div class="wysiwyg-dialog-close-wrapper"></div><div class="wysiwyg-dialog-title">'+this.options.title+'</div></div>');
+ var $link = $('<a href="#" class="wysiwyg-dialog-close-button">X</a>');
+
+ $link.click(function () {
+ abstractDialog.close(); // this is important it makes sure that is close from the abstract $.wysiwyg.dialog instace, not just locally
+ });
+
+ $topbar.find('.wysiwyg-dialog-close-wrapper').prepend($link);
+
+ var $dcontent = $('<div class="wysiwyg-dialog-content">'+content+'</div>');
+
+ that._$dialog.append($topbar).append($dcontent);
+
+ that._$dialog.hide();
+
+ $("body").append(that._$dialog);
+
+ return that._$dialog;
+ };
+
+ this.show = function () {
+ that._$dialog.show();
+ return that._$dialog;
+ }
+
+ this.hide = function () {
+ that._$dialog.hide();
+ return that._$dialog;
+ };
+
+ this.destroy = function() {
+ that._$dialog.remove();
+ return that._$dialog;
+ };
+ });
// end Dialog
$.fn.wysiwyg = function (method) {
@@ -1,5 +1,5 @@
(function ($) {
- var defaultDialog = function () {
+ $.wysiwyg.dialog.register("default", function () {
var that = this;
this._$dialog = null;
@@ -53,7 +53,5 @@
that._$dialog.remove();
return that._$dialog;
};
- };
-
- $.wysiwyg.dialog.register("default", defaultDialog);
+ });
})(jQuery);

0 comments on commit 871ae29

Please sign in to comment.