1. Ivan Zakrevsky
  2. django-imaging

Commits

Ivan Zakrevsky  committed 24d6fa0

jsi18n, reminder

  • Participants
  • Parent commits ffc3fb7
  • Branches default

Comments (0)

Files changed (4)

File imaging/static/imaging/imageselection.css

View file
-div.iframe_container {
+div.imaging_field div.iframe_container {
   display: block;
   width: auto;
   position: relative;
   margin-top: 5px;
   margin-left: 105px;
 }
+div.imaging_field div.reminder {
+  padding: 10px 20px;
+  margin-top: 5px;
+  margin-left: 105px;
+}
 
-div.image_container {
+div.imaging_field div.image_container {
 /*  background: #fff url(../img/admin/nav-bg.gif) repeat-x scroll 0  100%;*/
   overflow: hidden;
   border: 1px #ccc solid;
   position: relative;
 }
 
-div.image_block {
+div.imaging_field div.image_block {
   display: block;
   width: 205px;
   height: 220px;
   overflow: hidden;
 }
 
-span.image_id {
-  display: none;
-}
-
-a.edit_image,
-a.delete_image {
+div.imaging_field a.edit_image,
+div.imaging_field a.delete_image {
   display: block;
   position: absolute;
   height: 14px;
   top: -9999em;
 }
 
-a.edit_image {
+div.imaging_field a.edit_image {
   left: 4px;
   padding-left: 14px;
   background: #fff url(icon_changelink.gif) no-repeat scroll 2px 4px;
 }
 
-a.delete_image {
+div.imaging_field a.delete_image {
   color: #cc3434;
   right: 4px;
   padding-left: 14px;
   background: #fff url(icon_deletelink.gif) no-repeat scroll 2px 4px;
 }
 
-a.delete_image:hover {
+div.imaging_field a.delete_image:hover {
   color: #993333;
 }
 
-span.image_name {
+div.imaging_field span.image_name {
   line-height: 190%;
 }
 
-div.uploading {
+div.imaging_field div.uploading {
   display: block;
   background: #fff url(uploading.gif) center center no-repeat;
   position: absolute;
   left: 0px;
 }
 
-div.remove_confirm {
+div.imaging_field div.remove_confirm {
   display: block;
   position: absolute;
   left: 20px;

File imaging/static/imaging/imageselection.js

View file
 (function($) {
 $(document).ready(function(){
     // if some images already availible fire jqueryUI sortables
-    var cont = $("div.image_container");
-    var iframe = $("iframe.image_upload_form");
+    if (!window.gettext) {
+        window.gettext = function(msgid) {
+            return msgid;
+        }
+    }
+
+    var field = $("div.imaging_field");
+    var cont = $("div.image_container", field);
+    var iframe = $("iframe.image_upload_form", field);
+
     cont.sortable({
       stop: function(e,ui) {
       ui.item.css({'top':'0','left':'0'});
     //cont.sortable({ containment: 'parent', appendTo: 'body' });
     // event binding
     cont.on('click.edit_image', 'a.edit_image', function(e) {
+        $("div.iframe_container").prepend('<div class="uploading"></div>');
         iframe.attr('src', $(this).attr('href'));
         e.preventDefault();
     });
     iframe.load(function(){
       $("div.uploading").remove(); // hide progressbar
       // auto resize the iframe
-      this.style.height = this.contentWindow.document.body.offsetHeight + 'px';
+      this.style.height = this.contentWindow.document.body.offsetHeight + 10 + 'px';
       iframe.contents().find("input[type='submit']").click(function(){
         $("div.iframe_container").prepend('<div class="uploading"></div>');
           //if($("div.image_block").length == 1){ cont.sortable(); }
         }
         cont.sortable("refresh");
         iframe.attr('src', iframe.data('add-url'));
+        $('<div class="reminder">' + gettext("Don't forget to save the form to commit the changes.") + '</div>').insertAfter(cont).effect("highlight", {mode: 'hide'}, 3000, function(e) { $(this).remove(); });
       }
       
     });
 
 function confirm_remove_image(){
   $(".remove_confirm").remove();
-  var dialog_box = '<div class="remove_confirm">Are you sure? <br /> <input type="button" name="yes" value="Yes" /> <input type="button" name="no" value="No" /> </div>';
+  var dialog_box = '<div class="remove_confirm">' + gettext('Are you sure?') + ' <br /> <input type="button" name="yes" value="' + gettext('Yes') + '" /> <input type="button" name="no" value="' + gettext('No') + '" /> </div>';
   var image_block = $(this).parent();
   image_block.append(dialog_box);
   $("input[name='yes']").bind('click.removal',remove_image);

File imaging/templates/imaging/iframe_form.html

View file
 {% spaceless %}
 {% load i18n %}
+{% load staticfiles %}
 {% endspaceless %}<!DOCTYPE html>
 <html xmlns="http://www.w3.org/1999/xhtml" lang="{{ LANGUAGE_CODE }}" xml:lang="{{ LANGUAGE_CODE }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif %}>
 <head>
 <title>{% block title %}{% endblock %}</title>
-<link rel="stylesheet" type="text/css" href="{% block stylesheet %}{% load adminmedia %}{% admin_media_prefix %}css/forms.css{% endblock %}" />
-{% if LANGUAGE_BIDI %}<link rel="stylesheet" type="text/css" href="{% block stylesheet_rtl %}{% admin_media_prefix %}css/rtl.css{% endblock %}" />{% endif %}
+<link rel="stylesheet" type="text/css" href="{% block stylesheet %}{% static "admin/css/forms.css" %}{% endblock %}" />
+{% if LANGUAGE_BIDI %}<link rel="stylesheet" type="text/css" href="{% block stylesheet_rtl %}{% static "admin/css/rtl.css" %}{% endblock %}" />{% endif %}
 {% block extrastyle %}{% endblock %}
 {% block extrahead %}{% endblock %}
 {% block blockbots %}<meta name="robots" content="NONE,NOARCHIVE" />{% endblock %}
 </head>
-<body class="change-form">
+<body class="change-form" style="margin: 0;">
 <div id="container">
 <form id="ajax_form" method="post" enctype="multipart/form-data" action="">{% csrf_token %}
   <fieldset class="module aligned">

File imaging/templates/imaging/image_selection.html

View file
 {% load i18n %}
 {% include "imaging/bootstrap.html" %}
-<input type="hidden" class="imaging_data" {{ final_attrs|safe }} value="{{ value }}" />
-<div class="image_container">
-{% for image in initial_values %}
-    {% include "imaging/image_selection_item.html" %}
-{% endfor %}
+<div class="imaging_field">
+    <input type="hidden" class="imaging_data" {{ final_attrs|safe }} value="{{ value }}" />
+    <div class="image_container">
+    {% for image in initial_values %}
+        {% include "imaging/image_selection_item.html" %}
+    {% endfor %}
+    </div>
+    <div class="iframe_container">
+        <iframe src="{% url imaging_iframe_form %}" class="image_upload_form" width="100%" height="205" frameborder="0" data-add-url="{% url imaging_iframe_form %}"></iframe>
+    </div>
 </div>
-
-<div class="iframe_container">
-    <iframe src="{% url imaging_iframe_form %}" class="image_upload_form" width="100%" height="205" frameborder="0" data-add-url="{% url imaging_iframe_form %}"></iframe>
-</div>