Przyciski do zmiany czcionki.
authorŁukasz Rekucki <lrekucki@gmail.com>
Fri, 4 Sep 2009 11:06:59 +0000 (13:06 +0200)
committerŁukasz Rekucki <lrekucki@gmail.com>
Fri, 4 Sep 2009 11:06:59 +0000 (13:06 +0200)
apps/toolbar/templates/toolbar/toolbar.html
dump_toolbar.sh [new file with mode: 0755]
fixtures/przyciski.xml
project/templates/explorer/panels/xmleditor.html

index 29528c1..2113530 100644 (file)
@@ -21,7 +21,7 @@
                 ui:action-params="{{ button.params|escape }}"
                 {% if button.key %}ui:hotkey="{{ button.key|keycode }}"{% endif %} 
                 {% if button.tooltip %}ui:tooltip="{{ button.tooltip }}"{% endif %} >
                 ui:action-params="{{ button.params|escape }}"
                 {% if button.key %}ui:hotkey="{{ button.key|keycode }}"{% endif %} 
                 {% if button.tooltip %}ui:tooltip="{{ button.tooltip }}"{% endif %} >
-            {{ button.label }}
+            {{ button.label|safe }}
             </button>
             {% endfor %}
         </p>
             </button>
             {% endfor %}
         </p>
diff --git a/dump_toolbar.sh b/dump_toolbar.sh
new file mode 100755 (executable)
index 0000000..3bac9fe
--- /dev/null
@@ -0,0 +1 @@
+./project/manage.py dumpdata --format=xml toolbar > fixtures/przyciski.xml
index a8ad2c1..287a0cc 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
 <?xml version="1.0" encoding="utf-8"?>\r
-<django-objects version="1.0"><object pk="2" model="toolbar.buttongroup"><field type="CharField" name="name">Autokorekta</field><field type="SlugField" name="slug">autokorekta</field><field type="IntegerField" name="position">0</field></object><object pk="1" model="toolbar.buttongroup"><field type="CharField" name="name">Formatowanie</field><field type="SlugField" name="slug">formatowanie</field><field type="IntegerField" name="position">0</field></object><object pk="4" model="toolbar.button"><field type="CharField" name="label">Novelpages</field><field type="SlugField" name="slug">novelpages</field><field type="TextField" name="params">({exprs: [\r\r
+<django-objects version="1.0"><object pk="2" model="toolbar.buttongroup"><field type="CharField" name="name">Autokorekta</field><field type="SlugField" name="slug">autokorekta</field><field type="IntegerField" name="position">0</field></object><object pk="1" model="toolbar.buttongroup"><field type="CharField" name="name">Formatowanie</field><field type="SlugField" name="slug">formatowanie</field><field type="IntegerField" name="position">0</field></object><object pk="3" model="toolbar.buttongroup"><field type="CharField" name="name">Widok</field><field type="SlugField" name="slug">display_options</field><field type="IntegerField" name="position">2</field></object><object pk="5" model="toolbar.button"><field type="CharField" name="label">A&lt;sup&gt;+&lt;/sup&gt;</field><field type="SlugField" name="slug">increase_font_size</field><field type="TextField" name="params">({change: 2})</field><field to="toolbar.scriptlet" name="scriptlet" rel="ManyToOneRel">codemirror_fontsize</field><field type="CharField" name="key">+</field><field type="CharField" name="tooltip">Zwiększ rozmiar czcionki.</field><field to="toolbar.buttongroup" name="group" rel="ManyToManyRel"><object pk="3"></object></field></object><object pk="6" model="toolbar.button"><field type="CharField" name="label">A&lt;sup&gt;-&lt;/sup&gt;</field><field type="SlugField" name="slug">descrease_font_size</field><field type="TextField" name="params">({change: -2})</field><field to="toolbar.scriptlet" name="scriptlet" rel="ManyToOneRel">codemirror_fontsize</field><field type="CharField" name="key">-</field><field type="CharField" name="tooltip">Zmniejsz rozmiar czcionki.</field><field to="toolbar.buttongroup" name="group" rel="ManyToManyRel"><object pk="3"></object></field></object><object pk="7" model="toolbar.button"><field type="CharField" name="label">A&lt;sup&gt;=&lt;/sup&gt;</field><field type="SlugField" name="slug">reset_font_size</field><field type="TextField" name="params">({fontSize: 13})</field><field to="toolbar.scriptlet" name="scriptlet" rel="ManyToOneRel">codemirror_fontsize</field><field type="CharField" name="key">=</field><field type="CharField" name="tooltip">Przywróć orginalny rozmiar czcionki.</field><field to="toolbar.buttongroup" name="group" rel="ManyToManyRel"><object pk="3"></object></field></object><object pk="4" model="toolbar.button"><field type="CharField" name="label">Novelpages</field><field type="SlugField" name="slug">novelpages</field><field type="TextField" name="params">({exprs: [\r\r
   ["\\,\\.\\.|\\.\\,\\.|\\.\\.\\,", "..."],\r\r
   ["„", ",,"] /* DOUBLE LOW-9 QUOTATION MARK */\r\r
 ]})\r\r
   ["\\,\\.\\.|\\.\\,\\.|\\.\\.\\,", "..."],\r\r
   ["„", ",,"] /* DOUBLE LOW-9 QUOTATION MARK */\r\r
 ]})\r\r
