Commit 3ca935240ee08d5d5d650f9d54b74d530d421674
1 parent
231ad8a0
Exists in
master
and in
27 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,8 +322,8 @@ class CmsController < MyProfileController | ||
322 | if request.post? | 322 | if request.post? |
323 | @file = UploadedFile.create(:uploaded_data => params[:file], :profile => profile, :parent => parent) unless params[:file] == '' | 323 | @file = UploadedFile.create(:uploaded_data => params[:file], :profile => profile, :parent => parent) unless params[:file] == '' |
324 | end | 324 | end |
325 | + @file = FilePresenter.for(@file) | ||
325 | #render :text => article_list_to_json([file]), :content_type => 'text/plain' | 326 | #render :text => article_list_to_json([file]), :content_type => 'text/plain' |
326 | - render :text => '' | ||
327 | end | 327 | end |
328 | 328 | ||
329 | protected | 329 | protected |
app/views/cms/_text_editor_sidebar.html.erb
@@ -19,13 +19,21 @@ | @@ -19,13 +19,21 @@ | ||
19 | <p><%= file_field_tag('file', :multiple => true) %></p> | 19 | <p><%= file_field_tag('file', :multiple => true) %></p> |
20 | <% end %> | 20 | <% end %> |
21 | </div> | 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 | </div> | 33 | </div> |
26 | - <p><%= link_to(_('Upload more files ...'), '#', :id => 'media-upload-more-files')%></p> | ||
27 | </div> | 34 | </div> |
28 | </div> | 35 | </div> |
36 | + | ||
29 | <div id='media-search-box' class='text-editor-sidebar-box'> | 37 | <div id='media-search-box' class='text-editor-sidebar-box'> |
30 | <div class='header'><strong><%= _('Media search') %></strong></div> | 38 | <div class='header'><strong><%= _('Media search') %></strong></div> |
31 | <p> | 39 | <p> |
@@ -0,0 +1,9 @@ | @@ -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 @@ | @@ -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,21 +3384,25 @@ div.with_media_panel .formfield input[type="checkbox"] { | ||
3384 | padding-bottom: 5px; | 3384 | padding-bottom: 5px; |
3385 | } | 3385 | } |
3386 | 3386 | ||
3387 | -.upload { | 3387 | +#media-upload-form .upload { |
3388 | border-top: solid 1px #CCC; | 3388 | border-top: solid 1px #CCC; |
3389 | width: 100%; | 3389 | width: 100%; |
3390 | padding-top: 5px; | 3390 | padding-top: 5px; |
3391 | margin-top: 5px; | 3391 | margin-top: 5px; |
3392 | } | 3392 | } |
3393 | 3393 | ||
3394 | -.percentage { | 3394 | +#media-upload-form .percentage { |
3395 | float: right; | 3395 | float: right; |
3396 | } | 3396 | } |
3397 | 3397 | ||
3398 | -.bar { | ||
3399 | - height: 18px; | 3398 | +#media-upload-form .bar { |
3399 | + height: 10px; | ||
3400 | background: #729fcf; | 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 | .text-editor-sidebar { | 3408 | .text-editor-sidebar { |
@@ -3437,6 +3441,11 @@ div.with_media_panel .formfield input[type="checkbox"] { | @@ -3437,6 +3441,11 @@ div.with_media_panel .formfield input[type="checkbox"] { | ||
3437 | margin-bottom: 10px; | 3441 | margin-bottom: 10px; |
3438 | } | 3442 | } |
3439 | 3443 | ||
3444 | +#published-media .items .images, | ||
3445 | +#published-media .items .generics { | ||
3446 | + display: none; | ||
3447 | +} | ||
3448 | + | ||
3440 | .text-editor-sidebar .items .file { | 3449 | .text-editor-sidebar .items .file { |
3441 | background-repeat: no-repeat; | 3450 | background-repeat: no-repeat; |
3442 | background-position: 0px 0px; | 3451 | background-position: 0px 0px; |
@@ -3487,7 +3496,7 @@ div.with_media_panel .formfield input[type="checkbox"] { | @@ -3487,7 +3496,7 @@ div.with_media_panel .formfield input[type="checkbox"] { | ||
3487 | } | 3496 | } |
3488 | .text-editor-sidebar img { | 3497 | .text-editor-sidebar img { |
3489 | max-height: 70px; | 3498 | max-height: 70px; |
3490 | - max-width: 110px; | 3499 | + max-width: 74px; |
3491 | } | 3500 | } |
3492 | .text-editor-sidebar .media-upload-error { | 3501 | .text-editor-sidebar .media-upload-error { |
3493 | color: red; | 3502 | color: red; |