Commit 21fb3fcc02152763770b348fbd078dcc738f24fe

Authored by Rodrigo Souto
1 parent 16b3ad01

[media-panel-improvements] Show/Hide all uploads

app/views/cms/_text_editor_sidebar.html.erb
... ... @@ -15,6 +15,10 @@
15 15 <p><%= file_field_tag('file', :multiple => true) %></p>
16 16 <% end %>
17 17 </div>
  18 + <div class='hide-and-show-uploads'>
  19 + <%= link_to(_('Hide all uploads'), nil, :id => 'hide-uploads', :style => 'display: none;', 'data-bootstraped' => false) %>
  20 + <%= link_to(_('Show all uploads'), nil, :id => 'show-uploads', :style => 'display: none;') %>
  21 + </div>
18 22 </div>
19 23  
20 24 <div id='published-media' class='text-editor-sidebar-box' data-url='<%= url_for({:controller => 'cms', :action => 'published_media_items', :profile => profile.identifier}) %>'>
... ...
public/javascripts/media-panel.js
... ... @@ -5,6 +5,10 @@ jQuery(&#39;#file&#39;).fileupload({
5 5 data.submit();
6 6 },
7 7 progress: function (e, data) {
  8 + if (jQuery('#hide-uploads').data('bootstraped') == false) {
  9 + jQuery('#hide-uploads').show();
  10 + jQuery('#hide-uploads').data('bootstraped', true);
  11 + }
8 12 if (data.context) {
9 13 progress = parseInt(data.loaded / data.total * 100, 10);
10 14 data.context.find('.bar').css('width', progress + '%');
... ... @@ -18,6 +22,20 @@ jQuery(&#39;#file&#39;).fileupload({
18 22 }
19 23 });
20 24  
  25 +jQuery('#hide-uploads').click(function(){
  26 + jQuery('#hide-uploads').hide();
  27 + jQuery('#show-uploads').show();
  28 + jQuery('.upload').slideUp();
  29 + return false;
  30 +});
  31 +
  32 +jQuery('#show-uploads').click(function(){
  33 + jQuery('#hide-uploads').show();
  34 + jQuery('#show-uploads').hide();
  35 + jQuery('.upload').slideDown();
  36 + return false;
  37 +});
  38 +
21 39 function loadPublishedMedia() {
22 40 var parent_id = jQuery('#published-media #parent_id').val();
23 41 var q = jQuery('#published-media #q').val();
... ...
public/stylesheets/application.css
... ... @@ -3415,6 +3415,10 @@ div.with_media_panel .formfield input[type=&quot;checkbox&quot;] {
3415 3415  
3416 3416 }
3417 3417  
  3418 +#media-upload-box .hide-and-show-uploads {
  3419 + text-align: center;
  3420 +}
  3421 +
3418 3422 .text-editor-sidebar {
3419 3423 position: absolute;
3420 3424 width: 280px;
... ...