-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Built Content Resources so they show up in Smithy navigation
- Loading branch information
Tim Glen
committed
Aug 26, 2015
1 parent
46125cc
commit 9a5163f
Showing
10 changed files
with
41 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
require 'smithy/content_resources/base' | ||
require 'smithy/content_resources/registry' |
4 changes: 2 additions & 2 deletions
4
lib/smithy/content_pieces/base.rb → lib/smithy/content_resources/base.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
require 'active_support/concern' | ||
|
||
module Smithy | ||
module ContentResources | ||
class Registry | ||
@@content_resources = [] | ||
|
||
class << self | ||
def clear | ||
@@content_resources = [] | ||
end | ||
|
||
def content_resources | ||
@@content_resources | ||
end | ||
|
||
def register(content_resource_model_name, navigation_title=nil) | ||
return if @@content_resources.include?(content_resource_model_name) | ||
navigation_title ||= content_resource_model_name.to_s.titleize.pluralize | ||
@@content_resources << [content_resource_model_name.to_s.tableize, navigation_title] | ||
Smithy::Engine.routes.prepend do | ||
scope '/smithy/content_resources' do | ||
resources content_resource_model_name.to_s.tableize | ||
end | ||
end | ||
@@content_resources | ||
end | ||
end | ||
end | ||
end | ||
end |