From 2488a50b57aa08d8de686dda0bf4c492391e22f0 Mon Sep 17 00:00:00 2001
From: Mateus Rambo Strey <mars11@inf.ufpr.br>
Date: Fri, 4 Mar 2016 11:30:10 -0300
Subject: [PATCH] add missing files

---
 app/models/concerns/thumbnailable.rb                     | 9 +++++++++
 app/views/follows/_button.html.erb                       | 2 ++
 .../20160303120433_add_counter_to_user_collection.rb     | 6 ++++++
 .../20160304100533_change_learning_object_score.rb       | 5 +++++
 .../20160304102333_add_thumbnail_for_collections.rb      | 5 +++++
 5 files changed, 27 insertions(+)
 create mode 100644 app/models/concerns/thumbnailable.rb
 create mode 100644 app/views/follows/_button.html.erb
 create mode 100644 db/migrate/20160303120433_add_counter_to_user_collection.rb
 create mode 100644 db/migrate/20160304100533_change_learning_object_score.rb
 create mode 100644 db/migrate/20160304102333_add_thumbnail_for_collections.rb

diff --git a/app/models/concerns/thumbnailable.rb b/app/models/concerns/thumbnailable.rb
new file mode 100644
index 000000000..b497ae777
--- /dev/null
+++ b/app/models/concerns/thumbnailable.rb
@@ -0,0 +1,9 @@
+module Thumbnailable
+  extend ActiveSupport::Concern
+
+  included do
+    has_attached_file :thumbnail, styles: { medium: '530x300', small: '250x140' }
+    validates_attachment_content_type :thumbnail, content_type: ['image/jpg', 'image/jpeg', 'image/png', 'image/gif']
+  end
+
+end
diff --git a/app/views/follows/_button.html.erb b/app/views/follows/_button.html.erb
new file mode 100644
index 000000000..ef4628abf
--- /dev/null
+++ b/app/views/follows/_button.html.erb
@@ -0,0 +1,2 @@
+<% follow_text = current_user.following?(followable) ? 'Deixar de seguir' : 'Seguir' %>
+<%= link_to follow_text, follow_user_path(id: current_user.id, followable_type: followable.class.name, followable_id: followable.id), method: :post, remote: true, class: 'btn btn-default follow-button' %>
diff --git a/db/migrate/20160303120433_add_counter_to_user_collection.rb b/db/migrate/20160303120433_add_counter_to_user_collection.rb
new file mode 100644
index 000000000..d8e7e755a
--- /dev/null
+++ b/db/migrate/20160303120433_add_counter_to_user_collection.rb
@@ -0,0 +1,6 @@
+class AddCounterToUserCollection < ActiveRecord::Migration
+  def change
+    add_column :collections, :follows_count, :integer, default: 0
+    add_column :users, :follows_count, :integer, default: 0
+  end
+end
diff --git a/db/migrate/20160304100533_change_learning_object_score.rb b/db/migrate/20160304100533_change_learning_object_score.rb
new file mode 100644
index 000000000..ef4a47bf6
--- /dev/null
+++ b/db/migrate/20160304100533_change_learning_object_score.rb
@@ -0,0 +1,5 @@
+class ChangeLearningObjectScore < ActiveRecord::Migration
+  def change
+    change_column :learning_objects, :score, :float, default: 0.0
+  end
+end
diff --git a/db/migrate/20160304102333_add_thumbnail_for_collections.rb b/db/migrate/20160304102333_add_thumbnail_for_collections.rb
new file mode 100644
index 000000000..ac34185cd
--- /dev/null
+++ b/db/migrate/20160304102333_add_thumbnail_for_collections.rb
@@ -0,0 +1,5 @@
+class AddThumbnailForCollections < ActiveRecord::Migration
+  def change
+    add_attachment :collections, :thumbnail
+  end
+end
-- 
GitLab