Merge branch '3.2-master' of github.com:warpc/rosa-build into 3.2-master

This commit is contained in:
Pavel Chipiga 2012-03-03 01:43:14 +02:00
commit a831a4aa63
6 changed files with 10 additions and 17 deletions

View File

@ -76,7 +76,8 @@ function changeRadioStart(el) {
} }
el.next().bind("mousedown", function(e) { el.next().bind("mousedown", function(e) {
changeRadio($(this)) changeRadio($(this));
$(this).find("input:radio").change();
}); });
if($.browser.msie) { if($.browser.msie) {
el.next().find("input").eq(0).bind("click", function(e) { el.next().find("input").eq(0).bind("click", function(e) {

View File

@ -3,15 +3,13 @@ class IssuesController < ApplicationController
NON_RESTFUL_ACTION = [:create_label, :update_label, :destroy_label, :search_collaborators] NON_RESTFUL_ACTION = [:create_label, :update_label, :destroy_label, :search_collaborators]
before_filter :authenticate_user! before_filter :authenticate_user!
load_and_authorize_resource :project, :except => NON_RESTFUL_ACTION load_resource :project
load_and_authorize_resource :issue, :through => :project, :find_by => :serial_id, :only => [:show, :edit, :update, :destroy] load_and_authorize_resource :issue, :through => :project, :find_by => :serial_id, :only => [:show, :edit, :update, :destroy, :new, :create]
before_filter :load_and_authorize_label, :only => NON_RESTFUL_ACTION before_filter :load_and_authorize_label, :only => NON_RESTFUL_ACTION
layout 'application' layout 'application'
def index(status = 200) def index(status = 200)
logger.debug "!!!!!!!!!!!!!!!!!!"
logger.debug "request format is #{request.format}"
@is_assigned_to_me = params[:filter] == 'to_me' @is_assigned_to_me = params[:filter] == 'to_me'
@status = params[:status] == 'closed' ? 'closed' : 'open' @status = params[:status] == 'closed' ? 'closed' : 'open'
@labels = params[:labels] || [] @labels = params[:labels] || []
@ -36,17 +34,16 @@ class IssuesController < ApplicationController
end end
def new def new
@issue = Issue.new(:project => @project) @issue = @project.issues.new
end end
def create def create
@user_id = params[:user_id] @user_id = params[:user_id]
@user_uname = params[:user_uname] @user_uname = params[:user_uname]
@issue = Issue.new(params[:issue]) @issue = @project.issues.new(params[:issue])
@issue.creator_id = current_user.id @issue.creator_id = current_user.id
@issue.user_id = @user_id @issue.user_id = @user_id
@issue.project_id = @project.id
if @issue.save if @issue.save
@issue.subscribe_creator(current_user.id) @issue.subscribe_creator(current_user.id)
@ -67,9 +64,7 @@ class IssuesController < ApplicationController
status = 200 if @issue.save status = 200 if @issue.save
render action, :status => (status || 500), :layout => false render action, :status => (status || 500), :layout => false
else else
@issue.title = params[:issue][:title] status = 200 if @issue.update_attributes(params[:issue])
@issue.body = params[:issue][:body]
status = 200 if @issue.save
render :nothing => true, :status => (status || 500), :layout => false render :nothing => true, :status => (status || 500), :layout => false
end end
end end
@ -112,7 +107,6 @@ class IssuesController < ApplicationController
private private
def load_and_authorize_label def load_and_authorize_label
@project = Project.find(params[:project_id])
@label = Label.find(params[:label_id]) if params[:label_id] @label = Label.find(params[:label_id]) if params[:label_id]
authorize! :write, @project authorize! :write, @project
end end

View File

@ -20,7 +20,7 @@ class Issue < ActiveRecord::Base
after_create :subscribe_users after_create :subscribe_users
after_update :subscribe_issue_assigned_user after_update :subscribe_issue_assigned_user
attr_accessible :labelings_attributes, :title, :body, :project, :project_id, :closed_at, :closed_by attr_accessible :labelings_attributes, :title, :body
accepts_nested_attributes_for :labelings, :allow_destroy => true accepts_nested_attributes_for :labelings, :allow_destroy => true
scope :opened, where(:status => 'open', :closed_by => nil, :closed_at => nil) scope :opened, where(:status => 'open', :closed_by => nil, :closed_at => nil)

View File

@ -16,5 +16,5 @@
=tracker_search_field(:search_issue, t('layout.issues.search')) =tracker_search_field(:search_issue, t('layout.issues.search'))
.bordered.nopadding .bordered.nopadding
%h3.bmargin10=t('layout.issues.new') %h3.bmargin10=t('layout.issues.new')
= link_to t("layout.add"), new_project_issue_path(@project), :class => 'button' if can? :new, Issue.new(:project_id => @project.id) = link_to t("layout.add"), new_project_issue_path(@project), :class => 'button' if can? :new, @project.issues.new
=render :partial => 'labels' =render :partial => 'labels'

View File

@ -1,5 +1,3 @@
= render :partial => 'projects/submenu'
%h3.bpadding10 %h3.bpadding10
= t("layout.projects.new_header") = t("layout.projects.new_header")

View File

@ -27,7 +27,7 @@ end
shared_examples_for 'user with issue update rights' do shared_examples_for 'user with issue update rights' do
it 'should be able to perform update action' do it 'should be able to perform update action' do
put :update, {:id => @issue.serial_id}.merge(@update_params) put :update, {:id => @issue.serial_id}.merge(@update_params)
response.should redirect_to([@project, @issue]) response.code.should eq('200')
end end
it 'should update issue title' do it 'should update issue title' do