diff --git a/Gemfile b/Gemfile
index 35f19b90ca20f0547204f1613091dda58278fef5..43a380a159c7075835da3bd72b1430ea344b9545 100644
--- a/Gemfile
+++ b/Gemfile
@@ -112,3 +112,13 @@ group :test do
   gem 'shoulda'
   gem 'shoulda-callback-matchers', '~> 1.1.1'
 end
+
+gem 'streamio-ffmpeg', '~> 1.0.0'
+
+# sidekiq
+gem 'sidekiq'
+gem 'sinatra', require: false
+gem 'slim'
+
+# CUrl
+gem 'curb', '~> 0.8.8'
diff --git a/Gemfile.lock b/Gemfile.lock
new file mode 100644
index 0000000000000000000000000000000000000000..cea3c858ee916e8157c41c1f6daa194ad48e8ca2
--- /dev/null
+++ b/Gemfile.lock
@@ -0,0 +1,351 @@
+GEM
+  remote: https://rubygems.org/
+  specs:
+    abstract_type (0.0.7)
+    actionmailer (4.2.0)
+      actionpack (= 4.2.0)
+      actionview (= 4.2.0)
+      activejob (= 4.2.0)
+      mail (~> 2.5, >= 2.5.4)
+      rails-dom-testing (~> 1.0, >= 1.0.5)
+    actionpack (4.2.0)
+      actionview (= 4.2.0)
+      activesupport (= 4.2.0)
+      rack (~> 1.6.0)
+      rack-test (~> 0.6.2)
+      rails-dom-testing (~> 1.0, >= 1.0.5)
+      rails-html-sanitizer (~> 1.0, >= 1.0.1)
+    actionview (4.2.0)
+      activesupport (= 4.2.0)
+      builder (~> 3.1)
+      erubis (~> 2.7.0)
+      rails-dom-testing (~> 1.0, >= 1.0.5)
+      rails-html-sanitizer (~> 1.0, >= 1.0.1)
+    activejob (4.2.0)
+      activesupport (= 4.2.0)
+      globalid (>= 0.3.0)
+    activemodel (4.2.0)
+      activesupport (= 4.2.0)
+      builder (~> 3.1)
+    activerecord (4.2.0)
+      activemodel (= 4.2.0)
+      activesupport (= 4.2.0)
+      arel (~> 6.0)
+    activesupport (4.2.0)
+      i18n (~> 0.7)
+      json (~> 1.7, >= 1.7.7)
+      minitest (~> 5.1)
+      thread_safe (~> 0.3, >= 0.3.4)
+      tzinfo (~> 1.1)
+    adamantium (0.2.0)
+      ice_nine (~> 0.11.0)
+      memoizable (~> 0.4.0)
+    arel (6.0.3)
+    ast (2.1.0)
+    autoprefixer-rails (6.0.3)
+      execjs
+      json
+    axiom-types (0.1.1)
+      descendants_tracker (~> 0.0.4)
+      ice_nine (~> 0.11.0)
+      thread_safe (~> 0.3, >= 0.3.1)
+    bcrypt (3.1.10)
+    better_errors (2.1.1)
+      coderay (>= 1.0.0)
+      erubis (>= 2.6.6)
+      rack (>= 0.9.0)
+    binding_of_caller (0.7.2)
+      debug_inspector (>= 0.0.1)
+    bootstrap-sass (3.3.5.1)
+      autoprefixer-rails (>= 5.0.0.1)
+      sass (>= 3.3.0)
+    builder (3.2.2)
+    bullet (4.14.7)
+      activesupport (>= 3.0.0)
+      uniform_notifier (~> 1.9.0)
+    byebug (6.0.2)
+    chart-js-rails (0.0.9)
+      railties (> 3.1)
+    chronic (0.10.2)
+    climate_control (0.0.3)
+      activesupport (>= 3.0)
+    cocaine (0.5.7)
+      climate_control (>= 0.0.3, < 1.0)
+    coderay (1.1.0)
+    coercible (1.0.0)
+      descendants_tracker (~> 0.0.1)
+    coffee-rails (4.1.0)
+      coffee-script (>= 2.2.0)
+      railties (>= 4.0.0, < 5.0)
+    coffee-script (2.4.1)
+      coffee-script-source
+      execjs
+    coffee-script-source (1.9.1.1)
+    concord (0.1.5)
+      adamantium (~> 0.2.0)
+      equalizer (~> 0.0.9)
+    curb (0.8.8)
+    debug_inspector (0.0.2)
+    descendants_tracker (0.0.4)
+      thread_safe (~> 0.3, >= 0.3.1)
+    devise (3.5.1)
+      bcrypt (~> 3.0)
+      orm_adapter (~> 0.1)
+      railties (>= 3.2.6, < 5)
+      responders
+      thread_safe (~> 0.1)
+      warden (~> 1.2.3)
+    devise_token_auth (0.1.34)
+      devise (= 3.5.1)
+      rails (~> 4.2)
+    diff-lcs (1.2.5)
+    domain_name (0.5.24)
+      unf (>= 0.0.5, < 1.0.0)
+    dspace_rest_client (1.1.2)
+      curb (~> 0.8.6)
+      rest-client (>= 1.7, < 2)
+    equalizer (0.0.11)
+    erubis (2.7.0)
+    execjs (2.6.0)
+    fast_stack (0.1.0)
+      rake
+      rake-compiler
+    flamegraph (0.1.0)
+      fast_stack
+    flay (2.4.0)
+      ruby_parser (~> 3.0)
+      sexp_processor (~> 4.0)
+    flog (4.2.1)
+      ruby_parser (~> 3.1, > 3.1.0)
+      sexp_processor (~> 4.4)
+    globalid (0.3.6)
+      activesupport (>= 4.1.0)
+    gruff (0.6.0)
+      rmagick (>= 2.13.4)
+    http-cookie (1.0.2)
+      domain_name (~> 0.5)
+    i18n (0.7.0)
+    ice_nine (0.11.1)
+    jbuilder (2.3.1)
+      activesupport (>= 3.0.0, < 5)
+      multi_json (~> 1.2)
+    jquery-rails (4.0.5)
+      rails-dom-testing (~> 1.0)
+      railties (>= 4.2.0)
+      thor (>= 0.14, < 2.0)
+    jquery-turbolinks (2.1.0)
+      railties (>= 3.1.0)
+      turbolinks
+    json (1.8.3)
+    libv8 (3.16.14.11)
+    locastyle (0.0.1)
+    loofah (2.0.3)
+      nokogiri (>= 1.5.9)
+    mail (2.6.3)
+      mime-types (>= 1.16, < 3)
+    memoizable (0.4.2)
+      thread_safe (~> 0.3, >= 0.3.1)
+    mime-types (2.6.2)
+    mimemagic (0.3.0)
+    mina (0.3.7)
+      open4 (~> 1.3.4)
+      rake
+    mini_portile (0.6.2)
+    minitest (5.8.1)
+    multi_json (1.11.2)
+    netrc (0.10.3)
+    nokogiri (1.6.6.2)
+      mini_portile (~> 0.6.0)
+    open4 (1.3.4)
+    orientdb4r (0.5.1)
+      rest-client (~> 1.7)
+    orm_adapter (0.5.0)
+    paperclip (4.3.1)
+      activemodel (>= 3.2.0)
+      activesupport (>= 3.2.0)
+      cocaine (~> 0.5.5)
+      mime-types
+      mimemagic (= 0.3.0)
+    parser (2.2.2.6)
+      ast (>= 1.1, < 3.0)
+    pg (0.18.3)
+    procto (0.0.2)
+    puma (2.14.0)
+    rack (1.6.4)
+    rack-cors (0.4.0)
+    rack-mini-profiler (0.9.7)
+      rack (>= 1.1.3)
+    rack-test (0.6.3)
+      rack (>= 1.0)
+    rails (4.2.0)
+      actionmailer (= 4.2.0)
+      actionpack (= 4.2.0)
+      actionview (= 4.2.0)
+      activejob (= 4.2.0)
+      activemodel (= 4.2.0)
+      activerecord (= 4.2.0)
+      activesupport (= 4.2.0)
+      bundler (>= 1.3.0, < 2.0)
+      railties (= 4.2.0)
+      sprockets-rails
+    rails-deprecated_sanitizer (1.0.3)
+      activesupport (>= 4.2.0.alpha)
+    rails-dom-testing (1.0.7)
+      activesupport (>= 4.2.0.beta, < 5.0)
+      nokogiri (~> 1.6.0)
+      rails-deprecated_sanitizer (>= 1.0.1)
+    rails-html-sanitizer (1.0.2)
+      loofah (~> 2.0)
+    railties (4.2.0)
+      actionpack (= 4.2.0)
+      activesupport (= 4.2.0)
+      rake (>= 0.8.7)
+      thor (>= 0.18.1, < 2.0)
+    rainbow (2.0.0)
+    rake (10.4.2)
+    rake-compiler (0.9.5)
+      rake
+    rdoc (4.2.0)
+    reek (1.6.5)
+      parser (~> 2.2.0.pre.7)
+      rainbow (>= 1.99, < 3.0)
+      unparser (~> 0.2.2)
+    ref (2.0.0)
+    responders (2.1.0)
+      railties (>= 4.2.0, < 5)
+    rest-client (1.8.0)
+      http-cookie (>= 1.0.2, < 2.0)
+      mime-types (>= 1.16, < 3.0)
+      netrc (~> 0.7)
+    rmagick (2.15.4)
+    rsolr (1.0.12)
+      builder (>= 2.1.2)
+    ruby_parser (3.7.1)
+      sexp_processor (~> 4.1)
+    rubycritic (1.4.0)
+      flay (= 2.4.0)
+      flog (= 4.2.1)
+      parser (>= 2.2.0, < 3.0)
+      reek (= 1.6.5)
+      virtus (~> 1.0)
+    sass (3.4.18)
+    sass-rails (5.0.4)
+      railties (>= 4.0.0, < 5.0)
+      sass (~> 3.1)
+      sprockets (>= 2.8, < 4.0)
+      sprockets-rails (>= 2.0, < 4.0)
+      tilt (>= 1.1, < 3)
+    sdoc (0.4.1)
+      json (~> 1.7, >= 1.7.7)
+      rdoc (~> 4.0)
+    select2-rails (4.0.0)
+      thor (~> 0.14)
+    sexp_processor (4.6.0)
+    shoulda (3.5.0)
+      shoulda-context (~> 1.0, >= 1.0.1)
+      shoulda-matchers (>= 1.4.1, < 3.0)
+    shoulda-callback-matchers (1.1.3)
+      activesupport (>= 3)
+    shoulda-context (1.2.1)
+    shoulda-matchers (2.8.0)
+      activesupport (>= 3.0.0)
+    spring (1.4.0)
+    sprockets (3.3.5)
+      rack (> 1, < 3)
+    sprockets-rails (2.3.3)
+      actionpack (>= 3.0)
+      activesupport (>= 3.0)
+      sprockets (>= 2.8, < 4.0)
+    sqlite3 (1.3.10)
+    stackprof (0.2.7)
+    therubyracer (0.12.2)
+      libv8 (~> 3.16.14.0)
+      ref
+    thor (0.19.1)
+    thread_safe (0.3.5)
+    tilt (2.0.1)
+    turbolinks (2.5.3)
+      coffee-rails
+    tzinfo (1.2.2)
+      thread_safe (~> 0.1)
+    uglifier (2.7.2)
+      execjs (>= 0.3.0)
+      json (>= 1.8.0)
+    unf (0.1.4)
+      unf_ext
+    unf_ext (0.0.7.1)
+    uniform_notifier (1.9.0)
+    unparser (0.2.4)
+      abstract_type (~> 0.0.7)
+      adamantium (~> 0.2.0)
+      concord (~> 0.1.5)
+      diff-lcs (~> 1.2.5)
+      equalizer (~> 0.0.9)
+      parser (~> 2.2.2)
+      procto (~> 0.0.2)
+    virtus (1.0.5)
+      axiom-types (~> 0.1)
+      coercible (~> 1.0)
+      descendants_tracker (~> 0.0, >= 0.0.3)
+      equalizer (~> 0.0, >= 0.0.9)
+    warden (1.2.3)
+      rack (>= 1.0)
+    web-console (2.2.1)
+      activemodel (>= 4.0)
+      binding_of_caller (>= 0.7.2)
+      railties (>= 4.0)
+      sprockets-rails (>= 2.0, < 4.0)
+    whenever (0.9.4)
+      chronic (>= 0.6.3)
+    will_paginate (3.0.7)
+
+PLATFORMS
+  ruby
+
+DEPENDENCIES
+  bcrypt (~> 3.1.7)
+  better_errors
+  bootstrap-sass
+  bullet
+  byebug
+  chart-js-rails
+  coffee-rails (~> 4.1.0)
+  devise
+  devise_token_auth
+  dspace_rest_client (~> 1.1.0)
+  execjs
+  flamegraph
+  gruff
+  jbuilder (~> 2.0)
+  jquery-rails
+  jquery-turbolinks
+  locastyle
+  mina
+  orientdb4r
+  paperclip
+  pg
+  puma
+  rack-cors
+  rack-mini-profiler
+  rails (= 4.2.0)
+  rdoc
+  rmagick
+  rsolr (~> 1.0.12)
+  rubycritic
+  sass-rails (~> 5.0)
+  sdoc (~> 0.4.0)
+  select2-rails
+  shoulda
+  shoulda-callback-matchers (~> 1.1.1)
+  spring
+  sqlite3
+  stackprof
+  therubyracer
+  turbolinks
+  uglifier (>= 1.3.0)
+  web-console (~> 2.0)
+  whenever
+  will_paginate (~> 3.0.5)
+
+BUNDLED WITH
+   1.10.6
diff --git a/app/assets/images/icons/collection-add.png b/app/assets/images/icons/collection-add.png
new file mode 100644
index 0000000000000000000000000000000000000000..1fa684519e819dd3fe909bce96375fad0b335193
Binary files /dev/null and b/app/assets/images/icons/collection-add.png differ
diff --git a/app/assets/images/icons/collection-download.png b/app/assets/images/icons/collection-download.png
new file mode 100644
index 0000000000000000000000000000000000000000..ad972bdd8a05349a39e45731032a2e14a7eb496e
Binary files /dev/null and b/app/assets/images/icons/collection-download.png differ
diff --git a/app/assets/images/icons/collection-fast.png b/app/assets/images/icons/collection-fast.png
new file mode 100644
index 0000000000000000000000000000000000000000..f6ab41783c1e3c7c4e2191d3a35e5c7e2b79d017
Binary files /dev/null and b/app/assets/images/icons/collection-fast.png differ
diff --git a/app/assets/images/icons/collection-items.png b/app/assets/images/icons/collection-items.png
new file mode 100644
index 0000000000000000000000000000000000000000..22190a91f0866488651423c67da56d54d411910f
Binary files /dev/null and b/app/assets/images/icons/collection-items.png differ
diff --git a/app/assets/images/icons/collection-remove.png b/app/assets/images/icons/collection-remove.png
new file mode 100644
index 0000000000000000000000000000000000000000..863bb099f22a6c7c57bb6239727231ecb41b1f30
Binary files /dev/null and b/app/assets/images/icons/collection-remove.png differ
diff --git a/app/assets/images/icons/collection.png b/app/assets/images/icons/collection.png
new file mode 100644
index 0000000000000000000000000000000000000000..ba020f3199a45af971987ad77a5cfb83f8a81609
Binary files /dev/null and b/app/assets/images/icons/collection.png differ
diff --git a/app/assets/images/icons/comments.png b/app/assets/images/icons/comments.png
new file mode 100644
index 0000000000000000000000000000000000000000..d6e736420a7c5d71982c603cc471733e680135b0
Binary files /dev/null and b/app/assets/images/icons/comments.png differ
diff --git a/app/assets/images/icons/contrast.png b/app/assets/images/icons/contrast.png
new file mode 100644
index 0000000000000000000000000000000000000000..acb1f5b8447cf69fbf2645a3b1bb6f215d0ee684
Binary files /dev/null and b/app/assets/images/icons/contrast.png differ
diff --git a/app/assets/images/icons/download.png b/app/assets/images/icons/download.png
new file mode 100644
index 0000000000000000000000000000000000000000..af9243b430f11515a84a224bcae47b93ef11f1e0
Binary files /dev/null and b/app/assets/images/icons/download.png differ
diff --git a/app/assets/images/icons/filter.png b/app/assets/images/icons/filter.png
new file mode 100644
index 0000000000000000000000000000000000000000..1bf31b8cebf7fdfdfd922676ce2a95c6e74bc408
Binary files /dev/null and b/app/assets/images/icons/filter.png differ
diff --git a/app/assets/images/icons/font-minus.png b/app/assets/images/icons/font-minus.png
new file mode 100644
index 0000000000000000000000000000000000000000..53c8d5c33d9671bc2e0ee4f3ac95de40b75307ac
Binary files /dev/null and b/app/assets/images/icons/font-minus.png differ
diff --git a/app/assets/images/icons/font-plus.png b/app/assets/images/icons/font-plus.png
new file mode 100644
index 0000000000000000000000000000000000000000..e0d32fd6f4a2a6d60bdbaa0c4c4e8641d23eff71
Binary files /dev/null and b/app/assets/images/icons/font-plus.png differ
diff --git a/app/assets/images/icons/report-circle.png b/app/assets/images/icons/report-circle.png
new file mode 100644
index 0000000000000000000000000000000000000000..d5d078817dca175f6f9a01ec9271ca44da5c1f6c
Binary files /dev/null and b/app/assets/images/icons/report-circle.png differ
diff --git a/app/assets/images/icons/report.png b/app/assets/images/icons/report.png
new file mode 100644
index 0000000000000000000000000000000000000000..a26bb4aab44e9806465f0f69dfc60c18e661b66f
Binary files /dev/null and b/app/assets/images/icons/report.png differ
diff --git a/app/assets/images/icons/search.png b/app/assets/images/icons/search.png
new file mode 100644
index 0000000000000000000000000000000000000000..3faefcad4dded07baee7fe6a7da06cc0842f137c
Binary files /dev/null and b/app/assets/images/icons/search.png differ
diff --git a/app/assets/images/icons/selection-copy.png b/app/assets/images/icons/selection-copy.png
new file mode 100644
index 0000000000000000000000000000000000000000..1dabd051939bc6c97786f3e2246aebf7cdefcd81
Binary files /dev/null and b/app/assets/images/icons/selection-copy.png differ
diff --git a/app/assets/images/icons/selection-download.png b/app/assets/images/icons/selection-download.png
new file mode 100644
index 0000000000000000000000000000000000000000..46168302edc3557bdcdccd1aea08111881defe07
Binary files /dev/null and b/app/assets/images/icons/selection-download.png differ
diff --git a/app/assets/images/icons/selection-move.png b/app/assets/images/icons/selection-move.png
new file mode 100644
index 0000000000000000000000000000000000000000..f242b1b3397e00100c0f9db08fb442b28b2d710b
Binary files /dev/null and b/app/assets/images/icons/selection-move.png differ
diff --git a/app/assets/images/icons/star-gold.png b/app/assets/images/icons/star-gold.png
new file mode 100644
index 0000000000000000000000000000000000000000..14d216f875885a2b3ab8f92ff7129b139da0363e
Binary files /dev/null and b/app/assets/images/icons/star-gold.png differ
diff --git a/app/assets/images/icons/star-grey.png b/app/assets/images/icons/star-grey.png
new file mode 100644
index 0000000000000000000000000000000000000000..d56e678777363b947eee5f8a534a6a5bce87ee13
Binary files /dev/null and b/app/assets/images/icons/star-grey.png differ
diff --git a/app/assets/images/icons/upload-add.png b/app/assets/images/icons/upload-add.png
new file mode 100644
index 0000000000000000000000000000000000000000..5e458c3752b65e7a12d98904ee033fc193a604ab
Binary files /dev/null and b/app/assets/images/icons/upload-add.png differ
diff --git a/app/assets/images/icons/upload.png b/app/assets/images/icons/upload.png
new file mode 100644
index 0000000000000000000000000000000000000000..ed76e10e18e65b5f1521311c21331b6e3cfeec31
Binary files /dev/null and b/app/assets/images/icons/upload.png differ
diff --git a/app/assets/images/icons/visualization.png b/app/assets/images/icons/visualization.png
new file mode 100644
index 0000000000000000000000000000000000000000..12a1183a472acb3b7e77d2afb241ab54b7fc8288
Binary files /dev/null and b/app/assets/images/icons/visualization.png differ
diff --git a/app/assets/images/learning-object-preview-large.png b/app/assets/images/learning-object-preview-large.png
new file mode 100644
index 0000000000000000000000000000000000000000..bbfb4087443833a867e3257ad5e6e3bee5492d64
Binary files /dev/null and b/app/assets/images/learning-object-preview-large.png differ
diff --git a/app/assets/images/learning-object-preview.png b/app/assets/images/learning-object-preview.png
new file mode 100644
index 0000000000000000000000000000000000000000..4b52e2eb2c0448bbbc602e0d4d7e42ba7909bd94
Binary files /dev/null and b/app/assets/images/learning-object-preview.png differ
diff --git a/app/assets/javascripts/application/accessibility.js b/app/assets/javascripts/application/accessibility.js
index 7e240dc34bbaee04b3fa5bc7d973370b38682fd9..ccf9bf19d494131a5fbf278a52ccb2e963e9c965 100644
--- a/app/assets/javascripts/application/accessibility.js
+++ b/app/assets/javascripts/application/accessibility.js
@@ -18,6 +18,9 @@ var fontSize = function() {
       reloadFontSize(size_c);
     });
   }
+  else {
+    createCookie('fontSize', 0, 365);
+  }
 
   function reloadFontSize(size) {
     var i = 0;
diff --git a/app/assets/javascripts/application/learning_objects.coffee b/app/assets/javascripts/application/learning_objects.coffee
index 019c35f9309439fc6df4d3bf79c67e228b5ef287..b50f394bdc37e5076efe2796d8e44d89eaec4d13 100644
--- a/app/assets/javascripts/application/learning_objects.coffee
+++ b/app/assets/javascripts/application/learning_objects.coffee
@@ -3,6 +3,5 @@ $ ->
     html: true
     content: ->
       $('#collections_list_popover').html()
-    title: ->
-      $('#collections_list_popover_title').html()
-  return
\ No newline at end of file
+
+  return
diff --git a/app/assets/javascripts/application/search.js b/app/assets/javascripts/application/search.js
new file mode 100644
index 0000000000000000000000000000000000000000..ed6954101b77e8467e0340a47d99004749a9acd4
--- /dev/null
+++ b/app/assets/javascripts/application/search.js
@@ -0,0 +1,20 @@
+$(document).ready(function () {
+    $(".select-tag-container").select2();
+
+    var runDropdown = function (element) {
+        if ($(element).next().is(':hidden')) {
+            $('> .caret', element).addClass('caret-up');
+            $(element).next().slideDown();
+        }
+        else {
+            $('> .caret', element).removeClass('caret-up');
+            $(element).next().slideUp();
+        }
+    };
+
+    runDropdown($('.nestedAccordion .dropdown'));
+
+    $('.nestedAccordion .dropdown').click(function () {
+        runDropdown(this);
+    });
+});
diff --git a/app/assets/javascripts/application/users.coffee b/app/assets/javascripts/application/users.coffee
new file mode 100644
index 0000000000000000000000000000000000000000..521a0c47b2c50cb7ea2038ec21a21da977e6ba6c
--- /dev/null
+++ b/app/assets/javascripts/application/users.coffee
@@ -0,0 +1,4 @@
+$('a.showmore').on 'click', ->
+  $('span', this).toggle()
+  $('.user-biography').slideToggle()
+  return
\ No newline at end of file
diff --git a/app/assets/javascripts/edges.coffee b/app/assets/javascripts/edges.coffee
deleted file mode 100644
index 24f83d18bbd38c24c4f7c3c2fc360cd68e857a2a..0000000000000000000000000000000000000000
--- a/app/assets/javascripts/edges.coffee
+++ /dev/null
@@ -1,3 +0,0 @@
-# Place all the behaviors and hooks related to the matching controller here.
-# All this logic will automatically be available in application.js.
-# You can use CoffeeScript in this file: http://coffeescript.org/
diff --git a/app/assets/javascripts/management/carousel.coffee b/app/assets/javascripts/management/carousel.coffee
deleted file mode 100644
index 24f83d18bbd38c24c4f7c3c2fc360cd68e857a2a..0000000000000000000000000000000000000000
--- a/app/assets/javascripts/management/carousel.coffee
+++ /dev/null
@@ -1,3 +0,0 @@
-# Place all the behaviors and hooks related to the matching controller here.
-# All this logic will automatically be available in application.js.
-# You can use CoffeeScript in this file: http://coffeescript.org/
diff --git a/app/assets/javascripts/registrations.coffee b/app/assets/javascripts/registrations.coffee
deleted file mode 100644
index 24f83d18bbd38c24c4f7c3c2fc360cd68e857a2a..0000000000000000000000000000000000000000
--- a/app/assets/javascripts/registrations.coffee
+++ /dev/null
@@ -1,3 +0,0 @@
-# Place all the behaviors and hooks related to the matching controller here.
-# All this logic will automatically be available in application.js.
-# You can use CoffeeScript in this file: http://coffeescript.org/
diff --git a/app/assets/javascripts/university.coffee b/app/assets/javascripts/university.coffee
deleted file mode 100644
index 24f83d18bbd38c24c4f7c3c2fc360cd68e857a2a..0000000000000000000000000000000000000000
--- a/app/assets/javascripts/university.coffee
+++ /dev/null
@@ -1,3 +0,0 @@
-# Place all the behaviors and hooks related to the matching controller here.
-# All this logic will automatically be available in application.js.
-# You can use CoffeeScript in this file: http://coffeescript.org/
diff --git a/app/assets/javascripts/users.coffee b/app/assets/javascripts/users.coffee
deleted file mode 100644
index 24f83d18bbd38c24c4f7c3c2fc360cd68e857a2a..0000000000000000000000000000000000000000
--- a/app/assets/javascripts/users.coffee
+++ /dev/null
@@ -1,3 +0,0 @@
-# Place all the behaviors and hooks related to the matching controller here.
-# All this logic will automatically be available in application.js.
-# You can use CoffeeScript in this file: http://coffeescript.org/
diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss
index 6d2ae1d0fa2864242860ed5675f5c2b57178b638..28ab9c33b2a629ab6dbf8fb75e10221087d034d3 100644
--- a/app/assets/stylesheets/application.scss
+++ b/app/assets/stylesheets/application.scss
@@ -19,6 +19,7 @@
 @import "select2-bootstrap";
 
 $header-blue: #1676bc;
+$link-grey: #343D3E;
 
 //// HTML/BODY
 html,
@@ -28,13 +29,24 @@ body {
 	height:100%;
 
   font-size: 100%;
+	font-weight: 300;
   font-family: 'Roboto', "Helvetica Neue", Helvetica, Arial, sans-serif;
 }
 
+h1, h2, h3, h4, h5, h6 {
+	margin: 0;
+	font-weight: 300;
+}
+
 a, a:focus, a:hover {
+	font-weight: 400;
 	color: #000;
 }
 
+.media-heading {
+	font-weight: 400;
+}
+
 .caret {
 	border-left: 7px solid transparent;
 	border-right: 7px solid transparent;
@@ -88,14 +100,13 @@ header {
 		}
 		.logo {
       margin-top: 10px;
-      padding: 0px;
-			// font-size: 24px;
-      font-weight: bold;
+      padding: 0;
 			text-align: center;
 			float: left;
 			width: 165px;
 			h3 {
 				margin-top: 10px;
+	      font-weight: 400;
 			}
       a {
 			 color: #FFF;
diff --git a/app/assets/stylesheets/application/learning_objects.scss b/app/assets/stylesheets/application/learning_objects.scss
index 30ec3e3144c4bc92c36fa7eb5e72463eda369283..0fec4dee3d3a7585dc5c04ceb10d97b475fe7c77 100644
--- a/app/assets/stylesheets/application/learning_objects.scss
+++ b/app/assets/stylesheets/application/learning_objects.scss
@@ -1,13 +1,104 @@
+
+$background-grey: #e7e7e8;
+
 .learning-object-horizontal, .learning-object-vertical {
-	margin-bottom: 20px;
-  
+  margin-bottom: 20px;
+
+
   .panel-body {
     padding: 0 !important;
     margin-top: 3px;
   }
+
   .media-heading {
     overflow: hidden;
     white-space: nowrap;
     text-overflow: ellipsis;
   }
+
+
+  .learning-object-thumbnail {
+    min-width: 250px;
+    height: 141px;
+    position: relative;
+
+    .learning-object-actions {
+      position: absolute;
+      bottom: 5px;
+      right: 5px;
+    }
+  }
+}
+
+.learning-object-vertical {
+
+  .learning-object-thumbnail {
+    max-width: 250px;
+    height: 150px !important;
+    position: relative;
+  }
+
+}
+
+.glyphicon-eye-open:before, .glyphicon-star:before {
+  margin-right: 5px;
+}
+
+.learning-object {
+  .thumbnail {
+    width: 530px;
+    height: 298px;
+  }
+  .stats {
+    text-align: right;
+  }
+  .title {
+    font-weight: 400;
+  }
+  .description {
+    padding-left: 3%;
+    padding-top: 10px;
+  }
+  .category {
+    font-weight: 400;
+  }
+  .rightbar {
+    margin-top: 230px;
+
+    .media-heading {
+      white-space: nowrap;
+    }
+    .rating-panel {
+      background-color: $background-grey;
+      width: 100%;
+      height: 100px;
+      padding: 10px;
+      padding-left: 20px;
+      padding-right: 20px;
+
+      .rating {
+        text-align: right;
+      }
+    }
+
+    .actions {
+      text-align: center;
+
+      .action {
+        margin-top: 10px;
+        padding: 0;
+
+        a {
+          color: #F05421;
+          font-weight: 400;
+        }
+        img {
+          width: 40px;
+          height: 40px;
+          margin-bottom: 5px;
+        }
+      }
+    }
+  }
+
 }
diff --git a/app/assets/stylesheets/application/search.scss b/app/assets/stylesheets/application/search.scss
index 1e0bc46ea2011f1067d4676045b61a33b8fb2652..71452e6b0119474729e8e70a4b150a3aeea38d6d 100644
--- a/app/assets/stylesheets/application/search.scss
+++ b/app/assets/stylesheets/application/search.scss
@@ -7,6 +7,13 @@
   }
 }
 
+.nestedAccordion {
+  .dropdown {
+    margin-top: 10px !important;
+    margin-bottom: 10px !important;
+  }
+}
+
 .select2-container {
   width: 100% !important;
 }
diff --git a/app/assets/stylesheets/application/users.scss b/app/assets/stylesheets/application/users.scss
index 334ce327e22cfb358fe6cdb6a6b8a2306f84ae9a..98e3d01a1b78b60cdf65c7e3159328736f61c574 100644
--- a/app/assets/stylesheets/application/users.scss
+++ b/app/assets/stylesheets/application/users.scss
@@ -1,17 +1,44 @@
 $header-blue: #1676bc;
+$link-grey: #343D3E;
+$background-grey: #e7e7e8;
 
 .user-image {
   width: 60px;
   height: 60px;
   border-radius: 50%;
 }
+.user-image-small {
+  width: 40px;
+  height: 40px;
+  border-radius: 50%;
+}
+.user-image-tiny {
+  width: 20px;
+  height: 20px;
+  border-radius: 50%;
+}
 
 .user-header {
-  background-color: #e7e7e8;
+  background-color: $background-grey;
   width: 100%;
-  min-height: 100px;
+  min-height: 145px;
+  height: auto;
+  margin-top: 30px;
+  margin-bottom: 50px;
   padding: 15px;
 
+  h2 {
+    font-weight: 400;
+  }
+  .header-sub {
+    margin-top: 0;
+    color: $link-grey;
+    font-style: italic;
+  }
+  .header-content {
+    margin-top: 20px;
+  }
+
   .right-column {
     text-align: right;
 
@@ -23,3 +50,12 @@ $header-blue: #1676bc;
     }
   }
 }
+
+.user-files {
+
+}
+
+.user-biography {
+  padding-left: 85px !important;
+  display: none;
+}
\ No newline at end of file
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index cda7f8ed990b71a14c0076ffaa4560a8e631ccc0..ed2221aa11de44361c0bdf64ddaf28930275e271 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -1,7 +1,32 @@
 class UsersController < ApplicationController
 
+  before_action :authenticate_user!, only: :me
+  before_action :check_current_user_page, only: :show
+  before_action :set_user, only: :show
+
   def show
-    @objects = learning_object_repository.all
+    @objects = learning_object_repository.all_from_offset_to_limit 0, 10
+  end
+
+  def me
+    @objects = learning_object_repository.all_from_offset_to_limit 0, 10
+    @new_collection = Collection.new
+  end
+
+
+  private
+
+  def set_user
+    @user = user_repository.find params[:id]
+  end
+
+  def check_current_user_page
+    if user_signed_in?
+      if current_user.id == params[:id]
+        redirect_to action: :me
+      end
+    end
+>>>>>>> master
   end
 
 end
diff --git a/app/helpers/learning_objects_helper.rb b/app/helpers/learning_objects_helper.rb
index 37aa17b22027af30ad9df0ae7f94bd93b604e9c3..48405d335781af8c4adb76078d41bca0960f46ee 100644
--- a/app/helpers/learning_objects_helper.rb
+++ b/app/helpers/learning_objects_helper.rb
@@ -4,6 +4,26 @@ module LearningObjectsHelper
     categories.to_s
   end
 
+  def learning_object_thumbnail(learning_object, size = "")
+    if learning_object.thumbnail.nil? || learning_object.thumbnail == "thumbnai" # TODO: remove "thumbnai" when possible
+      if size == "large"
+        image_tag('learning-object-preview-large.png')
+      else
+        image_tag('learning-object-preview.png')
+      end
+    else
+      image_tag learning_object.thumbnail, alt: learning_object_title(learning_object)
+    end
+  end
+
+  def learning_object_title(learning_object)
+    if learning_object.name.nil?
+      return 'Sem Título'
+    end
+
+    learning_object.name
+  end
+
   def render_learning_object(orientation, learning_object)
     case (orientation)
       when "vertical"
diff --git a/app/models/learning_object.rb b/app/models/learning_object.rb
index f6a4f61b637f15ec32f1fd0c0fcba2205db1957e..b0c27500ddb7453022f9c3fc6060bc99d1bbf455 100644
--- a/app/models/learning_object.rb
+++ b/app/models/learning_object.rb
@@ -38,6 +38,30 @@ class LearningObject
     values
   end
 
+
+  def get_bitstream_retrievelink_of name
+    values = @bitstreams.select { |v| v["bundleName"] == name }
+    unless values.empty?
+      return Dspace::Config.rest_url + values.first["retrieveLink"]
+    end
+  end
+
+  def get_bitstream_filename_of name
+    values = @bitstreams.select { |v| v["bundleName"] == name }
+    unless values.empty?
+      return values.first["name"]
+    end
+  end
+
+  def get_retrievelink
+    get_bitstream_retrievelink_of "ORIGINAL"
+  end
+
+  def get_filename
+    get_bitstream_filename_of "ORIGINAL"
+  end
+
+
   private
 
   def defaults
diff --git a/app/repositories/orient_db/base.rb b/app/repositories/orient_db/base.rb
index a2affd8b1c539330639d69ba580f6e4166b09c43..9d469e05bd5bd1110a3ef54c41f36c1f52f9d5ed 100644
--- a/app/repositories/orient_db/base.rb
+++ b/app/repositories/orient_db/base.rb
@@ -14,21 +14,23 @@ class OrientDb::Base
     build_object result
   end
 
-  # Example:
-  #   list = repository.for(:learning_objects).all
-  #   list.each do |learning_object|
-  #     learning_object.inspect <LearningObject model>
-  #   end
+
   def all
     objects_hash = connection.query "SELECT FROM #{odb_class}", :limit => -1
     objects = build_objects(objects_hash) || []
   end
 
   def all_from_offset_to_limit(offset, limit)
-    objects_hash = connection.query "SELECT FROM #{odb_class} SKIP #{offset}", :limit => limit
+
+    objects_hash = connection.query "SELECT FROM #{odb_class} LIMIT #{limit} SKIP #{offset}", :limit => limit
+
     objects = build_objects(objects_hash) || []
   end
 
+  def destroy(object)
+    connection.command sprintf("DELETE VERTEX %s", object.id)
+  end
+
   def create(object)
     hash = build_hash(object)
     result = connection.create_document(hash)
diff --git a/app/repositories/orient_db/collection_repository.rb b/app/repositories/orient_db/collection_repository.rb
index 80e6b177add29920a2b038400e8267d5baee9449..56f36ebd8e7606f904184479006efa659ec313ae 100644
--- a/app/repositories/orient_db/collection_repository.rb
+++ b/app/repositories/orient_db/collection_repository.rb
@@ -2,13 +2,6 @@ module OrientDb
   class CollectionRepository < Base
     include OrientDb::Methods::EdgeMethods
 
-    # Usage:
-    #   repository.for(:collections).destroy collection
-    #
-    def destroy(collection)
-      connection.command sprintf("DELETE VERTEX %s", collection.id)
-    end
-
     def build_object(args={})
       Collection.new(
           :id => args["@rid"],
diff --git a/app/repositories/orient_db/learning_object_repository.rb b/app/repositories/orient_db/learning_object_repository.rb
index 22ca9a0847c2a2c6e9540175317d4ebbadf8d380..3ca5042cabddc36991d61a87063f5631a38ca3c0 100644
--- a/app/repositories/orient_db/learning_object_repository.rb
+++ b/app/repositories/orient_db/learning_object_repository.rb
@@ -49,11 +49,14 @@ module OrientDb
       edges.flatten
     end
 
-    # Usage:
-    #   repository.for(:learning_objects).destroy learning_object
-    #
-    def destroy(learning_object)
-      connection.command sprintf("DELETE VERTEX #{odb_class} where @rid = '%s'", learning_object.id)
+    def save(learning_object)
+      result = connection.command "INSERT INTO LearningObject CONTENT #{learning_object.to_json}"
+    end
+
+    def update_property(learning_object,property,value)
+      if accepted_properties.include? property
+        connection.command "UPDATE LearningObject SET #{property}='#{value}' WHERE @rid = #{learning_object.id}"
+      end
     end
 
     ##
@@ -102,6 +105,10 @@ module OrientDb
 
     private
 
+    def accepted_properties
+      ['thumbnail']
+    end
+
     def create_edges_from_array(edge_class, id, array, unique=false)
       edges = []
       array.each do |o|
diff --git a/app/repositories/orient_db/subject_repository.rb b/app/repositories/orient_db/subject_repository.rb
index b90fa2b919efcb4a884cb3ea1a2c9744decef128..6bc3f7147c2b06155971e59c8b457e43f7bdad45 100644
--- a/app/repositories/orient_db/subject_repository.rb
+++ b/app/repositories/orient_db/subject_repository.rb
@@ -27,8 +27,8 @@ module OrientDb
       learning_object_repository.build_objects(result)
     end
 
-    def build_hash
-      hash = super
+    def build_hash(object)
+      hash = super(object)
       hash.delete("learning_objects")
       hash
     end
diff --git a/app/views/collections/_create.html.erb b/app/views/collections/_create.html.erb
index cf67f6c19e68f176968fd05e7e54c15804fdd47b..0ed916c6c1bff7fd91b14adc45c887f27245c795 100644
--- a/app/views/collections/_create.html.erb
+++ b/app/views/collections/_create.html.erb
@@ -1,9 +1,11 @@
-<a href="#" id="create_collection_popover">Criar coleção</a>
+<button id="create_collection_popover" type="button" class="btn btn-primary">Criar coleção</button>
 
 <div id="create_collection_popover_content" style="display: none">
-  <%= render 'collections/form' %>
+
+  <%= render 'collections/form', collection: collection %>
+
 </div>
 
 <div id="create_collection_popover_title" style="display: none">
   Criar coleção
-</div>
\ No newline at end of file
+</div>
diff --git a/app/views/collections/_form.html.erb b/app/views/collections/_form.html.erb
index 7330b0254f3ba93c7b437ec76db29a8ae8689ffb..f30b462590084f78536a2cce0836dbd693c5ba6a 100644
--- a/app/views/collections/_form.html.erb
+++ b/app/views/collections/_form.html.erb
@@ -1,14 +1,12 @@
-<%= form_for @collection do |f| %>
 
-    <%= f.label :title %>
-    <%= f.text_field :title, required: true, style: 'width: 250px;' %>
+<%= form_for collection do |f| %>
+
+    <%= f.label :name %>
+    <%= f.text_field :name, required: true, style: 'width: 250px;' %>
+
+    <%= f.label :description %>
+    <%= f.text_area :description, required: true, style: 'width: 250px;' %>
 
-    <%= f.label :privacy %>
-    <select name="collection[privacy]">
-      <option value="public">Público</option>
-      <option value="followers">Meus seguidores</option>
-      <option value="only_me">Somente eu</option>
-    </select>
 
     <%= f.submit %>
-<% end %>
\ No newline at end of file
+<% end %>
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 5974f076c8ed56f498f2588ac3fa2c65fd02e7b7..8979487f8cb3a05fdfa61df8c974fc4a2bda1e87 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -3,7 +3,7 @@
 <head>
  <title>PortalMEC</title>
   <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>
-  <link href='https://fonts.googleapis.com/css?family=Roboto:400,300,700,500' rel='stylesheet' type='text/css'>
+  <link href='https://fonts.googleapis.com/css?family=Roboto:300,400,500,700' rel='stylesheet' type='text/css'>
   <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
   <%= csrf_meta_tags %>
   <meta property="creator.productor" content="http://estruturaorganizacional.dados.gov.br/id/unidade-organizacional/1">
diff --git a/app/views/learning_objects/_actions_buttons.html.erb b/app/views/learning_objects/_actions_buttons.html.erb
new file mode 100644
index 0000000000000000000000000000000000000000..23ca78e5048d333ba161b35bab64650b0db67b75
--- /dev/null
+++ b/app/views/learning_objects/_actions_buttons.html.erb
@@ -0,0 +1,5 @@
+<div class="learning-object-actions">
+  <%= render 'learning_objects/like_button' %>
+  <%= render 'learning_objects/bookmarks_button' %>
+  <%= render 'learning_objects/collections_button' %>
+</div>
\ No newline at end of file
diff --git a/app/views/learning_objects/_bookmarks_button.html.erb b/app/views/learning_objects/_bookmarks_button.html.erb
new file mode 100644
index 0000000000000000000000000000000000000000..69513ca105d96133c02c12a670b1df4613833921
--- /dev/null
+++ b/app/views/learning_objects/_bookmarks_button.html.erb
@@ -0,0 +1,3 @@
+<button type="button" class="btn btn-default btn-xs" data-toggle="button" aria-pressed="false" autocomplete="off" title="Adicionar aos favoritos">
+  <span class="glyphicon glyphicon-bookmark" aria-hidden="true"></span>
+</button>
\ No newline at end of file
diff --git a/app/views/learning_objects/_collections_button.html.erb b/app/views/learning_objects/_collections_button.html.erb
new file mode 100644
index 0000000000000000000000000000000000000000..24ff0d56ec818d514e8ca1889900edcbc49748f2
--- /dev/null
+++ b/app/views/learning_objects/_collections_button.html.erb
@@ -0,0 +1,8 @@
+<button type="button" class="btn btn-default btn-xs add_to_collection" data-toggle="button" aria-pressed="false" autocomplete="off" title="Adicionar as coleções">
+  <span class="glyphicon glyphicon-list" aria-hidden="true"></span>
+</button>
+
+<div id="collections_list_popover" style="display: none; z-index: 999;">
+  <a href="#">Segundo ano - B</a>
+  <a href="#">Terceiro ano - A</a>
+</div>
\ No newline at end of file
diff --git a/app/views/learning_objects/_learning_object_horizontal.erb b/app/views/learning_objects/_learning_object_horizontal.erb
index 20c78f620a324ae5f3b77b6d2de6539df7fd76ff..634f743587a2d470a2ac3c0dfb52afbab8c68e1c 100644
--- a/app/views/learning_objects/_learning_object_horizontal.erb
+++ b/app/views/learning_objects/_learning_object_horizontal.erb
@@ -1,28 +1,34 @@
+<% link = learning_object_path(id: learning_object.id) %>
 <div class="learning-object-horizontal">
   <div class="media">
     <div class="media-left media-middle">
-      <a href="#">
-        <img src="http://dummyimage.com/250x150/363336/fff" alt='dummy image'>
-      </a>
+      <div class="learning-object-thumbnail">
+        <%= link_to link do
+          learning_object_thumbnail learning_object
+        end %>
+
+        <% if user_signed_in? %>
+            <%= render 'learning_objects/actions_buttons' %>
+        <% end %>
+      </div>
     </div>
+
     <div class="media-body">
-      <a href="<%= learning_object_path(id: learning_object.id) %>">
-        <% if learning_object.name.nil? %>
-            <h4 class="media-heading">Sem Título</h4>
-        <% else %>
-            <h4 class="media-heading"><%= learning_object.name %></h4>
-        <% end %>
-      </a>
 
-      <span>Por <a>Usuário&nbsp;</a></span><br/>
-      <span class="glyphicon glyphicon-eye-open"><%= learning_object.views %>&nbsp;</span>
-      <span class="glyphicon glyphicon-star"><%= learning_object.likes %>&nbsp;</span><br>
+      <%= link_to link do %>
+          <h4><%= learning_object_title learning_object %></h4>
+      <% end %>
+
+      <span>Por <%= link_to 'João', '#' %></span><br/>
+      <span class="glyphicon glyphicon-eye-open"><%= learning_object.views %></span>
+      <span class="glyphicon glyphicon-star"><%= learning_object.likes %></span><br>
+
       <% unless learning_object.description.nil? %>
           <%= learning_object.description %>
           <br/>
       <% end %>
       <br/>
-      Em<b> <%= show_categories learning_object.categories %></b>
+      <b><%= ("Em " + show_categories(learning_object.categories)) unless learning_object.categories.nil? %></b>
     </div>
   </div>
 </div>
diff --git a/app/views/learning_objects/_learning_object_vertical.erb b/app/views/learning_objects/_learning_object_vertical.erb
index ff0bc2740338a08f42eda2dc7754a8732f515cbe..2ebbc5ee9fadf0926e1fabe282d9ee32054cde98 100644
--- a/app/views/learning_objects/_learning_object_vertical.erb
+++ b/app/views/learning_objects/_learning_object_vertical.erb
@@ -1,17 +1,18 @@
 <div class="learning-object-vertical">
   <div class="panel">
-    <div>
-      <img src="http://dummyimage.com/250x150/363336/fff" alt='dummy image' class="img-responsive">
+    <div class="learning-object-thumbnail">
+      <%= link_to learning_object_path(id: learning_object.id) do
+        learning_object_thumbnail learning_object
+      end %>
+      <% if user_signed_in? %>
+          <%= render 'learning_objects/actions_buttons' %>
+      <% end %>
     </div>
     <div class="panel-body">
-      <% if learning_object.name.nil? %>
-        <h4 class="media-heading">Sem Título</h4>
-      <% else %>
-        <h4 class="media-heading"><%= learning_object.name %></h4>
-      <% end %>
+          <h4 class="media-heading"><%= learning_object_title(learning_object) %></h4>
       <span class="glyphicon glyphicon-eye-open"><%= learning_object.views %>&nbsp;</span>
       <span class="glyphicon glyphicon-star"><%= learning_object.likes %>&nbsp;</span>
       <span>Por <a>Usuário&nbsp;</a></span>
     </div>
   </div>
-</div>
+</div>
\ No newline at end of file
diff --git a/app/views/learning_objects/_like_button.html.erb b/app/views/learning_objects/_like_button.html.erb
new file mode 100644
index 0000000000000000000000000000000000000000..b59543135607e64f8cf73b6360e17d1d8850f346
--- /dev/null
+++ b/app/views/learning_objects/_like_button.html.erb
@@ -0,0 +1,3 @@
+<button type="button" class="btn btn-primary btn-xs" data-toggle="button" aria-pressed="false" autocomplete="off" title="Gostei">
+  <span class="glyphicon glyphicon-thumbs-up" aria-hidden="true"></span>
+</button>
\ No newline at end of file
diff --git a/app/views/learning_objects/show.html.erb b/app/views/learning_objects/show.html.erb
index 1c485edad72b11ac3778fb4538becfa23f8340c5..25c0ccd0ff7389b27b2914f1277eca24db9c5b0a 100644
--- a/app/views/learning_objects/show.html.erb
+++ b/app/views/learning_objects/show.html.erb
@@ -1,4 +1,4 @@
-<h1><%= @learning_object.name %></h1>
+<!-- <h1><%= @learning_object.name %></h1>
 
 <ul>
   <li><b>Autor: </b><%= @learning_object.get_metadata_value_of("dc.contributor.author") %></li>
@@ -21,4 +21,264 @@
   <%= link_to "Curtir",
               like_learning_object_path(@learning_object.id_dspace),
               method: :post, remote: true %>
-<% end %>
+<% end %> -->
+
+<div class="row learning-object">
+  <div class="col-md-7">
+    <%= learning_object_thumbnail @learning_object, "large" %>
+    <div class="stats">
+      <span class="glyphicon glyphicon-eye-open"><%= @learning_object.views %>&nbsp;</span>
+      <span class="glyphicon glyphicon-star"><%= @learning_object.likes %>&nbsp;</span>
+    </div>
+    <h2 class="title"><%= @learning_object.name %></h2>
+    <% unless @learning_object.description.nil? %>
+      <p class="description"><%= @learning_object.description %></p>
+    <% end %>
+    <span class="category"><%= ("Em " + show_categories(@learning_object.categories)) unless @learning_object.categories.nil? %></span>
+  </div>
+  <div class="col-md-5">
+    <div class="rightbar">
+      <div class="media">
+        <div class="media-left">
+          <a href="#">
+            <img class="user-image-small" src="<%#= current_user.avatar.url(:thumb) %><%= asset_path('user-anon.png')%>" alt="Foto do usuário"/>
+          </a>
+        </div>
+        <div class="media-body">
+          <h5>Adicionado por</h5>
+          <h3 class="media-heading"><%= @learning_object.get_metadata_value_of("dc.contributor.author") %></h3>
+        </div>
+      </div>
+      <div class="rating-panel">
+        <p>O que você achou deste arquivo?</p>
+        <div class="rating">
+          <span class="starRating">
+            <input id="rating5" name="rating" type="radio" value="5">
+            <label for="rating5">5</label>
+            <input id="rating4" name="rating" type="radio" value="4">
+            <label for="rating4">4</label>
+            <input checked id="rating3" name="rating" type="radio" value="3">
+            <label for="rating3">3</label>
+            <input id="rating2" name="rating" type="radio" value="2">
+            <label for="rating2">2</label>
+            <input id="rating1" name="rating" type="radio" value="1">
+            <label for="rating1">1</label>
+          </span>
+        </div>
+      </div>
+      <div class="actions">
+        <div class="col-md-3 action">
+          <a href="<%= @learning_object.get_retrievelink %>">
+            <%= image_tag "icons/download.png", alt: "Download do objeto" %>
+            <h6>salvar no computador</h6>
+          </a>
+        </div>
+        <div class="col-md-3 action">
+          <%= image_tag "icons/collection-add.png", alt: "Adicionar à coleção" %>
+          <h6>adicionar à coleção</h6>
+        </div>
+        <div class="col-md-3 action"></div>
+        <div class="col-md-3 action">
+          <%= image_tag "icons/report-circle.png", alt: "Denunciar objeto" %>
+          <h6>denunciar objeto</h6>
+        </div>
+      </div>
+    </div>
+  </div>
+</div>
+
+<!-- <div class="container-fluid">
+  <div class="container-fluid">
+    <div class="row">
+      <div class="col-sm-6">
+        <a href="">
+          <img alt="<%=@learning_object.name %>" class="img-responsive" height="550" src="<%= @learning_object.thumbnail %>" width="600">
+        </a>
+        <p>
+          <h1><%= @learning_object.name %></h1>
+        </p>
+      </div>
+      <div class="col-sm-6">
+        <div class="col-sm-12">
+          <div class="row">
+            <div class="col-md-12">Adicionado por:
+              <h1>
+                <img class="img-circle" src="images/user.jpg">
+                <a href="autor.php"><%= @learning_object.get_metadata_value_of("dc.contributor.author") %></a>
+              </h1>
+            </div>
+          </div><br/>
+          <%= @learning_object.get_metadata_value_of("dc.description") %>
+        </div>
+        <div class="col-sm-12">
+          <br/>
+          <table class="table">
+            <tr>
+              <td>Avalie:</td>
+              <td>Total curtir:</td>
+              <td>Visualizações:</td>
+              <td>Total Downloads:
+              </td>
+            </tr>
+            <tr>
+              <td>
+
+                ()
+              </td>
+              <td>
+                <%= @learning_object.likes %></td>
+              <td><%= @learning_object.views %></td>
+              <td>-</td>
+            </tr>
+          </table><br/>
+          <!--div class="pull-right"-->
+          <!-- <div style="text-align: center;">
+            <a class="btn btn-primary" href="#">Download</a>
+          </div>
+        </div>
+      </div>
+    </div>
+    <br/><br/>
+    <div class="row">
+      <div class="col-sm-8">
+        <ul>
+          <li>
+            <b>Autor:
+            </b><%= @learning_object.get_metadata_value_of("dc.contributor.author") %></li>
+          <li>
+            <b>Tipo:
+            </b><%= @learning_object.get_metadata_value_of("dc.type") %></li>
+          <li>
+            <b>Data:
+            </b><%= @learning_object.get_metadata_value_of("dc.date.available") %></li>
+          <li>
+            <b>Linguagem:
+            </b><%= @learning_object.get_metadata_value_of("dc.language") %></li>
+          <li>
+            <b>Metadados:
+            </b>
+          </li>
+        </ul>
+        <table class="table table-striped">
+          <% @learning_object.metadata.each do |m| %>
+          <tr >
+            <th >
+              <span ><%= "#{m["key"]}:"  %></span >
+            </th>
+            <td >
+              <%=  "#{m["value"]}" %></td>
+          </tr>
+          <% end %>
+        </table>
+        <br/>
+        <% if user_signed_in? %>
+        <%= link_to "Curtir",
+                              like_learning_object_path(@learning_object.id_dspace),
+                              method: :post, remote: true %>
+        <% end %>
+        <br/> -->
+        <!-- <div class="row">
+          <div class="col-md-12">
+            <h1>Comentários</h1>
+          </div>
+        </div>
+
+        <div class="row">
+          <div class="col-md-12">
+            <div class="media">
+              <form action="?f=addComment" method="POST">
+                <div class="media-left">
+                  <label></label>
+                  <a href="#"><img alt="<img_usuario>" class="media-object" src="images/user.jpg" width="64"></a>
+                </div>
+                <div class="media-body">
+                  <label for="comment">Comentário:</label>
+                  <textarea class="form-control" name="text" rows="2" width=200px></textarea>
+                </br>
+                <div align="right"><input class="btn btn-success" type="submit" value="Enviar Comentário"></div>
+              </div>
+            </form>
+          </div>
+        </div>
+      </div>
+    </br>
+    <div class="row">
+      <div class="col-md-1">
+        <img class="img-circle" height="50" src="images/user.jpg" width="50">
+      </div>
+      <div class="col-md-11">
+        <h4>Nome Sobrenome</h4>
+        Coment ...
+      </div>
+    </div>
+    <hr>
+
+    <div class="row">
+      <div class="col-md-1">
+        <img class="img-circle" height="50" src="images/user.jpg" width="50">
+      </div>
+      <div class="col-md-11">
+        <h4>Nome Sobrenome</h4>
+        Coment ...
+      </div>
+    </div>
+    <hr>
+    <div class="row">
+      <div class="col-md-1">
+        <img class="img-circle" height="50" src="images/user.jpg" width="50">
+      </div>
+      <div class="col-md-11">
+        <h4>Nome Sobrenome</h4>
+        Coment ...
+      </div>
+    </div>
+    <hr>
+    <div class="row">
+      <div class="col-md-12">
+        <center>
+          <a class="btn btn-primary" href="#">Ver mais...</a>
+        </center>
+      </div>
+    </div>
+    <br/>
+
+  </div> -->
+  <!--arquivos relacionados-->
+  <!-- <div class="col-sm-4">
+    <div class="row">
+      <div class="col-md-12">
+        <h1>
+          Arquivos relacionados
+        </h1>
+      </div>
+    </div>
+    <%# @related_objects.each do |o| %>
+      <div class="row">
+        <div class="col-md-12">
+          <div class="itemvert">
+            <center><img class="img-responsive" height="180" src="<%#= o.thumbnail %>" width="320">
+              <h1>
+                <%#=  o.name %>
+              </h1>
+              <p>
+                <span aria-hidden="true" class="glyphicon glyphicon-search"></span>(<%#= o.views %>)&nbsp;&nbsp;&nbsp;&nbsp;
+                <img height="15" src="star-on.svg" width="15">
+                <img height="15" src="star-on.svg" width="15">
+                <img height="15" src="star-on.svg" width="15">
+                <img height="15" src="star-on.svg" width="15">
+                <img height="15" src="star-on.svg" width="15"></span>(10,0)<br/>
+              <a href="autor.php"><img class="img-circle" height="32" src="images/user.jpg" width="32">
+                por Jonas</a>
+            </p>
+          </center>
+        </div>
+      </div>
+    </div><hr>
+  <%# end %>
+  </div> -->
+<!-- </div>
+<br/>
+</div>
+<!-- container fluid -->
+<!-- </div> -->
+<!-- /container -->
diff --git a/app/views/management/carousels/edit.html.erb b/app/views/management/carousels/edit.html.erb
index e4195ad934da723acd597466b952f9b07b96a7b7..f4fbf007c6561345b05e782ffd7b72154ea73bc0 100644
--- a/app/views/management/carousels/edit.html.erb
+++ b/app/views/management/carousels/edit.html.erb
@@ -1,7 +1,9 @@
-<h1 class="ls-title-intro ls-ico-users">Carousels</h1>
+
+<h1 class="ls-title-intro ls-ico-users">Carrossel</h1>
 
 <ol class="ls-breadcrumb">
-  <li><%= link_to 'Carousels', management_carousels_path %></li>
+  <li><%= link_to 'Carrosséis', management_carousels_path %></li>
+
   <li>Administrar</li>
 </ol>
 
diff --git a/app/views/management/carousels/index.html.erb b/app/views/management/carousels/index.html.erb
index 7f36d3e0d777f652869e7cd9a40696d1f7ff0a99..6ea5335f18d6e18d5b0350be8931569ae2f69771 100644
--- a/app/views/management/carousels/index.html.erb
+++ b/app/views/management/carousels/index.html.erb
@@ -1,4 +1,6 @@
-<h1 class="ls-title-intro ls-ico-users">Carousels</h1>
+
+<h1 class="ls-title-intro ls-ico-users">Carrossel</h1>
+
 
 <a href="<%= new_management_carousel_path %>" class="ls-btn-primary" aria-expanded="false" role="combobox">Cadastrar
   novo</a>
diff --git a/app/views/management/carousels/new.html.erb b/app/views/management/carousels/new.html.erb
index 5cac49569c1a8729509a601370ed1d1bc9bfc4f7..23ab3e1cca473ef4c66e7ac22f4b3b74ed3b770e 100644
--- a/app/views/management/carousels/new.html.erb
+++ b/app/views/management/carousels/new.html.erb
@@ -1,8 +1,9 @@
-<h1 class="ls-title-intro ls-ico-users">Usuários</h1>
+
+<h1 class="ls-title-intro ls-ico-users">Carrossel</h1>
 
 <ol class="ls-breadcrumb">
-  <li><a href="#">Usuários</a></li>
-  <li>Novo usuário</li>
+  <li><%= link_to 'Carrosséis', management_carousels_path %></li>
+  <li>Novo Carrossel</li>
 </ol>
 
-<%= render 'form' %>
\ No newline at end of file
+<%= render 'form' %>
diff --git a/app/views/search/index.html.erb b/app/views/search/index.html.erb
index 46f39ee39908c84a87445daf64decea7d72434ff..ec3d57d734be38cb52528399d6c48c99eb409043 100644
--- a/app/views/search/index.html.erb
+++ b/app/views/search/index.html.erb
@@ -1,26 +1,3 @@
-<script type="text/javascript">
-    $(document).ready(function () {
-        $(".select-tag-container").select2();
-
-        var runDropdown = function (element) {
-            if ($(element).next().is(':hidden')) {
-                $('> .caret', element).addClass('caret-up');
-                $(element).next().slideDown();
-            }
-            else {
-                $('> .caret', element).removeClass('caret-up');
-                $(element).next().slideUp();
-            }
-        };
-
-        runDropdown($('#nestedAccordion .dropdown'));
-
-        $('#nestedAccordion .dropdown').click(function () {
-            runDropdown(this);
-        });
-    });
-</script>
-
 <div class="row">
   <div class="col-sm-4 search-sidebar">
     <!-- <h2>Busca Avançada</h2> -->
@@ -34,7 +11,7 @@
       </div>
     </div> -->
 
-    <div id="nestedAccordion">
+    <div class="nestedAccordion">
       <h3 class="dropdown open">Matérias<span class="caret caret-align-right"/></h3>
 
       <div class="dropdown-element">
@@ -293,9 +270,9 @@
         <input type="text" name="ano2" size="8"> - <input type="text" name="ano2" size="8">
       </div>
     </div>
-    <!-- fim div id="nestedAccordion"-->
+    <!-- fim div class="nestedAccordion"-->
 
-    <div id="nestedAccordion">
+    <div class="nestedAccordion">
       <h3 class="dropdown">Pesquisa Avançada<span class="caret caret-align-right"/></h3>
 
       <form method="get">
diff --git a/app/views/users/me.html.erb b/app/views/users/me.html.erb
new file mode 100644
index 0000000000000000000000000000000000000000..7596496a6e00778da71e85369c896ff21d880468
--- /dev/null
+++ b/app/views/users/me.html.erb
@@ -0,0 +1,95 @@
+<div class="row">
+  <div class="user-header">
+    <div class="col-md-6">
+      <div class="media">
+        <div class="media-left">
+          <%= link_to edit_user_registration_path do
+            image_tag current_user.avatar.url(:thumb), class: 'user-image'
+          end %>
+          </a>
+        </div>
+        <div class="media-body">
+          <h2 class="media-heading"><%= current_user.name %></h2>
+
+          <h3 class="header-sub">Universidade Federal do Paraná - UFPR</h3>
+
+          <div class="header-content">
+            <a href="#" class="showmore">
+              <span>ver mais</span>
+              <span style="display: none;">fechar</span>
+            </a>
+          </div>
+        </div>
+      </div>
+    </div>
+    <div class="col-md-6 right-column">
+      <button type="button" class="btn btn-default" onclick="window.location=<%= edit_user_registration_path %>">Editar perfil</button>
+    </div>
+
+    <div class="col-md-12 user-biography">
+      <h3>Biografia</h3>
+
+      <p>asdasdsadasdas</p>
+      <a href="#" class="showmore">
+        <span style="display: none;">fechar</span>
+        <span>fechar</span>
+      </a>
+    </div>
+
+    <div style="clear: both;"></div>
+  </div>
+
+  <div class="user-files">
+    <div class="row">
+      <div class="col-md-6">
+        <div class="media">
+          <div class="media-body">
+            <h2 class="media-heading">Objetos do usuário</h2>
+            <h4>x items</h4>
+          </div>
+        </div>
+      </div>
+      <div class="col-md-6 right-column align-right">
+        <button type="button" class="btn btn-primary">Adicionar novo objeto</button>
+      </div>
+    </div>
+
+    <div class="row learning-object-columns">
+      <%= render @objects[0], orientation: "vertical" %>
+      <%= render @objects[1], orientation: "vertical" %>
+      <%= render @objects[2], orientation: "vertical" %>
+      <%= render @objects[0], orientation: "vertical" %>
+      <%= render @objects[1], orientation: "vertical" %>
+      <%= render @objects[2], orientation: "vertical" %>
+    </div>
+
+    <div style="clear: both;"></div>
+    <div style="float: right;">
+      <a href="#">Ver todos</a>
+    </div>
+  </div>
+
+  <div class="user-files">
+    <div class="row">
+      <div class="col-md-6">
+        <div class="media">
+          <div class="media-body">
+            <h2 class="media-heading">Minhas Coleções</h2>
+          </div>
+        </div>
+      </div>
+      <div class="col-md-6 right-column align-right">
+        <%= render 'collections/create', collection: @new_collection %>
+      </div>
+    </div>
+
+    <div class="row learning-object-columns">
+      <%= render @objects[0], orientation: "vertical" %>
+      <%= render @objects[1], orientation: "vertical" %>
+      <%= render @objects[2], orientation: "vertical" %>
+      <%= render @objects[0], orientation: "vertical" %>
+      <%= render @objects[1], orientation: "vertical" %>
+      <%= render @objects[2], orientation: "vertical" %>
+    </div>
+  </div>
+</div>
\ No newline at end of file
diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb
index e915c351cd710310db12b2195ba69ee0ef6ba67a..a857865694905b8536cc31049d8e5452307990a3 100644
--- a/app/views/users/show.html.erb
+++ b/app/views/users/show.html.erb
@@ -8,18 +8,35 @@
           </a>
         </div>
         <div class="media-body">
-          <h4 class="media-heading">Usuário</h4>
-          <span>nome da instituição</span>
 
-          <p>
-            x items
-          </p>
+          <h2 class="media-heading">Usuário</h2>
+          <h3 class="header-sub">nome da instituição</h3>
+          <div class="header-content">
+            <a href="#" class="showmore">
+              <span>ver mais</span>
+              <span style="display: none;">fechar</span>
+            </a>
+          </div>
+
         </div>
       </div>
     </div>
     <div class="col-md-6 right-column">
       <button type="button" class="btn btn-default">Seguir</button>
     </div>
+
+    <div class="col-md-12 user-biography">
+      <h3>Biografia</h3>
+
+      <p>asdasdsadasdas</p>
+
+      <a href="#" class="showmore">
+        <span style="display: none;">fechar</span>
+        <span>fechar</span>
+      </a>
+    </div>
+
+    <div style="clear: both;"></div>
   </div>
 
   <div class="user-files">
@@ -27,15 +44,15 @@
       <div class="col-md-6">
         <div class="media">
           <div class="media-body">
-            <h4 class="media-heading">Arquivos do usuário</h4>
 
-            <p>
-              x items
-            </p>
+            <h2 class="media-heading">Objetos do usuário</h2>
+            <h4>x items</h4>
+
           </div>
         </div>
       </div>
-      <div class="col-md-6 right-column">
+      <div class="col-md-6 right-column align-right">
+        <button type="button" class="btn btn-primary">Enviar mensagem</button>
       </div>
     </div>
 
@@ -47,25 +64,28 @@
       <%= render @objects[1], orientation: "vertical" %>
       <%= render @objects[2], orientation: "vertical" %>
     </div>
+
+
+    <div style="clear: both;"></div>
+    <div style="float: right;">
+      <a href="#">Ver todos</a>
+    </div>
   </div>
-</div>
 
+  <div class="user-files">
 
-<div class="row">
-  <div class="user-collections">
     <div class="row">
       <div class="col-md-6">
         <div class="media">
           <div class="media-body">
-            <h4 class="media-heading">Coleções</h4>
 
-            <p>
-              x items
-            </p>
+            <h2 class="media-heading">Minhas Coleções</h2>
           </div>
         </div>
       </div>
-      <div class="col-md-6 right-column">
+      <div class="col-md-6 right-column align-right">
+
+
       </div>
     </div>
 
@@ -78,8 +98,5 @@
       <%= render @objects[2], orientation: "vertical" %>
     </div>
   </div>
-</div>
 
-<div class="row">
-  <%= render 'collections/create' %>
 </div>
diff --git a/app/workers/massive_likes_creator_worker.rb b/app/workers/massive_likes_creator_worker.rb
new file mode 100644
index 0000000000000000000000000000000000000000..79506a6831d6571a912b2a24990054f0f60ed616
--- /dev/null
+++ b/app/workers/massive_likes_creator_worker.rb
@@ -0,0 +1,21 @@
+class MassiveLikesCreatorWorker
+
+  include Sidekiq::Worker
+  include RepositoriesProxy
+
+  def perform(item_id, users_ids)
+
+    item = learning_object_repository.find item_id
+
+    users_ids.each do |user_id|
+      user = User.find user_id
+      begin
+        learning_object_repository.like user, item
+      rescue
+        next
+      end
+    end
+
+  end
+
+end
diff --git a/app/workers/massive_views_creator_worker.rb b/app/workers/massive_views_creator_worker.rb
new file mode 100644
index 0000000000000000000000000000000000000000..a5903a0a87314ecb87074abfc47cf1e90e4ab418
--- /dev/null
+++ b/app/workers/massive_views_creator_worker.rb
@@ -0,0 +1,21 @@
+class MassiveViewsCreatorWorker
+
+  include Sidekiq::Worker
+  include RepositoriesProxy
+
+  def perform(item_id, users_ids)
+
+    item = learning_object_repository.find item_id
+
+    users_ids.each do |user_id|
+      user = User.find user_id
+      begin
+        learning_object_repository.increment_views user, item
+      rescue
+        next
+      end
+    end
+
+  end
+
+end
diff --git a/app/workers/thumbnail_generator_worker.rb b/app/workers/thumbnail_generator_worker.rb
new file mode 100644
index 0000000000000000000000000000000000000000..75b809f3f6141524b8a98ee833ccf87476ebb84a
--- /dev/null
+++ b/app/workers/thumbnail_generator_worker.rb
@@ -0,0 +1,58 @@
+class ThumbnailGeneratorWorker
+
+  include Sidekiq::Worker
+  include RepositoriesProxy
+  include Thumbnail::Creation
+  include Thumbnail::Formats
+
+  def perform(learning_object_id)
+
+    item = learning_object_repository.find(learning_object_id)
+    filename = item.get_bitstream_filename_of "ORIGINAL"
+
+    size = "530x298"
+
+    unless accepted_formats.include? file_format filename
+      item.thumbnail = default_thumbnail
+    else
+      begin
+        retrieve_link = item.get_bitstream_retrievelink_of "ORIGINAL"
+        file = download_bitstream(retrieve_link,filename)
+      rescue
+        puts "ERROR!!! Some error occurred during file download."
+      else
+        item.thumbnail = generate_thumbnail(file,filename,size)
+        delete_downloaded_bitstream(file)
+      end
+    end
+
+    learning_object_repository.update_property(item,"thumbnail",item.thumbnail)
+
+  end
+
+  private
+
+  def delete_downloaded_bitstream(file)
+    File.unlink(file) if File.exist?(file)
+  end
+
+  def download_bitstream(url, filename)
+    output_dir = "/tmp"
+
+    output_file = "#{output_dir}/#{filename}"
+
+    c = Curl::Easy.new(url)
+    c.ssl_verify_peer = false
+    c.ssl_verify_host = false
+    File.open(output_file, 'wb') do |f|
+      # c.on_progress { |dl_total, dl_now, ul_total, ul_now|
+      #   puts "#{dl_total}, #{dl_now}, #{ul_total}, #{ul_now}"; true
+      # }
+      c.on_body {|data| f << data; data.size }
+      c.perform
+    end
+
+    return output_file
+  end
+
+end
diff --git a/config/routes.rb b/config/routes.rb
index 9455b5b3360873692021487a1170a62abf1de25d..c6a3fd5e87eceac3a43b311eaad7c568433ea6a8 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,4 +1,6 @@
 Rails.application.routes.draw do
+  require 'sidekiq/web'
+
   devise_for :users
 
   namespace :auth do
@@ -22,8 +24,12 @@ Rails.application.routes.draw do
     get 'highlights/index' => 'highlights#index', as: 'index_highlights'
     resources :users
 
+    resources :highlights
+
     resources :carousels
 
+    mount Sidekiq::Web, at: '/sidekiq'
+
   end
 
   root 'welcome#index'
@@ -38,6 +44,11 @@ Rails.application.routes.draw do
   resources :collections
   resources :subjects, only: [:index, :show]
 
+  resources :users, only: [:show] do
+    collection do
+      get :me
+    end
+  end
   get 'users/:id', to: 'users#show', as: 'users_show'
 
   get '/faq' => 'welcome#faq'
diff --git a/lib/dspace/client.rb b/lib/dspace/client.rb
index a88bb8477206f7742e6ef4b7b675ffc8c191d031..e3dd70c904575bf94a3a9665e5051d3dc3ec4e06 100644
--- a/lib/dspace/client.rb
+++ b/lib/dspace/client.rb
@@ -1,2 +1,16 @@
-class OrientDb::Client
+class Dspace::Client
+  @@client = nil
+
+  def self.instance
+    if !@@client.nil?
+      return @@client
+    end
+
+    begin
+      @@client = DspaceClient.new(Dspace::Config.rest_url)
+    rescue
+      raise 'Wrong orient db credentials'
+    end
+  end
+
 end
diff --git a/lib/orient_db/methods/edge_methods.rb b/lib/orient_db/methods/edge_methods.rb
index 0e5c8c448fe1059c3b09917ae569dd2c3d340731..a1e13990a82db6473493ccbb38af84397bdb4051 100644
--- a/lib/orient_db/methods/edge_methods.rb
+++ b/lib/orient_db/methods/edge_methods.rb
@@ -2,6 +2,16 @@ module OrientDb
   module Methods
     module EdgeMethods
 
+      def create_edges_from_array(edge_class, id, array, unique=false)
+        edges = []
+        array.each do |o|
+          unless unique && edge_exists?(edge_class, id, o.id)
+            edges << create_edge(edge_class, id, o.id)
+          end
+        end
+        edges
+      end
+
       ##
       # Count the number of edges existent
       def get_in_edges_count(edge_class, id)
diff --git a/lib/tasks/dspace.rake b/lib/tasks/dspace.rake
new file mode 100644
index 0000000000000000000000000000000000000000..f2c2770d952d93686f000382b9e5be6ec6100523
--- /dev/null
+++ b/lib/tasks/dspace.rake
@@ -0,0 +1,101 @@
+require 'dspace_rest_client'
+
+namespace :dspace do
+  desc "Dspace tasks"
+
+  task import: :environment do
+    desc "Import DSpace items to LearningObject Repositoy"
+
+    include RepositoriesProxy
+
+    # Quantity of items fetched on each iteration
+    limit = 500
+
+    # Start point from where items will be fetched
+    offset = 0
+
+    loop do
+
+      puts " --> importing items from #{offset} to #{offset+limit}"
+
+      begin
+        # Get items from dspace (from offset to offset+limit)
+        dspace_items = get_items_from_dspace(limit,offset)
+      rescue
+        # Sleeps for a while to wait database's recovery
+        sleep(10.seconds)
+        # Goes to next iteration to retry
+        next
+      else
+        # Terminate loop if there are no more items to import
+        break if dspace_items.empty?
+
+        # Increment offset, to get new items on next iteration
+        offset = offset + limit
+
+        # Iterates through items
+        # Verifies if item is already on repository
+        # Initializes new LearningObjects
+        # and saves them on LearningObjects's repository
+        dspace_items.each do |item|
+          result = learning_object_repository.get_by_dspace_id item.id
+          if result.nil?
+            learning_object = initialize_learning_object item
+            learning_object_repository.save learning_object
+          end
+        end
+
+      end
+
+    end
+
+  end
+
+  private
+
+  def dspace_repository
+    @dspace_repository ||= Dspace::Client.instance.repository.item_repository
+  end
+
+  def get_items_from_dspace(limit, offset)
+    dspace_repository.get_all_items(
+      expand: ['metadata','bitstreams'],
+      limit: limit, offset: offset
+    )
+  end
+
+  def initialize_learning_object item
+    metadata = build_array_of(item.metadata)
+    bitstreams = build_array_of(item.bit_streams)
+    current_date = Time.new
+
+    LearningObject.new(
+      :name => item.name,
+      :description => select_value_of(metadata, "dc.description"),
+      :thumbnail => '/thumbnails/default_thumbnail.jpg',
+      :created_at => current_date,
+      :last_modified => current_date,
+      :id_dspace => item.id,
+      :type => item.type,
+      :bitstreams => bitstreams,
+      :metadata => metadata
+    )
+  end
+
+  def build_array_of(item_content=[])
+    return item_content if item_content.nil?
+    content_array = []
+    item_content.each do |i|
+      content_array << i.to_h
+    end
+    return content_array
+  end
+
+  def select_value_of(array, key)
+    descriptions = array.select { |a|  a[:key] == key }
+    unless descriptions.empty?
+      descriptions.first[:value]
+    end
+  end
+
+end
diff --git a/lib/tasks/fakeData.rake b/lib/tasks/fakeData.rake
new file mode 100644
index 0000000000000000000000000000000000000000..07f90f587c7cc4d7c781eb0b039ca14ca40a26be
--- /dev/null
+++ b/lib/tasks/fakeData.rake
@@ -0,0 +1,89 @@
+namespace :fakedata do
+  desc "Fake data generation tasks"
+
+  task generate_users: :environment do
+    desc "Generate fake Users"
+
+    include RepositoriesProxy
+
+    total_new_users = 50
+
+    (1..total_new_users).each do |i|
+      user = User.new(
+              :name => "User#{i}",
+              :email => "user#{i}@inf.ufpr.br",
+              :password => "1234567890",
+              :password_confirmation => "1234567890"
+            )
+      user.save
+    end
+  end
+
+  task generate_data: :environment do
+    desc "Generate fake user Likes/Views data"
+
+    include RepositoriesProxy
+
+    # Quantity of items fetched on each iteration
+    limit = 100
+
+    # Start point from where items will be fetched
+    offset = 0
+
+    users = User.all
+
+    loop do
+
+      begin
+        # Get items from dspace (from offset to offset+limit)
+        learning_objects = learning_object_repository.all_from_offset_to_limit(limit,offset)
+      rescue
+        # Sleeps for a while to wait database's recovery
+        sleep(30.seconds)
+        # Goes to next iteration to retry
+        next
+      else
+        # Terminate loop if there are no more items to import
+        break if learning_objects.empty?
+
+        # Increment offset, to get new items on next iteration
+        offset = offset + limit
+
+        learning_objects.each do |lo|
+
+          users_views = []
+          users_likes = []
+
+          users.each do |user|
+            # Randomize "Views"
+            if random_check(30)
+              users_views << user.  id
+              # Randomize "Likes"
+              if random_check(70)
+                users_likes << user.id
+              end
+            end
+          end
+
+          MassiveViewsCreatorWorker.perform_async(lo.id, users_views)
+          MassiveLikesCreatorWorker.perform_async(lo.id, users_likes)
+
+        end
+
+      end
+
+    end
+
+  end
+
+  private
+
+  def random_check(threshold)
+    if rand(1..100) <= threshold
+      return true
+    else
+      return false
+    end
+  end
+
+end
diff --git a/lib/tasks/mainPage.rake b/lib/tasks/mainPage.rake
index 28340ebb86146c1bd67f767e7020207ff13a4607..bb6e25e0c90acd0dc5a38358aeb351779d7be14d 100644
--- a/lib/tasks/mainPage.rake
+++ b/lib/tasks/mainPage.rake
@@ -1,10 +1,11 @@
 namespace :mainPage do
   desc "Generate the MainPage"
   task :highlights => :environment do
-    repository = Portalmec::Application.repository
+    include RepositoriesProxy
+    # repository = Portalmec::Application.repository
     puts 'Generate the main page subject highlights'
     general_highlights = Array.new
-    subjects = repository.for(:subject).all
+    subjects = subject_repository.all
     subjects.each do |subject|
       # select all the learning objects about that subject
       objects = subject.learning_objects
@@ -20,17 +21,17 @@ namespace :mainPage do
 
       # add the object to the subject highlight
       puts subject.name
-      repository.for(:subject).update(subject.id,'set','highlights','[]')
+      subject_repository.update(subject.id,'set','highlights','[]')
       objects.each do |object|
-        repository.for(:subject).update(subject.id,'add','highlights',object.name)
+        subject_repository.update(subject.id,'add','highlights',object.name)
       end
     end
     puts 'Generating the main page highlights'
-    mainPage = repository.for(:mainPage).all.first
+    mainPage = main_page_repository.all.first
     rid = mainPage['@rid']
-    repository.for(:mainPage).update(rid,'set','highlights','[]')
+    main_page_repository.update(rid,'set','highlights','[]')
     general_highlights.each do |general_highlight|
-      repository.for(:mainPage).update(rid,'add','highlights',general_highlight.name)
+      main_page_repository.update(rid,'add','highlights',general_highlight.name)
     end
   end
 end
diff --git a/lib/tasks/orientdb.rake b/lib/tasks/orientdb.rake
index 3960b089c79d4eb241ba65c0995d26ddbc2e123c..55a0dd8c0fb89006e8322bc81a02881e1b757698 100644
--- a/lib/tasks/orientdb.rake
+++ b/lib/tasks/orientdb.rake
@@ -62,10 +62,10 @@ namespace :orientdb do
               lo.attributes << attribute
             end
           end
-            
-          p lo_repo.create_relations(lo)
+          
+          lo_repo.create_relations(lo)
         end
-        
+
         offset += limit
       end
     end
@@ -82,4 +82,4 @@ namespace :orientdb do
     hash
   end
 
-end
\ No newline at end of file
+end
diff --git a/lib/tasks/thumbnail.rake b/lib/tasks/thumbnail.rake
new file mode 100644
index 0000000000000000000000000000000000000000..634ff332df43e82355d617274b2469b6a4f3c3c7
--- /dev/null
+++ b/lib/tasks/thumbnail.rake
@@ -0,0 +1,39 @@
+namespace :thumbnail do
+
+  desc "Generate Thumbnails"
+  task :generate => :environment do
+
+    include RepositoriesProxy
+
+    # Quantity of items fetched on each iteration
+    limit = 500
+
+    # Start point from where items will be fetched
+    offset = 0
+
+    loop do
+
+      begin
+        # Get items from dspace (from offset to offset+limit)
+        items = learning_object_repository.all_from_offset_to_limit(offset,limit)
+      rescue
+        # Sleeps for a while to wait database's recovery
+        sleep(30.seconds)
+        # Goes to next iteration to retry
+        next
+      else
+        # Terminate loop if there are no more items to import
+        break if items.empty?
+
+        # Increment offset, to get new items on next iteration
+        offset = offset + limit
+
+        items.each do |item|
+          ThumbnailGeneratorWorker.perform_async(item.id)
+        end
+
+      end
+    end
+  end
+
+end
diff --git a/lib/thumbnail/creation.rb b/lib/thumbnail/creation.rb
new file mode 100644
index 0000000000000000000000000000000000000000..0531f65155074be2661e8ce889e30e7fd48f33f3
--- /dev/null
+++ b/lib/thumbnail/creation.rb
@@ -0,0 +1,68 @@
+module Thumbnail
+  module Creation
+
+    include Formats
+
+    def generate_thumbnail(input, filename, size)
+      unless accepted_formats.include? file_format(filename)
+        return default_thumbnail
+      else
+        thumbnail = thumbnail_path(filename, size)
+        output = "#{root_dir}#{thumbnail}"
+        begin
+          if accepted_video_formats.include? File.extname(input)
+            generate_video_thumbnail(input, output, size)
+          else
+            generate_image_thumbnail(input, output, size)
+          end
+        rescue
+          return default_thumbnail
+        else
+          return thumbnail
+        end
+      end
+
+    end
+
+    def default_thumbnail
+      @default_thumbnail ||= nil
+    end
+
+    private
+
+    def generate_video_thumbnail(input,output,size)
+      movie = FFMPEG::Movie.new(input)
+      frame = (movie.duration * 25/100).floor
+      movie.screenshot(output,
+                        { seek_time: frame, resolution: size },
+                        preserve_aspect_ratio: :width)
+    end
+
+    def generate_image_thumbnail(input,output,size)
+      # Read the image and resize it. The `change_geometry' method
+      # computes the new image geometry and yields to a block. The
+      # return value of the block is the return value of the method.
+      img = Magick::Image.read(input)[0]
+      img.change_geometry!(size) { |cols, rows| img.thumbnail! cols, rows }
+      img.write(output)
+    end
+
+    def encode_hash_from(object)
+      Digest::SHA1.hexdigest object
+    end
+
+    def thumbnail_path(filename, size)
+      thumbnail_name = encode_hash_from filename
+      thumbnail_path = "#{thumbnails_dir}/#{thumbnail_name}_#{size}.jpg"
+    end
+
+    def thumbnails_dir
+      @thumbnails_dir ||= "/thumbnails"
+    end
+
+    def root_dir
+      @root_dir ||= Rails.root.join('public')
+    end
+
+  end
+end
diff --git a/lib/thumbnail/formats.rb b/lib/thumbnail/formats.rb
new file mode 100644
index 0000000000000000000000000000000000000000..4df246e9bc30576c0886551952073f63750650cc
--- /dev/null
+++ b/lib/thumbnail/formats.rb
@@ -0,0 +1,36 @@
+module Thumbnail
+  module Formats
+
+    def file_format file
+      unless file.nil?
+        file_format = File.extname(file)
+      else
+        file_format = ""
+      end
+      file_format
+    end
+
+    def accepted_video_formats
+      lower = [".mp4", ".wmv", ".3gp", ".asf", ".avi", ".flv", ".mov", ".mpg", ".mpeg", ".rmvb", ".vob", ".webm"]
+      upper = [".MP4", ".WMV", ".3GP", ".ASF", ".AVI", ".FLV", ".MOV", ".MPG", ".MPEG", ".RMVB", ".VOB", ".WEBM"]
+      return lower + upper
+    end
+
+    def accepted_image_formats
+      lower = [".jpg", ".jpeg", ".gif", ".png", ".bmp", ".tif"]
+      upper = [".JPG", ".JPEG", ".GIF", ".PNG", ".BMP", ".TIF"]
+      return lower + upper
+    end
+
+    def accepted_other_formats
+      lower = [".pdf", ".pps"]
+      upper = [".PDF", ".PPS"]
+      return lower + upper
+    end
+
+    def accepted_formats
+      return accepted_video_formats + accepted_image_formats + accepted_other_formats
+    end
+
+  end
+end