1.0.2
This commit is contained in:
parent
7b5799a979
commit
ef2bf15204
28 changed files with 104 additions and 37 deletions
1
Gemfile
1
Gemfile
|
@ -19,6 +19,7 @@ gem "albino", :git => "git://github.com/gitlabhq/albino.git"
|
|||
gem "kaminari"
|
||||
gem "thin"
|
||||
gem "git"
|
||||
gem "acts_as_list"
|
||||
|
||||
group :assets do
|
||||
gem 'sass-rails', " ~> 3.1.0"
|
||||
|
|
|
@ -61,6 +61,7 @@ GEM
|
|||
activesupport (= 3.1.0)
|
||||
activesupport (3.1.0)
|
||||
multi_json (~> 1.0)
|
||||
acts_as_list (0.1.4)
|
||||
addressable (2.2.6)
|
||||
ansi (1.3.0)
|
||||
archive-tar-minitar (0.5.2)
|
||||
|
@ -240,6 +241,7 @@ PLATFORMS
|
|||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
acts_as_list
|
||||
albino!
|
||||
annotate!
|
||||
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();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function focusSearch() {
|
||||
|
|
|
@ -539,3 +539,13 @@ tbody tr:nth-child(2n) td, tbody tr.even td {
|
|||
float:left;
|
||||
}
|
||||
}
|
||||
|
||||
.handle:hover{
|
||||
cursor: move;
|
||||
}
|
||||
|
||||
.handle{
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
padding: 10px;
|
||||
}
|
||||
|
|
|
@ -61,4 +61,8 @@ class ApplicationController < ActionController::Base
|
|||
def render_404
|
||||
render :file => File.join(Rails.root, "public", "404"), :layout => false, :status => "404"
|
||||
end
|
||||
|
||||
def require_non_empty_project
|
||||
redirect_to @project unless @project.repo_exists?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,6 +6,7 @@ class CommitsController < ApplicationController
|
|||
# Authorize
|
||||
before_filter :add_project_abilities
|
||||
before_filter :authorize_read_project!
|
||||
before_filter :require_non_empty_project
|
||||
|
||||
def index
|
||||
load_refs # load @branch, @tag & @ref
|
||||
|
|
|
@ -5,7 +5,7 @@ class IssuesController < ApplicationController
|
|||
# Authorize
|
||||
before_filter :add_project_abilities
|
||||
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]
|
||||
|
||||
respond_to :js
|
||||
|
@ -69,4 +69,14 @@ class IssuesController < ApplicationController
|
|||
format.js { render :nothing => true }
|
||||
end
|
||||
end
|
||||
|
||||
def sort
|
||||
@issues = @project.issues.where(:id => params['issue'])
|
||||
@issues.each do |issue|
|
||||
issue.position = params['issue'].index(issue.id.to_s) + 1
|
||||
issue.save
|
||||
end
|
||||
|
||||
render :nothing => true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,6 +6,8 @@ class ProjectsController < ApplicationController
|
|||
before_filter :authorize_read_project!, :except => [:index, :new, :create]
|
||||
before_filter :authorize_admin_project!, :only => [:edit, :update, :destroy]
|
||||
|
||||
before_filter :require_non_empty_project, :only => [:blob, :tree]
|
||||
|
||||
def index
|
||||
@projects = current_user.projects.all
|
||||
end
|
||||
|
@ -48,7 +50,7 @@ class ProjectsController < ApplicationController
|
|||
def update
|
||||
respond_to do |format|
|
||||
if project.update_attributes(params[:project])
|
||||
format.html { redirect_to project, notice: 'Project was successfully updated.' }
|
||||
format.html { redirect_to project, :notice => 'Project was successfully updated.' }
|
||||
format.js
|
||||
else
|
||||
format.html { render action: "edit" }
|
||||
|
|
|
@ -21,6 +21,8 @@ class Issue < ActiveRecord::Base
|
|||
scope :opened, where(:closed => false)
|
||||
scope :closed, where(:closed => true)
|
||||
scope :assigned, lambda { |u| where(:assignee_id => u.id)}
|
||||
|
||||
acts_as_list
|
||||
end
|
||||
# == Schema Information
|
||||
#
|
||||
|
|
|
@ -3,7 +3,7 @@ require "grit"
|
|||
class Project < ActiveRecord::Base
|
||||
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, :through => :users_projects
|
||||
has_many :notes, :dependent => :destroy
|
||||
|
@ -16,6 +16,8 @@ class Project < ActiveRecord::Base
|
|||
validates :path,
|
||||
:uniqueness => true,
|
||||
:presence => true,
|
||||
:format => { :with => /^[a-zA-Z0-9_\-]*$/,
|
||||
:message => "only letters, digits & '_' '-' allowed" },
|
||||
:length => { :within => 0..255 }
|
||||
|
||||
validates :description,
|
||||
|
@ -24,14 +26,15 @@ class Project < ActiveRecord::Base
|
|||
validates :code,
|
||||
:presence => true,
|
||||
:uniqueness => true,
|
||||
:length => { :within => 3..12 }
|
||||
:format => { :with => /^[a-zA-Z0-9_\-]*$/,
|
||||
:message => "only letters, digits & '_' '-' allowed" },
|
||||
:length => { :within => 3..16 }
|
||||
|
||||
validates :owner,
|
||||
:presence => true
|
||||
|
||||
validate :check_limit
|
||||
|
||||
before_save :format_code
|
||||
after_destroy :destroy_gitosis_project
|
||||
after_save :update_gitosis_project
|
||||
|
||||
|
@ -47,10 +50,6 @@ class Project < ActiveRecord::Base
|
|||
notes.where(:noteable_type => ["", nil])
|
||||
end
|
||||
|
||||
def format_code
|
||||
read_attribute(:code).downcase.strip.gsub(' ', '')
|
||||
end
|
||||
|
||||
def update_gitosis_project
|
||||
Gitosis.new.configure do |c|
|
||||
c.update_project(path, gitosis_writers)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
%tr{ :id => dom_id(issue), :class => "issue", :url => project_issue_path(@project, issue) }
|
||||
%td
|
||||
= image_tag "move.png" , :class => [:handle, :left]
|
||||
= image_tag gravatar_icon(issue.assignee.email), :class => "left", :width => 40, :style => "padding:0 5px;"
|
||||
= truncate issue.assignee.name, :lenght => 20
|
||||
%td ##{issue.id}
|
||||
|
|
|
@ -22,3 +22,29 @@
|
|||
:javascript
|
||||
$('.delete-issue').live('ajax:success', function() {
|
||||
$(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
|
||||
$('#issues-table-holder').html("#{escape_javascript(render('issues'))}");
|
||||
setSortable();
|
||||
|
|
|
@ -10,12 +10,13 @@
|
|||
</div>
|
||||
<div class="right">
|
||||
<%= link_to truncate(@project.name, :length => 20), project_path(@project), :class => "current button" if @project && !@project.new_record? %>
|
||||
<%= link_to 'Home', root_path, :class => current_page?(root_url) ? "current button" : "button" %>
|
||||
<%= link_to 'Projects', projects_path, :class => current_page?(projects_path) ? "current button" : "button" %>
|
||||
<%= link_to 'Profile', profile_path, :class => (controller.controller_name == "keys") ? "current button" : "button" %>
|
||||
<%= link_to('Admin', admin_root_path, :class => admin_namespace? ? "current button" : "button" ) if current_user.is_admin? %>
|
||||
<%#= link_to 'Profile', edit_user_registration_path, :class => "button" %>
|
||||
<%= link_to 'Logout', destroy_user_session_path, :class => "button", :method => :delete %>
|
||||
<%= link_to profile_path, :class => ((controller.controller_name == "keys" || controller.controller_name == "profile") ? "current button" : "button") do %>
|
||||
<%= image_tag gravatar_icon(current_user.email) %>
|
||||
<%= current_user.name.split(" ").first %>
|
||||
<% end %>
|
||||
<%= link_to 'Logout', destroy_user_session_path, :style => "border-left: 1px solid #666;", :class => "button", :method => :delete %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
%td{:align => "left", :style => "padding: 20px 0 0;"}
|
||||
%h2{:style => "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "}
|
||||
New comment for commmit
|
||||
= link_to truncate(@commit.id.to_s, :length => 16), project_commit_url(@project, :id => @commit.id)
|
||||
= link_to truncate(@commit.id.to_s, :length => 16), project_commit_url(@project, :id => @commit.id, :anchor => "note_#{@note.id}")
|
||||
%td{:style => "font-size: 1px; line-height: 1px;", :width => "21"}
|
||||
%tr
|
||||
%td{:style => "font-size: 1px; line-height: 1px;", :width => "21"}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
%td{:align => "left", :style => "padding: 20px 0 0;"}
|
||||
%h2{:style => "color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "}
|
||||
New comment -
|
||||
= link_to project_issue_url(@project, @issue) do
|
||||
= link_to project_issue_url(@project, @issue, :anchor => "note_#{@note.id}") do
|
||||
= "Issue ##{@issue.id.to_s}"
|
||||
= truncate(@issue.title, :length => 35)
|
||||
%td{:style => "font-size: 1px; line-height: 1px;", :width => "21"}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
%td{:align => "left", :style => "padding: 20px 0 0;"}
|
||||
%h2{:style => "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "}
|
||||
New message on
|
||||
= link_to "Project Wall", wall_project_url(@project)
|
||||
= link_to "Project Wall", wall_project_url(@project, :anchor => "note_#{@note.id}")
|
||||
%td{:style => "font-size: 1px; line-height: 1px;", :width => "21"}
|
||||
%tr
|
||||
%td{:style => "font-size: 1px; line-height: 1px;", :width => "21"}
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
%div{:class => "tile", :style => view_mode_style("tile")}
|
||||
= render "tile"
|
||||
%div{:class => "list", :style => view_mode_style("list")}
|
||||
= render "list"
|
||||
- unless @projects.empty?
|
||||
%div{:class => "tile", :style => view_mode_style("tile")}
|
||||
= render "tile"
|
||||
%div{:class => "list", :style => view_mode_style("list")}
|
||||
= render "list"
|
||||
- else
|
||||
%center.prepend-top
|
||||
%h2
|
||||
%cite Nothing here
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
if defined?(Footnotes) && Rails.env.development?
|
||||
Footnotes.run! # first of all
|
||||
#if defined?(Footnotes) && Rails.env.development?
|
||||
#Footnotes.run! # first of all
|
||||
|
||||
# ... other init code
|
||||
end
|
||||
#end
|
||||
|
|
|
@ -32,7 +32,7 @@ Gitlab::Application.routes.draw do
|
|||
get "tree/:commit_id/:path" => "projects#tree",
|
||||
:as => :tree_file,
|
||||
:constraints => {
|
||||
:id => /[a-zA-Z0-9]+/,
|
||||
:id => /[a-zA-Z0-9_\-]+/,
|
||||
:commit_id => /[a-zA-Z0-9]+/,
|
||||
:path => /.*/
|
||||
}
|
||||
|
@ -40,7 +40,11 @@ Gitlab::Application.routes.draw do
|
|||
end
|
||||
resources :commits
|
||||
resources :team_members
|
||||
resources :issues
|
||||
resources :issues do
|
||||
collection do
|
||||
post :sort
|
||||
end
|
||||
end
|
||||
resources :notes, :only => [:create, :destroy]
|
||||
end
|
||||
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.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20111009111204) do
|
||||
ActiveRecord::Schema.define(:version => 20111015154310) do
|
||||
|
||||
create_table "issues", :force => true do |t|
|
||||
t.string "title"
|
||||
|
@ -22,6 +22,7 @@ ActiveRecord::Schema.define(:version => 20111009111204) do
|
|||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.boolean "closed", :default => false, :null => false
|
||||
t.integer "position", :default => 0
|
||||
end
|
||||
|
||||
create_table "keys", :force => true do |t|
|
||||
|
|
|
@ -88,7 +88,7 @@ describe "Admin::Projects" do
|
|||
visit new_admin_project_path
|
||||
fill_in 'Name', :with => 'NewProject'
|
||||
fill_in 'Code', :with => 'NPR'
|
||||
fill_in 'Path', :with => '/tmp/legit_test/legit'
|
||||
fill_in 'Path', :with => 'legit_1'
|
||||
expect { click_button "Save" }.to change { Project.count }.by(1)
|
||||
@project = Project.last
|
||||
end
|
||||
|
|
|
@ -39,7 +39,7 @@ describe "Projects" do
|
|||
visit new_project_path
|
||||
fill_in 'Name', :with => 'NewProject'
|
||||
fill_in 'Code', :with => 'NPR'
|
||||
fill_in 'Path', :with => '/tmp/legit_test/legit'
|
||||
fill_in 'Path', :with => 'newproject'
|
||||
expect { click_button "Create Project" }.to change { Project.count }.by(1)
|
||||
@project = Project.last
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue