Skip to content

Commit

Permalink
extract submission variable form the concept date render helper
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Jun 21, 2024
1 parent 9205693 commit 6909137
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/controllers/concepts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def show_date_sorted_list
if @ontology.nil?
ontology_not_found(params[:ontology])
else
@submission = @ontology.explore.latest_submission(include: 'uriRegexPattern,preferredNamespaceUri')
page = params[:page]
@last_date = params[:last_date]
auto_click = page.to_s.eql?('1')
Expand Down
9 changes: 5 additions & 4 deletions app/helpers/concepts_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,14 @@ def concepts_li_list(concepts, auto_click: false, selected_id: nil, submission:
out
end

def render_concepts_by_dates(auto_click: false)
def render_concepts_by_dates(auto_click: false, submission: @submission)
return if @concepts_year_month.empty?

first_year, first_month_concepts = @concepts_year_month.shift
first_month, first_concepts = first_month_concepts.shift
out = ''
if same_period?(first_year, first_month, @last_date)
out += "<ul>#{concepts_li_list(first_concepts, auto_click: auto_click, submission: @ontology.explore.latest_submission(include:'uriRegexPattern,preferredNamespaceUri'))}</ul>"
out += "<ul>#{concepts_li_list(first_concepts, auto_click: auto_click, submission: submission)}</ul>"
else
tmp = {}
tmp[first_month] = first_concepts
Expand All @@ -138,8 +138,9 @@ def render_concepts_by_dates(auto_click: false)
@concepts_year_month.each do |year, month_concepts|
month_concepts.each do |month, concepts|
out += "<ul> #{month + ' ' + year.to_s}"
out += concepts_li_list(concepts, auto_click: auto_click, selected_id: selected_id, submission: @ontology.explore.latest_submission(include:'uriRegexPattern,preferredNamespaceUri'))
out += "</ul>"
out += concepts_li_list(concepts, auto_click: auto_click, selected_id: selected_id,
submission: submission)
out += '</ul>'
end
end
raw out
Expand Down

0 comments on commit 6909137

Please sign in to comment.