Skip to content
Snippets Groups Projects
Commit 96b69d14 authored by Mauricio Giacomini Girardello's avatar Mauricio Giacomini Girardello
Browse files

move logic of learning object view to helper

parent 0531a124
No related branches found
No related tags found
No related merge requests found
......@@ -4,4 +4,15 @@ module LearningObjectsHelper
categories.to_s
end
def render_learning_object(orientation, learning_object)
case (orientation)
when "vertical"
render "learning_objects/learning_object_vertical", learning_object: learning_object
when "horizontal"
render "learning_objects/learning_object_horizontal", learning_object: learning_object
else
render "learning_objects/learning_object_horizontal", learning_object: learning_object
end
end
end
class LearningObject
include ActiveModel::Model
attr_accessor :id, :id_dspace, :rid, :name, :description,
:thumbnail, :date_creation, :last_modified,
:thumbnail, :created_at, :last_modified,
:type, :bitstreams, :metadata, :likes, :views, :downloads
validates_presence_of :name, :date_creation, :type, :likes, :views, :downloads
validates_presence_of :name, :created_at, :type, :likes, :views, :downloads
validates_numericality_of :likes, greater_than_or_equal_to: 0
validates_numericality_of :views, greater_than_or_equal_to: 0
validates_numericality_of :downloads, greater_than_or_equal_to: 0
......
<%=
case(orientation)
when "vertical"
render "learning_objects/learning_object_vertical", learning_object: learning_object
when "horizontal"
render "learning_objects/learning_object_horizontal", learning_object: learning_object
else
render "learning_objects/learning_object_horizontal", learning_object: learning_object
end
%>
<%= render_learning_object orientation, learning_object %>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment