Merge pull request #431 from warpc/263-refactoring

Github style URLs and refactor
This commit is contained in:
Alexander Machehin 2012-05-03 08:43:29 -07:00
commit 4def449a6d
264 changed files with 1396 additions and 1537 deletions

20
Gemfile
View File

@ -1,6 +1,6 @@
source 'http://rubygems.org'
gem 'rails', '3.2.2' #, :git => 'git://github.com/rails/rails.git'
gem 'rails', '3.2.3' #, :git => 'git://github.com/rails/rails.git'
gem 'pg', '~> 0.13.2'
# gem 'silent-postgres', :git => 'git://github.com/dolzenko/silent-postgres.git' #'~> 0.1.1'
@ -13,7 +13,7 @@ gem 'omniauth-openid', '~> 1.0.1'
gem 'cancan', '~> 1.6.7'
gem 'ancestry', '~> 1.2.5'
gem 'paperclip', '~> 2.7.0'
gem 'paperclip', '~> 3.0.2'
gem 'delayed_job_active_record', '~> 0.3.2'
gem 'russian', '~> 0.6.0'
gem 'highline', '~> 1.6.11'
@ -37,30 +37,30 @@ gem 'wikicloth'
gem 'unicorn', '~> 4.2.1', :platforms => [:mri, :rbx]
gem 'trinidad', '~> 1.0.2', :platforms => :jruby
gem 'newrelic_rpm', '~> 3.3.2', :platforms => [:mri, :rbx]
gem 'newrelic_rpm', '~> 3.3.3', :platforms => [:mri, :rbx]
gem 'whenever', '~> 0.7.3', :require => false
gem 'rails3-jquery-autocomplete', '~> 1.0.6'
gem 'rails3-jquery-autocomplete', '~> 1.0.7'
gem 'will_paginate', '~> 3.0.3'
gem 'meta-tags', '~> 1.2.5', :require => 'meta_tags'
gem "haml-rails", '~> 0.3.4'
gem 'ruby-haml-js'
gem 'rails-backbone'
gem 'jquery-rails', '~> 2.0.1'
gem 'jquery-rails', '~> 2.0.2'
gem 'ruby-haml-js', '~> 0.0.3'
gem 'rails-backbone', '~> 0.7.2'
group :assets do
gem 'sass-rails', '~> 3.2.5'
gem 'coffee-rails', '~> 3.2.2'
gem 'compass-rails', '~> 1.0.1'
gem 'uglifier', '~> 1.2.4'
gem 'therubyracer', '~> 0.10.0', :platforms => [:mri, :rbx]
gem 'therubyracer', '~> 0.10.1', :platforms => [:mri, :rbx]
gem 'therubyrhino', '~> 1.73.1', :platforms => :jruby
end
group :production do
gem "airbrake", '~> 3.0.9'
gem 'bluepill', '~> 0.0.60', :require => false
gem 'daemons', '1.1.6' # for DJ
gem 'daemons', '1.1.6' # Try to upgrade 1.1.8 to avoid tons DJ bugs?
end
group :development do
@ -76,7 +76,7 @@ end
group :test do
gem 'rspec-rails', '~> 2.9.0', :group => 'development'
gem 'factory_girl_rails', '~> 3.0.0'
gem 'factory_girl_rails', '~> 3.1.0'
gem 'rr', '~> 1.0.4'
gem 'shoulda'
end

View File

@ -25,32 +25,31 @@ GEM
remote: http://rubygems.org/
specs:
RedCloth (4.2.9)
RedCloth (4.2.9-java)
actionmailer (3.2.2)
actionpack (= 3.2.2)
mail (~> 2.4.0)
actionpack (3.2.2)
activemodel (= 3.2.2)
activesupport (= 3.2.2)
actionmailer (3.2.3)
actionpack (= 3.2.3)
mail (~> 2.4.4)
actionpack (3.2.3)
activemodel (= 3.2.3)
activesupport (= 3.2.3)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.1)
rack (~> 1.4.0)
rack-cache (~> 1.1)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.1.2)
activemodel (3.2.2)
activesupport (= 3.2.2)
activemodel (3.2.3)
activesupport (= 3.2.3)
builder (~> 3.0.0)
activerecord (3.2.2)
activemodel (= 3.2.2)
activesupport (= 3.2.2)
activerecord (3.2.3)
activemodel (= 3.2.3)
activesupport (= 3.2.3)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.2)
activemodel (= 3.2.2)
activesupport (= 3.2.2)
activesupport (3.2.2)
activeresource (3.2.3)
activemodel (= 3.2.3)
activesupport (= 3.2.3)
activesupport (3.2.3)
i18n (~> 0.6)
multi_json (~> 1.0)
airbrake (3.0.9)
@ -62,7 +61,6 @@ GEM
activerecord (>= 2.2.2)
arel (3.0.2)
bcrypt-ruby (3.0.1)
bcrypt-ruby (3.0.1-java)
blankslate (2.1.2.4)
bluepill (0.0.60)
activesupport (>= 3.0.0)
@ -72,7 +70,7 @@ GEM
builder (3.0.0)
cancan (1.6.7)
cape (1.4.0)
capistrano (2.11.2)
capistrano (2.12.0)
highline
net-scp (>= 1.0.0)
net-sftp (>= 2.0.0)
@ -89,7 +87,7 @@ GEM
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.2.0)
coffee-script-source (1.3.1)
compass (0.12.1)
chunky_png (~> 1.2)
fssm (>= 0.2.7)
@ -98,7 +96,7 @@ GEM
compass (~> 0.12.0)
creole (0.4.2)
daemons (1.1.6)
delayed_job (3.0.1)
delayed_job (3.0.2)
activesupport (~> 3.0)
delayed_job_active_record (0.3.2)
activerecord (> 2.1.0)
@ -113,17 +111,16 @@ GEM
ejs (1.0.0)
erubis (2.7.0)
eventmachine (0.12.10)
eventmachine (0.12.10-java)
execjs (1.3.0)
multi_json (~> 1.0)
expression_parser (0.9.0)
factory_girl (3.0.0)
factory_girl (3.1.1)
activesupport (>= 3.0.0)
factory_girl_rails (3.0.0)
factory_girl (~> 3.0.0)
factory_girl_rails (3.1.0)
factory_girl (~> 3.1.0)
railties (>= 3.0.0)
fssm (0.2.8.1)
github-markup (0.7.1)
fssm (0.2.9)
github-markup (0.7.2)
gollum (1.3.1)
albino (~> 1.3.2)
github-markup (>= 0.4.0, < 1.0.0)
@ -148,12 +145,10 @@ GEM
activesupport (>= 3.0.0)
blankslate (>= 2.1.2.4)
journey (1.0.3)
jquery-rails (2.0.1)
jquery-rails (2.0.2)
railties (>= 3.2.0, < 5.0)
thor (~> 0.14)
jruby-rack (1.1.4)
json (1.6.6)
json (1.6.6-java)
kgio (2.7.4)
libv8 (3.3.10.4)
mail (2.4.4)
@ -172,7 +167,7 @@ GEM
meta-tags (1.2.6)
actionpack
mime-types (1.18)
multi_json (1.2.0)
multi_json (1.3.2)
mustache (0.99.4)
net-scp (1.0.4)
net-ssh (>= 1.99.1)
@ -181,9 +176,8 @@ GEM
net-ssh (2.3.0)
net-ssh-gateway (1.1.0)
net-ssh (>= 1.99.1)
newrelic_rpm (3.3.2.1)
newrelic_rpm (3.3.4)
nokogiri (1.5.2)
nokogiri (1.5.2-java)
omniauth (1.0.3)
hashie (~> 1.2)
rack
@ -191,9 +185,10 @@ GEM
omniauth (~> 1.0)
rack-openid (~> 1.3.1)
orm_adapter (0.0.7)
paperclip (2.7.0)
activerecord (>= 2.3.0)
activesupport (>= 2.3.2)
paperclip (3.0.2)
activemodel (>= 3.0.0)
activerecord (>= 3.0.0)
activesupport (>= 3.0.0)
cocaine (>= 0.0.2)
mime-types
pg (0.13.2)
@ -211,25 +206,25 @@ GEM
rack
rack-test (0.6.1)
rack (>= 1.0)
rails (3.2.2)
actionmailer (= 3.2.2)
actionpack (= 3.2.2)
activerecord (= 3.2.2)
activeresource (= 3.2.2)
activesupport (= 3.2.2)
rails (3.2.3)
actionmailer (= 3.2.3)
actionpack (= 3.2.3)
activerecord (= 3.2.3)
activeresource (= 3.2.3)
activesupport (= 3.2.3)
bundler (~> 1.0)
railties (= 3.2.2)
rails-backbone (0.7.1)
railties (= 3.2.3)
rails-backbone (0.7.2)
coffee-script (~> 2.2.0)
ejs (~> 1.0.0)
railties (>= 3.1.0)
rails3-generators (0.17.4)
railties (>= 3.0.0)
rails3-jquery-autocomplete (1.0.6)
rails3-jquery-autocomplete (1.0.7)
rails (~> 3.0)
railties (3.2.2)
actionpack (= 3.2.2)
activesupport (= 3.2.2)
railties (3.2.3)
actionpack (= 3.2.3)
activesupport (= 3.2.3)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
@ -246,7 +241,7 @@ GEM
rspec-expectations (~> 2.9.0)
rspec-mocks (~> 2.9.0)
rspec-core (2.9.0)
rspec-expectations (2.9.0)
rspec-expectations (2.9.1)
diff-lcs (~> 1.1.3)
rspec-mocks (2.9.0)
rspec-rails (2.9.0)
@ -254,7 +249,7 @@ GEM
activesupport (>= 3.0)
railties (>= 3.0)
rspec (~> 2.9.0)
ruby-haml-js (0.0.2)
ruby-haml-js (0.0.3)
execjs
sprockets (>= 2.0.0)
ruby-openid (2.1.8)
@ -262,7 +257,7 @@ GEM
i18n (>= 0.5.0)
sanitize (2.0.3)
nokogiri (>= 1.4.4, < 1.6)
sass (3.1.15)
sass (3.1.16)
sass-rails (3.2.5)
railties (~> 3.2.0)
sass (>= 3.1.10)
@ -285,11 +280,10 @@ GEM
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.5)
sqlite3 (1.3.6)
state_machine (1.1.2)
therubyracer (0.10.0)
therubyracer (0.10.1)
libv8 (~> 3.3.10)
therubyrhino (1.73.1)
thin (1.3.1)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
@ -299,11 +293,7 @@ GEM
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
trinidad (1.0.5)
jruby-rack (>= 1.0.2)
trinidad_jars (>= 0.3.0)
trinidad_jars (1.0.2)
tzinfo (0.3.32)
tzinfo (0.3.33)
uglifier (1.2.4)
execjs (>= 0.3.0)
multi_json (>= 1.0.2)
@ -316,13 +306,12 @@ GEM
whenever (0.7.3)
activesupport (>= 2.3.4)
chronic (~> 0.6.3)
wikicloth (0.7.1)
wikicloth (0.8.0)
builder
expression_parser
will_paginate (3.0.3)
PLATFORMS
java
ruby
DEPENDENCIES
@ -342,7 +331,7 @@ DEPENDENCIES
delayed_job_active_record (~> 0.3.2)
devise (~> 2.0.4)
diff-display (~> 0.0.1)
factory_girl_rails (~> 3.0.0)
factory_girl_rails (~> 3.1.0)
gollum (= 1.3.1)
grack!
grit!
@ -350,29 +339,29 @@ DEPENDENCIES
highline (~> 1.6.11)
hirb
jbuilder
jquery-rails (~> 2.0.1)
jquery-rails (~> 2.0.2)
mailcatcher
meta-tags (~> 1.2.5)
newrelic_rpm (~> 3.3.2)
newrelic_rpm (~> 3.3.3)
omniauth (~> 1.0.3)
omniauth-openid (~> 1.0.1)
paperclip (~> 2.7.0)
paperclip (~> 3.0.2)
pg (~> 0.13.2)
rails (= 3.2.2)
rails-backbone
rails (= 3.2.3)
rails-backbone (~> 0.7.2)
rails3-generators
rails3-jquery-autocomplete (~> 1.0.6)
rails3-jquery-autocomplete (~> 1.0.7)
rdiscount
redcarpet (= 1.17.2)
redhillonrails_core!
rr (~> 1.0.4)
rspec-rails (~> 2.9.0)
ruby-haml-js
ruby-haml-js (~> 0.0.3)
russian (~> 0.6.0)
sass-rails (~> 3.2.5)
shotgun
shoulda
therubyracer (~> 0.10.0)
therubyracer (~> 0.10.1)
therubyrhino (~> 1.73.1)
trinidad (~> 1.0.2)
uglifier (~> 1.2.4)

View File

@ -65,7 +65,7 @@ header div.middle {
background: image-url("top-middle.png");
float: left;
height: 46px;
width: 912px;
width: 913px;
}
header div.right {

View File

@ -0,0 +1,5 @@
# -*- encoding : utf-8 -*-
class Admin::BaseController < ApplicationController
before_filter :authenticate_user!
load_and_authorize_resource
end

View File

@ -1,8 +1,5 @@
# -*- encoding : utf-8 -*-
class EventLogsController < ApplicationController
before_filter :authenticate_user!
load_and_authorize_resource
class Admin::EventLogsController < Admin::BaseController
def index
@event_logs = EventLog.default_order.eager_loading.paginate :page => params[:page]
end

View File

@ -0,0 +1,21 @@
# -*- encoding : utf-8 -*-
class Admin::RegisterRequestsController < Admin::BaseController
def index
@register_requests = @register_requests.send((params[:scope] || 'unprocessed').to_sym).paginate(:page => params[:page])
end
def update
RegisterRequest.where(:id => params[:request_ids]).each(&params[:update_type].to_sym) if params[:update_type].present? && params[:request_ids].present?
redirect_to :action => :index
end
def approve
@register_request.approve
redirect_to :action => :index
end
def reject
@register_request.reject
redirect_to :action => :index
end
end

View File

@ -1,7 +1,6 @@
# -*- encoding : utf-8 -*-
class Admin::UsersController < ApplicationController
before_filter :authenticate_user!
load_and_authorize_resource
class Admin::UsersController < Admin::BaseController
prepend_before_filter :find_user
def index
@filter = params[:filter] || 'all'
@ -15,7 +14,7 @@ class Admin::UsersController < ApplicationController
@user.confirmed_at = Time.now.utc
if @user.save
flash[:notice] = t('flash.user.saved')
redirect_to users_path
redirect_to admin_users_path
else
flash[:error] = t('flash.user.save_error')
flash[:warning] = @user.errors.full_messages.join('. ')
@ -23,7 +22,7 @@ class Admin::UsersController < ApplicationController
end
end
def profile
def edit
end
def update
@ -34,18 +33,18 @@ class Admin::UsersController < ApplicationController
@user.save
end
flash[:notice] = t('flash.user.saved')
redirect_to users_path#edit_user_path(@user)
redirect_to admin_users_path
else
flash[:error] = t('flash.user.save_error')
flash[:warning] = @user.errors.full_messages.join('. ')
render(:action => :profile)
render :action => :edit
end
end
def destroy
@user.destroy
flash[:notice] = t("flash.user.destroyed")
redirect_to users_path
redirect_to admin_users_path
end
def list
@ -64,6 +63,12 @@ class Admin::UsersController < ApplicationController
@total_user = @users.count
@users = @users.order(order)
render :partial =>'users_ajax', :layout => false
render :partial => 'users_ajax', :layout => false
end
protected
def find_user
@user = User.find_by_uname!(params[:id]) if params[:id]
end
end

View File

@ -1,38 +0,0 @@
# -*- encoding : utf-8 -*-
class Git::BaseController < ApplicationController
before_filter :authenticate_user!
skip_before_filter :authenticate_user!, :only => [:show, :index, :blame, :raw, :archive] if APP_CONFIG['anonymous_access']
load_and_authorize_resource :project
before_filter :find_git_repository
before_filter :find_tags
before_filter :find_branches
before_filter :set_treeish
before_filter :set_current_tag
before_filter :set_current_branch
protected
def find_git_repository
@git_repository = @project.git_repository
end
def find_tags
@tags = @git_repository.tags
end
def find_branches
@branches = @git_repository.branches
end
def set_treeish
@treeish = params[:treeish].presence || @project.default_branch
end
def set_current_tag
@current_tag = @tags.select{|t| t.name == @treeish }.first
end
def set_current_branch
@current_branch = @branches.select{|b| b.name == @treeish }.first
end
end

View File

@ -0,0 +1,13 @@
# -*- encoding : utf-8 -*-
class Groups::BaseController < ApplicationController
before_filter :authenticate_user!
before_filter :find_group
protected
def find_group
if group_id = params[:owner_name] || params[:group_id] || params[:id]
@group = Group.find_by_insensitive_uname! group_id
end
end
end

View File

@ -0,0 +1,57 @@
# -*- encoding : utf-8 -*-
class Groups::MembersController < Groups::BaseController
is_related_controller!
belongs_to :group, :finder => 'find_by_insensitive_uname!', :optional => true
before_filter lambda { authorize! :manage_members, @group }
def index
end
def update
params['user'].keys.each do |user_id|
role = params['user'][user_id]
if relation = parent.actors.where(:actor_id => user_id, :actor_type => 'User') #find_by_actor_id_and_actor_type(user_id, 'User')
relation.update_all(:role => role) if parent.owner.id.to_s != user_id
else
relation = parent.actors.build(:actor_id => user_id, :actor_type => 'User', :role => role)
relation.save!
end
end if params['user']
if parent.save
flash[:notice] = t("flash.members.successfully_changed")
else
flash[:error] = t("flash.members.error_in_changing")
end
redirect_to group_members_path(parent)
end
def remove
all_user_ids = []
params['user_remove'].each do |user_id, remove|
all_user_ids << user_id if remove == ["1"] && parent.owner.id.to_s != user_id
end if params['user_remove']
all_user_ids.each do |user_id|
u = User.find(user_id)
Relation.by_actor(u).by_target(parent).each {|r| r.destroy}
end
redirect_to group_members_path(parent)
end
def add
if params['user_id'] and !params['user_id'].empty?
@user = User.find_by_uname(params['user_id'])
unless parent.actors.exists? :actor_id => @user.id, :actor_type => 'User'
relation = parent.actors.build(:actor_id => @user.id, :actor_type => 'User', :role => params[:role])
if relation.save
flash[:notice] = t("flash.members.successfully_added")
else
flash[:error] = t("flash.members.error_in_adding")
end
else
flash[:error] = t("flash.members.already_added")
end
end
redirect_to group_members_path(parent)
end
end

View File

@ -0,0 +1,55 @@
# -*- encoding : utf-8 -*-
class Groups::ProfileController < Groups::BaseController
load_and_authorize_resource :class => Group, :instance_name => 'group'
autocomplete :group, :uname
def index
@groups = current_user.groups.paginate(:page => params[:group_page]) # accessible_by(current_ability)
@groups = @groups.search(params[:query]) if params[:query].present?
end
def show
@projects = @group.projects #.paginate(:page => params[:project_page], :per_page => 10)
end
def new
end
def edit
end
def create
@group = Group.new params[:group]
@group.owner = current_user
if @group.save
flash[:notice] = t('flash.group.saved')
redirect_to group_path(@group)
else
flash[:error] = t('flash.group.save_error')
flash[:warning] = @group.errors.full_messages.join('. ')
render :action => :new
end
end
def update
if @group.update_attributes(params[:group])
flash[:notice] = t('flash.group.saved')
redirect_to group_path(@group)
else
flash[:error] = t('flash.group.save_error')
render :action => :edit
end
end
def destroy
@group.destroy
flash[:notice] = t("flash.group.destroyed")
redirect_to groups_path
end
def remove_user
Relation.by_object(current_user).by_target(@group).destroy_all
redirect_to groups_path
end
end

View File

@ -1,71 +0,0 @@
# -*- encoding : utf-8 -*-
class GroupsController < ApplicationController
is_related_controller!
belongs_to :user, :optional => true
before_filter :authenticate_user!
before_filter :find_group, :only => [:show, :edit, :update, :destroy]
load_and_authorize_resource :except => :create
authorize_resource :only => :create
autocomplete :group, :uname
def index
@groups = current_user.groups#accessible_by(current_ability)
@groups = if params[:query]
@groups.where(["name LIKE ?", "%#{params[:query]}%"])
else
@groups
end.paginate(:page => params[:group_page])
end
def show
@projects = @group.projects.paginate(:page => params[:project_page], :per_page => 10)
end
def new
@group = Group.new
end
def edit
end
def create
@group = Group.new(:description => params[:group][:description])
@group.owner = current_user
@group.uname = params[:group][:uname]
if @group.save
flash[:notice] = t('flash.group.saved')
redirect_to group_path(@group)
else
flash[:error] = t('flash.group.save_error')
flash[:warning] = @group.errors.full_messages.join('. ')
render :action => :new
end
end
def update
if @group.update_attributes(params[:group])
flash[:notice] = t('flash.group.saved')
redirect_to group_path(@group)
else
flash[:error] = t('flash.group.save_error')
render :action => :edit
end
end
def destroy
@group.destroy
flash[:notice] = t("flash.group.destroyed")
redirect_to groups_path
end
protected
def find_group
@group = Group.find(params[:id])
end
end

View File

@ -1,98 +0,0 @@
# -*- encoding : utf-8 -*-
class MembersController < ApplicationController
before_filter :authenticate_user!
is_related_controller!
belongs_to :group, :optional => true
# before_filter :find_target
before_filter :find_users
def index
redirect_to edit_group_members_path(parent)
end
def show
end
def new
end
def edit
if params[:id]
@user = User.find params[:id]
render :edit_rights and return
end
@group = parent
end
def create
end
def update
params['user'].keys.each { |user_id|
role = params['user'][user_id]
if relation = parent.actors.where(:actor_id => user_id, :actor_type => 'User') #find_by_actor_id_and_actor_type(user_id, 'User')
relation.update_attribute(:role, role)
else
relation = parent.actors.build(:actor_id => user_id, :actor_type => 'User', :role => role)
relation.save!
end
} if params['user']
if parent.save
flash[:notice] = t("flash.members.successfully_changed")
else
flash[:error] = t("flash.members.error_in_changing")
end
redirect_to edit_group_members_path(parent)
end
def remove
if params[:id]
u = User.find(params[:id])
Relation.by_actor(u).by_target(parent)[0].destroy
redirect_to groups_path
else
all_user_ids = []
params['user_remove'].keys.each { |user_id|
all_user_ids << user_id if params['user_remove'][user_id] == ["1"]
} if params['user_remove']
all_user_ids.each do |user_id|
u = User.find(user_id)
Relation.by_actor(u).by_target(parent).each {|r| r.destroy}
end
redirect_to edit_group_members_path(parent)
end
end
def add
if params['user_id'] and !params['user_id'].empty?
@user = User.find_by_uname(params['user_id'])
unless parent.actors.exists? :actor_id => @user.id, :actor_type => 'User'
relation = parent.actors.build(:actor_id => @user.id, :actor_type => 'User', :role => params[:role])
if relation.save
flash[:notice] = t("flash.members.successfully_added")
else
flash[:error] = t("flash.members.error_in_adding")
end
else
flash[:error] = t("flash.members.already_added")
end
end
redirect_to edit_group_members_path(parent)
end
protected
def find_users
@users = parent.members #User.all
end
end

View File

@ -0,0 +1,3 @@
# -*- encoding : utf-8 -*-
class Platforms::BaseController < ApplicationController
end

View File

@ -1,5 +1,5 @@
# -*- encoding : utf-8 -*-
class PlatformsController < ApplicationController
class Platforms::PlatformsController < Platforms::BaseController
before_filter :authenticate_user!
load_and_authorize_resource
@ -17,7 +17,6 @@ class PlatformsController < ApplicationController
end
def show
end
def new

View File

@ -1,5 +1,5 @@
# -*- encoding : utf-8 -*-
class PrivateUsersController < ApplicationController
class Platforms::PrivateUsersController < Platforms::BaseController
before_filter :authenticate_user!
before_filter :find_platform_and_private_users

View File

@ -1,5 +1,5 @@
# -*- encoding : utf-8 -*-
class PrivatesController < ApplicationController
class Platforms::PrivatesController < Platforms::BaseController
require 'digest/sha2'
before_filter :find_platform

View File

@ -1,5 +1,5 @@
# -*- encoding : utf-8 -*-
class ProductBuildListsController < ApplicationController
class Platforms::ProductBuildListsController < Platforms::BaseController
before_filter :authenticate_user!, :except => [:status_build]
skip_before_filter :authenticate_user!, :only => [:index] if APP_CONFIG['anonymous_access']
load_and_authorize_resource :platform, :only => [:create, :destroy]

View File

@ -1,5 +1,5 @@
# -*- encoding : utf-8 -*-
class ProductsController < ApplicationController
class Platforms::ProductsController < Platforms::BaseController
before_filter :authenticate_user!
load_and_authorize_resource :platform

View File

@ -1,5 +1,5 @@
# -*- encoding : utf-8 -*-
class RepositoriesController < ApplicationController
class Platforms::RepositoriesController < Platforms::BaseController
before_filter :authenticate_user!
load_and_authorize_resource :platform

View File

@ -0,0 +1,10 @@
# -*- encoding : utf-8 -*-
class Projects::BaseController < ApplicationController
prepend_before_filter :find_project
protected
def find_project
@project = Project.find_by_owner_and_name!(params[:owner_name], params[:project_name]) if params[:owner_name] && params[:project_name]
end
end

View File

@ -1,15 +1,14 @@
# -*- encoding : utf-8 -*-
class BuildListsController < ApplicationController
class Projects::BuildListsController < Projects::BaseController
CALLBACK_ACTIONS = [:publish_build, :status_build, :pre_build, :post_build, :circle_build, :new_bbdt]
NESTED_ACTIONS = [:search, :index, :new, :create]
before_filter :authenticate_user!, :except => CALLBACK_ACTIONS
before_filter :authenticate_build_service!, :only => CALLBACK_ACTIONS
skip_before_filter :authenticate_user!, :only => [:show, :index, :search] if APP_CONFIG['anonymous_access']
before_filter :find_project, :only => NESTED_ACTIONS
before_filter :find_build_list, :only => [:show, :publish, :cancel, :reject_publish]
before_filter :find_build_list, :only => [:show, :publish, :cancel]
before_filter :find_build_list_by_bs, :only => [:publish_build, :status_build, :pre_build, :post_build, :circle_build]
before_filter :find_platform, :only => [:create]
load_and_authorize_resource :project, :only => NESTED_ACTIONS
load_and_authorize_resource :build_list, :through => :project, :only => NESTED_ACTIONS, :shallow => true
@ -36,12 +35,12 @@ class BuildListsController < ApplicationController
end
def new
@build_list = BuildList.new
# @build_list = BuildList.new # @build_list already created by CanCan
end
def create
notices, errors = [], []
# Disable auto_publish if platform released
@platform = Platform.find params[:build_list][:pl_id]
params[:build_list][:auto_publish] = false if @platform.released
Arch.where(:id => params[:arches]).each do |arch|
Platform.main.where(:id => params[:bpls]).each do |bpl|
@ -160,14 +159,6 @@ class BuildListsController < ApplicationController
protected
def find_project
@project = Project.find_by_id params[:project_id]
end
def find_platform
@platform = Platform.find params[:build_list][:pl_id]
end
def find_build_list
@build_list = BuildList.find(params[:id])
end

View File

@ -1,16 +1,14 @@
# -*- encoding : utf-8 -*-
class CollaboratorsController < ApplicationController
class Projects::CollaboratorsController < Projects::BaseController
respond_to :html, :json
before_filter :authenticate_user!
before_filter :find_project
before_filter :find_users
before_filter :find_groups
load_resource :project
before_filter :authorize_collaborators
before_filter :find_users
before_filter :find_groups
def index
@collaborators = Collaborator.find_by_project(@project)
respond_with @collaborators
@ -67,21 +65,17 @@ class CollaboratorsController < ApplicationController
protected
def find_project
@project = Project.find params[:project_id]
end
def find_users
@users = @project.collaborators.order('uname')#User.all
@users = @users.without(@project.owner_id) if @project.owner_type == 'User'
end
def find_users
@users = @project.collaborators.order('uname')#User.all
@users = @users.without(@project.owner_id) if @project.owner_type == 'User'
end
def find_groups
@groups = @project.groups.order('uname')#Group.all
@groups = @groups.without(@project.owner_id) if @project.owner_type == 'Group'
end
def find_groups
@groups = @project.groups.order('uname')#Group.all
@groups = @groups.without(@project.owner_id) if @project.owner_type == 'Group'
end
def authorize_collaborators
authorize! :update, @project
end
def authorize_collaborators
authorize! :update, @project
end
end

View File

@ -1,5 +1,5 @@
# -*- encoding : utf-8 -*-
class CommentsController < ApplicationController
class Projects::CommentsController < Projects::BaseController
before_filter :authenticate_user!
load_and_authorize_resource :project
before_filter :find_commentable

View File

@ -1,7 +1,6 @@
# -*- encoding : utf-8 -*-
class CommitSubscribesController < ApplicationController
class Projects::CommitSubscribesController < Projects::BaseController
before_filter :authenticate_user!
load_and_authorize_resource :project
before_filter :find_commit

View File

@ -0,0 +1,39 @@
# -*- encoding : utf-8 -*-
class Projects::Git::BaseController < Projects::BaseController
before_filter :authenticate_user!
skip_before_filter :authenticate_user!, :only => [:show, :index, :blame, :raw, :archive] if APP_CONFIG['anonymous_access']
load_and_authorize_resource :project
before_filter :find_git_repository
before_filter :find_tags
before_filter :find_branches
before_filter :set_treeish
before_filter :set_current_tag
before_filter :set_current_branch
protected
def find_git_repository
@git_repository = @project.git_repository
end
def find_tags
@tags = @git_repository.tags
end
def find_branches
@branches = @git_repository.branches
end
def set_treeish
@treeish = params[:treeish].presence || @project.default_branch
end
def set_current_tag
@current_tag = @tags.select{|t| t.name == @treeish }.first
end
def set_current_branch
@current_branch = @branches.select{|b| b.name == @treeish }.first
end
end

View File

@ -1,5 +1,5 @@
# -*- encoding : utf-8 -*-
class Git::BlobsController < Git::BaseController
class Projects::Git::BlobsController < Projects::Git::BaseController
before_filter :find_tree
before_filter :find_branch
before_filter :set_path_blob

View File

@ -1,5 +1,5 @@
# -*- encoding : utf-8 -*-
class Git::CommitsController < Git::BaseController
class Projects::Git::CommitsController < Projects::Git::BaseController
helper_method :split_commits_by_date
def index

View File

@ -1,5 +1,5 @@
# -*- encoding : utf-8 -*-
class Git::TreesController < Git::BaseController
class Projects::Git::TreesController < Projects::Git::BaseController
def show
redirect_to project_path(@project) and return if params[:treeish] == @project.default_branch and params[:path].blank?
@ -10,10 +10,9 @@ class Git::TreesController < Git::BaseController
# @commit = @git_repository.commits(@treeish, 1).first
# Raises Grit::Git::GitTimeout
@commit = @branch.present? ? @branch.commit() : @git_repository.log(@treeish, @path, :max_count => 1).first
render :template => "git/trees/empty" and return unless @commit
render "empty" and return unless @commit
@tree = @tree / @path if @path
render :template => "git/trees/show"
end
def archive
@ -28,8 +27,6 @@ class Git::TreesController < Git::BaseController
file = Tempfile.new fullname, 'tmp'
system("cd #{@project.path}; git archive --format=#{format} --prefix=#{name}/ #{treeish} #{format == 'tar' ? ' | gzip -9' : ''} > #{file.path}")
file.close
send_file file.path, :disposition => 'attachment', :type => "application/#{format == 'tar' ? 'x-tar-gz' : 'zip'}",
:filename => fullname
send_file file.path, :disposition => 'attachment', :type => "application/#{format == 'tar' ? 'x-tar-gz' : 'zip'}", :filename => fullname
end
end

View File

@ -1,5 +1,5 @@
# -*- encoding : utf-8 -*-
class IssuesController < ApplicationController
class Projects::IssuesController < Projects::BaseController
NON_RESTFUL_ACTION = [:create_label, :update_label, :destroy_label, :search_collaborators]
before_filter :authenticate_user!
skip_before_filter :authenticate_user!, :only => [:index, :show] if APP_CONFIG['anonymous_access']
@ -55,11 +55,11 @@ class IssuesController < ApplicationController
def update
if params[:issue] && status = params[:issue][:status]
action = 'issues/_status'
action = 'status'
@issue.set_close(current_user) if status == 'closed'
@issue.set_open if status == 'open'
status = 200 if @issue.save
render action, :status => (status || 500), :layout => false
render :partial => action, :status => (status || 500), :layout => false
elsif params[:issue]
@issue.labelings.destroy_all if params[:issue][:labelings_attributes] # FIXME
status = 200 if @issue.update_attributes(params[:issue])
@ -77,12 +77,12 @@ class IssuesController < ApplicationController
end
def create_label
status = @project.labels.create(:name => params[:name], :color => params[:color]) ? 200 : 500
status = @project.labels.create!(:name => params[:name], :color => params[:color]) ? 200 : 500
index(status)
end
def update_label
status = @label.update_attributes( :name => params[:name], :color => params[:color]) ? 200 : 500
status = @label.update_attributes(:name => params[:name], :color => params[:color]) ? 200 : 500
index(status)
end
@ -96,7 +96,7 @@ class IssuesController < ApplicationController
users = User.joins(:groups => :projects).where(:projects => {:id => @project.id}).where("users.uname ILIKE ?", search)
users2 = @project.collaborators.where("users.uname ILIKE ?", search)
@users = (users + users2).uniq.sort {|x,y| x.uname <=> y.uname}.first(10)
render 'issues/_search_collaborators', :layout => false
render :partial => 'search_collaborators', :layout => false
end
private

View File

@ -1,5 +1,5 @@
# -*- encoding : utf-8 -*-
class ProjectsController < ApplicationController
class Projects::ProjectsController < Projects::BaseController
before_filter :authenticate_user!
load_and_authorize_resource
@ -57,6 +57,7 @@ class ProjectsController < ApplicationController
end
def fork
authorize! :fork, @project # TODO WTF ?
owner = (Group.find params[:group] if params[:group].present?) || current_user
authorize! :update, owner if owner.class == Group
if forked = @project.fork(owner) and forked.valid?
@ -72,11 +73,11 @@ class ProjectsController < ApplicationController
if request.post?
if @project.update_attributes(params[:project])
flash[:notice] = t('flash.project.saved')
redirect_to sections_project_path(@project)
else
@project.save
flash[:error] = t('flash.project.save_error')
end
render :action => :sections
end
end

View File

@ -1,5 +1,5 @@
# -*- encoding : utf-8 -*-
class SubscribesController < ApplicationController
class Projects::SubscribesController < Projects::BaseController
before_filter :authenticate_user!
load_and_authorize_resource :project

View File

@ -2,7 +2,7 @@
#require 'lib/gollum'
require 'cgi'
class WikiController < ApplicationController
class Projects::WikiController < Projects::BaseController
WIKI_OPTIONS = {}
before_filter :authenticate_user!

View File

@ -1,52 +0,0 @@
# -*- encoding : utf-8 -*-
class RegisterRequestsController < ApplicationController
load_and_authorize_resource
before_filter :find_register_request, :only => [:approve, :reject]
def index
@register_requests = @register_requests.send((params[:scope] || 'unprocessed').to_sym).paginate(:page => params[:page])
end
def new
# render :layout => 'sessions'
redirect_to '/invite.html'
end
def show_message
end
def create
RegisterRequest.create(params[:register_request])
redirect_to '/thanks.html' #show_message_register_requests_path
end
def update
if params[:update_type].present? and params[:request_ids].present?
updates = RegisterRequest.where(:id => params[:request_ids])
case params[:update_type]
when 'approve' # see approve method
updates.each {|req| req.update_attributes(:approved => true, :rejected => false)}
when 'reject' # see reject method
updates.each {|req| req.update_attributes(:approved => false, :rejected => true)}
end
end
redirect_to :action => :index
end
def approve
@register_request.update_attributes(:approved => true, :rejected => false)
redirect_to :action => :index
end
def reject
@register_request.update_attributes(:approved => false, :rejected => true)
redirect_to :action => :index
end
protected
def find_register_request
@register_request = RegisterRequest.find(params[:register_request_id])
end
end

View File

@ -1,21 +0,0 @@
# -*- encoding : utf-8 -*-
class Settings::NotifiersController < ApplicationController
before_filter :authenticate_user!
load_and_authorize_resource :user
load_and_authorize_resource :class => Settings::Notifier, :through => :user, :singleton => true, :shallow => true
def show
end
def update
if @notifier.update_attributes(params[:settings_notifier])
flash[:notice] = I18n.t("flash.settings.saved")
redirect_to user_settings_notifier_path(@user)
else
flash[:notice] = I18n.t("flash.settings.save_error")
redirect_to user_settings_notifier_path(@user)
end
end
end

View File

@ -0,0 +1,13 @@
# -*- encoding : utf-8 -*-
class Users::BaseController < ApplicationController
before_filter :authenticate_user!
before_filter :find_user
protected
def find_user
if user_id = params[:owner_name] || params[:user_id] || params[:id]
@user = User.find_by_insensitive_uname! user_id
end
end
end

View File

@ -0,0 +1,10 @@
# -*- encoding : utf-8 -*-
class Users::ProfileController < Users::BaseController
autocomplete :user, :uname
def show
@groups = @user.groups.uniq
@platforms = @user.platforms.paginate(:page => params[:platform_page], :per_page => 10)
@projects = @user.projects.paginate(:page => params[:project_page], :per_page => 10)
end
end

View File

@ -0,0 +1,11 @@
# -*- encoding : utf-8 -*-
class Users::RegisterRequestsController < ApplicationController
def new
redirect_to '/invite.html'
end
def create
RegisterRequest.create(params[:register_request])
redirect_to '/thanks.html'
end
end

View File

@ -0,0 +1,55 @@
# -*- encoding : utf-8 -*-
class Users::SettingsController < Users::BaseController
before_filter :set_current_user
def profile
if request.put?
send_confirmation = params[:user][:email] != @user.email
if @user.update_without_password(params[:user])
if @user.avatar && params[:delete_avatar] == '1'
@user.avatar = nil
@user.save
end
if send_confirmation
@user.confirmed_at, @user.confirmation_sent_at = nil
@user.send_confirmation_instructions
end
flash[:notice] = t('flash.user.saved')
redirect_to profile_settings_path
else
flash[:error] = t('flash.user.save_error')
flash[:warning] = @user.errors.full_messages.join('. ')
end
end
end
def private
if request.put?
if @user.update_with_password(params[:user])
flash[:notice] = t('flash.user.saved')
redirect_to private_settings_path
else
flash[:error] = t('flash.user.save_error')
flash[:warning] = @user.errors.full_messages.join('. ')
render(:action => :private)
end
end
end
def notifiers
if request.put?
if @user.notifier.update_attributes(params[:settings_notifier])
flash[:notice] = I18n.t("flash.settings.saved")
redirect_to notifiers_settings_path
else
flash[:error] = I18n.t("flash.settings.save_error")
end
end
end
protected
def set_current_user
@user = current_user
end
end

View File

@ -1,57 +0,0 @@
# -*- encoding : utf-8 -*-
class UsersController < ApplicationController
before_filter :authenticate_user!
load_and_authorize_resource :only => :show
before_filter :set_current_user, :only => [:profile, :update, :private]
autocomplete :user, :uname
def show
@groups = @user.groups.uniq
@platforms = @user.platforms.paginate(:page => params[:platform_page], :per_page => 10)
@projects = @user.projects.paginate(:page => params[:project_page], :per_page => 10)
end
def profile
end
def update
send_confirmation = params[:user][:email] != @user.email
if @user.update_without_password(params[:user])
if @user.avatar && params[:delete_avatar] == '1'
@user.avatar = nil
@user.save
end
if send_confirmation
@user.confirmed_at, @user.confirmation_sent_at = nil
@user.send_confirmation_instructions
end
flash[:notice] = t('flash.user.saved')
redirect_to edit_profile_path
else
flash[:error] = t('flash.user.save_error')
flash[:warning] = @user.errors.full_messages.join('. ')
render(:action => :profile)
end
end
def private
if request.put?
if @user.update_with_password(params[:user])
flash[:notice] = t('flash.user.saved')
redirect_to user_private_settings_path(@user)
else
flash[:error] = t('flash.user.save_error')
flash[:warning] = @user.errors.full_messages.join('. ')
render(:action => :private)
end
end
end
protected
def set_current_user
@user = current_user
end
end

View File

@ -1,7 +1,7 @@
# -*- encoding : utf-8 -*-
module ActivityFeedsHelper
def render_activity_feed(activity_feed)
render :partial => activity_feed.partial, :locals => activity_feed.data.merge(:activity_feed => activity_feed)
render activity_feed.partial, activity_feed.data.merge(:activity_feed => activity_feed)
end
def get_feed_title_from_content(content)

View File

@ -2,15 +2,15 @@
module ApplicationHelper
def layout_class
case
when params[:controller] == 'issues' && params[:action] == 'new'
when controller_name == 'issues' && action_name == 'new'
'right nopadding'
when params[:controller] == 'build_lists' && params[:action] == 'index'
when controller_name == 'build_lists' && action_name == 'index'
'right slim'
when params[:controller] == 'build_lists' && ['new', 'create'].include?(params[:action])
when controller_name == 'build_lists' && ['new', 'create'].include?(action_name)
nil
when params[:controller] == 'platforms' && params[:action] == 'show'
when controller_name == 'platforms' && action_name == 'show'
'right bigpadding'
when params[:controller] == 'platforms' && params[:action] == 'clone'
when controller_name == 'platforms' && action_name == 'clone'
'right middlepadding'
else
content_for?(:sidebar) ? 'right' : 'all'

View File

@ -1,3 +0,0 @@
# -*- encoding : utf-8 -*-
module Settings::NotifiersHelper
end

View File

@ -1,3 +0,0 @@
# -*- encoding : utf-8 -*-
module SubscribesHelper
end

View File

@ -23,12 +23,11 @@ class Ability
can [:publish_build, :status_build, :pre_build, :post_build, :circle_build, :new_bbdt], BuildList
if user.guest? # Guest rights
can [:create, :show_message], RegisterRequest
# can [:new, :create], RegisterRequest
else # Registered user rights
if user.admin?
can :manage, :all
# Protection
cannot :create, RegisterRequest
cannot :approve, RegisterRequest, :approved => true
cannot :reject, RegisterRequest, :rejected => true
cannot [:destroy, :create], Subscribe
@ -40,15 +39,13 @@ class Ability
if user.user?
can [:show, :autocomplete_user_uname], User
can [:profile, :update, :private], User, :id => user.id
can [:show, :update], Settings::Notifier, :user_id => user.id
can [:read, :create, :autocomplete_group_uname], Group
can [:update, :manage_members], Group do |group|
group.actors.exists?(:actor_type => 'User', :actor_id => user.id, :role => 'admin') # or group.owner_id = user.id
end
can :destroy, Group, :owner_id => user.id
can :remove_user, Group
can :create, Project
can :read, Project, :visibility => 'open'
@ -58,7 +55,7 @@ class Ability
can(:write, Project) {|project| local_writer? project} # for grack
can([:update, :sections, :manage_collaborators], Project) {|project| local_admin? project}
can(:fork, Project) {|project| can? :read, project}
can(:fork_to_group, Project) {|project| project.owner_type == 'Group' and can? :update, project.owner}
can(:fork, Project) {|project| project.owner_type == 'Group' and can? :update, project.owner}
can(:destroy, Project) {|project| owner? project}
can(:destroy, Project) {|project| project.owner_type == 'Group' and project.owner.actors.exists?(:actor_type => 'User', :actor_id => user.id, :role => 'admin')}
can :remove_user, Project
@ -118,13 +115,10 @@ class Ability
# Shared cannot rights for all users (registered, admin)
cannot :destroy, Platform, :platform_type => 'personal'
cannot [:create, :destroy, :add_project, :remove_project], Repository, :platform => {:platform_type => 'personal'}
cannot :fork, Project, :owner_id => user.id, :owner_type => user.class.to_s
cannot :destroy, Issue
cannot [:members, :add_member, :remove_member, :remove_members], Platform, :platform_type => 'personal'
# cannot :read, Product, :platform => {:platform_type => 'personal'}
# cannot(:read, Product, read_relations_for('products', 'platforms')) {|product| product.platform.platform_type == 'personal'}
cannot [:create, :update, :destroy, :clone], Product, :platform => {:platform_type => 'personal'}
cannot [:clone, :build_all], Platform, :platform_type => 'personal'

View File

@ -2,9 +2,9 @@
class Group < ActiveRecord::Base
belongs_to :owner, :class_name => 'User'
has_many :relations, :as => :actor, :dependent => :destroy
has_many :actors, :as => :target, :class_name => 'Relation'
has_many :targets, :as => :actor, :class_name => 'Relation'
has_many :relations, :as => :actor, :dependent => :destroy, :dependent => :destroy
has_many :actors, :as => :target, :class_name => 'Relation', :dependent => :destroy
has_many :targets, :as => :actor, :class_name => 'Relation', :dependent => :destroy
has_many :members, :through => :actors, :source => :actor, :source_type => 'User', :autosave => true
has_many :projects, :through => :targets, :source => :target, :source_type => 'Project', :autosave => true
@ -13,22 +13,21 @@ class Group < ActiveRecord::Base
has_many :own_platforms, :as => :owner, :class_name => 'Platform', :dependent => :destroy
validates :owner, :presence => true
validates :uname, :presence => true, :uniqueness => {:case_sensitive => false}, :format => { :with => /^[a-z0-9_]+$/ }
validate { errors.add(:uname, :taken) if User.where('uname LIKE ?', uname).present? }
validates :uname, :presence => true, :uniqueness => {:case_sensitive => false}, :format => {:with => /^[a-z0-9_]+$/}, :reserved_name => true
validate { errors.add(:uname, :taken) if User.by_uname(uname).present? }
scope :opened, where('1=1')
scope :by_owner, lambda {|owner| where(:owner_id => owner.id)}
scope :by_admin, lambda {|admin| joins(:actors).where(:'relations.role' => 'admin', :'relations.actor_id' => admin.id, :'relations.actor_type' => 'User')}
include Modules::Models::ActsLikeMember
attr_accessible :description
attr_readonly :own_projects_count
attr_accessible :uname, :description
attr_readonly :uname
delegate :email, :to => :owner
after_create :add_owner_to_members
include Modules::Models::ActsLikeMember
include Modules::Models::PersonalRepository
# include Modules::Models::Owner
@ -43,7 +42,6 @@ class Group < ActiveRecord::Base
protected
def add_owner_to_members
Relation.create_with_role(self.owner, self, 'admin')
# members << self.owner if !members.exists?(:id => self.owner.id)
Relation.create_with_role(self.owner, self, 'admin') # members << self.owner if !members.exists?(:id => self.owner.id)
end
end

View File

@ -9,8 +9,8 @@ class Issue < ActiveRecord::Base
has_many :comments, :as => :commentable, :dependent => :destroy
has_many :subscribes, :as => :subscribeable, :dependent => :destroy
has_many :labelings, :dependent => :destroy
has_many :labels, :through => :labelings, :uniq => true
has_many :labelings
validates :title, :body, :project_id, :presence => true

View File

@ -4,7 +4,7 @@ class Label < ActiveRecord::Base
has_many :issues, :through => :labelings
belongs_to :project
validates :name, :uniqueness => { :scope => :project_id}
validates :name, :uniqueness => {:scope => :project_id}
validates :name, :color, :presence => true
validates :color, :format => { :with => /\A([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})\z/, :message => I18n.t('layout.issues.invalid_labels')}

View File

@ -36,9 +36,7 @@ class Platform < ActiveRecord::Base
scope :main, where(:platform_type => 'main')
scope :personal, where(:platform_type => 'personal')
attr_accessible :owner, :visibility, :description, :released #, :owner_id, :owner_type
attr_accessible :name, :distrib_type, :parent_platform_id, :platform_type
attr_accessible :name, :distrib_type, :parent_platform_id, :platform_type, :owner, :visibility, :description, :released
attr_readonly :name, :distrib_type, :parent_platform_id, :platform_type
include Modules::Models::Owner
@ -100,7 +98,8 @@ class Platform < ActiveRecord::Base
def base_clone(attrs = {}) # :description, :name, :owner
clone.tap do |c|
c.attributes = attrs # attrs.each {|k,v| c.send("#{k}=", v)}
# c.attributes = attrs #
attrs.each {|k,v| c.send("#{k}=", v)}
c.updated_at = nil; c.created_at = nil # :id = nil
c.parent = self
end

View File

@ -15,8 +15,7 @@ class Product < ActiveRecord::Base
scope :recent, order("name ASC")
attr_accessible :name, :counter, :ks, :menu, :tar, :cron_tab, :use_cron
attr_accessible :description, :build_script, :delete_tar
attr_accessible :name, :counter, :ks, :menu, :tar, :cron_tab, :use_cron, :description, :build_script, :delete_tar
attr_readonly :platform_id
def delete_tar

View File

@ -6,6 +6,7 @@ class Project < ActiveRecord::Base
belongs_to :owner, :polymorphic => true, :counter_cache => :own_projects_count
has_many :issues, :dependent => :destroy
has_many :labels, :dependent => :destroy
has_many :build_lists, :dependent => :destroy
has_many :project_imports, :dependent => :destroy
@ -15,7 +16,6 @@ class Project < ActiveRecord::Base
has_many :relations, :as => :target, :dependent => :destroy
has_many :collaborators, :through => :relations, :source => :actor, :source_type => 'User'
has_many :groups, :through => :relations, :source => :actor, :source_type => 'Group'
has_many :labels
validates :name, :uniqueness => {:scope => [:owner_id, :owner_type], :case_sensitive => false}, :presence => true, :format => {:with => /^[a-zA-Z0-9_\-\+\.]+$/}
validates :owner, :presence => true
@ -51,6 +51,21 @@ class Project < ActiveRecord::Base
include Modules::Models::Owner
def to_param
name
end
def self.find_by_owner_and_name(owner_name, project_name)
owner = User.find_by_uname(owner_name) || Group.find_by_uname(owner_name) || User.by_uname(owner_name).first || Group.by_uname(owner_name).first and
scoped = where(:owner_id => owner.id, :owner_type => owner.class) and
scoped.find_by_name(project_name) || scoped.by_name(project_name).first
# owner.projects.find_by_name(project_name) || owner.projects.by_name(project_name).first # TODO force this work?
end
def self.find_by_owner_and_name!(owner_name, project_name)
find_by_owner_and_name(owner_name, project_name) or raise ActiveRecord::RecordNotFound
end
def build_for(platform, user, arch = 'i586', priority = 0)
# Select main and project platform repository(contrib, non-free and etc)
# If main does not exist, will connect only project platform repository
@ -58,7 +73,6 @@ class Project < ActiveRecord::Base
build_reps = [platform.repositories.find_by_name('main')]
build_reps += platform.repositories.select {|rep| self.repository_ids.include? rep.id}
build_ids = build_reps.compact.map(&:id).uniq
arch = Arch.find_by_name(arch) if arch.acts_like?(:string)
build_lists.create do |bl|
bl.pl = platform
@ -257,7 +271,7 @@ class Project < ActiveRecord::Base
def create_wiki
if has_wiki && !FileTest.exist?(wiki_path)
Grit::Repo.init_bare(wiki_path)
wiki = Gollum::Wiki.new(wiki_path, {:base_path => Rails.application.routes.url_helpers.project_wiki_index_path(self)})
wiki = Gollum::Wiki.new(wiki_path, {:base_path => Rails.application.routes.url_helpers.project_wiki_index_path(owner, self)})
wiki.write_page('Home', :markdown, I18n.t("wiki.seed.welcome_content"),
{:name => owner.name, :email => owner.email, :message => 'Initial commit'})
end

View File

@ -11,6 +11,14 @@ class RegisterRequest < ActiveRecord::Base
validates :email, :presence => true, :uniqueness => {:case_sensitive => false}, :format => { :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i }
def approve
update_attributes(:approved => true, :rejected => false)
end
def reject
update_attributes(:approved => false, :rejected => true)
end
protected
def generate_token

View File

@ -13,7 +13,7 @@ class Repository < ActiveRecord::Base
before_create :xml_rpc_create, :unless => lambda {Thread.current[:skip]}
before_destroy :xml_rpc_destroy, :unless => lambda {Thread.current[:skip]}
attr_accessible :name, :description
attr_accessible :name, :description
attr_readonly :name, :platform_id
def base_clone(attrs = {})

View File

@ -1,6 +0,0 @@
# -*- encoding : utf-8 -*-
module Settings
def self.table_name_prefix
'settings_'
end
end

View File

@ -1,5 +1,5 @@
# -*- encoding : utf-8 -*-
class Settings::Notifier < ActiveRecord::Base
class SettingsNotifier < ActiveRecord::Base
belongs_to :user
validates :user_id, :presence => true

View File

@ -15,7 +15,7 @@ class User < ActiveRecord::Base
}
validates_inclusion_of :avatar_file_size, :in => (0..MAX_AVATAR_SIZE), :allow_nil => true
has_one :notifier, :class_name => 'Settings::Notifier', :dependent => :destroy #:notifier
has_one :notifier, :class_name => 'SettingsNotifier', :dependent => :destroy #:notifier
has_many :activity_feeds, :dependent => :destroy
@ -35,16 +35,14 @@ class User < ActiveRecord::Base
has_many :own_groups, :foreign_key => :owner_id, :class_name => 'Group', :dependent => :destroy
has_many :own_platforms, :as => :owner, :class_name => 'Platform', :dependent => :destroy
include Modules::Models::PersonalRepository
validates :uname, :presence => true, :uniqueness => {:case_sensitive => false}, :format => { :with => /^[a-z0-9_]+$/ }
validate { errors.add(:uname, :taken) if Group.where('uname LIKE ?', uname).present? }
validates :uname, :presence => true, :uniqueness => {:case_sensitive => false}, :format => {:with => /^[a-z0-9_]+$/}, :reserved_name => true
validate { errors.add(:uname, :taken) if Group.by_uname(uname).present? }
validates :role, :inclusion => {:in => ROLES}, :allow_blank => true
validates :language, :inclusion => {:in => LANGUAGES}, :allow_blank => true
attr_accessible :email, :password, :password_confirmation, :current_password, :remember_me, :login, :name, :uname, :language,
:site, :company, :professional_experience, :location, :avatar
attr_readonly :uname, :own_projects_count
attr_readonly :uname
attr_accessor :login
scope :opened, where('1=1')
@ -52,11 +50,12 @@ class User < ActiveRecord::Base
scope :admin, where(:role => 'admin')
scope :real, where(:role => ['', nil])
include Modules::Models::ActsLikeMember
after_create lambda { self.create_notifier }
before_create :ensure_authentication_token
include Modules::Models::PersonalRepository
include Modules::Models::ActsLikeMember
def admin?
role == 'admin'
end
@ -70,13 +69,17 @@ class User < ActiveRecord::Base
end
def access_locked?
role == 'banned'
role == 'banned'
end
def fullname
return "#{uname} (#{name})"
end
def user_appeal
name.presence || uname
end
class << self
def find_for_database_authentication(warden_conditions)
conditions = warden_conditions.dup
@ -126,14 +129,4 @@ class User < ActiveRecord::Base
false
end
end
def user_appeal
name.blank? ? uname : name
end
private
def create_settings_notifier
self.create_notifier
end
end

View File

@ -4,7 +4,7 @@
.text
%span
= raw t('notifications.bodies.build_task', :task_num => task_num, :task_link => build_list_path(build_list_id))
= raw t('notifications.bodies.project', :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_id)) )
= raw t('notifications.bodies.project', :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) )
- message, error = case status
- when BuildList::BUILD_PENDING
- ['pending', nil]

View File

@ -2,7 +2,7 @@
.text
%span
= t('notifications.bodies.delete_branch', :branch_name => branch_name)
= raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_id)) )
= raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) )
.both
%span.date= activity_feed.created_at
.both

View File

@ -5,12 +5,12 @@
.text
%span
= raw t("notifications.bodies.#{change_type}_branch", {:branch_name => branch_name, :user_link => defined?(user_name) ? link_to(user_name, user_path(user_id)) : user_email})
= raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_id)) )
= raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) )
.both
%span.date= activity_feed.created_at
.both
%span.subject
- last_commits.each do |commit|
= link_to shortest_hash_id(commit[0]), commit_path(project_id, commit[0])
= link_to shortest_hash_id(commit[0]), commit_path(project_owner, project_name, commit[0])
= commit[1]
%br

View File

@ -1,8 +1,8 @@
.top
.text
%span
= raw t("notifications.bodies.issue_assign_notification", { :issue_link => link_to(issue_title, project_issue_path(project_id, issue_serial_id))})
= raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_id)) )
= raw t("notifications.bodies.issue_assign_notification", { :issue_link => link_to(issue_title, project_issue_path(project_owner, project_name, issue_serial_id))})
= raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) )
.both
%span.date= activity_feed.created_at
.both

View File

@ -4,8 +4,8 @@
.text
%span
= raw t("notifications.bodies.new_comment_notification.title", :user_link => link_to(user_name, user_path(user_id)) )
= raw t("notifications.bodies.new_comment_notification.commit_content", {:commit_link => link_to(commit_message, commit_path(project_id, commit_id) + "#comment##{comment_id}")})
= raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_id)) )
= raw t("notifications.bodies.new_comment_notification.commit_content", {:commit_link => link_to(commit_message, commit_path(project_owner, project_name, commit_id) + "#comment##{comment_id}")})
= raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) )
.both
%span.date= activity_feed.created_at
.both

View File

@ -4,8 +4,8 @@
.text
%span
= raw t("notifications.bodies.new_comment_notification.title", {:user_link => link_to(user_name, user_path(user_id))})
= raw t("notifications.bodies.new_comment_notification.content", {:issue_link => link_to(issue_title, project_issue_path(project_id, issue_serial_id) + "#comment##{comment_id}")})
= raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_id)) )
= raw t("notifications.bodies.new_comment_notification.content", {:issue_link => link_to(issue_title, project_issue_path(project_owner, project_name, issue_serial_id) + "#comment##{comment_id}")})
= raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) )
.both
%span.date= activity_feed.created_at
.both

View File

@ -3,8 +3,8 @@
= image_tag(avatar_url_by_email(user_email, :small), :alt => 'avatar')
.text
%span
= raw t("notifications.bodies.new_issue_notification", { :user_link => link_to(user_name, user_path(user_id)), :issue_link => project_issue_path(project_id, issue_serial_id)})
= raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_id)) )
= raw t("notifications.bodies.new_issue_notification", { :user_link => link_to(user_name, user_path(user_id)), :issue_link => project_issue_path(project_owner, project_name, issue_serial_id)})
= raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) )
.both
%span.date= activity_feed.created_at
.both

View File

@ -3,8 +3,8 @@
= image_tag(avatar_url_by_email(user_email, :small), :alt => 'avatar')
.text
%span
= raw t("notifications.bodies.wiki_new_commit_notification", {:user_link => user_name, :history_link => link_to("wiki", history_project_wiki_index_path(project_id))})
= raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_id)) )
= raw t("notifications.bodies.wiki_new_commit_notification", {:user_link => user_name, :history_link => link_to("wiki", history_project_wiki_index_path(project_owner, project_name))})
= raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) )
.both
%span.date= activity_feed.created_at
.both

View File

@ -1,3 +0,0 @@
- content_for :submenu do
%nav
= render :partial => 'layouts/menu/top', :locals => {:which_menu => 'admins_menu'}

View File

@ -0,0 +1,2 @@
- content_for :submenu do
%nav= render 'layouts/menu/top', :which_menu => 'admins_menu'

View File

@ -0,0 +1,14 @@
%h3.fix= title t("layout.event_logs.list_header")
%table#datatable.tablesorter.list-users
%tr
%th.first= t("activerecord.attributes.event_log.kind")
%th= t("activerecord.attributes.event_log.created_at")
%th= t("activerecord.attributes.event_log.user")
%th= t("activerecord.attributes.event_log.ip")
%th= t("activerecord.attributes.event_log.protocol")
%th.last= t("activerecord.attributes.event_log.description")
= render @event_logs
= will_paginate
= render 'submenu'

View File

@ -0,0 +1,55 @@
%div{:style => 'float: right; margin: 20px'}
= link_to t("layout.register_request.approved"), admin_register_requests_path(:scope => :approved)
\|
= link_to t("layout.register_request.rejected"), admin_register_requests_path(:scope => :rejected)
%h2.title= title t("layout.register_request.list_header")
= form_tag admin_register_requests_path, :method => :put, :class => 'update_form' do
= hidden_field_tag 'update_type'
%table.tablesorter
%tr
%th &nbsp;
%th= t("activerecord.attributes.register_request.name")
%th= t("activerecord.attributes.register_request.email")
%th= t("activerecord.attributes.register_request.interest")
%th= t("activerecord.attributes.register_request.more")
%th= t("activerecord.attributes.register_request.created_at")
%th
- @register_requests.each do |request|
%tr{:class => cycle("odd", "even")}
%td= check_box_tag 'request_ids[]', request.id
%td= request.name
- @user = User.find_by_email(request.email) if request.approved
%td= link_to_if @user, request.email, @user
%td= request.interest
%td= request.more
%td= request.created_at
%td
= link_to t("layout.approve"), approve_admin_register_request_path(request) if can? :approve, request
|
= link_to t("layout.reject"), reject_admin_register_request_path(request) if can? :reject, request
.actions
%input#approve_registration{:type => 'button', :value => "Approve Selected"}
%input#reject_registration{:type => 'button', :value => "Reject Selected"}
= will_paginate @register_requests
:javascript
$(function() {
var $form = $('form.update_form')
var change_update_type = function (type) {
$('input#update_type').val(type);
};
$('#approve_registration').live('click', function(e) {
//set update_type to 'approve'
change_update_type('approve');
$form.submit();
});
$('#reject_registration').live('click', function(e) {
//set update_type to 'reject'
change_update_type('reject');
$form.submit();
});
});
= render 'submenu'

View File

@ -1,7 +1,7 @@
- content_for :sidebar do
.bordered
- if can? :create, User.new
= link_to t("layout.users.new"), new_user_path, :class => 'button'
= link_to t("layout.users.new"), new_admin_user_path, :class => 'button'
%h3= t("layout.users.filter_header")
%table
- t('layout.users.users_filter').each_key do |base|

View File

@ -9,9 +9,9 @@
"<%= user.uname %>",
"<%= user.email %>",
"<span style='<%=user.access_locked? ? 'background: #FEDEDE' : ''%>'><%= user.role %></span>",
"<%= j raw [(link_to t('layout.show'), user_path(user) if can? :read, user),
(link_to t('layout.edit'), edit_user_path(user) if can? :edit, user),
(link_to t('layout.delete'), delete_user_path(user), :method => :delete, :confirm => t('layout.users.confirm_delete') if can? :destroy, user)
"<%= j raw [(link_to t('layout.show'), user if can? :read, user),
(link_to t('layout.edit'), edit_admin_user_path(user) if can? :edit, user),
(link_to t('layout.delete'), admin_user_path(user), :method => :delete, :confirm => t('layout.users.confirm_delete') if can? :destroy, user)
].compact.join('&nbsp;|&nbsp;') %>"
]<%= user == @users.last ? '' : ',' %>
<% end %>

View File

@ -0,0 +1,10 @@
.block
.content
%h2.title= title t("layout.users.edit_header")
.inner
= form_for @user, :url => admin_user_path(@user), :html => {:class => :form} do |f|
= render "users/base/form", :f => f
- content_for :sidebar do
.bordered.nopadding
= render 'submenu'

View File

@ -23,8 +23,8 @@
%tbody
%br
= render :partial => 'admin/users/sidebar'
= render 'admin/submenu'
= render 'sidebar'
= render 'submenu'
:javascript
$('#users_filter[type="radio"]').live('change', function(){

View File

@ -2,10 +2,9 @@
.content
%h2.title= title t("layout.users.new_header")
.inner
= form_for @user, :url => create_user_path, :html => { :class => :form } do |f|
= render :partial => "users/form", :locals => {:f => f}
= form_for @user, :url => admin_users_path, :html => {:class => :form} do |f|
= render "users/base/form", :f => f
- content_for :sidebar do
.bordered.nopadding
= render 'admin/submenu'
= render 'submenu'

View File

@ -1,16 +0,0 @@
%h3.fix.bpadding10= title @user.uname
= form_for @user, :url => update_user_path(@user), :html => { :class => :form } do |f|
= render :partial => "users/form", :locals => {:f => f}
.notify
%p= t('layout.users.public_data_edit_warning')
.notify
%p= t('layout.users.avatar_notice')
:javascript
$('article .right').addClass('middlepadding');
= render 'admin/submenu'
- content_for :sidebar do
.bordered.nopadding

View File

@ -20,4 +20,4 @@
= image_tag("choose.png", :alt => t("devise.confirmations.send"))
= t("devise.confirmations.send")
%span.text_button_padding
= render :partial => "devise/shared/links"
= render "devise/shared/links"

View File

@ -1,7 +1,7 @@
%h3.fix.bpadding10= @user.uname
= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put, :class => "form" }) do |f|
= render :partial => "users/form", :locals => {:f => f}
= render "users/form", :f => f
.notify
%p= t('layout.users.public_data_edit_warning')

View File

@ -6,4 +6,4 @@
%br/
= f.text_field :email
%p= f.submit "Resend unlock instructions"
= render :partial => "devise/shared/links"
= render "devise/shared/links"

View File

@ -1,21 +0,0 @@
.block
.secondary-navigation
%ul.wat-cf
%li.first.active= link_to t("layout.event_logs.list"), event_logs_path
.content
%h2.title
= title t("layout.event_logs.list_header")
.inner
%table.table
%tr
%th.first= t("activerecord.attributes.event_log.kind")
%th= t("activerecord.attributes.event_log.created_at")
%th= t("activerecord.attributes.event_log.user")
%th= t("activerecord.attributes.event_log.ip")
%th= t("activerecord.attributes.event_log.protocol")
%th.last= t("activerecord.attributes.event_log.description")
= render @event_logs
.actions-bar.wat-cf
.actions= will_paginate
= render 'admin/submenu'

View File

@ -1,6 +0,0 @@
-set_meta_tags :title => [title_object(@project), "#{t '.title'} #{t('at') if @branch} #{@branch.try :name}"]
= render :partial => 'projects/submenu'
= render :partial => 'projects/repo_block', :locals => {:project => @project}
= render :partial => 'git/commits/commits', :object => @commits
= render 'git/commits/paginate' if @render_paginate

View File

@ -1,19 +0,0 @@
- act = controller.action_name.to_sym
- if [:new, :create].include? act
.leftlist
= f.label :uname, t("activerecord.attributes.group.uname"), :class => :label
.rightlist.nomargin
= f.text_field :uname
.both
%br
.leftlist
= f.label :description, t("activerecord.attributes.group.description"), :class => :label
.rightlist.nomargin
= f.text_area :description
.both
%br
.leftlist
\ 
.rightlist
= submit_tag t("layout.save")
.both

View File

@ -6,8 +6,8 @@
.admin-preferences
%ul
- if can? :edit, @group
%li{:class => (act == :edit && contr == :groups) ? 'active' : ''}
%li{:class => (act == :edit && contr == :profile) ? 'active' : ''}
= link_to t("layout.groups.edit"), edit_group_path(@group)
- if can? :manage_members, @group
%li{:class => (act == :edit && contr == :members) ? 'active' : ''}
= link_to t("layout.groups.edit_members"), edit_group_members_path(@group)
%li{:class => (act == :index && contr == :members) ? 'active' : ''}
= link_to t("layout.groups.edit_members"), group_members_path(@group)

View File

@ -6,35 +6,28 @@
%tr
%th
\ 
%th
= t("layout.collaborators.members")
%th{:colspan => "3"}
= t("layout.collaborators.roles")
%th= t("layout.collaborators.members")
%th{:colspan => "3"}= t("layout.collaborators.roles")
%tbody
- @users.each do |user|
- (parent.members - [parent.owner]).each do |user|
%tr
%td
%span#niceCheckbox1.niceCheck-main
= check_box_tag "user_remove[#{user.id}][]"
%span#niceCheckbox1.niceCheck-main= check_box_tag "user_remove[#{user.id}][]"
%td
.img
= image_tag avatar_url(user)
.img= image_tag avatar_url(user)
.forimg= link_to user.name, user_path(user)
- Relation::ROLES.each_with_index do |role, i|
%td
.radio
= radio_button_tag "user[#{user.id}]", role, ((parent.actors.exists? :actor_id => user.id, :actor_type => 'User', :role => role) ? :checked : nil), :class => 'niceRadio'
.radio= radio_button_tag "user[#{user.id}]", role, ((parent.actors.exists? :actor_id => user.id, :actor_type => 'User', :role => role) ? :checked : nil), :class => 'niceRadio'
.forradio= t("layout.collaborators.role_names.#{ role }")
= link_to_function t("layout.delete"), "deleteAdminMember();", :class => 'button'
.both
.hr.top
= form_tag add_group_members_path(parent) do
.admin-search
= autocomplete_field_tag 'user_id', params[:user_id], autocomplete_user_uname_users_path#, :id_element => '#member_id_field'
.admin-search= autocomplete_field_tag 'user_id', params[:user_id], autocomplete_user_uname_users_path#, :id_element => '#member_id_field'
.admin-role
.lineForm
= select_tag 'role', options_for_collaborators_roles_select
.lineForm= select_tag 'role', options_for_collaborators_roles_select
.both
%br
= submit_tag t("layout.add"), :class => 'button'
@ -43,4 +36,4 @@
.both
= link_to_function t("layout.save"), "saveAdminMember();", :class => 'button'
- content_for :sidebar, render('groups/sidebar')
- content_for :sidebar, render('sidebar')

View File

@ -0,0 +1,14 @@
- act = controller.action_name.to_sym
- if [:new, :create].include? act
.leftlist= f.label :uname, t("activerecord.attributes.group.uname"), :class => :label
.rightlist.nomargin= f.text_field :uname
.both
%br
.leftlist= f.label :description, t("activerecord.attributes.group.description"), :class => :label
.rightlist.nomargin= f.text_area :description
.both
%br
.leftlist
\ 
.rightlist= submit_tag t("layout.save")
.both

View File

@ -1,16 +1,13 @@
-set_meta_tags :title => [title_object(@group), t('layout.groups.edit')]
= form_for @group, :html => { :class => :form, :multipart => true } do |f|
= render :partial => "form", :locals => {:f => f}
= form_for @group do |f|
= render "form", :f => f
.hr
.groups-profile
= image_tag('code.png')
.groups-profile
= link_to t("layout.groups.public_profile"), @group
.groups-profile= image_tag('code.png')
.groups-profile= link_to t("layout.groups.public_profile"), @group
.both
.hr
.leftside
= t("layout.groups.delete_warning")
.leftside= t("layout.groups.delete_warning")
.rightside
= link_to t("layout.delete"), group_path(@group), :method => :delete, :confirm => t("layout.groups.confirm_delete"), :class => 'button' if can? :destroy, @group
.both

View File

@ -12,4 +12,4 @@
%td= link_to group.name, group_path(group)
%td.td2= group.description
%td.td5
= link_to image_tag('x.png'), remove_group_member_path(group, current_user), :method => :delete unless group.owner_id == current_user.id
= link_to image_tag('x.png'), remove_user_group_path(group), :method => :delete unless group.owner_id == current_user.id

View File

@ -1,6 +1,6 @@
%h3.bpadding10= title t("layout.groups.new_header")
= form_for @group, :url => groups_path do |f|
= render :partial => "form", :locals => {:f => f}
= form_for @group do |f|
= render "form", :f => f
:javascript
$('article .all').addClass('bigpadding');

View File

@ -5,7 +5,7 @@
%p= @group.description
%h4= t("layout.groups.projects_list") + ":"
%p
- @group.projects.each do |project|
- @projects.each do |project|
= link_to project.name, project
%br
%br

View File

@ -19,7 +19,7 @@
.middle
%menu
.logo= link_to image_tag('logo-mini.png', :alt => 'logo'), root_path
= render :partial => 'layouts/menu/top', :locals => {:which_menu => 'top_menu'}
= render 'layouts/menu/top', :which_menu => 'top_menu'
.information
= render 'search/form'
- if current_user
@ -34,7 +34,7 @@
.droplist-wrap
#droplist.droplist
.a= link_to current_user.uname, current_user
.a= link_to t('layout.settings.label'), edit_profile_path
.a= link_to t('layout.settings.label'), profile_settings_path
.a= link_to t('layout.logout'), destroy_user_session_path, :method => :delete
- else
.user

View File

@ -1,6 +1,7 @@
- namespace = which_menu == 'admins_menu' ? 'admin_' : ''
%ul
- (collection = t which_menu).each do |base, title|
- if can? :index, base.to_s.classify.constantize
%li= link_to title, send(:"#{base}_path"), :class => controller_name == base.to_s ? 'active' : ''
%li= link_to title, send(:"#{namespace}#{base}_path"), :class => params[:controller].include?(base.to_s) ? 'active' : ''
- if current_user.try(:admin?) and which_menu == 'top_menu'
%li= link_to t('admins_menu_header'), users_path, :class => t('admins_menu').has_key?(controller_name.to_sym) ? 'active' : ''
%li= link_to t('admins_menu_header'), admin_users_path, :class => t('admins_menu').has_key?(controller_name.to_sym) ? 'active' : ''

View File

@ -13,7 +13,7 @@
= display_meta_tags :site => APP_CONFIG['project_name'], :reverse => true, :separator => '-'
%body
-# render :partial => "layouts/flashes"
-# render "layouts/flashes"
= yield
= render 'layouts/counters' unless current_user.try(:admin?)

View File

@ -1,4 +1,4 @@
- render :partial => 'tos_sidebar'
- render 'tos_sidebar'
.tos
%a{:name => '#'}

View File

@ -22,8 +22,3 @@
-#- if current_user.owner_of? @platform or current_user.admin?
%li{:class => (act == :index && contr == :private_users) ? 'active' : ''}
= link_to t("layout.platforms.private_users"), platform_private_users_path(@platform)
-#.block.notice
%h3= t("layout.groups.members")
.content
- @platform.members.uniq.each do |member|
%p= link_to member.name + "", user_path(member)

View File

@ -1,13 +0,0 @@
-set_meta_tags :title => [title_object(@platform), t('layout.platforms.edit')]
= render :partial => 'submenu'
= render :partial => 'sidebar'
= form_for @platform, :url => platform_path(@platform), :html => { :class => :form } do |f|
= render :partial => "form", :locals => {:f => f}
- if can? :destroy, @platform
.hr
.leftside
= t("layout.platforms.delete_warning")
.rightside
= link_to t("layout.delete"), platform_path(@platform), :method => :delete, :confirm => t("layout.platforms.confirm_delete"), :class => 'button'

View File

@ -1,16 +0,0 @@
%h3= title t("layout.platforms.new_header")
= form_for :platform, :url => platforms_path, :html => { :class => :form } do |f|
= render :partial => "form", :locals => {:f => f}
-#.block
.secondary-navigation
%ul.wat-cf
%li.first= link_to "#{t("layout.platforms.list")}", platforms_path
%li.active= link_to "#{t("layout.platforms.new")}", new_platform_path
.content
%h2.title
= t("layout.platforms.new_header")
.inner
= form_for :platform, :url => platforms_path, :html => { :class => :form } do |f|
= render :partial => "form", :locals => {:f => f}

View File

@ -6,7 +6,5 @@
%tbody
- @platforms.each do |platform|
%tr{:class => cycle("odd", "even")}
%td
= link_to platfrom_printed_name(platform), platform_path(platform)
%td
= platform.distrib_type
%td= link_to platfrom_printed_name(platform), platform_path(platform)
%td= platform.distrib_type

Some files were not shown because too many files have changed in this diff Show More