diff options
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/admin/mailer_controller.rb | 6 | ||||
-rw-r--r-- | app/controllers/admin/users_controller.rb | 6 | ||||
-rw-r--r-- | app/controllers/application_controller.rb | 6 | ||||
-rw-r--r-- | app/controllers/issues_controller.rb | 9 | ||||
-rw-r--r-- | app/controllers/keys_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/notes_controller.rb | 11 | ||||
-rw-r--r-- | app/controllers/profile_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/projects_controller.rb | 24 | ||||
-rw-r--r-- | app/controllers/snippets_controller.rb | 6 | ||||
-rw-r--r-- | app/controllers/team_members_controller.rb | 8 |
10 files changed, 39 insertions, 41 deletions
diff --git a/app/controllers/admin/mailer_controller.rb b/app/controllers/admin/mailer_controller.rb index 05ad267fad5..d2fbbcd4968 100644 --- a/app/controllers/admin/mailer_controller.rb +++ b/app/controllers/admin/mailer_controller.rb @@ -20,7 +20,7 @@ class Admin::MailerController < ApplicationController else render :file => 'notify/note_wall_email.html.haml', :layout => 'notify' end - rescue + rescue render :text => "Preview not avaialble" end @@ -29,7 +29,7 @@ class Admin::MailerController < ApplicationController @password = "DHasJKDHAS!" render :file => 'notify/new_user_email.html.haml', :layout => 'notify' - rescue + rescue render :text => "Preview not avaialble" end @@ -38,7 +38,7 @@ class Admin::MailerController < ApplicationController @user = @issue.assignee @project = @issue.project render :file => 'notify/new_issue_email.html.haml', :layout => 'notify' - rescue + rescue render :text => "Preview not avaialble" end end diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index e9ad1e55983..f60330f73ca 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -36,7 +36,7 @@ class Admin::UsersController < ApplicationController def create admin = params[:user].delete("admin") - @admin_user = User.new(params[:user]) + @admin_user = User.new(params[:user]) @admin_user.admin = (admin && admin.to_i > 0) respond_to do |format| @@ -54,8 +54,8 @@ class Admin::UsersController < ApplicationController def update admin = params[:user].delete("admin") if params[:user][:password].empty? - params[:user].delete(:password) - params[:user].delete(:password_confirmation) + params[:user].delete(:password) + params[:user].delete(:password_confirmation) end @admin_user = User.find(params[:id]) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 047c6cb7d95..816c4c55b8b 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -8,7 +8,7 @@ class ApplicationController < ActionController::Base render :file => File.join(Rails.root, "public", "gitosis_error"), :layout => false end - protected + protected def abilities @abilities ||= Six.new @@ -18,7 +18,7 @@ class ApplicationController < ActionController::Base abilities.allowed?(object, action, subject) end - def project + def project @project ||= Project.find_by_code(params[:project_id]) end @@ -55,7 +55,7 @@ class ApplicationController < ActionController::Base @tag = unless params[:tag].blank? params[:tag] - else + else nil end diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 757ada94767..56d711dbca1 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -1,12 +1,12 @@ class IssuesController < ApplicationController before_filter :authenticate_user! - before_filter :project + before_filter :project before_filter :issue, :only => [:edit, :update, :destroy, :show] # Authorize before_filter :add_project_abilities before_filter :authorize_read_issue! - before_filter :authorize_write_issue!, :only => [:new, :create, :close, :edit, :update, :sort] + before_filter :authorize_write_issue!, :only => [:new, :create, :close, :edit, :update, :sort] respond_to :js @@ -57,14 +57,13 @@ class IssuesController < ApplicationController end end - def destroy return access_denied! unless can?(current_user, :admin_issue, @issue) @issue.destroy respond_to do |format| - format.js { render :nothing => true } + format.js { render :nothing => true } end end @@ -78,7 +77,7 @@ class IssuesController < ApplicationController render :nothing => true end - protected + protected def issue @issue ||= @project.issues.find(params[:id]) diff --git a/app/controllers/keys_controller.rb b/app/controllers/keys_controller.rb index b0249375b85..d3c93b5fff6 100644 --- a/app/controllers/keys_controller.rb +++ b/app/controllers/keys_controller.rb @@ -24,7 +24,7 @@ class KeysController < ApplicationController respond_to do |format| format.html { redirect_to keys_url } - format.js { render :nothing => true } + format.js { render :nothing => true } end end end diff --git a/app/controllers/notes_controller.rb b/app/controllers/notes_controller.rb index 46425664d6e..ad9531e077c 100644 --- a/app/controllers/notes_controller.rb +++ b/app/controllers/notes_controller.rb @@ -1,9 +1,9 @@ class NotesController < ApplicationController - before_filter :project + before_filter :project # Authorize before_filter :add_project_abilities - before_filter :authorize_write_note!, :only => [:create] + before_filter :authorize_write_note!, :only => [:create] respond_to :js @@ -15,10 +15,9 @@ class NotesController < ApplicationController notify if params[:notify] == '1' end - respond_to do |format| format.html {redirect_to :back} - format.js + format.js end end @@ -30,11 +29,11 @@ class NotesController < ApplicationController @note.destroy respond_to do |format| - format.js { render :nothing => true } + format.js { render :nothing => true } end end - protected + protected def notify @project.users.reject { |u| u.id == current_user.id } .each do |u| diff --git a/app/controllers/profile_controller.rb b/app/controllers/profile_controller.rb index c8477729a92..a0078f0e0a3 100644 --- a/app/controllers/profile_controller.rb +++ b/app/controllers/profile_controller.rb @@ -14,7 +14,7 @@ class ProfileController < ApplicationController end def password_update - params[:user].reject!{ |k, v| k != "password" && k != "password_confirmation"} + params[:user].reject!{ |k, v| k != "password" && k != "password_confirmation"} @user = current_user if @user.update_attributes(params[:user]) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 54d19af7511..481e02fd231 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -1,10 +1,10 @@ class ProjectsController < ApplicationController - before_filter :project, :except => [:index, :new, :create] + before_filter :project, :except => [:index, :new, :create] # Authorize before_filter :add_project_abilities - before_filter :authorize_read_project!, :except => [:index, :new, :create] - before_filter :authorize_admin_project!, :only => [:edit, :update, :destroy] + before_filter :authorize_read_project!, :except => [:index, :new, :create] + before_filter :authorize_admin_project!, :only => [:edit, :update, :destroy] before_filter :require_non_empty_project, :only => [:blob, :tree] @@ -23,7 +23,7 @@ class ProjectsController < ApplicationController @project = Project.new(params[:project]) @project.owner = current_user - Project.transaction do + Project.transaction do @project.save! @project.users_projects.create!(:admin => true, :read => true, :write => true, :user => current_user) end @@ -31,7 +31,7 @@ class ProjectsController < ApplicationController respond_to do |format| if @project.valid? format.html { redirect_to @project, notice: 'Project was successfully created.' } - format.js + format.js else format.html { render action: "new" } format.js @@ -51,10 +51,10 @@ class ProjectsController < ApplicationController respond_to do |format| if project.update_attributes(params[:project]) format.html { redirect_to project, :notice => 'Project was successfully updated.' } - format.js + format.js else format.html { render action: "edit" } - format.js + format.js end end end @@ -105,7 +105,7 @@ class ProjectsController < ApplicationController if params[:commit_id] @commit = @repo.commits(params[:commit_id]).first - else + else @commit = @repo.commits(@ref || "master").first end @@ -114,7 +114,7 @@ class ProjectsController < ApplicationController respond_to do |format| format.html # show.html.erb - format.js do + format.js do # diasbale cache to allow back button works response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate" response.headers["Pragma"] = "no-cache" @@ -132,7 +132,7 @@ class ProjectsController < ApplicationController if @tree.is_a?(Grit::Blob) send_data(@tree.data, :type => @tree.mime_type, :disposition => 'inline', :filename => @tree.name) - else + else head(404) end rescue @@ -147,9 +147,9 @@ class ProjectsController < ApplicationController end end - protected + protected - def project + def project @project ||= Project.find_by_code(params[:id]) end end diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb index b31fe6836a2..d9a6ab2a1b3 100644 --- a/app/controllers/snippets_controller.rb +++ b/app/controllers/snippets_controller.rb @@ -1,11 +1,11 @@ class SnippetsController < ApplicationController before_filter :authenticate_user! - before_filter :project + before_filter :project # Authorize before_filter :add_project_abilities before_filter :authorize_read_snippet! - before_filter :authorize_write_snippet!, :only => [:new, :create, :close, :edit, :update, :sort] + before_filter :authorize_write_snippet!, :only => [:new, :create, :close, :edit, :update, :sort] respond_to :html @@ -13,7 +13,7 @@ class SnippetsController < ApplicationController @snippets = @project.snippets end - def new + def new @snippet = @project.snippets.new end diff --git a/app/controllers/team_members_controller.rb b/app/controllers/team_members_controller.rb index 84addf8d7bb..48e7e9b9c4a 100644 --- a/app/controllers/team_members_controller.rb +++ b/app/controllers/team_members_controller.rb @@ -1,10 +1,10 @@ class TeamMembersController < ApplicationController - before_filter :project + before_filter :project # Authorize before_filter :add_project_abilities before_filter :authorize_read_project! - before_filter :authorize_admin_project!, :only => [:new, :create, :destroy, :update] + before_filter :authorize_admin_project!, :only => [:new, :create, :destroy, :update] def show @team_member = project.users_projects.find(params[:id]) @@ -26,7 +26,7 @@ class TeamMembersController < ApplicationController respond_to do |format| format.js - format.html do + format.html do unless @team_member.valid? flash[:alert] = "User should have at least one role" end @@ -41,7 +41,7 @@ class TeamMembersController < ApplicationController respond_to do |format| format.html { redirect_to root_path } - format.js { render :nothing => true } + format.js { render :nothing => true } end end end |