forked from thoughtbot/administrate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tweak primary navigation (thoughtbot#861)
* Tweak primary navigation - Rename `sidebar` to `navigation`, which is based on its purpose rather than its visual placement. - Use `nav` element. - Remove unnecessary `ul`; the `nav` provides enough semantics to wrap the links in. - Tweak visual design: show a light background on hover, add more whitespace between navigation links and main content. * Add whitespace around main content box (thoughtbot#862)
- Loading branch information
Showing
17 changed files
with
93 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 4 additions & 3 deletions
7
app/assets/stylesheets/administrate/components/_main-content.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
.main-content { | ||
background-color: $white; | ||
box-shadow: 0 2px 4px rgba($grey-7, 0.24), 0 2px 6px rgba($grey-7, 0.12); | ||
flex: 1; | ||
overflow-y: auto; | ||
border-radius: $base-border-radius; | ||
box-shadow: 0 0 6px 0 rgba($black, 0.12), | ||
0 2px 2px rgba($black, 0.2); | ||
flex: 1 1 100%; | ||
} |
33 changes: 33 additions & 0 deletions
33
app/assets/stylesheets/administrate/components/_navigation.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
$_navigation-link-padding: 0.6em; | ||
|
||
.navigation { | ||
flex: 1 0 10rem; | ||
padding-bottom: $base-spacing; | ||
padding-right: calc(#{$base-spacing} - #{$_navigation-link-padding}); | ||
padding-top: $base-spacing; | ||
} | ||
|
||
.navigation__link { | ||
background-color: transparent; | ||
color: $base-font-color; | ||
display: block; | ||
line-height: 1; | ||
margin-left: -($_navigation-link-padding); | ||
padding: $_navigation-link-padding; | ||
transition: background-color $base-duration $base-timing, | ||
color $base-duration $base-timing; | ||
|
||
&:not(:last-of-type) { | ||
margin-bottom: $small-spacing; | ||
} | ||
|
||
&:hover { | ||
background-color: shade($base-background-color, 5%); | ||
border-radius: $base-border-radius; | ||
color: $base-font-color; | ||
} | ||
} | ||
|
||
.navigation__link--active { | ||
font-weight: $bold-font-weight; | ||
} |
22 changes: 0 additions & 22 deletions
22
app/assets/stylesheets/administrate/components/_sidebar.scss
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<%# | ||
# Navigation | ||
This partial is used to display the navigation in Administrate. | ||
By default, the navigation contains navigation links | ||
for all resources in the admin dashboard, | ||
as defined by the routes in the `admin/` namespace | ||
%> | ||
|
||
<nav class="navigation"> | ||
<% Administrate::Namespace.new(namespace).resources.each do |resource| %> | ||
<%= link_to( | ||
display_resource_name(resource), | ||
[namespace, resource.path], | ||
class: "navigation__link navigation__link--#{nav_link_state(resource)}" | ||
) %> | ||
<% end %> | ||
</nav> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require "spec_helper" | ||
require "generators/administrate/views/navigation_generator" | ||
require "support/generator_spec_helpers" | ||
|
||
describe Administrate::Generators::Views::NavigationGenerator, :generator do | ||
describe "administrate:views:navigation" do | ||
it "copies the navigation partial into the `admin/application` namespace" do | ||
expected_contents = contents_for_application_template("_navigation") | ||
generated_file = file("app/views/admin/application/_navigation.html.erb") | ||
|
||
run_generator [] | ||
|
||
contents = File.read(generated_file) | ||
expect(contents).to eq(expected_contents) | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.