Skip to content

Commit

Permalink
lab2023#27 Custom view helpers was created
Browse files Browse the repository at this point in the history
  • Loading branch information
tayfunoziserikan committed Aug 9, 2013
1 parent b7949e1 commit c84da35
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions helpers/view_helpers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module ViewHelpers
def page(title, id)
@page_id = id
content_for :title do
title
end
end

def launcher_active(page)
@page_id == page ? {class:'active'} : {}
end
end
4 changes: 2 additions & 2 deletions source/layouts/layout.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/[if lt IE 10] <html class="no-js lt-ie10" lang="en-us">
%html{lang: 'en', class: 'no-js'}
%head
%title= @title || 'Hierapolis'
%title= yield_content :title
%meta(http-equiv="content-type" content="text/html" charset="utf-8")
%meta(http-equiv="x-ua-compatible" content="ie=edge,chrome=1")
%meta(name="description" content="")
Expand All @@ -25,7 +25,7 @@
'//netdna.bootstrapcdn.com/font-awesome/3.2.0/css/font-awesome.min.css'
= yield_content :head

%body{class: @body_class || 'page'}
%body.main{class: @page || 'page'}

/ Navbar
= partial 'partials/navbar'
Expand Down

0 comments on commit c84da35

Please sign in to comment.