Great controllers and routes refactor - separate them to namespaces. Add user/group routes in github style, refactor. Implement templates inheritance. Refactor and cleanup views. Fix specs. Other minor fixes. Refs #263

This commit is contained in:
Pavel Chipiga 2012-05-02 12:18:07 +03:00
parent b957600eda
commit 2539ef4795
242 changed files with 865 additions and 1206 deletions

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,29 @@
# -*- 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
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
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

@ -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_owner_name! group_id
end
end
end

View File

@ -1,32 +1,11 @@
# -*- encoding : utf-8 -*-
class MembersController < ApplicationController
before_filter :authenticate_user!
class Groups::MembersController < Groups::BaseController
is_related_controller!
belongs_to :group, :finder => 'find_by_owner_name!', :optional => true
belongs_to :group, :optional => true
# before_filter :find_target
before_filter :find_users
before_filter lambda { authorize! :manage_members, @group }
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
@ -34,42 +13,30 @@ class MembersController < ApplicationController
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)
relation.update_all(: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)
redirect_to 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
redirect_to group_members_path(parent)
end
def add
@ -86,13 +53,6 @@ class MembersController < ApplicationController
flash[:error] = t("flash.members.already_added")
end
end
redirect_to edit_group_members_path(parent)
redirect_to group_members_path(parent)
end
protected
def find_users
@users = parent.members #User.all
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

@ -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,5 +1,5 @@
# -*- 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]
@ -14,8 +14,6 @@ class BuildListsController < ApplicationController
load_and_authorize_resource :build_list, :through => :project, :only => NESTED_ACTIONS, :shallow => true
load_and_authorize_resource :except => CALLBACK_ACTIONS.concat(NESTED_ACTIONS)
include Modules::Controllers::FindProject
def search
new_params = {:filter => {}}
params[:filter].each do |k,v|
@ -37,7 +35,7 @@ class BuildListsController < ApplicationController
end
def new
@build_list = BuildList.new
# @build_list = BuildList.new # @build_list already created by CanCan
end
def create

View File

@ -1,5 +1,5 @@
# -*- encoding : utf-8 -*-
class CollaboratorsController < ApplicationController
class Projects::CollaboratorsController < Projects::BaseController
respond_to :html, :json
before_filter :authenticate_user!
@ -9,8 +9,6 @@ class CollaboratorsController < ApplicationController
before_filter :find_users
before_filter :find_groups
include Modules::Controllers::FindProject
def index
@collaborators = Collaborator.find_by_project(@project)
respond_with @collaborators

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
@ -7,7 +7,6 @@ class CommentsController < ApplicationController
load_and_authorize_resource
include CommentsHelper
include Modules::Controllers::FindProject
def create
if @comment.save

View File

@ -1,12 +1,10 @@
# -*- encoding : utf-8 -*-
class CommitSubscribesController < ApplicationController
class Projects::CommitSubscribesController < Projects::BaseController
before_filter :authenticate_user!
load_and_authorize_resource :project
before_filter :find_commit
include Modules::Controllers::FindProject
def create
if Subscribe.subscribe_to_commit(@options)
flash[:notice] = I18n.t("flash.subscribe.commit.saved")

View File

@ -1,5 +1,5 @@
# -*- encoding : utf-8 -*-
class Git::BaseController < ApplicationController
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
@ -11,8 +11,6 @@ class Git::BaseController < ApplicationController
before_filter :set_current_tag
before_filter :set_current_branch
include Modules::Controllers::FindProject
protected
def find_git_repository

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']
@ -9,8 +9,6 @@ class IssuesController < ApplicationController
layout 'application'
include Modules::Controllers::FindProject
def index(status = 200)
@is_assigned_to_me = params[:filter] == 'to_me'
@status = params[:status] == 'closed' ? 'closed' : 'open'
@ -57,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])
@ -98,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,10 +1,8 @@
# -*- encoding : utf-8 -*-
class ProjectsController < ApplicationController
class Projects::ProjectsController < Projects::BaseController
before_filter :authenticate_user!
load_and_authorize_resource
include Modules::Controllers::FindProject
def index
@projects = Project.accessible_by(current_ability, :membered)
# @projects = @projects.search(params[:query]).search_order if params[:query].present?

View File

@ -1,13 +1,11 @@
# -*- encoding : utf-8 -*-
class SubscribesController < ApplicationController
class Projects::SubscribesController < Projects::BaseController
before_filter :authenticate_user!
load_and_authorize_resource :project
load_and_authorize_resource :issue, :through => :project, :find_by => :serial_id
load_and_authorize_resource :subscribe, :through => :issue, :find_by => :user_id
include Modules::Controllers::FindProject
def create
@subscribe = @issue.subscribes.build(:user_id => current_user.id)
if @subscribe.save

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!
@ -13,8 +13,6 @@ class WikiController < ApplicationController
before_filter :authorize_write_actions, :only => [:edit, :update, :new, :create, :destroy, :revert, :revert_wiki, :preview]
before_filter :get_wiki
include Modules::Controllers::FindProject
def index
@name = 'Home'
@page = @wiki.page(@name)

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_owner_name! 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'

View File

@ -14,21 +14,20 @@ class Group < ActiveRecord::Base
validates :owner, :presence => true
validates :uname, :presence => true, :uniqueness => {:case_sensitive => false}, :format => {:with => /^[a-z0-9_]+$/}, :reserved_name => true
validate { errors.add(:uname, :taken) if User.where('uname LIKE ?', uname).present? }
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
@ -36,10 +35,6 @@ class Group < ActiveRecord::Base
(by_owner(user) | by_admin(user))
end
def to_param
uname
end
def name
uname
end
@ -47,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

@ -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 #, :owner_id, :owner_type
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,10 +51,12 @@ class Project < ActiveRecord::Base
include Modules::Models::Owner
def to_param; name; end
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) and
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
end
@ -268,7 +270,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

@ -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_]+$/}, :reserved_name => true
validate { errors.add(:uname, :taken) if Group.where('uname LIKE ?', uname).present? }
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,14 +50,11 @@ 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
def to_param
uname
end
include Modules::Models::PersonalRepository
include Modules::Models::ActsLikeMember
def admin?
role == 'admin'
@ -81,6 +76,10 @@ class User < ActiveRecord::Base
return "#{uname} (#{name})"
end
def user_appeal
name.presence || uname
end
class << self
def find_for_database_authentication(warden_conditions)
conditions = warden_conditions.dup
@ -130,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

@ -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.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

View File

@ -1,6 +1,6 @@
-set_meta_tags :title => [title_object(@platform), t('layout.platforms.clone_header')]
= render :partial => 'submenu'
= render :partial => 'sidebar'
= render 'submenu'
= render 'sidebar'
= form_for @cloned, :url => make_clone_platform_path(@platform), :html => { :class => :form } do |f|
.leftlist= f.label :name, :class => :label

View File

@ -0,0 +1,11 @@
-set_meta_tags :title => [title_object(@platform), t('layout.platforms.edit')]
= render 'submenu'
= render 'sidebar'
= form_for @platform, :url => platform_path(@platform), :html => { :class => :form } do |f|
= render "form", :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,4 +1,4 @@
-set_meta_tags :title => t('layout.platforms.list_header')
= link_to t("layout.platforms.new"), new_platform_path, :class => 'button' if can? :create, Platform
= render :partial => 'platforms/list', :object => @platforms
= render 'list', :object => @platforms
= will_paginate @platforms

View File

@ -1,6 +1,6 @@
-set_meta_tags :title => [title_object(@platform), t('layout.platforms.members')]
= render :partial => 'submenu'
= render :partial => 'sidebar'
= render 'submenu'
= render 'sidebar'
= form_tag remove_members_platform_path(@platform), :id => 'members_form', :method => :post do
%table.tablesorter{:cellpadding => "0", :cellspacing => "0"}

View File

@ -0,0 +1,4 @@
%h3= title t("layout.platforms.new_header")
= form_for :platform, :url => platforms_path, :html => { :class => :form } do |f|
= render "form", :f => f

View File

@ -1,6 +1,6 @@
-set_meta_tags :title => title_object(@platform)
= render :partial => 'submenu'
= render :partial => 'sidebar'
= render 'submenu'
= render 'sidebar'
%h3.fix= "#{t("layout.platforms.about")} #{@platform.name}"
@ -34,5 +34,4 @@
= link_to t("layout.platforms.build_all"), build_all_platform_path(@platform), :confirm => I18n.t("layout.confirm"), :method => :post, :class => "button left_floated"
= link_to I18n.t("layout.platforms.clone"), clone_platform_path(@platform), :class => "button left_floated" if can? :clone, @platform
- if @platform.platform_type == 'personal' and @platform.visibility == 'open'
= render :partial => 'connection_info'
= render 'connection_info' if @platform.platform_type == 'personal' and @platform.visibility == 'open'

View File

@ -1,5 +1,4 @@
-set_meta_tags :title => t('.title')
/ #myTable
%table.tablesorter{:cellpadding => "0", :cellspacing => "0"}
%thead
%tr
@ -10,10 +9,10 @@
-#%th.lpadding16= t("activerecord.attributes.product_build_list.user")
%th= t("layout.product_build_lists.action")
%th.lpadding16= t("activerecord.attributes.product_build_list.notified_at")
%tbody= render @product_build_lists
%tbody= render :partial => 'platforms/product_build_lists/product_build_list', :collection => @product_build_lists
.both
= will_paginate @product_build_lists
= render 'product_build_lists/filter'
= render 'build_lists/submenu'
= render 'filter'
= render 'projects/build_lists/submenu'

View File

@ -35,7 +35,7 @@
.rightlist= f.check_box :delete_tar
.both
= render :partial => "products/crontab", :locals => { :form => f }
= render "crontab", :form => f
.both
.button_block

View File

@ -1,6 +1,6 @@
-set_meta_tags :title => [title_object(@product), t('title_editing')]
= render :partial => 'platforms/submenu'
= render :partial => 'platforms/sidebar'
= render 'submenu'
= render 'sidebar'
%h3
= t("layout.products.edit_header")
@ -8,5 +8,5 @@
%br
= form_for [@platform, @product], :html => { :class => :form, :multipart => true } do |f|
= render :partial => "form", :locals => {:f => f}
= render "form", :f => f

View File

@ -1,7 +1,7 @@
-set_meta_tags :title => [title_object(@platform), t('layout.products.list_header')]
= render :partial => 'platforms/submenu' if params[:platform_id]
= render :partial => 'platforms/sidebar' if params[:platform_id]
= render 'submenu' if params[:platform_id]
= render 'sidebar' if params[:platform_id]
= link_to t("layout.products.new"), new_platform_product_path(@platform), :class => 'button' if can? :create, @platform.products.build
= render :partial => 'list', :object => @products
= render 'list', :object => @products
= will_paginate @products

View File

@ -1,7 +1,6 @@
-set_meta_tags :title => [title_object(@platform), t('layout.products.new')]
= render :partial => 'platforms/submenu'
= render :partial => 'platforms/sidebar'
= render 'submenu'
= render 'sidebar'
= form_for [@platform, @product], :html => { :class => :form, :multipart => true } do |f|
= render :partial => "form", :locals => {:f => f}
= render "form", :f => f

View File

@ -1,6 +1,6 @@
-set_meta_tags :title => title_object(@product)
= render :partial => 'platforms/submenu'
= render :partial => 'platforms/sidebar'
= render 'submenu'
= render 'sidebar'
%h3 #{t("layout.products.about")} #{@product.name}
@ -25,4 +25,4 @@
%th= t("layout.product_build_lists.product")
%th= t("layout.product_build_lists.action")
%th= t("activerecord.attributes.product_build_list.notified_at")
%tbody= render @product.product_build_lists.default_order
%tbody= render :partial => 'platforms/product_build_lists/product_build_list', :collection => @product.product_build_lists.default_order

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