[refs #194] show page beta version
This commit is contained in:
parent
66a08662c2
commit
0d75a37451
|
@ -1,54 +0,0 @@
|
|||
function switchThis() {
|
||||
var doc = document.getElementById("switcher");
|
||||
if (doc.className == "switcher") {
|
||||
doc.className = "switcher-off";
|
||||
$("#open-comment").fadeOut(0);
|
||||
$("#closed-comment").fadeIn("slow");
|
||||
} else {
|
||||
doc.className = "switcher";
|
||||
$("#closed-comment").fadeOut(0);
|
||||
$("#open-comment").fadeIn("slow");
|
||||
}
|
||||
}
|
||||
|
||||
function preload() {
|
||||
if (document.images) {
|
||||
var imgsrc = preload.arguments;
|
||||
arr=new Array(imgsrc.length);
|
||||
|
||||
for (var j=0; j<imgsrc.length; j++) {
|
||||
arr[j] = new Image;
|
||||
arr[j].src = imgsrc[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function manage(elem) {
|
||||
if (elem == "people") {
|
||||
var doc = document.getElementById("people-manage");
|
||||
if (doc.className == "view") {
|
||||
doc.className = "non-view";
|
||||
$("#people-manage").fadeOut(0);
|
||||
$("#people-manage-list").fadeIn("slow");
|
||||
}
|
||||
else {
|
||||
$("#people-manage-list").fadeOut(0);
|
||||
$("#people-manage").fadeIn("slow");
|
||||
doc.className = "view";
|
||||
}
|
||||
}
|
||||
if (elem == "labels") {
|
||||
var doc = document.getElementById("labels-manage");
|
||||
if (doc.className == "view") {
|
||||
doc.className = "non-view";
|
||||
$("#labels-manage").fadeOut(0);
|
||||
$("#labels-manage-list").fadeIn("slow");
|
||||
}
|
||||
else {
|
||||
$("#labels-manage-list").fadeOut(0);
|
||||
$("#labels-manage").fadeIn("slow");
|
||||
doc.className = "view";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -184,4 +184,25 @@ $(document).ready(function() {
|
|||
|
||||
});
|
||||
|
||||
$('.issue_status.switch_issue_status').live('click', function () {
|
||||
var button = $(this);
|
||||
var status = (button.hasClass('switcher')) ? 'closed' : 'open';
|
||||
var form = $('#update_issue_status');
|
||||
form.find('#issue_status').attr('value', status);
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: form.attr("action"),
|
||||
data: form.serialize(),
|
||||
success: function(data){
|
||||
if (status == "open") { button.addClass('switcher').removeClass("switcher-off"); }
|
||||
else { button.removeClass('switcher').addClass("switcher-off"); }
|
||||
$('#closed_issue_text').html(data);
|
||||
},
|
||||
error: function(data){
|
||||
alert('error') // TODO remove
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -56,16 +56,14 @@ class IssuesController < ApplicationController
|
|||
end
|
||||
|
||||
def update
|
||||
@user_id = params[:user_id].blank? ? @issue.user_id : params[:user_id]
|
||||
@user_uname = params[:user_uname].blank? ? @issue.assign_uname : params[:user_uname]
|
||||
|
||||
if @issue.update_attributes( params[:issue].merge({:user_id => @user_id}) )
|
||||
flash[:notice] = I18n.t("flash.issue.saved")
|
||||
redirect_to [@project, @issue]
|
||||
else
|
||||
flash[:error] = I18n.t("flash.issue.save_error")
|
||||
render :action => :new
|
||||
if status = params[:issue][:status]
|
||||
action = 'issues/_status'
|
||||
@issue.set_close(current_user) if status == 'closed'
|
||||
@issue.set_open if status == 'open'
|
||||
status = 200 if @issue.save
|
||||
end
|
||||
|
||||
render action, :status => (status || 500), :layout => false
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
|
|
@ -5,6 +5,7 @@ class Issue < ActiveRecord::Base
|
|||
belongs_to :project
|
||||
belongs_to :user
|
||||
belongs_to :creator, :class_name => 'User', :foreign_key => 'creator_id'
|
||||
belongs_to :closer, :class_name => 'User', :foreign_key => 'closed_by'
|
||||
|
||||
has_many :comments, :as => :commentable, :dependent => :destroy #, :finder_sql => proc { "comments.commentable_id = '#{self.id}' AND comments.commentable_type = '#{self.class.name}'"}
|
||||
has_many :subscribes, :as => :subscribeable, :dependent => :destroy #, :finder_sql => proc { "subscribes.subscribeable_id = '#{self.id}' AND subscribes.subscribeable_type = '#{self.class.name}'"}
|
||||
|
@ -22,7 +23,7 @@ class Issue < ActiveRecord::Base
|
|||
after_update :deliver_issue_assign_notification
|
||||
after_update :subscribe_issue_assigned_user
|
||||
|
||||
attr_accessible :labelings_attributes, :title, :body, :project, :project_id
|
||||
attr_accessible :labelings_attributes, :title, :body, :project, :project_id, :closed_at, :closed_by
|
||||
accepts_nested_attributes_for :labelings, :allow_destroy => true
|
||||
|
||||
def assign_uname
|
||||
|
@ -39,6 +40,21 @@ class Issue < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def closed?
|
||||
closed_by && closed_at && status == 'closed'
|
||||
end
|
||||
|
||||
def set_close(closed_by)
|
||||
self.closed_at = Time.now
|
||||
self.closer = closed_by
|
||||
self.status = 'closed'
|
||||
end
|
||||
|
||||
def set_open
|
||||
self.closed_at = self.closed_by = nil
|
||||
self.status = 'open'
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def set_serial_id
|
||||
|
@ -87,4 +103,5 @@ class Issue < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,14 +1,39 @@
|
|||
-content_for :sidebar do
|
||||
- if @issue.persisted?
|
||||
.bordered.nopadding
|
||||
%h3=t('activerecord.attributes.issue.status')
|
||||
#switcher.issue_status{:class => "#{@issue.closed? ? 'switcher-off' : 'switcher'} #{can?(:write, @issue.project) ? "switch_issue_status" : ''}"}
|
||||
.swleft=t('layout.issues.status.open')
|
||||
.swright=t('layout.issues.status.closed')
|
||||
- if can? :write, @issue.project
|
||||
=form_tag [@project, @issue], :id => 'update_issue_status', :method => :put do
|
||||
=hidden_field_tag "issue_status", @issue.closed? ? 'closed' : 'open', :name => "issue[status]"
|
||||
|
||||
.bordered.nopadding
|
||||
%h3=t('layout.issues.executor')
|
||||
=form_tag search_collaborators_project_issues_path(@project), :id => 'search_user', :method => :get do
|
||||
=tracker_search_field(:search_user, t('layout.issues.search_user'))
|
||||
#create_issue_users_list
|
||||
=render 'issues/search_collaborators'
|
||||
- if @issue.persisted? && @issue.user
|
||||
.bordered.nopadding
|
||||
.people.nopointer
|
||||
.avatar=image_tag(@issue.user.avatar(25), :alt => 'avatar')
|
||||
.name="#{@issue.user.uname} (#{@issue.user.name})"
|
||||
=hidden_field_tag "user-0", @issue.user.id, :name => 'user_id'
|
||||
.both
|
||||
- else
|
||||
=form_tag search_collaborators_project_issues_path(@project), :id => 'search_user', :method => :get do
|
||||
=tracker_search_field(:search_user, t('layout.issues.search_user'))
|
||||
#create_issue_users_list
|
||||
=render 'issues/search_collaborators'
|
||||
|
||||
.block
|
||||
%h3=t('layout.issues.labels')
|
||||
=form_tag search_labels_project_issues_path(@project), :id => 'search_labels', :method => :get do
|
||||
=tracker_search_field(:search_labels, t('layout.issues.search_labels'))
|
||||
#create_issue_labels_list
|
||||
=render 'issues/search_labels'
|
||||
- if @issue.new_record?
|
||||
=form_tag search_labels_project_issues_path(@project), :id => 'search_labels', :method => :get do
|
||||
=tracker_search_field(:search_labels, t('layout.issues.search_labels'))
|
||||
#create_issue_labels_list
|
||||
=render 'issues/search_labels'
|
||||
- else
|
||||
- (@issue.labels || []).each_with_index do |label|
|
||||
.label.selected.nopointer
|
||||
.labeltext.selected{:style => "background: ##{label.color};"}
|
||||
=label.name
|
||||
.both
|
|
@ -0,0 +1,9 @@
|
|||
#closed_issue_text
|
||||
- if @issue.status == 'closed' && @issue.closed_at && @issue.closed_by
|
||||
#closed-comment.comment-closed{:style => 'display: block;'}
|
||||
.state=t('layout.issues.status.closed')
|
||||
.text
|
||||
.avatar=image_tag(@issue.closer.avatar(25), :alt => 'avatar')
|
||||
.name="#{@issue.closer.uname} (#{@issue.closer.name}) #{t('layout.issues.at')} #{@issue.closed_at.to_s(:long)}"
|
||||
.both
|
||||
%br/
|
|
@ -1,11 +0,0 @@
|
|||
.block
|
||||
.secondary-navigation
|
||||
%ul.wat-cf
|
||||
%li.first= link_to t("layout.issues.list"), project_issues_path(@project)
|
||||
%li= link_to t("layout.issues.new"), new_project_issue_path(@project)
|
||||
.content
|
||||
%h2.title
|
||||
= t("layout.issues.edit_header")
|
||||
.inner
|
||||
= form_for @issue, :url => project_issue_path(@project, @issue), :html => { :class => :form } do |f|
|
||||
= render :partial => "form", :locals => {:f => f}
|
|
@ -4,9 +4,9 @@
|
|||
#closed-switcher.blue-switcher
|
||||
=hidden_field_tag :issues_status, @status, :id => 'issues_status'
|
||||
.open
|
||||
="#{t('layout.issues.statuses.open')} (#{@issues.where(:status => 'open').count})"
|
||||
="#{t('layout.issues.statuses.open')} (#{@project.issues.where(:status => 'open').count})"
|
||||
#closed-tasks.closed
|
||||
="#{t('layout.issues.statuses.closed')} (#{@issues.where(:status => 'closed').count})"
|
||||
="#{t('layout.issues.statuses.closed')} (#{@project.issues.where(:status => 'closed').count})"
|
||||
#blue-switch-select.selected{:style => "margin-left: #{@status == 'open' ? '0' : '130'}px;"}
|
||||
.both
|
||||
.both
|
||||
|
|
|
@ -1,32 +1,20 @@
|
|||
.block
|
||||
.secondary-navigation
|
||||
%ul.wat-cf
|
||||
%li.first= link_to t("layout.issues.list"), project_issues_path(@project)
|
||||
%li= link_to t("layout.issues.edit"), edit_project_issue_path(@project, @issue) if can? :edit, @issue
|
||||
.content
|
||||
.inner
|
||||
%p
|
||||
%b
|
||||
= t("activerecord.attributes.issue.title")
|
||||
\:
|
||||
= @issue.title
|
||||
%p
|
||||
%b
|
||||
= t("activerecord.attributes.issue.body")
|
||||
\:
|
||||
= @issue.body
|
||||
%p
|
||||
%b
|
||||
= t('activerecord.attributes.issue.status')
|
||||
\:
|
||||
= @issue.status
|
||||
%p
|
||||
%b
|
||||
= t('layout.issues.subscribe')
|
||||
\:
|
||||
- if @issue.subscribes.exists? :user_id => current_user.id
|
||||
= link_to t('layout.issues.unsubscribe_btn'), project_issue_subscribe_path(@project, @issue, current_user.id), :method => :delete
|
||||
- else
|
||||
= link_to t('layout.issues.subscribe_btn'), project_issue_subscribes_path(@project, @issue), :method => :post
|
||||
-render :partial => 'projects/submenu'
|
||||
-render :partial => 'issues/create_sidebar'
|
||||
-content_for :right_nopadding do
|
||||
dummy
|
||||
%h3=@issue.title
|
||||
.activity
|
||||
.top
|
||||
.image
|
||||
=image_tag(@issue.creator.avatar(42), :alt => 'avatar') if @issue.creator
|
||||
.text
|
||||
%span.name=link_to(@issue.creator.uname, user_path(@issue.creator)) if @issue.creator
|
||||
%br/
|
||||
%span.date=@issue.created_at.to_s(:long)
|
||||
%br/
|
||||
.both
|
||||
.fulltext.view=@issue.body
|
||||
.both
|
||||
.hr
|
||||
|
||||
= render :partial => "comments/list", :locals => {:list => @issue.comments.order(:created_at), :project => @project, :commentable => @issue}
|
||||
=render :partial => 'issues/status'
|
||||
|
|
|
@ -27,6 +27,9 @@ en:
|
|||
open: Opened
|
||||
closed: Closed
|
||||
any: Any
|
||||
status:
|
||||
open: Открыто
|
||||
closed: Closed
|
||||
subscribe: Subscribe
|
||||
subscribe_btn: Subscribe
|
||||
unsubscribe_btn: Unsubscribe
|
||||
|
@ -44,6 +47,7 @@ en:
|
|||
search_labels: Search labels...
|
||||
choose_user_on_left: Choose executor on the left
|
||||
choose_labels_on_left: Choose labels on the left
|
||||
at: at
|
||||
|
||||
flash:
|
||||
issue:
|
||||
|
|
|
@ -27,6 +27,9 @@ ru:
|
|||
open: Открытые
|
||||
closed: Закрытые
|
||||
any: Все
|
||||
status:
|
||||
open: Открыто
|
||||
closed: Закрыто
|
||||
subscribe: Подписка на уведомления
|
||||
subscribe_btn: Подписаться
|
||||
unsubscribe_btn: Отписаться
|
||||
|
@ -44,6 +47,7 @@ ru:
|
|||
search_labels: Найти метки...
|
||||
choose_user_on_left: выберите исполнителя слева
|
||||
choose_labels_on_left: выберите метки слева
|
||||
at: в
|
||||
|
||||
flash:
|
||||
issue:
|
||||
|
|
|
@ -116,7 +116,7 @@ Rosa::Application.routes.draw do
|
|||
match 'compare/*versions' => 'wiki#compare', :as => :compare_versions, :via => :get
|
||||
end
|
||||
end
|
||||
resources :issues do
|
||||
resources :issues, :except => :edit do
|
||||
resources :comments, :only => [:edit, :create, :update, :destroy]
|
||||
resources :subscribes, :only => [:create, :destroy]
|
||||
collection do
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddClosedAtToIssue < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :issues, :closed_at, :datetime
|
||||
end
|
||||
end
|
|
@ -0,0 +1,6 @@
|
|||
class AddClosedByToIssue < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :issues, :closed_by, :integer
|
||||
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue