Commit 47d5d5f5db1fd6259e041211ea70da93f2173441
Exists in
master
and in
4 other branches
Merge pull request #203 from mlitwiniuk/top_nav_fix
Hide admin menu for non-admins
Showing
2 changed files
with
12 additions
and
7 deletions
Show diff stats
app/assets/stylesheets/style.scss
| ... | ... | @@ -359,6 +359,9 @@ header nav{border-radius: 4px; box-shadow: 0 1px 2px black; width: 294px; margin |
| 359 | 359 | margin-top: 2px; |
| 360 | 360 | height:30px |
| 361 | 361 | } |
| 362 | +header nav.shorter_nav{ | |
| 363 | + width: 207px; | |
| 364 | +} | |
| 362 | 365 | header nav a{padding: 8px 12px 8px 34px; display: inline-block; color: #D6DADF; border-right: 1px solid #31363E; position: relative; box-shadow: 1px 0 0 rgba(255,255,255,.1); margin: 0} |
| 363 | 366 | header nav a span{width: 20px; height: 20px; display: inline-block; background: red; position: absolute; left: 8px; top: 6px;} |
| 364 | 367 | header nav a:last-child {border: 0; box-shadow: none} |
| ... | ... | @@ -382,7 +385,7 @@ header nav a.dashboard { |
| 382 | 385 | border-bottom-left-radius: 4px; |
| 383 | 386 | } |
| 384 | 387 | |
| 385 | -header nav a.admin{ | |
| 388 | +header nav a.last_elem{ | |
| 386 | 389 | -webkit-border-top-right-radius: 4px; |
| 387 | 390 | -webkit-border-bottom-right-radius: 4px; |
| 388 | 391 | -moz-border-radius-topright: 4px; | ... | ... |
app/views/layouts/_head_panel.html.erb
| ... | ... | @@ -21,16 +21,18 @@ |
| 21 | 21 | <%= text_field_tag "search", nil, :placeholder => "Search", :class => "search-input" %> |
| 22 | 22 | </div> |
| 23 | 23 | <!-- .login-top --> |
| 24 | - <nav> | |
| 25 | - <%= link_to dashboard_path, :class => current_page?(root_path) ? "current dashboard" : "dashboard" do %> | |
| 24 | + <nav class="<%= 'shorter_nav' unless current_user.is_admin? %>"> | |
| 25 | + <%= link_to dashboard_path, :class => "#{'current' if current_page?(root_path)} dashboard" do %> | |
| 26 | 26 | <span></span>Dashboard |
| 27 | 27 | <% end %> |
| 28 | - <%= link_to projects_path, :class => current_page?(projects_path) ? "current project" : "project" do %> | |
| 28 | + <%= link_to projects_path, :class =>"#{'current' if current_page?(projects_path)} project #{'last_elem' unless current_user.is_admin?}" do %> | |
| 29 | 29 | <span></span>Projects |
| 30 | 30 | <% end %> |
| 31 | - <%= link_to((current_user.is_admin? ? admin_root_path : "#"), :class => (admin_namespace? ? "current admin" : "admin")) do %> | |
| 32 | - <span></span>Admin | |
| 33 | - <% end %> | |
| 31 | + <% if current_user.is_admin? %> | |
| 32 | + <%= link_to((current_user.is_admin? ? admin_root_path : "#"), :class => "#{'current' if admin_namespace?} admin last_elem") do %> | |
| 33 | + <span></span>Admin | |
| 34 | + <% end %> | |
| 35 | + <% end %> | |
| 34 | 36 | </nav> |
| 35 | 37 | |
| 36 | 38 | </header> | ... | ... |