[refs #90] issue status -> state
This commit is contained in:
parent
598c072a80
commit
628fed40ea
|
@ -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 = 'status=' + $('#issues_status').attr('value');
|
||||
var status = 'state=' + $('#issues_status').attr('value');
|
||||
$.ajax({
|
||||
type: type_request,
|
||||
url: url,
|
||||
|
|
|
@ -11,7 +11,7 @@ class IssuesController < ApplicationController
|
|||
|
||||
def index(status = 200)
|
||||
@is_assigned_to_me = params[:filter] == 'to_me'
|
||||
@status = params[:status] == 'closed' ? 'closed' : 'open'
|
||||
@state = params[:state] == '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 IssuesController < ApplicationController
|
|||
end
|
||||
@opened_issues = @issues.opened.count
|
||||
@closed_issues = @issues.closed.count
|
||||
@issues = @issues.where(:status => @status)
|
||||
@issues = @issues.where(:state => @state)
|
||||
|
||||
|
||||
@issues = @issues.includes(:assignee, :user).order('serial_id desc').uniq.paginate :per_page => 10, :page => params[:page]
|
||||
|
@ -54,10 +54,10 @@ class IssuesController < ApplicationController
|
|||
end
|
||||
|
||||
def update
|
||||
if params[:issue] && status = params[:issue][:status]
|
||||
if params[:issue] && state = params[:issue][:state]
|
||||
action = 'issues/_status'
|
||||
@issue.set_close(current_user) if status == 'closed'
|
||||
@issue.set_open if status == 'open'
|
||||
@issue.set_close(current_user) if state == 'closed'
|
||||
@issue.set_open if state == 'open'
|
||||
status = 200 if @issue.save
|
||||
render action, :status => (status || 500), :layout => false
|
||||
elsif params[:issue]
|
||||
|
|
|
@ -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(:status => 'open')
|
||||
scope :closed, where(:status => 'closed')
|
||||
scope :opened, where(:state => 'open')
|
||||
scope :closed, where(:state => 'closed')
|
||||
|
||||
def assign_uname
|
||||
assignee.uname if assignee
|
||||
|
@ -39,18 +39,18 @@ class Issue < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def closed?
|
||||
closed_by && closed_at && status == 'closed'
|
||||
closed_by && closed_at && state == 'closed'
|
||||
end
|
||||
|
||||
def set_close(closed_by)
|
||||
self.closed_at = Time.now
|
||||
self.closer = closed_by
|
||||
self.status = 'closed'
|
||||
self.state = 'closed'
|
||||
end
|
||||
|
||||
def set_open
|
||||
self.closed_at = self.closed_by = nil
|
||||
self.status = 'open'
|
||||
self.state = 'open'
|
||||
end
|
||||
|
||||
def collect_recipient_ids
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
- can_manage = can?(:update, @issue) && @issue.persisted? || @issue.new_record?
|
||||
- if @issue.persisted?
|
||||
.bordered.nopadding
|
||||
%h3=t('activerecord.attributes.issue.status')
|
||||
%h3=t('activerecord.attributes.issue.state')
|
||||
#switcher.issue_status{:class => "#{@issue.closed? ? 'switcher-off' : 'switcher'} #{can_manage ? "switch_issue_status" : ''}"}
|
||||
.swleft=t('layout.issues.status.open')
|
||||
.swright=t('layout.issues.status.closed')
|
||||
.swleft=t('layout.issues.state.open')
|
||||
.swright=t('layout.issues.state.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[status]"
|
||||
=hidden_field_tag "issue_status", @issue.closed? ? 'closed' : 'open', :name => "issue[state]"
|
||||
.bordered.nopadding
|
||||
%h3=t('layout.issues.assignee')
|
||||
- if @issue.persisted?
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#closed_issue_text
|
||||
- if @issue.status == 'closed' && @issue.closed_at && @issue.closed_by
|
||||
- if @issue.state == 'closed' && @issue.closed_at && @issue.closed_by
|
||||
#closed-comment.comment-closed{:style => 'display: block;'}
|
||||
.state=t('layout.issues.status.closed')
|
||||
.state=t('layout.issues.state.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 :partial => 'issues/index_sidebar'
|
||||
|
||||
#closed-switcher.blue-switcher
|
||||
=hidden_field_tag :issues_status, @status, :id => 'issues_status'
|
||||
=hidden_field_tag :issues_status, @state, :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: #{@status == 'open' ? '0' : '130'}px;"}
|
||||
#blue-switch-select.selected{:style => "margin-left: #{@state == 'open' ? '0' : '130'}px;"}
|
||||
.both
|
||||
.both
|
||||
#table1
|
||||
|
|
|
@ -7,7 +7,7 @@ en:
|
|||
assignee: Assigned
|
||||
assignee_id: Assigned
|
||||
project: Project
|
||||
status: Status
|
||||
state: Status
|
||||
|
||||
layout:
|
||||
issues:
|
||||
|
@ -27,7 +27,7 @@ en:
|
|||
open: Open
|
||||
closed: Closed
|
||||
any: Any
|
||||
status:
|
||||
state:
|
||||
open: Open
|
||||
closed: Closed
|
||||
subscribe: Subscribe to notifications
|
||||
|
|
|
@ -7,7 +7,7 @@ ru:
|
|||
assignee: Назначена
|
||||
assignee_id: Назначена
|
||||
project: Проект
|
||||
status: Статус
|
||||
state: Статус
|
||||
|
||||
layout:
|
||||
issues:
|
||||
|
@ -27,7 +27,7 @@ ru:
|
|||
open: Открытые
|
||||
closed: Закрытые
|
||||
any: Все
|
||||
status:
|
||||
state:
|
||||
open: Открыто
|
||||
closed: Закрыто
|
||||
subscribe: Подписка на уведомления
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
class CreatePullRequests < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :issues, :type, :string
|
||||
add_column :issues, :state, :string
|
||||
rename_column :issues, :status, :state
|
||||
add_column :issues, :data, :text, :null => false, :default => 0
|
||||
end
|
||||
end
|
||||
|
|
|
@ -140,14 +140,13 @@ ActiveRecord::Schema.define(:version => 20120418100619) do
|
|||
t.integer "assignee_id"
|
||||
t.string "title"
|
||||
t.text "body"
|
||||
t.string "status", :default => "open"
|
||||
t.string "state", :default => "open"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "user_id"
|
||||
t.datetime "closed_at"
|
||||
t.integer "closed_by"
|
||||
t.string "type"
|
||||
t.string "state"
|
||||
t.text "data", :default => "0", :null => false
|
||||
end
|
||||
|
||||
|
|
|
@ -6,6 +6,6 @@ FactoryGirl.define do
|
|||
association :project, :factory => :project
|
||||
association :user, :factory => :user
|
||||
association :assignee, :factory => :user
|
||||
status "open"
|
||||
state "open"
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue