#258: removed project_modify_view.js

This commit is contained in:
Vokhmin Alexey V 2013-08-07 16:30:32 +04:00
parent 3cd88dfb25
commit f92c700662
2 changed files with 77 additions and 104 deletions

View File

@ -1,30 +0,0 @@
Rosa.Views.ProjectModifyView = Backbone.View.extend({
initialize: function() {
_.bindAll(this, 'checkboxClick');
this.$checkbox_wrapper = $('#niceCheckbox1');
this._$checkbox = this.$checkbox_wrapper.children('#project_is_package').first();
this.$maintainer_form = $('#maintainer_form');
this.$publish_form = $('#publish_form');
this._$publish_checkbox = this.$publish_form.find('#project_publish_i686_into_x86_64').first();
this.$checkbox_wrapper.on('click', this.checkboxClick);
},
checkboxClick: function() {
if (this._$checkbox.is(':checked')) {
this.$maintainer_form.slideDown();
this.$publish_form.slideDown();
} else {
this.$maintainer_form.slideUp();
this.$publish_form.slideUp();
if (this._$publish_checkbox.is(':checked')) {
changeCheck(this.$publish_form.find('.niceCheck-main'));
}
}
},
render: function() {
this.checkboxClick();
}
});

View File

@ -1,4 +1,5 @@
- act = controller.action_name.to_sym
%div{'ng-controller' => 'ProjectFromController'}
- if [:new, :create].include? act
.leftlist= f.label :name
.rightlist= f.text_field :name, :class => 'text_field', :disabled => f.object.try(:persisted?)
@ -34,14 +35,12 @@
.leftlist
\ 
.rightlist
.check
%span#niceCheckbox1.niceCheck-main= f.check_box :is_package
.check= f.check_box :is_package, 'ng-model' => 'project.is_package', 'ng-change' => 'project.publish_i686_into_x86_64 = false'
.forcheck= f.label :is_package
.both
- unless [:new, :create].include? act
#publish_form{:class => @project.publish_i686_into_x86_64 ? '' : 'hidden'}
.check
%span.niceCheck-main= f.check_box :publish_i686_into_x86_64
#publish_form{'ng-show' => 'project.is_package'}
.check= f.check_box :publish_i686_into_x86_64, 'ng-model' => 'project.publish_i686_into_x86_64'
.forcheck= f.label :publish_i686_into_x86_64
.both
@ -54,7 +53,7 @@
:name, :name, @project.default_branch),
:class => 'sel80', :id => 'branch_selector'
.both
#maintainer_form{:class => @project.is_package ? '' : 'hidden'}
#maintainer_form{'ng-show' => 'project.is_package'}
= f.hidden_field :maintainer_id, :value => @project.maintainer_id
.leftlist
= f.label :maintainer
@ -73,7 +72,11 @@
\ 
.rightlist= submit_tag t('layout.save'), :class => 'button', :data => {'disable-with' => t('layout.saving')}
.both
:javascript
$(function() {
( new Rosa.Views.ProjectModifyView ).render();
});
RosaABF.controller('ProjectFromController', ['$scope', function($scope) {
$scope.project = {
is_package: #{@project.is_package},
publish_i686_into_x86_64: #{@project.publish_i686_into_x86_64}
}
}]);