spud_cms 0.9.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,61 @@
1
+ class Spud::Admin::SnippetsController < Spud::Admin::ApplicationController
2
+ belongs_to_spud_app :snippets
3
+ layout '/spud/admin/detail'
4
+ add_breadcrumb "Snippets", :spud_admin_snippets_url
5
+
6
+ before_filter :load_snippet, :only => [:show, :edit, :update, :destroy]
7
+
8
+ cache_sweeper :snippet_sweeper, :only => [:update,:destroy,:create]
9
+
10
+ def index
11
+ @snippets = SpudSnippet.site(session[:admin_site]).order(:name).paginate :page => params[:page]
12
+
13
+ respond_with @snippets
14
+ end
15
+
16
+ def new
17
+ add_breadcrumb "New", :new_spud_admin_snippet_url
18
+ @snippet = SpudSnippet.new
19
+ respond_with @snippet
20
+ end
21
+
22
+ def create
23
+ add_breadcrumb "New", :new_spud_admin_snippet_url
24
+ @snippet = SpudSnippet.new(params[:spud_snippet])
25
+ @snippet.site_id = session[:admin_site]
26
+
27
+ @snippet.save
28
+
29
+ respond_with @snippet, :location => spud_admin_snippets_url
30
+ end
31
+
32
+ def edit
33
+ add_breadcrumb "Edit", :edit_spud_admin_snippet_url
34
+
35
+ respond_with @snippet
36
+ end
37
+
38
+ def update
39
+ add_breadcrumb "Edit", :edit_spud_admin_snippet_url
40
+ flash[:notice] = "Snippet saved successfully!" if @snippet.update_attributes(params[:spud_snippet])
41
+ respond_with @snippet, :location => spud_admin_snippets_url
42
+ end
43
+
44
+ def destroy
45
+ flash[:notice] = "Snippet removed!" if @snippet.destroy
46
+ respond_with @snippet,:location => spud_admin_snippets_url
47
+ end
48
+
49
+
50
+ private
51
+ def load_snippet
52
+ @snippet = SpudSnippet.where(:id => params[:id]).first
53
+ if @snippet.blank?
54
+ flash[:error] = "Snippet does not exist!"
55
+ redirect_to spud_admin_snippets_url and return false
56
+ elsif Spud::Core.multisite_mode_enabled && @snippet.site_id != session[:admin_site]
57
+ flash[:warning] = "This snippet is for a different site"
58
+ redirect_to spud_admin_snippets_url and return false
59
+ end
60
+ end
61
+ end
@@ -1,5 +1,25 @@
1
1
  module Spud::Cms::ApplicationHelper
2
2
  MENU_INDEX = {}
3
+
4
+ def sp_snippet(name,snippets=nil)
5
+ if name.blank?
6
+ return ''
7
+ end
8
+
9
+ if !snippets.blank?
10
+ snippet = snippets.select {|s| s.name == name}
11
+ else
12
+ snippet = SpudSnippet.where(:name => name).first
13
+ end
14
+
15
+ if !snippet.blank?
16
+ return snippet.content_processed.html_safe
17
+ else
18
+ return nil
19
+ end
20
+
21
+ end
22
+
3
23
  def sp_list_pages(options = {})
4
24
 
5
25
  pages = SpudPage.public.published_pages
@@ -191,6 +211,7 @@ module Spud::Cms::ApplicationHelper
191
211
 
192
212
  return menu_tags.join(seperator).html_safe
193
213
  end
214
+
194
215
  private
195
216
  def sp_list_menu_item(items,item_id,depth,max_depth)
196
217
 
@@ -220,6 +241,7 @@ private
220
241
  content += "</ul>"
221
242
  return content.html_safe
222
243
  end
244
+
223
245
  def sp_list_page(page,collection,depth,max_depth,options = {})
224
246
  active_class = 'menu-active'
225
247
  if options.has_key?(:active_class)
@@ -251,6 +273,8 @@ private
251
273
 
252
274
 
253
275
  def layout_options
276
+ layouts = Spud::Cms::Engine.template_parser.layouts(Spud::Core.site_config_for_id(session[:admin_site] || 0)[:short_name])
277
+
254
278
  layouts = Spud::Cms::Engine.template_parser.layouts
255
279
  layout_options = []
256
280
  layouts.each_pair do |key,value|
@@ -1,4 +1,4 @@
1
1
  class SpudPageLiquidTag < ActiveRecord::Base
2
- attr_accessible :spud_page_partial_id, :tag_name, :value
3
- belongs_to :spud_page_partial
2
+ attr_accessible :attachment_type,:attachment_id, :tag_name, :value
3
+ belongs_to :attachment, :polymorphic => true
4
4
  end
@@ -1,6 +1,6 @@
1
1
  class SpudPagePartial < ActiveRecord::Base
2
2
  belongs_to :spud_page
3
- has_many :spud_page_liquid_tags, :dependent => :destroy
3
+ has_many :spud_page_liquid_tags, :as => :attachment, :dependent => :destroy
4
4
  validates :name,:presence => true
5
5
  attr_accessible :name, :spud_page_id, :content, :format, :content_processed
6
6
  before_save :maintain_revisions
@@ -0,0 +1,41 @@
1
+ class SpudSnippet < ActiveRecord::Base
2
+ attr_accessible :content, :content_processed, :format, :name
3
+ has_many :spud_page_liquid_tags, :as => :attachment, :dependent => :destroy
4
+
5
+ validates :name, :presence => true
6
+ validates_uniqueness_of :name, :scope => :site_id
7
+
8
+ scope :site, lambda {|sid| where(:site_id => sid)}
9
+
10
+ before_save :postprocess_content
11
+
12
+ def postprocess_content
13
+ template = Liquid::Template.parse(self.content) # Parses and compiles the template
14
+ update_taglist(template)
15
+ self.content_processed = template.render()
16
+ end
17
+
18
+ def content_processed=(content)
19
+ write_attribute(:content_processed,content)
20
+ end
21
+
22
+ def content_processed
23
+ if read_attribute(:content_processed).blank?
24
+ self.update_column(:content_processed, postprocess_content)
25
+ end
26
+ return read_attribute(:content_processed)
27
+ end
28
+
29
+
30
+ def update_taglist(template)
31
+ self.spud_page_liquid_tags.all.each do |tag|
32
+ tag.destroy
33
+ end
34
+ template.root.nodelist.each do |node|
35
+ if !node.is_a?(String) && defined?(node.tag_name) && defined?(node.tag_value)
36
+ self.spud_page_liquid_tags.create(:tag_name => node.tag_name,:value => node.tag_value)
37
+ end
38
+ end
39
+ end
40
+
41
+ end
@@ -0,0 +1,41 @@
1
+ class SnippetSweeper < ActionController::Caching::Sweeper
2
+ observe :spud_snippet
3
+
4
+ def before_save(record)
5
+ if record.is_a?(SpudSnippet)
6
+ @old_name = record.name_was
7
+ else
8
+ @old_name = nil
9
+ end
10
+ end
11
+
12
+ def after_save(record)
13
+ reset_cms_pages(record)
14
+ end
15
+
16
+ def after_destroy(record)
17
+ reset_cms_pages(record)
18
+ end
19
+
20
+ private
21
+ def reset_cms_pages(record)
22
+
23
+ values = [record.name]
24
+ values << @old_name if !@old_name.blank?
25
+ SpudPageLiquidTag.where(:tag_name => "snippet",:value => values).includes(:attachment).each do |tag|
26
+ partial = tag.attachment
27
+ partial.postprocess_content
28
+ partial.save
29
+ page = partial.try(:spud_page)
30
+ if page.blank? == false
31
+ page.updated_at = Time.now.utc
32
+ page.save
33
+ end
34
+
35
+
36
+ end
37
+ end
38
+
39
+
40
+
41
+ end
@@ -1,10 +1,7 @@
1
+ <%=form_for @menu,:url => spud_admin_menus_path,:html=>{:class=>"form-horizontal"} do |f|%>
2
+ <%=render :partial => "form",:locals => {:f => f}%>
3
+ <div class="form-actions">
4
+ <%=f.submit "Create Menu", :class=>"btn btn-primary"%> or <%=link_to "cancel",spud_admin_menus_path,:class => "btn"%>
5
+ </div>
1
6
 
2
-
3
-
4
- <%=form_for @menu,:url => spud_admin_menus_path,:html=>{:class=>"form-horizontal"} do |f|%>
5
- <%=render :partial => "form",:locals => {:f => f}%>
6
- <div class="form-actions">
7
- <%=f.submit "Create Menu", :class=>"btn btn-primary"%> or <%=link_to "cancel",spud_admin_menus_path,:class => "btn"%>
8
- </div>
9
-
10
- <%end%>
7
+ <%end%>
@@ -0,0 +1,8 @@
1
+ <fieldset>
2
+ <%= f.label :name, :required=>true,:style =>"display:none;" %>
3
+ <%= f.text_field :name, :class => "full-width",:placeholder=>"Enter title here" %>
4
+ </fieldset>
5
+ <br/>
6
+ <div>
7
+ <%= f.text_area :content,:style => "width:100%;", :class => 'tinymce full-width' %>
8
+ </div>
@@ -0,0 +1,7 @@
1
+ <%=form_for @snippet,:url => spud_admin_snippet_path(@snippet),:html=>{:class=>"form-horizontal"} do |f|%>
2
+ <%=render :partial => "form",:locals => {:f => f}%>
3
+ <div class="form-actions">
4
+ <%=f.submit "Save Snippet", :class=>"btn btn-primary"%> or <%=link_to "cancel",spud_admin_snippets_path,:class => "btn"%>
5
+ </div>
6
+
7
+ <%end%>
@@ -0,0 +1,24 @@
1
+ <%=content_for :data_controls do%>
2
+ <%=link_to "New Snippet",new_spud_admin_snippet_path(),:class => "btn btn-primary",:title => "New Snippet"%>
3
+ <%end%>
4
+ <%=content_for :detail do%>
5
+ <div class="page_list">
6
+ <%@snippets.each do |snippet|%>
7
+ <div class="page_row">
8
+
9
+ <span class="row_meta"><%=link_to snippet.name,edit_spud_admin_snippet_path(:id => snippet.id)%></span>
10
+
11
+ <span class="edit_controls">
12
+
13
+ <%=link_to "Remove",spud_admin_snippet_path(:id => snippet.id),:method => :delete,:class => 'btn btn-danger',:confirm => "Are you sure you want to remove this snippet?"%>
14
+ </span>
15
+ <br style="clear:both;"/>
16
+ </div>
17
+ <%end%>
18
+ <%=will_paginate @snippets%>
19
+
20
+ </div>
21
+
22
+
23
+
24
+ <%end%>
@@ -0,0 +1,7 @@
1
+ <%=form_for @snippet,:url => spud_admin_snippets_path,:html=>{:class=>"form-horizontal"} do |f|%>
2
+ <%=render :partial => "form",:locals => {:f => f}%>
3
+ <div class="form-actions">
4
+ <%=f.submit "Create Snippet", :class=>"btn btn-primary"%> or <%=link_to "cancel",spud_admin_snippets_path,:class => "btn"%>
5
+ </div>
6
+
7
+ <%end%>
data/config/routes.rb CHANGED
@@ -8,7 +8,8 @@ Rails.application.routes.draw do
8
8
  post 'preview'
9
9
  end
10
10
  end
11
- resources :templates
11
+
12
+ resources :snippets
12
13
 
13
14
  resources :menus do
14
15
  resources :menu_items
