add_default_dashboards_if_first_user_dashboard(@dashboard.global?)
last_index=current_user.active_dashboards.max_by(&:order_index).order_index
current_user.active_dashboards.create(:dashboard => @dashboard, :user => current_user, :order_index => (last_index+1))
- render :text => @dashboard.id.to_s, :resource => params[:resource], :highlight => @dashboard.id, :status => 200
+ render :text => params[:resource], :highlight => @dashboard.id, :status => 200
else
render :partial => 'dashboards/create_form', :status => 400, :resource => params[:resource]
end
if @dashboard.editable_by?(current_user)
load_dashboard_from_params(@dashboard)
if @dashboard.save
- render :text => @dashboard.id.to_s, :resource => params[:resource], :status => 200
+ render :text => params[:resource], :status => 200
else
render :partial => 'dashboards/edit_form', :status => 400, :resource => params[:resource]
end
<script>
$j("#create-dashboard-form").modalForm({success: function (data) {
- window.location = baseUrl + '/dashboards';
+ var contextParams = data.trim().length > 0 ? '?resource=' + data.trim() : '';
+ window.location = baseUrl + '/dashboards' + contextParams;
}});
</script>
<script>
$j("#edit-dashboard-form").modalForm({success: function (data) {
- window.location = baseUrl + '/dashboards';
+ var contextParams = data.trim().length > 0 ? '?resource=' + data.trim() : '';
+ window.location = baseUrl + '/dashboards' + contextParams;
}});
-</script>
\ No newline at end of file
+</script>