editorial_logic 1.3.3 → 1.4.0
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/Gemfile +1 -0
- data/VERSION +1 -1
- data/app/models/faq_import.rb +0 -1
- data/app/models/managed_content.rb +15 -14
- data/app/models/publication.rb +34 -20
- data/app/models/section.rb +16 -38
- data/app/views/admin/managed_contents/_article_fields.html.erb +1 -1
- data/app/views/admin/managed_contents/_document_fields.html.erb +1 -1
- data/app/views/admin/managed_contents/_faq_fields.html.erb +1 -1
- data/app/views/admin/managed_contents/_index.html.erb +1 -1
- data/app/views/admin/managed_contents/_term_fields.html.erb +1 -1
- data/app/views/admin/managed_contents/show.html.erb +1 -1
- data/app/views/admin/publications/_form.html.erb +1 -1
- data/app/views/admin/publications/index.html.erb +1 -1
- data/app/views/admin/publications/show.html.erb +2 -2
- data/app/views/admin/sections/_form.html.erb +1 -1
- data/app/views/admin/sections/_index.html.erb +1 -1
- data/app/views/admin/sections/show.html.erb +1 -1
- data/app/views/managed_contents/show.html.erb +3 -3
- data/app/views/publications/_articles.html.erb +1 -1
- data/app/views/publications/_faqs.html.erb +1 -1
- data/app/views/publications/_terms.html.erb +1 -1
- data/app/views/publications/feed.rss.builder +2 -2
- data/app/views/publications/show.html.erb +1 -1
- data/app/views/sections/_contents.html.erb +1 -1
- data/app/views/sections/show.html.erb +1 -1
- data/editorial_logic.gemspec +5 -4
- data/features/manage_articles_content.feature +0 -3
- data/features/manage_faq_content.feature +5 -7
- data/features/manage_glossary_content.feature +0 -1
- data/features/manage_publications.feature +0 -1
- data/features/step_definitions/publication_steps.rb +4 -5
- data/lib/editorial_logic.rb +3 -45
- data/spec/blueprints.rb +0 -1
- data/spec/controllers/admin/managed_contents_controller_spec.rb +4 -4
- data/spec/controllers/admin/publications_controller_spec.rb +3 -4
- data/spec/controllers/managed_contents_controller_spec.rb +2 -2
- data/spec/controllers/publications_controller_spec.rb +1 -1
- data/spec/models/managed_content_spec.rb +11 -14
- data/spec/models/publication_spec.rb +6 -22
- data/spec/models/section_spec.rb +9 -15
- metadata +25 -13
- data/lib/editorial_logic/engine.rb +0 -7
- data/spec/editorial_logic_spec.rb +0 -42
    
        data/Gemfile
    CHANGED
    
    
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            1. | 
| 1 | 
            +
            1.4.0
         | 
    
        data/app/models/faq_import.rb
    CHANGED
    
    | @@ -23,7 +23,6 @@ class FaqImport < ScaffoldLogic::DataImport | |
| 23 23 | 
             
              protected
         | 