@@ -0,0 +1,17 @@
1
+ class CreateSpudSnippets < ActiveRecord::Migration
2
+ def change
3
+ create_table :spud_snippets do |t|
4
+ t.string :name
5
+ t.text :content
6
+ t.string :format
7
+ t.text :content_processed
8
+ t.integer :site_id, :default => 0
9
+ t.timestamps
10
+ end
11
+
12
+ add_index :spud_snippets, :site_id
13
+ add_index :spud_snippets, :name
14
+ end
15
+
16
+
17
+ end
@@ -0,0 +1,17 @@
1
+ class ChangeLiquidTagsToPolymorphic < ActiveRecord::Migration
2
+ def up
3
+ rename_column :spud_page_liquid_tags, :spud_page_partial_id, :attachment_id
4
+ add_column :spud_page_liquid_tags, :attachment_type, :string
5
+
6
+ add_index :spud_page_liquid_tags, [:attachment_type,:attachment_id]
7
+
8
+ SpudPageLiquidTag.all.each do |f|
9
+ f.update_attributes(:attachment_type => "SpudPagePartial")
10
+ end
11
+ end
12
+
13
+ def down
14
+ rename_column :spud_page_liquid_tags, :attachment_id, :spud_page_partial_id
15
+ remove_column :spud_page_liquid_tags, :attachment_type
16
+ end
17
+ end
@@ -2,8 +2,9 @@ module Spud
2
2
  module Cms
3
3
  include ActiveSupport::Configurable
4
4
 
5
- config_accessor :menus_enabled,:root_page_name,:yield_body_as_content_block,:default_page_layout,:enable_sitemap,:multisite_config,:max_revisions,:template_404, :cache_mode
5
+ config_accessor :menus_enabled,:root_page_name,:yield_body_as_content_block,:default_page_layout,:enable_sitemap,:multisite_config,:max_revisions,:template_404, :cache_mode, :snippets_enabled
6
6
  self.menus_enabled = true
7
+ self.snippets_enabled = true
7
8
  self.root_page_name = "home"
8
9
  self.default_page_layout = 'application'
9
10
  self.yield_body_as_content_block = false
@@ -8,26 +8,27 @@ module Spud
8
8
  class Engine < Rails::Engine
9
9
  engine_name :spud_cms
10
10
 
11
- # config.active_record.observers = [] if config.active_record.observers.nil?
12
- # config.active_record.observers += [:page_observer]
13
-
14
11
  config.generators do |g|
15
12
  g.test_framework :rspec, :view_specs => false
16
13
  end
17
14
 
18
- initializer :admin do
15
+ initializer :admin do
19
16
  Spud::Core.configure do |config|
20
17
  config.admin_applications += [{:name => "Pages",:thumbnail => "spud/admin/pages_thumb.png",:url => "/spud/admin/pages",:order => 0}]
21
18
  if Spud::Cms.menus_enabled
22
19
  config.admin_applications += [{:name => "Menus",:thumbnail => "spud/admin/menus_thumb.png",:url => "/spud/admin/menus",:order => 2}]
23
20
  end
24
21
 
22
+ if Spud::Cms.snippets_enabled
23
+ config.admin_applications += [{:name => "Snippets",:thumbnail => "spud/admin/snippets_thumb.png",:url => "/spud/admin/snippets",:order => 3}]
24
+ end
25
+
25
26
  if Spud::Cms.enable_sitemap == true
26
27
  config.sitemap_urls += [:spud_cms_sitemap_url]
27
28
  end
28
-
29
29
  end
30
- end
30
+ end
31
+
31
32
  initializer :model_overrides_cms do |config|
32
33
  ActiveRecord::Base.class_eval do
33
34
  include Spud::Searchable
@@ -49,6 +50,10 @@ module Spud
49
50
  Spud::Core.append_admin_stylesheets('spud/admin/cms/application')
50
51
  end
51
52
 
53
+ initializer :liquid do |config|
54
+ Liquid::Template.register_tag('snippet', Spud::Cms::LiquidSnippet)
55
+ end
56
+
52
57
  initializer :template_parser do |config|
53
58
  @template_parser = Spud::Cms::TemplateParser.new()
54
59
  end
@@ -57,6 +62,6 @@ module Spud
57
62
  return @template_parser
58
63
  end
59
64
 
65
+ end
60
66
  end
61
- end
62
67
  end
