#------------------------------------------------------------------------------
widgets.more=More
+widget.error_occurred_please_read_logs=An error occurred while trying to display the widget "{0}". Please contact the administrator.
widget.alerts.name=Alerts
widget.alerts.description=Display current alerts on the project.
end
def widget_body(widget)
- widget_body=""
+ widget_body=nil
if widget.configured
begin
-<% switch_to_widget_resource(widget) %>
-<% widget_body=widget_body(widget) %>
+<%
+ switch_to_widget_resource(widget)
+ widget_body=widget_body(widget)
+ default_layout=(widget.layout=='DEFAULT')
+%>
<div class="widget-header">
<div class="widget-actions">
</style>
<![endif]-->
<div class="transparent"></div>
- <% if widget_body.include? '<' %>
+ <% if !widget_body %>
+ <div class="block">
+ <% if default_layout %>
+ <div class="widget">
+ <span class="empty_widget"><%= message('widget.error_occurred_please_read_logs', :params => widget.name) -%></span>
+ <div class="clear"></div>
+ </div>
+ <% else %>
+ <span class="empty_widget"><%= message('widget.error_occurred_please_read_logs', :params => widget.name) -%></span>
+ <% end %>
+ </div>
+ <% elsif widget_body.include? '<' %>
<%
- default_layout=(widget.layout=='DEFAULT')
+
if default_layout
%>
<div class="widget">
-<% switch_to_widget_resource(widget) %>
-<% widget_body=widget_body(widget) %>
+<%
+ switch_to_widget_resource(widget)
+ widget_body=widget_body(widget)
+ default_layout=(widget.java_definition.getWidgetLayout().name()=='DEFAULT')
+%>
-<% if widget_body.include?('<') %>
+<% if !widget_body %>
+
+ <div class="block">
+ <% if default_layout %>
+ <div class="widget">
+ <span class="empty_widget"><%= message('widget.error_occurred_please_read_logs', :params => widget.name) -%></span>
+ <div class="clear"></div>
+ </div>
+ <% else %>
+ <span class="empty_widget"><%= message('widget.error_occurred_please_read_logs', :params => widget.name) -%></span>
+ <% end %>
+ </div>
+
+<% elsif widget_body.include?('<') %>
<div class="block" id="block_<%= widget.id -%>">
<%= render :partial => 'widget_title', :locals => {:widget => widget} -%>
<div class="<%= h widget.key -%>" style="height:100%;">
- <% default_layout=(widget.java_definition.getWidgetLayout().name()=='DEFAULT') %>
<% if default_layout %>
<div class="widget">
<%= widget_body -%>
<div id="block_1" class="block" style="width: <%= @widget_width -%>">
<div class="<%= @widget_definition.getId() %>" style="height:100%;">
<%
+ widget_body=nil
begin
widget_body=render :inline => @widget_definition.getTarget().getTemplate(), :locals => {:widget_properties => @widget.properties_as_hash, :widget => @widget, :dashboard_configuration => @dashboard_configuration}
rescue => error
logger.error(message('dashboard.cannot_render_widget_x', :params => [@widget_definition.getId(), error]), error)
- widget_body=""
end
-
- if widget_body.include?('<')
+ default_layout=(@widget_definition.getWidgetLayout().name()=='DEFAULT')
%>
- <%
- default_layout=(@widget_definition.getWidgetLayout().name()=='DEFAULT')
- if default_layout
- %>
- <div class="widget">
- <% end %>
- <%= widget_body -%>
- <% if default_layout %>
+
+<% if !widget_body %>
+
+ <% if default_layout %>
+ <div class="widget">
+ <span class="empty_widget"><%= message('widget.error_occurred_please_read_logs', :params => @widget.key) -%></span>
+ <div class="clear"></div>
+ </div>
+ <% else %>
+ <span class="empty_widget"><%= message('widget.error_occurred_please_read_logs', :params => @widget.key) -%></span>
+ <% end %>
+
+<%
+ elsif widget_body.include?('<')
+%>
+ <% if default_layout %>
+ <div class="widget">
+ <%= widget_body -%>
<div class="clear"></div>
- </div>
- <% end %>
- <%
- end
- %>
+ </div>
+ <% else %>
+ <%= widget_body -%>
+ <% end %>
+<% end %>
+
<div style="clear: both;"></div>
</div>
</div>
\ No newline at end of file