Updated styles to work in the original admin. Updated the javascript to overload...
authorHarris Lapiroff <harris@chromamine.com>
Wed, 6 Jul 2011 18:40:29 +0000 (14:40 -0400)
committerHarris Lapiroff <harris@chromamine.com>
Wed, 6 Jul 2011 18:40:29 +0000 (14:40 -0400)
philo/forms/widgets.py
philo/static/philo/css/EmbedWidget.css
philo/static/philo/js/EmbedWidget.js

index 739adc7..d223605 100644 (file)
@@ -16,7 +16,7 @@ class EmbedWidget(Textarea):
                
                json_ = json.dumps(data)
                
-               default_attrs = {'class': 'embedding', 'data-content-types': json_ }
+               default_attrs = {'class': 'embedding vLargeTextField', 'data-content-types': json_ }
                
                if attrs:
                        default_attrs.update(attrs)
index 3b21016..6b85410 100644 (file)
@@ -1,15 +1,20 @@
 .embed-widget{
-       background:#DDD;
-       padding:2px;
-       border:1px solid #CCC;
-       border-radius:5px;
-       -webkit-border-radius:5px;
-       -moz-border-radius:5px;
-       display:inline-block;
-       margin:0 -3px;
+       float:left;
 }
 .embed-toolbar{
-       padding-bottom:3px;
+       border:1px solid #CCC;
+       border-bottom:0;
+       padding:3px 5px;
+       background:#EEE -webkit-linear-gradient(#F5F5F5, #DDD);
+       background:#EEE -moz-linear-gradient(#F5F5F5, #DDD);
+       background-color:#EEE;
+}
+.embed-widget textarea{
+       margin-top:0;
+}
+.embed-widget button, .embed-widget select{
+       vertical-align:middle;
+       margin-right:3px;
 }
 .embed-toolbar button{
        background:#FFF;
@@ -19,9 +24,6 @@
        -moz-border-radius:3px;
        color:#666;
 }
-.embed-toolbar select, .embed-toolbar button{
-       margin-right:3px;
-}
 .embed-toolbar button:hover{
        color:#444;
 }
        color:#FFF;
        background:#666;
        border-color:#666;
+}
+
+.grappelli .embed-widget{
+       background:#DDD;
+       padding:2px;
+       border:1px solid #CCC;
+       border-radius:5px;
+       -webkit-border-radius:5px;
+       -moz-border-radius:5px;
+       display:inline-block;
+       margin:0 -3px;
+}
+.grappelli .embed-toolbar{
+       padding-bottom:3px;
 }
\ No newline at end of file
index 210bb9a..f946740 100644 (file)
                                // otherwise, do what you usually do
                                oldDismissRelatedLookupPopup.apply(this, arguments);
                        }
+                       
+                       // overload the dismissAddAnotherPopup function
+                       oldDismissAddAnotherPopup = window.dismissAddAnotherPopup;
+                       window.dismissAddAnotherPopup = function (win, newId, newRepr) {
+                               var name = windowname_to_id(win.name),
+                                       elem = $('#'+win.name), val;
+                               if (elem.parent().hasClass('embed-widget')) {
+                                       dismissRelatedLookupPopup(win, newId);
+                               }
+                               // otherwise, do what you usually do
+                               oldDismissAddAnotherPopup.apply(this, arguments);
+                       }
+                       
+                       // Add grappelli to the body class if the admin is grappelli. This will allow us to customize styles accordingly.
+                       if (window.grappelli) {
+                               $(document.body).addClass('grappelli');
+                       }
                },
                parseContentTypes: function () {
                        var string = widget.EmbedFields.eq(0).attr('data-content-types'),