#898: add "publish_i686_into_x86_64" field into Project, update UI

This commit is contained in:
Vokhmin Alexey V 2013-02-07 15:11:57 +04:00
parent 3e5f3cb916
commit e9c023f273
8 changed files with 43 additions and 22 deletions

View File

@ -2,9 +2,11 @@ Rosa.Views.ProjectModifyView = Backbone.View.extend({
initialize: function() { initialize: function() {
_.bindAll(this, 'checkboxClick'); _.bindAll(this, 'checkboxClick');
this.$checkbox_wrapper = $('#niceCheckbox1'); this.$checkbox_wrapper = $('#niceCheckbox1');
this._$checkbox = this.$checkbox_wrapper.children('#project_is_package').first(); this._$checkbox = this.$checkbox_wrapper.children('#project_is_package').first();
this.$maintainer_form = $('#maintainer_form'); 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); this.$checkbox_wrapper.on('click', this.checkboxClick);
}, },
@ -12,8 +14,13 @@ Rosa.Views.ProjectModifyView = Backbone.View.extend({
checkboxClick: function() { checkboxClick: function() {
if (this._$checkbox.is(':checked')) { if (this._$checkbox.is(':checked')) {
this.$maintainer_form.slideDown(); this.$maintainer_form.slideDown();
this.$publish_form.slideDown();
} else { } else {
this.$maintainer_form.slideUp(); this.$maintainer_form.slideUp();
this.$publish_form.slideUp();
if (this._$publish_checkbox.is(':checked')) {
changeCheck(this.$publish_form.find('.niceCheck-main'));
}
} }
}, },

View File

@ -32,7 +32,7 @@ class Project < ActiveRecord::Base
validate { errors.add(:base, :can_have_less_or_equal, :count => MAX_OWN_PROJECTS) if owner.projects.size >= MAX_OWN_PROJECTS } validate { errors.add(:base, :can_have_less_or_equal, :count => MAX_OWN_PROJECTS) if owner.projects.size >= MAX_OWN_PROJECTS }
validate :check_default_branch validate :check_default_branch
attr_accessible :name, :description, :visibility, :srpm, :is_package, :default_branch, :has_issues, :has_wiki, :maintainer_id attr_accessible :name, :description, :visibility, :srpm, :is_package, :default_branch, :has_issues, :has_wiki, :maintainer_id, :publish_i686_into_x86_64
attr_readonly :name, :owner_id, :owner_type attr_readonly :name, :owner_id, :owner_type
scope :recent, order("name ASC") scope :recent, order("name ASC")

View File

@ -2,7 +2,7 @@ json.build_list do |json|
json.(@build_list, :id, :name, :container_status, :status, :duration) json.(@build_list, :id, :name, :container_status, :status, :duration)
json.(@build_list, :is_circle, :update_type, :priority, :new_core) json.(@build_list, :is_circle, :update_type, :priority, :new_core)
json.(@build_list, :advisory, :mass_build, :use_save_to_repository) json.(@build_list, :advisory, :mass_build, :use_save_to_repository)
json.(@build_list, :auto_publish, :package_version, :commit_hash, :last_published_commit_hash) json.(@build_list, :auto_publish, :package_version, :commit_hash, :last_published_commit_hash, :publish_i686_into_x86_64)
json.build_log_url log_build_list_path(@build_list) json.build_log_url log_build_list_path(@build_list)
if @build_list.container_published? if @build_list.container_published?

View File

@ -1,13 +1,13 @@
- act = controller.action_name.to_sym - act = controller.action_name.to_sym
- if [:new, :create].include? act - if [:new, :create].include? act
.leftlist= f.label :name, t("activerecord.attributes.project.name"), :class => :label .leftlist= f.label :name
.rightlist= f.text_field :name, :class => 'text_field', :disabled => f.object.try(:persisted?) .rightlist= f.text_field :name, :class => 'text_field', :disabled => f.object.try(:persisted?)
.both .both
.leftlist= f.label :description, t("activerecord.attributes.project.description"), :class => :label .leftlist= f.label :description
.rightlist= f.text_area :description, :class => 'text_field', :cols => 80 .rightlist= f.text_area :description, :class => 'text_field', :cols => 80
.both .both
- if [:new, :create].include? act - if [:new, :create].include? act
.leftlist= f.label :owner_id, t("activerecord.attributes.project.owner"), :class => :label .leftlist= f.label :owner
.rightlist .rightlist
= label_tag t("activerecord.attributes.project.who_owns.me") = label_tag t("activerecord.attributes.project.who_owns.me")
- if Group.can_own_project(current_user).count > 0 - if Group.can_own_project(current_user).count > 0
@ -20,7 +20,7 @@
= hidden_field_tag :who_owns, :me = hidden_field_tag :who_owns, :me
.both .both
.leftlist= f.label :visibility, t("activerecord.attributes.project.visibility"), :class => :label .leftlist= f.label :visibility
.rightlist .rightlist
=# f.select :visibility, Project::VISIBILITIES =# f.select :visibility, Project::VISIBILITIES
- Project::VISIBILITIES.each do |visibility| - Project::VISIBILITIES.each do |visibility|
@ -35,12 +35,18 @@
\  \ 
.rightlist .rightlist
.check .check
%span#niceCheckbox1.niceCheck-main= f.check_box :is_package#, :class => 'niceCheckbox1' %span#niceCheckbox1.niceCheck-main= f.check_box :is_package
.forcheck= t("activerecord.attributes.project.is_package") .forcheck= f.label :is_package
.both .both
#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 .both
- if [:edit, :update].include? act - if [:edit, :update].include? act
.leftlist= t("activerecord.attributes.project.default_branch") .leftlist= f.label :default_branch
.rightlist .rightlist
= f.select :default_branch, = f.select :default_branch,
options_from_collection_for_select( @project.repo.branches, options_from_collection_for_select( @project.repo.branches,
@ -50,7 +56,7 @@
#maintainer_form{:class => @project.is_package ? '' : 'hidden'} #maintainer_form{:class => @project.is_package ? '' : 'hidden'}
= f.hidden_field :maintainer_id, :value => @project.maintainer_id = f.hidden_field :maintainer_id, :value => @project.maintainer_id
.leftlist .leftlist
= t("activerecord.attributes.project.maintainer") = f.label :maintainer
.rightlist .rightlist
-# TODO: Maybe use something like Chosen with filter and prepopulated -# TODO: Maybe use something like Chosen with filter and prepopulated
-# list of potential maintainers? -# list of potential maintainers?
@ -59,7 +65,7 @@
:id_element => '#project_maintainer_id', :id_element => '#project_maintainer_id',
:placeholder => @project.maintainer.fullname :placeholder => @project.maintainer.fullname
- if [:new, :create].include? act - if [:new, :create].include? act
.leftlist= f.label :srpm, t("activerecord.attributes.project.srpm"), :class => :label .leftlist= f.label :srpm
.rightlist= f.file_field :srpm, :class => 'file_field' .rightlist= f.file_field :srpm, :class => 'file_field'
.both .both
.leftlist .leftlist

View File

@ -94,6 +94,7 @@ en:
group: Group group: Group
default_branch: Default branch default_branch: Default branch
is_package: Project is a package is_package: Project is a package
publish_i686_into_x86_64: Publish i686 packages into x86_64 repository (only for rhel)
maintainer: Maintainer of project maintainer: Maintainer of project
maintainer_id: Maintainer of project maintainer_id: Maintainer of project
errors: errors:

View File

@ -94,6 +94,7 @@ ru:
group: Группа group: Группа
default_branch: Ветка по умолчанию default_branch: Ветка по умолчанию
is_package: Проект является пакетом is_package: Проект является пакетом
publish_i686_into_x86_64: Публиковать i686 пакеты в x86_64 репозиторий (только для rhel)
maintainer_id: Майнтейнер проекта maintainer_id: Майнтейнер проекта
maintainer: Майнтейнер проекта maintainer: Майнтейнер проекта
errors: errors:

View File

@ -0,0 +1,5 @@
class AddPublishi686IntoX8664ToProject < ActiveRecord::Migration
def change
add_column :projects, :publish_i686_into_x86_64, :boolean, :default => false
end
end

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20130201094007) do ActiveRecord::Schema.define(:version => 20130207101148) do
create_table "activity_feeds", :force => true do |t| create_table "activity_feeds", :force => true do |t|
t.integer "user_id", :null => false t.integer "user_id", :null => false
@ -354,20 +354,21 @@ ActiveRecord::Schema.define(:version => 20130201094007) do
t.datetime "updated_at" t.datetime "updated_at"
t.integer "owner_id" t.integer "owner_id"
t.string "owner_type" t.string "owner_type"
t.string "visibility", :default => "open" t.string "visibility", :default => "open"
t.text "description" t.text "description"
t.string "ancestry" t.string "ancestry"
t.boolean "has_issues", :default => true t.boolean "has_issues", :default => true
t.string "srpm_file_name" t.string "srpm_file_name"
t.integer "srpm_file_size" t.integer "srpm_file_size"
t.datetime "srpm_updated_at" t.datetime "srpm_updated_at"
t.string "srpm_content_type" t.string "srpm_content_type"
t.boolean "has_wiki", :default => false t.boolean "has_wiki", :default => false
t.string "default_branch", :default => "master" t.string "default_branch", :default => "master"
t.boolean "is_package", :default => true, :null => false t.boolean "is_package", :default => true, :null => false
t.integer "average_build_time", :default => 0, :null => false t.integer "average_build_time", :default => 0, :null => false
t.integer "build_count", :default => 0, :null => false t.integer "build_count", :default => 0, :null => false
t.integer "maintainer_id" t.integer "maintainer_id"
t.boolean "publish_i686_into_x86_64", :default => false
end end
add_index "projects", ["owner_id", "name", "owner_type"], :name => "index_projects_on_name_and_owner_id_and_owner_type", :unique => true, :case_sensitive => false add_index "projects", ["owner_id", "name", "owner_type"], :name => "index_projects_on_name_and_owner_id_and_owner_type", :unique => true, :case_sensitive => false