Commit 3ca935240ee08d5d5d650f9d54b74d530d421674
1 parent
231ad8a0
Exists in
master
and in
22 other branches
[media-panel-improvements] Published media box
Showing
6 changed files
with
49 additions
and
11 deletions
Show diff stats
app/controllers/my_profile/cms_controller.rb
... | ... | @@ -322,8 +322,8 @@ class CmsController < MyProfileController |
322 | 322 | if request.post? |
323 | 323 | @file = UploadedFile.create(:uploaded_data => params[:file], :profile => profile, :parent => parent) unless params[:file] == '' |
324 | 324 | end |
325 | + @file = FilePresenter.for(@file) | |
325 | 326 | #render :text => article_list_to_json([file]), :content_type => 'text/plain' |
326 | - render :text => '' | |
327 | 327 | end |
328 | 328 | |
329 | 329 | protected | ... | ... |
app/views/cms/_text_editor_sidebar.html.erb
... | ... | @@ -19,13 +19,21 @@ |
19 | 19 | <p><%= file_field_tag('file', :multiple => true) %></p> |
20 | 20 | <% end %> |
21 | 21 | </div> |
22 | - <div id='media-upload-results' style='display: none'> | |
23 | - <%= render :partial => 'drag_and_drop_note' %> | |
24 | - <div class='items'> | |
22 | + </div> | |
23 | + | |
24 | + <div id='published-media' class='text-editor-sidebar-box'> | |
25 | + <div class='header'><strong><%= _('Published media') %></strong></div> | |
26 | + <%= render :partial => 'drag_and_drop_note' %> | |
27 | + <div class='items'> | |
28 | + <div class='images'> | |
29 | + <h3><%= _('Images') %></h3> | |
30 | + </div> | |
31 | + <div class='generics'> | |
32 | + <h3><%= _('Files') %></h3> | |
25 | 33 | </div> |
26 | - <p><%= link_to(_('Upload more files ...'), '#', :id => 'media-upload-more-files')%></p> | |
27 | 34 | </div> |
28 | 35 | </div> |
36 | + | |
29 | 37 | <div id='media-search-box' class='text-editor-sidebar-box'> |
30 | 38 | <div class='header'><strong><%= _('Media search') %></strong></div> |
31 | 39 | <p> | ... | ... |
... | ... | @@ -0,0 +1,9 @@ |
1 | +<div class="item image" data-item="span"> | |
2 | + <span> | |
3 | + <img src="<%= @file.public_filename(:uploaded) %>"/> | |
4 | + </span> | |
5 | + <div class="controls image-controls"> | |
6 | + <a class="button icon-add add-to-text" href="#"><span><%= _('Add to the text') %></span></a> | |
7 | + <a class="button icon-zoom zoom" href="#" title="<%= _('Zoom in') %>"><span><%= _('Zoom in') %></span></a> | |
8 | + </div> | |
9 | +</div> | ... | ... |
... | ... | @@ -0,0 +1,7 @@ |
1 | +<% if @file.valid? %> | |
2 | + <% klass = @file.class.name.split('::').last.to_css_class %> | |
3 | + jQuery("#published-media .items .<%= klass.pluralize %>").append("<%= j render :partial => "cms/media_panel/#{klass}" %>"); | |
4 | + jQuery("#published-media .items .<%= klass.pluralize %>").show(); | |
5 | +<% else %> | |
6 | + alert("Failed to upload file: <%= j @file.errors.full_messages.join(', ').html_safe %>"); | |
7 | +<% end %> | ... | ... |
public/stylesheets/application.css
... | ... | @@ -3384,21 +3384,25 @@ div.with_media_panel .formfield input[type="checkbox"] { |
3384 | 3384 | padding-bottom: 5px; |
3385 | 3385 | } |
3386 | 3386 | |
3387 | -.upload { | |
3387 | +#media-upload-form .upload { | |
3388 | 3388 | border-top: solid 1px #CCC; |
3389 | 3389 | width: 100%; |
3390 | 3390 | padding-top: 5px; |
3391 | 3391 | margin-top: 5px; |
3392 | 3392 | } |
3393 | 3393 | |
3394 | -.percentage { | |
3394 | +#media-upload-form .percentage { | |
3395 | 3395 | float: right; |
3396 | 3396 | } |
3397 | 3397 | |
3398 | -.bar { | |
3399 | - height: 18px; | |
3398 | +#media-upload-form .bar { | |
3399 | + height: 10px; | |
3400 | 3400 | background: #729fcf; |
3401 | - border-radius: 4px; | |
3401 | + border-radius: 3px; | |
3402 | +} | |
3403 | + | |
3404 | +#media-upload-form input#file { | |
3405 | + width: 100%; | |
3402 | 3406 | } |
3403 | 3407 | |
3404 | 3408 | .text-editor-sidebar { |
... | ... | @@ -3437,6 +3441,11 @@ div.with_media_panel .formfield input[type="checkbox"] { |
3437 | 3441 | margin-bottom: 10px; |
3438 | 3442 | } |
3439 | 3443 | |
3444 | +#published-media .items .images, | |
3445 | +#published-media .items .generics { | |
3446 | + display: none; | |
3447 | +} | |
3448 | + | |
3440 | 3449 | .text-editor-sidebar .items .file { |
3441 | 3450 | background-repeat: no-repeat; |
3442 | 3451 | background-position: 0px 0px; |
... | ... | @@ -3487,7 +3496,7 @@ div.with_media_panel .formfield input[type="checkbox"] { |
3487 | 3496 | } |
3488 | 3497 | .text-editor-sidebar img { |
3489 | 3498 | max-height: 70px; |
3490 | - max-width: 110px; | |
3499 | + max-width: 74px; | |
3491 | 3500 | } |
3492 | 3501 | .text-editor-sidebar .media-upload-error { |
3493 | 3502 | color: red; | ... | ... |