Sha256: 03234e5fe5b11044ba7eb6710b2fa9a176b06866d60a0b9880c2d79a02d9cbd3

Contents?: true

Size: 1.06 KB

Versions: 4

Compression:

Stored size: 1.06 KB

Contents

class CreateKuztuscmsTemplates < ActiveRecord::Migration
  def change
    create_table :kuztuscms_templates do |t|
      t.text :body
      t.string :path
      t.string :format
      t.string :locale
      t.string :handler
      t.boolean :partial, :default => false

      t.timestamps
    end

    body = <<EOF
<% if code = Kuztuscms.settings.get('google-analytics') %>
  <script type="text/javascript">
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', '<%= code %>']);
    _gaq.push(['_trackPageview']);

    (function() {
      var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
      ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
      var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();
  </script>
<% end %>
EOF
    Kuztuscms::Template.create(
      :body => body, 
      :path => 'google-analytics', 
      :format => 'html', 
      :locale => 'en', 
      :handler => 'erb', 
      :partial => true
    )
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
kuztuscms-0.0.10 db/migrate/20120311080242_create_kuztuscms_templates.rb
kuztuscms-0.0.9 db/migrate/20120311080242_create_kuztuscms_templates.rb
kuztuscms-0.0.8 db/migrate/20120311080242_create_kuztuscms_templates.rb
kuztuscms-0.0.7 db/migrate/20120311080242_create_kuztuscms_templates.rb