Revert "[refs #90] issue status -> state" & changed state -> status
This reverts commit 7470ee76e4783a0fbbd98607406d7b770a2980d1. Conflicts: app/controllers/projects/issues_controller.rb db/migrate/20120412173938_create_pull_requests.rb db/schema.rb
This commit is contained in:
parent
6623da9d71
commit
11c67fb07d
|
@ -90,7 +90,7 @@ $(document).ready(function() {
|
|||
var filter_form = $('#filter_issues');
|
||||
url = url || filter_form.attr("action");
|
||||
var label_form = $('#filter_labels');
|
||||
var status = 'state=' + $('#issues_status').attr('value');
|
||||
var status = 'status=' + $('#issues_status').attr('value');
|
||||
$.ajax({
|
||||
type: type_request,
|
||||
url: url,
|
||||
|
|
|
@ -11,7 +11,7 @@ class Projects::IssuesController < Projects::BaseController
|
|||
|
||||
def index(status = 200)
|
||||
@is_assigned_to_me = params[:filter] == 'to_me'
|
||||
@state = params[:state] == 'closed' ? 'closed' : 'open'
|
||||
@status = params[:status] == 'closed' ? 'closed' : 'open'
|
||||
@labels = params[:labels] || []
|
||||
@issues = @project.issues
|
||||
@issues = @issues.where(:assignee_id => current_user.id) if @is_assigned_to_me
|
||||
|
@ -22,7 +22,7 @@ class Projects::IssuesController < Projects::BaseController
|
|||
end
|
||||
@opened_issues = @issues.opened.count
|
||||
@closed_issues = @issues.closed.count
|
||||
@issues = @issues.where(:state => @state)
|
||||
@issues = @issues.where(:status => @status)
|
||||
|
||||
|
||||
@issues = @issues.includes(:assignee, :user).order('serial_id desc').uniq.paginate :per_page => 10, :page => params[:page]
|
||||
|
|
|
@ -18,8 +18,8 @@ class Projects::PullRequestsController < Projects::BaseController
|
|||
@pull.head_project = @project
|
||||
@pull.base_ref = (params[:pull_request][:base_ref].presence if params[:pull_request]) || @pull.base_project.default_branch
|
||||
@pull.head_ref = params[:treeish].presence || (params[:pull_request][:head_ref].presence if params[:pull_request]) || @pull.head_project.default_branch
|
||||
@pull.state = @pull.soft_check
|
||||
if @pull.state == 'already'
|
||||
@pull.status = @pull.soft_check
|
||||
if @pull.status == 'already'
|
||||
flash[:warning] = I18n.t('projects.pull_requests.up_to_date', :base_ref => @pull.base_ref, :head_ref => @pull.head_ref)
|
||||
else
|
||||
repo = Git::Repository.new(@pull.path)
|
||||
|
@ -39,7 +39,7 @@ class Projects::PullRequestsController < Projects::BaseController
|
|||
|
||||
if @pull.save
|
||||
@pull.check
|
||||
if @pull.state == 'already'
|
||||
if @pull.status == 'already'
|
||||
@pull.destroy
|
||||
|
||||
@pull.errors.add(:head_ref, I18n.t('projects.pull_requests.up_to_date', :base_ref => @pull.base_ref, :head_ref => @pull.head_ref))
|
||||
|
|
|
@ -116,7 +116,7 @@ class Ability
|
|||
can(:update, Comment) {|comment| comment.user_id == user.id or local_admin?(comment.project || comment.commentable.project)}
|
||||
cannot :manage, Comment, :commentable_type => 'Issue', :commentable => {:project => {:has_issues => false}} # switch off issues
|
||||
|
||||
can [:merge], PullRequest, :state => 'ready'
|
||||
can [:merge], PullRequest, :status => 'ready'
|
||||
end
|
||||
|
||||
# Shared cannot rights for all users (registered, admin)
|
||||
|
|
|
@ -21,8 +21,8 @@ class Issue < ActiveRecord::Base
|
|||
attr_accessible :labelings_attributes, :title, :body, :assignee_id
|
||||
accepts_nested_attributes_for :labelings, :allow_destroy => true
|
||||
|
||||
scope :opened, where(:state => 'open')
|
||||
scope :closed, where(:state => 'closed')
|
||||
scope :opened, where(:status => 'open')
|
||||
scope :closed, where(:status => 'closed')
|
||||
|
||||
def assign_uname
|
||||
assignee.uname if assignee
|
||||
|
@ -39,18 +39,18 @@ class Issue < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def closed?
|
||||
closed_by && closed_at && state == 'closed'
|
||||
closed_by && closed_at && status == 'closed'
|
||||
end
|
||||
|
||||
def set_close(closed_by)
|
||||
self.closed_at = Time.now
|
||||
self.closer = closed_by
|
||||
self.state = 'closed'
|
||||
self.status = 'closed'
|
||||
end
|
||||
|
||||
def set_open
|
||||
self.closed_at = self.closed_by = nil
|
||||
self.state = 'open'
|
||||
self.status = 'open'
|
||||
end
|
||||
|
||||
def collect_recipient_ids
|
||||
|
|
|
@ -2,7 +2,7 @@ class PullRequest < ActiveRecord::Base
|
|||
belongs_to :issue, :autosave => true, :dependent => :destroy, :touch => true, :validate => true
|
||||
belongs_to :base_project, :class_name => 'Project', :foreign_key => 'base_project_id'
|
||||
belongs_to :head_project, :class_name => 'Project', :foreign_key => 'head_project_id'
|
||||
delegate :user, :title, :body, :serial_id, :assignee, :state, :to => :issue, :allow_nil => true
|
||||
delegate :user, :title, :body, :serial_id, :assignee, :status, :to => :issue, :allow_nil => true
|
||||
accepts_nested_attributes_for :issue
|
||||
#attr_accessible #FIXME disable for development
|
||||
validate :uniq_merge
|
||||
|
@ -16,9 +16,9 @@ class PullRequest < ActiveRecord::Base
|
|||
before_create :clean_dir
|
||||
after_destroy :clean_dir
|
||||
|
||||
scope :needed_checking, includes(:issue).where(:issues => {:state => ['open', 'blocked', 'ready', 'already']})
|
||||
scope :needed_checking, includes(:issue).where(:issues => {:status => ['open', 'blocked', 'ready', 'already']})
|
||||
|
||||
state_machine :initial => :open do
|
||||
state_machine :status, :initial => :open do
|
||||
#after_transition [:ready, :blocked] => [:merged, :closed] do |pull, transition|
|
||||
# FileUtils.rm_rf(pull.path) # What about diff?
|
||||
#end
|
||||
|
@ -48,12 +48,12 @@ class PullRequest < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def state=(value)
|
||||
issue.state = value
|
||||
def status=(value)
|
||||
issue.status = value
|
||||
end
|
||||
|
||||
def can_merge?
|
||||
state == 'ready'
|
||||
status == 'ready'
|
||||
end
|
||||
|
||||
def check
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
- can_manage = can?(:update, @issue) && @issue.persisted? || @issue.new_record?
|
||||
- if @issue.persisted?
|
||||
.bordered.nopadding
|
||||
%h3=t('activerecord.attributes.issue.state')
|
||||
%h3=t('activerecord.attributes.issue.status')
|
||||
#switcher.issue_status{:class => "#{@issue.closed? ? 'switcher-off' : 'switcher'} #{can_manage ? "switch_issue_status" : ''}"}
|
||||
.swleft=t('layout.issues.state.open')
|
||||
.swright=t('layout.issues.state.closed')
|
||||
.swleft=t('layout.issues.status.open')
|
||||
.swright=t('layout.issues.status.closed')
|
||||
- if can_manage
|
||||
=form_tag [@project, @issue], :id => 'update_issue_status', :method => :put do
|
||||
=hidden_field_tag "issue_status", @issue.closed? ? 'closed' : 'open', :name => "issue[state]"
|
||||
=hidden_field_tag "issue_status", @issue.closed? ? 'closed' : 'open', :name => "issue[status]"
|
||||
.bordered.nopadding
|
||||
%h3=t('layout.issues.assignee')
|
||||
- if @issue.persisted?
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#closed_issue_text
|
||||
- if @issue.state == 'closed' && @issue.closed_at && @issue.closed_by
|
||||
- if @issue.status == 'closed' && @issue.closed_at && @issue.closed_by
|
||||
#closed-comment.comment-closed{:style => 'display: block;'}
|
||||
.state=t('layout.issues.state.closed')
|
||||
.state=t('layout.issues.status.closed')
|
||||
.text
|
||||
.avatar= image_tag(avatar_url(@issue.closer), :alt => 'avatar')
|
||||
.name="#{@issue.closer.uname} (#{@issue.closer.name}) #{t('layout.issues.at')} #{@issue.closed_at.to_s(:long)}"
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
-render 'index_sidebar'
|
||||
|
||||
#closed-switcher.blue-switcher
|
||||
=hidden_field_tag :issues_status, @state, :id => 'issues_status'
|
||||
=hidden_field_tag :issues_status, @status, :id => 'issues_status'
|
||||
.open
|
||||
="#{t('layout.issues.statuses.open')} (#{@opened_issues})"
|
||||
#closed-tasks.closed
|
||||
="#{t('layout.issues.statuses.closed')} (#{@closed_issues})"
|
||||
#blue-switch-select.selected{:style => "margin-left: #{@state == 'open' ? '0' : '130'}px;"}
|
||||
#blue-switch-select.selected{:style => "margin-left: #{@status == 'open' ? '0' : '130'}px;"}
|
||||
.both
|
||||
.both
|
||||
#table1
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
%a{"data-toggle" => "tab", :href => "##{base}"}=title
|
||||
.tab-content.pull_diff_fix
|
||||
#discussion.tab-pane.active
|
||||
=form_for @pull, :url => (@pull.state != 'already' ? project_pull_requests_path : new_project_pull_requests_path), :html => {:class => 'well well-large'} do |f|
|
||||
=form_for @pull, :url => (@pull.status != 'already' ? project_pull_requests_path : new_project_pull_requests_path), :html => {:class => 'well well-large'} do |f|
|
||||
.leftlist=f.label :base_project, t('.base_project'), :class => :label
|
||||
.rightlist
|
||||
= @pull.base_project.full_name
|
||||
|
@ -35,10 +35,10 @@
|
|||
.both
|
||||
|
||||
.leftlist for debug
|
||||
.rightlist=@pull.state
|
||||
.rightlist=@pull.status
|
||||
.both
|
||||
.leftlist
|
||||
.rightlist=f.submit t(@pull.state != 'already' ? '.submit' : '.update'), :class => 'btn btn-primary disabled', 'data-loading-text' => t('layout.processing')#, :id => 'create_pull'
|
||||
.rightlist=f.submit t(@pull.status != 'already' ? '.submit' : '.update'), :class => 'btn btn-primary disabled', 'data-loading-text' => t('layout.processing')#, :id => 'create_pull'
|
||||
.both
|
||||
|
||||
#diff.tab-pane
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
.leftlist=t('activerecord.attributes.issue.body')
|
||||
.rightlist=@pull.issue.body
|
||||
.both
|
||||
.leftlist=t('activerecord.attributes.issue.state')
|
||||
.rightlist=@pull.issue.state
|
||||
.leftlist=t('activerecord.attributes.issue.status')
|
||||
.rightlist=@pull.issue.status
|
||||
.both
|
||||
- if can? :merge, @pull
|
||||
=form_for PullRequest.new, :url => merge_project_pull_request_path(@project, @pull), :html => { :method => :put, :class => :form } do |f|
|
||||
|
|
|
@ -7,7 +7,7 @@ en:
|
|||
assignee: Assigned
|
||||
assignee_id: Assigned
|
||||
project: Project
|
||||
state: Status
|
||||
status: Status
|
||||
|
||||
layout:
|
||||
issues:
|
||||
|
@ -27,7 +27,7 @@ en:
|
|||
open: Open
|
||||
closed: Closed
|
||||
any: Any
|
||||
state:
|
||||
status:
|
||||
open: Open
|
||||
closed: Closed
|
||||
subscribe: Subscribe to notifications
|
||||
|
|
|
@ -7,7 +7,7 @@ ru:
|
|||
assignee: Назначена
|
||||
assignee_id: Назначена
|
||||
project: Проект
|
||||
state: Статус
|
||||
status: Статус
|
||||
|
||||
layout:
|
||||
issues:
|
||||
|
@ -27,7 +27,7 @@ ru:
|
|||
open: Открытые
|
||||
closed: Закрытые
|
||||
any: Все
|
||||
state:
|
||||
status:
|
||||
open: Открыто
|
||||
closed: Закрыто
|
||||
subscribe: Подписка на уведомления
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
class CreatePullRequests < ActiveRecord::Migration
|
||||
def change
|
||||
rename_column :issues, :status, :state
|
||||
|
||||
create_table :pull_requests do |t|
|
||||
t.integer :issue_id, :null => false
|
||||
t.integer :base_project_id, :null => false
|
||||
|
|
16
db/schema.rb
16
db/schema.rb
|
@ -17,8 +17,8 @@ ActiveRecord::Schema.define(:version => 20120515095324) do
|
|||
t.integer "user_id", :null => false
|
||||
t.string "kind"
|
||||
t.text "data"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "advisories", :force => true do |t|
|
||||
|
@ -182,7 +182,7 @@ ActiveRecord::Schema.define(:version => 20120515095324) do
|
|||
t.integer "assignee_id"
|
||||
t.string "title"
|
||||
t.text "body"
|
||||
t.string "state", :default => "open"
|
||||
t.string "status", :default => "open"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "user_id"
|
||||
|
@ -373,9 +373,8 @@ ActiveRecord::Schema.define(:version => 20120515095324) do
|
|||
|
||||
create_table "users", :force => true do |t|
|
||||
t.string "name"
|
||||
t.string "email", :default => "", :null => false
|
||||
t.string "encrypted_password", :limit => 128, :default => "", :null => false
|
||||
t.string "password_salt", :default => "", :null => false
|
||||
t.string "email", :default => "", :null => false
|
||||
t.string "encrypted_password", :default => "", :null => false
|
||||
t.string "reset_password_token"
|
||||
t.datetime "reset_password_sent_at"
|
||||
t.datetime "remember_created_at"
|
||||
|
@ -384,12 +383,11 @@ ActiveRecord::Schema.define(:version => 20120515095324) do
|
|||
t.text "ssh_key"
|
||||
t.string "uname"
|
||||
t.string "role"
|
||||
t.string "language", :default => "en"
|
||||
t.string "language", :default => "en"
|
||||
t.integer "own_projects_count", :default => 0, :null => false
|
||||
t.string "confirmation_token"
|
||||
t.datetime "confirmed_at"
|
||||
t.datetime "confirmation_sent_at"
|
||||
t.integer "own_projects_count", :default => 0, :null => false
|
||||
t.datetime "reset_password_sent_at"
|
||||
t.text "professional_experience"
|
||||
t.string "site"
|
||||
t.string "company"
|
||||
|
|
|
@ -6,6 +6,6 @@ FactoryGirl.define do
|
|||
association :project, :factory => :project
|
||||
association :user, :factory => :user
|
||||
association :assignee, :factory => :user
|
||||
state "open"
|
||||
status "open"
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue