Merge branch 'issue_im'
Conflicts: config/initializers/rails_footnotes.rb
This commit is contained in:
commit
99777cab2a
18 changed files with 70 additions and 15 deletions
1
Gemfile
1
Gemfile
|
@ -19,6 +19,7 @@ gem "albino", :git => "git://github.com/gitlabhq/albino.git"
|
||||||
gem "kaminari"
|
gem "kaminari"
|
||||||
gem "thin"
|
gem "thin"
|
||||||
gem "git"
|
gem "git"
|
||||||
|
gem "acts_as_list"
|
||||||
|
|
||||||
group :assets do
|
group :assets do
|
||||||
gem 'sass-rails', " ~> 3.1.0"
|
gem 'sass-rails', " ~> 3.1.0"
|
||||||
|
|
|
@ -61,6 +61,7 @@ GEM
|
||||||
activesupport (= 3.1.0)
|
activesupport (= 3.1.0)
|
||||||
activesupport (3.1.0)
|
activesupport (3.1.0)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
|
acts_as_list (0.1.4)
|
||||||
addressable (2.2.6)
|
addressable (2.2.6)
|
||||||
ansi (1.3.0)
|
ansi (1.3.0)
|
||||||
archive-tar-minitar (0.5.2)
|
archive-tar-minitar (0.5.2)
|
||||||
|
@ -240,6 +241,7 @@ PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
|
acts_as_list
|
||||||
albino!
|
albino!
|
||||||
annotate!
|
annotate!
|
||||||
autotest
|
autotest
|
||||||
|
|
BIN
app/assets/images/move.png
Normal file
BIN
app/assets/images/move.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 260 B |
|
@ -1,3 +0,0 @@
|
||||||
# Place all the behaviors and hooks related to the matching controller here.
|
|
||||||
# All this logic will automatically be available in application.js.
|
|
||||||
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
|
|
|
@ -1,3 +0,0 @@
|
||||||
# Place all the behaviors and hooks related to the matching controller here.
|
|
||||||
# All this logic will automatically be available in application.js.
|
|
||||||
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
|
|
|
@ -1,3 +0,0 @@
|
||||||
# Place all the behaviors and hooks related to the matching controller here.
|
|
||||||
# All this logic will automatically be available in application.js.
|
|
||||||
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
|
|
|
@ -34,6 +34,7 @@ $(document).ready(function(){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function focusSearch() {
|
function focusSearch() {
|
||||||
|
|
|
@ -539,3 +539,13 @@ tbody tr:nth-child(2n) td, tbody tr.even td {
|
||||||
float:left;
|
float:left;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.handle:hover{
|
||||||
|
cursor: move;
|
||||||
|
}
|
||||||
|
|
||||||
|
.handle{
|
||||||
|
width: 12px;
|
||||||
|
height: 12px;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ class IssuesController < ApplicationController
|
||||||
# Authorize
|
# Authorize
|
||||||
before_filter :add_project_abilities
|
before_filter :add_project_abilities
|
||||||
before_filter :authorize_read_issue!
|
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]
|
before_filter :authorize_admin_issue!, :only => [:destroy]
|
||||||
|
|
||||||
respond_to :js
|
respond_to :js
|
||||||
|
@ -69,4 +69,14 @@ class IssuesController < ApplicationController
|
||||||
format.js { render :nothing => true }
|
format.js { render :nothing => true }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def sort
|
||||||
|
@issues = @project.issues.all
|
||||||
|
@issues.each do |issue|
|
||||||
|
issue.position = params['issue'].index(issue.id.to_s) + 1
|
||||||
|
issue.save
|
||||||
|
end
|
||||||
|
|
||||||
|
render :nothing => true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,6 +21,8 @@ class Issue < ActiveRecord::Base
|
||||||
scope :opened, where(:closed => false)
|
scope :opened, where(:closed => false)
|
||||||
scope :closed, where(:closed => true)
|
scope :closed, where(:closed => true)
|
||||||
scope :assigned, lambda { |u| where(:assignee_id => u.id)}
|
scope :assigned, lambda { |u| where(:assignee_id => u.id)}
|
||||||
|
|
||||||
|
acts_as_list
|
||||||
end
|
end
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
|
|
|
@ -3,7 +3,7 @@ require "grit"
|
||||||
class Project < ActiveRecord::Base
|
class Project < ActiveRecord::Base
|
||||||
belongs_to :owner, :class_name => "User"
|
belongs_to :owner, :class_name => "User"
|
||||||
|
|
||||||
has_many :issues, :dependent => :destroy
|
has_many :issues, :dependent => :destroy, :order => "position"
|
||||||
has_many :users_projects, :dependent => :destroy
|
has_many :users_projects, :dependent => :destroy
|
||||||
has_many :users, :through => :users_projects
|
has_many :users, :through => :users_projects
|
||||||
has_many :notes, :dependent => :destroy
|
has_many :notes, :dependent => :destroy
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
%tr{ :id => dom_id(issue), :class => "issue", :url => project_issue_path(@project, issue) }
|
%tr{ :id => dom_id(issue), :class => "issue", :url => project_issue_path(@project, issue) }
|
||||||
%td
|
%td
|
||||||
|
= image_tag "move.png" , :class => [:handle, :left]
|
||||||
= image_tag gravatar_icon(issue.assignee.email), :class => "left", :width => 40, :style => "padding:0 5px;"
|
= image_tag gravatar_icon(issue.assignee.email), :class => "left", :width => 40, :style => "padding:0 5px;"
|
||||||
= truncate issue.assignee.name, :lenght => 20
|
= truncate issue.assignee.name, :lenght => 20
|
||||||
%td ##{issue.id}
|
%td ##{issue.id}
|
||||||
|
|
|
@ -22,3 +22,29 @@
|
||||||
:javascript
|
:javascript
|
||||||
$('.delete-issue').live('ajax:success', function() {
|
$('.delete-issue').live('ajax:success', function() {
|
||||||
$(this).closest('tr').fadeOut(); });
|
$(this).closest('tr').fadeOut(); });
|
||||||
|
|
||||||
|
function setSortable(){
|
||||||
|
$('#issues-table>tbody').sortable({
|
||||||
|
axis: 'y',
|
||||||
|
dropOnEmpty: false,
|
||||||
|
handle: '.handle',
|
||||||
|
cursor: 'crosshair',
|
||||||
|
items: 'tr',
|
||||||
|
opacity: 0.4,
|
||||||
|
scroll: true,
|
||||||
|
update: function(){
|
||||||
|
$.ajax({
|
||||||
|
type: 'post',
|
||||||
|
data: $('#issues-table>tbody').sortable('serialize'),
|
||||||
|
dataType: 'script',
|
||||||
|
complete: function(request){
|
||||||
|
$('#issues-table>tbody').effect('highlight');
|
||||||
|
},
|
||||||
|
url: "#{sort_project_issues_path(@project)}"})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$(function(){
|
||||||
|
setSortable();
|
||||||
|
});
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
:plain
|
:plain
|
||||||
$('#issues-table-holder').html("#{escape_javascript(render('issues'))}");
|
$('#issues-table-holder').html("#{escape_javascript(render('issues'))}");
|
||||||
|
setSortable();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
if defined?(Footnotes) && Rails.env.development?
|
#if defined?(Footnotes) && Rails.env.development?
|
||||||
#Footnotes.run! # first of all
|
#Footnotes.run! # first of all
|
||||||
|
|
||||||
# ... other init code
|
# ... other init code
|
||||||
end
|
#end
|
||||||
|
|
|
@ -40,7 +40,11 @@ Gitlab::Application.routes.draw do
|
||||||
end
|
end
|
||||||
resources :commits
|
resources :commits
|
||||||
resources :team_members
|
resources :team_members
|
||||||
resources :issues
|
resources :issues do
|
||||||
|
collection do
|
||||||
|
post :sort
|
||||||
|
end
|
||||||
|
end
|
||||||
resources :notes, :only => [:create, :destroy]
|
resources :notes, :only => [:create, :destroy]
|
||||||
end
|
end
|
||||||
root :to => "projects#index"
|
root :to => "projects#index"
|
||||||
|
|
5
db/migrate/20111015154310_add_position_to_issues.rb
Normal file
5
db/migrate/20111015154310_add_position_to_issues.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class AddPositionToIssues < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :issues, :position, :integer, :default => 0
|
||||||
|
end
|
||||||
|
end
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20111009111204) do
|
ActiveRecord::Schema.define(:version => 20111015154310) do
|
||||||
|
|
||||||
create_table "issues", :force => true do |t|
|
create_table "issues", :force => true do |t|
|
||||||
t.string "title"
|
t.string "title"
|
||||||
|
@ -22,6 +22,7 @@ ActiveRecord::Schema.define(:version => 20111009111204) do
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.boolean "closed", :default => false, :null => false
|
t.boolean "closed", :default => false, :null => false
|
||||||
|
t.integer "position", :default => 0
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "keys", :force => true do |t|
|
create_table "keys", :force => true do |t|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue