From 3562a4142ad8a8f8b2b3a1a10538acfbf146d462 Mon Sep 17 00:00:00 2001 From: Lars Henrik Mai Date: Tue, 4 Nov 2014 19:23:17 +0100 Subject: add helpers for project infos --- helpers/projects_helpers.rb | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 helpers/projects_helpers.rb (limited to 'helpers') diff --git a/helpers/projects_helpers.rb b/helpers/projects_helpers.rb new file mode 100644 index 0000000..3007b17 --- /dev/null +++ b/helpers/projects_helpers.rb @@ -0,0 +1,30 @@ +module ProjectsHelpers + + class Project + + attr_reader :name, :text, :link, :bild + + def initialize(atts={}) + @name = atts.fetch("name") + @text = atts.fetch("text") + @link = atts.fetch("link", nil) + @bild = atts.fetch("bild", nil) + end + + end + + def projects + data.projects.map {|atts| Project.new(atts) } + end + + def project_classes(project) + [ + "large-6", + "medium-6", + "columns", + ("end" if projects.last.name == project.name) + ] + end + + +end -- cgit v1.2.1