Some changes in representation
This commit is contained in:
parent
e672c20d3f
commit
fa3359b025
|
@ -6,7 +6,7 @@ class PlatformsController < ApplicationController
|
|||
before_filter :find_platform, :only => [:freeze, :unfreeze, :clone]
|
||||
|
||||
def index
|
||||
@platforms = Platform.all
|
||||
@platforms = Platform.paginate(:page => params[:platform_page])
|
||||
end
|
||||
|
||||
def show
|
||||
|
@ -20,15 +20,16 @@ class PlatformsController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@platform = Platform.new params[:platform]
|
||||
if @platform.save
|
||||
flash[:notice] = I18n.t("flash.platform.saved")
|
||||
redirect_to @platform
|
||||
else
|
||||
flash[:error] = I18n.t("flash.platform.saved_error")
|
||||
@platforms = Platform.all
|
||||
render :action => :new
|
||||
end
|
||||
pp params
|
||||
# @platform = Platform.new params[:platform]
|
||||
# if @platform.save
|
||||
# flash[:notice] = I18n.t("flash.platform.saved")
|
||||
# redirect_to @platform
|
||||
# else
|
||||
# flash[:error] = I18n.t("flash.platform.saved_error")
|
||||
# @platforms = Platform.all
|
||||
# render :action => :new
|
||||
# end
|
||||
end
|
||||
|
||||
def freeze
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
class ProjectsController < ApplicationController
|
||||
before_filter :authenticate_user!
|
||||
before_filter :find_platform
|
||||
before_filter :find_repository
|
||||
# before_filter :find_platform
|
||||
# before_filter :find_repository
|
||||
before_filter :find_project, :only => [:show, :destroy, :build, :process_build]
|
||||
|
||||
def new
|
||||
|
@ -72,7 +72,7 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
|
||||
def find_project
|
||||
@project = @repository.projects.find params[:id]
|
||||
@project = Project.find params[:id]
|
||||
end
|
||||
|
||||
def check_arches
|
||||
|
|
|
@ -11,9 +11,9 @@ class Platform < ActiveRecord::Base
|
|||
validates :name, :presence => true, :uniqueness => true
|
||||
validates :unixname, :uniqueness => true, :presence => true, :format => { :with => /^[a-zA-Z0-9\-.]+$/ }, :allow_nil => false, :allow_blank => false
|
||||
|
||||
before_create :xml_rpc_create
|
||||
before_destroy :xml_rpc_destroy
|
||||
before_update :check_freezing
|
||||
# before_create :xml_rpc_create
|
||||
# before_destroy :xml_rpc_destroy
|
||||
# before_update :check_freezing
|
||||
|
||||
|
||||
def path
|
||||
|
@ -55,30 +55,33 @@ class Platform < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def xml_rpc_create
|
||||
result = BuildServer.add_platform unixname, APP_CONFIG['root_path']
|
||||
if result == BuildServer::SUCCESS
|
||||
return true
|
||||
else
|
||||
raise "Failed to create platform #{name}. Path: #{build_path(unixname)}"
|
||||
end
|
||||
# result = BuildServer.add_platform unixname, APP_CONFIG['root_path']
|
||||
# if result == BuildServer::SUCCESS
|
||||
# return true
|
||||
# else
|
||||
# raise "Failed to create platform #{name}. Path: #{build_path(unixname)}"
|
||||
# end
|
||||
end
|
||||
|
||||
def xml_rpc_destroy
|
||||
result = BuildServer.delete_platform unixname
|
||||
if result == BuildServer::SUCCESS
|
||||
return true
|
||||
else
|
||||
raise "Failed to delete platform #{unixname}."
|
||||
end
|
||||
# result = BuildServer.delete_platform unixname
|
||||
# if result == BuildServer::SUCCESS
|
||||
# return true
|
||||
# else
|
||||
# raise "Failed to delete platform #{unixname}."
|
||||
# end
|
||||
end
|
||||
|
||||
def xml_rpc_clone(new_unixname)
|
||||
result = BuildServer.clone_platform new_unixname, self.unixname, APP_CONFIG['root_path']
|
||||
if result == BuildServer::SUCCESS
|
||||
return true
|
||||
else
|
||||
raise "Failed to clone platform #{name}. Path: #{build_path(unixname)} to platform #{new_unixname}"
|
||||
end
|
||||
# result = BuildServer.clone_platform new_unixname, self.unixname, APP_CONFIG['root_path']
|
||||
# if result == BuildServer::SUCCESS
|
||||
# return true
|
||||
# else
|
||||
# raise "Failed to clone platform #{name}. Path: #{build_path(unixname)} to platform #{new_unixname}"
|
||||
# end
|
||||
end
|
||||
|
||||
def check_freezing
|
||||
|
|
|
@ -17,8 +17,8 @@ class Project < ActiveRecord::Base
|
|||
scope :by_name, lambda { |name| {:conditions => ['name like ?', '%' + name + '%']} }
|
||||
|
||||
#before_create :create_directory, :create_git_repo
|
||||
before_create :xml_rpc_create
|
||||
before_destroy :xml_rpc_destroy
|
||||
# before_create :xml_rpc_create
|
||||
# before_destroy :xml_rpc_destroy
|
||||
|
||||
# Redefining a method from Project::HasRepository module to reflect current situation
|
||||
def git_repo_path
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class Relation < ActiveRecord::Base
|
||||
belongs_to :target, :polymorphic => true
|
||||
belongs_to :object, :polymorphic => true
|
||||
belongs_to :role
|
||||
belongs_to :role, :autosave => true
|
||||
end
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
.block
|
||||
.secondary-navigation
|
||||
%ul.wat-cf
|
||||
%li.first.active= link_to t("layout.platforms.list"), platforms_path
|
||||
%li= link_to t("layout.platforms.new"), new_platform_path
|
||||
.content
|
||||
%h2.title
|
||||
= t("layout.platforms.list_header")
|
||||
.inner
|
||||
%table.table
|
||||
%tr
|
||||
%th.first= t("activerecord.attributes.platform.name")
|
||||
%th.last
|
||||
- @platforms.each do |platform|
|
||||
%tr{:class => cycle("odd", "even")}
|
||||
%td
|
||||
= link_to platform.name, platform_path(platform)
|
||||
%td.last
|
||||
#{link_to t("layout.show"), platform_path(platform)} | #{link_to t("layout.delete"), platform_path(platform), :method => :delete, :confirm => t("layout.platforms.confirm_delete")}
|
||||
.actions-bar.wat-cf
|
||||
.actions
|
||||
=render :partial => 'list', :object => @platforms
|
||||
/.block
|
||||
/ .secondary-navigation
|
||||
/ %ul.wat-cf
|
||||
/ %li.first.active= link_to t("layout.platforms.list"), platforms_path
|
||||
/ %li= link_to t("layout.platforms.new"), new_platform_path
|
||||
/ .content
|
||||
/ %h2.title
|
||||
/ = t("layout.platforms.list_header")
|
||||
/ .inner
|
||||
/ %table.table
|
||||
/ %tr
|
||||
/ %th.first= t("activerecord.attributes.platform.name")
|
||||
/ %th.last
|
||||
/ - @platforms.each do |platform|
|
||||
/ %tr{:class => cycle("odd", "even")}
|
||||
/ %td
|
||||
/ = link_to platform.name, platform_path(platform)
|
||||
/ %td.last
|
||||
/ #{link_to t("layout.show"), platform_path(platform)} | #{link_to t("layout.delete"), platform_path(platform), :method => :delete, :confirm => t("layout.platforms.confirm_delete")}
|
||||
/ .actions-bar.wat-cf
|
||||
/ .actions
|
||||
|
|
Loading…
Reference in New Issue