youthtree-helpers 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.document +5 -0
 - data/.gitignore +21 -0
 - data/LICENSE +27 -0
 - data/README.md +23 -0
 - data/Rakefile +59 -0
 - data/lib/youth_tree/helpers/analytics_helper.rb +55 -0
 - data/lib/youth_tree/helpers/assets_helper.rb +36 -0
 - data/lib/youth_tree/helpers/embed_helper.rb +48 -0
 - data/lib/youth_tree/helpers/general_helper.rb +133 -0
 - data/lib/youth_tree/helpers/sidebar_helper.rb +38 -0
 - data/lib/youth_tree/helpers/uuid_tracker_helper.rb +17 -0
 - data/lib/youth_tree/helpers.rb +36 -0
 - data/lib/youthtree-helpers.rb +1 -0
 - data/youthtree-helpers.gemspec +63 -0
 - metadata +142 -0
 
    
        data/.document
    ADDED
    
    
    
        data/.gitignore
    ADDED
    
    
    
        data/LICENSE
    ADDED
    
    | 
         @@ -0,0 +1,27 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Copyright (c) 2010, Youth Tree
         
     | 
| 
      
 2 
     | 
    
         
            +
            All rights reserved.
         
     | 
| 
      
 3 
     | 
    
         
            +
             
         
     | 
| 
      
 4 
     | 
    
         
            +
            Redistribution and use in source and binary forms, with or without
         
     | 
| 
      
 5 
     | 
    
         
            +
            modification, are permitted provided that the following conditions are met:
         
     | 
| 
      
 6 
     | 
    
         
            +
            1. Redistributions of source code must retain the above copyright
         
     | 
| 
      
 7 
     | 
    
         
            +
               notice, this list of conditions and the following disclaimer.
         
     | 
| 
      
 8 
     | 
    
         
            +
            2. Redistributions in binary form must reproduce the above copyright
         
     | 
| 
      
 9 
     | 
    
         
            +
               notice, this list of conditions and the following disclaimer in the
         
     | 
| 
      
 10 
     | 
    
         
            +
               documentation and/or other materials provided with the distribution.
         
     | 
| 
      
 11 
     | 
    
         
            +
            3. All advertising materials mentioning features or use of this software
         
     | 
| 
      
 12 
     | 
    
         
            +
               must display the following acknowledgement:
         
     | 
| 
      
 13 
     | 
    
         
            +
               This product includes software developed by the Youth Tree.
         
     | 
| 
      
 14 
     | 
    
         
            +
            4. Neither the name of the Youth Tree nor the
         
     | 
| 
      
 15 
     | 
    
         
            +
               names of its contributors may be used to endorse or promote products
         
     | 
| 
      
 16 
     | 
    
         
            +
               derived from this software without specific prior written permission.
         
     | 
| 
      
 17 
     | 
    
         
            +
             
         
     | 
| 
      
 18 
     | 
    
         
            +
            THIS SOFTWARE IS PROVIDED BY YOUTH TREE ''AS IS'' AND ANY
         
     | 
| 
      
 19 
     | 
    
         
            +
            EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
         
     | 
| 
      
 20 
     | 
    
         
            +
            WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
         
     | 
| 
      
 21 
     | 
    
         
            +
            DISCLAIMED. IN NO EVENT SHALL YOUTH TREE BE LIABLE FOR ANY
         
     | 
| 
      
 22 
     | 
    
         
            +
            DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
         
     | 
