Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Add Top Nav #271

Closed
BenMorganIO opened this issue Nov 24, 2015 · 16 comments
Closed

Feature Request: Add Top Nav #271

BenMorganIO opened this issue Nov 24, 2015 · 16 comments
Labels
feature new functionality that’s not yet implemented

Comments

@BenMorganIO
Copy link
Collaborator

While I was cruising about, I noticed that I wanted to return to the app, but that link wasn't in the admin. Also, sometimes when you're running a job, you get a dashboard to look at jobs. There's no link anywhere to find them. You're also logged in (most of the time) and there's no conventional logout button.

What I'm asking:

Basically add a nav to the top right near the search to logout if user_signed_in? is true and defined?. And maybe a link to main_app.root_url as well.

An API to add new links (such as giving users the ability to link to a CMS admin and/or a jobs dashboard possible) would be great. I know Solidus/Spree has this.

@c-lliope
Copy link
Contributor

@BenMorganIO A top nav is something that will probably vary a lot between different implementations of Administrate. I'm not sure how to add a top nav that will be generally useful.

On master, we just added #269. This gives you the command rails generate administrate:views:layout. It'll go out in version 0.1.3, and until then you can get it by using:

gem "administrate", github: "thoughtbot/administrate"

If you (and others) want to share your top navbar implementation here, that would be a good first step to see if we can add a generally-useful API for it.

Cheers!

@zamith
Copy link

zamith commented Dec 21, 2015

I added a top navbar on my app by generating the layout and adding it to that layout. Here's the code in Slim, but it should be easily translated to ERb. I also added another manifest with some style coming from the main app.

doctype html
html lang='en'
head
  meta charset="utf-8"
  meta name="ROBOTS" content="NOODP"
  meta name="viewport" content="initial-scale=1"
  title
    = content_for(:title)
    | |
    = Rails.application.class.parent_name.titlecase
  = stylesheet_link_tag "//fonts.googleapis.com/css?family=Lato:300,400,900", media: "all"
  = stylesheet_link_tag "administrate/application", media: "all"
  = stylesheet_link_tag "admin", media: "all"
  = csrf_meta_tags

body.administrate
  = render "application/navbar"  # The top nav
  main.main
    .sidebar
      = render "sidebar"

    .container
      = content_for(:search)
      .content
        = render "flashes"
        = yield

  = render "javascript"

Hope it helps.

@c-lliope
Copy link
Contributor

Great, thanks! I'll leave this open to gauge interest - if anyone else wants to see this, let us know here.

@minimul
Copy link

minimul commented Mar 9, 2016

I have 2 projects using administrate and the first thing you/user/client is thinking after doing what they need to do in administrate is "How do I get back to the main app". So basically overriding the view is the first thing I am going to do everytime.

Solution? Something like what @BenMorganIO said.

@BenMorganIO
Copy link
Collaborator Author

@minimul yep... The top nav of Spree 2 and 3 were views that I always edited in the beginning to add jobs and CMS admin links.

@dgleba
Copy link

dgleba commented Jun 8, 2016

I would like to see a top nav as well.

@flavienhello
Copy link

flavienhello commented Jan 10, 2017

For people like me that didn't know where to you the layouts, it needs to be inside:

app/views/layouts/administrate/application.html.erb

Enjoy

@jasonswett
Copy link

I can see how it could make sense not to include a top nav bar by default. I don't really see how it could make sense not to include a sign-out link by default.

@brownell
Copy link

or a "home" link back to the app

@colinrubbert
Copy link

colinrubbert commented Dec 5, 2018

Seems like such a basic thing but yet it's not there. I'm not going to hold my breath considering this was opened in 2015 and there hasn't been any actual updates on this front.

I could never introduce this to my end-users without me spending the time to add custom navbar or even a sign out or home link.

Please add this, thank you!

@KraevRoot
Copy link

we still need it

@AgonIdrizi
Copy link

This would be great feature, everyone needs to get back to app!

@gesaleh
Copy link

gesaleh commented May 16, 2019

is this going to be added ?

1 similar comment
@ruanltbg
Copy link

ruanltbg commented Jul 6, 2019

is this going to be added ?

nickcharlton added a commit that referenced this issue Jul 12, 2019
This solves half of #271 by implementing a link to take the user back to
the main application. It's assumed that `root_url` without a namespace
returns the main application's root.
@nickcharlton
Copy link
Member

nickcharlton commented Jul 12, 2019

I've opened #1376 as an attempt at solving half of this issue.

Attempting to solve sign out is a different problem. Administrate does not make any assumptions about how you authenticate your application (see: https://github.com/thoughtbot/administrate/blob/7ed5b0792b7dc0b622de83256a22fcaa1d7db54b/lib/generators/administrate/install/templates/application_controller.rb.erb#L11:L13), so there's nothing we can assume about signing out. Like the application_controller, the best we could do is document the best way of solving it.

@nickcharlton
Copy link
Member

I'm going to close this as #1376, which I hope to merge soon provides a partial solution to this.

@nickcharlton nickcharlton added the feature new functionality that’s not yet implemented label Jan 2, 2020
nickcharlton added a commit that referenced this issue Jan 4, 2020
This solves half of #271 by implementing a link to take the user back to
the main application. It's assumed that `root_url` without a namespace
returns the main application's root.
nickcharlton added a commit that referenced this issue Jan 7, 2020
This solves half of #271 by implementing a link to take the user back to
the main application. It's assumed that `root_url` without a namespace
returns the main application's root.
nickcharlton added a commit that referenced this issue Jan 7, 2020
This solves half of #271 by implementing a link to take the user back to
the main application. It's assumed that `root_url` without a namespace
returns the main application's root.
nickcharlton added a commit that referenced this issue Jan 7, 2020
This solves half of #271 by implementing a link to take the user back to
the main application. It's assumed that `root_url` without a namespace
returns the main application's root.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature new functionality that’s not yet implemented
Projects
None yet
Development

No branches or pull requests