| 24 24 |  | 
| 25 25 | 
             
              COLUMNS_BY_MODEL_FIELDS = {
         | 
| 26 | 
            -
                'desired_slug' => 'row_map[:slug]',
         | 
| 27 26 | 
             
                'headline' => 'row_map[:title]', # this is used as the title of the page and the link text of links pointing to the page
         | 
| 28 27 | 
             
                'summary' => 'row_map[:summary]',  # used as meta description
         | 
| 29 28 | 
             
                'keywords' => 'row_map[:keywords]',
         | 
| @@ -1,5 +1,5 @@ | |
| 1 1 | 
             
            class ManagedContent
         | 
| 2 | 
            -
              include  | 
| 2 | 
            +
              include LuckySneaks::StringExtensions
         | 
| 3 3 | 
             
              include Mongoid::Document
         | 
| 4 4 | 
             
              include Mongoid::Timestamps
         | 
| 5 5 | 
             
              include Tanker
         | 
| @@ -42,8 +42,7 @@ class ManagedContent | |
| 42 42 | 
             
              alias_method :definition, :content
         | 
| 43 43 | 
             
              alias_method :question, :headline
         | 
| 44 44 | 
             
              alias_method :term, :headline
         | 
| 45 | 
            -
               | 
| 46 | 
            -
              has_slug :desired_slug
         | 
| 45 | 
            +
              before_save :set_slug
         | 
| 47 46 | 
             
              mount_uploader :document, DocumentUploader, :mount_on => :document_filename
         | 
| 48 47 | 
             
              store_in :documents
         | 
| 49 48 |  | 
| @@ -60,14 +59,6 @@ class ManagedContent | |
| 60 59 | 
             
              after_save :update_tank_indexes
         | 
| 61 60 |  | 
| 62 61 | 
             
              # Validations ====================================================================================
         | 
| 63 | 
            -
              class DesiredSlugPresenceValidator < ActiveModel::EachValidator
         | 
| 64 | 
            -
                def validate_each(object, attribute, value)
         | 
| 65 | 
            -
                  unless object.desired_slug || object.slug
         | 
| 66 | 
            -
                    object.errors[attribute] << (options[:message] || ' cannot be blank.')
         | 
| 67 | 
            -
                  end
         | 
| 68 | 
            -
                end
         | 
| 69 | 
            -
              end
         | 
| 70 | 
            -
             | 
| 71 62 | 
             
              class ContentPresenceValidator < ActiveModel::EachValidator
         | 
| 72 63 | 
             
                def validate_each(object, attribute, value)
         | 
| 73 64 | 
             
                  unless object.kind == 'Multiple Pages' || object.kind == 'Document'
         | 
| @@ -89,7 +80,6 @@ class ManagedContent | |
| 89 80 | 
             
              end
         | 
| 90 81 |  | 
| 91 82 | 
             
              validates :content, :content_presence => true
         | 
| 92 | 
            -
              validates :desired_slug, :desired_slug_presence => true
         | 
| 93 83 | 
             
              validates_presence_of :headline
         | 
| 94 84 | 
             
              validates_uniqueness_of :slug
         | 
| 95 85 |  | 
| @@ -112,12 +102,17 @@ class ManagedContent | |
| 112 102 | 
             
                self.kind == 'Multiple Pages'
         | 
| 113 103 | 
             
              end
         | 
| 114 104 |  | 
| 105 | 
            +
              # @deprecated Please use {#path} instead
         | 
| 115 106 | 
             
              def humanize_path
         | 
| 107 | 
            +
                warn "[DEPRECATION] `humanize_path` is deprecated.  Please use `path` instead."
         | 
| 116 108 | 
             
                self.path
         | 
| 117 109 | 
             
              end
         | 
| 118 110 |  | 
| 111 | 
            +
              # Returns this managed-content's path.
         | 
| 112 | 
            +
              #
         | 
| 113 | 
            +
              # @return [String] the path for this managed content
         | 
| 119 114 | 
             
              def path
         | 
| 120 | 
            -
                kind == 'Document' ? self.document_url : " | 
| 115 | 
            +
                kind == 'Document' ? self.document_url : "#{self.publication.path}/#{self.slug}"
         | 
| 121 116 | 
             
              end
         | 
| 122 117 |  | 
| 123 118 | 
             
              def publish!
         | 
| @@ -151,4 +146,10 @@ class ManagedContent | |
| 151 146 | 
             
              def state=(state)
         | 
| 152 147 | 
             
                self[:state] = state.downcase
         | 
| 153 148 | 
             
              end
         | 
| 154 | 
            -
             | 
| 149 | 
            +
             | 
| 150 | 
            +
              private
         | 
| 151 | 
            +
             | 
| 152 | 
            +
              def set_slug
         | 
| 153 | 
            +
                self.slug = self.headline.to_s.to_url if self.slug.blank?
         | 
| 154 | 
            +
              end
         | 
| 155 | 
            +
            end
         | 
    
        data/app/models/publication.rb
    CHANGED
    
    | @@ -1,39 +1,33 @@ | |
| 1 1 | 
             
            class Publication
         | 
| 2 | 
            -
              include  | 
| 3 | 
            -
             | 
| 4 | 
            -
              # Mongo Config ===================================================================================
         | 
| 2 | 
            +
              include LuckySneaks::StringExtensions
         | 
| 5 3 | 
             
              include Mongoid::Document
         | 
| 6 4 | 
             
              include Mongoid::Timestamps
         | 
| 7 5 |  | 
| 6 | 
            +
              # Constants ======================================================================================
         | 
| 7 | 
            +
              CONTENT_TYPES = ['Articles', 'FAQs', 'Terms and Definitions', 'Documents']
         | 
| 8 | 
            +
             | 
| 9 | 
            +
              # Scopes =========================================================================================
         | 
| 10 | 
            +
              scope :with_articles,   :where => {:content_type => 'Articles'}
         | 
| 11 | 
            +
              scope :with_documents,  :where => {:content_type => 'Documents'}
         | 
| 12 | 
            +
              scope :with_faqs,       :where => {:content_type => 'FAQs'}
         | 
| 13 | 
            +
              scope :with_terms,      :where => {:content_type => 'Terms and Definitions'}
         | 
| 14 | 
            +
             | 
| 15 | 
            +
              # Mongo Config ===================================================================================
         | 
| 8 16 | 
             
              field :name
         | 
| 9 17 | 
             
              field :description
         | 
| 10 18 | 
             
              field :slug
         | 
| 11 19 | 
             
              field :content_type
         | 
| 12 20 | 
             
              field :rss_feed_enabled, :type => Boolean
         | 
| 13 21 | 
             
              field :pdf_enabled, :type => Boolean
         | 
| 14 | 
            -
             | 
| 15 22 | 
             
              index :name, :unique => true
         | 
| 16 23 | 
             
              index :slug, :unique => true
         | 
| 17 24 | 
             
              index :state, :unique => false
         | 
| 18 | 
            -
             | 
| 19 25 | 
             
              embeds_many :managed_contents
         | 
| 20 26 |  | 
| 21 | 
            -
              # Constants ======================================================================================
         | 
| 22 | 
            -
              CONTENT_TYPES = ['Articles', 'FAQs', 'Terms and Definitions', 'Documents']
         | 
| 23 | 
            -
             | 
| 24 | 
            -
              # Scopes ===================================================================================
         | 
| 25 | 
            -
              scope :with_articles,   :where => {:content_type => 'Articles'}
         | 
| 26 | 
            -
              scope :with_documents,  :where => {:content_type => 'Documents'}
         | 
| 27 | 
            -
              scope :with_faqs,       :where => {:content_type => 'FAQs'}
         | 
| 28 | 
            -
              scope :with_terms,      :where => {:content_type => 'Terms and Definitions'}
         | 
| 29 | 
            -
             | 
| 30 27 | 
             
              # Behavior =======================================================================================
         | 
| 31 | 
            -
               | 
| 32 | 
            -
              has_slug :desired_slug
         | 
| 28 | 
            +
              before_save :set_slug
         | 
| 33 29 | 
             
              validates_presence_of :name
         | 
| 34 | 
            -
              validates_uniqueness_of :name
         | 
| 35 30 | 
             
              validates_uniqueness_of :slug
         | 
| 36 | 
            -
              validates_presence_of :desired_slug
         | 
| 37 31 |  | 
| 38 32 | 
             
              # Class methods ==================================================================================
         | 
| 39 33 | 
             
              def self.matching_slug(slug)
         | 
| @@ -51,6 +45,13 @@ class Publication | |
| 51 45 | 
             
                label
         | 
| 52 46 | 
             
              end
         | 
| 53 47 |  | 
| 48 | 
            +
              # Returns this publication's RSS feed.
         | 
| 49 | 
            +
              #
         | 
| 50 | 
            +
              # @return [String] the RSS feed as a URL path
         | 
| 51 | 
            +
              def feed
         | 
| 52 | 
            +
                "#{self.path}/feed"
         | 
| 53 | 
            +
              end
         | 
| 54 | 
            +
             | 
| 54 55 | 
             
              def has_articles?
         | 
| 55 56 | 
             
                self.content_type == 'Articles'
         | 
| 56 57 | 
             
              end
         | 
| @@ -75,15 +76,28 @@ class Publication | |
| 75 76 | 
             
                label
         | 
| 76 77 | 
             
              end
         | 
| 77 78 |  | 
| 79 | 
            +
              # @deprecated Please use {#path} instead
         | 
| 78 80 | 
             
              def humanize_path
         | 
| 81 | 
            +
                warn "[DEPRECATION] `humanize_path` is deprecated.  Please use `path` instead."
         | 
| 79 82 | 
             
                self.path
         | 
| 80 83 | 
             
              end
         | 
| 81 84 |  | 
| 85 | 
            +
              # Returns this publication's path.
         | 
| 86 | 
            +
              #
         | 
| 87 | 
            +
              # @return [String] the path for this publication
         | 
| 82 88 | 
             
              def path
         | 
| 83 | 
            -
                "/#{self.slug}" | 
| 89 | 
            +
                "/#{self.slug}"
         | 
| 84 90 | 
             
              end
         | 
| 85 91 |  | 
| 92 | 
            +
              # @deprecated Please use {#feed} instead
         | 
| 86 93 | 
             
              def rss_feed_url
         | 
| 87 | 
            -
                " | 
| 94 | 
            +
                warn "[DEPRECATION] `rss_feed_url` is deprecated.  Please use `feed` instead."
         | 
| 95 | 
            +
                self.feed
         | 
| 96 | 
            +
              end
         | 
| 97 | 
            +
             | 
| 98 | 
            +
              private
         | 
| 99 | 
            +
             | 
| 100 | 
            +
              def set_slug
         | 
| 101 | 
            +
                self.slug = self.name.to_s.to_url if self.slug.blank?
         | 
| 88 102 | 
             
              end
         | 
| 89 103 | 
             
            end
         | 
    
        data/app/models/section.rb
    CHANGED
    
    | @@ -1,13 +1,9 @@ | |
| 1 1 | 
             
            class Section
         | 
| 2 | 
            -
             | 
| 3 | 
            -
              include EditorialLogic::Base
         | 
| 4 | 
            -
             | 
| 5 | 
            -
              # Mongo Config ===================================================================================
         | 
| 6 | 
            -
             | 
| 2 | 
            +
              include LuckySneaks::StringExtensions
         | 
| 7 3 | 
             
              include Mongoid::Document
         | 
| 8 4 | 
             
              include Mongoid::Timestamps
         | 
| 9 | 
            -
            #  include Mongoid::Versioning
         | 
| 10 5 |  | 
| 6 | 
            +
              # Mongo Config ===================================================================================
         | 
| 11 7 | 
             
              field :headline
         | 
| 12 8 | 
             
              field :slug
         | 
| 13 9 | 
             
              field :content
         | 
| @@ -16,54 +12,36 @@ class Section | |
| 16 12 | 
             
              field :related_contents, :type => Array, :default => []
         | 
| 17 13 | 
             
              index :slug, :unique => true
         | 
| 18 14 | 
             
              index :state, :unique => false
         | 
| 19 | 
            -
             | 
| 20 | 
            -
              # Constants ======================================================================================
         | 
| 21 | 
            -
             | 
| 22 | 
            -
              # Scopes ===================================================================================
         | 
| 23 | 
            -
             | 
| 24 | 
            -
              # Relationships ==================================================================================
         | 
| 25 15 | 
             
              embedded_in :managed_content, :inverse_of => :sections
         | 
| 26 16 |  | 
| 27 17 | 
             
              # Behavior =======================================================================================
         | 
| 28 | 
            -
               | 
| 29 | 
            -
               | 
| 30 | 
            -
             | 
| 31 | 
            -
              # Custom Validators ==============================================================================
         | 
| 32 | 
            -
             | 
| 33 | 
            -
              # Validations ====================================================================================
         | 
| 34 | 
            -
             | 
| 35 | 
            -
              class DesiredSlugPresenceValidator < ActiveModel::EachValidator
         | 
| 36 | 
            -
                def validate_each(object, attribute, value)
         | 
| 37 | 
            -
                  unless object.slug || object.desired_slug
         | 
| 38 | 
            -
                    object.errors[attribute] << (options[:message] || "cannot be blank.")
         | 
| 39 | 
            -
                  end
         | 
| 40 | 
            -
                end
         | 
| 41 | 
            -
              end
         | 
| 42 | 
            -
             | 
| 43 | 
            -
              validates_presence_of :content
         | 
| 44 | 
            -
              validates_presence_of :headline
         | 
| 45 | 
            -
              validates :desired_slug, :desired_slug_presence => true
         | 
| 18 | 
            +
              before_save :set_slug
         | 
| 19 | 
            +
              validates_presence_of :content, :headline
         | 
| 46 20 | 
             
              validates_uniqueness_of :slug
         | 
| 47 21 |  | 
| 48 | 
            -
              # Class methods ==================================================================================
         | 
| 49 | 
            -
             | 
| 50 22 | 
             
              # Instance methods ===============================================================================
         | 
| 51 23 |  | 
| 24 | 
            +
              # @deprecated Please use {#path} instead
         | 
| 52 25 | 
             
              def humanize_path
         | 
| 53 | 
            -
                 | 
| 54 | 
            -
             | 
| 55 | 
            -
                else
         | 
| 56 | 
            -
                  "/#{self.managed_content.publication.slug}/#{self.managed_content.slug}/#{self.slug}/".gsub('//','/')
         | 
| 57 | 
            -
                end
         | 
| 26 | 
            +
                warn "[DEPRECATION] `humanize_path` is deprecated.  Please use `path` instead."
         | 
| 27 | 
            +
                self.path
         | 
| 58 28 | 
             
              end
         | 
| 59 29 |  | 
| 60 30 | 
             
              def next_section
         | 
| 61 31 | 
             
                self.managed_content.sections.where(:position => self.position + 1).first
         | 
| 62 32 | 
             
              end
         | 
| 63 33 |  | 
| 34 | 
            +
              def path
         | 
| 35 | 
            +
                self.position == 1 ? self.managed_content.path : "#{self.managed_content.path}/#{self.slug}"
         | 
| 36 | 
            +
              end
         | 
| 37 | 
            +
             | 
| 64 38 | 
             
              def siblings
         | 
| 65 39 | 
             
                self.managed_content.sections.sort{|a,b| a.position.to_i <=> b.position.to_i}
         | 
| 66 40 | 
             
              end
         | 
| 67 41 |  | 
| 42 | 
            +
              private
         | 
| 68 43 |  | 
| 69 | 
            -
             | 
| 44 | 
            +
              def set_slug
         | 
| 45 | 
            +
                self.slug = self.headline.to_s.to_url if self.slug.blank?
         | 
| 46 | 
            +
              end
         | 
| 47 | 
            +
            end
         | 
| @@ -11,7 +11,7 @@ | |
| 11 11 | 
             
                  <%- if @managed_content.content.blank? -%>
         | 
| 12 12 | 
             
                    <%= f.select :kind, ['Single Page','Multiple Pages'], :label => 'Pages' -%>
         | 
| 13 13 | 
             
                  <%- end -%>
         | 
| 14 | 
            -
                  <%= f.text_field : | 
| 14 | 
            +
                  <%= f.text_field :slug, :label => 'Permalink', :value => @managed_content.slug, :help => "The permalink is the portion of the URL that refers directly to this article. The full URL will consist of the permalink for the publication plus what you enter below, e.g. /#{@publication.slug}/#{@managed_content.slug || 'foo'}/" -%>
         | 
| 15 15 | 
             
                  <%= f.text_area :summary, :help => 'The summary should provide a brief description of the content, up to 255 characters. The summary may be used by search engines to describe the content on this page.' -%>
         | 
| 16 16 | 
             
                </div>
         | 
| 17 17 |  | 
| @@ -2,7 +2,7 @@ | |
| 2 2 | 
             
                <%= legend_tag 'About This Document' -%>
         | 
| 3 3 | 
             
                <div class="form_column">
         | 
| 4 4 | 
             
                  <%= f.text_field :headline, :label => 'Title' -%>
         | 
| 5 | 
            -
                  <%= f.text_field : | 
| 5 | 
            +
                  <%= f.text_field :slug, :value => @managed_content.slug, :help => "The slug is the portion of the URL that refers directly to this document. The full URL will consist of the slug for the managed content section plus what you enter below, e.g. /#{@publication.slug}/#{@managed_content.slug || 'foo'}/" -%>
         | 
| 6 6 | 
             
                </div>
         | 
| 7 7 | 
             
                <div class="form_column">
         | 
| 8 8 | 
             
                  <%= f.select :state, ManagedContent::STATES.map{|s| s.capitalize} -%>
         | 
| @@ -3,7 +3,7 @@ | |
| 3 3 | 
             
                <div class="form_column">
         | 
| 4 4 | 
             
                  <%= f.text_field :headline, :label => 'Question' -%>
         | 
| 5 5 | 
             
                  <%= f.text_field :headline_short, :label => 'Shortened Headline/Question' -%>
         | 
| 6 | 
            -
                  <%= f.text_field : | 
| 6 | 
            +
                  <%= f.text_field :slug, :value => @managed_content.slug, :help => "The slug is the portion of the URL that refers directly to this article. The full URL will consist of the slug for the managed content section plus what you enter below, e.g. /#{@publication.slug}/#{@managed_content.slug || 'foo'}/" -%>
         | 
| 7 7 | 
             
                  <%= f.select :state, ManagedContent::STATES.map{|s| s} -%>
         | 
| 8 8 | 
             
                </div>
         | 
| 9 9 | 
             
                <div class="form_column">
         | 
| @@ -17,7 +17,7 @@ | |
| 17 17 | 
             
                  <%- @managed_content.each do |managed_content| -%>
         | 
| 18 18 | 
             
                    <tr class="<%= cycle('odd', 'even') -%>" id="content_<%= managed_content.id -%>">
         | 
| 19 19 | 
             
                      <td><%= link_to managed_content.headline, admin_publication_managed_content_path(@publication, managed_content) -%></td>
         | 
| 20 | 
            -
                      <td><%= managed_content. | 
| 20 | 
            +
                      <td><%= managed_content.path -%></td>
         | 
| 21 21 | 
             
                      <td><%= managed_content.state.capitalize -%></td>
         | 
| 22 22 | 
             
                      <td><%= managed_content.publication_date ? managed_content.publication_date.to_s(:concise) : '-' -%></td>
         | 
| 23 23 | 
             
                      <td><%= managed_content.revision_date ? managed_content.revision_date.to_s(:concise) : '-' -%></td>
         | 
| @@ -4,7 +4,7 @@ | |
| 4 4 | 
             
                  <%= f.text_field :headline, :label => 'Term' -%>
         | 
| 5 5 | 
             
                </div>
         | 
| 6 6 | 
             
                <div class="form_column">
         | 
| 7 | 
            -
                  <%= f.text_field : | 
| 7 | 
            +
                  <%= f.text_field :slug, :value => @managed_content.slug, :help => "The slug is the portion of the URL that refers directly to this term. The full URL will consist of the slug for the managed content section plus what you enter below, e.g. /#{@publication.slug}/#{@managed_content.slug || 'foo'}/" -%>
         | 
| 8 8 | 
             
                  <%= f.select :state, ManagedContent::STATES.map{|s| s.capitalize} -%>
         | 
| 9 9 | 
             
                </div>
         | 
| 10 10 | 
             
                <br style="clear: both;" />
         | 
| @@ -9,7 +9,7 @@ | |
| 9 9 | 
             
                  <%= faux_field 'Subheader', @managed_content.subheader %>
         | 
| 10 10 | 
             
                  <%= faux_field 'Author', @managed_content.author %>
         | 
| 11 11 | 
             
                  <%= faux_field 'Status', @managed_content.state.capitalize %>
         | 
| 12 | 
            -
                  <%= faux_field 'URL', @managed_content. | 
| 12 | 
            +
                  <%= faux_field 'URL', @managed_content.path %>
         | 
| 13 13 | 
             
                </div>
         | 
| 14 14 | 
             
                <div class="form_column">
         | 
| 15 15 | 
             
                  <%= faux_field 'Publication Date', @managed_content.publication_date %>
         | 
| @@ -16,7 +16,7 @@ | |
| 16 16 |  | 
| 17 17 | 
             
                <div class="form_column">
         | 
| 18 18 | 
             
                  <%= f.text_field :name, :help => 'The name you provide will be used in the page title for the publcation.' -%>
         | 
| 19 | 
            -
                  <%= f.text_field : | 
| 19 | 
            +
                  <%= f.text_field :slug, :label => 'URL', :value => @publication.path, :help => 'Enter the desired web address for this publcation, e.g. /press-releases/' -%>
         | 
| 20 20 | 
             
                  <%= f.select :content_type, Publication::CONTENT_TYPES, :include_blank => 'Select...' -%>
         | 
| 21 21 | 
             
                  <%= f.check_box :rss_feed_enabled, :label => "RSS Feed", :inline_label => "Enabled", :help => 'Click this checkbox to enable an RSS news feed for this publication.' -%><br />
         | 
| 22 22 | 
             
                  <%= f.check_box :pdf_enabled, :label => "Auto-Create PDFs", :inline_label => "Enabled", :help => 'Click this checkbox to automatically create PDF versions of content in this publication.' -%>
         | 
| @@ -18,7 +18,7 @@ | |
| 18 18 | 
             
              <%- @publications.each do |publication| -%>
         | 
| 19 19 | 
             
                <tr class="<%= cycle('odd', 'even') -%>">
         | 
| 20 20 | 
             
                  <td><%= link_to publication.name, admin_publication_path(publication) -%></td>
         | 
| 21 | 
            -
                  <td><%= publication. | 
| 21 | 
            +
                  <td><%= publication.path -%></td>
         | 
| 22 22 | 
             
                  <td><%= publication.description.to_s.truncate(50) -%></td>
         | 
| 23 23 | 
             
                  <td><%= publication.content_type -%></td>
         | 
| 24 24 | 
             
                  <td><%= publication.managed_contents.count -%></td>
         | 
| @@ -8,13 +8,13 @@ | |
| 8 8 | 
             
            <%= tab_body :id => 'details', :label => 'About This Publication', :display => 'block' do -%>
         | 
| 9 9 | 
             
              <div class="form_column">
         | 
| 10 10 | 
             
                <%= faux_field 'Name', @publication.name %>
         | 
| 11 | 
            -
                <%= faux_field 'URL', @publication. | 
| 11 | 
            +
                <%= faux_field 'URL', @publication.path %>
         | 
| 12 12 | 
             
                <%= faux_field 'Content Type', @publication.content_type %>
         | 
| 13 13 | 
             
              </div>
         | 
| 14 14 | 
             
              <div class="form_column">
         | 
| 15 15 | 
             
                <%= faux_field 'PDF Creation Enabled?', @publication.pdf_enabled? ? "Yes" : "No" %>
         | 
| 16 16 | 
             
                <%= faux_field 'RSS Feed Enabled?', @publication.rss_feed_enabled? ? "Yes" : "No" %>
         | 
| 17 | 
            -
                <%= faux_field 'RSS Feed URL', @publication. | 
| 17 | 
            +
                <%= faux_field 'RSS Feed URL', @publication.feed if @publication.rss_feed_enabled? %>
         | 
| 18 18 | 
             
                <%= faux_field 'Description', @publication.description %>
         | 
| 19 19 | 
             
              </div>
         | 
| 20 20 | 
             
              <br style="clear: both;" />
         | 
| @@ -17,7 +17,7 @@ | |
| 17 17 | 
             
                <%= legend_tag 'About This Article Section' -%>
         | 
| 18 18 | 
             
                <div class="form_column">
         | 
| 19 19 | 
             
                  <%= f.text_field :headline -%>
         | 
| 20 | 
            -
                  <%= f.text_field : | 
| 20 | 
            +
                  <%= f.text_field :slug, :value => @section.slug, :help => "The slug is the portion of the URL that refers directly to this article. The full URL will consist of the slug for the managed content section plus what you enter below, e.g. /#{@publication.slug}/#{@content.slug}/#{@section.slug || 'foo'}/" -%>
         | 
| 21 21 | 
             
                </div>
         | 
| 22 22 | 
             
                <div class="form_column">
         | 
| 23 23 | 
             
                  <%= f.text_area :summary, :help => 'The summary should provide a brief description of the content, up to 255 characters. The summary may be used by search engines to describe the content on this page.' -%>
         | 
| @@ -17,7 +17,7 @@ | |
| 17 17 | 
             
                <%- @sections.each do |section| -%>
         | 
| 18 18 | 
             
                  <tr class="<%= cycle('odd', 'even') -%>" id="section_<%= section.id -%>">
         | 
| 19 19 | 
             
                    <td><%= link_to section.headline, admin_publication_managed_content_section_path(@publication, @managed_content, section) -%></td>
         | 
| 20 | 
            -
                    <td><%= section. | 
| 20 | 
            +
                    <td><%= section.path -%></td>
         | 
| 21 21 | 
             
                    <td><%= strip_tags(section.content.to_s).truncate(75) -%></td>
         | 
| 22 22 | 
             
                    <td class="crud_links">
         | 
| 23 23 | 
             
                      <%= link_to image_tag('/images/icons/view.png'), admin_publication_managed_content_section_path(@publication, @managed_content, section) -%>
         | 
| @@ -18,7 +18,7 @@ | |
| 18 18 | 
             
              <h3>Related <%= @content.publication.content_type -%></h3>
         | 
| 19 19 | 
             
              <ul class="related_content_list">
         | 
| 20 20 | 
             
              <%- @content.related_content.each do |related| -%>
         | 
| 21 | 
            -
                <li><%= link_to related.headline, related. | 
| 21 | 
            +
                <li><%= link_to related.headline, related.path -%></li>
         | 
| 22 22 | 
             
              <%- end -%>
         | 
| 23 23 | 
             
              </ul>
         | 
| 24 24 | 
             
            <%- end -%>
         | 
| @@ -30,5 +30,5 @@ | |
| 30 30 | 
             
              <p>Use or reference to this content on the Internet must be accompanied by a link to the page you cite.</p>
         | 
| 31 31 | 
             
            <%- end -%>
         | 
| 32 32 |  | 
| 33 | 
            -
            <%= link_to 'Download PDF', "#{@content. | 
| 34 | 
            -
            <%= link_to 'Back', @content.publication. | 
| 33 | 
            +
            <%= link_to 'Download PDF', "#{@content.path.gsub(/\/$/,'.pdf')}", :class => :button if @content.publication.pdf_enabled -%>
         | 
| 34 | 
            +
            <%= link_to 'Back', @content.publication.path, :class => :button -%>
         | 
| @@ -2,7 +2,7 @@ | |
| 2 2 | 
             
                <%- @contents.in_groups(4, false).each do |group| -%>
         | 
| 3 3 | 
             
                  <ul class="terms_list">
         | 
| 4 4 | 
             
                    <%- group.each do |content| -%>
         | 
| 5 | 
            -
                      <li><%= link_to content.headline, content. | 
| 5 | 
            +
                      <li><%= link_to content.headline, content.path -%></li>
         | 
| 6 6 | 
             
                    <%- end -%>
         | 
| 7 7 | 
             
                  </ul>
         | 
| 8 8 | 
             
                <%- end -%>
         | 
| @@ -11,8 +11,8 @@ xml.rss :version => '2.0', :'xmlns:atom' => 'http://www.w3.org/2005/Atom' do | |
| 11 11 | 
             
                    xml.title article.headline
         | 
| 12 12 | 
             
                    xml.description article.summary
         | 
| 13 13 | 
             
                    xml.pubDate article.publication_date.strftime("%a, %d %b %Y %H:%M:%S %z")
         | 
| 14 | 
            -
                    xml.link "#{request.url.gsub(@publication. | 
| 15 | 
            -
                    xml.guid "#{request.url.gsub(@publication. | 
| 14 | 
            +
                    xml.link "#{request.url.gsub(@publication.feed, '')}#{article.path}"
         | 
| 15 | 
            +
                    xml.guid "#{request.url.gsub(@publication.feed, '')}#{article.path}"
         | 
| 16 16 | 
             
                  end
         | 
| 17 17 | 
             
                end
         | 
| 18 18 | 
             
              end
         | 
| @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            <%- set_title @publication.name -%>
         | 
| 2 2 | 
             
            <%- meta_description @publication.description -%>
         | 
| 3 | 
            -
            <%= auto_discovery_link_tag(:rss, @publication. | 
| 3 | 
            +
            <%= auto_discovery_link_tag(:rss, @publication.feed, {:title => @publication.name}) if @publication.rss_feed_enabled? -%>
         | 
| 4 4 |  | 
| 5 5 | 
             
            <p>
         | 
| 6 6 | 
             
              <%= @publication.description.to_s.html_safe -%>
         | 
| @@ -9,4 +9,4 @@ | |
| 9 9 | 
             
            <h3>Referring to This Page</h3>
         | 
| 10 10 | 
             
            <p>Use or reference to this content on the Internet must be accompanied by a link to the page you cite.</p>
         | 
| 11 11 |  | 
| 12 | 
            -
            <%= link_to 'Back', @content.publication. | 
| 12 | 
            +
            <%= link_to 'Back', @content.publication.path, :class => :button -%>
         | 
    
        data/editorial_logic.gemspec
    CHANGED
    
    | @@ -5,11 +5,11 @@ | |
| 5 5 |  | 
| 6 6 | 
             
            Gem::Specification.new do |s|
         | 
| 7 7 | 
             
              s.name = "editorial_logic"
         | 
| 8 | 
            -
              s.version = "1. | 
| 8 | 
            +
              s.version = "1.4.0"
         | 
| 9 9 |  | 
| 10 10 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 11 11 | 
             
              s.authors = ["Bantik"]
         | 
| 12 | 
            -
              s.date = "2011- | 
| 12 | 
            +
              s.date = "2011-10-04"
         | 
| 13 13 | 
             
              s.description = "An engine for enabling managed content, including articles, blogs, FAQs and glossaries."
         | 
| 14 14 | 
             
              s.email = "corey@seologic.com"
         | 
| 15 15 | 
             
              s.files = [
         | 
| @@ -97,7 +97,6 @@ Gem::Specification.new do |s| | |
| 97 97 | 
             
                "features/support/selectors.rb",
         | 
| 98 98 | 
             
                "init.rb",
         | 
| 99 99 | 
             
                "lib/editorial_logic.rb",
         | 
| 100 | 
            -
                "lib/editorial_logic/engine.rb",
         | 
| 101 100 | 
             
                "lib/editorial_logic/railtie.rb",
         | 
| 102 101 | 
             
                "lib/tasks/cucumber.rake",
         | 
| 103 102 | 
             
                "lib/tasks/rcov.rake",
         | 
| @@ -796,7 +795,6 @@ Gem::Specification.new do |s| | |
| 796 795 | 
             
                "spec/controllers/admin/publications_controller_spec.rb",
         | 
| 797 796 | 
             
                "spec/controllers/managed_contents_controller_spec.rb",
         | 
| 798 797 | 
             
                "spec/controllers/publications_controller_spec.rb",
         | 
| 799 | 
            -
                "spec/editorial_logic_spec.rb",
         | 
| 800 798 | 
             
                "spec/models/managed_content_spec.rb",
         | 
| 801 799 | 
             
                "spec/models/publication_spec.rb",
         | 
| 802 800 | 
             
                "spec/models/section_spec.rb",
         | 
| @@ -820,6 +818,7 @@ Gem::Specification.new do |s| | |
| 820 818 | 
             
                  s.add_runtime_dependency(%q<mongoid>, [">= 0"])
         | 
| 821 819 | 
             
                  s.add_runtime_dependency(%q<rails>, [">= 0"])
         | 
| 822 820 | 
             
                  s.add_runtime_dependency(%q<scaffold_logic>, [">= 0"])
         | 
| 821 | 
            +
                  s.add_runtime_dependency(%q<stringex>, [">= 0"])
         | 
| 823 822 | 
             
                  s.add_runtime_dependency(%q<SystemTimer>, [">= 0"])
         | 
| 824 823 | 
             
                  s.add_runtime_dependency(%q<tanker>, [">= 0"])
         | 
| 825 824 | 
             
                  s.add_development_dependency(%q<jeweler>, [">= 0"])
         | 
| @@ -832,6 +831,7 @@ Gem::Specification.new do |s| | |
| 832 831 | 
             
                  s.add_dependency(%q<mongoid>, [">= 0"])
         | 
| 833 832 | 
             
                  s.add_dependency(%q<rails>, [">= 0"])
         | 
| 834 833 | 
             
                  s.add_dependency(%q<scaffold_logic>, [">= 0"])
         | 
| 834 | 
            +
                  s.add_dependency(%q<stringex>, [">= 0"])
         | 
| 835 835 | 
             
                  s.add_dependency(%q<SystemTimer>, [">= 0"])
         | 
| 836 836 | 
             
                  s.add_dependency(%q<tanker>, [">= 0"])
         | 
| 837 837 | 
             
                  s.add_dependency(%q<jeweler>, [">= 0"])
         | 
| @@ -845,6 +845,7 @@ Gem::Specification.new do |s| | |
| 845 845 | 
             
                s.add_dependency(%q<mongoid>, [">= 0"])
         | 
| 846 846 | 
             
                s.add_dependency(%q<rails>, [">= 0"])
         | 
| 847 847 | 
             
                s.add_dependency(%q<scaffold_logic>, [">= 0"])
         | 
| 848 | 
            +
                s.add_dependency(%q<stringex>, [">= 0"])
         | 
| 848 849 | 
             
                s.add_dependency(%q<SystemTimer>, [">= 0"])
         | 
| 849 850 | 
             
                s.add_dependency(%q<tanker>, [">= 0"])
         | 
| 850 851 | 
             
                s.add_dependency(%q<jeweler>, [">= 0"])
         | 
| @@ -11,7 +11,6 @@ Feature: Manage Articles Content | |
| 11 11 | 
             
                And I follow "Add Content"
         | 
| 12 12 | 
             
                And I fill in "managed_content_headline" with "My Great Article"
         | 
| 13 13 | 
             
                And I fill in "managed_content_content_editor" with "Here it is."
         | 
| 14 | 
            -
                And I fill in "managed_content_desired_slug" with "my-great-article"
         | 
| 15 14 | 
             
                And I press "Save"
         | 
| 16 15 | 
             
                Then I should see "Publication Details"
         | 
| 17 16 | 
             
                And I should see "My Great Article"
         | 
| @@ -100,7 +99,6 @@ Feature: Manage Articles Content | |
| 100 99 | 
             
                Then I should see "Article Sections"
         | 
| 101 100 | 
             
                And I follow "Add a Section"
         | 
| 102 101 | 
             
                And I fill in "section_headline" with "Introduction"
         | 
| 103 | 
            -
                And I fill in "section_desired_slug" with "my-introduction"
         | 
| 104 102 | 
             
                And I fill in "section_content_editor" with "This is my intro."
         | 
| 105 103 | 
             
                And I press "Save"
         | 
| 106 104 | 
             
                Then I should see "Article Details"
         | 
| @@ -117,7 +115,6 @@ Feature: Manage Articles Content | |
| 117 115 | 
             
                Then I should see "Article Sections"
         | 
| 118 116 | 
             
                And I follow "Add a Section"
         | 
| 119 117 | 
             
                And I fill in "section_headline" with "Introduction"
         | 
| 120 | 
            -
                And I fill in "section_desired_slug" with "my-introduction"
         | 
| 121 118 | 
             
                And I fill in "section_content_editor" with "This is my intro."
         | 
| 122 119 | 
             
                And I press "Save"
         | 
| 123 120 | 
             
                Then I should see "Article Details"
         | 
| @@ -10,7 +10,6 @@ Feature: Manage FAQ Content | |
| 10 10 | 
             
                And I follow "Add Content"
         | 
| 11 11 | 
             
                And I fill in "managed_content_headline" with "What is the answer?"
         | 
| 12 12 | 
             
                And I fill in "managed_content_content_editor" with "Here it is."
         | 
| 13 | 
            -
                And I fill in "managed_content_desired_slug" with "something"
         | 
| 14 13 | 
             
                And I press "Save"
         | 
| 15 14 | 
             
                Then I should see "Publication Details"
         | 
| 16 15 | 
             
                And I should see "What is the answer?"
         | 
| @@ -21,7 +20,7 @@ Feature: Manage FAQ Content | |
| 21 20 | 
             
                Given I have a publication named "FAQ" with "FAQs" content
         | 
| 22 21 | 
             
                Given the publication "FAQ" has the following contents
         | 
| 23 22 | 
             
                  | headline | content | slug |
         | 
| 24 | 
            -
                  | Foo      | Stuff   | foo | 
| 23 | 
            +
                  | Foo      | Stuff   | foo  |
         | 
| 25 24 | 
             
                When I visit "FAQ"
         | 
| 26 25 | 
             
                Then I should see "Foo"
         | 
| 27 26 |  | 
| @@ -30,7 +29,7 @@ Feature: Manage FAQ Content | |
| 30 29 | 
             
                Given I have a publication named "FAQ" with "FAQs" content
         | 
| 31 30 | 
             
                Given the publication "FAQ" has the following contents
         | 
| 32 31 | 
             
                  | headline | content | slug |
         | 
| 33 | 
            -
                  | Foo      | Stuff   | foo | 
| 32 | 
            +
                  | Foo      | Stuff   | foo  |
         | 
| 34 33 | 
             
                When I visit "FAQ"
         | 
| 35 34 | 
             
                And I follow "View" within "[@class='crud_links']"
         | 
| 36 35 | 
             
                Then I should see "FAQ Details"
         | 
| @@ -41,7 +40,7 @@ Feature: Manage FAQ Content | |
| 41 40 | 
             
                Given I have a publication named "FAQ" with "FAQs" content
         | 
| 42 41 | 
             
                Given the publication "FAQ" has the following contents
         | 
| 43 42 | 
             
                  | headline | content | slug |
         | 
| 44 | 
            -
                  | Foo      | Stuff   | foo | 
| 43 | 
            +
                  | Foo      | Stuff   | foo  |
         | 
| 45 44 | 
             
                When I visit "FAQ"
         | 
| 46 45 | 
             
                And I follow "Edit" within "[@class='crud_links']"
         | 
| 47 46 | 
             
                And I fill in "managed_content_headline" with "What was the answer?"
         | 
| @@ -54,8 +53,7 @@ Feature: Manage FAQ Content | |
| 54 53 | 
             
                Given I have a publication named "FAQ" with "FAQs" content
         | 
| 55 54 | 
             
                Given the publication "FAQ" has the following contents
         | 
| 56 55 | 
             
                  | headline | content | slug |
         | 
| 57 | 
            -
                  | Foo      | Stuff   | foo | 
| 56 | 
            +
                  | Foo      | Stuff   | foo  |
         | 
| 58 57 | 
             
                When I visit "FAQ"
         | 
| 59 58 | 
             
                And I press "" within "[@class='crud_links']"
         | 
| 60 | 
            -
                Then I should not see "Foo"
         | 
| 61 | 
            -
             | 
| 59 | 
            +
                Then I should not see "Foo"
         | 
| @@ -10,7 +10,6 @@ Feature: Manage Glossary Content | |
| 10 10 | 
             
                And I follow "Add Content"
         | 
| 11 11 | 
             
                And I fill in "managed_content_headline" with "Foo"
         | 
| 12 12 | 
             
                And I fill in "managed_content_content_editor" with "Something arbitrary."
         | 
| 13 | 
            -
                And I fill in "managed_content_desired_slug" with "something"
         | 
| 14 13 | 
             
                And I press "Save"
         | 
| 15 14 | 
             
                Then I should see "Publication Details"
         | 
| 16 15 | 
             
                And I should see "Foo"
         | 
| @@ -16,7 +16,6 @@ Feature: Manage Publications | |
| 16 16 | 
             
                And I am on the admin_publications page
         | 
| 17 17 | 
             
                When I follow "New Publication"
         | 
| 18 18 | 
             
                And I fill in "publication_name" with "Frequently Asked Questions"
         | 
| 19 | 
            -
                And I fill in "publication_desired_slug" with "faqs"
         | 
| 20 19 | 
             
                And I select "FAQs" from "publication_content_type"
         | 
| 21 20 | 
             
                And I press "Save"
         | 
| 22 21 | 
             
                Then I should see "Frequently Asked Questions"
         | 
| @@ -1,15 +1,15 @@ | |
| 1 1 | 
             
            Given /^I have publications named (.+)$/ do |names|
         | 
| 2 2 | 
             
              names.split(', ').each do |name|
         | 
| 3 | 
            -
                 | 
| 3 | 
            +
                Publication.make :name => name, :content_type => 'Articles'
         | 
| 4 4 | 
             
              end
         | 
| 5 5 | 
             
            end
         | 
| 6 6 |  | 
| 7 7 | 
             
            Given /^I have a publication named "(.+)" with "(.+)" content/ do |name, content|
         | 
| 8 | 
            -
              Publication.make | 
| 8 | 
            +
              Publication.make :name => name, :content_type => content
         | 
| 9 9 | 
             
            end
         | 
| 10 10 |  | 
| 11 11 | 
             
            Given /^the publication "(.+)" has an RSS feed$/ do |name|
         | 
| 12 | 
            -
              Publication.where(:name =>  | 
| 12 | 
            +
              Publication.where(:name => name).first.update_attributes(:rss_feed_enabled => true)
         | 
| 13 13 | 
             
            end
         | 
| 14 14 |  | 
| 15 15 | 
             
            Given /^I have no publications$/ do
         | 
| @@ -23,5 +23,4 @@ end | |
| 23 23 | 
             
            When /^I visit "(.+)"$/ do |publication|
         | 
| 24 24 | 
             
              publication = Publication.where(:name => publication).first
         | 
| 25 25 | 
             
              visit admin_publication_url(publication)
         | 
| 26 | 
            -
            end
         | 
| 27 | 
            -
             | 
| 26 | 
            +
            end
         | 
    
        data/lib/editorial_logic.rb
    CHANGED
    
    | @@ -1,52 +1,10 @@ | |
| 1 1 | 
             
            module EditorialLogic
         | 
| 2 2 | 
             
              require 'editorial_logic/railtie.rb' if defined?(Rails)
         | 
| 3 | 
            -
              require 'editorial_logic/engine.rb' if defined?(Rails)
         | 
| 4 3 |  | 
| 5 | 
            -
               | 
| 6 | 
            -
                yield self
         | 
| 4 | 
            +
              class Engine < Rails::Engine
         | 
| 7 5 | 
             
              end
         | 
| 8 6 |  | 
| 9 | 
            -
              def self. | 
| 10 | 
            -
             | 
| 11 | 
            -
                   if key =~ /^#{Regexp.escape(name.to_s)}\((\d+)(\w)\)$/
         | 
| 12 | 
            -
                     [$1.to_i, value.send("to_#$2")]
         | 
| 13 | 
            -
                   end
         | 
| 14 | 
            -
                 end.compact.sort_by(&:first).map(&:last)
         | 
| 15 | 
            -
                 Time.zone.local(*attrs) unless attrs.empty?
         | 
| 16 | 
            -
              end
         | 
| 17 | 
            -
             | 
| 18 | 
            -
              module Base
         | 
| 19 | 
            -
                @@sluggable_attribute = nil
         | 
| 20 | 
            -
             | 
| 21 | 
            -
                module ClassMethods
         | 
| 22 | 
            -
                  def has_slug(attr)
         | 
| 23 | 
            -
                    self.send(:set_callback, :save, :before, Proc.new{|doc| doc.make_slug})
         | 
| 24 | 
            -
                  end
         | 
| 25 | 
            -
                end
         | 
| 26 | 
            -
             | 
| 27 | 
            -
                def self.included(base)
         | 
| 28 | 
            -
                  base.extend(ClassMethods)
         | 
| 29 | 
            -
                end
         | 
| 30 | 
            -
             | 
| 31 | 
            -
                def make_slug
         | 
| 32 | 
            -
                  if self.desired_slug && ! self.desired_slug.blank?
         | 
| 33 | 
            -
                    text = self.desired_slug
         | 
| 34 | 
            -
                  elsif self.slug
         | 
| 35 | 
            -
                    text = self.slug
         | 
| 36 | 
            -
                  elsif self.respond_to?(:headline)
         | 
| 37 | 
            -
                    text = self.headline.to_s.downcase
         | 
| 38 | 
            -
                  elsif self.respond_to?(:name)
         | 
| 39 | 
            -
                    text = self.name.to_s.downcase
         | 
| 40 | 
            -
                  end
         | 
| 41 | 
            -
             | 
| 42 | 
            -
                  # Translation borrowed from permalink_fu
         | 
| 43 | 
            -
                  text = text.to_s
         | 
| 44 | 
            -
                  text.gsub!(/[^\x00-\x7F]+/, '-') # Remove anything non-ASCII entirely (e.g. diacritics).
         | 
| 45 | 
            -
                  text.gsub!(/[^\w_ \/\-]+/i,   '-') # Remove unwanted chars.
         | 
| 46 | 
            -
                  text.gsub!(/[ \-]+/i,      '-') # No more than one of the separator in a row.
         | 
| 47 | 
            -
                  text.gsub!(/^\-|\-$/i,      '') # Remove leading/trailing separator.
         | 
| 48 | 
            -
                  text.downcase!
         | 
| 49 | 
            -
                  self.slug = text
         | 
| 50 | 
            -
                end
         | 
| 7 | 
            +
              def self.setup
         | 
| 8 | 
            +
                yield self
         | 
| 51 9 | 
             
              end
         | 
| 52 10 | 
             
            end
         | 
    
        data/spec/blueprints.rb
    CHANGED
    
    
| @@ -3,8 +3,8 @@ require File.dirname(__FILE__) + '/../../spec_helper' | |
| 3 3 | 
             
            describe Admin::ManagedContentsController do
         | 
| 4 4 | 
             
              before :all do
         | 
| 5 5 | 
             
                Publication.destroy_all
         | 
| 6 | 
            -
                @publication = Publication.create | 
| 7 | 
            -
                @content = @publication.managed_contents.create | 
| 6 | 
            +
                @publication = Publication.create :name => 'FAQ'
         | 
| 7 | 
            +
                @content = @publication.managed_contents.create :headline => 'foo', :content => 'bar'
         | 
| 8 8 | 
             
              end
         | 
| 9 9 |  | 
| 10 10 | 
             
              it "show action should render show template" do
         | 
| @@ -47,9 +47,9 @@ describe Admin::ManagedContentsController do | |
| 47 47 | 
             
              end
         | 
| 48 48 |  | 
| 49 49 | 
             
              it "destroy action should destroy model and redirect to index action" do
         | 
| 50 | 
            -
                @content_to_delete = @publication.managed_contents.create | 
| 50 | 
            +
                @content_to_delete = @publication.managed_contents.create :headline => 'foo', :content => 'bar'
         | 
| 51 51 | 
             
                delete :destroy, :id => @content_to_delete.id, :publication_id => @publication.id
         | 
| 52 52 | 
             
                response.should redirect_to(admin_publication_url(@publication))
         | 
| 53 53 | 
             
                Publication.find(@publication.id).managed_contents.include?(@content_to_delete).should be_false
         | 
| 54 54 | 
             
              end
         | 
| 55 | 
            -
            end
         | 
| 55 | 
            +
            end
         | 
| @@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../../spec_helper' | |
| 3 3 | 
             
            describe Admin::PublicationsController do
         | 
| 4 4 | 
             
              before :all do
         | 
| 5 5 | 
             
                Publication.destroy_all
         | 
| 6 | 
            -
                @publication = Publication.create | 
| 6 | 
            +
                @publication = Publication.create :name => 'FAQ'
         | 
| 7 7 | 
             
              end
         | 
| 8 8 |  | 
| 9 9 | 
             
              it "index action should render index template" do
         | 
| @@ -29,7 +29,6 @@ describe Admin::PublicationsController do | |
| 29 29 |  | 
| 30 30 | 
             
              it "create action should redirect when model is valid" do
         | 
| 31 31 | 
             
                Publication.any_instance.stubs(:valid?).returns(true)
         | 
| 32 | 
            -
                Publication.any_instance.stubs(:desired_slug).returns('bar')
         | 
| 33 32 | 
             
                post :create
         | 
| 34 33 | 
             
                response.should redirect_to(admin_publication_url(assigns[:publication]))
         | 
| 35 34 | 
             
              end
         | 
| @@ -52,9 +51,9 @@ describe Admin::PublicationsController do | |
| 52 51 | 
             
              end
         | 
| 53 52 |  | 
| 54 53 | 
             
              it "destroy action should destroy model and redirect to index action" do
         | 
| 55 | 
            -
                @publication_to_delete = Publication.create | 
| 54 | 
            +
                @publication_to_delete = Publication.create :name => 'iFAQs'
         | 
| 56 55 | 
             
                delete :destroy, :id => @publication_to_delete.id
         | 
| 57 56 | 
             
                response.should redirect_to(admin_publications_url)
         | 
| 58 57 | 
             
                Publication.where(:id => @publication_to_delete.id).should be_empty
         | 
| 59 58 | 
             
              end
         | 
| 60 | 
            -
            end
         | 
| 59 | 
            +
            end
         | 
| @@ -3,8 +3,8 @@ require File.dirname(__FILE__) + '/../spec_helper' | |
| 3 3 | 
             
            describe ManagedContentsController do
         | 
| 4 4 | 
             
              before :all do
         | 
| 5 5 | 
             
                Publication.destroy_all
         | 
| 6 | 
            -
                @publication = Publication.create | 
| 7 | 
            -
                @content = @publication.managed_contents.create | 
| 6 | 
            +
                @publication = Publication.create :name => 'FAQ'
         | 
| 7 | 
            +
                @content = @publication.managed_contents.create :headline => 'foo', :content => 'bar'
         | 
| 8 8 | 
             
              end
         | 
| 9 9 |  | 
| 10 10 | 
             
              it "show action should render show template" do
         | 
| @@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../spec_helper' | |
| 3 3 | 
             
            describe PublicationsController do
         | 
| 4 4 | 
             
              before :all do
         | 
| 5 5 | 
             
                Publication.destroy_all
         | 
| 6 | 
            -
                @publication = Publication.create | 
| 6 | 
            +
                @publication = Publication.create :name => 'FAQ'
         | 
| 7 7 | 
             
              end
         | 
| 8 8 |  | 
| 9 9 | 
             
              it "show action should render show template" do
         | 
| @@ -4,11 +4,11 @@ describe ManagedContent do | |
| 4 4 |  | 
| 5 5 | 
             
              before :all do
         | 
| 6 6 | 
             
                Publication.destroy_all
         | 
| 7 | 
            -
                @publication = Publication.create | 
| 8 | 
            -
                @content = @publication.managed_contents.create | 
| 7 | 
            +
                @publication = Publication.create :name => 'FAQ'
         | 
| 8 | 
            +
                @content = @publication.managed_contents.create :headline => 'foo', :content => 'bar'
         | 
| 9 9 |  | 
| 10 10 | 
             
                # Pub with PDF documents
         | 
| 11 | 
            -
                @pdfs = Publication.create | 
| 11 | 
            +
                @pdfs = Publication.create :name => 'Fact Sheets', :content_type => 'Documents'
         | 
| 12 12 | 
             
              end
         | 
| 13 13 |  | 
| 14 14 | 
             
              it 'requires content for single-page articles' do
         | 
| @@ -24,13 +24,13 @@ describe ManagedContent do | |
| 24 24 | 
             
              end
         | 
| 25 25 |  | 
| 26 26 | 
             
              it 'returns an SEO-friendly URL' do
         | 
| 27 | 
            -
                @content. | 
| 27 | 
            +
                @content.path.should == '/faq/foo'
         | 
| 28 28 | 
             
              end
         | 
| 29 29 |  | 
| 30 30 | 
             
              it 'returns the direct URL for an attached document' do
         | 
| 31 | 
            -
                @document = @pdfs.managed_contents.create | 
| 31 | 
            +
                @document = @pdfs.managed_contents.create :headline => 'Fact Sheet the First', :kind => 'Document'
         | 
| 32 32 | 
             
                @document.stubs(:document_url).returns('/first.pdf')
         | 
| 33 | 
            -
                @document. | 
| 33 | 
            +
                @document.path.should == '/first.pdf'
         | 
| 34 34 | 
             
              end
         | 
| 35 35 |  | 
| 36 36 | 
             
              it 'publishes, setting its publication date' do
         | 
| @@ -47,11 +47,10 @@ describe ManagedContent do | |
| 47 47 |  | 
| 48 48 | 
             
              describe 'slug' do
         | 
| 49 49 |  | 
| 50 | 
            -
                it 'is generated based on the  | 
| 50 | 
            +
                it 'is generated based on the headline' do
         | 
| 51 51 | 
             
                  content = @publication.managed_contents.create(
         | 
| 52 | 
            -
                    :headline     => ' | 
| 53 | 
            -
                    :content      => 'bar' | 
| 54 | 
            -
                    :desired_slug => 'flexible outings'
         | 
| 52 | 
            +
                    :headline     => 'Flexible Outings',
         | 
| 53 | 
            +
                    :content      => 'bar'
         | 
| 55 54 | 
             
                  )
         | 
| 56 55 | 
             
                  content.slug.should == 'flexible-outings'
         | 
| 57 56 | 
             
                end
         | 
| @@ -59,8 +58,7 @@ describe ManagedContent do | |
| 59 58 | 
             
                it 'truncates extra hyphens' do
         | 
| 60 59 | 
             
                  content = @publication.managed_contents.create(
         | 
| 61 60 | 
             
                    :headline     => 'Mario!! Brothers',
         | 
| 62 | 
            -
                    :content      => 'bar' | 
| 63 | 
            -
                    :desired_slug => 'mario!! brothers'
         | 
| 61 | 
            +
                    :content      => 'bar'
         | 
| 64 62 | 
             
                  )
         | 
| 65 63 | 
             
                  content.slug.should == 'mario-brothers'
         | 
| 66 64 | 
             
                end
         | 
| @@ -68,8 +66,7 @@ describe ManagedContent do | |
| 68 66 | 
             
                it 'truncates trailing hyphens' do
         | 
| 69 67 | 
             
                  content = @publication.managed_contents.create(
         | 
| 70 68 | 
             
                    :headline     => 'Blues Brothers?',
         | 
| 71 | 
            -
                    :content      => 'bar' | 
| 72 | 
            -
                    :desired_slug => 'blues brothers?'
         | 
| 69 | 
            +
                    :content      => 'bar'
         | 
| 73 70 | 
             
                  )
         | 
| 74 71 | 
             
                  content.slug.should == 'blues-brothers'
         | 
| 75 72 | 
             
                end
         | 
| @@ -51,41 +51,25 @@ describe Publication do | |
| 51 51 | 
             
                end
         | 
| 52 52 | 
             
              end
         | 
| 53 53 |  | 
| 54 | 
            -
              describe ' | 
| 54 | 
            +
              describe 'path' do
         | 
| 55 55 | 
             
                it 'returns an SEO-friendly URL' do
         | 
| 56 | 
            -
                   | 
| 57 | 
            -
                    :name         => 'FAQs',
         | 
| 58 | 
            -
                    :desired_slug => 'somewhat-dense'
         | 
| 59 | 
            -
                  )
         | 
| 60 | 
            -
                  publication.make_slug
         | 
| 61 | 
            -
                  publication.humanize_path.should == '/somewhat-dense'
         | 
| 62 | 
            -
                end
         | 
| 63 | 
            -
             | 
| 64 | 
            -
                it 'is generated based on the desired_slug' do
         | 
| 65 | 
            -
                  publication = Publication.new(
         | 
| 66 | 
            -
                    :name         => 'FAQs',
         | 
| 67 | 
            -
                    :desired_slug => 'unfortunate beginnings'
         | 
| 68 | 
            -
                  )
         | 
| 69 | 
            -
                  publication.make_slug.should == 'unfortunate-beginnings'
         | 
| 56 | 
            +
                  Publication.create(:name => 'FAQ').path.should == '/faq'
         | 
| 70 57 | 
             
                end
         | 
| 71 58 |  | 
| 72 59 | 
             
                it 'is generated based on the name' do
         | 
| 73 | 
            -
                   | 
| 74 | 
            -
                  publication.make_slug.should == 'flood-brothers'
         | 
| 60 | 
            +
                  Publication.create(:name => 'Flood Brothers').path.should == '/flood-brothers'
         | 
| 75 61 | 
             
                end
         | 
| 76 62 |  | 
| 77 63 | 
             
                it 'truncates extra hyphens' do
         | 
| 78 | 
            -
                   | 
| 79 | 
            -
                  publication.make_slug.should == 'mario-brothers'
         | 
| 64 | 
            +
                  Publication.create(:name => 'Mario!! Brothers').path.should == '/mario-brothers'
         | 
| 80 65 | 
             
                end
         | 
| 81 66 |  | 
| 82 67 | 
             
                it 'truncates trailing hyphens' do
         | 
| 83 | 
            -
                   | 
| 84 | 
            -
                  publication.make_slug.should == 'blues-brothers'
         | 
| 68 | 
            +
                  Publication.create(:name => 'Blues Brothers?').path.should == '/blues-brothers'
         | 
| 85 69 | 
             
                end
         | 
| 86 70 | 
             
              end
         | 
| 87 71 |  | 
| 88 72 | 
             
              it 'returns its feed URL' do
         | 
| 89 | 
            -
                Publication.create(:name => 'Blues News' | 
| 73 | 
            +
                Publication.create(:name => 'Blues News').feed.should == '/blues-news/feed'
         | 
| 90 74 | 
             
              end
         | 
| 91 75 | 
             
            end
         | 
    
        data/spec/models/section_spec.rb
    CHANGED
    
    | @@ -1,27 +1,23 @@ | |
| 1 1 | 
             
            require File.dirname(__FILE__) + '/../spec_helper'
         | 
| 2 2 |  | 
| 3 3 | 
             
            describe Section do
         | 
| 4 | 
            -
             | 
| 5 | 
            -
              it "should be valid with minimum values" do
         | 
| 4 | 
            +
              it 'should be valid with minimum values' do
         | 
| 6 5 | 
             
                Section.new(
         | 
| 7 6 | 
             
                  :headline => 'References',
         | 
| 8 | 
            -
                  :desired_slug => 'references',
         | 
| 9 7 | 
             
                  :content => 'Foo'
         | 
| 10 8 | 
             
                ).should be_valid
         | 
| 11 9 | 
             
              end
         | 
| 12 10 |  | 
| 13 11 | 
             
              describe 'handles siblings and urls' do
         | 
| 14 | 
            -
             | 
| 15 12 | 
             
                before :all do
         | 
| 16 13 | 
             
                  Publication.destroy_all
         | 
| 17 14 | 
             
                  @publication = Publication.new(
         | 
| 18 | 
            -
                    :name         => 'Scholarly Articles' | 
| 19 | 
            -
                    :desired_slug => 'articles'
         | 
| 15 | 
            +
                    :name         => 'Scholarly Articles'
         | 
| 20 16 | 
             
                  )
         | 
| 21 | 
            -
                  @article = @publication.managed_contents.create(:headline => 'Article the First', : | 
| 22 | 
            -
                  @intro = @article.sections.create(:headline => 'Intro', : | 
| 23 | 
            -
                  @meat = @article.sections.create(:headline => 'Body', : | 
| 24 | 
            -
                  @refs = @article.sections.create(:headline => 'References', : | 
| 17 | 
            +
                  @article = @publication.managed_contents.create(:headline => 'Article the First', :kind => 'Multiple Pages')
         | 
| 18 | 
            +
                  @intro = @article.sections.create(:headline => 'Intro', :content => 'Intro', :position => 1)
         | 
| 19 | 
            +
                  @meat = @article.sections.create(:headline => 'Body', :content => 'Body', :position => 2)
         | 
| 20 | 
            +
                  @refs = @article.sections.create(:headline => 'References', :content => 'References', :position => 3)
         | 
| 25 21 | 
             
                end
         | 
| 26 22 |  | 
| 27 23 | 
             
                it 'returning its siblings' do
         | 
| @@ -35,13 +31,11 @@ describe Section do | |
| 35 31 | 
             
                end
         | 
| 36 32 |  | 
| 37 33 | 
             
                it 'returns the URL for initial section' do
         | 
| 38 | 
            -
                  @intro. | 
| 34 | 
            +
                  @intro.path.should == "#{@intro.managed_content.path}"
         | 
| 39 35 | 
             
                end
         | 
| 40 36 |  | 
| 41 37 | 
             
                it 'returns the URL for subsequent sections' do
         | 
| 42 | 
            -
                  @meat. | 
| 38 | 
            +
                  @meat.path.should == "#{@intro.managed_content.path}/body"
         | 
| 43 39 | 
             
                end
         | 
| 44 | 
            -
             | 
| 45 40 | 
             
              end
         | 
| 46 | 
            -
             | 
| 47 | 
            -
            end
         | 
| 41 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,13 +1,13 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: editorial_logic
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              hash:  | 
| 4 | 
            +
              hash: 7
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
              segments: 
         | 
| 7 7 | 
             
              - 1
         | 
| 8 | 
            -
              -  | 
| 9 | 
            -
              -  | 
| 10 | 
            -
              version: 1. | 
| 8 | 
            +
              - 4
         | 
| 9 | 
            +
              - 0
         | 
| 10 | 
            +
              version: 1.4.0
         | 
| 11 11 | 
             
            platform: ruby
         | 
| 12 12 | 
             
            authors: 
         | 
| 13 13 | 
             
            - Bantik
         | 
| @@ -15,7 +15,7 @@ autorequire: | |
| 15 15 | 
             
            bindir: bin
         | 
| 16 16 | 
             
            cert_chain: []
         | 
| 17 17 |  | 
| 18 | 
            -
            date: 2011- | 
| 18 | 
            +
            date: 2011-10-04 00:00:00 Z
         | 
| 19 19 | 
             
            dependencies: 
         | 
| 20 20 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 21 21 | 
             
              name: bson_ext
         | 
| @@ -116,7 +116,7 @@ dependencies: | |
| 116 116 | 
             
              type: :runtime
         | 
| 117 117 | 
             
              version_requirements: *id007
         | 
| 118 118 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 119 | 
            -
              name:  | 
| 119 | 
            +
              name: stringex
         | 
| 120 120 | 
             
              prerelease: false
         | 
| 121 121 | 
             
              requirement: &id008 !ruby/object:Gem::Requirement 
         | 
| 122 122 | 
             
                none: false
         | 
| @@ -130,7 +130,7 @@ dependencies: | |
| 130 130 | 
             
              type: :runtime
         | 
| 131 131 | 
             
              version_requirements: *id008
         | 
| 132 132 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 133 | 
            -
              name:  | 
| 133 | 
            +
              name: SystemTimer
         | 
| 134 134 | 
             
              prerelease: false
         | 
| 135 135 | 
             
              requirement: &id009 !ruby/object:Gem::Requirement 
         | 
| 136 136 | 
             
                none: false
         | 
| @@ -144,7 +144,7 @@ dependencies: | |
| 144 144 | 
             
              type: :runtime
         | 
| 145 145 | 
             
              version_requirements: *id009
         | 
| 146 146 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 147 | 
            -
              name:  | 
| 147 | 
            +
              name: tanker
         | 
| 148 148 | 
             
              prerelease: false
         | 
| 149 149 | 
             
              requirement: &id010 !ruby/object:Gem::Requirement 
         | 
| 150 150 | 
             
                none: false
         | 
| @@ -155,12 +155,26 @@ dependencies: | |
| 155 155 | 
             
                    segments: 
         | 
| 156 156 | 
             
                    - 0
         | 
| 157 157 | 
             
                    version: "0"
         | 
| 158 | 
            -
              type: : | 
| 158 | 
            +
              type: :runtime
         | 
| 159 159 | 
             
              version_requirements: *id010
         | 
| 160 160 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 161 | 
            -
              name:  | 
| 161 | 
            +
              name: jeweler
         | 
| 162 162 | 
             
              prerelease: false
         | 
| 163 163 | 
             
              requirement: &id011 !ruby/object:Gem::Requirement 
         | 
| 164 | 
            +
                none: false
         | 
| 165 | 
            +
                requirements: 
         | 
| 166 | 
            +
                - - ">="
         | 
| 167 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 168 | 
            +
                    hash: 3
         | 
| 169 | 
            +
                    segments: 
         | 
| 170 | 
            +
                    - 0
         | 
| 171 | 
            +
                    version: "0"
         | 
| 172 | 
            +
              type: :development
         | 
| 173 | 
            +
              version_requirements: *id011
         | 
| 174 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 175 | 
            +
              name: rspec
         | 
| 176 | 
            +
              prerelease: false
         | 
| 177 | 
            +
              requirement: &id012 !ruby/object:Gem::Requirement 
         | 
| 164 178 | 
             
                none: false
         | 
| 165 179 | 
             
                requirements: 
         | 
| 166 180 | 
             
                - - ">="
         | 
| @@ -172,7 +186,7 @@ dependencies: | |
| 172 186 | 
             
                    - 9
         | 
| 173 187 | 
             
                    version: 1.2.9
         | 
| 174 188 | 
             
              type: :development
         | 
| 175 | 
            -
              version_requirements: * | 
| 189 | 
            +
              version_requirements: *id012
         | 
| 176 190 | 
             
            description: An engine for enabling managed content, including articles, blogs, FAQs and glossaries.
         | 
| 177 191 | 
             
            email: corey@seologic.com
         | 
| 178 192 | 
             
            executables: []
         | 
| @@ -266,7 +280,6 @@ files: | |
| 266 280 | 
             
            - features/support/selectors.rb
         | 
| 267 281 | 
             
            - init.rb
         | 
| 268 282 | 
             
            - lib/editorial_logic.rb
         | 
| 269 | 
            -
            - lib/editorial_logic/engine.rb
         | 
| 270 283 | 
             
            - lib/editorial_logic/railtie.rb
         | 
| 271 284 | 
             
            - lib/tasks/cucumber.rake
         | 
| 272 285 | 
             
            - lib/tasks/rcov.rake
         | 
| @@ -965,7 +978,6 @@ files: | |
| 965 978 | 
             
            - spec/controllers/admin/publications_controller_spec.rb
         | 
| 966 979 | 
             
            - spec/controllers/managed_contents_controller_spec.rb
         | 
| 967 980 | 
             
            - spec/controllers/publications_controller_spec.rb
         | 
| 968 | 
            -
            - spec/editorial_logic_spec.rb
         | 
| 969 981 | 
             
            - spec/models/managed_content_spec.rb
         | 
| 970 982 | 
             
            - spec/models/publication_spec.rb
         | 
| 971 983 | 
             
            - spec/models/section_spec.rb
         | 
| @@ -1,42 +0,0 @@ | |
| 1 | 
            -
            require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            # Test vs the latest changes in the lib file, not the installed gem version
         | 
| 4 | 
            -
            require File.expand_path(File.dirname(__FILE__) + '/../lib/editorial_logic')
         | 
| 5 | 
            -
             | 
| 6 | 
            -
            describe "EditorialLogic" do
         | 
| 7 | 
            -
             | 
| 8 | 
            -
              before :all do
         | 
| 9 | 
            -
                class Foo
         | 
| 10 | 
            -
                  include Mongoid::Document
         | 
| 11 | 
            -
                  include EditorialLogic::Base
         | 
| 12 | 
            -
                  has_slug :desired_slug
         | 
| 13 | 
            -
                  attr_accessor :desired_slug
         | 
| 14 | 
            -
                  attr_accessor :slug
         | 
| 15 | 
            -
                end
         | 
| 16 | 
            -
              end
         | 
| 17 | 
            -
             | 
| 18 | 
            -
              it 'adds the has_slug method to a class' do
         | 
| 19 | 
            -
                Foo.respond_to?(:has_slug).should be_true
         | 
| 20 | 
            -
              end
         | 
| 21 | 
            -
             | 
| 22 | 
            -
              describe 'slug' do
         | 
| 23 | 
            -
             | 
| 24 | 
            -
                it 'converts non-alpha-numeric characters' do
         | 
| 25 | 
            -
                  Foo.new(:desired_slug => 'dollars$and$cents').make_slug.should == 'dollars-and-cents'
         | 
| 26 | 
            -
                end
         | 
| 27 | 
            -
             | 
| 28 | 
            -
                it 'converts runs of hyphens' do
         | 
| 29 | 
            -
                  Foo.new(:desired_slug => 'dollars$$and$$cents').make_slug.should == 'dollars-and-cents'
         | 
| 30 | 
            -
                end
         | 
| 31 | 
            -
             | 
| 32 | 
            -
                it 'removes trailing hyphens' do
         | 
| 33 | 
            -
                  Foo.new(:desired_slug => 'dollars$').make_slug.should == 'dollars'
         | 
| 34 | 
            -
                end
         | 
| 35 | 
            -
             | 
| 36 | 
            -
                it 'removes leading hyphens' do
         | 
| 37 | 
            -
                  Foo.new(:desired_slug => '$dollars').make_slug.should == 'dollars'
         | 
| 38 | 
            -
                end
         | 
| 39 | 
            -
             | 
| 40 | 
            -
              end
         | 
| 41 | 
            -
             | 
| 42 | 
            -
            end
         |