diff --git a/Gemfile b/Gemfile
index 40270a73..30dd9e67 100644
--- a/Gemfile
+++ b/Gemfile
@@ -2,6 +2,7 @@ source 'http://rubygems.org'
gem 'rails', '>=3.1.0', '<3.2.0'
gem "brakeman"
+gem 'mime-types'
gem 'bson_ext'
gem 'carrierwave'
@@ -24,6 +25,7 @@ gem "mongo_session_store-rails3"
gem 'mysql2'
gem 'nokogiri'
+
gem 'radius'
gem 'rake'
# gem 'remotipart'
diff --git a/app/assets/javascripts/orbitdesktop.js b/app/assets/javascripts/orbitdesktop.js
index f6ac193c..5a081dd8 100755
--- a/app/assets/javascripts/orbitdesktop.js
+++ b/app/assets/javascripts/orbitdesktop.js
@@ -956,13 +956,17 @@ var orbitDesktop = function(dom){
var abstractview = function(){
$("#journal_p div#paper_list div.overview").empty();
var column = $('
'),
+ counter = 1,
li;
$.each(journalData,function(i,journal){
$.each(journal.papers,function(j,paper){
- li = $(''+paper.title+'
'+paper.abstract+paper.abstract+'
');
+ li = $(''+paper.title+'
'+paper.abstract+'
');
column.find("ul").append(li);
- $("#journal_p div#paper_list div.overview").append(column);
- column = $('');
+ if(counter%5==0){
+ $("#journal_p div#paper_list div.overview").append(column);
+ column = $('');
+ }
+ counter++;
})
})
$("#journal_p div#paper_list div.overview").append(column);
diff --git a/app/controllers/desktop_publications_controller.rb b/app/controllers/desktop_publications_controller.rb
index d89f0ee4..eca77543 100644
--- a/app/controllers/desktop_publications_controller.rb
+++ b/app/controllers/desktop_publications_controller.rb
@@ -1,3 +1,5 @@
+require 'mime/types'
+
class DesktopPublicationsController< ApplicationController
def journal_p
render "desktop/journal_p", :layout => false
@@ -42,12 +44,34 @@ class DesktopPublicationsController< ApplicationController
render :json=>b.to_json
end
+ def check_file_type file
+ if not file.nil?
+ file_type = MIME::Types.type_for(file).first.to_s.split("/")[1]
+
+ case file_type
+ when "jpg", "jpeg"
+ type = "jpg"
+ when "text", "txt"
+ type = "txt"
+ when "pdf"
+ type = "pdf"
+ when "png"
+ type = "png"
+ else "readme"
+ end
+
+ file_type = "/assets/ft-icons/#{type}/#{type}-48_32.png"
+ else
+ file_type = ""
+ end
+ end
+
def getjournals
publications = WritingJournal.where(:create_user_id => current_user.id)
sort_publications= Hash.new
data = Array.new
- icon_size = "128_32"
+
publications.each do |publication|
if sort_publications[publication.journal_title].nil?
sort_publications[publication.journal_title] = Array.new
@@ -60,7 +84,7 @@ class DesktopPublicationsController< ApplicationController
coauthors: publication.authors,
year: publication.year,
files: publication.writing_journal_files.collect{|file|
- {title: file.title, url: file.file.url, icon: "/assets/ft-icons/jpg/jpg-48_32.png"}
+ {title: file.title, url: file.file.url, icon: check_file_type(file.file.url)}
}
}
end