| 
      
 23 
     | 
    
         
            +
            (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
         
     | 
| 
      
 24 
     | 
    
         
            +
            LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
         
     | 
| 
      
 25 
     | 
    
         
            +
            ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
         
     | 
| 
      
 26 
     | 
    
         
            +
            (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
         
     | 
| 
      
 27 
     | 
    
         
            +
            SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
         
     | 
    
        data/README.md
    ADDED
    
    | 
         @@ -0,0 +1,23 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Youth Tree Helpers #
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            ## Installation ##
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            1. Add "gem 'youthtree-helpers' to your Gemfile"
         
     | 
| 
      
 6 
     | 
    
         
            +
            2. Run bundle install
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            ## Usage ##
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            Youth Tree Helpers provides many helpers for Rails Applications.
         
     | 
| 
      
 11 
     | 
    
         
            +
            For a full refererence, please see the rdoc for them.
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            ## Note on Patches/Pull Requests ##
         
     | 
| 
      
 14 
     | 
    
         
            +
             
         
     | 
| 
      
 15 
     | 
    
         
            +
            1. Fork the project.
         
     | 
| 
      
 16 
     | 
    
         
            +
            2. Make your feature addition or bug fix.
         
     | 
| 
      
 17 
     | 
    
         
            +
            3. Add tests for it. This is important so I don't break it in a future version unintentionally.
         
     | 
| 
      
 18 
     | 
    
         
            +
            4. Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
         
     | 
| 
      
 19 
     | 
    
         
            +
            5. Send me a pull request. Bonus points for topic branches.
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            ## Copyright ##
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            Copyright (c) 2010 Youth Tree. See LICENSE for details.
         
     | 
    
        data/Rakefile
    ADDED
    
    | 
         @@ -0,0 +1,59 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'rubygems'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'rake'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            require 'active_support'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'active_support/core_ext'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require File.expand_path('lib/youth_tree/helpers', File.dirname(__FILE__))
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            begin
         
     | 
| 
      
 9 
     | 
    
         
            +
              require 'jeweler'
         
     | 
| 
      
 10 
     | 
    
         
            +
              Jeweler::Tasks.new do |gem|
         
     | 
| 
      
 11 
     | 
    
         
            +
                gem.name        = "youthtree-helpers"
         
     | 
| 
      
 12 
     | 
    
         
            +
                gem.summary     = "A exceedingly simple set of helpers used across Youth Tree web applications."
         
     | 
| 
      
 13 
     | 
    
         
            +
                gem.description = "Helpers to make life easier when coding YT-specific apps. see the code.."
         
     | 
| 
      
 14 
     | 
    
         
            +
                gem.email       = "sutto@sutto.net"
         
     | 
| 
      
 15 
     | 
    
         
            +
                gem.homepage    = "http://github.com/YouthTree/youthtree-helpers"
         
     | 
| 
      
 16 
     | 
    
         
            +
                gem.authors     = ["Darcy Laycock"]
         
     | 
| 
      
 17 
     | 
    
         
            +
                gem.version     = YouthTree::Helpers::VERSION
         
     | 
| 
      
 18 
     | 
    
         
            +
                gem.add_dependency "activesupport",      "~> 3.0.0.rc"
         
     | 
| 
      
 19 
     | 
    
         
            +
                gem.add_dependency "actionpack",         "~> 3.0.0.rc"
         
     | 
| 
      
 20 
     | 
    
         
            +
                gem.add_dependency "youthtree-js"
         
     | 
| 
      
 21 
     | 
    
         
            +
                gem.add_dependency "youthtree-settings"
         
     | 
| 
      
 22 
     | 
    
         
            +
              end
         
     | 
| 
      
 23 
     | 
    
         
            +
              Jeweler::GemcutterTasks.new
         
     | 
| 
      
 24 
     | 
    
         
            +
            rescue LoadError
         
     | 
| 
      
 25 
     | 
    
         
            +
              puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
         
     | 
| 
      
 26 
     | 
    
         
            +
            end
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            require 'rake/testtask'
         
     | 
| 
      
 29 
     | 
    
         
            +
            Rake::TestTask.new(:test) do |test|
         
     | 
| 
      
 30 
     | 
    
         
            +
              test.libs << 'lib' << 'test'
         
     | 
| 
      
 31 
     | 
    
         
            +
              test.pattern = 'test/**/*_test.rb'
         
     | 
| 
      
 32 
     | 
    
         
            +
              test.verbose = true
         
     | 
| 
      
 33 
     | 
    
         
            +
            end
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
            begin
         
     | 
| 
      
 36 
     | 
    
         
            +
              require 'rcov/rcovtask'
         
     | 
| 
      
 37 
     | 
    
         
            +
              Rcov::RcovTask.new do |test|
         
     | 
| 
      
 38 
     | 
    
         
            +
                test.libs << 'test'
         
     | 
| 
      
 39 
     | 
    
         
            +
                test.pattern = 'test/**/*_test.rb'
         
     | 
| 
      
 40 
     | 
    
         
            +
                test.verbose = true
         
     | 
| 
      
 41 
     | 
    
         
            +
              end
         
     | 
| 
      
 42 
     | 
    
         
            +
            rescue LoadError
         
     | 
| 
      
 43 
     | 
    
         
            +
              task :rcov do
         
     | 
| 
      
 44 
     | 
    
         
            +
                abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
         
     | 
| 
      
 45 
     | 
    
         
            +
              end
         
     | 
| 
      
 46 
     | 
    
         
            +
            end
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
            task :test => :check_dependencies
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
            task :default => :test
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
            require 'rake/rdoctask'
         
     | 
| 
      
 53 
     | 
    
         
            +
            Rake::RDocTask.new do |rdoc|
         
     | 
| 
      
 54 
     | 
    
         
            +
              version = File.exist?('VERSION') ? File.read('VERSION') : ""
         
     | 
| 
      
 55 
     | 
    
         
            +
              rdoc.rdoc_dir = 'rdoc'
         
     | 
| 
      
 56 
     | 
    
         
            +
              rdoc.title = "youthtree-helpers #{version}"
         
     | 
| 
      
 57 
     | 
    
         
            +
              rdoc.rdoc_files.include('README*')
         
     | 
| 
      
 58 
     | 
    
         
            +
              rdoc.rdoc_files.include('lib/**/*.rb')
         
     | 
| 
      
 59 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,55 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module YouthTree
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Helpers
         
     | 
| 
      
 3 
     | 
    
         
            +
                module AnalyticsHelper
         
     | 
| 
      
 4 
     | 
    
         
            +
                  
         
     | 
| 
      
 5 
     | 
    
         
            +
                  def clicky_snippet_js(site_id)
         
     | 
| 
      
 6 
     | 
    
         
            +
                    return <<-END_OF_JS
         
     | 
| 
      
 7 
     | 
    
         
            +
                      var clicky = { log: function(){ return; }, goal: function(){ return; }};
         
     | 
| 
      
 8 
     | 
    
         
            +
                      var clicky_site_id = #{site_id};
         
     | 
| 
      
 9 
     | 
    
         
            +
                      (function() {
         
     | 
| 
      
 10 
     | 
    
         
            +
                        var s = document.createElement('script');
         
     | 
| 
      
 11 
     | 
    
         
            +
                        s.type = 'text/javascript';
         
     | 
| 
      
 12 
     | 
    
         
            +
                        s.async = true;
         
     | 
| 
      
 13 
     | 
    
         
            +
                        s.src = (document.location.protocol + '://static.getclicky.com/js');
         
     | 
| 
      
 14 
     | 
    
         
            +
                        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(s);
         
     | 
| 
      
 15 
     | 
    
         
            +
                      })();
         
     | 
| 
      
 16 
     | 
    
         
            +
                    END_OF_JS
         
     | 
| 
      
 17 
     | 
    
         
            +
                  end
         
     | 
| 
      
 18 
     | 
    
         
            +
                  
         
     | 
| 
      
 19 
     | 
    
         
            +
                  def clicky_analytics
         
     | 
| 
      
 20 
     | 
    
         
            +
                    if Settings.clicky.site_id?
         
     | 
| 
      
 21 
     | 
    
         
            +
                      content = ActiveSupport::SafeBuffer.new
         
     | 
| 
      
 22 
     | 
    
         
            +
                      site_id = Settings.clicky.site_id.to_i;
         
     | 
| 
      
 23 
     | 
    
         
            +
                      content << javascript_tag(clicky_snippet_js(site_id))
         
     | 
| 
      
 24 
     | 
    
         
            +
                      static_image_tag = tag(:img, :width => 1, :height => 1, :src => "#{request.protocol}://in.getclicky.com/#{site_id}ns.gif")
         
     | 
| 
      
 25 
     | 
    
         
            +
                      content << content_tag(:noscript, content_tag(:div, static_image_tag, :class => 'clicky-tracker'))
         
     | 
| 
      
 26 
     | 
    
         
            +
                      content
         
     | 
| 
      
 27 
     | 
    
         
            +
                    end
         
     | 
| 
      
 28 
     | 
    
         
            +
                  end
         
     | 
| 
      
 29 
     | 
    
         
            +
                  
         
     | 
| 
      
 30 
     | 
    
         
            +
                  def google_analytics
         
     | 
| 
      
 31 
     | 
    
         
            +
                    if Settings.google_analytics.identifier?
         
     | 
| 
      
 32 
     | 
    
         
            +
                      javascript_tag(google_analytics_snippet_js(Settings.google_analytics.identifier))
         
     | 
| 
      
 33 
     | 
    
         
            +
                    end
         
     | 
| 
      
 34 
     | 
    
         
            +
                  end
         
     | 
| 
      
 35 
     | 
    
         
            +
                  
         
     | 
| 
      
 36 
     | 
    
         
            +
                  def analytics_code
         
     | 
| 
      
 37 
     | 
    
         
            +
                    [clicky_analytics, google_analytics].compact.sum(ActiveSupport::SafeBuffer.new)
         
     | 
| 
      
 38 
     | 
    
         
            +
                  end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                  def google_analytics_snippet_js(identifier)
         
     | 
| 
      
 41 
     | 
    
         
            +
                    return <<-END_OF_JS
         
     | 
| 
      
 42 
     | 
    
         
            +
                      var _gaq = _gaq || [];
         
     | 
| 
      
 43 
     | 
    
         
            +
                      _gaq.push(['_setAccount', #{identifier.to_json}]);
         
     | 
| 
      
 44 
     | 
    
         
            +
                      _gaq.push(['_trackPageview']);
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
                      (function() {
         
     | 
| 
      
 47 
     | 
    
         
            +
                        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
         
     | 
| 
      
 48 
     | 
    
         
            +
                        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
         
     | 
| 
      
 49 
     | 
    
         
            +
                        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
         
     | 
| 
      
 50 
     | 
    
         
            +
                      })();
         
     | 
| 
      
 51 
     | 
    
         
            +
                    END_OF_JS
         
     | 
| 
      
 52 
     | 
    
         
            +
                  end
         
     | 
| 
      
 53 
     | 
    
         
            +
                end
         
     | 
| 
      
 54 
     | 
    
         
            +
              end
         
     | 
| 
      
 55 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,36 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module YouthTree
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Helpers
         
     | 
| 
      
 3 
     | 
    
         
            +
                module AssetsHelper
         
     | 
| 
      
 4 
     | 
    
         
            +
                  
         
     | 
| 
      
 5 
     | 
    
         
            +
                  # Returns the content to be placed in the header.
         
     | 
| 
      
 6 
     | 
    
         
            +
                  def extra_head_content
         
     | 
| 
      
 7 
     | 
    
         
            +
                    content_for :extra_head
         
     | 
| 
      
 8 
     | 
    
         
            +
                  end
         
     | 
| 
      
 9 
     | 
    
         
            +
                  
         
     | 
| 
      
 10 
     | 
    
         
            +
                  # Equiv. to include_javascripts in the header
         
     | 
| 
      
 11 
     | 
    
         
            +
                  def has_jammit_js(*args)
         
     | 
| 
      
 12 
     | 
    
         
            +
                    content_for :extra_head, include_javascripts(*args)
         
     | 
| 
      
 13 
     | 
    
         
            +
                    nil
         
     | 
| 
      
 14 
     | 
    
         
            +
                  end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                  # Equiv. to include_stylesheets in the header
         
     | 
| 
      
 17 
     | 
    
         
            +
                  def has_jammit_css(*args)
         
     | 
| 
      
 18 
     | 
    
         
            +
                    content_for :extra_head, include_stylesheets(*args)
         
     | 
| 
      
 19 
     | 
    
         
            +
                    nil
         
     | 
| 
      
 20 
     | 
    
         
            +
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                  # Equiv. to javascript_include_tag in the header
         
     | 
| 
      
 23 
     | 
    
         
            +
                  def has_js(*args)
         
     | 
| 
      
 24 
     | 
    
         
            +
                    content_for :extra_head, javascript_include_tag(*args)
         
     | 
| 
      
 25 
     | 
    
         
            +
                    nil
         
     | 
| 
      
 26 
     | 
    
         
            +
                  end
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                  # Equiv. to stylesheet_link_tag in the header
         
     | 
| 
      
 29 
     | 
    
         
            +
                  def has_css(*args)
         
     | 
| 
      
 30 
     | 
    
         
            +
                    content_for :extra_head, stylesheet_link_tag(*args)
         
     | 
| 
      
 31 
     | 
    
         
            +
                    nil
         
     | 
| 
      
 32 
     | 
    
         
            +
                  end
         
     | 
| 
      
 33 
     | 
    
         
            +
                  
         
     | 
| 
      
 34 
     | 
    
         
            +
                end
         
     | 
| 
      
 35 
     | 
    
         
            +
              end
         
     | 
| 
      
 36 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,48 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module YouthTree
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Helpers
         
     | 
| 
      
 3 
     | 
    
         
            +
                module EmbedHelper
         
     | 
| 
      
 4 
     | 
    
         
            +
                  
         
     | 
| 
      
 5 
     | 
    
         
            +
                  # Links with added hinting to make them useful for social networking buttons.
         
     | 
| 
      
 6 
     | 
    
         
            +
                  def social_media_link(name, text, link)
         
     | 
| 
      
 7 
     | 
    
         
            +
                    link_to text.html_safe, link, :title => text, :class => "social-media-link #{name.to_s.dasherize}"
         
     | 
| 
      
 8 
     | 
    
         
            +
                  end
         
     | 
| 
      
 9 
     | 
    
         
            +
                  
         
     | 
| 
      
 10 
     | 
    
         
            +
                  # YouTube Video Embed.
         
     | 
| 
      
 11 
     | 
    
         
            +
                  def youtube_video(video_id, opts = {})
         
     | 
| 
      
 12 
     | 
    
         
            +
                    options = {:height => 360, :width => 480, :color1 => 'AAAAAA', :color2 => '999999'}.merge(opts)
         
     | 
| 
      
 13 
     | 
    
         
            +
                    video_url = "http://www.youtube-nocookie.com/v/#{video_id}?hl=en_US&fs=1&rel=0&color1=0x#{options[:color1]}&color2=0x#{options[:color2]}"
         
     | 
| 
      
 14 
     | 
    
         
            +
                    inner = ActiveSupport::SafeBuffer.new.tap do |i|
         
     | 
| 
      
 15 
     | 
    
         
            +
                      i << tag(:param, :name => "movie", :value => video_url)
         
     | 
| 
      
 16 
     | 
    
         
            +
                      i << tag(:param, :name => "allowFullScreen", :value => "true")
         
     | 
| 
      
 17 
     | 
    
         
            +
                      i << tag(:param, :name => "allowscriptaccess", :value => "always")
         
     | 
| 
      
 18 
     | 
    
         
            +
                      i << tag(:embed, :src => video_url, :height => options[:height], :width => options[:width], :allowfullscreen => "true",
         
     | 
| 
      
 19 
     | 
    
         
            +
                        :type => "application/x-shockwave-flash", :allowscriptaccess => "always")
         
     | 
| 
      
 20 
     | 
    
         
            +
                    end
         
     | 
| 
      
 21 
     | 
    
         
            +
                    content_tag(:object, inner, :height => options[:height], :width => options[:width])
         
     | 
| 
      
 22 
     | 
    
         
            +
                  end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                  # Share this embed js
         
     | 
| 
      
 25 
     | 
    
         
            +
                  def has_share_this_js
         
     | 
| 
      
 26 
     | 
    
         
            +
                    if Settings.share_this.publisher?
         
     | 
| 
      
 27 
     | 
    
         
            +
                      has_js "http://w.sharethis.com/button/sharethis.js#publisher=#{Settings.share_this.publisher}&type=website&button=false"
         
     | 
| 
      
 28 
     | 
    
         
            +
                      has_jammit_js :share_this
         
     | 
| 
      
 29 
     | 
    
         
            +
                    end
         
     | 
| 
      
 30 
     | 
    
         
            +
                  end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                  # Link to share something.
         
     | 
| 
      
 33 
     | 
    
         
            +
                  def share_this_link(text, options = {})
         
     | 
| 
      
 34 
     | 
    
         
            +
                    target = options.delete(:for)
         
     | 
| 
      
 35 
     | 
    
         
            +
                    options.stringify_keys!
         
     | 
| 
      
 36 
     | 
    
         
            +
                    options["data-share-this-target"] = target.to_s if target
         
     | 
| 
      
 37 
     | 
    
         
            +
                    options[:class] = [options[:class], 'share-this'].join(" ").squeeze(" ")
         
     | 
| 
      
 38 
     | 
    
         
            +
                    link_to(text, '#', options)
         
     | 
| 
      
 39 
     | 
    
         
            +
                  end
         
     | 
| 
      
 40 
     | 
    
         
            +
                  
         
     | 
| 
      
 41 
     | 
    
         
            +
                  # Embed a sponsor logo
         
     | 
| 
      
 42 
     | 
    
         
            +
                  def sponsor_link(name, url)
         
     | 
| 
      
 43 
     | 
    
         
            +
                    link_to image_tag("sponsors/#{name.underscore.gsub(/[\ \_]+/, "-")}-logo.jpg"), url, :title => name, :class => 'sponsor'
         
     | 
| 
      
 44 
     | 
    
         
            +
                  end
         
     | 
| 
      
 45 
     | 
    
         
            +
                  
         
     | 
| 
      
 46 
     | 
    
         
            +
                end
         
     | 
| 
      
 47 
     | 
    
         
            +
              end
         
     | 
| 
      
 48 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,133 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module YouthTree
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Helpers
         
     | 
| 
      
 3 
     | 
    
         
            +
                module GeneralHelper
         
     | 
| 
      
 4 
     | 
    
         
            +
                  
         
     | 
| 
      
 5 
     | 
    
         
            +
                  # Returns a nicely formatted date rang.
         
     | 
| 
      
 6 
     | 
    
         
            +
                  def pretty_date_range(from, to)
         
     | 
| 
      
 7 
     | 
    
         
            +
                    from_day, to_day = from.day.ordinalize, to.day.ordinalize
         
     | 
| 
      
 8 
     | 
    
         
            +
                    if [from.day, from.month, from.year] == [to.day, to.month, to.year]
         
     | 
| 
      
 9 
     | 
    
         
            +
                      "#{ampm from} to #{ampm to}, #{to_day} #{to.strftime "%B, %Y"}"
         
     | 
| 
      
 10 
     | 
    
         
            +
                    elsif [from.month, from.year] == [to.month, to.year]
         
     | 
| 
      
 11 
     | 
    
         
            +
                      "#{ampm from} #{from_day} to #{ampm to} #{to_day}, #{to.strftime "%B, %Y"}"
         
     | 
| 
      
 12 
     | 
    
         
            +
                    else
         
     | 
| 
      
 13 
     | 
    
         
            +
                      "#{ampm from} #{from_day}, #{from.strftime "%B, %Y"} to #{ampm to} #{to_day}, #{to.strftime "%B, %Y"}"
         
     | 
| 
      
 14 
     | 
    
         
            +
                    end
         
     | 
| 
      
 15 
     | 
    
         
            +
                  end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                  # Returns a nicely formated am/pm time with leading zeroes dropped.
         
     | 
| 
      
 18 
     | 
    
         
            +
                  def ampm(t)
         
     | 
| 
      
 19 
     | 
    
         
            +
                    t.strftime("%I:%M %p").gsub(/^0/, '')
         
     | 
| 
      
 20 
     | 
    
         
            +
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                  # A prettier form of the time.
         
     | 
| 
      
 23 
     | 
    
         
            +
                  def pretty_time(t)
         
     | 
| 
      
 24 
     | 
    
         
            +
                    "#{ampm t}, #{t.day.ordinalize} #{t.strftime "%B, %Y"}"
         
     | 
| 
      
 25 
     | 
    
         
            +
                  end
         
     | 
| 
      
 26 
     | 
    
         
            +
                  
         
     | 
| 
      
 27 
     | 
    
         
            +
                  # Returns the first paragraph of text, requires nokogiri.
         
     | 
| 
      
 28 
     | 
    
         
            +
                  def first_paragraph_of(text)
         
     | 
| 
      
 29 
     | 
    
         
            +
                    if defined?(Nokogiri)
         
     | 
| 
      
 30 
     | 
    
         
            +
                      Nokogiri::HTML(text).at('p').try(:to_html).try(:html_safe) || text
         
     | 
| 
      
 31 
     | 
    
         
            +
                    end
         
     | 
| 
      
 32 
     | 
    
         
            +
                  end
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                  # Returns a simple meta tag.
         
     | 
| 
      
 35 
     | 
    
         
            +
                  def meta_tag(name, content)
         
     | 
| 
      
 36 
     | 
    
         
            +
                    tag(:meta, :name => name.to_s, :content => content.to_s)
         
     | 
| 
      
 37 
     | 
    
         
            +
                  end
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                  # Published at for almost_happy.
         
     | 
| 
      
 40 
     | 
    
         
            +
                  def formatted_published_time(object)
         
     | 
| 
      
 41 
     | 
    
         
            +
                    object.published_at.blank? ? "Not yet published" : l(object.published_at, :format => :long)
         
     | 
| 
      
 42 
     | 
    
         
            +
                  end
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                  # Content with links converted to their absolute version.
         
     | 
| 
      
 45 
     | 
    
         
            +
                  # doesn't take into account https etc.
         
     | 
| 
      
 46 
     | 
    
         
            +
                  def absolutize_links(html)
         
     | 
| 
      
 47 
     | 
    
         
            +
                    return unless defined?(Nokogiri)
         
     | 
| 
      
 48 
     | 
    
         
            +
                    doc = Nokogiri::HTML(html)
         
     | 
| 
      
 49 
     | 
    
         
            +
                    doc.search('a').each do |link|
         
     | 
| 
      
 50 
     | 
    
         
            +
                      href = link['href'].to_s
         
     | 
| 
      
 51 
     | 
    
         
            +
                      link['href'] = "http://#{request.host}#{href}" if href =~ /^\//
         
     | 
| 
      
 52 
     | 
    
         
            +
                    end
         
     | 
| 
      
 53 
     | 
    
         
            +
                    doc.at('*').to_html.html_safe
         
     | 
| 
      
 54 
     | 
    
         
            +
                  end
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
                  # Returns a button
         
     | 
| 
      
 57 
     | 
    
         
            +
                  def button_tag(text, opts = {})
         
     | 
| 
      
 58 
     | 
    
         
            +
                    content_tag :button, text, opts
         
     | 
| 
      
 59 
     | 
    
         
            +
                  end
         
     | 
| 
      
 60 
     | 
    
         
            +
                  
         
     | 
| 
      
 61 
     | 
    
         
            +
                  # Shorthand to render a partial, defaulting to passing object / locals
         
     | 
| 
      
 62 
     | 
    
         
            +
                  # instead of options.
         
     | 
| 
      
 63 
     | 
    
         
            +
                  def partial(name, options = nil)
         
     | 
| 
      
 64 
     | 
    
         
            +
                    opts = {:partial => name.to_s}
         
     | 
| 
      
 65 
     | 
    
         
            +
                    if options.is_a?(Hash)
         
     | 
| 
      
 66 
     | 
    
         
            +
                      opts[:locals] = options
         
     | 
| 
      
 67 
     | 
    
         
            +
                    elsif options.present?
         
     | 
| 
      
 68 
     | 
    
         
            +
                      opts[:object] = options
         
     | 
| 
      
 69 
     | 
    
         
            +
                    end
         
     | 
| 
      
 70 
     | 
    
         
            +
                    render opts
         
     | 
| 
      
 71 
     | 
    
         
            +
                  end
         
     | 
| 
      
 72 
     | 
    
         
            +
                  
         
     | 
| 
      
 73 
     | 
    
         
            +
                  # Simple menu item shorthand.
         
     | 
| 
      
 74 
     | 
    
         
            +
                  def menu_link(*args, &blk)
         
     | 
| 
      
 75 
     | 
    
         
            +
                    content_tag(:li, link_to(*args, &blk), :class => 'menu-item')
         
     | 
| 
      
 76 
     | 
    
         
            +
                  end
         
     | 
| 
      
 77 
     | 
    
         
            +
                  alias ml menu_link
         
     | 
| 
      
 78 
     | 
    
         
            +
                  
         
     | 
| 
      
 79 
     | 
    
         
            +
                  # Properly formatted copyright text.
         
     | 
| 
      
 80 
     | 
    
         
            +
                  def copyright(year, now = Time.now)
         
     | 
| 
      
 81 
     | 
    
         
            +
                    if now.year == year
         
     | 
| 
      
 82 
     | 
    
         
            +
                      year.to_s
         
     | 
| 
      
 83 
     | 
    
         
            +
                    elsif year / 1000 == now.year / 1000 # same century
         
     | 
| 
      
 84 
     | 
    
         
            +
                      year.to_s + "–" + now.year.to_s[-2..3]
         
     | 
| 
      
 85 
     | 
    
         
            +
                    else
         
     | 
| 
      
 86 
     | 
    
         
            +
                      year.to_s + "–" + now.year.to_s
         
     | 
| 
      
 87 
     | 
    
         
            +
                    end
         
     | 
| 
      
 88 
     | 
    
         
            +
                  end
         
     | 
| 
      
 89 
     | 
    
         
            +
                  
         
     | 
| 
      
 90 
     | 
    
         
            +
                  # Simply boolean display
         
     | 
| 
      
 91 
     | 
    
         
            +
                  def yes_no?(value)
         
     | 
| 
      
 92 
     | 
    
         
            +
                    value ? "Yes" : "No"
         
     | 
| 
      
 93 
     | 
    
         
            +
                  end
         
     | 
| 
      
 94 
     | 
    
         
            +
             
     | 
| 
      
 95 
     | 
    
         
            +
                  # Returns value for _destroy.
         
     | 
| 
      
 96 
     | 
    
         
            +
                  def destroy_value(form)
         
     | 
| 
      
 97 
     | 
    
         
            +
                    form.object._destroy ? 1 : 0
         
     | 
| 
      
 98 
     | 
    
         
            +
                  end
         
     | 
| 
      
 99 
     | 
    
         
            +
             
     | 
| 
      
 100 
     | 
    
         
            +
                  # URL with ssl included.
         
     | 
| 
      
 101 
     | 
    
         
            +
                  def uri2ssl(url)
         
     | 
| 
      
 102 
     | 
    
         
            +
                    parts = url.to_s.split("://", 2)
         
     | 
| 
      
 103 
     | 
    
         
            +
                    "#{Settings.ssl_protocol}://#{parts[1] || parts[0]}"
         
     | 
| 
      
 104 
     | 
    
         
            +
                  end
         
     | 
| 
      
 105 
     | 
    
         
            +
             
     | 
| 
      
 106 
     | 
    
         
            +
                  # URL opts with ssl merged.
         
     | 
| 
      
 107 
     | 
    
         
            +
                  def ssl_opts(opts = {})
         
     | 
| 
      
 108 
     | 
    
         
            +
                    opts.merge(:protocol => Settings.ssl_protocol)
         
     | 
| 
      
 109 
     | 
    
         
            +
                  end
         
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
      
 111 
     | 
    
         
            +
                  # Generate flash message html
         
     | 
| 
      
 112 
     | 
    
         
            +
                  def flash_messages(*names)
         
     | 
| 
      
 113 
     | 
    
         
            +
                    names = names.select { |k| flash[k].present? }
         
     | 
| 
      
 114 
     | 
    
         
            +
                    return if names.blank?
         
     | 
| 
      
 115 
     | 
    
         
            +
                    content = []
         
     | 
| 
      
 116 
     | 
    
         
            +
                    names.each_with_index do |key, idx|
         
     | 
| 
      
 117 
     | 
    
         
            +
                      value = flash[key]
         
     | 
| 
      
 118 
     | 
    
         
            +
                      first, last = (idx == 0), (idx == names.length - 1)
         
     | 
| 
      
 119 
     | 
    
         
            +
                      content << content_tag(:p, value, :class => "flash #{key} #{"first" if first} #{"last" if last}".strip)
         
     | 
| 
      
 120 
     | 
    
         
            +
                    end
         
     | 
| 
      
 121 
     | 
    
         
            +
                    content_tag(:section, content.sum(ActiveSupport::SafeBuffer.new), :id => "flash-messages").html_safe
         
     | 
| 
      
 122 
     | 
    
         
            +
                  end
         
     | 
| 
      
 123 
     | 
    
         
            +
                  
         
     | 
| 
      
 124 
     | 
    
         
            +
                  # HTML for an inline button.
         
     | 
| 
      
 125 
     | 
    
         
            +
                  def inline_button(text, url, opts = {})
         
     | 
| 
      
 126 
     | 
    
         
            +
                    form_tag(url) do
         
     | 
| 
      
 127 
     | 
    
         
            +
                      concat content_tag(:button, text, :type => "submit")
         
     | 
| 
      
 128 
     | 
    
         
            +
                    end
         
     | 
| 
      
 129 
     | 
    
         
            +
                  end
         
     | 
| 
      
 130 
     | 
    
         
            +
                  
         
     | 
| 
      
 131 
     | 
    
         
            +
                end
         
     | 
| 
      
 132 
     | 
    
         
            +
              end
         
     | 
| 
      
 133 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,38 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module YouthTree
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Helpers
         
     | 
| 
      
 3 
     | 
    
         
            +
                module SidebarHelper
         
     | 
| 
      
 4 
     | 
    
         
            +
                  
         
     | 
| 
      
 5 
     | 
    
         
            +
                  # Returns the sidebar content.
         
     | 
| 
      
 6 
     | 
    
         
            +
                  def sidebar_content
         
     | 
| 
      
 7 
     | 
    
         
            +
                    content = content_for :sidebar
         
     | 
| 
      
 8 
     | 
    
         
            +
                    content.present? ? content : default_sidebar
         
     | 
| 
      
 9 
     | 
    
         
            +
                  end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                  # Do we have a sidebar?
         
     | 
| 
      
 12 
     | 
    
         
            +
                  def has_sidebar?
         
     | 
| 
      
 13 
     | 
    
         
            +
                    sidebar_content.present? && show_sidebar?
         
     | 
| 
      
 14 
     | 
    
         
            +
                  end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                  # Set sidebar content
         
     | 
| 
      
 17 
     | 
    
         
            +
                  def sidebar_contains(*args, &blk)
         
     | 
| 
      
 18 
     | 
    
         
            +
                    content_for :sidebar, *args, &blk
         
     | 
| 
      
 19 
     | 
    
         
            +
                  end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                  # Content class, inc. sidebar
         
     | 
| 
      
 22 
     | 
    
         
            +
                  def main_content_class
         
     | 
| 
      
 23 
     | 
    
         
            +
                    (Array(@extra_content_classes) + [has_sidebar? ? "left" : "full-width"]).uniq.sort.join(" ")
         
     | 
| 
      
 24 
     | 
    
         
            +
                  end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                  # Render content for sidebar
         
     | 
| 
      
 27 
     | 
    
         
            +
                  def render_to_sidebar!(partial_name, options = {})
         
     | 
| 
      
 28 
     | 
    
         
            +
                    sidebar_contains render(options.merge(:partial => partial_name))
         
     | 
| 
      
 29 
     | 
    
         
            +
                  end
         
     | 
| 
      
 30 
     | 
    
         
            +
                  
         
     | 
| 
      
 31 
     | 
    
         
            +
                  # Renders a default sidebar
         
     | 
| 
      
 32 
     | 
    
         
            +
                  def default_sidebar
         
     | 
| 
      
 33 
     | 
    
         
            +
                    render(:partial => 'shared/default_sidebar')
         
     | 
| 
      
 34 
     | 
    
         
            +
                  end
         
     | 
| 
      
 35 
     | 
    
         
            +
                  
         
     | 
| 
      
 36 
     | 
    
         
            +
                end
         
     | 
| 
      
 37 
     | 
    
         
            +
              end
         
     | 
| 
      
 38 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,17 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module YouthTree
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Helpers
         
     | 
| 
      
 3 
     | 
    
         
            +
                module UuidTrackerHelper
         
     | 
| 
      
 4 
     | 
    
         
            +
                  
         
     | 
| 
      
 5 
     | 
    
         
            +
                  # Returns the current request uuid
         
     | 
| 
      
 6 
     | 
    
         
            +
                  def current_request_uuid
         
     | 
| 
      
 7 
     | 
    
         
            +
                    @current_request_uuid ||= request.env['rack.log-marker.uuid']
         
     | 
| 
      
 8 
     | 
    
         
            +
                  end
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  # Returns a html comment with the current request uuid
         
     | 
| 
      
 11 
     | 
    
         
            +
                  def uuid_marker_comment
         
     | 
| 
      
 12 
     | 
    
         
            +
                    "<!-- current-request-uuid: #{current_request_uuid} -->".html_safe if current_request_uuid.present?
         
     | 
| 
      
 13 
     | 
    
         
            +
                  end
         
     | 
| 
      
 14 
     | 
    
         
            +
                  
         
     | 
| 
      
 15 
     | 
    
         
            +
                end
         
     | 
| 
      
 16 
     | 
    
         
            +
              end
         
     | 
| 
      
 17 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,36 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'active_support/concern'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module YouthTree
         
     | 
| 
      
 4 
     | 
    
         
            +
              module Helpers
         
     | 
| 
      
 5 
     | 
    
         
            +
                VERSION = "0.1.2".freeze
         
     | 
| 
      
 6 
     | 
    
         
            +
                
         
     | 
| 
      
 7 
     | 
    
         
            +
                extend ActiveSupport::Autoload
         
     | 
| 
      
 8 
     | 
    
         
            +
                
         
     | 
| 
      
 9 
     | 
    
         
            +
                autoload :GeneralHelper
         
     | 
| 
      
 10 
     | 
    
         
            +
                autoload :AnalyticsHelper
         
     | 
| 
      
 11 
     | 
    
         
            +
                autoload :AssetsHelper
         
     | 
| 
      
 12 
     | 
    
         
            +
                autoload :EmbedHelper
         
     | 
| 
      
 13 
     | 
    
         
            +
                autoload :SidebarHelper
         
     | 
| 
      
 14 
     | 
    
         
            +
                autoload :UuidTrackerHelper
         
     | 
| 
      
 15 
     | 
    
         
            +
                
         
     | 
| 
      
 16 
     | 
    
         
            +
                def self.install!
         
     | 
| 
      
 17 
     | 
    
         
            +
                  ActionView::Base.class_eval do
         
     | 
| 
      
 18 
     | 
    
         
            +
                    include GeneralHelper
         
     | 
| 
      
 19 
     | 
    
         
            +
                    include AnalyticsHelper
         
     | 
| 
      
 20 
     | 
    
         
            +
                    include AssetsHelper
         
     | 
| 
      
 21 
     | 
    
         
            +
                    include EmbedHelper
         
     | 
| 
      
 22 
     | 
    
         
            +
                    include SidebarHelper
         
     | 
| 
      
 23 
     | 
    
         
            +
                    include UuidTrackerHelper
         
     | 
| 
      
 24 
     | 
    
         
            +
                  end
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
                
         
     | 
| 
      
 27 
     | 
    
         
            +
                if defined?(Rails::Railtie)
         
     | 
| 
      
 28 
     | 
    
         
            +
                  class Railtie < Rails::Railtie
         
     | 
| 
      
 29 
     | 
    
         
            +
                    initializer "youthtree-helpers.setup-helpers" do
         
     | 
| 
      
 30 
     | 
    
         
            +
                      YouthTree::Helpers.install!
         
     | 
| 
      
 31 
     | 
    
         
            +
                    end
         
     | 
| 
      
 32 
     | 
    
         
            +
                  end
         
     | 
| 
      
 33 
     | 
    
         
            +
                end
         
     | 
| 
      
 34 
     | 
    
         
            +
                
         
     | 
| 
      
 35 
     | 
    
         
            +
              end
         
     | 
| 
      
 36 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'youth_tree/helpers'
         
     | 
| 
         @@ -0,0 +1,63 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Generated by jeweler
         
     | 
| 
      
 2 
     | 
    
         
            +
            # DO NOT EDIT THIS FILE DIRECTLY
         
     | 
| 
      
 3 
     | 
    
         
            +
            # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
         
     | 
| 
      
 4 
     | 
    
         
            +
            # -*- encoding: utf-8 -*-
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            Gem::Specification.new do |s|
         
     | 
| 
      
 7 
     | 
    
         
            +
              s.name = %q{youthtree-helpers}
         
     | 
| 
      
 8 
     | 
    
         
            +
              s.version = "0.1.2"
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         
     | 
| 
      
 11 
     | 
    
         
            +
              s.authors = ["Darcy Laycock"]
         
     | 
| 
      
 12 
     | 
    
         
            +
              s.date = %q{2010-08-23}
         
     | 
| 
      
 13 
     | 
    
         
            +
              s.description = %q{Helpers to make life easier when coding YT-specific apps. see the code..}
         
     | 
| 
      
 14 
     | 
    
         
            +
              s.email = %q{sutto@sutto.net}
         
     | 
| 
      
 15 
     | 
    
         
            +
              s.extra_rdoc_files = [
         
     | 
| 
      
 16 
     | 
    
         
            +
                "LICENSE",
         
     | 
| 
      
 17 
     | 
    
         
            +
                 "README.md"
         
     | 
| 
      
 18 
     | 
    
         
            +
              ]
         
     | 
| 
      
 19 
     | 
    
         
            +
              s.files = [
         
     | 
| 
      
 20 
     | 
    
         
            +
                ".document",
         
     | 
| 
      
 21 
     | 
    
         
            +
                 ".gitignore",
         
     | 
| 
      
 22 
     | 
    
         
            +
                 "LICENSE",
         
     | 
| 
      
 23 
     | 
    
         
            +
                 "README.md",
         
     | 
| 
      
 24 
     | 
    
         
            +
                 "Rakefile",
         
     | 
| 
      
 25 
     | 
    
         
            +
                 "lib/youth_tree/helpers.rb",
         
     | 
| 
      
 26 
     | 
    
         
            +
                 "lib/youth_tree/helpers/analytics_helper.rb",
         
     | 
| 
      
 27 
     | 
    
         
            +
                 "lib/youth_tree/helpers/assets_helper.rb",
         
     | 
| 
      
 28 
     | 
    
         
            +
                 "lib/youth_tree/helpers/embed_helper.rb",
         
     | 
| 
      
 29 
     | 
    
         
            +
                 "lib/youth_tree/helpers/general_helper.rb",
         
     | 
| 
      
 30 
     | 
    
         
            +
                 "lib/youth_tree/helpers/sidebar_helper.rb",
         
     | 
| 
      
 31 
     | 
    
         
            +
                 "lib/youth_tree/helpers/uuid_tracker_helper.rb",
         
     | 
| 
      
 32 
     | 
    
         
            +
                 "lib/youthtree-helpers.rb",
         
     | 
| 
      
 33 
     | 
    
         
            +
                 "youthtree-helpers.gemspec"
         
     | 
| 
      
 34 
     | 
    
         
            +
              ]
         
     | 
| 
      
 35 
     | 
    
         
            +
              s.homepage = %q{http://github.com/YouthTree/youthtree-helpers}
         
     | 
| 
      
 36 
     | 
    
         
            +
              s.rdoc_options = ["--charset=UTF-8"]
         
     | 
| 
      
 37 
     | 
    
         
            +
              s.require_paths = ["lib"]
         
     | 
| 
      
 38 
     | 
    
         
            +
              s.rubygems_version = %q{1.3.7}
         
     | 
| 
      
 39 
     | 
    
         
            +
              s.summary = %q{A exceedingly simple set of helpers used across Youth Tree web applications.}
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
              if s.respond_to? :specification_version then
         
     | 
| 
      
 42 
     | 
    
         
            +
                current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
         
     | 
| 
      
 43 
     | 
    
         
            +
                s.specification_version = 3
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
                if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
         
     | 
| 
      
 46 
     | 
    
         
            +
                  s.add_runtime_dependency(%q<activesupport>, ["~> 3.0.0.rc"])
         
     | 
| 
      
 47 
     | 
    
         
            +
                  s.add_runtime_dependency(%q<actionpack>, ["~> 3.0.0.rc"])
         
     | 
| 
      
 48 
     | 
    
         
            +
                  s.add_runtime_dependency(%q<youthtree-js>, [">= 0"])
         
     | 
| 
      
 49 
     | 
    
         
            +
                  s.add_runtime_dependency(%q<youthtree-settings>, [">= 0"])
         
     | 
| 
      
 50 
     | 
    
         
            +
                else
         
     | 
| 
      
 51 
     | 
    
         
            +
                  s.add_dependency(%q<activesupport>, ["~> 3.0.0.rc"])
         
     | 
| 
      
 52 
     | 
    
         
            +
                  s.add_dependency(%q<actionpack>, ["~> 3.0.0.rc"])
         
     | 
| 
      
 53 
     | 
    
         
            +
                  s.add_dependency(%q<youthtree-js>, [">= 0"])
         
     | 
| 
      
 54 
     | 
    
         
            +
                  s.add_dependency(%q<youthtree-settings>, [">= 0"])
         
     | 
| 
      
 55 
     | 
    
         
            +
                end
         
     | 
| 
      
 56 
     | 
    
         
            +
              else
         
     | 
| 
      
 57 
     | 
    
         
            +
                s.add_dependency(%q<activesupport>, ["~> 3.0.0.rc"])
         
     | 
| 
      
 58 
     | 
    
         
            +
                s.add_dependency(%q<actionpack>, ["~> 3.0.0.rc"])
         
     | 
| 
      
 59 
     | 
    
         
            +
                s.add_dependency(%q<youthtree-js>, [">= 0"])
         
     | 
| 
      
 60 
     | 
    
         
            +
                s.add_dependency(%q<youthtree-settings>, [">= 0"])
         
     | 
| 
      
 61 
     | 
    
         
            +
              end
         
     | 
| 
      
 62 
     | 
    
         
            +
            end
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,142 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification 
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: youthtree-helpers
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version 
         
     | 
| 
      
 4 
     | 
    
         
            +
              hash: 31
         
     | 
| 
      
 5 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 6 
     | 
    
         
            +
              segments: 
         
     | 
| 
      
 7 
     | 
    
         
            +
              - 0
         
     | 
| 
      
 8 
     | 
    
         
            +
              - 1
         
     | 
| 
      
 9 
     | 
    
         
            +
              - 2
         
     | 
| 
      
 10 
     | 
    
         
            +
              version: 0.1.2
         
     | 
| 
      
 11 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 12 
     | 
    
         
            +
            authors: 
         
     | 
| 
      
 13 
     | 
    
         
            +
            - Darcy Laycock
         
     | 
| 
      
 14 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 15 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 16 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            date: 2010-08-23 00:00:00 +08:00
         
     | 
| 
      
 19 
     | 
    
         
            +
            default_executable: 
         
     | 
| 
      
 20 
     | 
    
         
            +
            dependencies: 
         
     | 
| 
      
 21 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 22 
     | 
    
         
            +
              name: activesupport
         
     | 
| 
      
 23 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 24 
     | 
    
         
            +
              requirement: &id001 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 25 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 26 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 27 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 28 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 29 
     | 
    
         
            +
                    hash: 7712042
         
     | 
| 
      
 30 
     | 
    
         
            +
                    segments: 
         
     | 
| 
      
 31 
     | 
    
         
            +
                    - 3
         
     | 
| 
      
 32 
     | 
    
         
            +
                    - 0
         
     | 
| 
      
 33 
     | 
    
         
            +
                    - 0
         
     | 
| 
      
 34 
     | 
    
         
            +
                    - rc
         
     | 
| 
      
 35 
     | 
    
         
            +
                    version: 3.0.0.rc
         
     | 
| 
      
 36 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 37 
     | 
    
         
            +
              version_requirements: *id001
         
     | 
| 
      
 38 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 39 
     | 
    
         
            +
              name: actionpack
         
     | 
| 
      
 40 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 41 
     | 
    
         
            +
              requirement: &id002 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 42 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 43 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 44 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 45 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 46 
     | 
    
         
            +
                    hash: 7712042
         
     | 
| 
      
 47 
     | 
    
         
            +
                    segments: 
         
     | 
| 
      
 48 
     | 
    
         
            +
                    - 3
         
     | 
| 
      
 49 
     | 
    
         
            +
                    - 0
         
     | 
| 
      
 50 
     | 
    
         
            +
                    - 0
         
     | 
| 
      
 51 
     | 
    
         
            +
                    - rc
         
     | 
| 
      
 52 
     | 
    
         
            +
                    version: 3.0.0.rc
         
     | 
| 
      
 53 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 54 
     | 
    
         
            +
              version_requirements: *id002
         
     | 
| 
      
 55 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 56 
     | 
    
         
            +
              name: youthtree-js
         
     | 
| 
      
 57 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 58 
     | 
    
         
            +
              requirement: &id003 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 59 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 60 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 61 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 62 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 63 
     | 
    
         
            +
                    hash: 3
         
     | 
| 
      
 64 
     | 
    
         
            +
                    segments: 
         
     | 
| 
      
 65 
     | 
    
         
            +
                    - 0
         
     | 
| 
      
 66 
     | 
    
         
            +
                    version: "0"
         
     | 
| 
      
 67 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 68 
     | 
    
         
            +
              version_requirements: *id003
         
     | 
| 
      
 69 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 70 
     | 
    
         
            +
              name: youthtree-settings
         
     | 
| 
      
 71 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 72 
     | 
    
         
            +
              requirement: &id004 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 73 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 74 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 75 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 76 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 77 
     | 
    
         
            +
                    hash: 3
         
     | 
| 
      
 78 
     | 
    
         
            +
                    segments: 
         
     | 
| 
      
 79 
     | 
    
         
            +
                    - 0
         
     | 
| 
      
 80 
     | 
    
         
            +
                    version: "0"
         
     | 
| 
      
 81 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 82 
     | 
    
         
            +
              version_requirements: *id004
         
     | 
| 
      
 83 
     | 
    
         
            +
            description: Helpers to make life easier when coding YT-specific apps. see the code..
         
     | 
| 
      
 84 
     | 
    
         
            +
            email: sutto@sutto.net
         
     | 
| 
      
 85 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
            extra_rdoc_files: 
         
     | 
| 
      
 90 
     | 
    
         
            +
            - LICENSE
         
     | 
| 
      
 91 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 92 
     | 
    
         
            +
            files: 
         
     | 
| 
      
 93 
     | 
    
         
            +
            - .document
         
     | 
| 
      
 94 
     | 
    
         
            +
            - .gitignore
         
     | 
| 
      
 95 
     | 
    
         
            +
            - LICENSE
         
     | 
| 
      
 96 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 97 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 98 
     | 
    
         
            +
            - lib/youth_tree/helpers.rb
         
     | 
| 
      
 99 
     | 
    
         
            +
            - lib/youth_tree/helpers/analytics_helper.rb
         
     | 
| 
      
 100 
     | 
    
         
            +
            - lib/youth_tree/helpers/assets_helper.rb
         
     | 
| 
      
 101 
     | 
    
         
            +
            - lib/youth_tree/helpers/embed_helper.rb
         
     | 
| 
      
 102 
     | 
    
         
            +
            - lib/youth_tree/helpers/general_helper.rb
         
     | 
| 
      
 103 
     | 
    
         
            +
            - lib/youth_tree/helpers/sidebar_helper.rb
         
     | 
| 
      
 104 
     | 
    
         
            +
            - lib/youth_tree/helpers/uuid_tracker_helper.rb
         
     | 
| 
      
 105 
     | 
    
         
            +
            - lib/youthtree-helpers.rb
         
     | 
| 
      
 106 
     | 
    
         
            +
            - youthtree-helpers.gemspec
         
     | 
| 
      
 107 
     | 
    
         
            +
            has_rdoc: true
         
     | 
| 
      
 108 
     | 
    
         
            +
            homepage: http://github.com/YouthTree/youthtree-helpers
         
     | 
| 
      
 109 
     | 
    
         
            +
            licenses: []
         
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
      
 111 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 112 
     | 
    
         
            +
            rdoc_options: 
         
     | 
| 
      
 113 
     | 
    
         
            +
            - --charset=UTF-8
         
     | 
| 
      
 114 
     | 
    
         
            +
            require_paths: 
         
     | 
| 
      
 115 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 116 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement 
         
     | 
| 
      
 117 
     | 
    
         
            +
              none: false
         
     | 
| 
      
 118 
     | 
    
         
            +
              requirements: 
         
     | 
| 
      
 119 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 120 
     | 
    
         
            +
                - !ruby/object:Gem::Version 
         
     | 
| 
      
 121 
     | 
    
         
            +
                  hash: 3
         
     | 
| 
      
 122 
     | 
    
         
            +
                  segments: 
         
     | 
| 
      
 123 
     | 
    
         
            +
                  - 0
         
     | 
| 
      
 124 
     | 
    
         
            +
                  version: "0"
         
     | 
| 
      
 125 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement 
         
     | 
| 
      
 126 
     | 
    
         
            +
              none: false
         
     | 
| 
      
 127 
     | 
    
         
            +
              requirements: 
         
     | 
| 
      
 128 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 129 
     | 
    
         
            +
                - !ruby/object:Gem::Version 
         
     | 
| 
      
 130 
     | 
    
         
            +
                  hash: 3
         
     | 
| 
      
 131 
     | 
    
         
            +
                  segments: 
         
     | 
| 
      
 132 
     | 
    
         
            +
                  - 0
         
     | 
| 
      
 133 
     | 
    
         
            +
                  version: "0"
         
     | 
| 
      
 134 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 135 
     | 
    
         
            +
             
     | 
| 
      
 136 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 137 
     | 
    
         
            +
            rubygems_version: 1.3.7
         
     | 
| 
      
 138 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 139 
     | 
    
         
            +
            specification_version: 3
         
     | 
| 
      
 140 
     | 
    
         
            +
            summary: A exceedingly simple set of helpers used across Youth Tree web applications.
         
     | 
| 
      
 141 
     | 
    
         
            +
            test_files: []
         
     | 
| 
      
 142 
     | 
    
         
            +
             
     |