Commit 854153e69079f5508ed8d773488b1f410e88f9bf

Authored by Antonio Terceiro
1 parent 4816c3f1

Using the new media panel for all text editing

app/views/cms/_text_editor_sidebar.rhtml 0 → 100644
... ... @@ -0,0 +1,67 @@
  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>
  21 + <div class='text-editor-sidebar-box' id='media-upload-box'>
  22 + <p><strong>Media upload</strong></p>
  23 + <div id='media-upload-form'>
  24 + <% form_tag({ :action => 'media_upload' }, :multipart => true) do |f| %>
  25 + <div class='formfield'>
  26 + <%# TODO duplicated from partial upload_file_form %>
  27 + <%= labelled_form_field(_('Choose folder to upload files:'), select_tag('parent_id', options_for_select([[profile.identifier, '']] + profile.folders.collect {|f| [ profile.identifier + '/' + f.full_name, f.id ] }))) %>
  28 + </div>
  29 + <p><%= file_field_tag('file1') %></p>
  30 + <p><%= file_field_tag('file2') %></p>
  31 + <p><%= file_field_tag('file3') %></p>
  32 + <% button_bar do %>
  33 + <%= submit_button(:save, _('Upload')) %>
  34 + <% end %>
  35 + <% end %>
  36 + </div>
  37 + <div id='media-upload-results' class='media-list-results' style='display: none'>
  38 + <ul>
  39 + </ul>
  40 + <p>
  41 + <em><%= _('Drag item names to the text to add their URL') %></em>
  42 + </p>
  43 + <p><%= link_to(_('Upload more files ...'), '#', :id => 'media-upload-more-files')%></p>
  44 + </div>
  45 + </div>
  46 + <div class='text-editor-sidebar-box'>
  47 + <p><strong>Media search</strong></p>
  48 + <p>
  49 + <% form_tag({ :action => 'search' }) do %>
  50 + <span class='formfield'>
  51 + <input name='q' type='text' id='media-search-query' style='width: 250px;'/>
  52 + </span>
  53 + <%= submit_button :search, _('Search'), :id => 'media-search-button' %>
  54 + <% end %>
  55 + </p>
  56 + </form>
  57 + <div id='media-search-results' class='media-list-results' style='display: none'>
  58 + <ul>
  59 + </ul>
  60 + <p>
  61 + <em><%= _('Drag item names to the text to add their URL') %></em>
  62 + </p>
  63 + </div>
  64 + </div>
  65 +</div>
  66 +
  67 +
... ...
app/views/cms/_textile_media.rhtml
... ... @@ -1,65 +0,0 @@
1   -<div class='textile-editor-sidebar'>
2   - <div class='textile-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>
21   - <div class='textile-editor-sidebar-box' id='media-upload-box'>
22   - <p><strong>Media upload</strong></p>
23   - <div id='media-upload-form'>
24   - <% form_tag({ :action => 'media_upload' }, :multipart => true) do |f| %>
25   - <div class='formfield'>
26   - <%# TODO duplicated from partial upload_file_form %>
27   - <%= labelled_form_field(_('Choose folder to upload files:'), select_tag('parent_id', options_for_select([[profile.identifier, '']] + profile.folders.collect {|f| [ profile.identifier + '/' + f.full_name, f.id ] }))) %>
28   - </div>
29   - <p><%= file_field_tag('file1') %></p>
30   - <p><%= file_field_tag('file2') %></p>
31   - <p><%= file_field_tag('file3') %></p>
32   - <% button_bar do %>
33   - <%= submit_button(:save, _('Upload')) %>
34   - <% end %>
35   - <% end %>
36   - </div>
37   - <div id='media-upload-results' class='media-list-results' style='display: none'>
38   - <ul>
39   - </ul>
40   - <p>
41   - <em><%= _('Drag item names to the text to add their URL') %></em>
42   - </p>
43   - <p><%= link_to(_('Upload more files ...'), '#', :id => 'media-upload-more-files')%></p>
44   - </div>
45   - </div>
46   - <div class='textile-editor-sidebar-box'>
47   - <p><strong>Media search</strong></p>
48   - <% form_tag({ :action => 'search' }) do %>
49   - <span class='formfield'>
50   - <input name='q' type='text' id='media-search-query' style='width: 250px;'/>
51   - </span>
52   - <%= submit_button :search, _('Search'), :id => 'media-search-button' %>
53   - <% end %>
54   - </form>
55   - <div id='media-search-results' class='media-list-results' style='display: none'>
56   - <ul>
57   - </ul>
58   - <p>
59   - <em><%= _('Drag item names to the text to add their URL') %></em>
60   - </p>
61   - </div>
62   - </div>
63   -</div>
64   -
65   -
app/views/cms/edit.rhtml
... ... @@ -49,11 +49,8 @@
49 49 <% end %>
50 50 </div>
51 51  
52   -<% if environment.enabled?('media_panel') && [TinyMceArticle, Event, EnterpriseHomepage].any?{|klass| @article.kind_of?(klass)} %>
53   - <%= render :partial => 'media_listing' %>
54   -<% end %>
55   -<% if @article.is_a?(TextileArticle) %>
56   - <%= render :partial => 'textile_media' %>
  52 +<% if environment.enabled?('media_panel') && [TinyMceArticle, TextileArticle, Event, EnterpriseHomepage].any?{|klass| @article.kind_of?(klass)} %>
  53 + <%= render :partial => 'text_editor_sidebar' %>
57 54 <% end %>
58 55  
59 56 <br style='clear: both'/>
... ...
public/stylesheets/application.css
... ... @@ -3371,36 +3371,36 @@ div.with_media_panel .formfield input {
3371 3371  
3372 3372 /* Textile sidebar */
3373 3373  
3374   -.textile-editor-sidebar {
  3374 +.text-editor-sidebar {
3375 3375 position: absolute;
3376 3376 width: 380px;
3377 3377 right: 20px;
3378 3378 top: 70px;
3379 3379 }
3380 3380  
3381   -.textile-editor-sidebar-box {
  3381 +.text-editor-sidebar-box {
3382 3382 background: #eeeeec;
3383 3383 border: 1px solid #d3d7cf;
3384 3384 padding: 10px 10px 0px 10px;
3385 3385 margin-bottom: 10px;
3386 3386 }
3387   -.textile-editor-sidebar-box p {
  3387 +.text-editor-sidebar-box p {
3388 3388 margin-top: 0px;
3389 3389 }
3390   -.textile-editor-sidebar code,
3391   -.textile-editor-sidebar pre {
  3390 +.text-editor-sidebar code,
  3391 +.text-editor-sidebar pre {
3392 3392 border: 1px solid #d3d7cf;
3393 3393 color: black;
3394 3394 padding: 2px;
3395 3395 }
3396   -.textile-editor-sidebar .icon-loading {
  3396 +.text-editor-sidebar .icon-loading {
3397 3397 background-image: url(../images/loading-small.gif);
3398 3398 }
3399   -.textile-editor-sidebar .media-list-results ul {
  3399 +.text-editor-sidebar .media-list-results ul {
3400 3400 padding: 0px;
3401 3401 list-style: none;
3402 3402 }
3403   -.textile-editor-sidebar .media-list-results li {
  3403 +.text-editor-sidebar .media-list-results li {
3404 3404 background-repeat: no-repeat;
3405 3405 background-position: 0px 0px;
3406 3406 padding-left: 20px;
... ... @@ -3409,11 +3409,11 @@ div.with_media_panel .formfield input {
3409 3409 border: none;
3410 3410 margin-bottom: 2px;
3411 3411 }
3412   -.textile-editor-sidebar .media-list-results li:hover {
  3412 +.text-editor-sidebar .media-list-results li:hover {
3413 3413 background-color: transparent;
3414 3414 border: none;
3415 3415 }
3416   -.textile-editor-sidebar #media-upload-box {
  3416 +.text-editor-sidebar #media-upload-box {
3417 3417 background-repeat: no-repeat;
3418 3418 background-position: top right ;
3419 3419 }
... ...