gist and system info support have been added
This commit is contained in:
parent
3e12e904b3
commit
7939fe9eaa
@ -109,6 +109,11 @@ Note: Redmine must be restarted after changing "Custom Help URL"</tt> value befo
|
||||
|
||||
## Changelog
|
||||
|
||||
### 0.5.6
|
||||
|
||||
- system information uptime and uname have been added
|
||||
- gist macro support
|
||||
|
||||
### 0.5.5
|
||||
|
||||
- dependency with deface (used to overview views)
|
||||
|
5
app/overrides/add_system_info.rb
Normal file
5
app/overrides/add_system_info.rb
Normal file
@ -0,0 +1,5 @@
|
||||
Deface::Override.new virtual_path: 'admin/info',
|
||||
name: 'add-system_info',
|
||||
insert_after: 'table.list',
|
||||
original: '2de504b0ea475c3c109480136e6bb2b83368acc2',
|
||||
partial: 'admin/system_info'
|
8
app/views/admin/_system_info.html.erb
Normal file
8
app/views/admin/_system_info.html.erb
Normal file
@ -0,0 +1,8 @@
|
||||
<table class="list">
|
||||
<tr class="<%= cycle 'odd', 'even' %>">
|
||||
<td class="name"><%= l(:label_system_info) %>:</td><td class="name"><%= system_info %></td>
|
||||
</tr>
|
||||
<tr class="<%= cycle 'odd', 'even' %>">
|
||||
<td class="name"><%= l(:label_uptime) %>:</td><td class="name"><%= system_uptime %></td>
|
||||
</tr>
|
||||
</table>
|
@ -1,6 +1,6 @@
|
||||
<%
|
||||
if @users_by_role.any?
|
||||
view_roles = get_memberbox_view_roles
|
||||
view_roles = memberbox_view_roles
|
||||
if view_roles.count>0
|
||||
%>
|
||||
<div class="members box">
|
||||
|
@ -64,6 +64,9 @@ de:
|
||||
rule_issue_status_change_info: "Use Case: Zur Abnahme der Tickets sollen alle Tickets automatisch dem Ersteller des Tickets zugeordnet werden, sofern kein anderer Benutzer ausgewählt wird."
|
||||
label_rule_issue_current_user_status: "Der Ticketstatus x ist nur erlaubt, wenn \"Zugewiesen an\" der aktuelle Benutzer zugewiesen wird."
|
||||
rule_issue_current_user_status_info: "Use Case: Ein Benutzer soll nur den Status auf \"In Progress\" selbst stellen können, um damit anzuzeigen, dass er an dem Ticket (gerade) arbeitet."
|
||||
days: Tage
|
||||
label_system_info: Systeminformation
|
||||
label_uptime: Betriebszeit
|
||||
activerecord:
|
||||
errors:
|
||||
messages:
|
||||
|
@ -64,6 +64,9 @@ en:
|
||||
rule_issue_status_change_info: "Use Case: issues should be automatically assigned to autor, if the status changes to \"Approval\"."
|
||||
label_rule_issue_current_user_status: "Current issue status x is only allowed if \"Assignee\" is the current user."
|
||||
rule_issue_current_user_status_info: "Use Case: Users are only allowed to change the status to \"In Progress\" if they are the person who is actually working on the issue right now."
|
||||
days: days
|
||||
label_system_info: System info
|
||||
label_uptime: Uptime
|
||||
activerecord:
|
||||
errors:
|
||||
messages:
|
||||
|
@ -17,6 +17,7 @@ if ActiveRecord::Base.connection.table_exists?(:settings)
|
||||
require 'redmine_tweaks/patches/issue_patch'
|
||||
require 'redmine_tweaks/patches/wiki_patch'
|
||||
require 'redmine_tweaks/patches/wiki_controller_patch'
|
||||
require 'redmine_tweaks/wiki_macros/gist'
|
||||
require 'redmine_tweaks/wiki_macros/project_macros'
|
||||
require 'redmine_tweaks/wiki_macros/user_macros'
|
||||
require 'redmine_tweaks/wiki_macros/date_macros'
|
||||
|
@ -4,7 +4,27 @@
|
||||
# Redmine Tweak helper functions
|
||||
module RedmineTweaks
|
||||
module Helper
|
||||
def get_memberbox_view_roles
|
||||
def system_uptime
|
||||
if windows_platform?
|
||||
`net stats srv | find "Statist"`
|
||||
else
|
||||
"#{`uptime | awk '{print $3}'`} #{l(:days)}"
|
||||
end
|
||||
end
|
||||
|
||||
def system_info
|
||||
if windows_platform?
|
||||
'unknown'
|
||||
else
|
||||
`uname -a`
|
||||
end
|
||||
end
|
||||
|
||||
def windows_platform?
|
||||
true if /cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM
|
||||
end
|
||||
|
||||
def memberbox_view_roles
|
||||
view_roles = []
|
||||
@users_by_role.keys.sort.each do |role|
|
||||
if !role.permissions.include?(:hide_in_memberbox) ||
|
||||
|
@ -26,7 +26,7 @@ module RedmineTweaks
|
||||
when 3 then file = RedmineTweaks.get_garfield(Date.parse(args[2] + '-' + args[1] + '-' + args[0]))
|
||||
when 0 then file = RedmineTweaks.get_garfield(Time.zone.today)
|
||||
else
|
||||
out = '<pre>Error in garfield macro. The correct usage is {{garfield([<yyyy>,<mm>,<dd>])}}.</pre>'
|
||||
return '<pre>Error in garfield macro. The correct usage is {{garfield([<yyyy>,<mm>,<dd>])}}.</pre>'
|
||||
end
|
||||
|
||||
image = url_for(controller: 'garfield', action: 'show', name: file[:name], type: file[:type])
|
||||
|
15
lib/redmine_tweaks/wiki_macros/gist.rb
Executable file
15
lib/redmine_tweaks/wiki_macros/gist.rb
Executable file
@ -0,0 +1,15 @@
|
||||
# Redmine Tweaks plugin for Redmine
|
||||
# Copyright (C) 2013-2015 AlphaNodes GmbH
|
||||
|
||||
# Gist wiki macros
|
||||
module RedmineTweaks
|
||||
module WikiMacros
|
||||
Redmine::WikiFormatting::Macros.register do
|
||||
desc 'gist embed'
|
||||
# Register gist macro
|
||||
macro :gist do |_obj, args|
|
||||
javascript_tag(nil, src: "https://gist.github.com/#{args[0]}.js") unless args.empty?
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -3,7 +3,8 @@
|
||||
require File.expand_path(File.dirname(__FILE__) + '/../../../test/test_helper')
|
||||
|
||||
# Redmine Tweaks helper class for tests
|
||||
class RedmineTweaks::TestCase
|
||||
module RedmineTweaks
|
||||
class TestCase
|
||||
include ActionDispatch::TestProcess
|
||||
def self.plugin_fixtures(plugin, *fixture_names)
|
||||
plugin_fixture_path = "#{Redmine::Plugin.find(plugin).directory}/test/fixtures"
|
||||
@ -11,7 +12,7 @@ class RedmineTweaks::TestCase
|
||||
fixture_names = Dir["#{plugin_fixture_path}/**/*.{yml}"]
|
||||
fixture_names.map! { |f| f[(plugin_fixture_path.size + 1)..-5] }
|
||||
else
|
||||
fixture_names = fixture_names.flatten.map { |n| n.to_s }
|
||||
fixture_names = fixture_names.flatten.map(&:to_s)
|
||||
end
|
||||
|
||||
ActiveRecord::Fixtures.create_fixtures(plugin_fixture_path, fixture_names)
|
||||
@ -43,4 +44,5 @@ class RedmineTweaks::TestCase
|
||||
EnabledModule.create(project: project, name: 'issue_tracking')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user