[refs #232] Add new design to some group pages

This commit is contained in:
konstantin.grabar 2012-02-29 21:12:06 +04:00
parent c5d8041296
commit 12d8f5e7b8
8 changed files with 170 additions and 119 deletions

View File

@ -12,11 +12,12 @@ class GroupsController < ApplicationController
def index def index
puts parent.inspect puts parent.inspect
@groups = if parent? and !parent.nil? #@groups = #if parent? and !parent.nil?
parent.groups # parent.groups
else #else
Group # Group
end.accessible_by(current_ability) #end.accessible_by(current_ability)
@groups = current_user.groups#accessible_by(current_ability)
@groups = if params[:query] @groups = if params[:query]
@groups.where(["name LIKE ?", "%#{params[:query]}%"]) @groups.where(["name LIKE ?", "%#{params[:query]}%"])

View File

@ -1,30 +1,45 @@
.block = link_to t("layout.groups.new"), new_group_path, :class => "button"
.secondary-navigation %table#myTable.tablesorter.group-list{:cellpadding => "0", :cellspacing => "0"}
%ul.wat-cf %thead
%li.first.active= link_to t("layout.groups.list"), users_path %tr
%li= link_to t("layout.groups.new"), new_group_path %th.th1= t("layout.groups.group")
.content %th.th2= t("layout.groups.description")
%h2.title %th= t("layout.groups.leave_group")
= t("layout.groups.list_header") %tbody
.inner - @groups.each do |group|
%table.table %tr#Row1
%tr %td= link_to group.name, group_path(group)
%th.first ID %td.td2= group.description
%th= t("activerecord.attributes.group.name") %td.td5
%th= t("activerecord.attributes.group.owner") = link_to image_tag('x.png'), '#' unless group.owner_id == current_user.id
%th.last &nbsp;
- @groups.each do |group| -#.block
%tr{:class => cycle("odd", "even")} -# .secondary-navigation
%td -# %ul.wat-cf
= group.id -# %li.first.active= link_to t("layout.groups.list"), users_path
%td -# %li= link_to t("layout.groups.new"), new_group_path
= link_to group.name, group_path(group) -# .content
%td -# %h2.title
= link_to group.owner.name, user_path(group.owner) -# = t("layout.groups.list_header")
%td.last -# .inner
= raw [(link_to t("layout.edit"), edit_group_path(group) if can? :update, group), -# %table.table
(link_to t("layout.delete"), group_path(group), :method => :delete, :confirm => t("layout.groups.confirm_delete") if can? :destroy, group)].compact.join('&nbsp;|&nbsp;') -# %tr
.actions-bar.wat-cf -# %th.first ID
.actions= will_paginate @groups, :param_name => :group_page -# %th= t("activerecord.attributes.group.name")
-# %th= t("activerecord.attributes.group.owner")
-# %th.last &nbsp;
-# - @groups.each do |group|
-# %tr{:class => cycle("odd", "even")}
-# %td
-# = group.id
-# %td
-# = link_to group.name, group_path(group)
-# %td
-# = link_to group.owner.name, user_path(group.owner)
-# %td.last
-# = raw [(link_to t("layout.edit"), edit_group_path(group) if can? :update, group),
-# (link_to t("layout.delete"), group_path(group), :method => :delete, :confirm => t("layout.groups.confirm_delete") if can? :destroy, group)].compact.join('&nbsp;|&nbsp;')
-# .actions-bar.wat-cf
-# .actions= will_paginate @groups, :param_name => :group_page
-# content_for :sidebar, render('sidebar') -# content_for :sidebar, render('sidebar')

View File

@ -1,78 +1,88 @@
.block .all.verybigpadding
.secondary-navigation %h3= @group.name
%ul.wat-cf %h4= t("activerecord.attributes.group.description") + ":"
%li.first= link_to t("layout.groups.list"), groups_path %p= @group.description
%li= link_to t("layout.groups.new"), new_group_path %h4= t("layout.groups.projects_list") + ":"
%li.active= link_to t("layout.groups.show"), group_path %p
.content - @group.projects.each do |project|
.inner = link_to project.name, project
%p %br
%b
Id
\:
= @group.id
%p
%b
= t("activerecord.attributes.group.name")
\:
= @group.name
%p
%b
= t("activerecord.attributes.group.owner")
\:
= link_to @group.owner.name, user_path(@group.owner)
%p
%b
= t("activerecord.attributes.group.created_at")
\:
= @group.created_at
.wat-cf
= link_to image_tag("code.png", :alt => t("layout.edit")) + " " + t("layout.edit"), edit_group_path(@group), :class => "button"
= link_to image_tag("x.png", :alt => t("layout.delete")) + " " + t("layout.delete"), group_path(@group), :method => "delete", :class => "button", :confirm => t("layout.groups.confirm_delete")
.block
.secondary-navigation
%ul.wat-cf
%li.first.active= link_to t("layout.platforms.list"), platforms_path
%li= link_to t("layout.platforms.new"), new_group_platform_path(@group)
.content
%h2.title
= t("layout.platforms.list_header")
.inner
= render :partial => 'shared/search_form'
= render :partial => 'platforms/list', :object => @platforms
.actions-bar.wat-cf
.actions
= will_paginate @platforms, :param_name => :platform_page
-#.block -#.block
.secondary-navigation -# .secondary-navigation
%ul.wat-cf -# %ul.wat-cf
%li.first.active= link_to t("layout.repositories.list"), repositories_path -# %li.first= link_to t("layout.groups.list"), groups_path
%li= link_to t("layout.repositories.new"), new_group_repository_path(@group) -# %li= link_to t("layout.groups.new"), new_group_path
.content -# %li.active= link_to t("layout.groups.show"), group_path
%h2.title -# .content
= t("layout.repositories.list_header") -# .inner
.inner -# %p
= render :partial => 'shared/search_form' -# %b
= render :partial => 'repositories/list', :object => @repositories -# Id
.actions-bar.wat-cf -# \:
.actions -# = @group.id
= will_paginate @repositories, :param_name => :repository_page -# %p
-# %b
.block -# = t("activerecord.attributes.group.name")
.secondary-navigation -# \:
%ul.wat-cf -# = @group.name
%li.first.active= link_to t("layout.projects.list"), projects_path -# %p
%li= link_to t("layout.projects.new"), new_group_project_path(@group) -# %b
.content -# = t("activerecord.attributes.group.owner")
%h2.title -# \:
= t("layout.projects.list_header") -# = link_to @group.owner.name, user_path(@group.owner)
.inner -# %p
= render :partial => 'shared/search_form' -# %b
= render :partial => 'projects/list', :object => @projects -# = t("activerecord.attributes.group.created_at")
.actions-bar.wat-cf -# \:
.actions -# = @group.created_at
= will_paginate @projects, :param_name => :project_page -# .wat-cf
-# = link_to image_tag("code.png", :alt => t("layout.edit")) + " " + t("layout.edit"), edit_group_path(@group), :class => "button"
- content_for :sidebar, render('sidebar') -# = link_to image_tag("x.png", :alt => t("layout.delete")) + " " + t("layout.delete"), group_path(@group), :method => "delete", :class => "button", :confirm => t("layout.groups.confirm_delete")
-#
-#.block
-# .secondary-navigation
-# %ul.wat-cf
-# %li.first.active= link_to t("layout.platforms.list"), platforms_path
-# %li= link_to t("layout.platforms.new"), new_group_platform_path(@group)
-# .content
-# %h2.title
-# = t("layout.platforms.list_header")
-# .inner
-# = render :partial => 'shared/search_form'
-# = render :partial => 'platforms/list', :object => @platforms
-# .actions-bar.wat-cf
-# .actions
-# = will_paginate @platforms, :param_name => :platform_page
-#
-#-#.block
-# .secondary-navigation
-# %ul.wat-cf
-# %li.first.active= link_to t("layout.repositories.list"), repositories_path
-# %li= link_to t("layout.repositories.new"), new_group_repository_path(@group)
-# .content
-# %h2.title
-# = t("layout.repositories.list_header")
-# .inner
-# = render :partial => 'shared/search_form'
-# = render :partial => 'repositories/list', :object => @repositories
-# .actions-bar.wat-cf
-# .actions
-# = will_paginate @repositories, :param_name => :repository_page
-#
-#.block
-# .secondary-navigation
-# %ul.wat-cf
-# %li.first.active= link_to t("layout.projects.list"), projects_path
-# %li= link_to t("layout.projects.new"), new_group_project_path(@group)
-# .content
-# %h2.title
-# = t("layout.projects.list_header")
-# .inner
-# = render :partial => 'shared/search_form'
-# = render :partial => 'projects/list', :object => @projects
-# .actions-bar.wat-cf
-# .actions
-# = will_paginate @projects, :param_name => :project_page
-#
-#- content_for :sidebar, render('sidebar')

View File

@ -15,9 +15,9 @@
= f.label :owner_id, t("activerecord.attributes.project.owner"), :class => :label = f.label :owner_id, t("activerecord.attributes.project.owner"), :class => :label
.rightlist .rightlist
= label_tag t("activerecord.attributes.project.who_owns.me") = label_tag t("activerecord.attributes.project.who_owns.me")
= radio_button_tag :who_owns, 'me'#, {}.merge( (@who_owns == :me ? {:checked => 'checked'} : {}) ) = radio_button_tag :who_owns, 'me', :html => {:class => 'niceRadio'}#, {}.merge( (@who_owns == :me ? {:checked => 'checked'} : {}) )
= label_tag t("activerecord.attributes.project.who_owns.group") = label_tag t("activerecord.attributes.project.who_owns.group")
= radio_button_tag :who_owns, 'group'#, {}.merge( (@who_owns == :group ? {:checked => 'checked'} : {}) ) = radio_button_tag :who_owns, 'group', :class => 'niceRadio'#, {}.merge( (@who_owns == :group ? {:checked => 'checked'} : {}) )
-# TODO: Make our own select_box helper with new design, blackjack and bitches! -# TODO: Make our own select_box helper with new design, blackjack and bitches!
= select_tag :owner_id, options_for_select( Group.can_own_project(current_user) ) = select_tag :owner_id, options_for_select( Group.can_own_project(current_user) )
.both .both

View File

@ -296,6 +296,9 @@ en:
own_projects: My projects own_projects: My projects
part_projects: Participate projects part_projects: Participate projects
filter_header: Filter filter_header: Filter
group: Group
description: Descripton
leave_group: Leave group
git: git:
upload: Upload upload: Upload

View File

@ -271,7 +271,7 @@ ru:
groups: groups:
list: Список list: Список
new: Создать new: Создать группу
edit: Редактировать edit: Редактировать
members: Участники members: Участники
new_header: Новая группа new_header: Новая группа
@ -281,6 +281,10 @@ ru:
back_to_the_list: К списку групп back_to_the_list: К списку групп
confirm_delete: Вы уверены, что хотите удалить эту группу? confirm_delete: Вы уверены, что хотите удалить эту группу?
edit_members: Изменить список участников edit_members: Изменить список участников
group: Группа
description: Описание
leave_group: Покинуть группу
projects_list: Список проектов
users: users:
list: Список list: Список
@ -677,6 +681,7 @@ ru:
owner: Владелец owner: Владелец
created_at: Создана created_at: Создана
updated_at: Обновлена updated_at: Обновлена
description: Описание
user: user:
name: Имя name: Имя

View File

@ -0,0 +1,5 @@
class AddDescriptionToGroups < ActiveRecord::Migration
def change
add_column :groups, :description, :text
end
end

View File

@ -11,7 +11,15 @@
# #
# 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 => 20120224122738) do ActiveRecord::Schema.define(:version => 20120229163054) 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| create_table "arches", :force => true do |t|
t.string "name", :null => false t.string "name", :null => false
@ -155,6 +163,7 @@ ActiveRecord::Schema.define(:version => 20120224122738) do
t.datetime "updated_at" t.datetime "updated_at"
t.string "uname" t.string "uname"
t.integer "own_projects_count", :default => 0, :null => false t.integer "own_projects_count", :default => 0, :null => false
t.text "description"
end end
create_table "issues", :force => true do |t| create_table "issues", :force => true do |t|
@ -263,22 +272,20 @@ ActiveRecord::Schema.define(:version => 20120224122738) do
t.boolean "is_rpm", :default => true t.boolean "is_rpm", :default => true
end 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| create_table "register_requests", :force => true do |t|
t.string "name" t.string "name"
t.string "email" t.string "email"
t.string "token" t.string "token"
t.boolean "approved", :default => false t.boolean "approved", :default => false
t.boolean "rejected", :default => false t.boolean "rejected", :default => false
t.datetime "created_at" t.datetime "created_at", :null => false
t.datetime "updated_at" t.datetime "updated_at", :null => false
t.string "interest" t.string "interest"
t.text "more" t.text "more"
end end
add_index "register_requests", ["email"], :name => "index_register_requests_on_email", :unique => true, :case_sensitive => false 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| create_table "relations", :force => true do |t|
t.integer "object_id" t.integer "object_id"
@ -337,8 +344,8 @@ ActiveRecord::Schema.define(:version => 20120224122738) do
t.string "name" t.string "name"
t.string "email", :default => "", :null => false t.string "email", :default => "", :null => false
t.string "encrypted_password", :limit => 128, :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.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at" t.datetime "remember_created_at"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
@ -346,9 +353,14 @@ ActiveRecord::Schema.define(:version => 20120224122738) do
t.string "uname" t.string "uname"
t.string "role" t.string "role"
t.string "language", :default => "en" 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.integer "own_projects_count", :default => 0, :null => false
t.datetime "reset_password_sent_at"
end 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", ["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", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
add_index "users", ["uname"], :name => "index_users_on_uname", :unique => true add_index "users", ["uname"], :name => "index_users_on_uname", :unique => true