diff --git a/app/assets/javascripts/backbone/views/project_modify_view.js b/app/assets/javascripts/backbone/views/project_modify_view.js deleted file mode 100644 index 2c11de294..000000000 --- a/app/assets/javascripts/backbone/views/project_modify_view.js +++ /dev/null @@ -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(); - } -}); diff --git a/app/views/projects/projects/_form.html.haml b/app/views/projects/projects/_form.html.haml index 18585238c..b1cb51535 100644 --- a/app/views/projects/projects/_form.html.haml +++ b/app/views/projects/projects/_form.html.haml @@ -1,79 +1,82 @@ - act = controller.action_name.to_sym -- if [:new, :create].include? act - .leftlist= f.label :name - .rightlist= f.text_field :name, :class => 'text_field', :disabled => f.object.try(:persisted?) +%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?) + .both + .leftlist= f.label :description + .rightlist= f.text_area :description, :class => 'text_field', :cols => 80 .both -.leftlist= f.label :description -.rightlist= f.text_area :description, :class => 'text_field', :cols => 80 -.both -- if [:new, :create].include? act - .leftlist= f.label :owner - .rightlist - = label_tag t("activerecord.attributes.project.who_owns.me") - - if Group.can_own_project(current_user).count > 0 - = radio_button_tag :who_owns, 'me', @who_owns == :me #{}.merge( (@who_owns == :me) ? {:checked => 'checked'} : {} ) - = label_tag t("activerecord.attributes.project.who_owns.group") - = radio_button_tag :who_owns, 'group', @who_owns == :group #{}.merge( (@who_owns == :group) ? {:checked => 'checked'} : {} ) - -# TODO: Make our own select_box helper with new design, blackjack and bitches! - = select_tag :owner_id, options_from_collection_for_select( Group.can_own_project(current_user), :id, :name ) - - else - = hidden_field_tag :who_owns, :me - .both - -.leftlist= f.label :visibility -.rightlist - =# f.select :visibility, Project::VISIBILITIES - - Project::VISIBILITIES.each do |visibility| - = f.radio_button :visibility, visibility, :class => 'niceRadio' - - if visibility == 'open' - = image_tag("unlock.png") - - else - = image_tag("lock.png") - = t("activerecord.attributes.project.visibilities.#{visibility}") -.both -.leftlist - \  -.rightlist - .check - %span#niceCheckbox1.niceCheck-main= f.check_box :is_package - .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 - .forcheck= f.label :publish_i686_into_x86_64 - .both - -.both -- if [:edit, :update].include? act - .leftlist= f.label :default_branch - .rightlist - = f.select :default_branch, - options_from_collection_for_select( @project.repo.branches, - :name, :name, @project.default_branch), - :class => 'sel80', :id => 'branch_selector' - .both - #maintainer_form{:class => @project.is_package ? '' : 'hidden'} - = f.hidden_field :maintainer_id, :value => @project.maintainer_id - .leftlist - = f.label :maintainer + - if [:new, :create].include? act + .leftlist= f.label :owner .rightlist - -# TODO: Maybe use something like Chosen with filter and prepopulated - -# list of potential maintainers? - = autocomplete_field_tag :maintainer_name, @project.maintainer.fullname, - autocomplete_maintainers_path(@project.owner, @project), - :id_element => '#project_maintainer_id', - :placeholder => @project.maintainer.fullname -- if [:new, :create].include? act - .leftlist= f.label :srpm - .rightlist= f.file_field :srpm, :class => 'file_field' + = label_tag t("activerecord.attributes.project.who_owns.me") + - if Group.can_own_project(current_user).count > 0 + = radio_button_tag :who_owns, 'me', @who_owns == :me #{}.merge( (@who_owns == :me) ? {:checked => 'checked'} : {} ) + = label_tag t("activerecord.attributes.project.who_owns.group") + = radio_button_tag :who_owns, 'group', @who_owns == :group #{}.merge( (@who_owns == :group) ? {:checked => 'checked'} : {} ) + -# TODO: Make our own select_box helper with new design, blackjack and bitches! + = select_tag :owner_id, options_from_collection_for_select( Group.can_own_project(current_user), :id, :name ) + - else + = hidden_field_tag :who_owns, :me + .both + + .leftlist= f.label :visibility + .rightlist + =# f.select :visibility, Project::VISIBILITIES + - Project::VISIBILITIES.each do |visibility| + = f.radio_button :visibility, visibility, :class => 'niceRadio' + - if visibility == 'open' + = image_tag("unlock.png") + - else + = image_tag("lock.png") + = t("activerecord.attributes.project.visibilities.#{visibility}") .both -.leftlist - \  -.rightlist= submit_tag t('layout.save'), :class => 'button', :data => {'disable-with' => t('layout.saving')} -.both + .leftlist + \  + .rightlist + .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{'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 + + .both + - if [:edit, :update].include? act + .leftlist= f.label :default_branch + .rightlist + = f.select :default_branch, + options_from_collection_for_select( @project.repo.branches, + :name, :name, @project.default_branch), + :class => 'sel80', :id => 'branch_selector' + .both + #maintainer_form{'ng-show' => 'project.is_package'} + = f.hidden_field :maintainer_id, :value => @project.maintainer_id + .leftlist + = f.label :maintainer + .rightlist + -# TODO: Maybe use something like Chosen with filter and prepopulated + -# list of potential maintainers? + = autocomplete_field_tag :maintainer_name, @project.maintainer.fullname, + autocomplete_maintainers_path(@project.owner, @project), + :id_element => '#project_maintainer_id', + :placeholder => @project.maintainer.fullname + - if [:new, :create].include? act + .leftlist= f.label :srpm + .rightlist= f.file_field :srpm, :class => 'file_field' + .both + .leftlist + \  + .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} + } + }]); \ No newline at end of file