[refs #1832] Add some fixes to controllers. Add JS validation to project build

This commit is contained in:
konstantin.grabar 2011-10-23 11:37:54 +04:00
parent 56df3d05b0
commit 59bfac2be7
4 changed files with 26 additions and 21 deletions

View File

@ -1,8 +1,6 @@
class BuildListsController < ApplicationController
before_filter :authenticate_user!, :except => [:status_build, :pre_build, :post_build, :circle_build, :new_bbdt]
before_filter :authenticate_build_service!, :only => [:status_build, :pre_build, :post_build, :circle_build, :new_bbdt]
#before_filter :find_platform, :only => [:index, :filter, :show, :publish]
#before_filter :find_repository, :only => [:index, :filter, :show, :publish]
before_filter :find_project, :only => [:index, :filter, :show, :publish]
before_filter :find_arches, :only => [:index, :filter, :all]
before_filter :find_branches, :only => [:index, :filter]
@ -114,14 +112,7 @@ class BuildListsController < ApplicationController
end
protected
def find_platform
@platform = Platform.find params[:platform_id]
end
def find_repository
@repository = @platform.repositories.find(params[:repository_id])
end
def find_project
@project = Project.find params[:project_id]
end

View File

@ -1,7 +1,5 @@
class ProjectsController < ApplicationController
before_filter :authenticate_user!
# before_filter :find_platform
# before_filter :find_repository
before_filter :find_project, :only => [:show, :destroy, :build, :process_build]
before_filter :get_paths, :only => [:new, :create]

View File

@ -51,14 +51,6 @@
= image_tag("web-app-theme/icons/tick.png", :alt => t("layout.projects.build_button"))
= t("layout.projects.build_button")
%span.text_button_padding= t("layout.or")
= link_to t("layout.cancel"), root_path, :class => "text_button_padding link_button"
-#
:javascript
var pl_counter = 0;
var bpl_id = $('select#build_bpl').val();
$('input.build_pl_ids').each(function(i,el) {
var pl_id = $(el).attr('pl_id');
});
= link_to t("layout.cancel"), root_path, :class => "text_button_padding link_button"
-# content_for :sidebar, render(:partial => 'sidebar')

View File

@ -0,0 +1,24 @@
$(document).ready(function() {
$('select#build_bpl').change(function() {
var is_bpl_main = false;
var granted_pl_id = '';
var bpl_id = $('select#build_bpl').val();
$('input.build_pl_ids').each(function(i,el) {
var pl_id = $(el).attr('pl_id');
if (pl_id == bpl_id) {
is_bpl_main = true;
//granted_pl_id = $(el).attr('pl_id');
}
});
if (is_bpl_main) {
$('input.build_pl_ids').attr('disabled', 'disabled');
$('input.build_pl_ids[pl_id="'+bpl_id+'"]').removeAttr('disabled');
} else {
$('input.build_pl_ids').removeAttr('disabled');
}
});
$('select#build_bpl').trigger('change');
});