<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Vhochstein&#039;s Blog</title>
	<atom:link href="http://vhochstein.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://vhochstein.wordpress.com</link>
	<description>Just another WordPress.com site</description>
	<lastBuildDate>Wed, 17 Apr 2013 06:35:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='vhochstein.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Vhochstein&#039;s Blog</title>
		<link>http://vhochstein.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://vhochstein.wordpress.com/osd.xml" title="Vhochstein&#039;s Blog" />
	<atom:link rel='hub' href='http://vhochstein.wordpress.com/?pushpress=hub'/>
		<item>
		<title>ActiveScaffold render :super</title>
		<link>http://vhochstein.wordpress.com/2012/02/18/activescaffold-render-super/</link>
		<comments>http://vhochstein.wordpress.com/2012/02/18/activescaffold-render-super/#comments</comments>
		<pubDate>Sat, 18 Feb 2012 09:05:43 +0000</pubDate>
		<dc:creator>vhochstein</dc:creator>
				<category><![CDATA[ActiveScaffold]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[:super]]></category>
		<category><![CDATA[partial]]></category>
		<category><![CDATA[render]]></category>
		<category><![CDATA[template]]></category>

		<guid isPermaLink="false">http://vhochstein.wordpress.com/?p=171</guid>
		<description><![CDATA[You all may know that there is a quite flexible hierarchy for activescaffold s templates and partials. If you would like to override one in general for your application copy and change it in app/views/active_scaffold_overrides/. If you would like to override one just for one specific controller copy and change it in app/views/controller_name/. In addition <a href="http://vhochstein.wordpress.com/2012/02/18/activescaffold-render-super/" class="excerpt-more-link">[&#8230;]</a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vhochstein.wordpress.com&#038;blog=15467409&#038;post=171&#038;subd=vhochstein&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>You all may know that there is a quite flexible hierarchy for activescaffold s templates and partials.<br />
If you would like to override one in general for your application copy and change it in app/views/active_scaffold_overrides/.<br />
If you would like to override one just for one specific controller copy and change it in app/views/controller_name/.</p>
<p>In addition to do a full override you may also call parent s view eg. to wrap parent template/view or to change some locals. I will show you how to do that in this post.</p>
<p>Just a simple render :super call in your overwritten template/partial is all you need to activate this feature.</p>
<pre class="brush: ruby; title: ; notranslate">
&lt;%= render :super %&gt;
</pre>
<p>If you would like to change a local variable you have to do the following and it depends on your activescaffold version:</p>
<h3> :super with locals for ActiveScaffold 3.0</h3>
<pre class="brush: ruby; title: ; notranslate">
&lt;%= render :super, :locals =&gt; {:headline =&gt; 'My _base_form headline'} %&gt;
</pre>
<h3> :super with locals for ActiveScaffold 3.1 and 3.2</h3>
<pre class="brush: ruby; title: ; notranslate">
&lt;%= render :partial =&gt; :super, :locals =&gt; {:headline =&gt; 'My _base_form headline'} %&gt;
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vhochstein.wordpress.com/171/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vhochstein.wordpress.com/171/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vhochstein.wordpress.com&#038;blog=15467409&#038;post=171&#038;subd=vhochstein&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vhochstein.wordpress.com/2012/02/18/activescaffold-render-super/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6f5181b51ffc08e48a8460314de9f3d2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vhochstein</media:title>
		</media:content>
	</item>
		<item>
		<title>ActiveScaffold Asset Pipeline Comparison</title>
		<link>http://vhochstein.wordpress.com/2011/12/22/activescaffold-asset-pipeline-comparison/</link>
		<comments>http://vhochstein.wordpress.com/2011/12/22/activescaffold-asset-pipeline-comparison/#comments</comments>
		<pubDate>Thu, 22 Dec 2011 12:05:13 +0000</pubDate>
		<dc:creator>vhochstein</dc:creator>
				<category><![CDATA[ActiveScaffold]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Asset Pipeline]]></category>

		<guid isPermaLink="false">http://vhochstein.wordpress.com/?p=163</guid>
		<description><![CDATA[Today I would like to compare a activescaffold rails 3.0 controller index action waterfall chart with one of a rails 3.1 controller. You will see a big difference in these charts because of the asset pipeline feature. Asset pipeline is merging your js and css assets into one big file which improves your webperformance because <a href="http://vhochstein.wordpress.com/2011/12/22/activescaffold-asset-pipeline-comparison/" class="excerpt-more-link">[&#8230;]</a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vhochstein.wordpress.com&#038;blog=15467409&#038;post=163&#038;subd=vhochstein&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Today I would like to compare a activescaffold rails 3.0 controller index action waterfall chart with one of a rails 3.1 controller.<br />
You will see a big difference in these charts because of the asset pipeline feature. Asset pipeline is merging your js and css assets into one big file which improves your webperformance because of reduced http requests.<br />
In addition I m using css data-uri feature for background images. Please note that ie6 and ie7 do not support data-uris.</p>
<h3>Rails 3.0 waterfall</h3>
<p><a href="http://vhochstein.files.wordpress.com/2011/12/waterfall30.png"><img src="http://vhochstein.files.wordpress.com/2011/12/waterfall30.png?w=500&#038;h=284" alt="" title="ActiveScaffold 3.0 waterfall chart" width="500" height="284" class="alignnone size-full wp-image-164" /></a></p>
<h3>Rails 3.1 waterfall</h3>
<p><a href="http://vhochstein.files.wordpress.com/2011/12/waterfall_31.png"><img src="http://vhochstein.files.wordpress.com/2011/12/waterfall_31.png?w=500&#038;h=115" alt="" title="ActiveScaffold 3.1 Waterfall Chart" width="500" height="115" class="alignnone size-full wp-image-165" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vhochstein.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vhochstein.wordpress.com/163/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vhochstein.wordpress.com&#038;blog=15467409&#038;post=163&#038;subd=vhochstein&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vhochstein.wordpress.com/2011/12/22/activescaffold-asset-pipeline-comparison/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6f5181b51ffc08e48a8460314de9f3d2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vhochstein</media:title>
		</media:content>

		<media:content url="http://vhochstein.files.wordpress.com/2011/12/waterfall30.png" medium="image">
			<media:title type="html">ActiveScaffold 3.0 waterfall chart</media:title>
		</media:content>

		<media:content url="http://vhochstein.files.wordpress.com/2011/12/waterfall_31.png" medium="image">
			<media:title type="html">ActiveScaffold 3.1 Waterfall Chart</media:title>
		</media:content>
	</item>
		<item>
		<title>ActiveScaffold Unobtrusive Javascript and TinyMCE</title>
		<link>http://vhochstein.wordpress.com/2011/12/03/activescaffold-unobtrusive-javascript-and-tinymce/</link>
		<comments>http://vhochstein.wordpress.com/2011/12/03/activescaffold-unobtrusive-javascript-and-tinymce/#comments</comments>
		<pubDate>Sat, 03 Dec 2011 09:08:14 +0000</pubDate>
		<dc:creator>vhochstein</dc:creator>
				<category><![CDATA[ActiveScaffold]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[tinymce]]></category>
		<category><![CDATA[unobtrusive]]></category>

		<guid isPermaLink="false">http://vhochstein.wordpress.com/?p=157</guid>
		<description><![CDATA[My last post covered the topic how ActiveScaffold and Unobtrusive Javascript may fit together. This time I would like to give you an example. It s Activescaffold&#8217;s TinyMCE Bridge. It s a perfect example, cause it s a pure javascript feature. Let&#8217;s take a look at the bridge file using obtrusive javascript: Loading tinymce editor <a href="http://vhochstein.wordpress.com/2011/12/03/activescaffold-unobtrusive-javascript-and-tinymce/" class="excerpt-more-link">[&#8230;]</a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vhochstein.wordpress.com&#038;blog=15467409&#038;post=157&#038;subd=vhochstein&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>My last post covered the topic how ActiveScaffold and Unobtrusive Javascript may fit together. This time I would like to give you an example.<br />
It s Activescaffold&#8217;s TinyMCE Bridge. It s a perfect example, cause it s a pure javascript feature.<br />
Let&#8217;s take a look at the bridge file using obtrusive javascript:</p>
<h2>Loading tinymce editor</h2>
<h3>Obtrusive Javascript</h3>
<pre class="brush: ruby; title: ; notranslate">
def active_scaffold_input_text_editor(column, options)
    options[:class] = &quot;#{options[:class]} mceEditor #{column.options[:class]}&quot;.strip
    html = []
    html &lt;&lt; send(override_input(:textarea), column, options)
    html &lt;&lt; javascript_tag(&quot;tinyMCE.execCommand('mceAddControl', false, '#{options[:id]}');&quot;) if request.xhr?
    html.join &quot;\n&quot;
end
</pre>
<p>We use an activescaffold input override to add javascript code to our textareas.</p>
<h3>Unobtrusive Javascript</h3>
<pre class="brush: jscript; title: ; notranslate">
$('form.as_form').live('as:form_loaded', function(event) {
  var as_form = $(this).closest(&quot;form&quot;);
  as_form.find('textarea.as_mceEditor').each(function(index, elem) {
    tinyMCE.execCommand('mceAddControl', false, $(elem).attr('id'));
  });
  return true;
});
</pre>
<p>A listener to activescaffold form_load event, finding all textareas and adding tinyMCE control.</p>
<h2>Submitting tinymce editor</h2>
<h3>Obtrusive Javascript</h3>
<pre class="brush: ruby; title: ; notranslate">
def onsubmit
    if ActiveScaffold.js_framework == :jquery
       submit_js = 'tinyMCE.triggerSave();$(\'textarea.mceEditor\').each(function(index, elem) { tinyMCE.execCommand(\'mceRemoveControl\', false, $(elem).attr(\'id\')); });' if using_tiny_mce?
    else
       submit_js = 'tinyMCE.triggerSave();this.select(\'textarea.mceEditor\').each(function(elem) { tinyMCE.execCommand(\'mceRemoveControl\', false, elem.id); });' if using_tiny_mce?
    end
    [super, submit_js].compact.join ';'
end
</pre>
<p>We use form submit method override to add javascript code, which will call tinyMCE.triggerSave method.</p>
<h3>Unobtrusive Javascript</h3>
<pre class="brush: jscript; title: ; notranslate">
$('form.as_form').live('as:form_submit', function(event) {
  var as_form = $(this).closest(&quot;form&quot;);
  if (as_form.has('textarea.as_mceEditor').length &gt; 0) {
    tinyMCE.triggerSave();
  }
  return true;
});
</pre>
<p>A listener to activescaffold form_submit event, finding all textareas using tinyMCE and calling triggerSave.</p>
<h2>Removing tinymce editor</h2>
<h3>Obtrusive Javascript</h3>
<pre class="brush: ruby; title: ; notranslate">
def active_scaffold_includes(*args)
        if ActiveScaffold.js_framework == :jquery
          tiny_mce_js = javascript_tag(%|
var action_link_close = ActiveScaffold.ActionLink.Abstract.prototype.close;
ActiveScaffold.ActionLink.Abstract.prototype.close = function() {
$(this.adapter).find('textarea.mceEditor').each(function(index, elem) {
tinyMCE.execCommand('mceRemoveControl', false, $(elem).attr('id'));
});
action_link_close.apply(this);
};
|) if using_tiny_mce?
        else
        ....
        end
        super(*args) + (include_tiny_mce_if_needed || '') + (tiny_mce_js || '')
      end
</pre>
<p>Ok, we add a javascript code snippet to activescaffold includes in case using_tiny_mce? returns true. Javascript code will link into action link.close action management and will remove our tiny_mce_editor. To be honest I do not like that solution at all. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<h3>Unobtrusive Version</h3>
<pre class="brush: jscript; title: ; notranslate">
$('form.as_form').live('as:form_unloaded', function(event) {
  var as_form = $(this).closest(&quot;form&quot;);
  as_form.find('textarea.as_mceEditor').each(function(index, elem) {
    tinyMCE.execCommand('mceRemoveControl', false, $(elem).attr('id'));
  });
  return true;
});
</pre>
<p>A listener to activescaffold form_unload event, finding all textareas and removing tinyMCE control.</p>
<h2>Summary</h2>
<p>Did we achieve our goals?<br />
We ve separated javascript code from ruby code. which improves code quality and maintainability. You do not have to be an activescaffold expert anymore to add javascript functionality to forms, form_columns, list_columns. You just need to know javascript.</p>
<p>Hope that helps.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vhochstein.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vhochstein.wordpress.com/157/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vhochstein.wordpress.com&#038;blog=15467409&#038;post=157&#038;subd=vhochstein&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vhochstein.wordpress.com/2011/12/03/activescaffold-unobtrusive-javascript-and-tinymce/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6f5181b51ffc08e48a8460314de9f3d2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vhochstein</media:title>
		</media:content>
	</item>
		<item>
		<title>ActiveScaffold and Unobtrusive Javascript</title>
		<link>http://vhochstein.wordpress.com/2011/11/23/activescaffold-and-unobtrusive-javascript/</link>
		<comments>http://vhochstein.wordpress.com/2011/11/23/activescaffold-and-unobtrusive-javascript/#comments</comments>
		<pubDate>Wed, 23 Nov 2011 08:28:14 +0000</pubDate>
		<dc:creator>vhochstein</dc:creator>
				<category><![CDATA[ActiveScaffold]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[unobtrusive]]></category>

		<guid isPermaLink="false">http://vhochstein.wordpress.com/?p=154</guid>
		<description><![CDATA[Rails 3.0 started using unobtrusive javascript. However, what does that actually mean for activescaffold? Well, basically it means that there should nt be any javascript code in our partials. Looks easy at the first glance, however, if you start actually to implement it.. Big advances of unobtrusive javascript are: application works without javascript html code <a href="http://vhochstein.wordpress.com/2011/11/23/activescaffold-and-unobtrusive-javascript/" class="excerpt-more-link">[&#8230;]</a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vhochstein.wordpress.com&#038;blog=15467409&#038;post=154&#038;subd=vhochstein&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Rails 3.0 started using unobtrusive javascript. However, what does that actually mean for activescaffold? Well, basically it means that there should nt be any javascript code in our partials. Looks easy at the first glance, however, if you start actually to implement it..<br />
Big advances of unobtrusive javascript are:</p>
<ul>
<li> application works without javascript </li>
<li> html code seperated from javascript code </li>
<li> html id attribute is nt needed anymore for many operations </li>
</ul>
<p>I ve mentioned at the beginning that going unobtrusive is nt that easy as it seems. The big issues you have are:</p>
<ul>
<li>How to cleanly separate javascript code?</li>
<li>How may application work if javascript is disabled?</li>
<li>It s easy to manage click events, unobtrusively, but how to manage load events for ajax calls? </li>
</ul>
<p>In this post I will focus on the last bullet point. It took a while until I was able to manage that issue.<br />
Unobtrusive javascript needs a trigger event to add the javascript functionality. For example when you click a button. However, if you would like to add javascript functionality on load you are in kind of trouble for ajax applications, because load events of browsers do only fire if the whole page is loaded and not if snippets of html code are changed or added during an ajax call.</p>
<p>I ve solved that issue at least for activescaffold as follows.</p>
<p>ActiveScaffold will trigger the following events in case of page load and ajax load:</p>
<ul>
<li>as:list_row_loaded</li>
<li>as:form_loaded</li>
<li>as:form_element_loaded</li>
</ul>
<p>ActiveScaffold will trigger the following events in case of page unload and ajax unload:</p>
<ul>
<li>as:list_row_unloaded</li>
<li>as:form_unloaded</li>
<li>as:form_element_unloaded</li>
</ul>
<p>A simple use case would be the following: list columns may be configured for inplace editing, which is a pure javascript feature including the need to add it to the specified columns during as:list_row_load event:</p>
<pre class="brush: jscript; title: ; notranslate">
$('tr.record').live('as:list_row_loaded', function(event) {
  $(this).closest(&quot;tr&quot;).find('td &gt; span.in_place_editor_field').each(function(index) {
    ActiveScaffold.create_inplace_editor($(this));
  });
  return true;
});
</pre>
<p>In my next post I will show you how I ve migrated the tiny_mce bridge to unobtrusive javascript.</p>
<p>Hope you will benefit from this new javascript events, cause it will make the step to unobtrusive javascript a lot easier using activescaffold.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vhochstein.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vhochstein.wordpress.com/154/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vhochstein.wordpress.com&#038;blog=15467409&#038;post=154&#038;subd=vhochstein&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vhochstein.wordpress.com/2011/11/23/activescaffold-and-unobtrusive-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6f5181b51ffc08e48a8460314de9f3d2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vhochstein</media:title>
		</media:content>
	</item>
		<item>
		<title>ActiveScaffold per Request Configuration for ActionColumns</title>
		<link>http://vhochstein.wordpress.com/2011/10/22/activescaffold-per-request-configuration-for-actioncolumns/</link>
		<comments>http://vhochstein.wordpress.com/2011/10/22/activescaffold-per-request-configuration-for-actioncolumns/#comments</comments>
		<pubDate>Sat, 22 Oct 2011 14:39:59 +0000</pubDate>
		<dc:creator>vhochstein</dc:creator>
				<category><![CDATA[ActiveScaffold]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[column]]></category>

		<guid isPermaLink="false">http://vhochstein.wordpress.com/?p=149</guid>
		<description><![CDATA[If you take a look at Activescaffold per Request Configuration you will learn that you have to create a before_filter to be able to change column set per request. Well, that does nt feel right, before_filters should be used for aspect oriented programming tasks such as authentication, logging,.. However, it was quite complicated to do <a href="http://vhochstein.wordpress.com/2011/10/22/activescaffold-per-request-configuration-for-actioncolumns/" class="excerpt-more-link">[&#8230;]</a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vhochstein.wordpress.com&#038;blog=15467409&#038;post=149&#038;subd=vhochstein&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>If you take a look at <a href="https://github.com/activescaffold/active_scaffold/wiki/Per-Request-Configuration" title="Activescaffold per Request Configuration">Activescaffold per Request Configuration</a> you will learn that you have to create a before_filter to be able to change column set per request.<br />
Well, that does nt feel right, before_filters should be used for aspect oriented programming tasks such as authentication, logging,..</p>
<p>However, it was quite complicated to do it another way with Activescaffold.</p>
<p>I ve added a new feature to my fork which allows you to change column set configuration for a specific action without before_filters.</p>
<p>It s actually really easy, every action has a new method _columns, which you may override in your controller.</p>
<p>Let me give you some easy examples:</p>
<pre class="brush: ruby; title: ; notranslate">
def update_columns
  columns = super
  if @record.id == 85
    columns.select {|column| column.name != :last_name}
  else
    columns
  end
end
</pre>
<pre class="brush: ruby; title: ; notranslate">
def field_search_columns
  columns = super
  if sunny_weather
    columns.select {|column| column.name != :rain}
end
</pre>
<p>Wish you a great weekend.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vhochstein.wordpress.com/149/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vhochstein.wordpress.com/149/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vhochstein.wordpress.com&#038;blog=15467409&#038;post=149&#038;subd=vhochstein&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vhochstein.wordpress.com/2011/10/22/activescaffold-per-request-configuration-for-actioncolumns/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6f5181b51ffc08e48a8460314de9f3d2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vhochstein</media:title>
		</media:content>
	</item>
		<item>
		<title>ActiveScaffold and Rails 3.1</title>
		<link>http://vhochstein.wordpress.com/2011/07/09/activescaffold-and-rails-3-1/</link>
		<comments>http://vhochstein.wordpress.com/2011/07/09/activescaffold-and-rails-3-1/#comments</comments>
		<pubDate>Sat, 09 Jul 2011 14:36:21 +0000</pubDate>
		<dc:creator>vhochstein</dc:creator>
				<category><![CDATA[ActiveScaffold]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[rails 3.1]]></category>

		<guid isPermaLink="false">http://vhochstein.wordpress.com/?p=142</guid>
		<description><![CDATA[Today I would like to give you a short guide about how you may get ActiveScaffold up and running with Rails 3.1. Please be aware that ActiveScaffold is nt fully ported to Rails 3.1, so this guide is for early adopters who wanna try it out or help finishing development work. I assume that you <a href="http://vhochstein.wordpress.com/2011/07/09/activescaffold-and-rails-3-1/" class="excerpt-more-link">[&#8230;]</a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vhochstein.wordpress.com&#038;blog=15467409&#038;post=142&#038;subd=vhochstein&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Today I would like to give you a short guide about how you may get ActiveScaffold up and running with Rails 3.1. Please be aware that ActiveScaffold is nt fully ported to Rails 3.1, so this guide is for early adopters who wanna try it out or help finishing development work.</p>
<p>I assume that you ve got Rails 3.1/3.2 already installed on your computer.</p>
<p>1. rails new as_rails31<br />
2. please add below the line gem &#8216;jquery_rails&#8217; in your gem file following code:<br />
Official Gems:</p>
<pre class="brush: ruby; title: ; notranslate">
gem 'render_component_vho'
gem 'active_scaffold_vho'
</pre>
<p>Github Gems:</p>
<pre class="brush: ruby; title: ; notranslate">
gem 'render_component_vho', :git =&gt; 'git://github.com/vhochstein/render_component.git'
gem 'active_scaffold_vho', :git =&gt; 'git://github.com/vhochstein/active_scaffold.git'
</pre>
<p>3. bundle install<br />
4. bundle exec rake db:create<br />
5. rails g active_scaffold Team name:string position:integer<br />
6. bundle exec rake db:migrate<br />
7. Edit file /app/assets/javascripts/application.js</p>
<pre class="brush: ruby; title: ; notranslate">
//= require jquery
//= require jquery-ui
//= require jquery_ujs
//= require active_scaffold
//= require_tree .
</pre>
<p>8. Edit file /app/assets/stylesheets/application.css</p>
<pre class="brush: ruby; title: ; notranslate">
 *= require active_scaffold
 *= require_self
 *= require_tree . </pre>
<p>Hope you will enjoy.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vhochstein.wordpress.com/142/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vhochstein.wordpress.com/142/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vhochstein.wordpress.com&#038;blog=15467409&#038;post=142&#038;subd=vhochstein&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vhochstein.wordpress.com/2011/07/09/activescaffold-and-rails-3-1/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6f5181b51ffc08e48a8460314de9f3d2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vhochstein</media:title>
		</media:content>
	</item>
		<item>
		<title>Activescaffold Big Screen Touch Devices</title>
		<link>http://vhochstein.wordpress.com/2011/06/04/activescaffold-big-screen-touch-devices/</link>
		<comments>http://vhochstein.wordpress.com/2011/06/04/activescaffold-big-screen-touch-devices/#comments</comments>
		<pubDate>Sat, 04 Jun 2011 14:42:17 +0000</pubDate>
		<dc:creator>vhochstein</dc:creator>
				<category><![CDATA[ActiveScaffold]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[tablet]]></category>
		<category><![CDATA[touch]]></category>

		<guid isPermaLink="false">http://vhochstein.wordpress.com/?p=137</guid>
		<description><![CDATA[Well, it was only a question of time till one of my clients request better support for bigscreen touch devices such as iPad or some of these new Android tablets. Have you every tried activescaffold with an iPad? Close Icon is too small, hover is nt supported, record actionlinks are not optimized for touch input&#8230; <a href="http://vhochstein.wordpress.com/2011/06/04/activescaffold-big-screen-touch-devices/" class="excerpt-more-link">[&#8230;]</a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vhochstein.wordpress.com&#038;blog=15467409&#038;post=137&#038;subd=vhochstein&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Well, it was only a question of time till one of my clients request better support for bigscreen touch devices such as iPad or some of these new Android tablets.<br />
Have you every tried activescaffold with an iPad? Close Icon is too small, hover is nt supported, record actionlinks are not optimized for touch input&#8230;</p>
<p>We are facing at least two issues:</p>
<ol>
<li> We have to detect touch devices and apply improved css </li>
<li> For some of these devices we have to fix hover issue </li>
</ol>
<p>Activescaffold uses a new before_filter to identify touch devices, currently it just supports apple devices, but it can be easily overwritten:</p>
<pre class="brush: ruby; title: ; notranslate">
def check_input_device
  if request.env[&quot;HTTP_USER_AGENT&quot;] &amp;&amp; request.env[&quot;HTTP_USER_AGENT&quot;][/(iPhone|iPod|iPad)/i]
    session[:input_device_type] = 'TOUCH'
    session[:hover_supported] = false
  else
    session[:input_device_type] = 'MOUSE'
    session[:hover_supported] = true
  end if session[:input_device_type].nil?
end
</pre>
<p>In addition two new helper methods are provided:</p>
<pre class="brush: ruby; title: ; notranslate">
def touch_device?
  session[:input_device_type] == 'TOUCH'
end

def hover_via_click?
  session[:hover_supported] == false
end
</pre>
<p>And finally we added a new html class &#8220;as_touch&#8221; to activescaffold&#8217;s main div element to be able to apply different css stylings in case of a touch device.</p>
<p>At the end we improved activescaffold&#8217;s touchability a lot, it s not perfect but far better than before.</p>
<p>Hope that helps, wish you all a great weekend.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vhochstein.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vhochstein.wordpress.com/137/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vhochstein.wordpress.com&#038;blog=15467409&#038;post=137&#038;subd=vhochstein&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vhochstein.wordpress.com/2011/06/04/activescaffold-big-screen-touch-devices/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6f5181b51ffc08e48a8460314de9f3d2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vhochstein</media:title>
		</media:content>
	</item>
		<item>
		<title>ActiveScaffold: FieldSearch Column Overrides</title>
		<link>http://vhochstein.wordpress.com/2011/05/14/activescaffold-fieldsearch-column-overrides/</link>
		<comments>http://vhochstein.wordpress.com/2011/05/14/activescaffold-fieldsearch-column-overrides/#comments</comments>
		<pubDate>Sat, 14 May 2011 11:52:57 +0000</pubDate>
		<dc:creator>vhochstein</dc:creator>
				<category><![CDATA[ActiveScaffold]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[column]]></category>
		<category><![CDATA[condition_for]]></category>
		<category><![CDATA[field_search]]></category>
		<category><![CDATA[human_conditions]]></category>
		<category><![CDATA[override]]></category>

		<guid isPermaLink="false">http://vhochstein.wordpress.com/?p=126</guid>
		<description><![CDATA[ActiveScaffold is quite powerful, but sometimes it might not fit your needs. That s why activescaffold offers you many options to extend/change activescaffold s features to your needs. I would like to talk about FieldSearch Column Overrides today, as an example how you may extend activescaffold. We will use my howto application as a starting <a href="http://vhochstein.wordpress.com/2011/05/14/activescaffold-fieldsearch-column-overrides/" class="excerpt-more-link">[&#8230;]</a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vhochstein.wordpress.com&#038;blog=15467409&#038;post=126&#038;subd=vhochstein&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>ActiveScaffold is quite powerful, but sometimes it might not fit your needs. That s why activescaffold offers you many options to extend/change activescaffold s features to your needs.<br />
I would like to talk about FieldSearch Column Overrides today, as an example how you may extend activescaffold.</p>
<p>We will use my howto application as a starting point: <a href="http://vhochstein.wordpress.com/2010/10/08/one-step-rails-app-with-activescaffold-installation/">howto installation</a>.</p>
<p>Please activate field_search and human conditions in players controller:</p>
<pre class="brush: ruby; title: ; notranslate">
active_scaffold :player do |conf|
  conf.actions.exclude :search
  conf.actions.add :field_search
  conf.field_search.columns = [:date_of_birth]
  conf.field_search.human_conditions = true
end
</pre>
<p>If you start the application you may try fieldsearch. date_of_birth is using activescaffold&#8217;s default date search ui.<br />
Let s assume we have a special requirement and we would like to show a select box showing all existing date_of_birth values.</p>
<p>How to do that? It s really quite simple and it takes as only three steps:</p>
<h4>search column override</h4>
<p>Responsible for rendering our specific search_ui.</p>
<pre class="brush: ruby; title: ; notranslate">
players_helper.rb
def date_of_birth_search_column(record, html_options)
  selected = html_options.delete :value
        
  players = Player.select('distinct date_of_birth').except(:order).order('date_of_birth DESC').all
  select_options = players.collect do |player|
    [ l(player.date_of_birth), player.date_of_birth ]
  end
  options = { :selected =&gt; selected,
                  :include_blank =&gt; as_(:_select_)}
  select(:record, :date_of_birth, select_options, options, html_options)
end
</pre>
<h4>human condition column override</h4>
<p>Responsible for rendering a special human condition.</p>
<pre class="brush: ruby; title: ; notranslate">
players_helper.rb
def date_of_birth_human_condition_column(value, options)
  &quot;#{Player.human_attribute_name(:date_of_birth)} = #{I18n.l(controller.class.condition_value_for_datetime(value, :to_date))}&quot;
end
</pre>
<h4>condition_for column override</h4>
<p>Responsible for generating our special sql condition.</p>
<pre class="brush: ruby; title: ; notranslate">
players_controller.rb
def self.condition_for_date_of_birth_column(column, value, like_pattern)
  [&quot;#{column.search_sql} = ?&quot;, column.column.type_cast(value)]
end
</pre>
<p>My example used an override for one specific column, however you may as well override an existing search_ui type (such as :select or :multiselect) or just create your own search_ui type&#8230;.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vhochstein.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vhochstein.wordpress.com/126/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vhochstein.wordpress.com&#038;blog=15467409&#038;post=126&#038;subd=vhochstein&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vhochstein.wordpress.com/2011/05/14/activescaffold-fieldsearch-column-overrides/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6f5181b51ffc08e48a8460314de9f3d2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vhochstein</media:title>
		</media:content>
	</item>
		<item>
		<title>ActiveScaffold: singular polymorphic association inline actionlink</title>
		<link>http://vhochstein.wordpress.com/2011/05/09/activescaffold-singular-polymorphic-association-inline-actionlink/</link>
		<comments>http://vhochstein.wordpress.com/2011/05/09/activescaffold-singular-polymorphic-association-inline-actionlink/#comments</comments>
		<pubDate>Mon, 09 May 2011 16:42:17 +0000</pubDate>
		<dc:creator>vhochstein</dc:creator>
				<category><![CDATA[ActiveScaffold]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[actionlink]]></category>
		<category><![CDATA[association]]></category>
		<category><![CDATA[polymorphic]]></category>

		<guid isPermaLink="false">http://vhochstein.wordpress.com/?p=123</guid>
		<description><![CDATA[Quite a complicated subject for a post. Hope at least some of you have an idea about the topic of this post. Activescaffold supports concept of an inline actionlink, which is basically just a list column as a hyperlink. Out of the box it is used for associations to have a one click path to <a href="http://vhochstein.wordpress.com/2011/05/09/activescaffold-singular-polymorphic-association-inline-actionlink/" class="excerpt-more-link">[&#8230;]</a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vhochstein.wordpress.com&#038;blog=15467409&#038;post=123&#038;subd=vhochstein&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Quite a complicated subject for a post. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  Hope at least some of you have an idea about the topic of this post.<br />
Activescaffold supports concept of an inline actionlink, which is basically just a list column as a hyperlink. Out of the box it is used for associations to have a one click path to associated records. Unfortunetly, it was nt supported for singular polymorphic associations and in one of my projects I was missing this feature. I had to implement a log feature using a database as store. Each log statement should include a reference to the source. source was a perfect candidate for a polymorphic association.<br />
I just had to extend activescaffold to support singular polymorphic assocation inline actionlinks.</p>
<p>I ve prepared a simple example app including invoice and applog model for those of you who are interesting in trying out.</p>
<h3>Setup Example Application</h3>
<ol>
<li>Download: <a href="https://github.com/vhochstein/one_step_active_scaffold/raw/master/one_step_activescaffold.rb">one_step_active_scaffold</a></li>
<li>Download: <a href="https://github.com/vhochstein/one_step_active_scaffold/raw/master/examples/polymorphic_blog.rb.rb">polymorphici_blog.rb</a> and rename it to model_setup.rb</li>
<li>Execute following command: ruby one_step_activescaffold.rb polymorphic_app jquery</li>
<li>cd polymorphic_app</li>
<li>rails s</li>
<li><a href="http://localhost:3000/invoices" rel="nofollow">http://localhost:3000/invoices</a></li>
<li>Create new invoice with a log entry</li>
<li><a href="http://localhost:3000/app_logs" rel="nofollow">http://localhost:3000/app_logs</a></li>
</ol>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vhochstein.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vhochstein.wordpress.com/123/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vhochstein.wordpress.com&#038;blog=15467409&#038;post=123&#038;subd=vhochstein&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vhochstein.wordpress.com/2011/05/09/activescaffold-singular-polymorphic-association-inline-actionlink/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6f5181b51ffc08e48a8460314de9f3d2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vhochstein</media:title>
		</media:content>
	</item>
		<item>
		<title>ActiveScaffold: actions_for_association_links supporting list</title>
		<link>http://vhochstein.wordpress.com/2011/04/23/activescaffold-actions_for_association_links-supporting-list/</link>
		<comments>http://vhochstein.wordpress.com/2011/04/23/activescaffold-actions_for_association_links-supporting-list/#comments</comments>
		<pubDate>Sat, 23 Apr 2011 07:38:04 +0000</pubDate>
		<dc:creator>vhochstein</dc:creator>
				<category><![CDATA[ActiveScaffold]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[actionlink]]></category>
		<category><![CDATA[inline]]></category>

		<guid isPermaLink="false">http://vhochstein.wordpress.com/?p=119</guid>
		<description><![CDATA[Many of you know already that you may configure your inline actionlinks for singular associations columns. Possible action values are :new, :show, :edit. Let me show you a simple example. You would like to show &#8220;new&#8221; form in case player has nt got any team assigned and in case a team is assigned you would <a href="http://vhochstein.wordpress.com/2011/04/23/activescaffold-actions_for_association_links-supporting-list/" class="excerpt-more-link">[&#8230;]</a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vhochstein.wordpress.com&#038;blog=15467409&#038;post=119&#038;subd=vhochstein&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Many of you know already that you may configure your inline actionlinks for singular associations columns.<br />
Possible action values are :new, :show, :edit.</p>
<p>Let me show you a simple example. You would like to show &#8220;new&#8221; form in case player has nt got any team assigned and in case a team is assigned you would like to show &#8220;show&#8221; form</p>
<pre class="brush: ruby; title: ; notranslate">
class PlayersController &lt; ApplicationController
  active_scaffold :player do |conf|
    ....
    conf.columns[:team].actions_for_association_links = [:new, :show]
    ....
  end
end
</pre>
<p>I m using it quite often, however sometimes I was missing the option to show list view. That s why you have the following options these days: :new, :show, :edit and :list.</p>
<pre class="brush: ruby; title: ; notranslate">
class PlayersController &lt; ApplicationController
  active_scaffold :player do |conf|
    ....
    conf.columns[:team].actions_for_association_links = [:new, :list]
    ....
  end
end
</pre>
<p>Try it out. It s a shortcut for the user, all available information and actions for association model is just one click away and it s inline.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vhochstein.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vhochstein.wordpress.com/119/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vhochstein.wordpress.com&#038;blog=15467409&#038;post=119&#038;subd=vhochstein&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vhochstein.wordpress.com/2011/04/23/activescaffold-actions_for_association_links-supporting-list/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6f5181b51ffc08e48a8460314de9f3d2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vhochstein</media:title>
		</media:content>
	</item>
	</channel>
</rss>
