[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
puts parent.inspect
@groups = if parent? and !parent.nil?
parent.groups
else
Group
end.accessible_by(current_ability)
#@groups = #if parent? and !parent.nil?
# parent.groups
#else
# Group
#end.accessible_by(current_ability)
@groups = current_user.groups#accessible_by(current_ability)
@groups = if params[:query]
@groups.where(["name LIKE ?", "%#{params[:query]}%"])

View File

@ -1,30 +1,45 @@
.block
.secondary-navigation
%ul.wat-cf
%li.first.active= link_to t("layout.groups.list"), users_path
%li= link_to t("layout.groups.new"), new_group_path
.content
%h2.title
= t("layout.groups.list_header")
.inner
%table.table
%tr
%th.first ID
%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
= link_to t("layout.groups.new"), new_group_path, :class => "button"
%table#myTable.tablesorter.group-list{:cellpadding => "0", :cellspacing => "0"}
%thead
%tr
%th.th1= t("layout.groups.group")
%th.th2= t("layout.groups.description")
%th= t("layout.groups.leave_group")
%tbody
- @groups.each do |group|
%tr#Row1
%td= link_to group.name, group_path(group)
%td.td2= group.description
%td.td5
= link_to image_tag('x.png'), '#' unless group.owner_id == current_user.id
-#.block
-# .secondary-navigation
-# %ul.wat-cf
-# %li.first.active= link_to t("layout.groups.list"), users_path
-# %li= link_to t("layout.groups.new"), new_group_path
-# .content
-# %h2.title
-# = t("layout.groups.list_header")
-# .inner
-# %table.table
-# %tr
-# %th.first ID
-# %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')

View File

@ -1,78 +1,88 @@
.block
.secondary-navigation
%ul.wat-cf
%li.first= link_to t("layout.groups.list"), groups_path
%li= link_to t("layout.groups.new"), new_group_path
%li.active= link_to t("layout.groups.show"), group_path
.content
.inner
%p
%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
.all.verybigpadding
%h3= @group.name
%h4= t("activerecord.attributes.group.description") + ":"
%p= @group.description
%h4= t("layout.groups.projects_list") + ":"
%p
- @group.projects.each do |project|
= link_to project.name, project
%br
-#.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')
-# .secondary-navigation
-# %ul.wat-cf
-# %li.first= link_to t("layout.groups.list"), groups_path
-# %li= link_to t("layout.groups.new"), new_group_path
-# %li.active= link_to t("layout.groups.show"), group_path
-# .content
-# .inner
-# %p
-# %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
-# .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
.rightlist
= 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")
= 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!
= select_tag :owner_id, options_for_select( Group.can_own_project(current_user) )
.both

View File

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

View File

@ -271,7 +271,7 @@ ru:
groups:
list: Список
new: Создать
new: Создать группу
edit: Редактировать
members: Участники
new_header: Новая группа
@ -281,6 +281,10 @@ ru:
back_to_the_list: К списку групп
confirm_delete: Вы уверены, что хотите удалить эту группу?
edit_members: Изменить список участников
group: Группа
description: Описание
leave_group: Покинуть группу
projects_list: Список проектов
users:
list: Список
@ -677,6 +681,7 @@ ru:
owner: Владелец
created_at: Создана
updated_at: Обновлена
description: Описание
user:
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.
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|
t.string "name", :null => false
@ -155,6 +163,7 @@ ActiveRecord::Schema.define(:version => 20120224122738) do
t.datetime "updated_at"
t.string "uname"
t.integer "own_projects_count", :default => 0, :null => false
t.text "description"
end
create_table "issues", :force => true do |t|
@ -263,22 +272,20 @@ ActiveRecord::Schema.define(:version => 20120224122738) do
t.boolean "is_rpm", :default => true
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"
@ -337,8 +344,8 @@ ActiveRecord::Schema.define(:version => 20120224122738) 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"
@ -346,9 +353,14 @@ ActiveRecord::Schema.define(:version => 20120224122738) 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