grouped[version.project.name] << [version.name, version.id]
end
- selected = selected.is_a?(Version) ? selected.id : selected
+ selected = selected.id if selected.is_a?(Version)
if grouped.keys.size > 1
grouped_options_for_select(grouped, selected)
else
# project.copy(1, :only => 'members') # => copies members only
# project.copy(1, :only => ['members', 'versions']) # => copies members and versions
def copy(project, options={})
- project = project.is_a?(Project) ? project : Project.find(project)
+ project = Project.find(project) unless project.is_a?(Project)
to_be_copied = %w(members wiki versions issue_categories issues queries boards documents)
to_be_copied = to_be_copied & Array.wrap(options[:only]) unless options[:only].nil?
# Returns a new unsaved Project instance with attributes copied from +project+
def self.copy_from(project)
- project = project.is_a?(Project) ? project : Project.find(project)
+ project = Project.find(project) unless project.is_a?(Project)
# clear unique attributes
attributes =
project.attributes.dup.except('id', 'name', 'identifier',
c.starts_with?('wiki-class-') ? c : "wiki-class-#{c}"
end.join(' ') if cls
- id = id.starts_with?('wiki-id-') ? id : "wiki-id-#{id}" if id
+ id = "wiki-id-#{id}" if id && !id.start_with?('wiki-id-')
atts = +''
atts << " style=\"#{style.join}\"" unless style.empty?