AnsweredAssumed Answered

Force Default Dashboard Display (New UI)

Question asked by cesbrandt on Aug 31, 2015
Latest reply on Jul 5, 2016 by James Jones

I've been asked to look into making the activity list the default display for the new UI at my institution. As far as I've found, there is no setting for changing this and no one has asked about it, either. Investigating the toggle that swaps the display, I was able to create a simple JavaScript to create and submit a form sending the same information as is submitted when using the toggle switch (just trying to recreate the functionality of the trigger). The problem is I only get an error:

There was a problem with your last request. You may have tried to perform an action after a long period of inactivity. If that's the case, try going back, reloading the page you were working on, and resubmitting. If not, please let us know what you were doing when the error happened.

At this point, I have no idea how-to pursue this. I'm asking here because, as far as I'm aware, it's not a bug that this isn't changeable. Here's the snippet I've written to emulate the functionality (no control to prevent continuous switching):

function post(path, params, method) {
  method = method || 'post';
  var form = document.createElement('form');
  form.setAttribute('method', method);
  form.setAttribute('action', path);
  for(var key in params) {
    if(params.hasOwnProperty(key)) {
      var hiddenField = document.createElement('input');
      hiddenField.setAttribute('type', 'hidden');
      hiddenField.setAttribute('name', key);
      hiddenField.setAttribute('value', params[key]);
var token = document.cookie.match(/\_csrf\_token\=[^;]+/)[0].replace(/\_csrf\_token\=/, '');
var view = document.getElementById('page_view_id');
post(('/users/toggle_recent_activity_dashboard'), { _post: 'POST', authenticity_token: token, page_view_id: view });

Any help would be greatly appreciated.