diff --git a/app/controllers/my_profile/cms_controller.rb b/app/controllers/my_profile/cms_controller.rb index c79ce37..7f72766 100644 --- a/app/controllers/my_profile/cms_controller.rb +++ b/app/controllers/my_profile/cms_controller.rb @@ -212,12 +212,12 @@ class CmsController < MyProfileController def media_listing if params[:image_folder_id] folder = profile.articles.find(params[:image_folder_id]) if !params[:image_folder_id].blank? - @images = (folder ? folder.children : UploadedFile.find(:all, :conditions => ["profile_id = ? AND parent_id is NULL", profile ])).select { |c| c.image? } + @images = (folder ? folder.children : UploadedFile.find(:all, :order => 'created_at desc', :conditions => ["profile_id = ? AND parent_id is NULL", profile ])).select { |c| c.image? } elsif params[:document_folder_id] folder = profile.articles.find(params[:document_folder_id]) if !params[:document_folder_id].blank? - @documents = (folder ? folder.children : UploadedFile.find(:all, :conditions => ["profile_id = ? AND parent_id is NULL", profile ])).select { |c| c.kind_of?(UploadedFile) && !c.image? } + @documents = (folder ? folder.children : UploadedFile.find(:all, :order => 'created_at desc', :conditions => ["profile_id = ? AND parent_id is NULL", profile ])).select { |c| c.kind_of?(UploadedFile) && !c.image? } else - @documents = UploadedFile.find(:all, :conditions => ["profile_id = ? AND parent_id is NULL", profile ]) + @documents = UploadedFile.find(:all, :order => 'created_at desc', :conditions => ["profile_id = ? AND parent_id is NULL", profile ]) @images = @documents.select(&:image?) @documents -= @images end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a96b35b..1509efa 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -519,8 +519,8 @@ module ApplicationHelper content_tag('div', result) end - def select_folder(object, method, collection, html_options = {}, js_options = {}) - labelled_form_field(_('Folder'), select(object, method, collection.map {|f| [ profile.identifier + '/' + f.full_name, f.id ] }, html_options.merge({:include_blank => "#{profile.identifier}"}), js_options)) + def select_folder(label, object, method, collection, html_options = {}, js_options = {}) + labelled_form_field(label, select(object, method, collection.map {|f| [ profile.identifier + '/' + f.full_name, f.id ] }, html_options.merge({:include_blank => "#{profile.identifier}"}), js_options)) end def theme_option(opt = nil) diff --git a/app/views/cms/media_listing.rhtml b/app/views/cms/media_listing.rhtml index 81cc965..d5cb1f1 100644 --- a/app/views/cms/media_listing.rhtml +++ b/app/views/cms/media_listing.rhtml @@ -30,22 +30,9 @@ } registerDocumentSize(); -
-
-

<%= _('Images') %>

- <%= select_folder('folder', 'image_folder_id', @image_folders, {}, :onchange => remote_function(:with => "'image_folder_id=' + value + '&ipage=1'", :url => { :action => :media_listing, :format => 'js' }) ) %> - <%= render :partial => 'image_thumb', :locals => { :images => @images } %> -
-
-

<%= _('Documents') %>

- <%= select_folder('folder', 'document_folder_id', @document_folders, {}, :onchange => remote_function(:with => "'document_folder_id=' + value + '&dpage=1'", :url => { :action => :media_listing }) ) %> - <%= render :partial => 'document_link', :locals => { :documents => @documents } %> -
-
-

<%= _('Drag images and documents to add them to the text.') %>

-
-
+

<%= _("Include files in some folder or select from the list below to add images and documents to the text editor beside (max size %s)") % UploadedFile.max_size.to_humanreadable %>

+ +
+
+

<%= _('Folders') %>

+

<%= _('Drag images and documents to add them to the text. If needed, resize images by clicking the tree icon on editor.') %>

+ +
+

<%= _('Images') %>

+ <%= select_folder('', 'folder', 'image_folder_id', @image_folders, {}, :onchange => remote_function(:with => "'image_folder_id=' + value + '&ipage=1'", :url => { :action => :media_listing, :format => 'js' }) ) %> + <%= render :partial => 'image_thumb', :locals => { :images => @images } %> +
+
+

<%= _('Documents') %>

+ <%= select_folder('', 'folder', 'document_folder_id', @document_folders, {}, :onchange => remote_function(:with => "'document_folder_id=' + value + '&dpage=1'", :url => { :action => :media_listing }) ) %> + <%= render :partial => 'document_link', :locals => { :documents => @documents } %> +
+
+
diff --git a/app/views/tasks/_approve_article.rhtml b/app/views/tasks/_approve_article.rhtml index de2cc3c..c25a11b 100644 --- a/app/views/tasks/_approve_article.rhtml +++ b/app/views/tasks/_approve_article.rhtml @@ -21,7 +21,7 @@ <%= labelled_form_field _('Name for publishing'), f.text_field(:name, :style => 'width:80%;') %> - <%= labelled_form_field(_('Select the folder where the article must be published'), select_folder('task', 'article_parent_id', task.target.folders)) %> + <%= select_folder(_('Select the folder where the article must be published'), 'task', 'article_parent_id', task.target.folders) %> <%= labelled_form_field( _('Highlight'), check_box_tag(:highlighted, true)) %> <%= labelled_form_field _('Comment for author'), f.text_area(:closing_statment, :style => 'height:200px; width:80%;') %> diff --git a/public/stylesheets/media_listing.css b/public/stylesheets/media_listing.css index 8447194..ec9965c 100644 --- a/public/stylesheets/media_listing.css +++ b/public/stylesheets/media_listing.css @@ -5,12 +5,11 @@ body { font-size: 14px; color: #444; background-color: #F0F0EE; - border: 1px solid #CCC; overflow: hidden; } h3, h4, h5 { - margin: 10px 0px; + margin: 5px 0px; } h3 { @@ -23,14 +22,16 @@ h4 { #media-listing { width: 100%; - height: 65%; + height: 48%; margin: 0px; padding: 0px; - border-bottom: 2px solid #444; + padding-bottom: 5px; } +#media-listing-upload p, #media-listing p { - font-size: 14px; + font-size: 13px; + font-weight: bold; margin: 5px 5px; } @@ -48,9 +49,7 @@ h4 { } #media-listing-images { - margin-top: 2px; width: 46%; - height: 80%; float: left; text-align: center; } @@ -66,40 +65,43 @@ h4 { height: 60px; } -#media-listing-folder-images { - height: 75%; +#media-listing-folder-images, +#media-listing-folder-documents { + height: 80%; } #media-listing ul { padding: 0px; margin: 5px; - height: 65%; + height: 40%; overflow: auto; width: 98%; } +#media-listing ul { + height: 85%; +} + +#media-listing-images, +#media-listing-documents { + height: 55%; +} + #media-listing-documents ul { text-align: left; } #media-listing-documents { - margin: 2px 0px 0px 2px; width: 52%; - height: 80%; float: left; text-align: center; } -#media-listing-folder-documents { - height: 75%; -} - #media-listing-folder-documents img { border: none; } #media-listing-upload { - height: 38%; width: 98%; padding: 3px; } @@ -116,6 +118,7 @@ h4 { overflow-x: hidden; overflow-y: scroll; height: 100px; + margin-top: 5px; } .msie #uploaded_files { @@ -133,7 +136,7 @@ h4 { div#notice { background: #fee; border: 1px solid #933; - bottom: 150px; + top: 150px; color: black; cursor: pointer; font-weight: bold; -- libgit2 0.21.2