Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
andersoncardoso committed Jul 12, 2018
1 parent 066b936 commit cb5e231
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/models/search/repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Repository

client Elasticsearch::Client.new(host: ENV['ELASTICSEARCH_ADDRESS'])

index :"unbounded_documents_#{Rails.env}"
index :"lcms_documents_#{Rails.env}"

type :documents

Expand Down
9 changes: 6 additions & 3 deletions app/presenters/curriculum_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,18 @@ def jstree_data
Resource.tree.ordered.roots.map { |res| parse_jstree_node(res) }
end

def level(node)
Resource::HIERARCHY.index(node.curriculum_type.to_sym)
def opened?(node)
level = Resource::HIERARCHY.index(node.curriculum_type.to_sym)
return false unless level.present?

level < UNIT_LEVEL
end

def parse_jstree_node(node)
{
id: node.id,
text: node.short_title,
state: { opened: level(node) < UNIT_LEVEL },
state: { opened: opened?(node) },
children: node.children.tree.ordered.map { |res| parse_jstree_node(res) },
li_attr: { title: node.title }
}
Expand Down
2 changes: 1 addition & 1 deletion app/serializers/search_document_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def path
return media_path(object.model_id) if media?
return generic_path(object.model_id) if generic?

object.slug ? show_with_slug_path(object.slug) : resource_permalink
object.slug.present? ? show_with_slug_path(object.slug) : resource_permalink
end
end

Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ en:
active: Active
hidden: Hidden
resource_types:
resource: Resource
podcast: Podcast
video: Video
quick_reference_guide: Quick Reference Guide
Expand Down

0 comments on commit cb5e231

Please sign in to comment.