From 592eab19a223acf0592c694c3deec9aa92ba4ae3 Mon Sep 17 00:00:00 2001 From: bohung Date: Wed, 13 Jul 2022 15:00:21 +0800 Subject: [PATCH] Fix bug. --- app/controllers/calendars_controller.rb | 9 +++++- .../calendars/_calendar_variable.html.erb | 28 ++++++++++--------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/app/controllers/calendars_controller.rb b/app/controllers/calendars_controller.rb index 552af1a..705869a 100644 --- a/app/controllers/calendars_controller.rb +++ b/app/controllers/calendars_controller.rb @@ -34,6 +34,12 @@ class CalendarsController < ApplicationController def widget part = OrbitHelper.get_current_widget @calendar_setting = CalendarSetting.first + begin + extra_before_html = render_to_string(partial: 'calendars/calendar_variable', locals: {:@calendar_setting=>@calendar_setting}) + rescue => e + extra_before_html = "" + puts e, e.backtrace + end { "modes_info" => @calendar_setting.get_modes_info.map.with_index{|(trans, mode),i| {trans: trans, mode: mode, active_class: (i == 2 ? 'active' : '')}}, @@ -44,7 +50,8 @@ class CalendarsController < ApplicationController 'widget_title' => part.title, 'widget_title_class' => part.title.blank? ? 'center' : '', 'calendar_title' => get_calendar_title, - 'default_column' => widget_default_column + 'default_column' => widget_default_column, + 'extra_before_html' => extra_before_html } } end diff --git a/app/views/calendars/_calendar_variable.html.erb b/app/views/calendars/_calendar_variable.html.erb index f35d510..4f1b825 100644 --- a/app/views/calendars/_calendar_variable.html.erb +++ b/app/views/calendars/_calendar_variable.html.erb @@ -1,16 +1,18 @@ \ No newline at end of file