Sha256: 86166d25ba7236236eabe23dc4c6fc7d220b8ea5c8522f168b1c76d0ffbf930a

Contents?: true

Size: 636 Bytes

Versions: 3

Compression:

Stored size: 636 Bytes

Contents

module NavigationHelpers
  module Refinery
    module News
      def path_to(page_name)
        case page_name
        when /the home\s?page/
          root_path
        when /the list of news items/
          admin_news_items_path
        when /the new news item form/
          new_admin_news_item_path
        else
          begin
            if page_name =~ /the news item titled "?([^\"]*)"?/ and (news_item = NewsItem.where(:title => $1).first).present?
              self.url_for(news_item)
            else
              nil
            end
          rescue
            nil
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
refinerycms-news-1.2.0 features/support/paths.rb
refinerycms-news-1.1.0 features/support/paths.rb
refinerycms-news-1.0.1 features/support/paths.rb