@@ -50,4 +50,13 @@ else {
         cm.setLineContent(line, content);\r\r
         line = cm.nextLine(line);\r\r
     } while( !(line === false) );\r\r
         cm.setLineContent(line, content);\r\r
         line = cm.nextLine(line);\r\r
     } while( !(line === false) );\r\r
+}</field></object><object pk="codemirror_fontsize" model="toolbar.scriptlet"><field type="TextField" name="code">var texteditor = panel.texteditor;\r\r
+var frameBody = $('body', $(texteditor.frame).contents());\r\r
+\r\r
+if(params.fontSize) {\r\r
+    frameBody.css('font-size', params.fontSize);\r\r
+}\r\r
+else {\r\r
+    var old_size = parseInt(frameBody.css('font-size'));\r\r
+    frameBody.css('font-size', old_size + (params.change || 0) );\r\r
 }</field></object></django-objects>\r
 }</field></object></django-objects>\r
index 39a05e5..76018ca 100644 (file)
@@ -1,15 +1,9 @@
 {% load toolbar_tags %}
 
 {% load toolbar_tags %}
 
-<div class="change-font-size" style="">
-    <div class="decrease-font-size">A<sup>-</sup></div>
-    <div class="increase-font-size">A<sup>+</sup></div>
-</div>
-
 <div class="iframe-container" style="position: absolute; top: 41pt; left:0px; right:0px; bottom: 0px;">
        <textarea name="text">{{ text }}</textarea>
 </div>
 
 <div class="iframe-container" style="position: absolute; top: 41pt; left:0px; right:0px; bottom: 0px;">
        <textarea name="text">{{ text }}</textarea>
 </div>
 
-
 {% toolbar %}
 
 <script type="text/javascript" charset="utf-8">
 {% toolbar %}
 
 <script type="text/javascript" charset="utf-8">
@@ -39,22 +33,8 @@ panel_hooks = {
                     $.fbind(self, self.isHotkey) );
             }
         })
                     $.fbind(self, self.isHotkey) );
             }
         })
-        
-        $(texteditor.frame).css({width: '100%', height: '100%'});
-        
-        
 
 
-        $('.decrease-font-size', panel).click(function() {
-            var frameBody = $('body', $(texteditor.frame).contents());
-            console.log(frameBody.css('font-size'));
-            frameBody.css('font-size', parseInt(frameBody.css('font-size')) - 2);
-        });
-        
-        $('.increase-font-size', panel).click(function() {
-            var frameBody = $('body', $(texteditor.frame).contents());
-            console.log(frameBody.css('font-size'));
-            frameBody.css('font-size', parseInt(frameBody.css('font-size')) + 2);
-        });        
+        $(texteditor.frame).css({width: '100%', height: '100%'});    
         this.texteditor = texteditor;
     },
 
         this.texteditor = texteditor;
     },