Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
## Invites Page (view) [html_rails] <div id="invite-contacts"> <%= render :partial => 'shared/flash_messages'%> <div class="input-form"> <div style="font-weight: bold;">Input contacts from <%= image_tag("networking/#{params[:type]}.jpg") -%></div><br> <div id="contact-results"> Securely import your address book. I will not share your login info or password. You will be able to review and select which contacts to invite.<br> <% if ["hotmail", "gmail", "yahoo", "aol"].include?(params[:type]) -%> <% form_remote_tag(:url => {:controller => 'importer', :action => 'invite}) do %> <ul> <li><label>Email</label><br> <%= text_field_tag "username", '' -%> @<%= params[:type] -%>.com </li> <li><label>Password</label><br> <%= password_field_tag "password", '' -%> </li> </ul> <%= hidden_field_tag "contact_type", params[:type] -%> <div class="buttons" id="action-buttons0" style="text-align:left;padding-top: 15px;"> <%= submit_tag 'Import contacts' -%> OR <%= link_to 'Cancel', { :controller => "home" } -%> </div> <% end -%> <% end -%> </div> </div> </div> ##Controller: [ruby] if (request.post?) or (!params["contact_type"].nil?) #get contacts @contacts = [] @type = params["contact_type"] if ["gmail", "yahoo", "hotmail", "aol"].include?(params["contact_type"]) begin username = "#{params["username"]}@#{params["contact_type"]}.com" pass = "#{params["password"]}" @bl = Blackbook.get(:username => username, :password => pass) @bl.each do |item| unless item.blank? if params["contact_type"].eql?("hotmail") if item[:email].blank? and !item[:name][/[a-zA-Z0-9._%+-]+@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,4}/].nil? item[:email] = item[:name] item[:name] = "" end end @contacts << [item[:name], item[:email]] unless item[:email].blank? end end @contacts = process_contacts unless @contacts.blank? flash[:warning] = nil unless flash[:warning].nil? #do something rescue Exception => ex flash[:warning] = ex #do something end end
This paste will be private.
From the Design Piracy series on my blog: