-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
13 changed files
with
587 additions
and
545 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# encoding: utf-8 | ||
require_dependency 'redmine_drawio' | ||
require File.expand_path('../lib/redmine_drawio', __FILE__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,22 @@ | ||
# encoding: UTF-8 | ||
|
||
class DMSF_helper | ||
def self.deep_folder_search(project, folderPath) | ||
return nil if folderPath == "." | ||
search_folder_with_path(project, nil, folderPath.split(File::SEPARATOR)) | ||
end | ||
|
||
def self.search_folder_with_path(project, parent, path) | ||
folder = DmsfFolder.visible.where(:project_id => project.id, :dmsf_folder_id => parent, :title => path[0]).first | ||
module RedmineDrawio | ||
module Helpers | ||
class DrawioDmsfHelper | ||
def self.deep_folder_search(project, folderPath) | ||
return nil if folderPath == "." | ||
search_folder_with_path(project, nil, folderPath.split(File::SEPARATOR)) | ||
end | ||
|
||
def self.search_folder_with_path(project, parent, path) | ||
folder = DmsfFolder.visible.where(:project_id => project.id, :dmsf_folder_id => parent, :title => path[0]).first | ||
|
||
return folder if path.length == 1 | ||
|
||
search_folder_with_path(project, folder.id, path.drop(1)) | ||
end | ||
|
||
end | ||
|
||
return folder if path.length == 1 | ||
|
||
search_folder_with_path(project, folder.id, path.drop(1)) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
# encoding: UTF-8 | ||
|
||
class RedmineDrawioHookListener < Redmine::Hook::ViewListener | ||
include DrawioSettingsHelper | ||
|
||
def view_layouts_base_body_bottom(context = {}) | ||
html = context[:controller].send(:render_to_string, | ||
{ partial: 'redmine_drawio/macro_dialog', | ||
locals: { svg_enabled: svg_enabled? } }) | ||
html.html_safe | ||
module RedmineDrawio | ||
module Hooks | ||
class MacroDialog < Redmine::Hook::ViewListener | ||
def view_layouts_base_body_bottom(context = {}) | ||
html = context[:controller].send(:render_to_string, | ||
{ partial: 'redmine_drawio/macro_dialog', | ||
locals: { svg_enabled: RedmineDrawio::Helpers::DrawioSettingsHelper.svg_enabled? } }) | ||
html.html_safe | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
# encoding: UTF-8 | ||
|
||
# Add to_bool method to String class; this makes source more readable | ||
class String | ||
def to_bool | ||
return true if self =~ (/^(true|t|yes|y|1)$/i) | ||
return false if self.empty? || self =~ (/^(false|f|no|n|0)$/i) | ||
|
||
raise ArgumentError.new "invalid value: #{self}" | ||
end | ||
module RedmineDrawio | ||
module Patches | ||
module StringPatch | ||
def to_bool | ||
return true if self =~ (/^(true|t|yes|y|1)$/i) | ||
return false if self.empty? || self =~ (/^(false|f|no|n|0)$/i) | ||
|
||
raise ArgumentError.new "invalid value: #{self}" | ||
end | ||
end | ||
end | ||
end | ||
|
||
String.prepend(RedmineDrawio::Patches::StringPatch) |