Skip to content

Commit

Permalink
[webui] create the interconnect directly
Browse files Browse the repository at this point in the history
  • Loading branch information
coolo committed Oct 18, 2013
1 parent caac6a7 commit c38193e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
12 changes: 6 additions & 6 deletions src/api/webui/app/controllers/webui/configuration_controller.rb
Expand Up @@ -38,17 +38,17 @@ def save_instance

project_name = params[:name].strip

if WebuiProject.exists? project_name
if Project.exists_by_name project_name
flash[:error] = "Project '#{project_name}' already exists."
redirect_to :action => :connect_instance and return
end

@project = WebuiProject.new(:name => project_name)
@project.title.text = params[:title]
@project.description.text = params[:description]
@project.set_remoteurl(params[:remoteurl])
@project = Project.new(name: project_name)
@project.title = params[:title]
@project.description = params[:description]
@project.remoteurl = params[:remoteurl]

if @project.save
if @project.save!
Webui::Distribution.free_cache(:all)
if WebuiProject.exists? "home:#{@user.login.to_s}"
flash[:notice] = "Project '#{project_name}' was created successfully"
Expand Down
13 changes: 0 additions & 13 deletions src/api/webui/app/models/webui_project.rb
Expand Up @@ -48,19 +48,6 @@ def api_project
Project.find_by_name(to_s)
end

def set_remoteurl(url)
logger.debug "set remoteurl"

urlexists = has_element? 'remoteurl'

if url.nil?
delete_element if urlexists
else
add_element 'remoteurl' unless urlexists
remoteurl.text = url
end
end

def add_path_to_repository(opt={})
return nil if opt == {}
repository = self.find_first("//repository[@name='#{opt[:reponame]}']")
Expand Down

0 comments on commit c38193e

Please sign in to comment.