forked from riseuplabs/crabgrass-core
/
navigation.rb
360 lines (299 loc) · 9.85 KB
/
navigation.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
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
define_navigation do
##
## HOME
# disabled for now
global_section :home do
label { :home.t }
visible { false } # !logged_in? || controller?(:account, :session, :root) }
url '/'
active { controller?(:account, :session, :root) }
end
##
##
## ME
##
global_section :me do
label { :me.t }
# visible { logged_in? }
url { logged_in? ? me_pages_path : '/' }
active { context?(:me) || controller?(:account, :session, :root) }
html :partial => '/layouts/global/nav/me_menu'
context_section :create_page do
label { :create_thing.t(:thing => :page.t) }
url { new_page_path }
active false
icon :plus
visible { @drop_down_menu }
end
# context_section :notices do
# label { :notices.t }
# url { me_home_path }
# active { controller?('me/notices') }
# icon :info
# end
context_section :pages do
label { :pages.t }
url { me_pages_path }
active { page_controller? }
icon :page_white_copy
end
# context_section :activities do
# label { :activities.t }
# url { me_activities_path }
# active { controller?('me/activities') }
# icon :transmit
# local_section :all do
# label "All Activities"
# url { me_activities_path }
# active { controller?('me/activities') and params[:view].empty? }
# end
# local_section :my do
# label "Mine"
# url { me_activities_path(:view => 'my') }
# active { controller?('me/activities') and params[:view] == 'my' }
# end
# local_section :friends do
# label "People"
# url { me_activities_path(:view => 'friends') }
# active { controller?('me/activities') and params[:view] == 'friends' }
# end
# local_section :groups do
# label "Groups"
# url { me_activities_path(:view => 'groups') }
# active { controller?('me/activities') and params[:view] == 'groups' }
# end
# end
# context_section :calendar do
# label "Calendar"
# url { me_events_path }
# active { controller?('me/events') }
# icon :date
# end
context_section :messages do
label { :messages.t }
url { me_discussions_path }
active { controller?('me/discussions', 'me/posts') }
icon :page_message
end
context_section :settings do
label { :settings.t }
url { me_settings_path }
active { controller?('me/settings', 'me/permissions', 'me/profile', 'me/requests', 'me/passwords', 'me/destroys') }
icon :control
local_section :settings do
label { :account_settings.t }
url { me_settings_path }
active { controller?('me/settings') }
end
local_section :permissions do
label { :permissions.t }
url { me_permissions_path }
active { controller?('me/permissions') }
end
local_section :profile do
label { :profile.t }
url { edit_me_profile_path }
active { controller?('me/profile') }
end
local_section :requests do
label { :requests.t }
url { me_requests_path }
active { controller?('me/requests') }
end
local_section :password do
label { :password.t }
url { edit_me_password_path }
active { controller?('me/passwords') }
end
local_section :destroy do
label { :destroy.t }
url { me_destroy_path }
active { controller?('me/destroys') }
end
end
end
##
## PEOPLE
##
global_section :people do
label { :people.t }
url :controller => 'people/directory'
active { controller?('people/') or context?(:user) }
html :partial => '/layouts/global/nav/people_menu'
context_section :no_context do
visible { context?(:none) }
active { context?(:none) }
local_section :all do
label { :all.t }
url { people_directory_path }
active { params[:path].empty? }
end
local_section :friends do
visible { logged_in? }
label { :friends.t }
url { people_directory_path(:path => ['contacts']) }
active { params[:path].try.include?('contacts') }
end
local_section :peers do
visible { logged_in? }
label { :peers.t }
url { people_directory_path(:path => ['peers']) }
active { params[:path].try.include?('peers') }
end
end
context_section :home do
label { :home.t }
icon :house
url { entity_path(@user) }
active { controller?('people/home') }
end
context_section :pages do
label { :pages.t }
icon :page_white_copy
url { person_pages_path(@user) }
active { page_controller? }
end
end
##
## GROUPS
##
global_section :group do
label { :groups.t }
url { groups_directory_path }
active { controller?('groups/') or @group or context?(:group) }
html :partial => '/layouts/global/nav/groups_menu'
context_section :directory do
#visible { context?(:none) and controller?('groups/directory') }
#active { context?(:none) and controller?('groups/directory') }
visible { context?(:none) }
active { context?(:none) }
local_section :all do
label { :all.t }
url { groups_directory_path }
active { controller?('groups/directory') and params[:path].empty? }
end
local_section :mygroups do
visible { logged_in? }
label { :my_groups.t }
url { groups_directory_path(:path => ['my']) }
active { controller?('groups/directory') and params[:path].try.include?('my') }
end
local_section :create do
label { :create_thing.t(:thing => :group.t) }
url { new_group_path }
active { controller?('groups/groups') }
icon :plus
end
end
context_section :home do
label { :home.t }
icon :house
url { entity_path(@group) }
active { controller?('groups/home', 'groups/wikis', 'wikis/versions', 'wikis/diffs') }
end
context_section :pages do
label { :pages.t }
icon :page_white_copy
url { group_pages_path(@group) }
active { page_controller? }
end
# context_section :calendar do
# label { :calendar.t }
# url { group_events_path(@group) }
# active { controller?('groups/events') }
# icon :date
# end
context_section :members do
visible { may_list_memberships? }
label { :members.t }
icon :user
url { group_memberships_path(@group) }
active { controller?('groups/memberships', 'groups/invites', 'groups/membership_requests') }
local_section :people do
visible { may_list_memberships? }
label { :people.t }
url { group_memberships_path(@group) }
active { controller?('groups/memberships') and params[:view] != 'groups' }
end
local_section :groups do
visible { may_list_memberships? and @group.network? }
label { :groups.t }
url { group_memberships_path(@group, :view => 'groups') }
active { controller?('groups/memberships') and params[:view] == 'groups' }
end
local_section :invites do
visible { may_create_group_invite? }
label { :send_invites.t }
url { new_group_invite_path(@group) }
active { controller?('groups/invites') }
end
local_section :requests do
visible { may_list_membership_requests? }
label { :membership_requests.t }
url { group_membership_requests_path(@group) }
active { controller?('groups/membership_requests') }
end
local_section :leave_group_link do
visible { may_leave_group? }
html { leave_group_link }
end
#local_section :membership_settings do
# visible { may_edit_group? }
# label { 'Membership Settings' }
# url { group_permissions_path(@group, :view => 'membership') }
# active false
#end
end
context_section :settings do
visible { may_admin_group? } #there were a few disjuncts here, but all were equivalent to may_admin_group?
label { :settings.t }
icon :control
url { group_settings_path(@group) }
active { controller?('groups/settings', 'groups/permissions', 'groups/profiles', 'groups/structures', 'groups/requests') }
local_section :settings do
visible { may_admin_group? }
label { :basic_settings.t }
url { group_settings_path(@group) }
active { controller?('groups/settings') }
end
local_section :permissions do
visible { may_edit_group_permissions? }
label { :permissions.t }
url { group_permissions_path(@group) }
active { controller?('groups/permissions') }
end
local_section :profile do
visible { may_edit_group_profile? }
label { :profile.t }
url { edit_group_profile_path(@group) }
active { controller?('groups/profiles') }
end
local_section :structure do
visible { may_show_group_structure? }
label { :structure.t }
url { group_structure_path(@group) }
active { controller?('groups/structures') }
end
local_section :requests do
visible { may_list_group_requests? }
label { :requests.t }
url { group_requests_path(@group) }
active { controller?('groups/requests') }
end
end
end
##
## GROUPS DIRECTORY
##
# global_section :group_directory do
# visible { @group.nil? }
# label "Groups"
# url { groups_directory_path }
# active { controller?('groups/') }
# html :partial => '/layouts/global/nav/groups_menu'
## section :place do
## end
## section :location do
## end
# end
end