Commit b32949bc63813d9bba8d2033ddaa0b32627f53f6

Files missed in previous commit

Commit diff

app/helpers/.LCKarticles_helper.rb~

 
0/home/mtkd/projects/gitlab/app/helpers/.LCKarticles_helper.rb~
toggle raw diff

app/helpers/articles_helper.rb

 
2020 out << %Q{<div class='articlebox #{article.article_type.to_s}'><div class='formattedtext'>}
2121 #
2222 # title
23 if use_permalink then
23 if use_permalink
2424 out << %Q{<h2 class='blacklink'>}
2525 out << %Q{#{article.project.title}: } if article.project.id > 1
2626 out << %Q{#{link_to_article(article)}</h2>}
3636 # date by user
3737 out << %Q{<h5>#{format_datetime_article(article.created_at)} by #{link_to(article.user.fullname, user_path(article.user))}}
3838 #
39 if article.category.id > 1 then
39 if article.category.id > 1
4040 out << %Q{ in <a href='/archives/category/#{to_slug(article.category.name)}'>#{article.category.name}</a>}
4141 else
4242 # if no category, show a project link (if available)
4949 out << %Q{, #{0} comments</h5>}
5050 #
5151 # body
52 if short then
52 if short
5353 article.body_summary.length > 0 ? out << article.body_summary : out << article.body
5454 else
5555 out << article.body
6868 out = %Q{<div id='archive'>}
6969 for article in articles
7070 #FIXME can remove the .to_s from the temp year/month variables
71 if year != article.created_at.year.to_s then
72 if year_started then
71 if year != article.created_at.year.to_s
72 if year_started
7373 out << %Q{</ul>} if month_started
7474 out << %Q{</li></ul>}
7575 end
7979 out << %Q{<h2>#{year}</h2><ul><li>}
8080 end
8181 #
82 if month != article.created_at.month.to_s then
82 if month != article.created_at.month.to_s
8383 out << %Q{</ul>} if month_started
8484 month_started = true
8585 month = article.created_at.month.to_s
110110 out << %Q{<td width=90>#{get_article_bullet(article.article_type)} #{article.article_type.to_s.capitalize}</td>}
111111 out << %Q{<td>#{link_to_article(article)}</td>}
112112 out << %Q{<td width=140>}
113 if article.project.id > 1 then
113 if article.project.id > 1
114114 out << link_to(article.project.title, article_project_path(article.project.slug))
115115 else
116116 #FIXME sitename/domainname aren't clear, using domainname mostly
129129 end
130130
131131 def apg_cell (col, a, u)
132 if a != nil then
132 if a != nil
133133 @c = @c + a.type_count.to_i
134134 out = %Q{<td style='border-top: 1px solid #ccc; background-color: #{col}'>}
135 if a.type_count.to_i > 0 then
135 if a.type_count.to_i > 0
136136 # if sitename row, use a different slug
137 if u == "" then
137 if u == ""
138138 #FIXME this is wrong, it should only show SiteName articles
139139 out << %Q{<a href='/archives/#{SITENAME}/#{a.article_type.to_s}'>#{a.type_count.to_s}</a>}
140140 else
154154 # project or sitename td
155155 out = %Q{<tr><th style='border-top: 1px solid #ccc;'>}
156156 # sitename or project name
157 if p == "Other" then
157 if p == "Other"
158158 out << %Q{#{link_to("Other", article_sitename_path)}}
159159 else
160160 #FIXME had to frig this until project routes merged
169169 out << apg_cell('#fff8ee', a[4], u)
170170 out << apg_cell('#eee', a[5], u)
171171 # total column
172# out << %Q{<td style='border-top: 1px solid #ccc;'>}
173# if @c.to_i > 0 then
174# out << %Q{<a href='/archives/}
175# # if sitename row, use a different slug
176# u == "" ? out << %Q{#{SITENAME}'>} : out << %Q{project/#{u}'>}
177# out << %Q{#{@c.to_s}</a>}
178# else
179# out << %Q{0}
180# end
181172 out << %Q{</td></tr>}
182173 out
183174 end
199199 out << rapg_row("issue", "12", "42")
200200 out << rapg_row("howto", "12", "55")
201201 out << rapg_row("other", "13", "45")
202 #out << %Q{<td style='padding-top: 4px'></td>}
203202 out << %Q{</tr>}
204203 out << %Q{</table>}
205204 out
toggle raw diff

app/models/.LCKproject.rb~

 
0/home/mtkd/projects/gitlab/app/models/.LCKproject.rb~
toggle raw diff

app/models/project.rb

 
153153 #
154154 def self.allowed_access (project_id, curruser)
155155 projects_allowed = Project.list_for_user(curruser)
156 p = find(:first, :conditions => ["status = '#{:active}' AND projects.id = '" << project_id.to_s << "' AND ( audience = '#{:public}' OR projects.id IN (" << projects_allowed << ") )"])
157 if p != nil then
158 return true
159 else
160 return false
161 end
156 find(:first, :conditions => ["status = '#{:active}' AND projects.id = '" << project_id.to_s << "' AND ( audience = '#{:public}' OR projects.id IN (" << projects_allowed << ") )"])
162157 end
163158
164159 #
199199 # Get a list of project_ids of a user is a members of in the format '1','2','3'
200200 #
201201 def self.list_for_user(user)
202 if user != nil then
202 if user
203203 list = ""
204204 projects = Member.find_by_user(user.id)
205205 unless projects.empty?
206206 start = true
207207 for project in projects
208 if not start then
209 list = list << ","
210 else
211 start = false
212 end
208 !start ? list = list << "," : start = false
213209 list = list << "'" << project.project_id.to_s << "'"
214210 end
215 return list
211 list
216212 else
217 return "'1'" # see below
213 "'1'" # see below
218214 end
219215 else
220 return "'1'" # Project.id 1 is no project (this is a bit of a frig really, without it 2 queries will be needed for all finds)
216 "'1'" # Project.id 1 is no project (this is a bit of a frig really, without it 2 queries will be needed for all finds)
221217 end
222218 end
223219
toggle raw diff