Skip to content

Commit

Permalink
[webui] rename project to WebuiProject
Browse files Browse the repository at this point in the history
Makes it easier to grep for it
  • Loading branch information
coolo committed Oct 18, 2013
1 parent 8073fb2 commit 94da4ff
Show file tree
Hide file tree
Showing 17 changed files with 59 additions and 53 deletions.
4 changes: 2 additions & 2 deletions src/api/webui/app/controllers/webui/attribute_controller.rb
Expand Up @@ -65,7 +65,7 @@ def delete

def requires
required_parameters :project
@project = find_cached(Webui::Project, params[:project], :expires_in => 5.minutes )
@project = WebuiProject.find(params[:project])
unless @project
flash[:error] = "Project not found: #{params[:project]}"
redirect_to :controller => "project", :action => "list_public" and return
Expand All @@ -81,7 +81,7 @@ def requires
end
@is_maintenance_project = false
@is_maintenance_project = true if @project.project_type and @project.project_type == "maintenance"
@package = find_cached(Webui::Package, params[:package], :project => @project.name) if params[:package]
@package = Webui::Package.find(params[:package], :project => @project.name) if params[:package]
@attribute_opts = {:project => @project.name}
@attribute_opts.store(:package, @package.to_s) if @package
@attributes = Webui::Attribute.find(@attribute_opts)
Expand Down
Expand Up @@ -38,19 +38,19 @@ def save_instance

project_name = params[:name].strip

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

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

if @project.save
Webui::Distribution.free_cache(:all)
if Project.exists? "home:#{@user.login.to_s}"
if WebuiProject.exists? "home:#{@user.login.to_s}"
flash[:notice] = "Project '#{project_name}' was created successfully"
redirect_to :controller => :project, :action => 'show', :project => project_name and return
else
Expand Down
2 changes: 1 addition & 1 deletion src/api/webui/app/controllers/webui/package_controller.rb
Expand Up @@ -1121,7 +1121,7 @@ def require_project
render :text => "#{params[:project]} is not a valid project name", :status => 404 and return
end
end
@project = Webui::Project.find( params[:project] )
@project = WebuiProject.find( params[:project] )
unless @project
unless request.xhr?
flash[:error] = "Project not found: #{params[:project]}"
Expand Down
Expand Up @@ -371,7 +371,7 @@ def get_binaries

def require_all
required_parameters :project
@project = Webui::Project.find( params[:project] )
@project = WebuiProject.find( params[:project] )
unless @project
flash[:error] = "Project not found: #{params[:project]}"
redirect_to :controller => 'project', :action => 'list_public'
Expand Down
22 changes: 11 additions & 11 deletions src/api/webui/app/controllers/webui/project_controller.rb
Expand Up @@ -126,15 +126,15 @@ def subprojects
@subprojects = Hash.new
sub_names = Collection.find :id, :what => "project", :predicate => "starts-with(@name,'#{@project}:')"
sub_names.each do |sub|
@subprojects[sub.name] = find_cached( Project, sub.name )
@subprojects[sub.name] = find_cached( WebuiProject, sub.name )
end
@subprojects = @subprojects.sort # Sort by hash key for better display
@parentprojects = Hash.new
parent_names = @project.name.split ':'
parent_names.each_with_index do |parent, idx|
parent_name = parent_names.slice(0, idx+1).join(':')
unless [@project.name, 'home'].include?( parent_name )
parent_project = find_cached(Project, parent_name )
parent_project = find_cached(WebuiProject, parent_name )
@parentprojects[parent_name] = parent_project unless parent_project.blank?
end
end
Expand All @@ -154,7 +154,7 @@ def new
@project_name = params[:project]
if @namespace
begin
@project = find_cached(Project, @namespace)
@project = find_cached(WebuiProject, @namespace)
if @namespace == "home:#{session[:login]}" and not @project
@pagetitle = "Your home project doesn't exist yet. You can create it now"
@project_name = @namespace
Expand Down Expand Up @@ -241,7 +241,7 @@ def load_project_info
rescue ApiDetails::NotFoundError
return render_project_missing
end
@project = Webui::Project.new(@project_info['xml'])
@project = WebuiProject.new(@project_info['xml'])
@packages = @project_info['packages'].map { |p| p[0] }.sort
@open_maintenance_incidents = @project_info['incidents']
@linking_projects = @project_info['linking_projects']
Expand Down Expand Up @@ -453,7 +453,7 @@ def repositories
end
# overwrite @project with different view
# TODO to get this cached we need to make sure it gets purged on repo updates
@project = Project.find( params[:project], :view => :flagdetails )
@project = WebuiProject.find( params[:project], :view => :flagdetails )
end

def repository_state
Expand Down Expand Up @@ -607,13 +607,13 @@ def save_new
project_name = params[:name].strip
project_name = params[:ns].strip + ':' + project_name.strip if params[:ns]

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

#store project
@project = Project.new(:name => project_name)
@project = WebuiProject.new(name: project_name)
@project.title.text = params[:title]
@project.description.text = params[:description]
@project.set_project_type('maintenance') if params[:maintenance_project]
Expand Down Expand Up @@ -1073,7 +1073,7 @@ def save_meta
return
end

Project.free_cache params[:project]
WebuiProject.free_cache params[:project]
render :text => 'Config successfully saved', :content_type => 'text/plain'
end

Expand All @@ -1097,7 +1097,7 @@ def change_flag
check_ajax
required_parameters :cmd, :flag
frontend.source_cmd params[:cmd], :project => @project, :repository => params[:repository], :arch => params[:arch], :flag => params[:flag], :status => params[:status]
@project = Project.find( :name => params[:project], :view => :flagdetails )
@project = WebuiProject.find( :name => params[:project], :view => :flagdetails )
end

def clear_failed_comment
Expand Down Expand Up @@ -1260,7 +1260,7 @@ def unlock
path = "/source/#{CGI.escape(params[:project])}/?cmd=unlock&comment=#{CGI.escape(params[:comment])}"
frontend.transport.direct_http(URI(path), :method => 'POST', :data => '')
flash[:success] = "Unlocked project #{params[:project]}"
Project.free_cache(params[:project])
WebuiProject.free_cache(params[:project])
rescue ActiveXML::Transport::Error => e
flash[:error] = e.summary
end
Expand Down Expand Up @@ -1342,7 +1342,7 @@ def render_project_missing

def require_project
return unless check_valid_project_name
@project ||= find_cached(Webui::Project, params[:project], :expires_in => 5.minutes )
@project ||= find_cached(WebuiProject, params[:project], :expires_in => 5.minutes )
unless @project
return render_project_missing
end
Expand Down
4 changes: 2 additions & 2 deletions src/api/webui/app/controllers/webui/request_controller.rb
Expand Up @@ -129,7 +129,7 @@ def changerequest
if tpkg
target = find_cached(Package, tpkg, :project => tprj)
else
target = find_cached(Project, tprj)
target = find_cached(WebuiProject, tprj)
end
target.add_person(:userid => @req.creator, :role => "maintainer")
target.save
Expand Down Expand Up @@ -261,7 +261,7 @@ def set_bugowner_request

def change_devel_request_dialog
required_parameters :package, :project
@project = find_cached(Project, params[:project])
@project = find_cached(WebuiProject, params[:project])
@package = find_cached(Package, params[:package], :project => params[:project])
if @package.has_element?(:devel)
@current_devel_package = @package.devel.value('package') || @package.value('name')
Expand Down
2 changes: 1 addition & 1 deletion src/api/webui/app/controllers/webui/search_controller.rb
Expand Up @@ -43,7 +43,7 @@ def owner
end
end
end
project = find_cached(Project, result.project)
project = find_cached(WebuiProject, result.project)
if result.package
package = find_cached(Package, result.package, :project => project)
end
Expand Down
4 changes: 2 additions & 2 deletions src/api/webui/app/helpers/webui/project_helper.rb
Expand Up @@ -55,10 +55,10 @@ def project_bread_crumb(*args)
unless @project.nil? || @project.is_remote?
prj_parents = nil
if @namespace # corner case where no project object is available (i.e. 'new' action)
prj_parents = Webui::Project.parent_projects(@namespace)
prj_parents = WebuiProject.parent_projects(@namespace)
else
#FIXME: Some controller's @project is a Project object whereas other's @project is a String object.
prj_parents = Webui::Project.parent_projects(@project.to_s)
prj_parents = WebuiProject.parent_projects(@project.to_s)
end
project_list = []
prj_parents.each do |name, short_name|
Expand Down
2 changes: 1 addition & 1 deletion src/api/webui/app/helpers/webui/webui_helper.rb
Expand Up @@ -395,7 +395,7 @@ def setup_codemirror_editor(opts = {})

def link_to_project(prj, linktext=nil)
linktext = prj if linktext.blank?
if Project.exists?(prj)
if WebuiProject.exists?(prj)
link_to(linktext, {:controller => :project, :action => :show, :project => prj}, title: prj )
else
linktext
Expand Down
2 changes: 1 addition & 1 deletion src/api/webui/app/models/webui/package.rb
Expand Up @@ -170,7 +170,7 @@ def can_edit?(user)
return false unless user
raise "user needs to be a Person" unless user.kind_of? Person
return true if is_maintainer?(user)
return true if p=Project.find_cached(project) and p.can_edit?(user)
return true if p=WebuiProject.find_cached(project) and p.can_edit?(user)
end

def free_directory( rev=nil, expand=false )
Expand Down
2 changes: 1 addition & 1 deletion src/api/webui/app/models/webui/person.rb
Expand Up @@ -217,7 +217,7 @@ def has_role?(role, project, package = nil)
return true
end
end
project = Webui::Project.find_cached(project) if project.class == String
project = WebuiProject.find_cached(project) if project.class == String
if project
return project.user_has_role?(self, role)
else
Expand Down

0 comments on commit 94da4ff

Please sign in to comment.