_text_editor_sidebar.html.erb 2.52 KB
<% default_folder = content_id_to_str default_folder_for_image_upload(profile) %>

<div class='text-editor-sidebar'>
  <span class='button-add' data-value='<%= _('Add to the text') %>'></span>
  <span class='button-zoom' data-value='<%= _('Zoom in') %>'></span>
  <span class='button-close' data-value='<%= _('Close') %>'></span>

  <div class='header'><strong><%= _('Insert media') %></strong><%= button('vertical-toggle', _('Show/Hide'), '#') %></div>

  <%= render(:partial => 'textile_quick_reference') if @article.editor?(Article::Editor::TEXTILE) %>
  <div class='text-editor-sidebar-box' id='media-upload-box'>
    <div id='media-upload-form'>
      <%= form_tag({ :action => 'media_upload' }, :multipart => true) do %>
        <div class='formfield'>
          <%= select_profile_folder(
                _('Choose folder to upload files:'),
                :parent_id, profile, default_folder, {}, {},
                "type='Folder' or type='Gallery'"
          ) %>
          <%= button(:newfolder, _('New folder'), '#', :id => 'new-folder-button') %>
        </div>
        <p><%= file_field_tag('file', :multiple => true) %></p>
      <% end %>
    </div>
    <div class='hide-and-show-uploads'>
      <%= link_to(_('Hide all uploads'), nil, :id => 'hide-uploads', :style => 'display: none;', 'data-bootstraped' => false) %>
      <%= link_to(_('Show all uploads'), nil, :id => 'show-uploads', :style => 'display: none;') %>
    </div>
  </div>

  <div id='published-media' class='text-editor-sidebar-box' data-url='<%= url_for({:controller => 'cms', :action => 'published_media_items', :profile => profile.identifier}) %>'>
    <%= select_profile_folder(nil, :parent_id, profile, 'recent-media', {}, {},
        "type='Folder' or type='Gallery'", {:root_label => _('Recent media')}) %>
    <%= labelled_form_field _('Search among your uploaded files'), text_field_tag('q', '', placeholder: _('Write words about the file you are looking for')) %>
    <%= render :partial => 'drag_and_drop_note' %>
    <div class='items'>
      <%= render :partial => 'published_media_items' %>
    </div>
  </div>
</div>

<script id="template-upload" type="text/x-tmpl">
  <div id="file-{%= o.id %}" class="upload" title="{%= o.name %}">
    <div class="file-name">{%=o.name%}</div>
    <div class="percentage"></div>
    <div class="progress"><div class="bar" style="width: 0%;"></div></div>
  </div>
</script>

<%= render :partial => 'media_new_folder', :locals => {:default_folder => default_folder} %>
<%= javascript_include_tag 'jquery.fileupload.js', 'tmpl.js', 'media-panel.js' %>