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
|
# File 'lib/voluntary_recruiting/navigation.rb', line 44
def self.(resource)
case resource
when :vacancies
Proc.new do |primary, options|
primary.item :vacancies, I18n.t('vacancies.index.title'), vacancies_path do |vacancies|
vacancies.item :new, I18n.t('general.new'), new_vacancy_path
unless (@vacancy.new_record? rescue true)
vacancies.item :show, "#{@vacancy.name} @ #{@vacancy.project.name}", vacancy_path(@vacancy) do |vacancy|
if can? :destroy, @vacancy
vacancy.item :destroy, I18n.t('general.destroy'), vacancy_path(@vacancy), method: :delete, confirm: I18n.t('general.questions.are_you_sure')
end
vacancy.item :show, I18n.t('general.details'), "#{vacancy_path(@vacancy)}#top"
vacancy.item :edit, I18n.t('general.edit'), edit_vacancy_path(@vacancy) if can? :edit, @vacancy
vacancy.item :candidatures, I18n.t('candidatures.index.title'), vacancy_candidatures_path(@vacancy) do |candidatures|
candidatures.item :new, I18n.t('general.new'), new_vacancy_candidature_path(@vacancy)
unless (@candidature.new_record? rescue true)
candidatures.item(
:show, I18n.t('activerecord.models.candidature') + " of #{@candidature.resource.name} @ #{@candidature.vacancy.project.name}",
candidature_path(@candidature)
) do |candidature|
if can? :destroy, @candidature
candidature.item :destroy, I18n.t('general.destroy'), candidature_path(@candidature), method: :delete, confirm: I18n.t('general.questions.are_you_sure')
end
candidature.item :show, I18n.t('general.details'), "#{candidature_path(@candidature)}#top"
candidature.item :edit, I18n.t('general.edit'), edit_candidature_path(@candidature) if can? :edit, @candidature
candidature.item :comments, I18n.t('comments.index.title'), "#{candidature_path(@candidature)}#comments" do ||
.item(:new, I18n.t('general.new'), new_candidature_comment_path(@candidature)) if @comment
if @comment.try(:id) && can?(:edit, @comment)
.item(:edit, I18n.t('general.edit'), (@comment))
end
end
end
end
end
vacancy.item :comments, I18n.t('comments.index.title'), "#{vacancy_path(@vacancy)}#comments" do ||
.item(:new, I18n.t('general.new'), (@vacancy)) if @comment && !@candidature
if @comment.try(:id) && can?(:edit, @comment)
.item(:edit, I18n.t('general.edit'), (@comment))
end
end
if options[:after_resource_has_many]
instance_exec vacancy, {}, &options[:after_resource_has_many]
end
end
end
end
end
end
end
|