redmine

Initial commit

This diff is collapsed. Click to expand it.
require 'redmine'
require_dependency "redmine_cps/patches/app/helpers/application_helper"
Redmine::Plugin.register :redmine_cps do
name 'Integration to CPS plugin'
author 'Dmitry Yu Okunev'
author_url 'https://github.com/xaionaro/'
description 'A plugin to intergrate Redmine to NRNU MEPhI CPS system'
url 'https://gitlab.ut.mephi.ru/ut/redmine_cps'
version '0.0.1'
end
... ...
# encoding: UTF-8
require 'application_helper'
module CPS
module ApplicationHelperPatch
def self.included(base)
base.extend(ClassMethods)
base.send(:include, InstanceMethods)
base.class_eval do
alias_method_chain :link_to_user, :cps
end
end
module ClassMethods
end
module InstanceMethods
def link_to_user_with_cps(user, options={})
if user.is_a?(User)
name = h(user.name(options[:format]))
if user.active? || (User.current.admin? && user.logged?)
link_to "#{name}", user_path(user), {:class => user.css_classes, :title => "#{user.lastname} #{user.firstname}; #{user.appointment}"}
else
name
end
else
h(user.to_s)
end
end
end
end
end
ApplicationHelper.send(:include, CPS::ApplicationHelperPatch)
... ...