Commit 42cc1b2f4070fb921f8d5d8fe54350d2d9e2563a

Authored by Antonio Terceiro
1 parent 854153e6

Make it work better with TinyMCE

  * removed hardcoded style from Javascript-generated HTML so that when
    the image is dragged into TinyMCE it does not carry the sidebar
    formatting
  * Moved Textile quick reference to a separate partial that is only
    rendered for TextileArticle's
app/views/cms/_text_editor_sidebar.rhtml
1 1 <div class='text-editor-sidebar'>
2   - <div class='text-editor-sidebar-box'>
3   - <p>
4   - <strong><%= _('Textile markup quick reference') %></strong>
5   - <%= link_to(_('(show)'), '#', :id => 'textile-quickref-show') %>
6   - <%= link_to(_('(hide)'), '#', :id => 'textile-quickref-hide', :style => 'display: none') %>
7   - </p>
8   - <div id='textile-quickref' style='display: none;'>
9   - <p><%= _('Simple formatting:') %> <code>_<%= _('italics') %>_</code> <code>*<%= _('bold') %>*</code>, <code>-<%= _('striked')%>-</code>.</p>
10   - <p><%= _('Links:') %> <code>"Noosfero":http://noosfero.org/</code></p>
11   - <p><%= _('Images:') %> <code>!http://example.com/image.png!</code></p>
12   - <p><%= _('Bullet lists:') %></p>
13   - <pre>* <%= _('first item') %>
14   -* <%= _('second item') %></pre>
15   - <p><%= _('Numbered lists:') %></p>
16   - <pre># <%= _('first item') %>
17   -# <%= _('second item') %></pre>
18   - <p><%= _('See also a more complete <a href="%s">Textile Reference</a>') % 'http://redcloth.org/hobix.com/textile/' %></p>
19   - </div>
20   - </div>
  2 + <%= render(:partial => 'textile_quick_reference') if @article.is_a?(TextileArticle) %>
21 3 <div class='text-editor-sidebar-box' id='media-upload-box'>
22 4 <p><strong>Media upload</strong></p>
23 5 <div id='media-upload-form'>
... ...
app/views/cms/_textile_quick_reference.rhtml 0 → 100644
... ... @@ -0,0 +1,20 @@
  1 +<div class='text-editor-sidebar-box'>
  2 + <p>
  3 + <strong><%= _('Textile markup quick reference') %></strong>
  4 + <%= link_to(_('(show)'), '#', :id => 'textile-quickref-show') %>
  5 + <%= link_to(_('(hide)'), '#', :id => 'textile-quickref-hide', :style => 'display: none') %>
  6 + </p>
  7 + <div id='textile-quickref' style='display: none;'>
  8 + <p><%= _('Simple formatting:') %> <code>_<%= _('italics') %>_</code> <code>*<%= _('bold') %>*</code>, <code>-<%= _('striked')%>-</code>.</p>
  9 + <p><%= _('Links:') %> <code>"Noosfero":http://noosfero.org/</code></p>
  10 + <p><%= _('Images:') %> <code>!http://example.com/image.png!</code></p>
  11 + <p><%= _('Bullet lists:') %></p>
  12 + <pre>* <%= _('first item') %>
  13 +* <%= _('second item') %></pre>
  14 + <p><%= _('Numbered lists:') %></p>
  15 + <pre># <%= _('first item') %>
  16 +# <%= _('second item') %></pre>
  17 + <p><%= _('See also a more complete <a href="%s">Textile Reference</a>') % 'http://redcloth.org/hobix.com/textile/' %></p>
  18 + </div>
  19 +</div>
  20 +
... ...
public/javascripts/article.js
... ... @@ -27,7 +27,7 @@ jQuery(function($) {
27 27 var html_for_items = '';
28 28 $.each(items, function(i, item) {
29 29 if (item.content_type && item.content_type.match(/^image/)) {
30   - html_for_items += '<li class="icon-photos"><img src="' + item.url + '" style="max-height: 96px; max-width: 96px; border: 1px solid #d3d7cf;" alt="' + item.url + '"/><br/><a href="' + item.url + '">' + item.title + '</a></li>';
  30 + html_for_items += '<li class="icon-photos"><img src="' + item.url + '"/><br/><a href="' + item.url + '">' + item.title + '</a></li>';
31 31 } else {
32 32 html_for_items += '<li class="' + item.icon + '"><a href="' + item.url + '">' + item.title + '</a></li>';
33 33 }
... ...
public/stylesheets/application.css
... ... @@ -3417,6 +3417,11 @@ div.with_media_panel .formfield input {
3417 3417 background-repeat: no-repeat;
3418 3418 background-position: top right ;
3419 3419 }
  3420 +.text-editor-sidebar img {
  3421 + max-height: 96px;
  3422 + max-width: 96px;
  3423 + border: 1px solid #d3d7cf;
  3424 +}
3420 3425  
3421 3426 /* ==> public/stylesheets/controller_contact.css <== */
3422 3427 /*** SELECT CITY ***/
... ...