From ba1798fd7112652d77fb7fcb0419b3b7ce141db9 Mon Sep 17 00:00:00 2001 From: "konstantin.grabar" Date: Wed, 22 Feb 2012 21:48:37 +0400 Subject: [PATCH] [refs #195] Add design to form and edit page --- .../commit_as_message_presenter.rb | 2 +- app/views/projects/_form.html.haml | 126 ++++++++++++++---- app/views/projects/_sidebar.html.haml | 112 +++++++++------- app/views/projects/edit.html.haml | 14 +- config/locales/en.yml | 4 + config/locales/ru.yml | 4 + config/routes.rb | 1 + db/schema.rb | 23 +++- 8 files changed, 195 insertions(+), 91 deletions(-) diff --git a/app/presenters/git_presenters/commit_as_message_presenter.rb b/app/presenters/git_presenters/commit_as_message_presenter.rb index 3bf8e38e2..0902d8e1f 100644 --- a/app/presenters/git_presenters/commit_as_message_presenter.rb +++ b/app/presenters/git_presenters/commit_as_message_presenter.rb @@ -42,7 +42,7 @@ class GitPresenters::CommitAsMessagePresenter < ApplicationPresenter def committer_link @committer_link ||= if committer.is_a? User - link_to committer.uname, user_path(committer) + link_to committer.uname, '#'#user_path(committer) else mail_to committer.email.encode_to_default, committer.name.encode_to_default end diff --git a/app/views/projects/_form.html.haml b/app/views/projects/_form.html.haml index 0f318764e..fa861fc18 100644 --- a/app/views/projects/_form.html.haml +++ b/app/views/projects/_form.html.haml @@ -1,28 +1,104 @@ -.group - = f.label :category_id, t("activerecord.attributes.project.category_id"), :class => :label - = f.grouped_collection_select :category_id, Category.roots, :children, :name, :id, :name, :include_blank => true -.group - = f.label :name, t("activerecord.attributes.project.name"), :class => :label - = f.text_field :name, :class => 'text_field', :disabled => f.object.try(:persisted?) -.group - = f.label :visibility, t("activerecord.attributes.project.visibility"), :class => :label - = f.select :visibility, Project::VISIBILITIES -.group += act = controller.action_name.to_sym +- if [:new, :create].include? act + .leftlist + = f.label :name, t("activerecord.attributes.project.name"), :class => :label + .rightlist + = f.text_field :name, :class => 'text_field', :disabled => f.object.try(:persisted?) + .both +.leftlist = f.label :description, t("activerecord.attributes.project.description"), :class => :label +.rightlist = f.text_area :description, :class => 'text_field', :cols => 80 -.group - = f.label :has_issues, t("activerecord.attributes.project.has_issues"), :class => :label - = f.check_box :has_issues -.group - = f.label :has_wiki, t("activerecord.attributes.project.has_wiki"), :class => :label - = f.check_box :has_wiki -.group - = f.label :srpm, t("activerecord.attributes.project.srpm"), :class => :label - = f.file_field :srpm, :class => 'file_field' +.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 + =# f.select :visibility, Project::VISIBILITIES + - Project::VISIBILITIES.each do |visibility| + %span.niceRadio.radioChecked + = 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 + = 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 + Проект является пакетом + .both +.both +- if [:new, :create].include? act + .leftlist + = f.label :srpm, t("activerecord.attributes.project.srpm"), :class => :label + .rightlist + = f.file_field :srpm, :class => 'file_field' + .both +.leftlist + \  +.rightlist + -#%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.navform.wat-cf - %button.button{:type => "submit"} - = image_tag("web-app-theme/icons/tick.png", :alt => t("layout.save")) - = t("layout.save") - %span.text_button_padding= t("layout.or") - = link_to t("layout.cancel"), @projects_path, :class => "text_button_padding link_button" + +-#.group +-# = f.label :category_id, t("activerecord.attributes.project.category_id"), :class => :label +-# = f.grouped_collection_select :category_id, Category.roots, :children, :name, :id, :name, :include_blank => true +-#.group +-# = f.label :name, t("activerecord.attributes.project.name"), :class => :label +-# = f.text_field :name, :class => 'text_field', :disabled => f.object.try(:persisted?) +-#.group +-# = f.label :visibility, t("activerecord.attributes.project.visibility"), :class => :label +-# = f.select :visibility, Project::VISIBILITIES +-#.group +-# = f.label :description, t("activerecord.attributes.project.description"), :class => :label +-# = f.text_area :description, :class => 'text_field', :cols => 80 +-#.group +-# = f.label :has_issues, t("activerecord.attributes.project.has_issues"), :class => :label +-# = f.check_box :has_issues +-#.group +-# = f.label :has_wiki, t("activerecord.attributes.project.has_wiki"), :class => :label +-# = f.check_box :has_wiki +-#.group +-# = f.label :srpm, t("activerecord.attributes.project.srpm"), :class => :label +-# = f.file_field :srpm, :class => 'file_field' +-# +-#.group.navform.wat-cf +-# %button.button{:type => "submit"} +-# = image_tag("web-app-theme/icons/tick.png", :alt => t("layout.save")) +-# = t("layout.save") +-# %span.text_button_padding= t("layout.or") +-# = link_to t("layout.cancel"), @projects_path, :class => "text_button_padding link_button" diff --git a/app/views/projects/_sidebar.html.haml b/app/views/projects/_sidebar.html.haml index 04aced964..a021711c1 100644 --- a/app/views/projects/_sidebar.html.haml +++ b/app/views/projects/_sidebar.html.haml @@ -1,50 +1,66 @@ -.block.notice - %h3= t("layout.projects.members") - .content - %p - %b - = "#{t("layout.projects.collaborators")}:" - %ul - - @project.collaborators.each do |user| - %li - - if can? :read, user - = link_to user.name, user_path(user) - - else - = user.name - - if (@project.owner == user) - = '(' + t("layout.owner") + ')' - /%br - -# if can? :update, @project - %p - %b - = "#{t("layout.projects.groups")}:" - %ul - - @project.groups.each do |group| - %li - = link_to group.name, group_path(group) - - if (@project.owner == group) - = '(' + t("layout.owner") + ')' - %br - = link_to t("layout.projects.edit_collaborators"), edit_project_collaborators_path(@project) if can? :manage_collaborators, @project +- act = action_name.to_sym +- contr = controller_name.to_sym - / %p - / %b - / = "#{t("layout.projects.groups")}:" - / %ul - / - @project.groups.each do |group| - / %li - / = link_to group.name, group_path(group) - / - if (@project.owner == group) - / = '(' + t("layout.owner") + ')' - / %br - / = link_to t("layout.projects.add_groups"), '#' #add_collaborators_project_path(@project) +%aside + .admin-preferences + %ul + - if can? :edit, @project + %li{:class => (act == :edit && contr == :projects) ? 'active' : ''} + = link_to t("layout.projects.edit"), edit_project_path(@project) + %li + %a{:href => '#'} Разделы + - if can? :manage_collaborators, @project + %li{:class => (act == :edit && contr == :collaborators) ? 'active' : ''} + = link_to t("layout.projects.edit_collaborators"), edit_project_collaborators_path(@project) -/ .block.notice -/ %h3= t("layout.platforms.current_platform_header") -/ .content -/ %p= link_to @platform.name, platform_path(@platform) -/ -/ .block.notice -/ %h3= t("layout.repositories.current_repository_header") -/ .content -/ %p= link_to @repository.name + repository_name_postfix(@platform), platform_repository_path(@platform, @repository) + +-#.block.notice +-# %h3= t("layout.projects.members") +-# .content +-# %p +-# %b +-# = "#{t("layout.projects.collaborators")}:" +-# %ul +-# - @project.collaborators.each do |user| +-# %li +-# - if can? :read, user +-# = link_to user.name, user_path(user) +-# - else +-# = user.name +-# - if (@project.owner == user) +-# = '(' + t("layout.owner") + ')' +-# /%br +-# -# if can? :update, @project +-# %p +-# %b +-# = "#{t("layout.projects.groups")}:" +-# %ul +-# - @project.groups.each do |group| +-# %li +-# = link_to group.name, group_path(group) +-# - if (@project.owner == group) +-# = '(' + t("layout.owner") + ')' +-# %br +-# = link_to t("layout.projects.edit_collaborators"), edit_project_collaborators_path(@project) if can? :manage_collaborators, @project +-# +-# / %p +-# / %b +-# / = "#{t("layout.projects.groups")}:" +-# / %ul +-# / - @project.groups.each do |group| +-# / %li +-# / = link_to group.name, group_path(group) +-# / - if (@project.owner == group) +-# / = '(' + t("layout.owner") + ')' +-# / %br +-# / = link_to t("layout.projects.add_groups"), '#' #add_collaborators_project_path(@project) +-# +-#/ .block.notice +-#/ %h3= t("layout.platforms.current_platform_header") +-#/ .content +-#/ %p= link_to @platform.name, platform_path(@platform) +-#/ +-#/ .block.notice +-#/ %h3= t("layout.repositories.current_repository_header") +-#/ .content +-#/ %p= link_to @repository.name + repository_name_postfix(@platform), platform_repository_path(@platform, @repository) diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml index 1017c5329..e7a541760 100644 --- a/app/views/projects/edit.html.haml +++ b/app/views/projects/edit.html.haml @@ -1,14 +1,6 @@ -.block - .secondary-navigation - %ul.wat-cf - %li.first= link_to t("layout.projects.list"), @projects_path # url_for(get_owner) + "#projects" - %li= link_to t("layout.projects.new"), @new_project_path # new_platform_repository_project_path(@platform, @repository) - %li.active= link_to t("layout.projects.edit"), @edit_project_path += render :partial => 'projects/submenu' - .content - %h2.title= t("layout.projects.edit_header") - .inner - = form_for @project, :html => { :class => :form, :multipart => true } do |f| - = render :partial => "form", :locals => {:f => f} += form_for @project, :html => { :class => :form, :multipart => true } do |f| + = render :partial => "form", :locals => {:f => f} - content_for :sidebar, render('sidebar') diff --git a/config/locales/en.yml b/config/locales/en.yml index 8806dd1db..5775a2aae 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -297,6 +297,7 @@ en: edit_collaborators: Edit collaborators issues: Issues wiki: Wiki + delete_warning: Attention! Deleted project can not be restored! collaborators: back_to_proj: Back to project @@ -823,6 +824,9 @@ en: description: Descripton owner: Owner visibility: Visibility + visibility_types: + open: Open + hidden: Hidden repository_id: Repository repository: Repository created_at: Created diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 8c8fac327..fa13aadaa 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -297,6 +297,7 @@ ru: edit_collaborators: Изменить список участников issues: Задачи wiki: Wiki + delete_warning: Внимание! Удаленный проект восстановлению не подлежит. collaborators: back_to_proj: Вернуться к проекту @@ -685,6 +686,9 @@ ru: description: Описание owner: Владелец visibility: Видимость + visibilities: + open: Публичная + hidden: Приватная repository_id: Репозиторий repository: Репозиторий created_at: Создан diff --git a/config/routes.rb b/config/routes.rb index 0580b7111..d45bc0425 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -142,6 +142,7 @@ Rosa::Application.routes.draw do end collection do get :auto_build + get :settings end end diff --git a/db/schema.rb b/db/schema.rb index 838201966..8525508ae 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -13,6 +13,14 @@ ActiveRecord::Schema.define(:version => 20120220131333) do + create_table "activity_feeds", :force => true do |t| + t.integer "user_id", :null => false + t.string "kind" + t.text "data" + t.datetime "created_at" + t.datetime "updated_at" + end + create_table "arches", :force => true do |t| t.string "name", :null => false t.datetime "created_at" @@ -262,22 +270,20 @@ ActiveRecord::Schema.define(:version => 20120220131333) do t.string "default_branch", :default => "master" end - add_index "projects", ["category_id"], :name => "index_projects_on_category_id" - add_index "projects", ["owner_id"], :name => "index_projects_on_name_and_owner_id_and_owner_type", :unique => true, :case_sensitive => false - create_table "register_requests", :force => true do |t| t.string "name" t.string "email" t.string "token" t.boolean "approved", :default => false t.boolean "rejected", :default => false - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.string "interest" t.text "more" end add_index "register_requests", ["email"], :name => "index_register_requests_on_email", :unique => true, :case_sensitive => false + add_index "register_requests", ["token"], :name => "index_register_requests_on_token", :unique => true, :case_sensitive => false create_table "relations", :force => true do |t| t.integer "object_id" @@ -338,8 +344,8 @@ ActiveRecord::Schema.define(:version => 20120220131333) do t.string "name" t.string "email", :default => "", :null => false t.string "encrypted_password", :limit => 128, :default => "", :null => false + t.string "password_salt", :default => "", :null => false t.string "reset_password_token" - t.datetime "reset_password_sent_at" t.datetime "remember_created_at" t.datetime "created_at" t.datetime "updated_at" @@ -347,9 +353,14 @@ ActiveRecord::Schema.define(:version => 20120220131333) do t.string "uname" t.string "role" t.string "language", :default => "en" + t.string "confirmation_token" + t.datetime "confirmed_at" + t.datetime "confirmation_sent_at" t.integer "own_projects_count", :default => 0, :null => false + t.datetime "reset_password_sent_at" end + add_index "users", ["confirmation_token"], :name => "index_users_on_confirmation_token", :unique => true add_index "users", ["email"], :name => "index_users_on_email", :unique => true add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true add_index "users", ["uname"], :name => "index_users_on_uname", :unique => true