-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
293 additions
and
257 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
.admin { | ||
> header { | ||
border-bottom: 1px solid #eee; | ||
|
||
> * { | ||
@include full-width-background($adjust-margin: false, $adjust-padding: true); | ||
} | ||
} | ||
|
||
.top-links { | ||
|
||
a { | ||
line-height: rem-calc($line-height * 1.5); | ||
} | ||
} | ||
|
||
.top-bar { | ||
height: auto; | ||
padding-top: $line-height / 2; | ||
|
||
@include breakpoint(small only) { | ||
|
||
.top-bar-left ul { | ||
display: inline-block; | ||
} | ||
|
||
.top-bar-right { | ||
|
||
> ul { | ||
border-bottom: 0; | ||
padding-bottom: 0; | ||
margin-bottom: 0; | ||
} | ||
|
||
.submenu { | ||
position: initial; | ||
} | ||
|
||
a { | ||
font-weight: normal; | ||
} | ||
} | ||
|
||
[class^="icon-"] { | ||
display: none; | ||
} | ||
} | ||
|
||
[class^="icon-"] { | ||
font-size: $base-font-size; | ||
} | ||
|
||
h1 { | ||
margin-top: $line-height / 2; | ||
margin-bottom: 0; | ||
|
||
@include breakpoint(medium) { | ||
margin-top: 0; | ||
} | ||
|
||
small { | ||
color: inherit; | ||
text-transform: uppercase; | ||
} | ||
|
||
a { | ||
color: inherit; | ||
display: inline-block; | ||
font-family: "Lato" !important; | ||
font-size: rem-calc(24); | ||
font-weight: lighter; | ||
line-height: 1; | ||
} | ||
} | ||
} | ||
|
||
.top-bar .menu > li { | ||
|
||
@include breakpoint(medium) { | ||
height: auto !important; | ||
} | ||
} | ||
|
||
.title-bar { | ||
color: inherit; | ||
position: absolute; | ||
right: 12px; | ||
} | ||
} |
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,5 @@ | ||
<ul class="menu" data-responsive-menu="medium-dropdown"> | ||
<%= render Layout::AdminLoginItemsComponent.new(user) %> | ||
<%= render Layout::NotificationItemComponent.new(user) %> | ||
<%= render Layout::LoginItemsComponent.new(user) %> | ||
</ul> |
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,7 @@ | ||
class Layout::AccountMenuComponent < ApplicationComponent | ||
attr_reader :user | ||
|
||
def initialize(user) | ||
@user = user | ||
end | ||
end |
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,39 @@ | ||
<header class="header"> | ||
<div class="top-links"> | ||
<%= render "shared/locale_switcher" %> | ||
<%= link_to root_path do %> | ||
<%= t("admin.dashboard.index.back", org: setting["org_name"]) %> | ||
<% end %> | ||
</div> | ||
|
||
<div class="expanded row admin-top-bar"> | ||
<% if show_admin_menu?(user) || namespace != "management" %> | ||
<div class="title-bar" data-responsive-toggle="responsive_menu" data-hide-for="medium"> | ||
<button class="menu-button" type="button" data-toggle="responsive_menu"> | ||
<span class="menu-icon"></span> | ||
<span class="title-bar-title"><%= t("application.menu") %></span> | ||
</button> | ||
</div> | ||
<% end %> | ||
|
||
<div class="top-bar"> | ||
<div class="top-bar-left"> | ||
<h1> | ||
<%= link_to namespace_path do %> | ||
<%= setting["org_name"] %> | ||
<br><small><%= namespaced_header_title %></small> | ||
<% end %> | ||
</h1> | ||
</div> | ||
|
||
<% if show_admin_menu?(user) || namespace != "management" %> | ||
<div id="responsive_menu"> | ||
<div class="top-bar-right"> | ||
<%= render Layout::AccountMenuComponent.new(user) %> | ||
</div> | ||
</div> | ||
<% end %> | ||
</div> | ||
</div> | ||
</header> |
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,28 @@ | ||
class Layout::AdminHeaderComponent < ApplicationComponent | ||
attr_reader :user | ||
delegate :namespace, :namespaced_root_path, :show_admin_menu?, to: :helpers | ||
|
||
def initialize(user) | ||
@user = user | ||
end | ||
|
||
private | ||
|
||
def namespaced_header_title | ||
if namespace == "moderation/budgets" | ||
t("moderation.header.title") | ||
elsif namespace == "management" | ||
t("management.dashboard.index.title") | ||
else | ||
t("#{namespace}.header.title") | ||
end | ||
end | ||
|
||
def namespace_path | ||
if namespace == "officing" | ||
"#" | ||
else | ||
namespaced_root_path | ||
end | ||
end | ||
end |
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,4 @@ | ||
<li class="has-submenu"> | ||
<%= link_to t("layouts.header.administration_menu"), "#", rel: "nofollow", class: "hide-for-small-only" %> | ||
<%= link_list(*admin_links, class: "submenu menu", data: { submenu: true }) %> | ||
</li> |
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,49 @@ | ||
class Layout::AdminLoginItemsComponent < ApplicationComponent | ||
attr_reader :user | ||
delegate :link_list, :show_admin_menu?, to: :helpers | ||
|
||
def initialize(user) | ||
@user = user | ||
end | ||
|
||
def render? | ||
show_admin_menu?(user) | ||
end | ||
|
||
private | ||
|
||
def admin_links | ||
[ | ||
(admin_link if user.administrator?), | ||
(moderation_link if user.administrator? || user.moderator?), | ||
(valuation_link if feature?(:budgets) && (user.administrator? || user.valuator?)), | ||
(management_link if user.administrator? || user.manager?), | ||
(officing_link if user.poll_officer? && Poll.current.any?), | ||
(sdg_management_link if feature?(:sdg) && (user.administrator? || user.sdg_manager?)) | ||
] | ||
end | ||
|
||
def admin_link | ||
[t("layouts.header.administration"), admin_root_path] | ||
end | ||
|
||
def moderation_link | ||
[t("layouts.header.moderation"), moderation_root_path] | ||
end | ||
|
||
def valuation_link | ||
[t("layouts.header.valuation"), valuation_root_path] | ||
end | ||
|
||
def management_link | ||
[t("layouts.header.management"), management_sign_in_path] | ||
end | ||
|
||
def officing_link | ||
[t("layouts.header.officing"), officing_root_path] | ||
end | ||
|
||
def sdg_management_link | ||
[t("sdg_management.header.title"), sdg_management_root_path] | ||
end | ||
end |
File renamed without changes.
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,2 @@ | ||
class Layout::FooterComponent < ApplicationComponent | ||
end |
4 changes: 2 additions & 2 deletions
4
app/views/devise/menu/_login_items.html.erb → ...nts/layout/login_items_component.html.erb
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,8 @@ | ||
class Layout::LoginItemsComponent < ApplicationComponent | ||
attr_reader :user | ||
delegate :layout_menu_link_to, to: :helpers | ||
|
||
def initialize(user) | ||
@user = user | ||
end | ||
end |
File renamed without changes.
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,3 @@ | ||
class Layout::SubnavigationComponent < ApplicationComponent | ||
delegate :content_block, :layout_menu_link_to, to: :helpers | ||
end |
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
Oops, something went wrong.