def permission(name, hash, options={})
@permissions ||= []
+ @permissions.reject! {|p| p.name == name}
options[:project_module] = @project_module
@permissions << Permission.new(name, hash, options)
end
end
end
- ASSET_URL_PATTERN = /(url\(\s*["']?([^"'\s)]+)\s*["']?\s*\))/
+ ASSET_URL_PATTERN = /(url\(\s*["']?([^"'\s)]+)\s*["']?\s*\))/ unless defined? ASSET_URL_PATTERN
def convert_path(input, conversion)
input.gsub(ASSET_URL_PATTERN) do |matched|
target_root = @menu_items.root
end
+ target_root.children.reject! {|item| item.name == name}
+
# menu item position
if first = options.delete(:first)
target_root.prepend(MenuItem.new(name, url, options))
# Adds a child at given position
def add_at(child, position)
- raise "Child already added" if find {|node| node.name == child.name}
-
@children = @children.insert(position, child)
child.parent = self
child
# Warn for potential settings[:partial] collisions
if p.configurable?
partial = p.settings[:partial]
- if @used_partials[partial]
+ if @used_partials[partial] && @used_partials[partial] != p.id
Rails.logger.warn(
"WARNING: settings partial '#{partial}' is declared in '#{p.id}' plugin " \
"but it is already used by plugin '#{@used_partials[partial]}'. " \
# Add a new SCM adapter and repository
def add(scm_name)
@scms ||= []
+ @scms.delete(scm_name)
@scms << scm_name
end
def register(name, *args)
options = args.last.is_a?(Hash) ? args.pop : {}
name = name.to_s
- raise ArgumentError, "format name '#{name}' is already taken" if @@formatters[name]
formatter, helper, parser =
if args.any?
end
raise "A formatter class is required" if formatter.nil?
- @@formatters[name] = {
+ entry = {
:formatter => formatter,
:helper => helper,
:html_parser => parser,
:label => options[:label] || name.humanize
}
+ if @@formatters[name] && @@formatters[name] != entry
+ raise ArgumentError, "format name '#{name}' is already taken"
+ end
+ @@formatters[name] = entry
end
def formatter