| lib/septic/wiki.rb | |
| 30 | @@ -30,7 +30,11 @@ |
| 30 | |
| 31 | case prefix |
| 32 | when 'Image' |
| 33 | link = '<img src="%s">' % [attachment_for(resource)] |
| 34 | if resource.match('^https?://') |
| 35 | link = '<img src="%s" />' % [resource] |
| 36 | else |
| 37 | link = '<img src="%s" />' % [attachment_for(resource)] |
| 38 | end |
| 39 | when 'File' |
| 40 | link = '<a href="%s">%s</a>' % [attachment_for(resource), text.empty? ? resource : text] |
| 41 | when 'Code' |
| ... | |
| app/views/help/wiki_syntax.rhtml | |
| 8 | @@ -8,6 +8,7 @@ |
| 8 | <h3>Images</h3> |
| 9 | |
| 10 | <ul> |
| 11 | <li>External: [[Image:http://domain/path]]</li> |
| 12 | <li>Attachment: [[Image:attachmentname]]</li> |
| 13 | </ul> |
| 14 | |
| ... | |
| 24 | @@ -23,6 +24,8 @@ |
| 24 | <h3>Special links</h3> |
| 25 | |
| 26 | <ul> |
| 27 | <li>Code link: [[Code:branch:revision/path]]</li> |
| 28 | <li>Commit link: [[Commit:revision]]</li> |
| 29 | <li>Task link: [[Task:id]]</li> |
| 30 | <li>User link: [[User:login]]</li> |
| 31 | </ul> |
| ... | |
| lib/septic/activity/activity.rb | |
| 13 | @@ -13,15 +13,16 @@ |
| 13 | # Base class for activities used for aggregrating work (task changes, |
| 14 | # commits, wiki page edits) sorted by date. |
| 15 | class Activity |
| 16 | attr_reader :icon, :date, :user, :link, :subject, :body |
| 17 | attr_reader :icon, :project, :date, :user, :link, :subject, :body |
| 18 | end |
| 19 | |
| 20 | class MailActivity < Activity |
| 21 | def initialize(mail) |
| 22 | @icon = 'icons/activity_mail.png' |
| 23 | @project = mail.mailing_list.project |
| 24 | @date = mail.created_at |
| 25 | @user = mail.user |
| 26 | @link = nil |
| 27 | @link = "/projects/#{@project.name}/mailing_lists/#{mail.mailing_list.name}/mail?mail_id=#{mail.id}" |
| 28 | @subject = mail.subject |
| 29 | @body = '' |
| 30 | end |
| ... | |
| 31 | @@ -30,8 +31,9 @@ |
| 31 | class TaskActivity < Activity |
| 32 | def initialize(task, is_new) |
| 33 | @icon = 'icons/activity_task.png' |
| 34 | @project = task.project |
| 35 | @user = task.user |
| 35 | @link = nil |
| 37 | @link = "/projects/#{@project.name}/tasks/#{task.id}" |
| 38 | @body = '' |
| 39 | if is_new |
| 40 | @date = task.created_at |
| ... | |
| 48 | @@ -46,28 +48,22 @@ |
| 48 | class WikiActivity < Activity |
| 49 | def initialize(wiki_page_version) |
| 50 | @icon = 'icons/activity_wiki.png' |
| 51 | @project = wiki_page_version.wiki_page.project |
| 52 | @date = wiki_page_version.updated_at |
| 51 | @user = nil |
| 52 | @user_id = wiki_page_version.user_id |
| 53 | @link = nil |
| 56 | @user = wiki_page_version.wiki_page.user |
| 57 | @link = "/projects/#{@project.name}/wikis/#{wiki_page_version.name}" |
| 58 | @subject = "#{wiki_page_version.name}: #{wiki_page_version.comment}" |
| 59 | @body = '' |
| 60 | end |
| 59 | |
| 60 | def user |
| 61 | if @user.nil? |
| 62 | @user = User.find_by_id(@user_id) |
| 63 | end |
| 64 | return @user |
| 65 | end |
| 68 | end |
| 69 | |
| 70 | class ScmActivity < Activity |
| 71 | def initialize(commit) |
| 72 | @icon = 'icons/activity_scm.png' |
| 73 | @project = commit.repository.project |
| 74 | @date = commit.created_at |
| 75 | @user = commit.user |
| 74 | @link = nil |
| 77 | @link = "/projects/#{@project.name}/commits/#{commit.id}" |
| 78 | @subject = commit.title |
| 79 | if commit.body.nil? or commit.body.empty? |
| 80 | @body = '' |
| ... | |
| app/controllers/commits_controller.rb | |
| 77 | @@ -77,12 +77,16 @@ |
| 77 | private |
| 78 | # Before filter getting commit |
| 79 | def find_commit |
| 80 | @commit = @repository.commits.find_by_id(params[:id], :include => :commit_comments) |
| 81 | @commit = @repository.commits.find_by_id(params[:id], :include => :commit_comments) unless @repository.nil? |
| 82 | if @commit.nil? |
| 83 | flash[:error] = 'No such commit with id "%s"' % [params[:id]] |
| 84 | redirect_to(project_repository_path(@project)) |
| 85 | end |
| 86 | end |
| 87 | |
| 88 | # Before filter getting repository |
| 89 | def find_repository |
| 90 | @repository = @project.repository |
| 91 | @repository = @project.repository unless @project.nil? |
| 92 | end |
| 93 | |
| 94 | # Fill @page_actions |
| ... | |
| app/models/wiki_page.rb | |
| 25 | @@ -25,9 +25,11 @@ |
| 25 | :body => { :store => :yes } } |
| 26 | |
| 27 | belongs_to :user |
| 28 | belongs_to :project |
| 29 | has_many :file_infos, :as => :fileable, :order => 'file_infos.created_at DESC' |
| 30 | |
| 31 | validates_associated :user |
| 32 | validates_associated :project |
| 33 | validates_presence_of :name |
| 34 | validates_presence_of :body |
| 35 | |
| ... | |
| app/views/activity/_activity_list.rhtml | |
| 4 | @@ -4,7 +4,10 @@ |
| 4 | <% activity_date.activities.each do |activity| %> |
| 5 | <p style="margin-top: 0px; margin-left: 100px; margin-bottom: 0px;"> |
| 6 | <%= image_tag activity.icon %> |
| 7 | <span style="font-size: small; font-weight: bold;"><%= h(activity.subject) %></span> |
| 8 | <span style="font-size: small; font-weight: bold;"> |
| 9 | [<%= link_to(h(activity.project.name), activity.project) %>] |
| 10 | <%= link_to(h(activity.subject), activity.link) %> |
| 11 | </span> |
| 12 | <% unless activity.body.empty? %> |
| 13 | <br /><span style="font-size: x-small;"><%= activity.body %></span> |
| 14 | <% end %> |
| ... | |