Commit e92f1ea43d286298d7ed0bd0b448b9b04dd5047a

Increase wiki view count
Wiki tweaks

Commit diff

app/controllers/articles_controller.rb

 
44class ArticlesController < ApplicationController
55
66 after_filter :after_article
7
87
98 # Show all articles, render grouped by year, month
109 def index
toggle raw diff

app/controllers/wikis_controller.rb

 
11class WikisController < ApplicationController
2
3 after_filter :after_wiki
24
35 def index
46 if params[:project_id] != nil
174174 def to_slug(s)
175175 s.gsub(/\W+/, ' ').strip.downcase.gsub(/\ +/, '-')
176176 end
177
178
179protected
180
181 # Increase view count for a wiki page
182 def after_wiki
183 if action_name == "show" and @wiki != nil then
184 @wiki.views = @wiki.views + 1
185 @wiki.save!
186 end
187 end
188
177189
178190end
179191
toggle raw diff

app/views/wikis/ac_project_index.html.erb

 
99
1010<tr>
1111 <th width='<%= STYLE_TABLE_COL_WIDTH_ID %>'>ID</th>
12 <th>Title</th>
12 <th><%= @project.title %> Wiki Pages</th>
1313 <% if @member %>
1414 <th width='100'>Status</th>
15 <th width='100'>Format</th>
1615 <th width='180'>Slug</th>
1716 <% end %>
17 <th width='80'>Views</th>
18 <th width='100'>Format</th>
1819 <th width='<%= STYLE_TABLE_COL_WIDTH_DDMMYYHHMM %>'>Created</th>
1920 <% if @member %>
2021 <th colspan='2' width='<%= STYLE_TABLE_COL_WIDTH_ACTION_SHORT.to_i * 2 %>'></th>
2828 <td><%= link_to wiki.title, project_wiki_path(@project.slug, wiki.slug) %></td>
2929 <% if @member %>
3030 <td><%= wiki.status.to_s.capitalize %></td>
31 <td><%= wiki.format.to_s.capitalize %></td>
3231 <td>/<%= wiki.slug %></td>
3332 <% end %>
33 <td><%= wiki.views.to_s %></td>
34 <td><%= wiki.format.to_s.capitalize %></td>
3435 <td><%= format_datetime_ddmmyyhhmm(wiki.created_at) %></td>
3536 <% if @member %>
3637 <td>Edit</td>
toggle raw diff

test/fixtures/article_bodies/_gitlab-dev-team-collaboration.txt

 
1<p>Fanatical about speed, underwhelmed by the usability of existing hosted tools, and tired of multiple logins, I decided to mash together a site using OSS.</p>
1<p>Underwhelmed by the usability of existing hosted tools, and tired of multiple logins, I decided to mash together a site using OSS.</p>
22<p>Two weeks later it was clear splicing together Wordpress, Wikimedia etc. was just moving the problem, so I started to code a new app from scratch - that could share a login and share a model.</p>
33<p>The key requirements were:</p>
44<ul>
toggle raw diff

test/fixtures/article_bodies/_gitlab-renamed-and-forked.txt

 
1<p>The project has been renamed to Gitlab (it's more meaningful and the domain was available), it will be hosted on the <a href='http://www.itlab.org'>gitlab.org</a> domain.</p>
1<p>The <a href='http://www.gitlab.org/projects/gitlab'>project</a> has been renamed to Gitlab (it's more meaningful and the domain was available), it will be hosted on the <a href='http://www.itlab.org'>gitlab.org</a> domain.</p>
22
3<p>I will probably fork the project from Gitorious this week and stop updating. Gitorious is about to add Krawek's events changes which
3<p>I will probably fork the project from <a href='http://gitorious.org'>Gitorious</a> this week and stop updating. Gitorious is about to add Krawek's events changes which
44conflict with events in Gitlab (also I'm now using different comment and project membership models so it's getting harder
55to merge).</p>
66
toggle raw diff

test/fixtures/articles.yml

 
55
66A005:
77 id: 5
8 title: "Renamed and forked"
8 title: "Renamed and Forked"
99 body: "<%= File.open("#{RAILS_ROOT}/test/fixtures/article_bodies/_gitlab-renamed-and-forked.txt",'r').read %>"
1010 body_summary: "<%= File.open("#{RAILS_ROOT}/test/fixtures/article_bodies/_gitlab-renamed-and-forked.txt",'r').read %>"
1111 article_type: :news
toggle raw diff