aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcedricnjanga2017-10-25 17:15:34 +0200
committercedricnjanga2017-10-25 18:02:36 +0200
commit2ad3520f94bcfca20bb95dfdac98ad6735ca1287 (patch)
treee9a62646af4618453d788b11ffcb17948d914954
parentb0c1dd17d8e301ed2c3c22d84cf3620763b9fdf7 (diff)
downloadchouette-core-2ad3520f94bcfca20bb95dfdac98ad6735ca1287.tar.bz2
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
-rw-r--r--app/views/stif/dashboards/_dashboard.html.slim8
-rw-r--r--lib/stif/dashboard.rb2
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