Onur Küçük (onur@ozguryazilim.com.tr)
Redmine, Web tabanlı proje yönetimi,iş ve hata takip sistemidir
create vendor/plugins/redmine_issue_notes/app/controllers create vendor/plugins/redmine_issue_notes/app/helpers create vendor/plugins/redmine_issue_notes/app/models create vendor/plugins/redmine_issue_notes/app/views create vendor/plugins/redmine_issue_notes/db/migrate create vendor/plugins/redmine_issue_notes/lib/tasks create vendor/plugins/redmine_issue_notes/assets/images create vendor/plugins/redmine_issue_notes/assets/javascripts create vendor/plugins/redmine_issue_notes/assets/stylesheets create vendor/plugins/redmine_issue_notes/lang create vendor/plugins/redmine_issue_notes/config/locales create vendor/plugins/redmine_issue_notes/test create vendor/plugins/redmine_issue_notes/README.rdoc create vendor/plugins/redmine_issue_notes/init.rb create vendor/plugins/redmine_issue_notes/config/locales/en.yml create vendor/plugins/redmine_issue_notes/test/test_helper.rb
require 'redmine' Redmine::Plugin.register :redmine_issue_notes do name 'Redmine Issue Notes plugin' author 'Onur Küçük' description 'This is a plugin for Redmine' version '0.0.1' url 'http://www.ozguryazilim.com.tr/redmine_issue_notes' author_url 'http://www.ozguryazilim.com.tr' requires_redmine :version_or_higher => '1.4.0' end
class CreateIssueNotes < ActiveRecord::Migration def self.up create_table :issue_notes do |t| t.column :issue_id, :integer t.column :comment, :string end end def self.down drop_table :issue_notes end end
class IssueNote < ActiveRecord::Base unloadable belongs_to :issue end
lib ├── redmine_issue_notes │ └── patches │ └── issue_notes_patch.rb └── redmine_issue_notes.rb
require_dependency 'issue' module RedmineIssueNotes module Patches module IssueNotesPatch def self.included(base) # :nodoc: base.send(:include, InstanceMethods) base.class_eval do unloadable has_many :issue_notes, :dependent => :destroy end end module InstanceMethods def issue_notes_count issue_notes.count end end end end end
require 'redmine' require 'dispatcher' Redmine::Plugin.register :redmine_issue_notes do name 'Redmine Issue Notes plugin' author 'Onur Küçük' description 'This is a plugin for Redmine' version '0.0.1' url 'http://www.ozguryazilim.com.tr/redmine_issue_notes' author_url 'http://www.ozguryazilim.com.tr' requires_redmine :version_or_higher => '1.4.0' end Dispatcher.to_prepare :redmine_issue_notes do unless Issue.included_modules.include?(RedmineIssueNotes::Patches::IssueNotesPatch) Issue.send(:include, RedmineIssueNotes::Patches::IssueNotesPatch) end end
require_dependency 'issues_controller' module RedmineIssueNotes module Patches module IssuesControllerNotesPatch def self.included(base) # :nodoc: base.send(:include, InstanceMethods) base.class_eval do unloadable # to make sure plugin is loaded in development mode alias_method_chain :show, :notes end end module InstanceMethods def show_with_notes @issue_notes = @issue.issue_notes show_without_notes end end end end end
require 'redmine' require 'dispatcher' Redmine::Plugin.register :redmine_issue_notes do name 'Redmine Issue Notes plugin' author 'Onur Küçük' description 'This is a plugin for Redmine' version '0.0.1' url 'http://www.ozguryazilim.com.tr/redmine_issue_notes' author_url 'http://www.ozguryazilim.com.tr' requires_redmine :version_or_higher => '1.4.0' end Dispatcher.to_prepare :redmine_issue_notes do unless Issue.included_modules.include?(RedmineIssueNotes::Patches::IssueNotesPatch) Issue.send(:include, RedmineIssueNotes::Patches::IssueNotesPatch) end unless IssuesController.included_modules.include?(RedmineIssueNotes::Patches::IssuesControllerNotesPatch) IssuesController.send(:include, RedmineIssueNotes::Patches::IssuesControllerNotesPatch) end end
<%= render_custom_fields_rows(@issue) %> <%= call_hook(:view_issues_show_details_bottom, :issue => @issue) %>
module RedmineIssueNotes module Hooks class ViewsIssuesHook < Redmine::Hook::ViewListener render_on :view_issues_show_details_bottom, :partial => 'issues/show_notes' end end end
<tr> <th>Notlar</th> <% @issue_notes.each do |note| %> <tr> <td>* <%= note.comment %></td> </tr> <% end %> </tr>
require 'redmine' require 'dispatcher' Redmine::Plugin.register :redmine_issue_notes do name 'Redmine Issue Notes plugin' author 'Onur Küçük' description 'This is a plugin for Redmine' version '0.0.1' url 'http://www.ozguryazilim.com.tr/redmine_issue_notes' author_url 'http://www.ozguryazilim.com.tr' requires_redmine :version_or_higher => '1.4.0' end Dispatcher.to_prepare :redmine_issue_notes do unless Issue.included_modules.include?(RedmineIssueNotes::Patches::IssueNotesPatch) Issue.send(:include, RedmineIssueNotes::Patches::IssueNotesPatch) end unless IssuesController.included_modules.include?(RedmineIssueNotes::Patches::IssuesControllerNotesPatch) IssuesController.send(:include, RedmineIssueNotes::Patches::IssuesControllerNotesPatch) end end require 'redmine_issue_notes/hooks/views_issues_hook'
class IssueNotesController < ApplicationController unloadable before_filter :find_issue def index @issue_notes = @issue.issue_notes end private def find_issue @issue = Issue.find_by_id(params[:issue_id]) end end
ActionController::Routing::Routes.draw do |map| map.issue_notes_index('projects/:project_id/issue/:issue_id/issue_notes', :controller => 'issue_notes', :action => 'index', :conditions => {:method => :get} ) end
<h1> Notlar </h1> <p style="font-weight:bold;"><%= link_to_issue( @issue ) %></p> <% if @issue.issue_notes.any? %> <table class="list"> <thead> <tr> <th style="text-align:left;">ID</th> <th style="text-align:left;">Comment</th> </tr> </thead> <tbody> <% @issue_notes.each do |issue_note| %> <tr class="<%= cycle 'odd', 'even' %>"> <td><%= issue_note.id %></td> <td><%= issue_note.comment%></td> </tr> <% end %> </tbody> </table> <% end %>
<table> <tr> <td> <%= select_tag 'settings[note_prefix]', options_for_select(['Çok Önemli', 'Hemen Yapıla'], settings['note_prefix'])%> </td> </tr> </table>
settings :default => {:note_prefix=> 'Çok Önemli'}, :partial => 'issue_notes/settings'
note_prefix = Setting[:redmine_issue_notes][note_prefix]
project_module :redmine_issue_notes do permission :project_notes, {:issue_notes => :project_notes}, :require => :member end menu( :project_menu, :project_notes, {:controller => 'issue_notes', :action => 'project_notes'}, :caption => 'Proje Notları', :param => :project_id, :after => :new_issue )
tr: issue_notes: notes: 'Notlar'
<h1> Notlar </h1>
<h1> t('issue_notes.notes') </h1>
<%= javascript_include_tag 'my_custom_javascript', :plugin => 'redmine_issue_notes' %>
<%= stylesheet_link_tag 'my_custom_stylesheet', :plugin => 'redmine_issue_notes' %>
assets/ ├── javascripts │ └── my_custom_javascript.js └── stylesheets └── my_custom_stylesheet.css
source :rubygems gem "diff-lcs", "~> 1.1.3"
namespace :redmine_issue_notes do desc "Tüm notları sil" task :destroy_notes => :environment do IssueNote.destroy_all end end
Daha fazla bilgi almak için
class CreateIssueNotes < ActiveRecord::Migration def self.up create_table :issue_notes do |t| t.column :issue_id, :integer t.column :comment, :string end end def self.down drop_table :issue_notes end end
ActionController::Routing::Routes.draw do |map| map.issue_issue_notes( 'projects/:project_id/issue/:issue_id/issue_notes/:id', :controller => 'issue_notes', :action => 'show', :conditions => {:method => :get} ) end