From 2ad3520f94bcfca20bb95dfdac98ad6735ca1287 Mon Sep 17 00:00:00 2001 From: cedricnjanga Date: Wed, 25 Oct 2017 17:15:34 +0200 Subject: Refs #4759 Fix bug on dashboard to show the 5 first referentials of the current_organisation's first workbench. Added a small changes dashboard.rb to avoid '@workbench is not defined error' With the same logic we list only the first 5 calendars --- app/views/stif/dashboards/_dashboard.html.slim | 8 ++++---- lib/stif/dashboard.rb | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/stif/dashboards/_dashboard.html.slim b/app/views/stif/dashboards/_dashboard.html.slim index 3142ecd5b..f3cd01f46 100644 --- a/app/views/stif/dashboards/_dashboard.html.slim +++ b/app/views/stif/dashboards/_dashboard.html.slim @@ -39,14 +39,14 @@ h3.panel-title.with_actions div = t('.referentials') - span.badge.ml-xs = @referentials.count if @referentials.present? + span.badge.ml-xs = @dashboard.referentials.count if @dashboard.referentials.present? div = link_to '', workbench_path(@dashboard.workbench), class: ' fa fa-chevron-right pull-right', title: t('.see') - - if @referentials.present? + - if @dashboard.referentials.present? .list-group - - @referentials.each_with_index do |referential, i| + - @dashboard.referentials.first(5).each_with_index do |referential, i| = link_to referential.name, referential_path(referential, workbench_id: referential.workbench_id, current_workbench_id: @dashboard.workbench.id), class: 'list-group-item' if i < 6 - else @@ -65,7 +65,7 @@ - if @dashboard.calendars.present? .list-group - - @dashboard.calendars.each_with_index do |calendar, i| + - @dashboard.calendars.first(5).each_with_index do |calendar, i| = link_to calendar.name, calendar_path(calendar), class: 'list-group-item' if i < 6 - else diff --git a/lib/stif/dashboard.rb b/lib/stif/dashboard.rb index fafddec62..b6b6b8284 100644 --- a/lib/stif/dashboard.rb +++ b/lib/stif/dashboard.rb @@ -5,7 +5,7 @@ module Stif end def referentials - @referentials ||= @workbench.all_referentials + @referentials ||= self.workbench.all_referentials end def calendars -- cgit v1.2.3