whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sam Ruby <ru...@apache.org>
Subject [whimsy.git] [22/50] Commit f97c44a: update title in one place
Date Fri, 22 Jan 2016 02:40:55 GMT
Commit f97c44ad896209b85ef840675a4cb53012af852e:
    update title in one place


Branch: refs/heads/master
Author: Sam Ruby <rubys@intertwingly.net>
Committer: Sam Ruby <rubys@intertwingly.net>
Pusher: rubys <rubys@apache.org>

------------------------------------------------------------
views/header.js.rb                                           | ++++++++ 
views/main.js.rb                                             |  ---
------------------------------------------------------------
11 changes: 8 additions, 3 deletions.
------------------------------------------------------------


diff --git a/views/header.js.rb b/views/header.js.rb
index 473631a..d179e82 100644
--- a/views/header.js.rb
+++ b/views/header.js.rb
@@ -71,4 +71,12 @@ def render
       end
     end
   end
+
+  def componentDidMount()
+    self.componentDidUpdate()
+  end
+
+  def componentDidUpdate()
+    document.getElementsByTagName('title')[0].textContent = @@item.title
+  end
 end
diff --git a/views/main.js.rb b/views/main.js.rb
index d8cfcc0..285a597 100644
--- a/views/main.js.rb
+++ b/views/main.js.rb
@@ -27,7 +27,6 @@ def componentWillMount()
   def navigate(path)
     self.route(path)
     history.pushState({path: path}, nil, path)
-    document.getElementsByTagName('title')[0].textContent = @item.title
   end
 
   def componentDidMount()
@@ -35,12 +34,10 @@ def componentDidMount()
     Main.navigate = self.navigate
 
     history.replaceState({path: @@path}, nil, @@path)
-    document.getElementsByTagName('title')[0].textContent = @item.title
 
     window.addEventListener :popstate do |event|
       if event.state and event.state.path
         self.route(event.state.path)
-        document.getElementsByTagName('title')[0].textContent = @item.title
       end
     end
 

Mime
View raw message