Page management challenges

Have a few questions re: page management.

See screen capture below. I added the page “Tasks Table 2” this evening. I intend it to be an alternative to the existing “Tasks Table 1”. I want all the pages to be protected by login but as you can see I created Tasks Table 2 in such a way that it’s a public page.

Here are my questions.

  1. Note that there are all these login pages: Tasks Login, Projects Login, Notes Login. Why? At the moment there’s just 1 user in the users table, with just 1 role. And I want everything controlled by login. Is there a way to put everybody under the same login? The way Tadabase handles this is: each page has its own access rules, and if the page requires a login and user came directly to the page, user is redirected to the single login page for the app. I kind of like the “single login page” idea. Is that possible in Knack?

  2. Is there at least a way to move the Tasks Table 2 page so it is “covered” (whatever’s the right term here) by the main Tasks Login?

  3. Note that there are multiple Task Details pages. I imagine working with Knack I’ll be making multiple pages with different column configs and/or different default filters. But when a user needs to see details (or edit details) for a record, it would be really nice if I only had to maintain a single page for that purpose. Is that possible? Is it possible for example to configure the “edit” link in a column of Tasks Table 2 so that it takes user to the first Task Details page (the one that’s under Tasks Table 1)?

Thanks. Having a little trouble getting my head around Knack’s approach to these issues.

Hi William :wave:

  1. You can have a “single login page” by creating a page (for example, called General), requiring login on it, and then using Page Rules to direct the user based on their user role. Additionally, in case someone accidentally lands on another login page (e.g. upon logging out of the app) you can add this JavaScript to handle that:
// Redirect all Login pages to the General Login page
$(document).on('knack-view-render.any', function(event, view, data) {
  if (view.type == 'login' && view.key != 'view_148') {
    window.location.replace('#login'); // Replace the view key and #login link with your values
  }
});
  1. Yes I believe so, but that would make Tasks Table 2 a child page of the Tasks Login page… is that your intention?
  2. Yes this is possible and encouraged. When configuring the “edit” link in a column of Orders, for example, select “Link to another page” instead of “Edit record”. Selecting “Edit Record” will create an additional Edit page which you don’t want in your case.

1 Like

Just to chime in.

  1. KanckPros solved this for me using the same code I think here. It works perfectly.
  2. Uncheck the pages you want to move and then click the Save button way at the bottom - see image…
  3. Thanks KanckPros. I was wondering if this would work. I need this too.

Thanks. I’ve marked your reply as the solution.

I’m going to hold off on the JavaScript answer to my first question. Perhaps I can move the pages around in a way that minimizes the problem of login pages popping up like weeds. Yes, I don’t care if Tasks Table 2 is a “child” of the Tasks Login page (and thus a sibling of Tasks Table 1). But my problem has been, *I cannot see how to move Tasks Table 2 to a position “underneath” the Tasks Login page.

As to your answer to my third question: Brilliant! That’s a big, big help. Thanks again.

Not sure I follow what you’re done here, Peter. I have played a little with Dropdown menus but need to study them more carefully. Looks like you’re suggesting the solution to my problem lies there. Thanks for chiming in.

Click on the login page that you want to move stuff around in.
Uncheck those pages you want to move including the ones that may be relative to the page(s) of interest.
Click Save below.
You may need to do this for another login page “group” if you are moving from one place to another.
Now you can drag those pages to where you want.
When you have it right, go back to the relevant login pages and click the pages that should belong to that dropdown menu choice and click Save at the bottom again.

Removed

You said to replace the “#login link” with my own values. What is the “#login link”? Do you mean the name of the login page (which in your example was “General”)? Or something else?

Also, I cannot figure out WHERE to put this little bit of JavaScript. I’ve clicked on page settings, app settings etc and don’t find an obvious place to paste this. Please advise. Sorry, never mind this second question.

Here is the exact same code in my app:

// Always login to the home page regardless of where you logged out from
$(document).on('knack-view-render.any', function(event, view, data) {
 // Replace `view_148` and `#login` with your home login
if (view.type == 'login' && view.key != 'view_63') {
window.location.replace('#home');
}
});

The two variables are view_63 and #home
Home URL

THANKS Peter. It was especially the #home variable that I wasn’t sure about. Got it now.

1 Like