changeset 26:a8b0775798c3

Added title.
author Edho Arief <edho@myconan.net>
date Mon, 10 Sep 2012 03:49:08 +0700
parents faf30647205e
children 108e8d6fd0d5
files app/helpers/application_helper.rb app/views/layouts/application.html.erb app/views/pastes/new.html.erb
diffstat 3 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/app/helpers/application_helper.rb	Mon Sep 10 03:48:01 2012 +0700
+++ b/app/helpers/application_helper.rb	Mon Sep 10 03:49:08 2012 +0700
@@ -1,2 +1,10 @@
 module ApplicationHelper
+  def html_title
+    base_title = 'Zeropaste'
+    if content_for? :title
+      "#{content_for(:title)} | #{h base_title}".html_safe
+    else
+      base_title
+    end
+  end
 end
--- a/app/views/layouts/application.html.erb	Mon Sep 10 03:48:01 2012 +0700
+++ b/app/views/layouts/application.html.erb	Mon Sep 10 03:49:08 2012 +0700
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <html>
 <head>
-  <title>Zeropaste</title>
+  <title><%= html_title %></title>
   <%= stylesheet_link_tag    "application", :media => "all" %>
   <%= javascript_include_tag "application" %>
   <%= csrf_meta_tags %>
--- a/app/views/pastes/new.html.erb	Mon Sep 10 03:48:01 2012 +0700
+++ b/app/views/pastes/new.html.erb	Mon Sep 10 03:49:08 2012 +0700
@@ -1,3 +1,4 @@
+<% provide :title, 'New Paste' %>
 <h1>New Paste</h1>
 
 <%= render 'form' %>