1.0.2
This commit is contained in:
parent
7b5799a979
commit
ef2bf15204
28 changed files with 104 additions and 37 deletions
|
@ -61,4 +61,8 @@ class ApplicationController < ActionController::Base
|
|||
def render_404
|
||||
render :file => File.join(Rails.root, "public", "404"), :layout => false, :status => "404"
|
||||
end
|
||||
|
||||
def require_non_empty_project
|
||||
redirect_to @project unless @project.repo_exists?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,6 +6,7 @@ class CommitsController < ApplicationController
|
|||
# Authorize
|
||||
before_filter :add_project_abilities
|
||||
before_filter :authorize_read_project!
|
||||
before_filter :require_non_empty_project
|
||||
|
||||
def index
|
||||
load_refs # load @branch, @tag & @ref
|
||||
|
|
|
@ -5,7 +5,7 @@ class IssuesController < ApplicationController
|
|||
# Authorize
|
||||
before_filter :add_project_abilities
|
||||
before_filter :authorize_read_issue!
|
||||
before_filter :authorize_write_issue!, :only => [:new, :create, :close, :edit, :update]
|
||||
before_filter :authorize_write_issue!, :only => [:new, :create, :close, :edit, :update, :sort]
|
||||
before_filter :authorize_admin_issue!, :only => [:destroy]
|
||||
|
||||
respond_to :js
|
||||
|
@ -69,4 +69,14 @@ class IssuesController < ApplicationController
|
|||
format.js { render :nothing => true }
|
||||
end
|
||||
end
|
||||
|
||||
def sort
|
||||
@issues = @project.issues.where(:id => params['issue'])
|
||||
@issues.each do |issue|
|
||||
issue.position = params['issue'].index(issue.id.to_s) + 1
|
||||
issue.save
|
||||
end
|
||||
|
||||
render :nothing => true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,6 +6,8 @@ class ProjectsController < ApplicationController
|
|||
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]
|
||||
|
||||
def index
|
||||
@projects = current_user.projects.all
|
||||
end
|
||||
|
@ -48,7 +50,7 @@ class ProjectsController < ApplicationController
|
|||
def update
|
||||
respond_to do |format|
|
||||
if project.update_attributes(params[:project])
|
||||
format.html { redirect_to project, notice: 'Project was successfully updated.' }
|
||||
format.html { redirect_to project, :notice => 'Project was successfully updated.' }
|
||||
format.js
|
||||
else
|
||||
format.html { render action: "edit" }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue