<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/utype/part_controllers.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -12,6 +12,7 @@ Utype::App.after_components_init do
       klass.is(:configurable, :with =&gt; {
         :comments_expire_time =&gt; { :default =&gt; 0 }
       })
+      klass.has_liquid_properties :comments_count
     end
   end
   </diff>
      <filename>app/components/comments/init.rb</filename>
    </modified>
    <modified>
      <diff>@@ -5,6 +5,13 @@ module Utype::ContentExtensions
       receiver.before :destroy do
         self.comments.destroy! 
       end
+      receiver.send(:include, InstanceMethods)
+    end
+    
+    module InstanceMethods
+      def comments_count
+        self.comments.count
+      end
     end
   end
 end
\ No newline at end of file</diff>
      <filename>app/components/comments/lib/utype/content_extensions/has_comments.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,21 +1,28 @@
-class CommentsPart &lt; Utype::Parts::Controller
+class CommentsPart &lt; Utype::PartControllers::Components
+  register_data_fetchers :set_javascripts =&gt; [:comment_form] # TODO: this should be handled somewhere else
+  before :fetch_content
+  
   def comment_form
-    fetch_content
-    @template_data['javascripts'] = ['comments/form']
+    render
   end
   
   def comments_list
-    content = fetch_content
-    if content
-      @template_data['comments'] = content.comments.all(:published =&gt; true, :order =&gt; [:published_at.desc])
+    if @template_data['content']
+      @template_data['comments'] = @template_data['content'].comments.all(
+        :published =&gt; true, :order =&gt; [:published_at.desc])
     end
+    render
   end
   
   private
   
-  def fetch_content
-    content  = @web_controller.template_data.find { 
-      |k, v| v if Comment::COMMENTABLE_TYPES.include?(v.class.to_s.downcase.to_sym) }
-    @template_data['content'] = content.last if content
-  end
+    def fetch_content
+      content  = @web_controller.template_data.find { 
+        |k, v| v if Comment::COMMENTABLE_TYPES.include?(v.class.to_s.downcase.to_sym) }
+      @template_data['content'] = content.last if content
+    end
+    
+    def set_javascripts
+      @template_data['javascripts'] = ['utype/ui/watermark', 'comments/form']
+    end
 end</diff>
      <filename>app/components/comments/parts/comments_part.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,17 +1,19 @@
-class PublisherPart &lt; Utype::Parts::Controller
+class PublisherPart &lt; Utype::PartControllers::Components
+  register_data_fetchers :get_post =&gt; [:post_content]
+  
   def post_list
-    set_stylesheets
     @template_data['posts'] = Post.all(:published =&gt; true, :order =&gt; [:published_at.desc])
+    render
   end
   
   def post_content
-    set_stylesheets
-    @template_data['post'] = params[:permalink].nil? ? 
-      Post.get(params[:id]) : Post.first(:published =&gt; true, :permalink =&gt; params[:permalink])
+    render
   end
   
-  private
-    def set_stylesheets
-      @template_data['stylesheets'] = ['publisher/post']
+  protected
+    
+    def get_post
+      @template_data['post'] = params[:permalink].nil? ? 
+        Post.get(params[:id]) : Post.first(:published =&gt; true, :permalink =&gt; params[:permalink])
     end
 end</diff>
      <filename>app/components/publisher/parts/publisher_part.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,10 +1,12 @@
-class TagsPart &lt; Utype::Parts::Controller
+class TagsPart &lt; Utype::PartControllers::Components
   def tagged_content
     @template_data['tag']      = Tag.first(:name =&gt; params[:tag_list])
     @template_data['contents'] = Content.tagged_with(params[:tag_list]).sort_by {|c| [c.published_at, c.title]}.reverse
+    render
   end
   
   def tags_claud
     @template_data['tags'] = Tag.all.sort_by {|t| [t.name, t.taggables_count]}
+    render
   end
 end
\ No newline at end of file</diff>
      <filename>app/components/tags/parts/tags_part.rb</filename>
    </modified>
    <modified>
      <diff>@@ -6,4 +6,4 @@ Merb::Router.prepare([], Merb::Router.routes) do
 end
 
 # Add tag specific routes
-Utype::Routes.load_site_routes('/:tag_list', { :tag_list =&gt; /\w+/ }, :prepend)
\ No newline at end of file
+Utype::Routes.load_site_routes('/:tag_list', { :tag_list =&gt; /\w+/ })
\ No newline at end of file</diff>
      <filename>app/components/tags/routes.rb</filename>
    </modified>
    <modified>
      <diff>@@ -22,6 +22,7 @@ module Admin
       @page = ::Page.new(params[:page])
       @page.site_id = @current_site.id
       @page.site = @current_site
+      @page.is_static = params[:page][:component_installation_ids].blank?
       if @page.save
         @page_type = PageType.get(params[:page][:page_type_id])
         if @page_type
@@ -50,6 +51,7 @@ module Admin
         new_default.save
       end
       @page.component_installation_ids = params[:component_installation_ids] || []
+      @page.is_static = params[:component_installation_ids].blank?
       @page.update_attributes(params[:page])
       @page.create_or_update_content(params[:content_body]) unless params[:content_body].blank?
       redirect url(:admin_pages)</diff>
      <filename>app/controllers/admin/pages.rb</filename>
    </modified>
    <modified>
      <diff>@@ -11,6 +11,7 @@ class Page
   property :template, String, :length =&gt; 1..255
   property :template_layout, String, :default =&gt; nil
   property :is_default, Boolean, :default =&gt; false
+  property :is_static, Boolean, :default =&gt; true
   property :position, Integer, :default =&gt; nil
   property :menu_location, String, :default =&gt; nil
   property :created_at, DateTime
@@ -68,7 +69,7 @@ class Page
   end
   
   def is_static?
-    self.page_type_id.nil?
+    self.is_static
   end
   
   def has_site?</diff>
      <filename>app/models/page.rb</filename>
    </modified>
    <modified>
      <diff>@@ -9,6 +9,7 @@ class User
   property :login, String, :unique =&gt; true, :length =&gt; 3..50
   property :password_hash, String
   property :email, String, :format =&gt; :email_address
+  property :www, String, :format =&gt; :url
   property :admin_theme, String, :default =&gt; 'utype'
   property :created_at, DateTime
   property :updated_at, DateTime</diff>
      <filename>app/models/user.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,8 +1,10 @@
+require 'utype/part_controllers'
+
 module Admin
-  class PageMenuPart &lt; Utype::Parts::Controller
-    def set_data
+  class PageMenuPart &lt; Utype::PartControllers::Components
+    def page_menu
       selected_action = &quot;/#{params[:controller]}/#{params[:action]}&quot;
-      selected = { @component.site.page.id =&gt; 'selected' }
+      selected = { @components.values.first.site.page.id =&gt; 'selected' }
       @template_data = { 
         'pages' =&gt; Admin::Page.all(
           :site_id =&gt; Admin::Site.current.id,
@@ -19,6 +21,7 @@ module Admin
           end
         end unless page['actions'].nil?
       end
+      render
     end
   end
 end</diff>
      <filename>app/parts/admin/page_menu_part.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,25 +1,21 @@
-require 'utype/parts/controller'
+require 'utype/part_controllers'
 
-class PagePart &lt; Utype::Parts::Controller
+class PagePart &lt; Utype::PartControllers::Front
   def initialize(controller, page)
     super(controller, page)
     @page = page
   end
   
-  def set_data
-    component_parts = []
-    @page.components.each do |c|
-      component_parts &lt;&lt; cp = c.part_class.new(self, c)
-      cp.send(c.action) if cp.respond_to?(c.action)
-      @template_data.merge!(cp.template_data)
-    end
-    # Render the components
-    component_parts.each do |cp|
-      @template_data[cp.component.action] = cp._dispatch(:index)
-    end
-    # Set the content associated with the page
+  def set_template_data
+    @template_data['javascripts'] = []
+    @template_data['stylesheets'] = []
+    
+    # if it's a static page, then just set the content
+    # otherwise render the associated components
     if @page.content &amp;&amp; @page.is_static?
       @template_data['content'] = @page.content
+    else
+      render_components
     end
   end
 end</diff>
      <filename>app/parts/page_part.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,33 +1,25 @@
-require 'utype/parts/controller'
+require 'utype/part_controllers'
 
-class SitePart &lt; Utype::Parts::Controller
+class SitePart &lt; Utype::PartControllers::Front
   attr_reader :page_part
   
   def initialize(controller, site, page)
     super(controller, site)
     @site = site
-    @page = page
-    @page_part = PagePart.new(controller, @page)
+    @page_part = PagePart.new(controller, page)
   end
   
-  def set_data
-    component_parts = []
-    @site.components.each do |c|
-      component_parts &lt;&lt; cp = c.part_class.new(self, c)
-      cp.send(c.action) if cp.respond_to?(c.action)
-      @template_data.merge!(cp.template_data)
-    end
-    # Render the components
-    component_parts.each do |cp|
-      @template_data[cp.component.action] = cp._dispatch(:index)
-    end
+  def set_template_data
+    # render site components
+    render_components
     # Setup data
     @template_data.merge!({
       'site'          =&gt; @site,
       'pages'         =&gt; @site.pages.all(:menu_location.not =&gt; nil),
       'content'       =&gt; @page_part._dispatch(:index),
-      'javascripts'   =&gt; @page_part.template_data['javascripts'],
-      'stylesheets'   =&gt; @page_part.template_data['stylesheets']
+      'javascripts'   =&gt; @page_part.template_data['javascripts'].flatten.uniq,
+      'stylesheets'   =&gt; @page_part.template_data['stylesheets'].flatten.uniq,
+      'utype_version' =&gt; Utype::Constants::VERSION
     })
   end
   </diff>
      <filename>app/parts/site_part.rb</filename>
    </modified>
    <modified>
      <diff>@@ -4,8 +4,18 @@
   &lt;head&gt;
     &lt;meta http-equiv=&quot;Content-type&quot; content=&quot;text/html;charset=utf-8&quot; /&gt;
     &lt;title&gt;{{ current_site.name }} &amp;laquo; Administration&lt;/title&gt;
-    {% include 'stylesheets' %}
-    {% include 'javascripts' %}
+    &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;screen&quot; href=&quot;/stylesheets/reset-min.css&quot; /&gt;
+    &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;screen&quot; href=&quot;/stylesheets/common.css&quot; /&gt;
+    &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;screen&quot; href=&quot;/stylesheets/admin/main.css&quot; /&gt;
+    {% for stylesheet in stylesheets %}
+    &lt;script src=&quot;/stylesheets/{{stylesheet}}.css&quot; type=&quot;text/css&quot; media=&quot;screen&quot;&gt;&lt;/script&gt;
+    {% endfor %}
+    &lt;script src=&quot;/javascripts/vendor/jquery-1.2.6.min.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
+    &lt;script src=&quot;/javascripts/utype/ui/watermark.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
+    &lt;script src=&quot;/javascripts/admin/main.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
+    {% for javascript in javascripts %}
+    &lt;script src=&quot;/javascripts/{{javascript}}.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
+    {% endfor %}
   &lt;/head&gt;
   &lt;body class=&quot;admin&quot;&gt;
     &lt;div id=&quot;header&quot;&gt;</diff>
      <filename>themes/admin/utype/layouts/index.liquid</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>lib/utype/parts/controller.rb</filename>
    </removed>
    <removed>
      <filename>lib/utype/renderers/liquid.rb</filename>
    </removed>
    <removed>
      <filename>public/javascripts/common/utype.watermark.js</filename>
    </removed>
    <removed>
      <filename>themes/admin/utype/layouts/parts/_javascripts.liquid</filename>
    </removed>
    <removed>
      <filename>themes/admin/utype/layouts/parts/_stylesheets.liquid</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>fbab2ac8251afa62cc20d8b99d350e679d8ab41a</id>
    </parent>
  </parents>
  <author>
    <name>solnic</name>
    <email>piotr@zenbe.com</email>
  </author>
  <url>http://github.com/mariusz/utype/commit/d39d3dc5862794c7766521ce975ade70761646fd</url>
  <id>d39d3dc5862794c7766521ce975ade70761646fd</id>
  <committed-date>2008-11-11T09:26:22-08:00</committed-date>
  <authored-date>2008-11-11T09:26:22-08:00</authored-date>
  <message>refactored (again) the way how parts are rendered + comments related work</message>
  <tree>3b77029991ac679c1c007ed0b7f322f360e24143</tree>
  <committer>
    <name>solnic</name>
    <email>piotr@zenbe.com</email>
  </committer>
</commit>
