Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com>2011-10-15 22:39:11 +0400
committerDmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com>2011-10-15 22:39:11 +0400
commitef2bf1520489a23ff64224c3e102a03b46243dbf (patch)
tree6d28a936d98189867fd6f6faae4b169217cca526
parent7b5799a97998b68416f1b6233ce427135c99165a (diff)
1.0.2
-rw-r--r--Gemfile1
-rw-r--r--Gemfile.lock2
-rw-r--r--app/assets/images/move.pngbin0 -> 260 bytes
-rw-r--r--app/assets/javascripts/dashboard.js.coffee3
-rw-r--r--app/assets/javascripts/issues.js.coffee3
-rw-r--r--app/assets/javascripts/profile.js.coffee3
-rw-r--r--app/assets/javascripts/projects.js1
-rw-r--r--app/assets/stylesheets/projects.css.scss10
-rw-r--r--app/controllers/application_controller.rb4
-rw-r--r--app/controllers/commits_controller.rb1
-rw-r--r--app/controllers/issues_controller.rb12
-rw-r--r--app/controllers/projects_controller.rb4
-rw-r--r--app/models/issue.rb2
-rw-r--r--app/models/project.rb13
-rw-r--r--app/views/issues/_show.html.haml1
-rw-r--r--app/views/issues/index.html.haml26
-rw-r--r--app/views/issues/index.js.haml1
-rw-r--r--app/views/layouts/_head_panel.html.erb9
-rw-r--r--app/views/notify/note_commit_email.html.haml2
-rw-r--r--app/views/notify/note_issue_email.html.haml2
-rw-r--r--app/views/notify/note_wall_email.html.haml2
-rw-r--r--app/views/projects/index.html.haml13
-rw-r--r--config/initializers/rails_footnotes.rb6
-rw-r--r--config/routes.rb8
-rw-r--r--db/migrate/20111015154310_add_position_to_issues.rb5
-rw-r--r--db/schema.rb3
-rw-r--r--spec/requests/admin/admin_projects_spec.rb2
-rw-r--r--spec/requests/projects_spec.rb2
28 files changed, 104 insertions, 37 deletions
diff --git a/Gemfile b/Gemfile
index 374b50318b9..523793e7ca5 100644
--- a/Gemfile
+++ b/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"
diff --git a/Gemfile.lock b/Gemfile.lock
index c02ad3cdc18..2aa894aa87f 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -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
diff --git a/app/assets/images/move.png b/app/assets/images/move.png
new file mode 100644
index 00000000000..9d2d55ddf0b
--- /dev/null
+++ b/app/assets/images/move.png
Binary files differ
diff --git a/app/assets/javascripts/dashboard.js.coffee b/app/assets/javascripts/dashboard.js.coffee
deleted file mode 100644
index 761567942fc..00000000000
--- a/app/assets/javascripts/dashboard.js.coffee
+++ /dev/null
@@ -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/
diff --git a/app/assets/javascripts/issues.js.coffee b/app/assets/javascripts/issues.js.coffee
deleted file mode 100644
index 761567942fc..00000000000
--- a/app/assets/javascripts/issues.js.coffee
+++ /dev/null
@@ -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/
diff --git a/app/assets/javascripts/profile.js.coffee b/app/assets/javascripts/profile.js.coffee
deleted file mode 100644
index 761567942fc..00000000000
--- a/app/assets/javascripts/profile.js.coffee
+++ /dev/null
@@ -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/
diff --git a/app/assets/javascripts/projects.js b/app/assets/javascripts/projects.js
index dc13d006077..74f0e643c21 100644
--- a/app/assets/javascripts/projects.js
+++ b/app/assets/javascripts/projects.js
@@ -34,6 +34,7 @@ $(document).ready(function(){
e.preventDefault();
}
});
+
});
function focusSearch() {
diff --git a/app/assets/stylesheets/projects.css.scss b/app/assets/stylesheets/projects.css.scss
index 0ee40f512ac..bc15d8e2c12 100644
--- a/app/assets/stylesheets/projects.css.scss
+++ b/app/assets/stylesheets/projects.css.scss
@@ -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;
+}
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index f8eb238b1d2..2866d1a7358 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -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
diff --git a/app/controllers/commits_controller.rb b/app/controllers/commits_controller.rb
index af82b1cd901..83071891be4 100644
--- a/app/controllers/commits_controller.rb
+++ b/app/controllers/commits_controller.rb
@@ -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
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index f8b4719809b..6da5dea8bf7 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -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
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 1cc2fd63faa..e8f1c3925c9 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -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" }
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 0399607efe6..9b1b923eaa0 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -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
#
diff --git a/app/models/project.rb b/app/models/project.rb
index 17b556c3471..3c07976d24e 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -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)
diff --git a/app/views/issues/_show.html.haml b/app/views/issues/_show.html.haml
index 131d0d4c8a2..30157257ff5 100644
--- a/app/views/issues/_show.html.haml
+++ b/app/views/issues/_show.html.haml
@@ -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}
diff --git a/app/views/issues/index.html.haml b/app/views/issues/index.html.haml
index 7157d2c385d..6f4548a8066 100644
--- a/app/views/issues/index.html.haml
+++ b/app/views/issues/index.html.haml
@@ -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();
+ });
diff --git a/app/views/issues/index.js.haml b/app/views/issues/index.js.haml
index 1f051309233..bc18ac15151 100644
--- a/app/views/issues/index.js.haml
+++ b/app/views/issues/index.js.haml
@@ -1,2 +1,3 @@
:plain
$('#issues-table-holder').html("#{escape_javascript(render('issues'))}");
+ setSortable();
diff --git a/app/views/layouts/_head_panel.html.erb b/app/views/layouts/_head_panel.html.erb
index f32e4bc2b71..047f708b6df 100644
--- a/app/views/layouts/_head_panel.html.erb
+++ b/app/views/layouts/_head_panel.html.erb
@@ -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>
diff --git a/app/views/notify/note_commit_email.html.haml b/app/views/notify/note_commit_email.html.haml
index 09ae54ac629..81001d684c2 100644
--- a/app/views/notify/note_commit_email.html.haml
+++ b/app/views/notify/note_commit_email.html.haml
@@ -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"}
diff --git a/app/views/notify/note_issue_email.html.haml b/app/views/notify/note_issue_email.html.haml
index 54982af6286..242c97bf25f 100644
--- a/app/views/notify/note_issue_email.html.haml
+++ b/app/views/notify/note_issue_email.html.haml
@@ -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"}
diff --git a/app/views/notify/note_wall_email.html.haml b/app/views/notify/note_wall_email.html.haml
index 285fc763613..c9fdae12677 100644
--- a/app/views/notify/note_wall_email.html.haml
+++ b/app/views/notify/note_wall_email.html.haml
@@ -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"}
diff --git a/app/views/projects/index.html.haml b/app/views/projects/index.html.haml
index 22af6b7551a..888a72b6811 100644
--- a/app/views/projects/index.html.haml
+++ b/app/views/projects/index.html.haml
@@ -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
diff --git a/config/initializers/rails_footnotes.rb b/config/initializers/rails_footnotes.rb
index da9d58e4acb..db71e39c608 100644
--- a/config/initializers/rails_footnotes.rb
+++ b/config/initializers/rails_footnotes.rb
@@ -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
diff --git a/config/routes.rb b/config/routes.rb
index 00106b119a6..acf92536e3f 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -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"
diff --git a/db/migrate/20111015154310_add_position_to_issues.rb b/db/migrate/20111015154310_add_position_to_issues.rb
new file mode 100644
index 00000000000..41451a0cabb
--- /dev/null
+++ b/db/migrate/20111015154310_add_position_to_issues.rb
@@ -0,0 +1,5 @@
+class AddPositionToIssues < ActiveRecord::Migration
+ def change
+ add_column :issues, :position, :integer, :default => 0
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index befe0b2a518..ed37dbbb923 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -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|
diff --git a/spec/requests/admin/admin_projects_spec.rb b/spec/requests/admin/admin_projects_spec.rb
index 8aa311e8442..e36ee4411ff 100644
--- a/spec/requests/admin/admin_projects_spec.rb
+++ b/spec/requests/admin/admin_projects_spec.rb
@@ -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
diff --git a/spec/requests/projects_spec.rb b/spec/requests/projects_spec.rb
index 329f0a50435..2825a6a979a 100644
--- a/spec/requests/projects_spec.rb
+++ b/spec/requests/projects_spec.rb
@@ -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