@@ -0,0 +1,29 @@
1
+ require 'liquid'
2
+ module Spud
3
+ module Cms
4
+ class LiquidSnippet < Liquid::Tag
5
+ def initialize(tag_name, snippet_name, tokens)
6
+ @snippet_name = snippet_name
7
+ @snippet = SpudSnippet.where(:name => snippet_name).first
8
+
9
+ end
10
+
11
+ def tag_name
12
+ return "snippet"
13
+ end
14
+ def tag_value
15
+ return @snippet_name
16
+ end
17
+
18
+ def render(context)
19
+
20
+ if !@snippet.blank?
21
+ return @snippet.content_processed.html_safe
22
+ else
23
+ return ''
24
+ end
25
+
26
+ end
27
+ end
28
+ end
29
+ end
@@ -1,5 +1,5 @@
1
1
  module Spud
2
2
  module Cms
3
- VERSION = "0.9.2"
3
+ VERSION = "0.9.3"
4
4
  end
5
5
  end
data/lib/spud_cms.rb CHANGED
@@ -3,6 +3,7 @@ module Spud
3
3
  module Cms
4
4
  require 'spud_cms/configuration'
5
5
  require 'spud_cms/template_parser'
6
+ require 'spud_cms/liquid_snippet'
6
7
  require 'spud_cms/engine' if defined?(Rails)
7
8
  end
8
9
  end
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe Spud::Admin::SnippetsController do
4
+
5
+ end
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended to check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(:version => 20121112151110) do
14
+ ActiveRecord::Schema.define(:version => 20121119030136) do
15
15
 
16
16
  create_table "spud_admin_permissions", :force => true do |t|
17
17
  t.integer "user_id"
@@ -50,6 +50,18 @@ ActiveRecord::Schema.define(:version => 20121112151110) do
50
50
 
51
51
  add_index "spud_menus", ["site_id"], :name => "index_spud_menus_on_site_id"
52
52
 
53
+ create_table "spud_page_liquid_tags", :force => true do |t|
54
+ t.integer "attachment_id"
55
+ t.string "tag_name"
56
+ t.string "value"
57
+ t.datetime "created_at", :null => false
58
+ t.datetime "updated_at", :null => false
59
+ t.string "attachment_type"
60
+ end
61
+
62
+ add_index "spud_page_liquid_tags", ["attachment_type", "attachment_id"], :name => "index_spud_page_liquid_tags_on_attachment_type_and_attachment_id"
63
+ add_index "spud_page_liquid_tags", ["tag_name", "value"], :name => "index_spud_page_liquid_tags_on_tag_name_and_value"
64
+
53
65
  create_table "spud_page_partial_revisions", :force => true do |t|
54
66
  t.string "name"
55
67
  t.text "content"
@@ -109,6 +121,19 @@ ActiveRecord::Schema.define(:version => 20121112151110) do
109
121
  add_index "spud_permalinks", ["attachment_type", "attachment_id"], :name => "index_spud_permalinks_on_attachment_type_and_attachment_id"
110
122
  add_index "spud_permalinks", ["site_id"], :name => "index_spud_permalinks_on_site_id"
111
123
 
124
+ create_table "spud_snippets", :force => true do |t|
125
+ t.string "name"
126
+ t.text "content"
127
+ t.string "format"
128
+ t.text "content_processed"
129
+ t.integer "site_id", :default => 0
130
+ t.datetime "created_at", :null => false
131
+ t.datetime "updated_at", :null => false
132
+ end
133
+
134
+ add_index "spud_snippets", ["name"], :name => "index_spud_snippets_on_name"
135
+ add_index "spud_snippets", ["site_id"], :name => "index_spud_snippets_on_site_id"
136
+
112
137
  create_table "spud_user_settings", :force => true do |t|
113
138
  t.integer "spud_user_id"
114
139
  t.string "key"
@@ -339,3 +339,49 @@ Connecting to database specified by database.yml
339
339
   (0.3ms) INSERT INTO `schema_migrations` (version) VALUES ('20120911190030')
340
340
   (0.2ms) INSERT INTO `schema_migrations` (version) VALUES ('20120912121313')
