Class: WOR::Core

Inherits:
Object
  • Object
show all
Defined in:
lib/wor.rb

Class Method Summary collapse

Class Method Details

.build_pathObject



36
37
38
# File 'lib/wor.rb', line 36

def build_path

end

.find(params) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/wor.rb', line 13

def find params
  # Build path
  path = "#{Rails.root}/content"

  if (params[:locale].present?)
    if (WOR::Configuration::DEFAULT_LOCALE == params[:locale].to_s)
      path += "/#{params[:collection]}"
    else
      collection_name = params[:collection]
      translated_collection_name = WOR::Collection.get_folder_name(locale: params[:locale], collection_name: collection_name)
      path += "/#{translated_collection_name}"
    end

    path += "/#{WOR::Localization.translate_path_to_original(path: params[:page_name], locale: params[:locale])}.md"
  else
    path += "/#{params[:page_name]}.md"  
  end

  I18n.locale = params[:locale]

  return CollectionItem.new path
end