comparison app/helpers/projects_helper.rb @ 100:1412841d48a3 cannam

* Projects page: If I'm logged in but have no projects, use single All Projects heading * Projects page: Rename "Other Projects" to "Everyone Else's Projects" * Projects page: Remove stars from my project links; remove key explaining star * Projects page: Reorder top-right nav links to isolate the "+ New Project" icon
author Chris Cannam
date Thu, 16 Dec 2010 16:29:06 +0000
parents dc22c3eb3c81
children bc91f2025d05
comparison
equal deleted inserted replaced
99:4f06dd055f19 100:1412841d48a3
146 # Renders a tree of projects where the current DOES NOT belong 146 # Renders a tree of projects where the current DOES NOT belong
147 # as a nested set of unordered lists 147 # as a nested set of unordered lists
148 # The given collection may be a subset of the whole project tree 148 # The given collection may be a subset of the whole project tree
149 # (eg. some intermediate nodes are private and can not be seen) 149 # (eg. some intermediate nodes are private and can not be seen)
150 def render_other_project_hierarchy(projects) 150 def render_other_project_hierarchy(projects)
151 a = ''
151 s = '' 152 s = ''
153
154 # True if user has any projects (affects the heading used)
155 t = FALSE
152 156
153 if projects.any? 157 if projects.any?
154 ancestors = [] 158 ancestors = []
155 original_project = @project 159 original_project = @project
156 projects.each do |project| 160 projects.each do |project|
175 s << "<li class='#{classes}'><div class='#{classes}'>" + 179 s << "<li class='#{classes}'><div class='#{classes}'>" +
176 link_to_project(project, {}, :class => "project #{User.current.member_of?(project) ? 'my-project' : nil}") 180 link_to_project(project, {}, :class => "project #{User.current.member_of?(project) ? 'my-project' : nil}")
177 s << "<div class='wiki description'>#{textilizable(project.short_description, :project => project)}</div>" unless project.description.blank? 181 s << "<div class='wiki description'>#{textilizable(project.short_description, :project => project)}</div>" unless project.description.blank?
178 s << "</div>\n" 182 s << "</div>\n"
179 ancestors << project 183 ancestors << project
184 else
185 t = TRUE
180 end 186 end
181 end 187 end
182 188
183 s << ("</li></ul>\n" * ancestors.size) 189 s << ("</li></ul>\n" * ancestors.size)
184 @project = original_project 190 @project = original_project
185 end 191 end
186 192
187 193 if t == TRUE
188 s 194 a << "<h2>"
195 a << l("label_other_project_plural")
196 a << "</h2>"
197 a << s
198 else
199 a << "<h2>"
200 a << l("label_project_all")
201 a << "</h2>"
202 a << s
203 end
204
205 a
189 end 206 end
190 207
191 208
192 209
193 # Returns a set of options for a select field, grouped by project. 210 # Returns a set of options for a select field, grouped by project.