341
341
   (0.6ms) INSERT INTO `schema_migrations` (version) VALUES ('20121016233715')
342
+ Connecting to database specified by database.yml
343
+ Creating scope :public. Overwriting existing method SpudPage.public.
344
+  (6.1ms) SELECT `schema_migrations`.`version` FROM `schema_migrations` 
345
+ Migrating to CreateSpudPages (20120101192412)
346
+ Migrating to CreateSpudMenus (20120101193138)
347
+ Migrating to CreateSpudMenuItems (20120101193255)
348
+ Migrating to CreateSpudTemplates (20120101194124)
349
+ Migrating to CreateSpudPagePartials (20120103034659)
350
+ Migrating to AddVisibilityToSpudPages (20120104194032)
351
+ Migrating to AddMenuNameToSpudMenuItems (20120107181337)
352
+ Migrating to AddUseCustomUrlNameToSpudPages (20120111134754)
353
+ Migrating to AddNotesToSpudPages (20120118141852)
354
+ Migrating to AddMenuIdToSpudMenuItems (20120126232428)
355
+ Migrating to AddClassesToSpudMenuItems (20120128163601)
356
+ Migrating to CreateSpudAdminPermissions (20120307002859)
357
+ Migrating to CreateSpudUsers (20120307002860)
358
+ Migrating to CreateSpudPermalinks (20120307003559)
359
+ Migrating to AddSiteIdToSpudPages (20120329132314)
360
+ Migrating to AddSiteIdToSpudTemplates (20120329132322)
361
+ Migrating to AddSiteIdToSpudMenus (20120329132330)
362
+ Migrating to CreateSpudPagePartialRevisions (20120510195151)
363
+ Migrating to AddTimeZoneToSpudUser (20120610123555)
364
+ Migrating to AddScopeToSpudAdminPermissions (20120610123556)
365
+ Migrating to CreateSpudUserSettings (20120610123557)
366
+ Migrating to AddSiteIdToSpudPermalinks (20120610123615)
367
+ Migrating to AddSymbolNameToSpudPagePartials (20120911190030)
368
+ Migrating to ModifySiteIdForSpudPages (20120912121313)
369
+ Migrating to AddContentProcessedToSpudPagePartials (20121016233715)
370
+ Migrating to AddLayoutToSpudPages (20121112151110)
371
+ Migrating to CreateSpudPageLiquidTags (20121112212113)
372
+  (36.4ms) CREATE TABLE `spud_page_liquid_tags` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `spud_page_partial_id` int(11), `tag_name` varchar(255), `value` varchar(255), `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL) ENGINE=InnoDB
373
+  (26.9ms) CREATE INDEX `index_spud_page_liquid_tags_on_tag_name_and_value` ON `spud_page_liquid_tags` (`tag_name`, `value`)
374
+  (1.1ms) INSERT INTO `schema_migrations` (`version`) VALUES ('20121112212113')
375
+ Migrating to CreateSpudSnippets (20121119025608)
376
+  (14.6ms) CREATE TABLE `spud_snippets` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `name` varchar(255), `content` text, `format` varchar(255), `content_processed` text, `site_id` int(11) DEFAULT 0, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL) ENGINE=InnoDB
377
+  (24.7ms) CREATE INDEX `index_spud_snippets_on_site_id` ON `spud_snippets` (`site_id`)
378
+  (14.6ms) CREATE INDEX `index_spud_snippets_on_name` ON `spud_snippets` (`name`)
379
+  (0.4ms) INSERT INTO `schema_migrations` (`version`) VALUES ('20121119025608')
380
+ Migrating to ChangeLiquidTagsToPolymorphic (20121119030136)
381
+  (0.7ms) SHOW COLUMNS FROM `spud_page_liquid_tags` LIKE 'spud_page_partial_id'
382
+  (22.6ms) ALTER TABLE `spud_page_liquid_tags` CHANGE `spud_page_partial_id` `attachment_id` int(11) DEFAULT NULL
383
+  (18.2ms) ALTER TABLE `spud_page_liquid_tags` ADD `attachment_type` varchar(255)
384
+  (13.3ms) CREATE INDEX `index_spud_page_liquid_tags_on_attachment_type_and_attachment_id` ON `spud_page_liquid_tags` (`attachment_type`, `attachment_id`)
385
+ SpudPageLiquidTag Load (0.1ms) SELECT `spud_page_liquid_tags`.* FROM `spud_page_liquid_tags` 
386
+  (0.3ms) INSERT INTO `schema_migrations` (`version`) VALUES ('20121119030136')
387
+  (0.1ms) SELECT `schema_migrations`.`version` FROM `schema_migrations` 
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ # Specs in this file have access to a helper object that includes
4
+ # the Spud::Admin::SnippetsHelper. For example:
5
+ #
6
+ # describe Spud::Admin::SnippetsHelper do
7
+ # describe "string concat" do
8
+ # it "concats two strings with spaces" do
9
+ # helper.concat_strings("this","that").should == "this that"
10
+ # end
11
+ # end
12
+ # end
13
+ describe Spud::Admin::SnippetsHelper do
14
+ pending "add some examples to (or delete) #{__FILE__}"
15
+ end
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe SpudSnippet do
4
+ pending "add some examples to (or delete) #{__FILE__}"
5
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spud_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-16 00:00:00.000000000 Z
12
+ date: 2012-11-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -239,13 +239,16 @@ files:
239
239
  - app/assets/javascripts/spud/admin/cms/application.js
240
240
  - app/assets/javascripts/spud/admin/cms/menu_items.js
241
241
  - app/assets/javascripts/spud/admin/cms/pages.js
242
+ - app/assets/javascripts/spud/admin/snippets.js
242
243
  - app/assets/stylesheets/spud/admin/cms/application.css
243
244
  - app/assets/stylesheets/spud/admin/cms.css
245
+ - app/assets/stylesheets/spud/admin/snippets.css
244
246
  - app/controllers/pages_controller.rb
245
247
  - app/controllers/spud/admin/cms_controller.rb
246
248
  - app/controllers/spud/admin/menu_items_controller.rb
247
249
  - app/controllers/spud/admin/menus_controller.rb
248
250
  - app/controllers/spud/admin/pages_controller.rb
251
+ - app/controllers/spud/admin/snippets_controller.rb
249
252
  - app/controllers/spud/cms/sitemaps_controller.rb
250
253
  - app/helpers/spud/cms/application_helper.rb
251
254
  - app/models/spud_menu.rb
@@ -254,7 +257,9 @@ files:
254
257
  - app/models/spud_page_liquid_tag.rb
255
258
  - app/models/spud_page_partial.rb
256
259
  - app/models/spud_page_partial_revision.rb
260
+ - app/models/spud_snippet.rb
257
261
  - app/observers/page_sweeper.rb
262
+ - app/observers/snippet_sweeper.rb
258
263
  - app/views/pages/show.html.erb
259
264
  - app/views/spud/admin/menu_items/_form.html.erb
260
265
  - app/views/spud/admin/menu_items/_menu_item_row.html.erb
@@ -272,6 +277,10 @@ files:
272
277
  - app/views/spud/admin/pages/index.html.erb
273
278
  - app/views/spud/admin/pages/new.html.erb
274
279
  - app/views/spud/admin/pages/show.html.erb
280
+ - app/views/spud/admin/snippets/_form.html.erb
281
+ - app/views/spud/admin/snippets/edit.html.erb
282
+ - app/views/spud/admin/snippets/index.html.erb
283
+ - app/views/spud/admin/snippets/new.html.erb
275
284
  - app/views/spud/admin/templates/_form.html.erb
276
285
  - app/views/spud/admin/templates/edit.html.erb
277
286
  - app/views/spud/admin/templates/index.html.erb
@@ -299,8 +308,11 @@ files:
299
308
  - db/migrate/20121016233715_add_content_processed_to_spud_page_partials.rb
300
309
  - db/migrate/20121112151110_add_layout_to_spud_pages.rb
301
310
  - db/migrate/20121112212113_create_spud_page_liquid_tags.rb
311
+ - db/migrate/20121119025608_create_spud_snippets.rb
312
+ - db/migrate/20121119030136_change_liquid_tags_to_polymorphic.rb
302
313
  - lib/spud_cms/configuration.rb
303
314
  - lib/spud_cms/engine.rb
315
+ - lib/spud_cms/liquid_snippet.rb
304
316
  - lib/spud_cms/page_route.rb
305
317
  - lib/spud_cms/template_parser.rb
306
318
  - lib/spud_cms/test_files.rb
@@ -315,6 +327,7 @@ files:
315
327
  - spec/controllers/spud/admin/menu_items_controller_spec.rb
316
328
  - spec/controllers/spud/admin/menus_controller_spec.rb
317
329
  - spec/controllers/spud/admin/pages_controller_spec.rb
330
+ - spec/controllers/spud/admin/snippets_controller_spec.rb
318
331
  - spec/controllers/spud/cms/sitemaps_controller_spec.rb
319
332
  - spec/dummy/app/assets/javascripts/application.js
320
333
  - spec/dummy/app/assets/stylesheets/application.css
@@ -355,12 +368,14 @@ files:
355
368
  - spec/dummy/Rakefile
356
369
  - spec/dummy/README.rdoc
357
370
  - spec/dummy/script/rails
371
+ - spec/helpers/spud/admin/snippets_helper_spec.rb
358
372
  - spec/helpers/spud/cms/application_helper_spec.rb
359
373
  - spec/models/spud_menu_item_spec.rb
360
374
  - spec/models/spud_page_liquid_tag_spec.rb
361
375
  - spec/models/spud_page_partial_revision_spec.rb
362
376
  - spec/models/spud_page_partial_spec.rb
363
377
  - spec/models/spud_page_spec.rb
378
+ - spec/models/spud_snippet_spec.rb
364
379
  - spec/spec_helper.rb
365
380
  - spec/support/authlogic_helper.rb
366
381
  homepage: http://www.github.com/davydotcom/spud_cms
@@ -377,7 +392,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
377
392
  version: '0'
378
393
  segments:
379
394
  - 0
380
- hash: 4495024845249534031
395
+ hash: 3350950452711626729
381
396
  required_rubygems_version: !ruby/object:Gem::Requirement
382
397
  none: false
383
398
  requirements:
@@ -386,7 +401,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
386
401
  version: '0'
387
402
  segments:
388
403
  - 0
389
- hash: 4495024845249534031
404
+ hash: 3350950452711626729
390
405
  requirements: []
391
406
  rubyforge_project:
392
407
  rubygems_version: 1.8.24
@@ -399,6 +414,7 @@ test_files:
399
414
  - spec/controllers/spud/admin/menu_items_controller_spec.rb
400
415
  - spec/controllers/spud/admin/menus_controller_spec.rb
401
416
  - spec/controllers/spud/admin/pages_controller_spec.rb
417
+ - spec/controllers/spud/admin/snippets_controller_spec.rb
402
418
  - spec/controllers/spud/cms/sitemaps_controller_spec.rb
403
419
  - spec/dummy/app/assets/javascripts/application.js
404
420
  - spec/dummy/app/assets/stylesheets/application.css
@@ -439,11 +455,13 @@ test_files:
439
455
  - spec/dummy/Rakefile
440
456
  - spec/dummy/README.rdoc
441
457
  - spec/dummy/script/rails
458
+ - spec/helpers/spud/admin/snippets_helper_spec.rb
442
459
  - spec/helpers/spud/cms/application_helper_spec.rb
443
460
  - spec/models/spud_menu_item_spec.rb
444
461
  - spec/models/spud_page_liquid_tag_spec.rb
445
462
  - spec/models/spud_page_partial_revision_spec.rb
446
463
  - spec/models/spud_page_partial_spec.rb
447
464
  - spec/models/spud_page_spec.rb
465
+ - spec/models/spud_snippet_spec.rb
448
466
  - spec/spec_helper.rb
449
467
  - spec/support/authlogic_helper.rb