1.0.2
This commit is contained in:
parent
7b5799a979
commit
ef2bf15204
28 changed files with 104 additions and 37 deletions
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue