diff --git a/app/controllers/admin/base_controller.rb b/app/controllers/admin/base_controller.rb new file mode 100644 index 000000000..5104813c4 --- /dev/null +++ b/app/controllers/admin/base_controller.rb @@ -0,0 +1,5 @@ +# -*- encoding : utf-8 -*- +class Admin::BaseController < ApplicationController + before_filter :authenticate_user! + load_and_authorize_resource +end diff --git a/app/controllers/event_logs_controller.rb b/app/controllers/admin/event_logs_controller.rb similarity index 53% rename from app/controllers/event_logs_controller.rb rename to app/controllers/admin/event_logs_controller.rb index 1b491ba0a..a58dfcefd 100644 --- a/app/controllers/event_logs_controller.rb +++ b/app/controllers/admin/event_logs_controller.rb @@ -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 diff --git a/app/controllers/admin/register_requests_controller.rb b/app/controllers/admin/register_requests_controller.rb new file mode 100644 index 000000000..6ee831a37 --- /dev/null +++ b/app/controllers/admin/register_requests_controller.rb @@ -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 diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index ba3626130..91d5076b8 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -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 diff --git a/app/controllers/groups/base_controller.rb b/app/controllers/groups/base_controller.rb new file mode 100644 index 000000000..cbe73099b --- /dev/null +++ b/app/controllers/groups/base_controller.rb @@ -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 diff --git a/app/controllers/members_controller.rb b/app/controllers/groups/members_controller.rb similarity index 51% rename from app/controllers/members_controller.rb rename to app/controllers/groups/members_controller.rb index d31b35a50..ca6ace52a 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/groups/members_controller.rb @@ -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) + 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 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 diff --git a/app/controllers/groups/profile_controller.rb b/app/controllers/groups/profile_controller.rb new file mode 100644 index 000000000..30b62c795 --- /dev/null +++ b/app/controllers/groups/profile_controller.rb @@ -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 diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb deleted file mode 100644 index 50fc63beb..000000000 --- a/app/controllers/groups_controller.rb +++ /dev/null @@ -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 diff --git a/app/controllers/platforms/base_controller.rb b/app/controllers/platforms/base_controller.rb new file mode 100644 index 000000000..96ba67738 --- /dev/null +++ b/app/controllers/platforms/base_controller.rb @@ -0,0 +1,3 @@ +# -*- encoding : utf-8 -*- +class Platforms::BaseController < ApplicationController +end diff --git a/app/controllers/platforms_controller.rb b/app/controllers/platforms/platforms_controller.rb similarity index 98% rename from app/controllers/platforms_controller.rb rename to app/controllers/platforms/platforms_controller.rb index 7ef625831..0afc4b42c 100644 --- a/app/controllers/platforms_controller.rb +++ b/app/controllers/platforms/platforms_controller.rb @@ -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 diff --git a/app/controllers/private_users_controller.rb b/app/controllers/platforms/private_users_controller.rb similarity index 93% rename from app/controllers/private_users_controller.rb rename to app/controllers/platforms/private_users_controller.rb index 0b25d1202..ebd000e50 100644 --- a/app/controllers/private_users_controller.rb +++ b/app/controllers/platforms/private_users_controller.rb @@ -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 diff --git a/app/controllers/privates_controller.rb b/app/controllers/platforms/privates_controller.rb similarity index 92% rename from app/controllers/privates_controller.rb rename to app/controllers/platforms/privates_controller.rb index a375d9ce9..c10bb6c51 100644 --- a/app/controllers/privates_controller.rb +++ b/app/controllers/platforms/privates_controller.rb @@ -1,5 +1,5 @@ # -*- encoding : utf-8 -*- -class PrivatesController < ApplicationController +class Platforms::PrivatesController < Platforms::BaseController require 'digest/sha2' before_filter :find_platform diff --git a/app/controllers/product_build_lists_controller.rb b/app/controllers/platforms/product_build_lists_controller.rb similarity index 96% rename from app/controllers/product_build_lists_controller.rb rename to app/controllers/platforms/product_build_lists_controller.rb index 3e1384f4c..daab1ef25 100644 --- a/app/controllers/product_build_lists_controller.rb +++ b/app/controllers/platforms/product_build_lists_controller.rb @@ -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] diff --git a/app/controllers/products_controller.rb b/app/controllers/platforms/products_controller.rb similarity index 95% rename from app/controllers/products_controller.rb rename to app/controllers/platforms/products_controller.rb index 2e428e81e..020866a1c 100644 --- a/app/controllers/products_controller.rb +++ b/app/controllers/platforms/products_controller.rb @@ -1,5 +1,5 @@ # -*- encoding : utf-8 -*- -class ProductsController < ApplicationController +class Platforms::ProductsController < Platforms::BaseController before_filter :authenticate_user! load_and_authorize_resource :platform diff --git a/app/controllers/repositories_controller.rb b/app/controllers/platforms/repositories_controller.rb similarity index 97% rename from app/controllers/repositories_controller.rb rename to app/controllers/platforms/repositories_controller.rb index 3222811d2..d37caf8c6 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/platforms/repositories_controller.rb @@ -1,5 +1,5 @@ # -*- encoding : utf-8 -*- -class RepositoriesController < ApplicationController +class Platforms::RepositoriesController < Platforms::BaseController before_filter :authenticate_user! load_and_authorize_resource :platform diff --git a/app/controllers/projects/base_controller.rb b/app/controllers/projects/base_controller.rb new file mode 100644 index 000000000..c808887f2 --- /dev/null +++ b/app/controllers/projects/base_controller.rb @@ -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 diff --git a/app/controllers/build_lists_controller.rb b/app/controllers/projects/build_lists_controller.rb similarity index 97% rename from app/controllers/build_lists_controller.rb rename to app/controllers/projects/build_lists_controller.rb index 02b338583..25c8e8562 100644 --- a/app/controllers/build_lists_controller.rb +++ b/app/controllers/projects/build_lists_controller.rb @@ -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 diff --git a/app/controllers/collaborators_controller.rb b/app/controllers/projects/collaborators_controller.rb similarity index 94% rename from app/controllers/collaborators_controller.rb rename to app/controllers/projects/collaborators_controller.rb index 400e81f51..f0432b4fd 100644 --- a/app/controllers/collaborators_controller.rb +++ b/app/controllers/projects/collaborators_controller.rb @@ -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 diff --git a/app/controllers/comments_controller.rb b/app/controllers/projects/comments_controller.rb similarity index 93% rename from app/controllers/comments_controller.rb rename to app/controllers/projects/comments_controller.rb index 970467e54..371365eb9 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/projects/comments_controller.rb @@ -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 diff --git a/app/controllers/commit_subscribes_controller.rb b/app/controllers/projects/commit_subscribes_controller.rb similarity index 89% rename from app/controllers/commit_subscribes_controller.rb rename to app/controllers/projects/commit_subscribes_controller.rb index 394810d81..de5b2ac6e 100644 --- a/app/controllers/commit_subscribes_controller.rb +++ b/app/controllers/projects/commit_subscribes_controller.rb @@ -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") diff --git a/app/controllers/git/base_controller.rb b/app/controllers/projects/git/base_controller.rb similarity index 90% rename from app/controllers/git/base_controller.rb rename to app/controllers/projects/git/base_controller.rb index 1d18a573b..37168d764 100644 --- a/app/controllers/git/base_controller.rb +++ b/app/controllers/projects/git/base_controller.rb @@ -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 diff --git a/app/controllers/git/blobs_controller.rb b/app/controllers/projects/git/blobs_controller.rb similarity index 96% rename from app/controllers/git/blobs_controller.rb rename to app/controllers/projects/git/blobs_controller.rb index 4be95c11c..b8abb0799 100644 --- a/app/controllers/git/blobs_controller.rb +++ b/app/controllers/projects/git/blobs_controller.rb @@ -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 diff --git a/app/controllers/git/commits_controller.rb b/app/controllers/projects/git/commits_controller.rb similarity index 94% rename from app/controllers/git/commits_controller.rb rename to app/controllers/projects/git/commits_controller.rb index be34f4ad5..cf9a20021 100644 --- a/app/controllers/git/commits_controller.rb +++ b/app/controllers/projects/git/commits_controller.rb @@ -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 diff --git a/app/controllers/git/trees_controller.rb b/app/controllers/projects/git/trees_controller.rb similarity index 85% rename from app/controllers/git/trees_controller.rb rename to app/controllers/projects/git/trees_controller.rb index e84079f88..9655ffd4b 100644 --- a/app/controllers/git/trees_controller.rb +++ b/app/controllers/projects/git/trees_controller.rb @@ -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 diff --git a/app/controllers/issues_controller.rb b/app/controllers/projects/issues_controller.rb similarity index 93% rename from app/controllers/issues_controller.rb rename to app/controllers/projects/issues_controller.rb index 50b827c9c..b95743bdd 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/projects/issues_controller.rb @@ -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 diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects/projects_controller.rb similarity index 97% rename from app/controllers/projects_controller.rb rename to app/controllers/projects/projects_controller.rb index e8d3dbe6e..37d6648cd 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects/projects_controller.rb @@ -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? diff --git a/app/controllers/subscribes_controller.rb b/app/controllers/projects/subscribes_controller.rb similarity index 87% rename from app/controllers/subscribes_controller.rb rename to app/controllers/projects/subscribes_controller.rb index ee9e15fe3..0c4c285f3 100644 --- a/app/controllers/subscribes_controller.rb +++ b/app/controllers/projects/subscribes_controller.rb @@ -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 diff --git a/app/controllers/wiki_controller.rb b/app/controllers/projects/wiki_controller.rb similarity index 99% rename from app/controllers/wiki_controller.rb rename to app/controllers/projects/wiki_controller.rb index 97a0ea45a..c56d73dc9 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/projects/wiki_controller.rb @@ -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) diff --git a/app/controllers/register_requests_controller.rb b/app/controllers/register_requests_controller.rb deleted file mode 100644 index 85c915a52..000000000 --- a/app/controllers/register_requests_controller.rb +++ /dev/null @@ -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 diff --git a/app/controllers/settings/notifiers_controller.rb b/app/controllers/settings/notifiers_controller.rb deleted file mode 100644 index b52d8f525..000000000 --- a/app/controllers/settings/notifiers_controller.rb +++ /dev/null @@ -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 diff --git a/app/controllers/users/base_controller.rb b/app/controllers/users/base_controller.rb new file mode 100644 index 000000000..5a6d4fb40 --- /dev/null +++ b/app/controllers/users/base_controller.rb @@ -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 diff --git a/app/controllers/users/profile_controller.rb b/app/controllers/users/profile_controller.rb new file mode 100644 index 000000000..1e7c18869 --- /dev/null +++ b/app/controllers/users/profile_controller.rb @@ -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 diff --git a/app/controllers/users/register_requests_controller.rb b/app/controllers/users/register_requests_controller.rb new file mode 100644 index 000000000..5772334d3 --- /dev/null +++ b/app/controllers/users/register_requests_controller.rb @@ -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 diff --git a/app/controllers/users/settings_controller.rb b/app/controllers/users/settings_controller.rb new file mode 100644 index 000000000..cae985b96 --- /dev/null +++ b/app/controllers/users/settings_controller.rb @@ -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 diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb deleted file mode 100644 index 285101e6e..000000000 --- a/app/controllers/users_controller.rb +++ /dev/null @@ -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 diff --git a/app/helpers/activity_feeds_helper.rb b/app/helpers/activity_feeds_helper.rb index 0498ab8c9..2161a7582 100644 --- a/app/helpers/activity_feeds_helper.rb +++ b/app/helpers/activity_feeds_helper.rb @@ -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) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 0cd2f8927..d22a381b0 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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' diff --git a/app/helpers/settings/notifiers_helper.rb b/app/helpers/settings/notifiers_helper.rb deleted file mode 100644 index 218ea67f6..000000000 --- a/app/helpers/settings/notifiers_helper.rb +++ /dev/null @@ -1,3 +0,0 @@ -# -*- encoding : utf-8 -*- -module Settings::NotifiersHelper -end diff --git a/app/helpers/subscribes_helper.rb b/app/helpers/subscribes_helper.rb deleted file mode 100644 index dbf4053de..000000000 --- a/app/helpers/subscribes_helper.rb +++ /dev/null @@ -1,3 +0,0 @@ -# -*- encoding : utf-8 -*- -module SubscribesHelper -end diff --git a/app/models/ability.rb b/app/models/ability.rb index 0b2d06339..408d7c9d1 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -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' diff --git a/app/models/group.rb b/app/models/group.rb index d11f84bf1..bcb46ad7c 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -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 diff --git a/app/models/platform.rb b/app/models/platform.rb index 376d17cc7..e8056f4a9 100644 --- a/app/models/platform.rb +++ b/app/models/platform.rb @@ -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 diff --git a/app/models/product.rb b/app/models/product.rb index 71b0cbde7..80d4945e4 100644 --- a/app/models/product.rb +++ b/app/models/product.rb @@ -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 diff --git a/app/models/project.rb b/app/models/project.rb index 7a3c9cbd4..0e1fbbfc5 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -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 diff --git a/app/models/repository.rb b/app/models/repository.rb index 87cd1dedb..5318b93ba 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -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 = {}) diff --git a/app/models/settings.rb b/app/models/settings.rb deleted file mode 100644 index fee53706e..000000000 --- a/app/models/settings.rb +++ /dev/null @@ -1,6 +0,0 @@ -# -*- encoding : utf-8 -*- -module Settings - def self.table_name_prefix - 'settings_' - end -end diff --git a/app/models/settings/notifier.rb b/app/models/settings_notifier.rb similarity index 66% rename from app/models/settings/notifier.rb rename to app/models/settings_notifier.rb index 034117b26..e01c09c0b 100644 --- a/app/models/settings/notifier.rb +++ b/app/models/settings_notifier.rb @@ -1,5 +1,5 @@ # -*- encoding : utf-8 -*- -class Settings::Notifier < ActiveRecord::Base +class SettingsNotifier < ActiveRecord::Base belongs_to :user validates :user_id, :presence => true diff --git a/app/models/user.rb b/app/models/user.rb index f3f917529..19771bdd5 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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' @@ -74,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 @@ -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 diff --git a/app/views/admin/_submenu.html.haml b/app/views/admin/_submenu.html.haml deleted file mode 100644 index 015b19c98..000000000 --- a/app/views/admin/_submenu.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -- content_for :submenu do - %nav - = render :partial => 'layouts/menu/top', :locals => {:which_menu => 'admins_menu'} diff --git a/app/views/admin/base/_submenu.html.haml b/app/views/admin/base/_submenu.html.haml new file mode 100644 index 000000000..bed7e8f02 --- /dev/null +++ b/app/views/admin/base/_submenu.html.haml @@ -0,0 +1,2 @@ +- content_for :submenu do + %nav= render 'layouts/menu/top', :which_menu => 'admins_menu' \ No newline at end of file diff --git a/app/views/event_logs/_description.html.haml b/app/views/admin/event_logs/_description.html.haml similarity index 100% rename from app/views/event_logs/_description.html.haml rename to app/views/admin/event_logs/_description.html.haml diff --git a/app/views/event_logs/_event_log.html.haml b/app/views/admin/event_logs/_event_log.html.haml similarity index 100% rename from app/views/event_logs/_event_log.html.haml rename to app/views/admin/event_logs/_event_log.html.haml diff --git a/app/views/admin/event_logs/index.html.haml b/app/views/admin/event_logs/index.html.haml new file mode 100644 index 000000000..66057901e --- /dev/null +++ b/app/views/admin/event_logs/index.html.haml @@ -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' diff --git a/app/views/admin/register_requests/index.html.haml b/app/views/admin/register_requests/index.html.haml new file mode 100644 index 000000000..a562479a3 --- /dev/null +++ b/app/views/admin/register_requests/index.html.haml @@ -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 + %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' diff --git a/app/views/admin/users/_sidebar.html.haml b/app/views/admin/users/_sidebar.html.haml index 2a8d51566..a915d0e6e 100644 --- a/app/views/admin/users/_sidebar.html.haml +++ b/app/views/admin/users/_sidebar.html.haml @@ -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| diff --git a/app/views/admin/users/_users_ajax.js.erb b/app/views/admin/users/_users_ajax.js.erb index 433991b04..76db767ec 100644 --- a/app/views/admin/users/_users_ajax.js.erb +++ b/app/views/admin/users/_users_ajax.js.erb @@ -9,9 +9,9 @@ "<%= user.uname %>", "<%= user.email %>", "'><%= user.role %>", - "<%= 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(' | ') %>" ]<%= user == @users.last ? '' : ',' %> <% end %> diff --git a/app/views/admin/users/edit.html.haml b/app/views/admin/users/edit.html.haml new file mode 100644 index 000000000..7a591b180 --- /dev/null +++ b/app/views/admin/users/edit.html.haml @@ -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' diff --git a/app/views/admin/users/index.html.haml b/app/views/admin/users/index.html.haml index b7ae19533..3bf70d3cd 100644 --- a/app/views/admin/users/index.html.haml +++ b/app/views/admin/users/index.html.haml @@ -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(){ diff --git a/app/views/admin/users/new.html.haml b/app/views/admin/users/new.html.haml index 89cda022d..9fd4a4f9f 100644 --- a/app/views/admin/users/new.html.haml +++ b/app/views/admin/users/new.html.haml @@ -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' diff --git a/app/views/admin/users/profile.html.haml b/app/views/admin/users/profile.html.haml deleted file mode 100644 index 1c0fcf7ea..000000000 --- a/app/views/admin/users/profile.html.haml +++ /dev/null @@ -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 diff --git a/app/views/devise/confirmations/new.html.haml b/app/views/devise/confirmations/new.html.haml index 5933d7e57..4331a6dee 100644 --- a/app/views/devise/confirmations/new.html.haml +++ b/app/views/devise/confirmations/new.html.haml @@ -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" \ No newline at end of file + = render "devise/shared/links" \ No newline at end of file diff --git a/app/views/devise/registrations/edit.html.haml b/app/views/devise/registrations/edit.html.haml index c60558d4c..ce7f42306 100644 --- a/app/views/devise/registrations/edit.html.haml +++ b/app/views/devise/registrations/edit.html.haml @@ -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') diff --git a/app/views/devise/unlocks/new.html.haml b/app/views/devise/unlocks/new.html.haml index afb0daa81..15a031a7c 100644 --- a/app/views/devise/unlocks/new.html.haml +++ b/app/views/devise/unlocks/new.html.haml @@ -6,4 +6,4 @@ %br/ = f.text_field :email %p= f.submit "Resend unlock instructions" -= render :partial => "devise/shared/links" += render "devise/shared/links" diff --git a/app/views/event_logs/index.html.haml b/app/views/event_logs/index.html.haml deleted file mode 100644 index aba26befe..000000000 --- a/app/views/event_logs/index.html.haml +++ /dev/null @@ -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' diff --git a/app/views/git/commits/index.html.haml b/app/views/git/commits/index.html.haml deleted file mode 100644 index 3797be46f..000000000 --- a/app/views/git/commits/index.html.haml +++ /dev/null @@ -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 diff --git a/app/views/groups/_form.html.haml b/app/views/groups/_form.html.haml deleted file mode 100644 index 62463254f..000000000 --- a/app/views/groups/_form.html.haml +++ /dev/null @@ -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 diff --git a/app/views/groups/_sidebar.html.haml b/app/views/groups/base/_sidebar.html.haml similarity index 54% rename from app/views/groups/_sidebar.html.haml rename to app/views/groups/base/_sidebar.html.haml index abe3e44b0..0cf0595b0 100644 --- a/app/views/groups/_sidebar.html.haml +++ b/app/views/groups/base/_sidebar.html.haml @@ -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) diff --git a/app/views/members/edit.html.haml b/app/views/groups/members/index.html.haml similarity index 53% rename from app/views/members/edit.html.haml rename to app/views/groups/members/index.html.haml index db09dab07..888b853e5 100644 --- a/app/views/members/edit.html.haml +++ b/app/views/groups/members/index.html.haml @@ -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') diff --git a/app/views/groups/profile/_form.html.haml b/app/views/groups/profile/_form.html.haml new file mode 100644 index 000000000..f30cb0ab4 --- /dev/null +++ b/app/views/groups/profile/_form.html.haml @@ -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 diff --git a/app/views/groups/edit.html.haml b/app/views/groups/profile/edit.html.haml similarity index 52% rename from app/views/groups/edit.html.haml rename to app/views/groups/profile/edit.html.haml index 9ade14a3a..fca9df91c 100644 --- a/app/views/groups/edit.html.haml +++ b/app/views/groups/profile/edit.html.haml @@ -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 diff --git a/app/views/groups/index.html.haml b/app/views/groups/profile/index.html.haml similarity index 77% rename from app/views/groups/index.html.haml rename to app/views/groups/profile/index.html.haml index e0514172a..ab3b12855 100644 --- a/app/views/groups/index.html.haml +++ b/app/views/groups/profile/index.html.haml @@ -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 diff --git a/app/views/groups/new.html.haml b/app/views/groups/profile/new.html.haml similarity index 52% rename from app/views/groups/new.html.haml rename to app/views/groups/profile/new.html.haml index 462b23a5a..077c32394 100644 --- a/app/views/groups/new.html.haml +++ b/app/views/groups/profile/new.html.haml @@ -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'); diff --git a/app/views/groups/show.html.haml b/app/views/groups/profile/show.html.haml similarity index 90% rename from app/views/groups/show.html.haml rename to app/views/groups/profile/show.html.haml index 0f6527404..8525cffe3 100644 --- a/app/views/groups/show.html.haml +++ b/app/views/groups/profile/show.html.haml @@ -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 diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index c4b4a01fe..642d9b82e 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -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 diff --git a/app/views/layouts/menu/_top.html.haml b/app/views/layouts/menu/_top.html.haml index 182505e75..552c34fa0 100644 --- a/app/views/layouts/menu/_top.html.haml +++ b/app/views/layouts/menu/_top.html.haml @@ -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' : '' diff --git a/app/views/layouts/sessions.html.haml b/app/views/layouts/sessions.html.haml index 2d75d1707..dec6eecf5 100644 --- a/app/views/layouts/sessions.html.haml +++ b/app/views/layouts/sessions.html.haml @@ -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?) diff --git a/app/views/pages/tos.html.haml b/app/views/pages/tos.html.haml index 1291633e2..46bd71c76 100644 --- a/app/views/pages/tos.html.haml +++ b/app/views/pages/tos.html.haml @@ -1,4 +1,4 @@ -- render :partial => 'tos_sidebar' +- render 'tos_sidebar' .tos %a{:name => '#'} diff --git a/app/views/platforms/_sidebar.html.haml b/app/views/platforms/base/_sidebar.html.haml similarity index 89% rename from app/views/platforms/_sidebar.html.haml rename to app/views/platforms/base/_sidebar.html.haml index 8813540d4..f7d587fa5 100644 --- a/app/views/platforms/_sidebar.html.haml +++ b/app/views/platforms/base/_sidebar.html.haml @@ -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) diff --git a/app/views/platforms/_submenu.html.haml b/app/views/platforms/base/_submenu.html.haml similarity index 100% rename from app/views/platforms/_submenu.html.haml rename to app/views/platforms/base/_submenu.html.haml diff --git a/app/views/platforms/edit.html.haml b/app/views/platforms/edit.html.haml deleted file mode 100644 index ba64a2fac..000000000 --- a/app/views/platforms/edit.html.haml +++ /dev/null @@ -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' \ No newline at end of file diff --git a/app/views/platforms/new.html.haml b/app/views/platforms/new.html.haml deleted file mode 100644 index a88430eba..000000000 --- a/app/views/platforms/new.html.haml +++ /dev/null @@ -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} diff --git a/app/views/platforms/_connection_info.html.haml b/app/views/platforms/platforms/_connection_info.html.haml similarity index 100% rename from app/views/platforms/_connection_info.html.haml rename to app/views/platforms/platforms/_connection_info.html.haml diff --git a/app/views/platforms/_form.html.haml b/app/views/platforms/platforms/_form.html.haml similarity index 100% rename from app/views/platforms/_form.html.haml rename to app/views/platforms/platforms/_form.html.haml diff --git a/app/views/platforms/_list.html.haml b/app/views/platforms/platforms/_list.html.haml similarity index 69% rename from app/views/platforms/_list.html.haml rename to app/views/platforms/platforms/_list.html.haml index 5579856a8..b146945a7 100644 --- a/app/views/platforms/_list.html.haml +++ b/app/views/platforms/platforms/_list.html.haml @@ -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 \ No newline at end of file diff --git a/app/views/platforms/clone.html.haml b/app/views/platforms/platforms/clone.html.haml similarity index 88% rename from app/views/platforms/clone.html.haml rename to app/views/platforms/platforms/clone.html.haml index dcbb6dd7b..e72f71a65 100644 --- a/app/views/platforms/clone.html.haml +++ b/app/views/platforms/platforms/clone.html.haml @@ -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 diff --git a/app/views/platforms/platforms/edit.html.haml b/app/views/platforms/platforms/edit.html.haml new file mode 100644 index 000000000..a397e71d1 --- /dev/null +++ b/app/views/platforms/platforms/edit.html.haml @@ -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' diff --git a/app/views/platforms/index.html.haml b/app/views/platforms/platforms/index.html.haml similarity index 75% rename from app/views/platforms/index.html.haml rename to app/views/platforms/platforms/index.html.haml index 9d3b95c9a..e8e000676 100644 --- a/app/views/platforms/index.html.haml +++ b/app/views/platforms/platforms/index.html.haml @@ -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 diff --git a/app/views/platforms/members.html.haml b/app/views/platforms/platforms/members.html.haml similarity index 96% rename from app/views/platforms/members.html.haml rename to app/views/platforms/platforms/members.html.haml index 65eaff72d..5133f220f 100644 --- a/app/views/platforms/members.html.haml +++ b/app/views/platforms/platforms/members.html.haml @@ -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"} diff --git a/app/views/platforms/platforms/new.html.haml b/app/views/platforms/platforms/new.html.haml new file mode 100644 index 000000000..5f9dc3767 --- /dev/null +++ b/app/views/platforms/platforms/new.html.haml @@ -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 diff --git a/app/views/platforms/show.html.haml b/app/views/platforms/platforms/show.html.haml similarity index 86% rename from app/views/platforms/show.html.haml rename to app/views/platforms/platforms/show.html.haml index 7deb4e467..3066eef08 100644 --- a/app/views/platforms/show.html.haml +++ b/app/views/platforms/platforms/show.html.haml @@ -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' \ No newline at end of file += render 'connection_info' if @platform.platform_type == 'personal' and @platform.visibility == 'open' diff --git a/app/views/private_users/index.html.haml b/app/views/platforms/private_users/index.html.haml similarity index 100% rename from app/views/private_users/index.html.haml rename to app/views/platforms/private_users/index.html.haml diff --git a/app/views/product_build_lists/_filter.html.haml b/app/views/platforms/product_build_lists/_filter.html.haml similarity index 100% rename from app/views/product_build_lists/_filter.html.haml rename to app/views/platforms/product_build_lists/_filter.html.haml diff --git a/app/views/product_build_lists/_product_build_list.html.haml b/app/views/platforms/product_build_lists/_product_build_list.html.haml similarity index 100% rename from app/views/product_build_lists/_product_build_list.html.haml rename to app/views/platforms/product_build_lists/_product_build_list.html.haml diff --git a/app/views/product_build_lists/index.html.haml b/app/views/platforms/product_build_lists/index.html.haml similarity index 79% rename from app/views/product_build_lists/index.html.haml rename to app/views/platforms/product_build_lists/index.html.haml index cbf0f4e9a..7103bcfe9 100644 --- a/app/views/product_build_lists/index.html.haml +++ b/app/views/platforms/product_build_lists/index.html.haml @@ -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' diff --git a/app/views/products/_crontab.html.haml b/app/views/platforms/products/_crontab.html.haml similarity index 100% rename from app/views/products/_crontab.html.haml rename to app/views/platforms/products/_crontab.html.haml diff --git a/app/views/products/_form.html.haml b/app/views/platforms/products/_form.html.haml similarity index 96% rename from app/views/products/_form.html.haml rename to app/views/platforms/products/_form.html.haml index 02c1024af..ea8f33886 100644 --- a/app/views/products/_form.html.haml +++ b/app/views/platforms/products/_form.html.haml @@ -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 diff --git a/app/views/products/_list.html.haml b/app/views/platforms/products/_list.html.haml similarity index 100% rename from app/views/products/_list.html.haml rename to app/views/platforms/products/_list.html.haml diff --git a/app/views/products/edit.html.haml b/app/views/platforms/products/edit.html.haml similarity index 67% rename from app/views/products/edit.html.haml rename to app/views/platforms/products/edit.html.haml index 526ce659c..90cc286c7 100644 --- a/app/views/products/edit.html.haml +++ b/app/views/platforms/products/edit.html.haml @@ -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 diff --git a/app/views/products/index.html.haml b/app/views/platforms/products/index.html.haml similarity index 57% rename from app/views/products/index.html.haml rename to app/views/platforms/products/index.html.haml index 4a3c30741..a2788c4f4 100644 --- a/app/views/products/index.html.haml +++ b/app/views/platforms/products/index.html.haml @@ -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 diff --git a/app/views/products/new.html.haml b/app/views/platforms/products/new.html.haml similarity index 55% rename from app/views/products/new.html.haml rename to app/views/platforms/products/new.html.haml index 929b68c8b..5ed82d8ac 100644 --- a/app/views/products/new.html.haml +++ b/app/views/platforms/products/new.html.haml @@ -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 diff --git a/app/views/products/show.html.haml b/app/views/platforms/products/show.html.haml similarity index 88% rename from app/views/products/show.html.haml rename to app/views/platforms/products/show.html.haml index 4615db826..b53981594 100644 --- a/app/views/products/show.html.haml +++ b/app/views/platforms/products/show.html.haml @@ -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 diff --git a/app/views/repositories/_form.html.haml b/app/views/platforms/repositories/_form.html.haml similarity index 80% rename from app/views/repositories/_form.html.haml rename to app/views/platforms/repositories/_form.html.haml index 81adfa1d3..2539464d6 100644 --- a/app/views/repositories/_form.html.haml +++ b/app/views/platforms/repositories/_form.html.haml @@ -8,8 +8,5 @@ .button_block = submit_tag t("layout.save") - -#%input.button{:type => "submit", :class => "button"} - -#= image_tag("choose.png", :alt => t("layout.save")) - -#= t("layout.clone") %span.text_button_padding= t("layout.or") = link_to t("layout.cancel"), @repository.new_record? ? platform_repositories_path(@platform) : platform_repository_path(@platform, @repository), :class => "button" diff --git a/app/views/repositories/_list.html.haml b/app/views/platforms/repositories/_list.html.haml similarity index 57% rename from app/views/repositories/_list.html.haml rename to app/views/platforms/repositories/_list.html.haml index f1df53f26..69ef431d5 100644 --- a/app/views/repositories/_list.html.haml +++ b/app/views/platforms/repositories/_list.html.haml @@ -14,14 +14,4 @@ %td.buttons - if can? :destroy, repository = link_to platform_repository_path(@platform, repository), :method => :delete, :confirm => t("layout.repositories.confirm_delete") do - %span.delete --#%table.table - %tr - %th.first= t("activerecord.attributes.repository.name") - %th.last - - @repositories.each do |repository| - %tr{:class => cycle("odd", "even")} - %td - = link_to repository.name, repository_path(repository) - %td.last - #{link_to t("layout.show"), repository_path(repository)} | #{link_to t("layout.delete"), repository_path(repository), :method => :delete, :confirm => t("layout.repositories.confirm_delete")} + %span.delete \ No newline at end of file diff --git a/app/views/repositories/_proj_ajax.js.erb b/app/views/platforms/repositories/_proj_ajax.js.erb similarity index 100% rename from app/views/repositories/_proj_ajax.js.erb rename to app/views/platforms/repositories/_proj_ajax.js.erb diff --git a/app/views/repositories/_proj_list.html.haml b/app/views/platforms/repositories/_proj_list.html.haml similarity index 100% rename from app/views/repositories/_proj_list.html.haml rename to app/views/platforms/repositories/_proj_list.html.haml diff --git a/app/views/repositories/_project.html.haml b/app/views/platforms/repositories/_project.html.haml similarity index 100% rename from app/views/repositories/_project.html.haml rename to app/views/platforms/repositories/_project.html.haml diff --git a/app/views/repositories/_project.js.erb b/app/views/platforms/repositories/_project.js.erb similarity index 100% rename from app/views/repositories/_project.js.erb rename to app/views/platforms/repositories/_project.js.erb diff --git a/app/views/platforms/repositories/index.html.haml b/app/views/platforms/repositories/index.html.haml new file mode 100644 index 000000000..bdadba3ac --- /dev/null +++ b/app/views/platforms/repositories/index.html.haml @@ -0,0 +1,6 @@ +-set_meta_tags :title => [title_object(@platform), t('layout.repositories.list_header')] += render 'submenu' if params[:platform_id] += render 'sidebar' if params[:platform_id] += link_to t("layout.repositories.new"), new_platform_repository_path(@platform), :class => 'button' if can? :create, @platform.repositories.build += render 'list', :object => @repositories += will_paginate @repositories diff --git a/app/views/repositories/new.html.haml b/app/views/platforms/repositories/new.html.haml similarity index 63% rename from app/views/repositories/new.html.haml rename to app/views/platforms/repositories/new.html.haml index c17741890..72740cbb4 100644 --- a/app/views/repositories/new.html.haml +++ b/app/views/platforms/repositories/new.html.haml @@ -1,8 +1,8 @@ -set_meta_tags :title => [title_object(@platform), t('layout.repositories.new')] -= render :partial => 'platforms/submenu' -= render :partial => 'platforms/sidebar' += render 'submenu' += render 'sidebar' %h3= t("layout.repositories.new_header") = form_for :repository, :url => platform_repositories_path(@platform), :html => { :class => :form } do |f| - = render :partial => "form", :locals => {:f => f} + = render "form", :f => f diff --git a/app/views/platforms/repositories/projects_list.html.haml b/app/views/platforms/repositories/projects_list.html.haml new file mode 100644 index 000000000..26de0610c --- /dev/null +++ b/app/views/platforms/repositories/projects_list.html.haml @@ -0,0 +1,6 @@ += render 'submenu' += render 'sidebar' + +%h3= raw "#{t("layout.repositories.add_project_to")}: #{link_to @repository.name, platform_repository_path(@platform, @repository)}" + += render 'proj_list', :object => @projects diff --git a/app/views/repositories/show.html.haml b/app/views/platforms/repositories/show.html.haml similarity index 75% rename from app/views/repositories/show.html.haml rename to app/views/platforms/repositories/show.html.haml index b14f663cd..dedcb69e6 100644 --- a/app/views/repositories/show.html.haml +++ b/app/views/platforms/repositories/show.html.haml @@ -1,6 +1,6 @@ -set_meta_tags :title => title_object(@repository) -= render :partial => 'platforms/submenu' -= render :partial => 'platforms/sidebar' += render 'submenu' += render 'sidebar' %h3.fix= "#{t("layout.repositories.about")}: #{@repository.name}" @@ -12,4 +12,4 @@ - if can? :add_project, @repository = link_to t("layout.projects.add"), add_project_platform_repository_path(@platform, @repository), :class => 'button' -= render :partial => 'proj_list' \ No newline at end of file += render 'proj_list' \ No newline at end of file diff --git a/app/views/projects/_branch_select.html.haml b/app/views/projects/base/_branch_select.html.haml similarity index 100% rename from app/views/projects/_branch_select.html.haml rename to app/views/projects/base/_branch_select.html.haml diff --git a/app/views/projects/_show.html.haml b/app/views/projects/base/_layout.html.haml similarity index 59% rename from app/views/projects/_show.html.haml rename to app/views/projects/base/_layout.html.haml index e9606b920..f21b69b05 100644 --- a/app/views/projects/_show.html.haml +++ b/app/views/projects/base/_layout.html.haml @@ -1,5 +1,5 @@ -= render :partial => 'projects/submenu' -= render :partial => 'projects/repo_block', :locals => {:project => @project} += render 'submenu' += render 'repo_block', :project => @project .description %h3= t("layout.projects.about_subheader") @@ -9,7 +9,7 @@ %h3= t("layout.projects.last_commit") - GitPresenters::CommitAsMessagePresenter.present(@commit, :branch => @branch, :project => @project) do |presenter| - = render :partial => 'shared/feed_message', :locals => {:presenter => presenter, :item_no => 1} + = render 'shared/feed_message', :presenter => presenter, :item_no => 1 .both diff --git a/app/views/projects/_repo_block.html.haml b/app/views/projects/base/_repo_block.html.haml similarity index 93% rename from app/views/projects/_repo_block.html.haml rename to app/views/projects/base/_repo_block.html.haml index 63c1e111c..0870762d5 100644 --- a/app/views/projects/_repo_block.html.haml +++ b/app/views/projects/base/_repo_block.html.haml @@ -12,7 +12,7 @@ = text_field_tag :url, git_repo_url(project.git_repo_name), :class => 'name', :spellcheck => 'false', :readonly => true .git_help ? .role= can?(:write, project) ? t("layout.read_write_access") : t("layout.read_access") - = render :partial => 'projects/branch_select', :locals => {:project => project} + = render 'branch_select', :project => project #git_help_data %p= t("layout.projects.git_help.cloning") + ":" %p diff --git a/app/views/projects/_sidebar.html.haml b/app/views/projects/base/_sidebar.html.haml similarity index 100% rename from app/views/projects/_sidebar.html.haml rename to app/views/projects/base/_sidebar.html.haml diff --git a/app/views/projects/_submenu.html.haml b/app/views/projects/base/_submenu.html.haml similarity index 100% rename from app/views/projects/_submenu.html.haml rename to app/views/projects/base/_submenu.html.haml diff --git a/app/views/build_lists/_build_list.html.haml b/app/views/projects/build_lists/_build_list.html.haml similarity index 100% rename from app/views/build_lists/_build_list.html.haml rename to app/views/projects/build_lists/_build_list.html.haml diff --git a/app/views/build_lists/_filter.html.haml b/app/views/projects/build_lists/_filter.html.haml similarity index 100% rename from app/views/build_lists/_filter.html.haml rename to app/views/projects/build_lists/_filter.html.haml diff --git a/app/views/build_lists/_include_repos.html.haml b/app/views/projects/build_lists/_include_repos.html.haml similarity index 100% rename from app/views/build_lists/_include_repos.html.haml rename to app/views/projects/build_lists/_include_repos.html.haml diff --git a/app/views/build_lists/_platform_build_list.html.haml b/app/views/projects/build_lists/_platform_build_list.html.haml similarity index 100% rename from app/views/build_lists/_platform_build_list.html.haml rename to app/views/projects/build_lists/_platform_build_list.html.haml diff --git a/app/views/build_lists/_submenu.html.haml b/app/views/projects/build_lists/_submenu.html.haml similarity index 65% rename from app/views/build_lists/_submenu.html.haml rename to app/views/projects/build_lists/_submenu.html.haml index ec22631d9..50673084d 100644 --- a/app/views/build_lists/_submenu.html.haml +++ b/app/views/projects/build_lists/_submenu.html.haml @@ -7,5 +7,5 @@ .left %nav %ul - %li= link_to t('layout.projects.list_header'), build_lists_path, :class => (params[:controller] == 'build_lists' ? 'active' : nil) - %li= link_to t('layout.products.list_header'), product_build_lists_path, :class => (params[:controller] == 'product_build_lists' ? 'active' : nil) + %li= link_to t('layout.projects.list_header'), build_lists_path, :class => (controller_name == 'build_lists' ? 'active' : nil) + %li= link_to t('layout.products.list_header'), product_build_lists_path, :class => (controller_name == 'product_build_lists' ? 'active' : nil) diff --git a/app/views/build_lists/index.html.haml b/app/views/projects/build_lists/index.html.haml similarity index 78% rename from app/views/build_lists/index.html.haml rename to app/views/projects/build_lists/index.html.haml index 72c1482b9..8642bee90 100644 --- a/app/views/build_lists/index.html.haml +++ b/app/views/projects/build_lists/index.html.haml @@ -11,10 +11,10 @@ %th.lpadding16= t("activerecord.attributes.build_list.user") %th= t("layout.build_lists.action") %th.lpadding16= t("activerecord.attributes.build_list.updated_at") - %tbody= render @build_lists + %tbody= render :partial => 'projects/build_lists/build_list', :collection => @build_lists .both = will_paginate @build_lists -= render 'build_lists/filter' -= render @project ? 'projects/submenu' : 'build_lists/submenu' += render 'filter' += render @project ? 'projects/base/submenu' : 'projects/build_lists/submenu' diff --git a/app/views/build_lists/new.html.haml b/app/views/projects/build_lists/new.html.haml similarity index 98% rename from app/views/build_lists/new.html.haml rename to app/views/projects/build_lists/new.html.haml index ad53ea951..9bd2464b7 100644 --- a/app/views/build_lists/new.html.haml +++ b/app/views/projects/build_lists/new.html.haml @@ -38,4 +38,4 @@ %br = f.submit t("layout.projects.build_button") -= render 'projects/submenu' += render 'projects/base/submenu' diff --git a/app/views/build_lists/show.html.haml b/app/views/projects/build_lists/show.html.haml similarity index 99% rename from app/views/build_lists/show.html.haml rename to app/views/projects/build_lists/show.html.haml index 2ae62610e..f5793b252 100644 --- a/app/views/build_lists/show.html.haml +++ b/app/views/projects/build_lists/show.html.haml @@ -89,4 +89,4 @@ :javascript $('article .all').addClass('bigpadding'); -= render 'build_lists/submenu' += render 'submenu' diff --git a/app/views/collaborators/_collaborator.json.jbuilder b/app/views/projects/collaborators/_collaborator.json.jbuilder similarity index 100% rename from app/views/collaborators/_collaborator.json.jbuilder rename to app/views/projects/collaborators/_collaborator.json.jbuilder diff --git a/app/views/collaborators/_collaborators.json.jbuilder b/app/views/projects/collaborators/_collaborators.json.jbuilder similarity index 100% rename from app/views/collaborators/_collaborators.json.jbuilder rename to app/views/projects/collaborators/_collaborators.json.jbuilder diff --git a/app/views/collaborators/add.html.haml b/app/views/projects/collaborators/add.html.haml similarity index 100% rename from app/views/collaborators/add.html.haml rename to app/views/projects/collaborators/add.html.haml diff --git a/app/views/collaborators/edit.html.haml b/app/views/projects/collaborators/edit.html.haml similarity index 97% rename from app/views/collaborators/edit.html.haml rename to app/views/projects/collaborators/edit.html.haml index 70f620314..0db3aa7dd 100644 --- a/app/views/collaborators/edit.html.haml +++ b/app/views/projects/collaborators/edit.html.haml @@ -1,6 +1,6 @@ -set_meta_tags :title => [title_object(@project), t('layout.projects.members')] -= render :partial => 'projects/sidebar' -= render :partial => 'projects/submenu' += render 'sidebar' += render 'submenu' %a{:name => 'users'} %h3= t("layout.users.list_header") diff --git a/app/views/collaborators/index.html.haml b/app/views/projects/collaborators/index.html.haml similarity index 83% rename from app/views/collaborators/index.html.haml rename to app/views/projects/collaborators/index.html.haml index 09785b483..7b9a468ae 100644 --- a/app/views/collaborators/index.html.haml +++ b/app/views/projects/collaborators/index.html.haml @@ -1,6 +1,6 @@ -set_meta_tags :title => [title_object(@project), t('layout.projects.members')] -= render :partial => 'projects/sidebar' -= render :partial => 'projects/submenu' += render 'sidebar' += render 'submenu' %a{:name => 'users'} %h3= t("layout.users.list_header") @@ -39,6 +39,6 @@ :javascript $(function() { - Rosa.bootstrapedData.collaborators = #{ render :partial => 'collaborators.json.jbuilder', :locals => {:collaborators => @collaborators } }; + Rosa.bootstrapedData.collaborators = #{ render 'collaborators.json.jbuilder', :collaborators => @collaborators }; r = new Rosa.Routers.CollaboratorsRouter(); }); diff --git a/app/views/collaborators/index.json.jbuilder b/app/views/projects/collaborators/index.json.jbuilder similarity index 100% rename from app/views/collaborators/index.json.jbuilder rename to app/views/projects/collaborators/index.json.jbuilder diff --git a/app/views/comments/_add.html.haml b/app/views/projects/comments/_add.html.haml similarity index 95% rename from app/views/comments/_add.html.haml rename to app/views/projects/comments/_add.html.haml index b31b0be40..e78fe2ac3 100644 --- a/app/views/comments/_add.html.haml +++ b/app/views/projects/comments/_add.html.haml @@ -10,7 +10,7 @@ - subscribe_path = is_subscribed ? unsubscribe_commit_path(project, commentable) : subscribe_commit_path(project, commentable) = form_for :comment, :url => new_path, :method => :post, :html => { :class => :form } do |f| - = render :partial => "comments/form", :locals => {:f => f} + = render "projects/comments/form", :f => f .comment-left = t("layout.comments.notifications_are") %span.bold diff --git a/app/views/comments/_form.html.haml b/app/views/projects/comments/_form.html.haml similarity index 100% rename from app/views/comments/_form.html.haml rename to app/views/projects/comments/_form.html.haml diff --git a/app/views/comments/_list.html.haml b/app/views/projects/comments/_list.html.haml similarity index 70% rename from app/views/comments/_list.html.haml rename to app/views/projects/comments/_list.html.haml index 1ba6b69ad..acbead95f 100644 --- a/app/views/comments/_list.html.haml +++ b/app/views/projects/comments/_list.html.haml @@ -3,4 +3,4 @@ %h3= t("layout.comments.comments_header") - list.each do |comment| - CommentPresenter.present(comment, :project => project, :commentable => commentable) do |presenter| - = render :partial => 'shared/feed_message', :locals => {:presenter => presenter} \ No newline at end of file + = render 'shared/feed_message', :presenter => presenter \ No newline at end of file diff --git a/app/views/comments/edit.html.haml b/app/views/projects/comments/edit.html.haml similarity index 88% rename from app/views/comments/edit.html.haml rename to app/views/projects/comments/edit.html.haml index fff5309ef..a27158367 100644 --- a/app/views/comments/edit.html.haml +++ b/app/views/projects/comments/edit.html.haml @@ -8,4 +8,4 @@ = t("layout.comments.edit_header") .inner = form_for @comment, :url => project_commentable_comment_path(@project, @commentable, @comment), :html => {:class => :form} do |f| - = render :partial => "form", :locals => {:f => f} + = render "form", :f => f diff --git a/app/views/git/shared/_choose_fork.html.haml b/app/views/projects/git/base/_choose_fork.html.haml similarity index 100% rename from app/views/git/shared/_choose_fork.html.haml rename to app/views/projects/git/base/_choose_fork.html.haml diff --git a/app/views/git/shared/_fork.html.haml b/app/views/projects/git/base/_fork.html.haml similarity index 73% rename from app/views/git/shared/_fork.html.haml rename to app/views/projects/git/base/_fork.html.haml index d982149f9..ccb928bff 100644 --- a/app/views/git/shared/_fork.html.haml +++ b/app/views/projects/git/base/_fork.html.haml @@ -4,8 +4,8 @@ .modal-header %a.close{"data-dismiss" => "modal"} × %h3=t 'layout.projects.fork_modal_header' - .modal-footer=render :partial => 'git/shared/choose_fork', :locals => {:owner => current_user} + .modal-footer=render 'choose_fork', :owner => current_user - Group.can_own_project(current_user).each do |group| - .modal-footer=render :partial => 'git/shared/choose_fork', :locals => {:owner => group} + .modal-footer=render 'choose_fork', :owner => group - if can? :create, @project.build_lists.new .r{:style => "display: block"}= link_to t('layout.projects.new_build_list'), new_project_build_list_path(@project), :class => 'button' diff --git a/app/views/git/shared/_whereami.html.haml b/app/views/projects/git/base/_whereami.html.haml similarity index 100% rename from app/views/git/shared/_whereami.html.haml rename to app/views/projects/git/base/_whereami.html.haml diff --git a/app/views/git/blobs/_blame_table.html.haml b/app/views/projects/git/blobs/_blame_table.html.haml similarity index 100% rename from app/views/git/blobs/_blame_table.html.haml rename to app/views/projects/git/blobs/_blame_table.html.haml diff --git a/app/views/git/blobs/_editor.html.haml b/app/views/projects/git/blobs/_editor.html.haml similarity index 88% rename from app/views/git/blobs/_editor.html.haml rename to app/views/projects/git/blobs/_editor.html.haml index a02d5e229..874945aee 100644 --- a/app/views/git/blobs/_editor.html.haml +++ b/app/views/projects/git/blobs/_editor.html.haml @@ -1,7 +1,7 @@ %h3= t("layout.projects.files_in_project") .files - .l= render :partial => 'git/shared/whereami' - = render :partial => 'git/shared/fork' + .l= render 'whereami' + = render 'fork' .both = form_tag blob_path(@project, @treeish, @path), :name => 'blob-editor', :method => :put do diff --git a/app/views/git/blobs/_show.html.haml b/app/views/projects/git/blobs/_show.html.haml similarity index 92% rename from app/views/git/blobs/_show.html.haml rename to app/views/projects/git/blobs/_show.html.haml index b1bc94d66..f867189fd 100644 --- a/app/views/git/blobs/_show.html.haml +++ b/app/views/projects/git/blobs/_show.html.haml @@ -1,7 +1,7 @@ %h3= t("layout.projects.files_in_project") .files - .l= render :partial => 'git/shared/whereami' - = render :partial => 'git/shared/fork' + .l= render 'whereami' + = render 'fork' .both - render_way = choose_render_way(@blob) diff --git a/app/views/git/blobs/_top.html.haml b/app/views/projects/git/blobs/_top.html.haml similarity index 100% rename from app/views/git/blobs/_top.html.haml rename to app/views/projects/git/blobs/_top.html.haml diff --git a/app/views/git/blobs/blame.html.haml b/app/views/projects/git/blobs/blame.html.haml similarity index 70% rename from app/views/git/blobs/blame.html.haml rename to app/views/projects/git/blobs/blame.html.haml index 11f4fbf01..81fef4b00 100644 --- a/app/views/git/blobs/blame.html.haml +++ b/app/views/projects/git/blobs/blame.html.haml @@ -1,6 +1,6 @@ -set_meta_tags :title => "#{title_object @project} #{t('at') if @branch} #{@branch.try :name}" -= render :partial => 'projects/submenu' -= render :partial => 'projects/repo_block', :locals => {:project => @project} += render 'submenu' += render 'repo_block', :project => @project .description %h3= t("layout.projects.about_subheader") @@ -10,14 +10,14 @@ %h3= t("layout.projects.last_commit") - GitPresenters::CommitAsMessagePresenter.present(@commit, :branch => @branch, :project => @project) do |presenter| - = render :partial => 'shared/feed_message', :locals => {:presenter => presenter, :item_no => 1} + = render 'shared/feed_message', :presenter => presenter, :item_no => 1 .both #repo-wrapper %h3= t("layout.projects.files_in_project") .files - .l= render :partial => 'git/shared/whereami' + .l= render 'whereami' .both - render_way = choose_render_way(@blob) diff --git a/app/views/git/blobs/edit.html.haml b/app/views/projects/git/blobs/edit.html.haml similarity index 67% rename from app/views/git/blobs/edit.html.haml rename to app/views/projects/git/blobs/edit.html.haml index 95904d56d..ac520f0b3 100644 --- a/app/views/git/blobs/edit.html.haml +++ b/app/views/projects/git/blobs/edit.html.haml @@ -1,2 +1,2 @@ -set_meta_tags :title => [title_object(@project), "#{t :title_editing} #{@project.name}/#{@path} #{t('at') if @branch} #{@branch.try :name}"] -= render :partial => "git/blobs/editor", :layout => 'projects/show' += render :partial => "editor", :layout => 'layout' diff --git a/app/views/git/blobs/show.html.haml b/app/views/projects/git/blobs/show.html.haml similarity index 64% rename from app/views/git/blobs/show.html.haml rename to app/views/projects/git/blobs/show.html.haml index b28e87cf5..6b116dccb 100644 --- a/app/views/git/blobs/show.html.haml +++ b/app/views/projects/git/blobs/show.html.haml @@ -1,2 +1,2 @@ -set_meta_tags :title => [title_object(@project), "#{@project.name}/#{@path} #{t('at') if @branch} #{@branch.try :name}"] -= render :partial => "git/blobs/show", :layout => 'projects/show' += render :partial => "show", :layout => 'layout' diff --git a/app/views/git/commits/_commit_diff.html.haml b/app/views/projects/git/commits/_commit_diff.html.haml similarity index 100% rename from app/views/git/commits/_commit_diff.html.haml rename to app/views/projects/git/commits/_commit_diff.html.haml diff --git a/app/views/git/commits/_commits.html.haml b/app/views/projects/git/commits/_commits.html.haml similarity index 82% rename from app/views/git/commits/_commits.html.haml rename to app/views/projects/git/commits/_commits.html.haml index 27aa401d5..9651c7060 100644 --- a/app/views/git/commits/_commits.html.haml +++ b/app/views/projects/git/commits/_commits.html.haml @@ -13,6 +13,6 @@ .messages - commits.each_with_index do |commit| - GitPresenters::CommitAsMessagePresenter.present(commit, :branch => @branch, :project => @project) do |presenter| - = render :partial => 'shared/feed_message', :locals => {:presenter => presenter, :item_no => counter} + = render 'shared/feed_message', :presenter => presenter, :item_no => counter - counter += 1 .both \ No newline at end of file diff --git a/app/views/git/commits/_paginate.html.haml b/app/views/projects/git/commits/_paginate.html.haml similarity index 100% rename from app/views/git/commits/_paginate.html.haml rename to app/views/projects/git/commits/_paginate.html.haml diff --git a/app/views/git/commits/_show.html.haml b/app/views/projects/git/commits/_show.html.haml similarity index 88% rename from app/views/git/commits/_show.html.haml rename to app/views/projects/git/commits/_show.html.haml index 76ab77715..9e6e6a30c 100644 --- a/app/views/git/commits/_show.html.haml +++ b/app/views/projects/git/commits/_show.html.haml @@ -14,6 +14,6 @@ -begin = render_commit_stats(stats) - = render :partial => 'git/commits/commit_diff', :collection => @commit.diffs + = render :partial => 'commit_diff', :collection => @commit.diffs - rescue Grit::Git::GitTimeout %p= t 'layout.git.repositories.commit_diff_too_big' diff --git a/app/views/projects/git/commits/index.html.haml b/app/views/projects/git/commits/index.html.haml new file mode 100644 index 000000000..f3f9cca11 --- /dev/null +++ b/app/views/projects/git/commits/index.html.haml @@ -0,0 +1,6 @@ +-set_meta_tags :title => [title_object(@project), "#{t '.title'} #{t('at') if @branch} #{@branch.try :name}"] += render 'submenu' += render 'repo_block', :project => @project + += render :partial => 'commits', :object => @commits += render 'paginate' if @render_paginate diff --git a/app/views/git/commits/show.html.haml b/app/views/projects/git/commits/show.html.haml similarity index 61% rename from app/views/git/commits/show.html.haml rename to app/views/projects/git/commits/show.html.haml index 9329e7eb0..2fc7f5282 100644 --- a/app/views/git/commits/show.html.haml +++ b/app/views/projects/git/commits/show.html.haml @@ -1,5 +1,5 @@ -set_meta_tags :title => [title_object(@project), shortest_hash_id(@commit.id), @commit.message] -= render :partial => 'projects/submenu' += render 'submenu' .description %h3= t("layout.projects.about_subheader") @@ -14,7 +14,7 @@ .both #repo-wrapper - = render :partial => 'show' + = render 'show' - = render :partial => "comments/list", :locals => {:list => Comment.for_commit(@commit), :project => @project, :commentable => @commit} - = render :partial => "comments/add", :locals => {:project => @project, :commentable => @commit} if current_user + = render "projects/comments/list", :list => Comment.for_commit(@commit), :project => @project, :commentable => @commit + = render "projects/comments/add", :project => @project, :commentable => @commit if current_user diff --git a/app/views/git/trees/_show.html.haml b/app/views/projects/git/trees/_show.html.haml similarity index 90% rename from app/views/git/trees/_show.html.haml rename to app/views/projects/git/trees/_show.html.haml index ccd21be34..2bf2868aa 100644 --- a/app/views/git/trees/_show.html.haml +++ b/app/views/projects/git/trees/_show.html.haml @@ -1,7 +1,7 @@ %h3= t("layout.projects.files_in_project") .files - .l= render :partial => 'git/shared/whereami' - = render :partial => 'git/shared/fork' + .l= render 'whereami' + = render 'fork' .both %table#myTable.tablesorter.project{:cellpadding => "0", :cellspacing => "0"} diff --git a/app/views/git/trees/empty.html.haml b/app/views/projects/git/trees/empty.html.haml similarity index 79% rename from app/views/git/trees/empty.html.haml rename to app/views/projects/git/trees/empty.html.haml index 0bbfb90fa..2f1ff6733 100644 --- a/app/views/git/trees/empty.html.haml +++ b/app/views/projects/git/trees/empty.html.haml @@ -1,6 +1,6 @@ -set_meta_tags :title => title_object(@project) -= render :partial => 'projects/submenu' -= render :partial => 'projects/repo_block', :locals => {:project => @project} += render 'submenu' += render 'repo_block', :project => @project .description %h3= t("layout.projects.about_subheader") @@ -13,7 +13,7 @@ %h3= t("layout.projects.files_in_project") .files - .l= render :partial => 'git/shared/whereami' + .l= render 'whereami' .both %table#myTable.tablesorter.project{:cellpadding => "0", :cellspacing => "0"} diff --git a/app/views/git/trees/show.html.haml b/app/views/projects/git/trees/show.html.haml similarity index 59% rename from app/views/git/trees/show.html.haml rename to app/views/projects/git/trees/show.html.haml index 738e2f39b..f1dccbe2f 100644 --- a/app/views/git/trees/show.html.haml +++ b/app/views/projects/git/trees/show.html.haml @@ -1,2 +1,2 @@ -set_meta_tags :title => "#{title_object @project} #{t('at') if @branch} #{@branch.try :name}" -= render :partial => "git/trees/show", :layout => 'projects/show' += render :partial => "show", :layout => 'layout' diff --git a/app/views/issues/_colors_chooser.html.haml b/app/views/projects/issues/_colors_chooser.html.haml similarity index 100% rename from app/views/issues/_colors_chooser.html.haml rename to app/views/projects/issues/_colors_chooser.html.haml diff --git a/app/views/issues/_form.html.haml b/app/views/projects/issues/_form.html.haml similarity index 100% rename from app/views/issues/_form.html.haml rename to app/views/projects/issues/_form.html.haml diff --git a/app/views/issues/_index_sidebar.html.haml b/app/views/projects/issues/_index_sidebar.html.haml similarity index 97% rename from app/views/issues/_index_sidebar.html.haml rename to app/views/projects/issues/_index_sidebar.html.haml index 8147da126..d1ccfc387 100644 --- a/app/views/issues/_index_sidebar.html.haml +++ b/app/views/projects/issues/_index_sidebar.html.haml @@ -19,4 +19,4 @@ .bordered.nopadding %h3.bmargin10=t('layout.issues.new') = link_to t("layout.add"), new_project_issue_path(@project), :class => 'button' - =render :partial => 'labels' + =render 'labels' diff --git a/app/views/issues/_issue.html.haml b/app/views/projects/issues/_issue.html.haml similarity index 100% rename from app/views/issues/_issue.html.haml rename to app/views/projects/issues/_issue.html.haml diff --git a/app/views/issues/_labels.html.haml b/app/views/projects/issues/_labels.html.haml similarity index 94% rename from app/views/issues/_labels.html.haml rename to app/views/projects/issues/_labels.html.haml index bd7536170..81effb206 100644 --- a/app/views/issues/_labels.html.haml +++ b/app/views/projects/issues/_labels.html.haml @@ -26,7 +26,7 @@ .edit_label_form{:style => 'display:none'} =form_tag project_issues_update_label_path(@project, label.id), :id => 'update_label', :method => :post do %input.gray{:name => 'name', :type => "text", :value => label.name} - =render :partial => 'issues/colors_chooser', :locals => {:current_color => label.color} + =render 'colors_chooser', :current_color => label.color .lefter %a{:href => "#custom_color-#{label.name}", :id => "custom_color-#{label.name}", :class => 'custom_color'}=t('layout.issues.label_custom_color') =text_field_tag :color, label.color, :id => 'label_color', :class => 'gray', :style => 'display:none', :maxlength => 6 @@ -36,7 +36,7 @@ =form_tag create_label_project_issues_path(@project), :id => 'new_label', :method => :post do =tracker_search_field(:name, t('layout.issues.new_label')) - =render :partial => 'issues/colors_chooser' + =render 'colors_chooser' .lefter %a{:href => "#custom_color", :id => 'custom_color', :class => 'custom_color'}=t('layout.issues.label_custom_color') =text_field_tag :color, '0054a6', :id => 'label_color', :class => 'gray', :style => 'display:none', :maxlength => 6 diff --git a/app/views/issues/_manage_sidebar.html.haml b/app/views/projects/issues/_manage_sidebar.html.haml similarity index 98% rename from app/views/issues/_manage_sidebar.html.haml rename to app/views/projects/issues/_manage_sidebar.html.haml index 1d0c5a877..7568765e7 100644 --- a/app/views/issues/_manage_sidebar.html.haml +++ b/app/views/projects/issues/_manage_sidebar.html.haml @@ -32,7 +32,7 @@ =form_tag search_collaborators_project_issues_path(@project), :id => 'search_user', :method => :get, :style => @issue.persisted? ? 'display:none' : '' do =tracker_search_field(:search_user, t('layout.issues.search_user')) #manage_issue_users_list - =render 'issues/search_collaborators' + =render 'search_collaborators' =link_to(t('layout.issues.done'), '#', :class => "button tmargin10 update_assignee", :style => 'display:none') if can_manage .block diff --git a/app/views/issues/_search_collaborators.html.haml b/app/views/projects/issues/_search_collaborators.html.haml similarity index 100% rename from app/views/issues/_search_collaborators.html.haml rename to app/views/projects/issues/_search_collaborators.html.haml diff --git a/app/views/issues/_status.html.haml b/app/views/projects/issues/_status.html.haml similarity index 100% rename from app/views/issues/_status.html.haml rename to app/views/projects/issues/_status.html.haml diff --git a/app/views/issues/index.html.haml b/app/views/projects/issues/index.html.haml similarity index 79% rename from app/views/issues/index.html.haml rename to app/views/projects/issues/index.html.haml index 8214fcccd..02c05d53f 100644 --- a/app/views/issues/index.html.haml +++ b/app/views/projects/issues/index.html.haml @@ -1,6 +1,6 @@ -set_meta_tags :title => [title_object(@project), t('.title')] --render :partial => 'projects/submenu' --render :partial => 'issues/index_sidebar' +-render 'submenu' +-render 'index_sidebar' #closed-switcher.blue-switcher =hidden_field_tag :issues_status, @status, :id => 'issues_status' @@ -18,5 +18,5 @@ %th.th1{:colspan => "2"}=t('layout.issues.number') %th{:colspan => "2"}=t('layout.issues.description') %tbody - = render :partial => 'issues/issue', :collection => @issues + = render :partial => 'issue', :collection => @issues = will_paginate @issues \ No newline at end of file diff --git a/app/views/issues/new.html.haml b/app/views/projects/issues/new.html.haml similarity index 63% rename from app/views/issues/new.html.haml rename to app/views/projects/issues/new.html.haml index bac32e3fd..e3c4948e7 100644 --- a/app/views/issues/new.html.haml +++ b/app/views/projects/issues/new.html.haml @@ -1,7 +1,7 @@ -set_meta_tags :title => [title_object(@project), t('layout.issues.create_header')] --render :partial => 'projects/submenu' --render :partial => 'issues/manage_sidebar' +-render 'submenu' +-render 'manage_sidebar' %h3.bpadding10= t("layout.issues.create_header") = form_for :issue, :url => project_issues_path(@project), :html => { :class => 'form issue' } do |f| - = render :partial => "form", :locals => {:f => f} + = render "form", :f => f diff --git a/app/views/issues/show.html.haml b/app/views/projects/issues/show.html.haml similarity index 76% rename from app/views/issues/show.html.haml rename to app/views/projects/issues/show.html.haml index ad678c3ec..141d3cc1a 100644 --- a/app/views/issues/show.html.haml +++ b/app/views/projects/issues/show.html.haml @@ -1,6 +1,6 @@ -set_meta_tags :title => [title_object(@project), @issue.title] --render :partial => 'projects/submenu' --render :partial => 'issues/manage_sidebar' +-render 'submenu' +-render 'manage_sidebar' -content_for :right_nopadding do dummy %h3.issue_title=@issue.title @@ -28,8 +28,8 @@ =f.submit t('layout.update'), :id => 'update_issue_content' =link_to t('layout.issues.cancel_button'), '#', :id => 'cancel_edit_issue_content', :class => 'button' %br -=render :partial => 'issues/status' +=render 'status' -= render :partial => "comments/list", :locals => {:list => @issue.comments, :project => @project, :commentable => @issue} += render "projects/comments/list", :list => @issue.comments, :project => @project, :commentable => @issue %br -= render :partial => "comments/add", :locals => {:project => @project, :commentable => @issue} if current_user += render "projects/comments/add", :project => @project, :commentable => @issue if current_user diff --git a/app/views/projects/_form.html.haml b/app/views/projects/projects/_form.html.haml similarity index 100% rename from app/views/projects/_form.html.haml rename to app/views/projects/projects/_form.html.haml diff --git a/app/views/projects/_project.html.haml b/app/views/projects/projects/_project.html.haml similarity index 100% rename from app/views/projects/_project.html.haml rename to app/views/projects/projects/_project.html.haml diff --git a/app/views/projects/_project.json.jbuilder b/app/views/projects/projects/_project.json.jbuilder similarity index 100% rename from app/views/projects/_project.json.jbuilder rename to app/views/projects/projects/_project.json.jbuilder diff --git a/app/views/projects/edit.html.haml b/app/views/projects/projects/edit.html.haml similarity index 74% rename from app/views/projects/edit.html.haml rename to app/views/projects/projects/edit.html.haml index 6eb287c31..5cdc5af03 100644 --- a/app/views/projects/edit.html.haml +++ b/app/views/projects/projects/edit.html.haml @@ -1,9 +1,9 @@ -set_meta_tags :title => [title_object(@project), t('layout.projects.edit')] -= render :partial => 'projects/submenu' -= render :partial => 'projects/sidebar' += render 'submenu' += render 'sidebar' = form_for @project, :html => { :class => :form, :multipart => true } do |f| - = render :partial => "form", :locals => {:f => f} + = render "form", :f => f .hr .leftside= t("layout.projects.delete_warning") diff --git a/app/views/projects/index.html.haml b/app/views/projects/projects/index.html.haml similarity index 98% rename from app/views/projects/index.html.haml rename to app/views/projects/projects/index.html.haml index 5bc603c90..ed1a4777c 100644 --- a/app/views/projects/index.html.haml +++ b/app/views/projects/projects/index.html.haml @@ -33,7 +33,7 @@ %th{:colspan => 4} - %tbody= render @projects + %tbody= render :partial => 'projects/projects/project', :collection => @projects :javascript $(document).ready(function() { diff --git a/app/views/projects/index.json.jbuilder b/app/views/projects/projects/index.json.jbuilder similarity index 100% rename from app/views/projects/index.json.jbuilder rename to app/views/projects/projects/index.json.jbuilder diff --git a/app/views/projects/new.html.haml b/app/views/projects/projects/new.html.haml similarity index 70% rename from app/views/projects/new.html.haml rename to app/views/projects/projects/new.html.haml index bb5f6cfd6..68a1a0c6f 100644 --- a/app/views/projects/new.html.haml +++ b/app/views/projects/projects/new.html.haml @@ -1,4 +1,4 @@ %h3.bpadding10= title t("layout.projects.new") = form_for @project, :html => { :class => :form, :multipart => true } do |f| - = render :partial => "form", :locals => {:f => f} + = render "form", :f => f diff --git a/app/views/projects/sections.html.haml b/app/views/projects/projects/sections.html.haml similarity index 92% rename from app/views/projects/sections.html.haml rename to app/views/projects/projects/sections.html.haml index dd677970a..6bae42c0f 100644 --- a/app/views/projects/sections.html.haml +++ b/app/views/projects/projects/sections.html.haml @@ -1,6 +1,6 @@ -set_meta_tags :title => [title_object(@project), t('layout.projects.sections')] -= render :partial => 'projects/submenu' -= render :partial => 'projects/sidebar' += render 'submenu' += render 'sidebar' = form_for @project, :url => sections_project_path(@project), :method => :post, :html => { :class => :form, :multipart => true } do |f| .leftside.w25 diff --git a/app/views/wiki/_compare.html.haml b/app/views/projects/wiki/_compare.html.haml similarity index 100% rename from app/views/wiki/_compare.html.haml rename to app/views/projects/wiki/_compare.html.haml diff --git a/app/views/wiki/_diff_data.html.haml b/app/views/projects/wiki/_diff_data.html.haml similarity index 100% rename from app/views/wiki/_diff_data.html.haml rename to app/views/projects/wiki/_diff_data.html.haml diff --git a/app/views/wiki/_editor.html.haml b/app/views/projects/wiki/_editor.html.haml similarity index 100% rename from app/views/wiki/_editor.html.haml rename to app/views/projects/wiki/_editor.html.haml diff --git a/app/views/wiki/_editor_toolbar.html.haml b/app/views/projects/wiki/_editor_toolbar.html.haml similarity index 100% rename from app/views/wiki/_editor_toolbar.html.haml rename to app/views/projects/wiki/_editor_toolbar.html.haml diff --git a/app/views/wiki/_git_access.html.haml b/app/views/projects/wiki/_git_access.html.haml similarity index 100% rename from app/views/wiki/_git_access.html.haml rename to app/views/projects/wiki/_git_access.html.haml diff --git a/app/views/wiki/_git_access_message.en.html.haml b/app/views/projects/wiki/_git_access_message.en.html.haml similarity index 100% rename from app/views/wiki/_git_access_message.en.html.haml rename to app/views/projects/wiki/_git_access_message.en.html.haml diff --git a/app/views/wiki/_git_access_message.ru.html.haml b/app/views/projects/wiki/_git_access_message.ru.html.haml similarity index 100% rename from app/views/wiki/_git_access_message.ru.html.haml rename to app/views/projects/wiki/_git_access_message.ru.html.haml diff --git a/app/views/wiki/_gollum_includes.html.haml b/app/views/projects/wiki/_gollum_includes.html.haml similarity index 100% rename from app/views/wiki/_gollum_includes.html.haml rename to app/views/projects/wiki/_gollum_includes.html.haml diff --git a/app/views/wiki/_history.html.haml b/app/views/projects/wiki/_history.html.haml similarity index 100% rename from app/views/wiki/_history.html.haml rename to app/views/projects/wiki/_history.html.haml diff --git a/app/views/wiki/_navigation.html.haml b/app/views/projects/wiki/_navigation.html.haml similarity index 100% rename from app/views/wiki/_navigation.html.haml rename to app/views/projects/wiki/_navigation.html.haml diff --git a/app/views/wiki/_page.html.haml b/app/views/projects/wiki/_page.html.haml similarity index 100% rename from app/views/wiki/_page.html.haml rename to app/views/projects/wiki/_page.html.haml diff --git a/app/views/wiki/_results.html.haml b/app/views/projects/wiki/_results.html.haml similarity index 100% rename from app/views/wiki/_results.html.haml rename to app/views/projects/wiki/_results.html.haml diff --git a/app/views/wiki/_searchbar.html.haml b/app/views/projects/wiki/_searchbar.html.haml similarity index 100% rename from app/views/wiki/_searchbar.html.haml rename to app/views/projects/wiki/_searchbar.html.haml diff --git a/app/views/wiki/_sidebar.html.haml b/app/views/projects/wiki/_sidebar.html.haml similarity index 100% rename from app/views/wiki/_sidebar.html.haml rename to app/views/projects/wiki/_sidebar.html.haml diff --git a/app/views/wiki/compare.html.haml b/app/views/projects/wiki/compare.html.haml similarity index 94% rename from app/views/wiki/compare.html.haml rename to app/views/projects/wiki/compare.html.haml index 8a6b851ad..7ca80e462 100644 --- a/app/views/wiki/compare.html.haml +++ b/app/views/projects/wiki/compare.html.haml @@ -1,7 +1,7 @@ -set_meta_tags :title => [title_object(@project), t('.title')] = render 'gollum_includes' / = render 'project_short' -= render 'projects/submenu' += render 'submenu' %h3.wiki - if @name diff --git a/app/views/wiki/edit.html.haml b/app/views/projects/wiki/edit.html.haml similarity index 96% rename from app/views/wiki/edit.html.haml rename to app/views/projects/wiki/edit.html.haml index 29bbb6993..a82ee519a 100644 --- a/app/views/wiki/edit.html.haml +++ b/app/views/projects/wiki/edit.html.haml @@ -1,7 +1,7 @@ -set_meta_tags :title => [title_object(@project), "#{t('wiki.editing_page')} #{@page.name}"] = render 'gollum_includes' / = render 'project_short' -= render 'projects/submenu' += render 'submenu' .left %h3 = t("wiki.editing_page") diff --git a/app/views/wiki/git.html.haml b/app/views/projects/wiki/git.html.haml similarity index 91% rename from app/views/wiki/git.html.haml rename to app/views/projects/wiki/git.html.haml index a69968070..2cfc33ad2 100644 --- a/app/views/wiki/git.html.haml +++ b/app/views/projects/wiki/git.html.haml @@ -1,7 +1,7 @@ -set_meta_tags :title => [title_object(@project), t('wiki.git_access')] / = render 'gollum_includes' / = render 'project_short' -= render 'projects/submenu' += render 'submenu' .desription-top .img= image_tag("code.png") diff --git a/app/views/wiki/history.html.haml b/app/views/projects/wiki/history.html.haml similarity index 92% rename from app/views/wiki/history.html.haml rename to app/views/projects/wiki/history.html.haml index 591d4602a..25e517594 100644 --- a/app/views/wiki/history.html.haml +++ b/app/views/projects/wiki/history.html.haml @@ -1,7 +1,7 @@ -set_meta_tags :title => [title_object(@project), t('wiki.wiki_history')] / = render 'gollum_includes' / = render 'project_short' -= render 'projects/submenu' += render 'submenu' .r= link_to t("wiki.compare_revisions"), "javascript:void(0);", :class => "action-compare-revision button width100" .both diff --git a/app/views/wiki/new.html.haml b/app/views/projects/wiki/new.html.haml similarity index 92% rename from app/views/wiki/new.html.haml rename to app/views/projects/wiki/new.html.haml index bf7bba762..a64ef7ef7 100644 --- a/app/views/wiki/new.html.haml +++ b/app/views/projects/wiki/new.html.haml @@ -1,6 +1,6 @@ = render 'gollum_includes' / = render 'project_short' -= render 'projects/submenu' += render 'submenu' %h3.wiki = t("wiki.create_page") diff --git a/app/views/wiki/pages.html.haml b/app/views/projects/wiki/pages.html.haml similarity index 92% rename from app/views/wiki/pages.html.haml rename to app/views/projects/wiki/pages.html.haml index bcf7d5ffd..fff37180c 100644 --- a/app/views/wiki/pages.html.haml +++ b/app/views/projects/wiki/pages.html.haml @@ -1,7 +1,7 @@ -set_meta_tags :title => [title_object(@project), t('wiki.pages')] / = render 'gollum_includes' / = render 'project_short' -= render 'projects/submenu' += render 'submenu' - if can? :write, @project .r= link_to t("wiki.new_page"), '#', :'data-url' => project_wiki_index_path(@project), :id => 'minibutton-new-page', :class => 'button width100' diff --git a/app/views/wiki/search.html.haml b/app/views/projects/wiki/search.html.haml similarity index 94% rename from app/views/wiki/search.html.haml rename to app/views/projects/wiki/search.html.haml index 7d59ae2a6..8a34a77ee 100644 --- a/app/views/wiki/search.html.haml +++ b/app/views/projects/wiki/search.html.haml @@ -1,7 +1,7 @@ -set_meta_tags :title => [title_object(@project), @query, t('wiki.searching.title')] / = render 'gollum_includes' / = render 'project_short' -= render 'projects/submenu' += render 'submenu' - @st_query = capture do %strong= @query diff --git a/app/views/wiki/show.html.haml b/app/views/projects/wiki/show.html.haml similarity index 96% rename from app/views/wiki/show.html.haml rename to app/views/projects/wiki/show.html.haml index 071d2014f..cff28ba8d 100644 --- a/app/views/wiki/show.html.haml +++ b/app/views/projects/wiki/show.html.haml @@ -1,7 +1,7 @@ -set_meta_tags :title => [title_object(@project), @page.name] / = render 'gollum_includes' / = render 'project_short' -= render 'projects/submenu' += render 'submenu' .left %h3 = @page.name diff --git a/app/views/register_requests/index.html.haml b/app/views/register_requests/index.html.haml deleted file mode 100644 index 527f40f59..000000000 --- a/app/views/register_requests/index.html.haml +++ /dev/null @@ -1,65 +0,0 @@ -.block - .secondary-navigation - %ul.wat-cf - %li.first= link_to t("layout.users.list"), users_path - %li= link_to t("layout.users.new"), new_user_path - %li.active= link_to t("layout.users.register_requests"), register_requests_path - .content - %div{:style => 'float: right; margin: 20px'} - = link_to t("layout.register_request.approved"), register_requests_path(:scope => :approved) - \| - = link_to t("layout.register_request.rejected"), register_requests_path(:scope => :rejected) - %h2.title - = title t("layout.register_request.list_header") - .inner - = form_tag register_requests_path, :method => :put, :class => 'update_form' do - = hidden_field_tag 'update_type' - %table.table - %tr - %th - %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"), register_request_approve_path(request) if can? :approve, request - | - = link_to t("layout.reject"), register_request_reject_path(request) if can? :reject, request - .actions-bar.wat-cf - .actions - - - =# button_tag t("layout.register_request.approve_selected"), :class => 'approve_registration' - =# button_tag t("layout.register_request.reject_selected"), :class => 'reject_registration' - .pagination - = 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 'admin/submenu' diff --git a/app/views/repositories/_proj_list1.html.haml b/app/views/repositories/_proj_list1.html.haml deleted file mode 100644 index 0033945f2..000000000 --- a/app/views/repositories/_proj_list1.html.haml +++ /dev/null @@ -1,21 +0,0 @@ -%table#myTable.tablesorter.repo-projects{:cellpadding => "0", :cellspacing => "0"} - %thead - %tr - %th.th1= t("activerecord.attributes.project.name") - %th.th2= t("activerecord.attributes.project.description") - %th.th3= t("layout.remove") - %tbody= render :partial => 'repositories/project', :collection => @projects - --#%table.tablesorter - %tr - %th.first= t("activerecord.attributes.project.name") - %th. - %th.last - - @projects.each do |project| - %tr{:class => cycle("odd", "even")} - %td - = link_to project.name, project_path(project) - %td.last - = link_to t("layout.show"), project_path(project) - \| - = link_to t("layout.delete"), url_for(:action => :remove_project, :project_id => project.id), :confirm => t("layout.projects.confirm_delete") diff --git a/app/views/repositories/_sidebar.html.haml b/app/views/repositories/_sidebar.html.haml deleted file mode 100644 index d4101628f..000000000 --- a/app/views/repositories/_sidebar.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -.block.notice - %h3= t("layout.platforms.current_platform_header") - .content - / %p= link_to @platform.name, platform_path(@platform) \ No newline at end of file diff --git a/app/views/repositories/index.html.haml b/app/views/repositories/index.html.haml deleted file mode 100644 index 34f5450c5..000000000 --- a/app/views/repositories/index.html.haml +++ /dev/null @@ -1,20 +0,0 @@ --set_meta_tags :title => [title_object(@platform), t('layout.repositories.list_header')] -= render :partial => 'platforms/submenu' if params[:platform_id] -= render :partial => 'platforms/sidebar' if params[:platform_id] -= link_to t("layout.repositories.new"), new_platform_repository_path(@platform), :class => 'button' if can? :create, @platform.repositories.build -= render :partial => 'list', :object => @repositories -= will_paginate @repositories --#.block - .secondary-navigation - %ul.wat-cf - %li.first.active= link_to t("layout.repositories.list"), repositories_path - %li= link_to t("layout.repositories.new"), new_repository_path if can? :create, Platform # TODO repo without platform?? - .content - %h2.title - = t("layout.repositories.list_header") - .inner - = render :partial => 'shared/search_form' - = render :partial => 'list', :object => @repositories - .actions-bar.wat-cf - .actions - = will_paginate @repositories, :param_name => :repository_page diff --git a/app/views/repositories/projects_list.html.haml b/app/views/repositories/projects_list.html.haml deleted file mode 100644 index 2aa8f7170..000000000 --- a/app/views/repositories/projects_list.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -= render :partial => 'platforms/submenu' -= render :partial => 'platforms/sidebar' - -%h3= raw "#{t("layout.repositories.add_project_to")}: #{link_to @repository.name, platform_repository_path(@platform, @repository)}" - -= render :partial => 'proj_list', :object => @projects diff --git a/app/views/settings/notifiers/_form.html.haml b/app/views/settings/notifiers/_form.html.haml deleted file mode 100644 index 0aacc04da..000000000 --- a/app/views/settings/notifiers/_form.html.haml +++ /dev/null @@ -1,52 +0,0 @@ -.leftside.w25 - = f.check_box :can_notify -.leftside - = f.label :can_notify, t('activerecord.attributes.settings.notifier.can_notify') -.both -%h3= t("layout.settings.notifiers.code_header") -.leftside.w25 - = f.check_box :new_comment_commit_owner, :class => 'notify_cbx' -.leftside - = f.label :new_comment_commit_owner, t('activerecord.attributes.settings.notifier.new_comment_commit_owner') -.both -.leftside.w25 - = f.check_box :new_comment_commit_repo_owner, :class => 'notify_cbx' -.leftside - = f.label :new_comment_commit_repo_owner, t('activerecord.attributes.settings.notifier.new_comment_commit_repo_owner') -.both -.leftside.w25 - = f.check_box :new_comment_commit_commentor, :class => 'notify_cbx' -.leftside - = f.label :new_comment_commit_commentor, t('activerecord.attributes.settings.notifier.new_comment_commit_commentor') -.both -%h3= t("layout.settings.notifiers.tracker_header") -.leftside.w25 - = f.check_box :new_comment, :class => 'notify_cbx' -.leftside - = f.label :new_comment, t('activerecord.attributes.settings.notifier.new_comment') -.both -.leftside.w25 - = f.check_box :new_comment_reply, :class => 'notify_cbx' -.leftside - = f.label :new_comment_reply, t('activerecord.attributes.settings.notifier.new_comment_reply') -.both -.leftside.w25 - = f.check_box :new_issue, :class => 'notify_cbx' -.leftside - = f.label :new_issue, t('activerecord.attributes.settings.notifier.new_issue') -.both -.leftside.w25 - = f.check_box :issue_assign, :class => 'notify_cbx' -.leftside - = f.label :issue_assign, t('activerecord.attributes.settings.notifier.issue_assign') -.both - -%br -.leftside.w25 - \ -.leftside.w420 - = submit_tag t("layout.save") -.both - -:javascript - disableNotifierCbx($('#settings_notifier_can_notify')); diff --git a/app/views/settings/notifiers/show.html.haml b/app/views/settings/notifiers/show.html.haml deleted file mode 100644 index 6665aaa51..000000000 --- a/app/views/settings/notifiers/show.html.haml +++ /dev/null @@ -1,21 +0,0 @@ --set_meta_tags :title => t('layout.users.settings_notifier') -%p - = t("layout.settings.notifiers.notice_header", :email => @user.email) - %br - = link_to t("layout.settings.notifiers.change_email_link"), edit_user_path(@user) - %br - %br/ - -= form_for @notifier, :url => user_settings_notifier_path(@user), :html => { :class => :form } do |f| - = render :partial => "form", :locals => {:f => f} - -:javascript - $('article .right').addClass('bigpadding'); - -- content_for :sidebar, render('users/sidebar') - --##block-signup.block --# %h2= title t("layout.settings.notifiers.edit_header") --# .content --# = form_for @notifier, :url => user_settings_notifier_path(@user), :html => { :class => :form } do |f| --# = render :partial => "form", :locals => {:f => f} diff --git a/app/views/users/_filter.html.haml b/app/views/users/_filter.html.haml deleted file mode 100644 index eb1ebd9e2..000000000 --- a/app/views/users/_filter.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -%h2.title= t("layout.users.filter_header") - -= form_for :filter, :url => @action_url, :html => { :method => :get, :class => :form } do |f| - .columns.wat-cf - .column.left - .group - = f.label :status, t("activerecord.attributes.users.email"), :class => :label - = f.text_field :email, :class => :text_field, :value => @email - - .group.navform.wat-cf - %button.button{ :type => "submit" } - = image_tag("choose.png", :alt => "Save") - = t("layout.search.header") - diff --git a/app/views/users/_form.html.haml b/app/views/users/_form.html.haml deleted file mode 100644 index 39fa3ffd8..000000000 --- a/app/views/users/_form.html.haml +++ /dev/null @@ -1,73 +0,0 @@ -- if current_user.admin? - .leftlist - = f.label :role, t("activerecord.attributes.user.role"), :class => :label - .rightlist - = f.select :role, User::ROLES, {}, {:name => 'role'} - - if @user.new_record? - .leftlist - = f.label :uname, t("activerecord.attributes.user.uname") - .rightlist - = f.text_field :uname - .leftlist - = f.label :password, t("activerecord.attributes.user.password") - .rightlist - = f.password_field :password - .both - .leftlist - = f.label :password_confirmation, t("activerecord.attributes.user.password_confirm") - .rightlist - = f.password_field :password_confirmation - .both -.leftlist - = f.label :name, t("activerecord.attributes.user.name") -.rightlist - = f.text_field :name -.both -.leftlist - = f.label :email, t("activerecord.attributes.user.email") -.rightlist - = f.text_field :email -.both -.leftlist - = f.label :site, t("activerecord.attributes.user.site") -.rightlist - = f.text_field :site -.both -.leftlist - = f.label :language, t("activerecord.attributes.user.language") -.rightlist - = f.select :language, User::LANGUAGES_FOR_SELECT -.both -.leftlist - = f.label :company, t("activerecord.attributes.user.company") -.rightlist - = f.text_field :company -.both -.leftlist - = f.label :location, t("activerecord.attributes.user.location") -.rightlist - = f.text_field :location -.both -.leftlist - = f.label :avatar, t("layout.users.avatar_with_size", :max => number_to_human_size(User::MAX_AVATAR_SIZE)) -.rightlist - = image_tag(avatar_url(@user, :medium)) -.leftlist -.rightlist - .check - %span#niceCheckbox1.niceCheck-main - = check_box_tag "delete_avatar", 1, false, :class => 'niceCheckbox1' - .forcheck= t('layout.users.delete_avatar') - .both - = f.file_field :avatar -.both -.leftlist - = f.label :professional_experience, t("activerecord.attributes.user.professional_experience") -.rightlist - = f.text_area :professional_experience -.both -.leftlist - \ -.rightlist - = submit_tag t("layout.save") -.both diff --git a/app/views/users/_sidebar.html.haml b/app/views/users/_sidebar.html.haml deleted file mode 100644 index 9b8259f79..000000000 --- a/app/views/users/_sidebar.html.haml +++ /dev/null @@ -1,15 +0,0 @@ -- act = action_name.to_sym -- contr = controller_name.to_sym - -%aside - .admin-preferences - %ul - - if can? :edit, @user - %li{:class => (act == :profile && :users == contr) ? 'active' : ''} - = link_to t("layout.users.profile"), @user == current_user ? edit_profile_path : edit_user_path(@user) - - if can? :private, @user - %li{:class => (act == :private && contr == :users) ? 'active' : ''} - = link_to t("layout.users.user_private_settings"), user_private_settings_path(@user) - - if can? :show, @user.notifier - %li{:class => (act == :show && contr == :notifiers) ? 'active' : ''} - = link_to t("layout.users.settings_notifier"), user_settings_notifier_path(@user) diff --git a/app/views/users/base/_form.html.haml b/app/views/users/base/_form.html.haml new file mode 100644 index 000000000..d88807a92 --- /dev/null +++ b/app/views/users/base/_form.html.haml @@ -0,0 +1,47 @@ +- if current_user.admin? + .leftlist= f.label :role, t("activerecord.attributes.user.role"), :class => :label + .rightlist= f.select :role, User::ROLES, {}, {:name => 'role'} + - if @user.new_record? + .leftlist= f.label :uname, t("activerecord.attributes.user.uname") + .rightlist= f.text_field :uname + .leftlist= f.label :password, t("activerecord.attributes.user.password") + .rightlist= f.password_field :password + .both + .leftlist= f.label :password_confirmation, t("activerecord.attributes.user.password_confirm") + .rightlist= f.password_field :password_confirmation + .both +.leftlist= f.label :name, t("activerecord.attributes.user.name") +.rightlist= f.text_field :name +.both +.leftlist= f.label :email, t("activerecord.attributes.user.email") +.rightlist= f.text_field :email +.both +.leftlist= f.label :site, t("activerecord.attributes.user.site") +.rightlist= f.text_field :site +.both +.leftlist= f.label :language, t("activerecord.attributes.user.language") +.rightlist= f.select :language, User::LANGUAGES_FOR_SELECT +.both +.leftlist= f.label :company, t("activerecord.attributes.user.company") +.rightlist= f.text_field :company +.both +.leftlist= f.label :location, t("activerecord.attributes.user.location") +.rightlist= f.text_field :location +.both +.leftlist= f.label :avatar, t("layout.users.avatar_with_size", :max => number_to_human_size(User::MAX_AVATAR_SIZE)) +.rightlist= image_tag(avatar_url(@user, :medium)) +.leftlist +.rightlist + .check + %span#niceCheckbox1.niceCheck-main= check_box_tag "delete_avatar", 1, false, :class => 'niceCheckbox1' + .forcheck= t('layout.users.delete_avatar') + .both + = f.file_field :avatar +.both +.leftlist= f.label :professional_experience, t("activerecord.attributes.user.professional_experience") +.rightlist= f.text_area :professional_experience +.both +.leftlist + \ +.rightlist= submit_tag t("layout.save") +.both diff --git a/app/views/users/base/_sidebar.html.haml b/app/views/users/base/_sidebar.html.haml new file mode 100644 index 000000000..6c387a487 --- /dev/null +++ b/app/views/users/base/_sidebar.html.haml @@ -0,0 +1,6 @@ +%aside + .admin-preferences + %ul + %li{:class => action_name == 'profile' ? 'active' : nil}= link_to t("layout.users.profile"), profile_settings_path + %li{:class => action_name == 'private' ? 'active' : nil}= link_to t("layout.users.user_private_settings"), private_settings_path + %li{:class => action_name == 'notifiers' ? 'active' : nil}= link_to t("layout.users.settings_notifier"), notifiers_settings_path \ No newline at end of file diff --git a/app/views/users/private.html.haml b/app/views/users/private.html.haml deleted file mode 100644 index c9f76eec9..000000000 --- a/app/views/users/private.html.haml +++ /dev/null @@ -1,29 +0,0 @@ --set_meta_tags :title => t('layout.users.settings') -%h3.fix.bpadding10= t('layout.users.private_settings_header') - -= form_for(@user, :url => user_private_settings_path(@user), :html => { :method => :put, :class => "form" }) do |f| - .leftlist - = f.label :current_password - .rightlist - = f.password_field :current_password - .both - .leftlist - = f.label :password - .rightlist - = f.password_field :password - .both - .leftlist - = f.label :password_confirmation - .rightlist - = f.password_field :password_confirmation - .both - .leftlist - \ - .rightlist - = submit_tag t('layout.save') - .both - -:javascript - $('article .right').addClass('middlepadding'); - -- content_for :sidebar, render('users/sidebar') diff --git a/app/views/users/show.html.haml b/app/views/users/profile/show.html.haml similarity index 78% rename from app/views/users/show.html.haml rename to app/views/users/profile/show.html.haml index e5516d657..bc6167a0c 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/profile/show.html.haml @@ -1,12 +1,12 @@ .left = image_tag avatar_url(@user, :big) %br - = link_to t("layout.users.settings"), current_user == @user ? edit_profile_path : edit_user_path(@user), :class => 'button width81' if can? :edit, @user + = link_to t("layout.users.settings"), current_user == @user ? profile_settings_path : edit_admin_user_path(@user), :class => 'button width81' if can? :edit, @user .left %h3= title @user.uname = @user.name %br - = link_to @user.email, "mailto:#{ @user.email }" + = link_to @user.email, "mailto:#{@user.email}" %br %h4= t("activerecord.attributes.user.professional_experience") + ":" %p= @user.professional_experience diff --git a/app/views/register_requests/new.html.haml b/app/views/users/register_requests/new.html.haml similarity index 51% rename from app/views/register_requests/new.html.haml rename to app/views/users/register_requests/new.html.haml index 5ff201c35..d69448ed3 100644 --- a/app/views/register_requests/new.html.haml +++ b/app/views/users/register_requests/new.html.haml @@ -8,17 +8,12 @@ %p= value - form_for(@register_request, :html => { :class => "form login" }) do |f| .group.wat-cf - .left - = f.label :name, :class => "label right" - .right - = f.text_field :name, :class => "text_field" + .left= f.label :name, :class => "label right" + .right= f.text_field :name, :class => "text_field" .group.wat-cf - .left - = f.label :email, :class => "label right" - .right - = f.text_field :email, :class => "text_field" + .left= f.label :email, :class => "label right" + .right= f.text_field :email, :class => "text_field" .group.navform.wat-cf .right - %button.button{ :type => "submit" } - = t("layout.register_request.get_token_button") - %span.text_button_padding + %button.button{:type => "submit"}= t("layout.register_request.get_token_button") + %span.text_button_padding \ No newline at end of file diff --git a/app/views/users/settings/notifiers.html.haml b/app/views/users/settings/notifiers.html.haml new file mode 100644 index 000000000..2d206c2aa --- /dev/null +++ b/app/views/users/settings/notifiers.html.haml @@ -0,0 +1,47 @@ +-set_meta_tags :title => t('layout.users.settings_notifier') +%p + = t("layout.settings.notifiers.notice_header", :email => @user.email) + %br + = link_to t("layout.settings.notifiers.change_email_link"), profile_settings_path + %br + %br + += form_for @user.notifier, :url => notifiers_settings_path, :html => {:class => :form} do |f| + .leftside.w25= f.check_box :can_notify + .leftside= f.label :can_notify, t('activerecord.attributes.settings.notifier.can_notify') + .both + %h3= t("layout.settings.notifiers.code_header") + .leftside.w25= f.check_box :new_comment_commit_owner, :class => 'notify_cbx' + .leftside= f.label :new_comment_commit_owner, t('activerecord.attributes.settings.notifier.new_comment_commit_owner') + .both + .leftside.w25= f.check_box :new_comment_commit_repo_owner, :class => 'notify_cbx' + .leftside= f.label :new_comment_commit_repo_owner, t('activerecord.attributes.settings.notifier.new_comment_commit_repo_owner') + .both + .leftside.w25= f.check_box :new_comment_commit_commentor, :class => 'notify_cbx' + .leftside= f.label :new_comment_commit_commentor, t('activerecord.attributes.settings.notifier.new_comment_commit_commentor') + .both + %h3= t("layout.settings.notifiers.tracker_header") + .leftside.w25= f.check_box :new_comment, :class => 'notify_cbx' + .leftside= f.label :new_comment, t('activerecord.attributes.settings.notifier.new_comment') + .both + .leftside.w25= f.check_box :new_comment_reply, :class => 'notify_cbx' + .leftside= f.label :new_comment_reply, t('activerecord.attributes.settings.notifier.new_comment_reply') + .both + .leftside.w25= f.check_box :new_issue, :class => 'notify_cbx' + .leftside= f.label :new_issue, t('activerecord.attributes.settings.notifier.new_issue') + .both + .leftside.w25= f.check_box :issue_assign, :class => 'notify_cbx' + .leftside= f.label :issue_assign, t('activerecord.attributes.settings.notifier.issue_assign') + .both + + %br + .leftside.w25 + \ + .leftside.w420= submit_tag t("layout.save") + .both + +:javascript + disableNotifierCbx($('#settings_notifier_can_notify')); + $('article .right').addClass('bigpadding'); + +- content_for :sidebar, render('sidebar') diff --git a/app/views/users/settings/private.html.haml b/app/views/users/settings/private.html.haml new file mode 100644 index 000000000..3553c4d44 --- /dev/null +++ b/app/views/users/settings/private.html.haml @@ -0,0 +1,22 @@ +-set_meta_tags :title => t('layout.users.settings') +%h3.fix.bpadding10= t('layout.users.private_settings_header') + += form_for @user, :url => private_settings_path, :html => {:class => :form} do |f| + .leftlist= f.label :current_password + .rightlist= f.password_field :current_password + .both + .leftlist= f.label :password + .rightlist= f.password_field :password + .both + .leftlist= f.label :password_confirmation + .rightlist= f.password_field :password_confirmation + .both + .leftlist + \ + .rightlist= submit_tag t('layout.save') + .both + +:javascript + $('article .right').addClass('middlepadding'); + +- content_for :sidebar, render('sidebar') diff --git a/app/views/users/profile.html.haml b/app/views/users/settings/profile.html.haml similarity index 66% rename from app/views/users/profile.html.haml rename to app/views/users/settings/profile.html.haml index f77da522c..bcf053457 100644 --- a/app/views/users/profile.html.haml +++ b/app/views/users/settings/profile.html.haml @@ -1,8 +1,8 @@ -set_meta_tags :title => t('.title') %h3.fix.bpadding10= @user.uname -= form_for @user, :url => user_path(@user), :html => { :class => :form } do |f| - = render :partial => "users/form", :locals => {:f => f} += form_for @user, :url => profile_settings_path, :html => {:class => :form} do |f| + = render 'form', :f => f .notify %p= t('layout.users.public_data_edit_warning') diff --git a/config/locales/menu.en.yml b/config/locales/menu.en.yml index f3bae9b88..6af41623b 100644 --- a/config/locales/menu.en.yml +++ b/config/locales/menu.en.yml @@ -37,4 +37,3 @@ en: users: Users register_requests: Invites event_logs: Event log - diff --git a/config/routes.rb b/config/routes.rb index 8e3d04137..4baca4e70 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,111 +1,118 @@ # -*- encoding : utf-8 -*- Rosa::Application.routes.draw do - devise_scope :user do + devise_scope :users do get '/users/auth/:provider' => 'users/omniauth_callbacks#passthru' - get '/user' => 'users#profile', :as => :edit_profile - put '/user' => 'users#update', :as => :update_profile - get '/users' => 'admin/users#index', :as => :users - get '/users/new' => 'admin/users#new', :as => :new_user - get '/users/list' => 'admin/users#list', :as => :users_list - post '/users/create' => 'admin/users#create', :as => :create_user - constraints :id => /\d+/ do - get '/users/:id/edit' => 'admin/users#profile', :as => :edit_user - put '/users/:id/edit' => 'admin/users#update', :as => :update_user - delete '/users/:id/delete' => 'admin/users#destroy', :as => :delete_user - end end devise_for :users, :controllers => {:omniauth_callbacks => 'users/omniauth_callbacks'} - resources :users, :only => [:show, :profile, :update] do - collection do - resources :register_requests, :only => [:index, :new, :create, :show_message, :approve, :reject] do - get :show_message, :on => :collection - put :update, :on => :collection - get :approve - get :reject - end - get :autocomplete_user_uname - end - namespace :settings do - resource :notifier, :only => [:show, :update] - end - end - get 'users/:id/settings/private' => 'users#private', :as => :user_private_settings - put 'users/:id/settings/private' => 'users#private' - - resources :groups do - get :autocomplete_group_uname, :on => :collection - resources :members, :only => [:index, :edit, :update, :add] do - collection do - get :edit - post :add - post :update - delete :remove - end - member do - post :update - delete :remove - end - end - end - - resources :platforms do - resources :private_users, :except => [:show, :destroy, :update] - member do - get :clone - get :members - post :remove_members - delete :remove_member - post :add_member - post :make_clone - post :build_all - end - collection do - get :autocomplete_user_uname - end - resources :repositories do - member do - get :add_project - delete :remove_project - get :projects_list - end - end - resources :products do - resources :product_build_lists, :only => [:create, :destroy] - end - end - match '/private/:platform_name/*file_path' => 'privates#show' - - # Core callbacks - match 'build_lists/publish_build', :to => "build_lists#publish_build" - match 'build_lists/status_build', :to => "build_lists#status_build" - match 'build_lists/post_build', :to => "build_lists#post_build" - match 'build_lists/pre_build', :to => "build_lists#pre_build" - match 'build_lists/circle_build', :to => "build_lists#circle_build" - match 'build_lists/new_bbdt', :to => "build_lists#new_bbdt" - match 'product_status', :to => 'product_build_lists#status_build' - - resources :build_lists, :only => [:index, :show] do - member do - put :cancel - put :publish - put :reject_publish - end - collection { post :search } - end - resources :product_build_lists, :only => [:index] resources :search, :only => [:index] - resources :event_logs, :only => :index - get '/forbidden' => 'pages#forbidden', :as => 'forbidden' get '/terms-of-service' => 'pages#tos', :as => 'tos' - resources :projects, :only => [:index, :new, :create] - scope ':owner_name' do # Owner - # TODO User routes here + scope :module => 'platforms' do + resources :platforms do + resources :private_users, :except => [:show, :destroy, :update] + member do + get :clone + get :members + post :remove_members + delete :remove_member + post :add_member + post :make_clone + post :build_all + end + get :autocomplete_user_uname, :on => :collection + resources :repositories do + member do + get :add_project + delete :remove_project + get :projects_list + end + end + resources :products do + resources :product_build_lists, :only => [:create, :destroy] + end + end + match '/private/:platform_name/*file_path' => 'privates#show' - scope ':project_name', :as => 'project' do + resources :product_build_lists, :only => [:index] + end + + namespace :admin do + resources :users do + get :list, :on => :collection + end + resources :register_requests, :only => [:index] do + put :update, :on => :collection + member do + get :approve + get :reject + end + end + resources :event_logs, :only => :index + end + + scope :module => 'users' do + resources :settings, :only => [] do + collection do + get :profile + put :profile + get :private + put :private + get :notifiers + put :notifiers + end + end + resources :users, :controller => 'profile', :only => [] do + get :autocomplete_user_uname, :on => :collection + end + resources :register_requests, :only => [:new, :create] + end + + scope :module => 'groups' do + resources :groups, :controller => 'profile' do + get :autocomplete_group_uname, :on => :collection + delete :remove_user, :on => :member + resources :members, :only => [:index] do + collection do + post :add + post :update + delete :remove + end + end + end + end + + scope :module => 'projects' do + # Core callbacks + match 'build_lists/publish_build', :to => "build_lists#publish_build" + match 'build_lists/status_build', :to => "build_lists#status_build" + match 'build_lists/post_build', :to => "build_lists#post_build" + match 'build_lists/pre_build', :to => "build_lists#pre_build" + match 'build_lists/circle_build', :to => "build_lists#circle_build" + match 'build_lists/new_bbdt', :to => "build_lists#new_bbdt" + match 'product_status', :to => 'product_build_lists#status_build' + + resources :build_lists, :only => [:index, :show] do + member do + put :cancel + put :publish + put :reject_publish + end + collection { post :search } + end + + resources :projects, :only => [:index, :new, :create] + end + scope ':owner_name' do # Owner + constraints OwnerConstraint.new(User) do + get '/' => 'users/profile#show', :as => :user + end + constraints OwnerConstraint.new(Group) do + get '/' => 'groups/profile#show', :as => :group_profile + end + scope ':project_name', :as => 'project', :module => 'projects' do resources :wiki do collection do match '_history' => 'wiki#wiki_history', :as => :history, :via => :get @@ -146,7 +153,7 @@ Rosa::Application.routes.draw do get :find, :on => :collection end end - scope ':project_name' do + scope ':project_name', :module => 'projects' do # Resource get '/edit' => 'projects#edit', :as => :edit_project put '/' => 'projects#update' @@ -158,7 +165,7 @@ Rosa::Application.routes.draw do delete '/remove_user' => 'projects#remove_user', :as => :remove_user_project # Tree get '/' => "git/trees#show", :as => :project - get '/tree/:treeish(/*path)' => "git/trees#show", :defaults => {:treeish => :master}, :as => :tree + get '/tree/:treeish(/*path)' => "git/trees#show", :defaults => {:treeish => :master}, :as => :tree, :format => false # Commits get '/commits/:treeish(/*path)' => "git/commits#index", :defaults => {:treeish => :master}, :as => :commits, :format => false get '/commit/:id(.:format)' => "git/commits#show", :as => :commit diff --git a/lib/ext/rails/owner_constraint.rb b/lib/ext/rails/owner_constraint.rb index 82062b98f..921df1b4b 100644 --- a/lib/ext/rails/owner_constraint.rb +++ b/lib/ext/rails/owner_constraint.rb @@ -5,6 +5,6 @@ class OwnerConstraint end def matches?(request) - !!@class_name.find_by_uname(request.params[:owner_name]) + !!(@class_name.find_by_uname(request.params[:owner_name]) || @class_name.by_uname(request.params[:owner_name]).first) end end diff --git a/lib/ext/rails/reserved_name_validator.rb b/lib/ext/rails/reserved_name_validator.rb index 9e4171c66..d53b045d8 100644 --- a/lib/ext/rails/reserved_name_validator.rb +++ b/lib/ext/rails/reserved_name_validator.rb @@ -1,6 +1,6 @@ class ReservedNameValidator < ActiveModel::EachValidator RESERVED_NAMES = %w{ - about account add admin administrator api + about account add admin administrator api autocomplete_group_uname app apps archive archives auth blog config connect contact create commit commits @@ -12,6 +12,7 @@ class ReservedNameValidator < ActiveModel::EachValidator jobs login log-in log_in logout log-out log_out logs map maps + new oauth oauth_clients openid privacy register remove replies rss root @@ -30,7 +31,7 @@ class ReservedNameValidator < ActiveModel::EachValidator end def validate_each(record, attribute, value) - if reserved_names.include?(value.downcase) + if reserved_names.include?(value.to_s.downcase) record.errors.add(attribute, :exclusion, options.merge(:value => value)) end end diff --git a/lib/modules/controllers/find_project.rb b/lib/modules/controllers/find_project.rb deleted file mode 100644 index 3f2c7559d..000000000 --- a/lib/modules/controllers/find_project.rb +++ /dev/null @@ -1,21 +0,0 @@ -# -*- encoding : utf-8 -*- -module Modules - module Controllers - module FindProject - extend ActiveSupport::Concern - - included do - prepend_before_filter :find_project - end - - 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 - - module ClassMethods - end - end - end -end diff --git a/lib/modules/models/acts_like_member.rb b/lib/modules/models/acts_like_member.rb index 3685685ec..44af7f18e 100644 --- a/lib/modules/models/acts_like_member.rb +++ b/lib/modules/models/acts_like_member.rb @@ -4,28 +4,34 @@ module Modules module ActsLikeMember extend ActiveSupport::Concern - included do |klass| - scope :not_member_of, lambda { |item| + included do + scope :not_member_of, lambda {|item| where(" - #{klass.table_name}.id NOT IN ( + #{table_name}.id NOT IN ( SELECT relations.actor_id FROM relations WHERE ( - relations.actor_type = '#{klass.to_s}' + relations.actor_type = '#{self.to_s}' AND relations.target_type = '#{item.class.to_s}' AND relations.target_id = #{item.id} ) ) ") } - scope :search_order, order("CHAR_LENGTH(uname) ASC") - scope :without, lambda {|a| where("#{klass.table_name}.id NOT IN (?)", a)} - scope :search, lambda {|q| where("#{klass.table_name}.uname ILIKE ?", "%#{q.to_s.strip}%")} + scope :without, lambda {|a| where("#{table_name}.id NOT IN (?)", a)} + scope :by_uname, lambda {|n| where("#{table_name}.uname ILIKE ?", n)} + scope :search, lambda {|q| by_uname("%#{q.to_s.strip}%")} + end + def to_param + uname end module ClassMethods + def find_by_owner_name!(uname) + by_uname(uname).first! + end end end end diff --git a/public/invite.html b/public/invite.html index 4feb0c004..cf0af6f33 100644 --- a/public/invite.html +++ b/public/invite.html @@ -40,7 +40,7 @@