Sha256: ee7181e04f8f3502629def6787604cf2f1888d23bb4f5fbb1d1e860a6603b18e

Contents?: true

Size: 1.05 KB

Versions: 6

Compression:

Stored size: 1.05 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 = @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

6 entries across 6 versions & 1 rubygems

Version Path
kuztuscms-0.0.6 db/migrate/20120311080242_create_kuztuscms_templates.rb
kuztuscms-0.0.5 db/migrate/20120311080242_create_kuztuscms_templates.rb
kuztuscms-0.0.4 db/migrate/20120311080242_create_kuztuscms_templates.rb
kuztuscms-0.0.3 db/migrate/20120311080242_create_kuztuscms_templates.rb
kuztuscms-0.0.2 db/migrate/20120311080242_create_kuztuscms_templates.rb
kuztuscms-0.0.1 db/migrate/20120311080242_create_kuztuscms_templates.rb