From 3c5cdfd5e4623dc4374497d636177b0b639b51f9 Mon Sep 17 00:00:00 2001 From: "konstantin.grabar" Date: Fri, 24 Feb 2012 17:05:58 +0400 Subject: [PATCH] [refs #195] Add is_rpm field to projects. Continue set new design --- app/views/projects/_form.html.haml | 69 +++++++++---------- app/views/projects/_submenu.html.haml | 3 +- app/views/projects/edit.html.haml | 7 ++ app/views/projects/new.html.haml | 18 ++--- .../20120224122738_add_is_rpm_to_projects.rb | 5 ++ db/schema.rb | 3 +- 6 files changed, 55 insertions(+), 50 deletions(-) create mode 100644 db/migrate/20120224122738_add_is_rpm_to_projects.rb diff --git a/app/views/projects/_form.html.haml b/app/views/projects/_form.html.haml index fa861fc18..5689ae253 100644 --- a/app/views/projects/_form.html.haml +++ b/app/views/projects/_form.html.haml @@ -1,4 +1,4 @@ -= act = controller.action_name.to_sym +- act = controller.action_name.to_sym - if [:new, :create].include? act .leftlist = f.label :name, t("activerecord.attributes.project.name"), :class => :label @@ -10,12 +10,12 @@ .rightlist = f.text_area :description, :class => 'text_field', :cols => 80 .both -- if [:new, :create].include? act - .leftlist - = f.label :category_id, t("activerecord.attributes.project.category_id"), :class => :label - .rightlist - = f.grouped_collection_select :category_id, Category.roots, :children, :name, :id, :name, :include_blank => true - .both +-#- if [:new, :create].include? act +-# .leftlist +-# = f.label :category_id, t("activerecord.attributes.project.category_id"), :class => :label +-# .rightlist +-# = f.grouped_collection_select :category_id, Category.roots, :children, :name, :id, :name, :include_blank => true +-# .both .leftlist = f.label :visibility, t("activerecord.attributes.project.visibility"), :class => :label .rightlist @@ -29,30 +29,33 @@ = image_tag("lock.png") = t("activerecord.attributes.project.visibilities.#{visibility}") .both -.leftlist - Ветка по умолчанию: -.rightlist - = f.select :default_branch, options_from_collection_for_select(@project.branches, :name, :name, @project.default_branch), :class => 'sel80', :id => 'branch_selector' - -#.lineForm - -# #cuselFrame-ext.cusel.sel80{:style => "width:200px", :tabindex => "2"} - -# .cuselFrameRight - -# .cuselText Master - -# .cusel-scroll-wrap{:style => "display: none; visibility: visible; "} - -# #cusel-scroll-ext.cusel-scroll-pane - -# %span.cuselActive{:selected => "selected", :val => "1000"} Master - -# %span{:val => "1"} Extend - -# %span{:val => "2"} Fork4Driver - -# %input#ext{:name => "ext", :type => "hidden", :value => "1000"}/ -.both -.leftlist - \  -.rightlist - .check - %span#niceCheckbox1.niceCheck-main{:onclick => "changeCheck(this)"} - %input{:name => "ch1", :type => "checkbox"}/ - .forcheck - Проект является пакетом +- if [:edit, :update].include? act + .leftlist + Ветка по умолчанию: + .rightlist + = f.select :default_branch, options_from_collection_for_select(@project.branches, :name, :name, @project.default_branch), :class => 'sel80', :id => 'branch_selector' + -#.lineForm + -# #cuselFrame-ext.cusel.sel80{:style => "width:200px", :tabindex => "2"} + -# .cuselFrameRight + -# .cuselText Master + -# .cusel-scroll-wrap{:style => "display: none; visibility: visible; "} + -# #cusel-scroll-ext.cusel-scroll-pane + -# %span.cuselActive{:selected => "selected", :val => "1000"} Master + -# %span{:val => "1"} Extend + -# %span{:val => "2"} Fork4Driver + -# %input#ext{:name => "ext", :type => "hidden", :value => "1000"}/ .both +- if [:edit, :update].include? act + .leftlist + \  + .rightlist + .check + -#%span#niceCheckbox1.niceCheck-main{:onclick => "changeCheck(this)"} + -# %input{:name => "ch1", :type => "checkbox"}/ + = f.check_box :is_rpm, :class => 'niceCheck-main' + .forcheck + Проект является пакетом + .both .both - if [:new, :create].include? act .leftlist @@ -66,12 +69,6 @@ -#%a.button{:href => "#"} Сохранить = submit_tag t("layout.save"), :class => 'button' .both -.hr -.leftside - = t("layout.projects.delete_warning") -.rightside - = link_to t("layout.delete"), project_path(@project), :method => :delete, :confirm => t("layout.projects.confirm_delete"), :class => 'button' if can? :destroy, @project -.both -#.group diff --git a/app/views/projects/_submenu.html.haml b/app/views/projects/_submenu.html.haml index dd0eac7a8..b93cec547 100644 --- a/app/views/projects/_submenu.html.haml +++ b/app/views/projects/_submenu.html.haml @@ -7,7 +7,8 @@ %ul %li= link_to t("project_menu.project"), project_path(@project), {:class => (act == :show && contr.in?([:trees, :blobs])) ? 'active' : ''} %li= link_to t("project_menu.commits"), commits_path(@project), {:class => (act == :index && contr == :commits) ? 'active' : ''} - %li= link_to t("project_menu.builds"), project_build_lists_path(@project), {:class => (act == :index && contr == :builds) ? 'active' : ''} + - if @project.is_rpm + %li= link_to t("project_menu.builds"), project_build_lists_path(@project), {:class => (act == :index && contr == :builds) ? 'active' : ''} %li= link_to t("project_menu.tracker"), project_issues_path(@project), {:class => (act == :index && contr == :issues) ? 'active' : ''} %li= link_to t("project_menu.wiki"), project_wiki_index_path(@project), {:class => (act == :index && contr == :wiki) ? 'active' : ''} %li= link_to t("project_menu.readme"), "#" #pending diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml index e7a541760..0333ec68e 100644 --- a/app/views/projects/edit.html.haml +++ b/app/views/projects/edit.html.haml @@ -3,4 +3,11 @@ = form_for @project, :html => { :class => :form, :multipart => true } do |f| = render :partial => "form", :locals => {:f => f} +.hr +.leftside + = t("layout.projects.delete_warning") +.rightside + = link_to t("layout.delete"), project_path(@project), :method => :delete, :confirm => t("layout.projects.confirm_delete"), :class => 'button' if can? :destroy, @project +.both + - content_for :sidebar, render('sidebar') diff --git a/app/views/projects/new.html.haml b/app/views/projects/new.html.haml index 6e5ec7973..4b03c2896 100644 --- a/app/views/projects/new.html.haml +++ b/app/views/projects/new.html.haml @@ -1,15 +1,9 @@ -.block - .secondary-navigation - %ul.wat-cf - %li.first= link_to t("layout.projects.list"), @projects_path#url_for(get_owner) + "#projects" - %li.active= link_to t("layout.projects.new"), @new_project_path#new_platform_repository_project_path(@platform, @repository) - -#%li= link_to "git-repo", platform_repository_project_repo_path(@platform, @repository, @project) - -#%li= link_to t("layout.projects.build"), build_platform_repository_project_path(@platform, @repository, @project) += render :partial => 'projects/submenu' - .content - %h2.title= t("layout.projects.new_header") - .inner - = form_for [get_owner, @project], :html => { :class => :form, :multipart => true } do |f| - = render :partial => "form", :locals => {:f => f} +%h3.bpadding10 + = t("layout.projects.new_header") + += form_for [get_owner, @project], :html => { :class => :form, :multipart => true } do |f| + = render :partial => "form", :locals => {:f => f} -# content_for :sidebar, render('sidebar') diff --git a/db/migrate/20120224122738_add_is_rpm_to_projects.rb b/db/migrate/20120224122738_add_is_rpm_to_projects.rb new file mode 100644 index 000000000..1df769ab8 --- /dev/null +++ b/db/migrate/20120224122738_add_is_rpm_to_projects.rb @@ -0,0 +1,5 @@ +class AddIsRpmToProjects < ActiveRecord::Migration + def change + add_column :projects, :is_rpm, :boolean, :default => true + end +end diff --git a/db/schema.rb b/db/schema.rb index 8525508ae..2338550ec 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20120220131333) do +ActiveRecord::Schema.define(:version => 20120224122738) do create_table "activity_feeds", :force => true do |t| t.integer "user_id", :null => false @@ -268,6 +268,7 @@ ActiveRecord::Schema.define(:version => 20120220131333) do t.integer "srpm_file_size" t.datetime "srpm_updated_at" t.string "default_branch", :default => "master" + t.boolean "is_rpm", :default => true end create_table "register_requests", :force => true do |t|