forked from Katello/katello
/
organization.rb
65 lines (59 loc) · 2.01 KB
/
organization.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#
# Copyright 2011 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# including the implied warranties of MERCHANTABILITY,
# NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
# have received a copy of GPLv2 along with this software; if not, see
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
module Navigation
module OrganizationMenu
def self.included(base)
base.class_eval do
helper_method :organization_navigation
end
end
def menu_organization
{:key => :organizations,
:name => N_("Organizations"),
:url => :sub_level,
:options => {:class=>'organization top_level', "data-menu"=>"organization"},
:if => lambda{current_organization() && Organization.any_readable?},
:items=> [ menu_org_list, menu_org_subscriptions]
}
end
def menu_org_list
{:key => :org_list,
:name => N_("List"),
:url => organizations_path,
:options => {:class=>'organization second_level', "data-menu"=>"organization"}
}
end
def menu_org_subscriptions
{:key => :subscriptions,
:name => N_("Subscriptions"),
:url => subscriptions_path(),
:options => {:class=>'organization second_level', "data-menu"=>"organization"}
}
end
def organization_navigation
[
{ :key => :general,
:name =>N_("General"),
:url => lambda{edit_organization_path(@organization.id)},
:if => lambda{@organization},
:options => {:class=>"navigation_element"}
},
{ :key => :history,
:name =>N_("History"),
:url => lambda{events_organization_path(@organization.id)},
:if => lambda{@organization},
:options => {:class=>"navigation_element"}
}
]
end
end
end