| 160 |
160 |
s.join "\n"
|
| 161 |
161 |
end
|
| 162 |
162 |
|
|
163 |
# Renders a tree of projects where the current user belongs
|
|
164 |
# as a nested set of unordered lists
|
|
165 |
# The given collection may be a subset of the whole project tree
|
|
166 |
# (eg. some intermediate nodes are private and can not be seen)
|
|
167 |
def render_my_project_hierarchy_with_tags(projects)
|
|
168 |
|
|
169 |
s = ''
|
|
170 |
|
|
171 |
original_project = @project
|
|
172 |
|
|
173 |
projects.each do |project|
|
|
174 |
if project.root? || !projects.include?(project.parent)
|
|
175 |
s << render_my_project_in_hierarchy_with_tags(project)
|
|
176 |
end
|
|
177 |
end
|
|
178 |
|
|
179 |
@project = original_project
|
|
180 |
|
|
181 |
if s != ''
|
|
182 |
a = ''
|
|
183 |
a << "<ul class='projects root'>\n"
|
|
184 |
a << s
|
|
185 |
a << "</ul>\n"
|
|
186 |
s = a
|
|
187 |
end
|
|
188 |
|
|
189 |
s
|
|
190 |
|
|
191 |
end
|
|
192 |
|
|
193 |
|
|
194 |
|
|
195 |
|
|
196 |
def render_my_project_in_hierarchy_with_tags(project)
|
|
197 |
|
|
198 |
s = ''
|
|
199 |
|
|
200 |
if User.current.member_of?(project)
|
|
201 |
|
|
202 |
# set the project environment to please macros.
|
|
203 |
@project = project
|
|
204 |
|
|
205 |
classes = (project.root? ? 'root' : 'child')
|
|
206 |
|
|
207 |
s << "<li class='#{classes}'><div class='#{classes}'>" +
|
|
208 |
link_to_project(project, {}, :class => "project my-project")
|
|
209 |
if project.is_public?
|
|
210 |
s << " <span class='public'>" << l("field_is_public") << "</span>"
|
|
211 |
else
|
|
212 |
s << " <span class='private'>" << l("field_is_private") << "</span>"
|
|
213 |
end
|
|
214 |
s << render_project_short_description(project)
|
|
215 |
|
|
216 |
s << l(:tags) << ": "
|
|
217 |
s << project.tag_counts.collect{ |t| render_project_tag_link(t) }.join(', ')
|
|
218 |
|
|
219 |
s << "</div>\n"
|
|
220 |
|
|
221 |
cs = ''
|
|
222 |
project.children.each do |child|
|
|
223 |
cs << render_my_project_in_hierarchy(child)
|
|
224 |
end
|
|
225 |
|
|
226 |
if cs != ''
|
|
227 |
s << "<ul class='projects'>\n" << cs << "</ul>\n";
|
|
228 |
end
|
|
229 |
|
|
230 |
end
|
|
231 |
|
|
232 |
s
|
|
233 |
|
|
234 |
end
|
|
235 |
|
|
236 |
|
|
237 |
|
| 163 |
238 |
private
|
| 164 |
239 |
|
| 165 |
240 |
# copied from search_helper. This one doesn't escape html or limit the text length
|