<?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/"
	>

<channel>
	<title>Think Bohemian &#187; custom</title>
	<atom:link href="http://www.thinkbohemian.com/tag/custom/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thinkbohemian.com</link>
	<description>Secede from Convention in Life and Code</description>
	<lastBuildDate>Tue, 31 Aug 2010 23:37:16 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Custom Error Pages With Rails and Authlogic</title>
		<link>http://www.thinkbohemian.com/2010/01/16/custom-error-pages-with-rails-and-authlogic/</link>
		<comments>http://www.thinkbohemian.com/2010/01/16/custom-error-pages-with-rails-and-authlogic/#comments</comments>
		<pubDate>Sat, 16 Jan 2010 18:27:36 +0000</pubDate>
		<dc:creator>Richard Schneeman</dc:creator>
				<category><![CDATA[Ruby On Rails]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[authlogic]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[error]]></category>

		<guid isPermaLink="false">http://www.thinkbohemian.com/?p=280</guid>
		<description><![CDATA[Everyone wants their site to be pretty, even when its crashing horribly. So check out these two resources:
Custom dynamic error pages in Ruby on Rails
Authlogic and rescue_from ActionController::RoutingError

Enjoy, and happy erroring!
]]></description>
			<content:encoded><![CDATA[<p>Everyone wants their site to be pretty, even when its crashing horribly. So check out these two resources:</p>
<p><a href="http://www.perfectline.co.uk/blog/custom-dynamic-error-pages-in-ruby-on-rails">Custom dynamic error pages in Ruby on Rails</a></p>
<p><a href="http://www.mrkris.com/2009/08/21/authlogic-and-rescue_from-actioncontroller-routingerror/">Authlogic and rescue_from ActionController::RoutingError<br />
</a></p>
<p>Enjoy, and happy erroring!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thinkbohemian.com/2010/01/16/custom-error-pages-with-rails-and-authlogic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom jQuery UI Rails Button Form Helper</title>
		<link>http://www.thinkbohemian.com/2009/10/12/custom-jquery-ui-rails-button-form-helper/</link>
		<comments>http://www.thinkbohemian.com/2009/10/12/custom-jquery-ui-rails-button-form-helper/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 02:22:14 +0000</pubDate>
		<dc:creator>Richard Schneeman</dc:creator>
				<category><![CDATA[Ruby On Rails]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[form helper]]></category>
		<category><![CDATA[jquery ui]]></category>

		<guid isPermaLink="false">http://www.thinkbohemian.com/?p=97</guid>
		<description><![CDATA[Today I got a little bored with my standard rails buttons

Not bad&#8230;but could use a little pizazz. So I decided to take a crack at jQuery UI. A great javascript and style framework that promised to be easy to use and provides theme-able styles.
Once you&#8217;ve got jQuery UI integrated nicely into your rails project (note [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">Today I got a little bored with my standard rails buttons</p>
<p style="text-align: center;"><img class="aligncenter" title="generate secure email button" src="../wp-content/uploads/2009/10/Screen-shot-2009-10-12-at-8.55.48-PM.png" alt="generate secure email button" width="148" height="28" /></p>
<p style="text-align: left;">Not bad&#8230;but could use a little pizazz. So I decided to take a crack at <a href="http://jqueryui.com/">jQuery UI</a>. A great javascript and style framework that promised to be easy to use and provides theme-able styles.</p>
<p style="text-align: left;">Once you&#8217;ve got jQuery UI integrated nicely into your rails project (note i had to change my url paths in the stylesheet), you can style your submit button easily by adding some classes just like this:</p>
<pre style="text-align: left;">&lt;%= f.submit "Generate Secure Email", :class =&gt; "ui-corner-all ui-state-default " %&gt;</pre>
<p style="text-align: center;"><img class="size-full wp-image-101 alignnone" title="Untitled-3" src="http://www.thinkbohemian.com/wp-content/uploads/2009/10/Untitled-3.jpg" alt="Untitled-3" width="152" height="38" /></p>
<p style="text-align: left;">Though, this isn&#8217;t 100% what I was looking for, it&#8217;s a good start. When we hover over the button, it changes color, and when we press it, our rails form submits. Though you&#8217;ll notice that the cursor doesn&#8217;t change when you hover over the button and we haven&#8217;t put an icon in it yet. To get the correct behavior i hard coded in a button:</p>
<pre style="text-align: left;">&lt;button id="user_submit" class = "ui-corner-all  ui-state-default"  type="submit" name="commit"&gt;Generate Secure Email&lt;/button&gt;</pre>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-102" title="Screen shot 2009-10-12 at 9.06.33 PM" src="http://www.thinkbohemian.com/wp-content/uploads/2009/10/Screen-shot-2009-10-12-at-9.06.33-PM.png" alt="Screen shot 2009-10-12 at 9.06.33 PM" width="169" height="36" /></p>
<p style="text-align: left;">This solved the button styling and behavior, but we still don&#8217;t have our icon. After browsing the inter webs i found a nice page of <a href="http://http://www.filamentgroup.com/examples/buttonFrameworkCSS/">jQuery-UI button demos</a> and I managed to modify my code to include a nice icon:</p>
<pre style="text-align: left;">&lt;button id="user_submit" class = "ui-corner-all fg-button ui-state-default fg-button-icon-left" type="submit" name="commit"&gt;&lt;span&gt;&lt;/span&gt;Generate Secure Email&lt;/button&gt;</pre>
<p style="text-align: center;"><img class="aligncenter" title="jQuery UI Button with rails" src="http://www.thinkbohemian.com/wp-content/uploads/2009/10/Screen-shot-2009-10-12-at-8.54.35-PM.png" alt="jQuery UI Button with rails" width="185" height="38" /></p>
<p style="text-align: left;">Perfect! It works like a dream, but it&#8217;s not very rails-esq. Lets turn this into a reusable chunk of code by making a helper method to extend form builder. In app/helpers/application_helper.rb</p>
<pre style="text-align: left;">class ActionView::Helpers::FormBuilder
    def button_with_icon(text , icon)
     object_name = self.object_name
     return "&lt;button id='#{object_name}_submit' class = 'ui-corner-all fg-button ui-state-default fg-button-icon-left' type='submit' name='commit'&gt;&lt;span class='ui-icon ui-icon-#{icon}'&gt;&lt;/span&gt;#{text}&lt;/button&gt;"
    end
end</pre>
<p style="text-align: left;">Now In my View I can put:</p>
<pre style="text-align: left;">&lt;%=  f.button_with_icon("Generate Secure Email", "mail-closed") %&gt;</pre>
<p style="text-align: left;">And I get my perfectly formatted button complete with an Icon!</p>
<p style="text-align: center;"><img class="alignnone" title="jQuery UI Button with rails" src="http://www.thinkbohemian.com/wp-content/uploads/2009/10/Screen-shot-2009-10-12-at-8.54.35-PM.png" alt="jQuery UI Button with rails" width="185" height="38" /></p>
<hr style="text-align: center;" />
<p style="text-align: left;">Note:</p>
<pre style="text-align: left;">&lt;% form_for :person, @person, :url =&gt; { :action =&gt; "create" } do |f| %&gt;
    &lt;%= f.object_name %&gt;
&lt;% end %&gt;</pre>
<p style="text-align: left;">will print out &#8220;person&#8221;, thats why in the helper we call  self.object_name on the <a href="http://caboo.se/doc/classes/ActionView/Helpers/FormBuilder.html">form_builder class.</a> Pretty cool huh?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thinkbohemian.com/2009/10/12/custom-jquery-ui-rails-button-form-helper/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OnClick Rails Helper for Disqus Style Input Fields</title>
		<link>http://www.thinkbohemian.com/2009/10/11/onclick-rails-helper-for-disqus-style-input-fields/</link>
		<comments>http://www.thinkbohemian.com/2009/10/11/onclick-rails-helper-for-disqus-style-input-fields/#comments</comments>
		<pubDate>Sun, 11 Oct 2009 22:54:25 +0000</pubDate>
		<dc:creator>Richard Schneeman</dc:creator>
				<category><![CDATA[Austin]]></category>
		<category><![CDATA[Musings]]></category>
		<category><![CDATA[Ruby On Rails]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[disqus]]></category>
		<category><![CDATA[form builder]]></category>
		<category><![CDATA[helper method]]></category>
		<category><![CDATA[input]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.thinkbohemian.com/?p=87</guid>
		<description><![CDATA[Override the default rails input field text behavior with an intuitive and easy to understand alternative using rails helper methods and simple javascript.]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">If you haven&#8217;t seen comments by <a href="http://disqus.com/">Disqus</a>, you should probably check them out. If you don&#8217;t care about having programmatic access (as of this post) then its the simplest way of adding a comment system to your website. While their comment widget is pretty neat, i wanted to have the same effects on my input fields that they use, but with all the control and &#8220;flexibility&#8221; that rails gives me.</p>
<p style="text-align: left;">I wanted an input that had the default text grayed out, when you click on it and start typing your text becomes black, and if you delete your text and click outside of the area, the input goes back to its default value. And back to gray. To accomplish this task, i wrote my own custom helper /app/helpers/application_helper.rb:</p>
<pre style="text-align: left;">def default_text_field(name, value)

text_field(name, :value =&gt; value,  :class =&gt; "gray-input", :onfocus =&gt; "if (this.value=='#{value}') this.value = '';this.style.color = 'black';", :onblur =&gt; "if (this.value=='') {this.value = '#{value}';this.style.color = '';}" )

end</pre>
<p style="text-align: left;">So now when i use it in a view like this:</p>
<pre style="text-align: left;">&lt;%= f.default_text_field :website, "Example.com" %&gt;</pre>
<p style="text-align: left;">My view acts like this:</p>
<p style="text-align: center;"><img class="size-medium wp-image-88  alignnone" title="onClickrailsHelper" src="http://www.thinkbohemian.com/wp-content/uploads/2009/10/onClickrailsHelper-300x239.jpg" alt="onClickrailsHelper" width="300" height="239" /></p>
<p style="text-align: left;">The CSS needed for this to work properly is extremely simple:</p>
<pre style="text-align: left;">.gray-input {
color: #7a7a7a;
}</pre>
<p style="text-align: left;">Of course you can use another color if you wish. Hope you enjoyed this little tip, and I hope all your users fall all over themselves at the awesomeness of your sweet new inputs. Good luck, and happy coding.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thinkbohemian.com/2009/10/11/onclick-rails-helper-for-disqus-style-input-fields/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
