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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
# File 'lib/voluntary_scholarship/navigation.rb', line 21
def self.code
Proc.new do |navigation|
navigation.items do |primary|
primary.dom_class = 'nav'
instance_exec primary, VoluntaryScholarship::Navigation.[:organizations], &::Voluntary::Navigation.(:organizations)
primary.item :scholarship_programs, I18n.t('scholarship_programs.index.short_title'), scholarship_programs_path do |programs|
programs.item :new, I18n.t('general.new'), new_scholarship_program_path
unless (@program.new_record? rescue true)
programs.item :show, "#{@program.name} (#{@program.organization.name})", scholarship_program_path(@program) do |program|
if can? :destroy, @program
program.item :destroy, I18n.t('general.destroy'), scholarship_program_path(@program), method: :delete, confirm: I18n.t('general.questions.are_you_sure')
end
program.item :show, I18n.t('general.details'), "#{scholarship_program_path(@program)}#top"
program.item :edit, I18n.t('general.edit'), edit_scholarship_program_path(@program) if can? :edit, @program
program.item :iterations, I18n.t('scholarship_iterations.index.short_title'), scholarship_program_iterations_path(@program) do |iterations|
iterations.item :new, I18n.t('general.new'), new_scholarship_program_iteration_path(@program)
unless (@iteration.new_record? rescue true)
iterations.item(
:show, @iteration.to_s,
scholarship_iteration_path(@iteration)
) do |iteration|
if can? :destroy, @iteration
iteration.item :destroy, I18n.t('general.destroy'), scholarship_iteration_path(@iteration), method: :delete, confirm: I18n.t('general.questions.are_you_sure')
end
iteration.item :show, I18n.t('general.details'), "#{scholarship_iteration_path(@iteration)}#top"
iteration.item :edit, I18n.t('general.edit'), edit_scholarship_iteration_path(@iteration) if can? :edit, @iteration
iteration.item :participants, I18n.t('scholarship_iteration_participations.index.title'), scholarship_iteration_participants_path(@iteration) do |team_members|
team_members.item(
:new, I18n.t('scholarship_iteration_participations.new.title'), new_scholarship_iteration_participant_path(@iteration),
highlights_on: -> { params[:controller] == 'scholarship/iteration_participations' && ['new', 'create'].include?(params[:action]) }
)
unless (@iteration_participation.new_record? rescue true)
team_members.item(
:edit, I18n.t('scholarship_iteration_participations.edit.title'), edit_scholarship_iteration_participation_path(@iteration_participation),
highlights_on: -> { params[:controller] == 'scholarship/iteration_participations' && ['edit', 'update'].include?(params[:action]) }
)
end
end
end
end
end
end
end
end
primary.item :scholarship_teams, I18n.t('scholarship_teams.index.short_title'), scholarship_teams_path do |teams|
teams.item :new, I18n.t('general.new'), new_scholarship_team_path
unless (@team.new_record? rescue true)
teams.item :show, @team.name, scholarship_team_path(@team) do |team|
if can? :destroy, @team
team.item :destroy, I18n.t('general.destroy'), scholarship_team_path(@team), method: :delete, confirm: I18n.t('general.questions.are_you_sure')
end
team.item :show, I18n.t('general.details'), "#{scholarship_team_path(@team)}#top"
team.item :edit, I18n.t('general.edit'), edit_scholarship_team_path(@team) if can? :edit, @team
team.item :members, I18n.t('scholarship_team_memberships.index.title'), scholarship_team_members_path(@team) do |team_members|
team_members.item(
:new, I18n.t('scholarship_team_memberships.new.title'), new_scholarship_team_member_path(@team),
highlights_on: -> { params[:controller] == 'scholarship/team_memberships' && ['new', 'create'].include?(params[:action]) }
)
unless (@team_membership.new_record? rescue true)
team_members.item(
:edit, I18n.t('scholarship_team_memberships.edit.title'), edit_scholarship_team_membership_path(@team_membership),
highlights_on: -> { params[:controller] == 'scholarship/team_memberships' && ['edit', 'update'].include?(params[:action]) }
)
end
end
end
end
end
if user_signed_in?
primary.item :workflow, I18n.t('workflow.index.title'), scholarship_workflow_path do |workflow|
workflow.item :organization_owner, I18n.t('products.scholarship.workflow.organization_owner.index.title'), scholarship_workflow_organization_owner_index_path
workflow.item :team_leader, I18n.t('products.scholarship.workflow.team_leader.index.title'), scholarship_workflow_team_leader_index_path
end
end
instance_exec primary, ::Voluntary::Navigation::Base.(:authentication), &::Voluntary::Navigation.(:authentication)
end
end
end
|