Compare commits
320 Commits
integratio
...
1.1.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b33ecc41f9 | ||
|
|
78a4a995e6 | ||
|
|
465534a298 | ||
|
|
d5f1bd07b2 | ||
|
|
50863117b8 | ||
|
|
c6693fc78b | ||
|
|
1e01711e3d | ||
|
|
1ab7f6f930 | ||
|
|
f6f7467cdd | ||
|
|
4d0a955d3c | ||
|
|
c45044f13c | ||
|
|
4761e55691 | ||
|
|
af7fb657f4 | ||
|
|
0805ab943e | ||
|
|
9589c0bcad | ||
|
|
91295ea6cd | ||
|
|
d0f4b5aa50 | ||
|
|
008e8d4fbf | ||
|
|
1e50fea55a | ||
|
|
008d38d6b4 | ||
|
|
c61c9e6471 | ||
|
|
e5b5b61d6e | ||
|
|
6a8cdf54b3 | ||
|
|
e43d98a6f5 | ||
|
|
11b774d39d | ||
|
|
77c4667dbc | ||
|
|
f05fdd5cfa | ||
|
|
a0bb70ed2d | ||
|
|
1d5c3f7fba | ||
|
|
8b83aa1470 | ||
|
|
3a92721af4 | ||
|
|
b3218ba4d4 | ||
|
|
975ee2b522 | ||
|
|
27a319e66d | ||
|
|
7be5bf6e4d | ||
|
|
c73d4042d1 | ||
|
|
8270ad1e64 | ||
|
|
26016fbf43 | ||
|
|
307e4ceaa2 | ||
|
|
03085e85f9 | ||
|
|
1f4e0dc10c | ||
|
|
f69c95306d | ||
|
|
634ede3e8b | ||
|
|
c2a2979189 | ||
|
|
9800469943 | ||
|
|
e47f1d5595 | ||
|
|
135fe04d02 | ||
|
|
794d7c0959 | ||
|
|
b8f365f2a1 | ||
|
|
6188b9eddb | ||
|
|
96c4dc3f1e | ||
|
|
b877215261 | ||
|
|
788b143596 | ||
|
|
6a261eb5a0 | ||
|
|
007fbc00cf | ||
|
|
9b8b4b3bfc | ||
|
|
6734f91a72 | ||
|
|
5266346315 | ||
|
|
d426e4452b | ||
|
|
f8af1bebd7 | ||
|
|
6e695a4d1a | ||
|
|
e5b7c94cb4 | ||
|
|
9028e664c4 | ||
|
|
6318affd31 | ||
|
|
8794cd3344 | ||
|
|
2fcd4e5271 | ||
|
|
ea60705ca7 | ||
|
|
90bce4e366 | ||
|
|
9f7cc355ad | ||
|
|
6ee4c0bac7 | ||
|
|
b0f0bd1848 | ||
|
|
fe563a8802 | ||
|
|
8ebab00767 | ||
|
|
d97297e45d | ||
|
|
f06500dcce | ||
|
|
b098e2b63f | ||
|
|
151a49b319 | ||
|
|
ded234794e | ||
|
|
119732c3ee | ||
|
|
730fcef844 | ||
|
|
1cb33f3a95 | ||
|
|
69edd3c53f | ||
|
|
ad784e2146 | ||
|
|
c783ae4b3d | ||
|
|
dd87ebef58 | ||
|
|
82f528ddc8 | ||
|
|
ad62060753 | ||
|
|
f2ae2e9239 | ||
|
|
d2cc2861de | ||
|
|
e9a0e6dbc8 | ||
|
|
af7006dff6 | ||
|
|
0025a66200 | ||
|
|
03d4ecbbff | ||
|
|
21c0b868ae | ||
|
|
df9ea24136 | ||
|
|
07fe46e9df | ||
|
|
283d25d823 | ||
|
|
d076c19822 | ||
|
|
1ee7f31f4d | ||
|
|
d78a510642 | ||
|
|
3ef41c3131 | ||
|
|
759048e73a | ||
|
|
3b53ec20e6 | ||
|
|
c8dc7fff08 | ||
|
|
523febf9c1 | ||
|
|
72f58c4c40 | ||
|
|
0661cf6d87 | ||
|
|
703b0ec422 | ||
|
|
3d76a67a2e | ||
|
|
ef288fbff7 | ||
|
|
8a8ca40364 | ||
|
|
03397f605c | ||
|
|
c42b0ad6b7 | ||
|
|
4695754d2a | ||
|
|
339bcc97e0 | ||
|
|
6d4126f17e | ||
|
|
599bc45073 | ||
|
|
84dd413f22 | ||
|
|
f7529c94f6 | ||
|
|
7d7c67daba | ||
|
|
a7595ec191 | ||
|
|
93847ae337 | ||
|
|
525656a490 | ||
|
|
86e17ce74f | ||
|
|
0c24f88ce1 | ||
|
|
df88dc117f | ||
|
|
620c1e2789 | ||
|
|
8a86b2d2bc | ||
|
|
084e9e2e57 | ||
|
|
74a94ed4ad | ||
|
|
88a802b25e | ||
|
|
edc35d4d5b | ||
|
|
98c7c179ca | ||
|
|
8f7da03419 | ||
|
|
27f76d20ce | ||
|
|
1c3823cbb0 | ||
|
|
bc1703d7b6 | ||
|
|
4f4a62c6d0 | ||
|
|
3c1576e364 | ||
|
|
9f18426ca7 | ||
|
|
252dcad3f6 | ||
|
|
b48291ec63 | ||
|
|
6a586c39e9 | ||
|
|
335f8da5e8 | ||
|
|
9ac043a096 | ||
|
|
17f86d964f | ||
|
|
f9f1bd58d6 | ||
|
|
e120f2aab4 | ||
|
|
a8cf13e8c8 | ||
|
|
ac60fc9c1c | ||
|
|
aaee26ae22 | ||
|
|
29e0bca43a | ||
|
|
a8b12bcb52 | ||
|
|
758f2f0a4e | ||
|
|
a49c7f95e2 | ||
|
|
0a2ec6ef04 | ||
|
|
87ae744dce | ||
|
|
2066b2f666 | ||
|
|
9e2d401f43 | ||
|
|
1d4f28a54d | ||
|
|
e4f319fe61 | ||
|
|
cde02954c8 | ||
|
|
a4d7a99c22 | ||
|
|
3409333522 | ||
|
|
8407db9854 | ||
|
|
00d50157d3 | ||
|
|
67f1131a20 | ||
|
|
f2b42237d0 | ||
|
|
5f57bceabb | ||
|
|
10ba08ce13 | ||
|
|
cd71c1cc0a | ||
|
|
ab6a93b029 | ||
|
|
252e4983fb | ||
|
|
3e3315c103 | ||
|
|
0e19aa4362 | ||
|
|
8524d505c5 | ||
|
|
b898200803 | ||
|
|
4715a37937 | ||
|
|
318bd10c7f | ||
|
|
9c6377964c | ||
|
|
b17e145d75 | ||
|
|
b0a1a04008 | ||
|
|
bfa61c1ec4 | ||
|
|
d7c607fd8b | ||
|
|
80e0e1c544 | ||
|
|
8841ba97c6 | ||
|
|
7fb0fe2e91 | ||
|
|
224921460a | ||
|
|
9157482049 | ||
|
|
88e593ee02 | ||
|
|
558a951ed6 | ||
|
|
37ed02553a | ||
|
|
f7cf8aa878 | ||
|
|
9284a32c9a | ||
|
|
f6c633212a | ||
|
|
735a83c596 | ||
|
|
eaf6bb1e9b | ||
|
|
a1f12e3ade | ||
|
|
d0a3aab2e7 | ||
|
|
ea59d93dc8 | ||
|
|
e9775097ec | ||
|
|
96ce0f017c | ||
|
|
483133285e | ||
|
|
a52417eca9 | ||
|
|
c78f442095 | ||
|
|
ae3fd4cb59 | ||
|
|
3d6cb1435c | ||
|
|
054b7d28f1 | ||
|
|
8458faed11 | ||
|
|
d24e66370b | ||
|
|
620c48fbbb | ||
|
|
4faca3cd4a | ||
|
|
97140f6a78 | ||
|
|
4a6a551d07 | ||
|
|
d180c833b9 | ||
|
|
6608cda084 | ||
|
|
ec3975ef5b | ||
|
|
dfc76ce642 | ||
|
|
7087a53f27 | ||
|
|
cfc3ee4f5a | ||
|
|
77c6188ec2 | ||
|
|
1158716f46 | ||
|
|
6b72c66893 | ||
|
|
1f237388bd | ||
|
|
06b0176a3e | ||
|
|
427ec05c8b | ||
|
|
0f55adf31a | ||
|
|
8bb75da1ac | ||
|
|
3ba3c540fb | ||
|
|
3e95d12b75 | ||
|
|
ee91e34096 | ||
|
|
2fab7bd9b1 | ||
|
|
2ee45e8cac | ||
|
|
c4a218358f | ||
|
|
d7cdd58db6 | ||
|
|
97a9210483 | ||
|
|
8ef06826c3 | ||
|
|
eaab2ede76 | ||
|
|
abf988ad69 | ||
|
|
d4ab2ab4b9 | ||
|
|
e0e8c14c2a | ||
|
|
0eb7d8f614 | ||
|
|
aa84e6c179 | ||
|
|
fa3d71bed9 | ||
|
|
7482d2f5f4 | ||
|
|
44c9ad687f | ||
|
|
63866407f1 | ||
|
|
2ca9bb3cca | ||
|
|
635c177eea | ||
|
|
d9e960873c | ||
|
|
f8ca6e58aa | ||
|
|
475530e59f | ||
|
|
3b01ea9fa4 | ||
|
|
ae498a06e2 | ||
|
|
dca6fb92f9 | ||
|
|
1c047dfeb8 | ||
|
|
7f9d2b0804 | ||
|
|
024ff96ee2 | ||
|
|
666c54e86c | ||
|
|
f79a6f701a | ||
|
|
338e407a91 | ||
|
|
6f841b7f43 | ||
|
|
8a2aa5d217 | ||
|
|
b67e4a87e4 | ||
|
|
c50b611f85 | ||
|
|
73167fb4f2 | ||
|
|
c55e060bab | ||
|
|
7d934c984a | ||
|
|
4b1dd334a5 | ||
|
|
c967899b14 | ||
|
|
30dc4fec99 | ||
|
|
7e359d3d7e | ||
|
|
0395eb99de | ||
|
|
a04d64881c | ||
|
|
27049b848d | ||
|
|
bed79f523b | ||
|
|
d5fde17bf5 | ||
|
|
db2ecd3010 | ||
|
|
ba56b3f763 | ||
|
|
b2eeeb6fa0 | ||
|
|
147a16cbf8 | ||
|
|
7c5497db65 | ||
|
|
abb83f4c4f | ||
|
|
f8b79c52cb | ||
|
|
55cf64393d | ||
|
|
31b9868fc1 | ||
|
|
c91ca4fcd9 | ||
|
|
1cf67b3a1d | ||
|
|
5d6245b059 | ||
|
|
8dc0d4b916 | ||
|
|
c514dd6885 | ||
|
|
e7e7a91b85 | ||
|
|
6ffcbaa7b3 | ||
|
|
1b1a059d90 | ||
|
|
d41391e87a | ||
|
|
8ebe03ef86 | ||
|
|
cc9d356a55 | ||
|
|
e9efa5b981 | ||
|
|
70bf0706b2 | ||
|
|
17eab0f5f9 | ||
|
|
c399e76324 | ||
|
|
397222f198 | ||
|
|
22e3cba0b7 | ||
|
|
4b045badcf | ||
|
|
0e951c0716 | ||
|
|
d9f2bccf70 | ||
|
|
d642964035 | ||
|
|
7824eca775 | ||
|
|
eea456ed84 | ||
|
|
1e4776fa64 | ||
|
|
a29c35e08f | ||
|
|
0ca74df604 | ||
|
|
a6f891d1b1 | ||
|
|
ed608cb7d3 | ||
|
|
b7e3f80e14 | ||
|
|
b1921830de | ||
|
|
d8ef4b6f4d | ||
|
|
d0bbe830ad | ||
|
|
dc26fd215b | ||
|
|
d9652183f6 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,3 +1,5 @@
|
||||
/.project
|
||||
/.loadpath
|
||||
/config/additional_environment.rb
|
||||
/config/database.yml
|
||||
/config/email.yml
|
||||
|
||||
24
.hgignore
Normal file
24
.hgignore
Normal file
@@ -0,0 +1,24 @@
|
||||
syntax: glob
|
||||
|
||||
.project
|
||||
.loadpath
|
||||
config/additional_environment.rb
|
||||
config/database.yml
|
||||
config/email.yml
|
||||
config/initializers/session_store.rb
|
||||
coverage
|
||||
db/*.db
|
||||
db/*.sqlite3
|
||||
db/schema.rb
|
||||
files/*
|
||||
log/*.log*
|
||||
log/mongrel_debug
|
||||
public/dispatch.*
|
||||
public/plugin_assets
|
||||
tmp/*
|
||||
tmp/cache/*
|
||||
tmp/sessions/*
|
||||
tmp/sockets/*
|
||||
tmp/test/*
|
||||
vendor/rails
|
||||
*.rbc
|
||||
@@ -23,7 +23,7 @@ class ActivitiesController < ApplicationController
|
||||
|
||||
events = @activity.events(@date_from, @date_to)
|
||||
|
||||
if events.empty? || stale?(:etag => [events.first, User.current])
|
||||
if events.empty? || stale?(:etag => [@activity.scope, @date_to, @date_from, @with_subprojects, @author, events.first, User.current, current_language])
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
@events_by_day = events.group_by(&:event_date)
|
||||
|
||||
@@ -22,7 +22,7 @@ class ApplicationController < ActionController::Base
|
||||
include Redmine::I18n
|
||||
|
||||
layout 'base'
|
||||
exempt_from_layout 'builder'
|
||||
exempt_from_layout 'builder', 'rsb'
|
||||
|
||||
# Remove broken cookie after upgrade from 0.8.x (#4292)
|
||||
# See https://rails.lighthouseapp.com/projects/8994/tickets/3360
|
||||
@@ -71,10 +71,10 @@ class ApplicationController < ActionController::Base
|
||||
elsif params[:format] == 'atom' && params[:key] && accept_key_auth_actions.include?(params[:action])
|
||||
# RSS key authentication does not start a session
|
||||
User.find_by_rss_key(params[:key])
|
||||
elsif Setting.rest_api_enabled? && ['xml', 'json'].include?(params[:format])
|
||||
if params[:key].present? && accept_key_auth_actions.include?(params[:action])
|
||||
elsif Setting.rest_api_enabled? && api_request?
|
||||
if (key = api_key_from_request) && accept_key_auth_actions.include?(params[:action])
|
||||
# Use API key
|
||||
User.find_by_api_key(params[:key])
|
||||
User.find_by_api_key(key)
|
||||
else
|
||||
# HTTP Basic, either username/password or API key/random
|
||||
authenticate_with_http_basic do |username, password|
|
||||
@@ -154,7 +154,15 @@ class ApplicationController < ActionController::Base
|
||||
# Authorize the user for the requested action
|
||||
def authorize(ctrl = params[:controller], action = params[:action], global = false)
|
||||
allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @project || @projects, :global => global)
|
||||
allowed ? true : deny_access
|
||||
if allowed
|
||||
true
|
||||
else
|
||||
if @project && @project.archived?
|
||||
render_403 :message => :notice_not_authorized_archived_project
|
||||
else
|
||||
deny_access
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Authorize the user for the requested action outside a project
|
||||
@@ -265,39 +273,33 @@ class ApplicationController < ActionController::Base
|
||||
redirect_to default
|
||||
end
|
||||
|
||||
def render_403
|
||||
def render_403(options={})
|
||||
@project = nil
|
||||
respond_to do |format|
|
||||
format.html { render :template => "common/403", :layout => use_layout, :status => 403 }
|
||||
format.atom { head 403 }
|
||||
format.xml { head 403 }
|
||||
format.js { head 403 }
|
||||
format.json { head 403 }
|
||||
end
|
||||
render_error({:message => :notice_not_authorized, :status => 403}.merge(options))
|
||||
return false
|
||||
end
|
||||
|
||||
def render_404
|
||||
respond_to do |format|
|
||||
format.html { render :template => "common/404", :layout => use_layout, :status => 404 }
|
||||
format.atom { head 404 }
|
||||
format.xml { head 404 }
|
||||
format.js { head 404 }
|
||||
format.json { head 404 }
|
||||
end
|
||||
def render_404(options={})
|
||||
render_error({:message => :notice_file_not_found, :status => 404}.merge(options))
|
||||
return false
|
||||
end
|
||||
|
||||
def render_error(msg)
|
||||
# Renders an error response
|
||||
def render_error(arg)
|
||||
arg = {:message => arg} unless arg.is_a?(Hash)
|
||||
|
||||
@message = arg[:message]
|
||||
@message = l(@message) if @message.is_a?(Symbol)
|
||||
@status = arg[:status] || 500
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
flash.now[:error] = msg
|
||||
render :text => '', :layout => use_layout, :status => 500
|
||||
format.html {
|
||||
render :template => 'common/error', :layout => use_layout, :status => @status
|
||||
}
|
||||
format.atom { head 500 }
|
||||
format.xml { head 500 }
|
||||
format.js { head 500 }
|
||||
format.json { head 500 }
|
||||
format.atom { head @status }
|
||||
format.xml { head @status }
|
||||
format.js { head @status }
|
||||
format.json { head @status }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -347,6 +349,30 @@ class ApplicationController < ActionController::Base
|
||||
per_page
|
||||
end
|
||||
|
||||
# Returns offset and limit used to retrieve objects
|
||||
# for an API response based on offset, limit and page parameters
|
||||
def api_offset_and_limit(options=params)
|
||||
if options[:offset].present?
|
||||
offset = options[:offset].to_i
|
||||
if offset < 0
|
||||
offset = 0
|
||||
end
|
||||
end
|
||||
limit = options[:limit].to_i
|
||||
if limit < 1
|
||||
limit = 25
|
||||
elsif limit > 100
|
||||
limit = 100
|
||||
end
|
||||
if offset.nil? && options[:page].present?
|
||||
offset = (options[:page].to_i - 1) * limit
|
||||
offset = 0 if offset < 0
|
||||
end
|
||||
offset ||= 0
|
||||
|
||||
[offset, limit]
|
||||
end
|
||||
|
||||
# qvalues http header parser
|
||||
# code taken from webrick
|
||||
def parse_qvalues(value)
|
||||
@@ -376,6 +402,15 @@ class ApplicationController < ActionController::Base
|
||||
def api_request?
|
||||
%w(xml json).include? params[:format]
|
||||
end
|
||||
|
||||
# Returns the API key present in the request
|
||||
def api_key_from_request
|
||||
if params[:key].present?
|
||||
params[:key]
|
||||
elsif request.headers["X-Redmine-API-Key"].present?
|
||||
request.headers["X-Redmine-API-Key"]
|
||||
end
|
||||
end
|
||||
|
||||
# Renders a warning flash if obj has unsaved attachments
|
||||
def render_attachment_warning_if_needed(obj)
|
||||
@@ -411,5 +446,37 @@ class ApplicationController < ActionController::Base
|
||||
{ attribute => error }
|
||||
end.to_json
|
||||
end
|
||||
|
||||
# Renders API response on validation failure
|
||||
def render_validation_errors(object)
|
||||
options = { :status => :unprocessable_entity, :layout => false }
|
||||
options.merge!(case params[:format]
|
||||
when 'xml'; { :xml => object.errors }
|
||||
when 'json'; { :json => {'errors' => object.errors} } # ActiveResource client compliance
|
||||
else
|
||||
raise "Unknown format #{params[:format]} in #render_validation_errors"
|
||||
end
|
||||
)
|
||||
render options
|
||||
end
|
||||
|
||||
# Overrides #default_template so that the api template
|
||||
# is used automatically if it exists
|
||||
def default_template(action_name = self.action_name)
|
||||
if api_request?
|
||||
begin
|
||||
return self.view_paths.find_template(default_template_name(action_name), 'api')
|
||||
rescue ::ActionView::MissingTemplate
|
||||
# the api template was not found
|
||||
# fallback to the default behaviour
|
||||
end
|
||||
end
|
||||
super
|
||||
end
|
||||
|
||||
# Overrides #pick_layout so that #render with no arguments
|
||||
# doesn't use the layout for api requests
|
||||
def pick_layout(*args)
|
||||
api_request? ? nil : super
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,12 +4,14 @@ class AutoCompletesController < ApplicationController
|
||||
def issues
|
||||
@issues = []
|
||||
q = params[:q].to_s
|
||||
query = (params[:scope] == "all" && Setting.cross_project_issue_relations?) ? Issue : @project.issues
|
||||
if q.match(/^\d+$/)
|
||||
@issues << @project.issues.visible.find_by_id(q.to_i)
|
||||
@issues << query.visible.find_by_id(q.to_i)
|
||||
end
|
||||
unless q.blank?
|
||||
@issues += @project.issues.visible.find(:all, :conditions => ["LOWER(#{Issue.table_name}.subject) LIKE ?", "%#{q.downcase}%"], :limit => 10)
|
||||
@issues += query.visible.find(:all, :conditions => ["LOWER(#{Issue.table_name}.subject) LIKE ?", "%#{q.downcase}%"], :limit => 10)
|
||||
end
|
||||
@issues.compact!
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@ class ContextMenusController < ApplicationController
|
||||
helper :watchers
|
||||
|
||||
def issues
|
||||
@issues = Issue.find_all_by_id(params[:ids], :include => :project)
|
||||
@issues = Issue.visible.all(:conditions => {:id => params[:ids]}, :include => :project)
|
||||
|
||||
if (@issues.size == 1)
|
||||
@issue = @issues.first
|
||||
@allowed_statuses = @issue.new_statuses_allowed_to(User.current)
|
||||
|
||||
@@ -18,6 +18,7 @@ class IssueMovesController < ApplicationController
|
||||
@issues.each do |issue|
|
||||
issue.reload
|
||||
issue.init_journal(User.current)
|
||||
issue.current_journal.notes = @notes if @notes.present?
|
||||
call_hook(:controller_issues_move_before_save, { :params => params, :issue => issue, :target_project => @target_project, :copy => !!@copy })
|
||||
if r = issue.move_to_project(@target_project, new_tracker, {:copy => @copy, :attributes => extract_changed_attributes_for_move(params)})
|
||||
moved_issues << r
|
||||
@@ -50,11 +51,13 @@ class IssueMovesController < ApplicationController
|
||||
@target_project ||= @project
|
||||
@trackers = @target_project.trackers
|
||||
@available_statuses = Workflow.available_statuses(@project)
|
||||
@notes = params[:notes]
|
||||
@notes ||= ''
|
||||
end
|
||||
|
||||
def extract_changed_attributes_for_move(params)
|
||||
changed_attributes = {}
|
||||
[:assigned_to_id, :status_id, :start_date, :due_date].each do |valid_attribute|
|
||||
[:assigned_to_id, :status_id, :start_date, :due_date, :priority_id].each do |valid_attribute|
|
||||
unless params[valid_attribute].blank?
|
||||
changed_attributes[valid_attribute] = (params[valid_attribute] == 'none' ? nil : params[valid_attribute])
|
||||
end
|
||||
|
||||
@@ -28,6 +28,7 @@ class IssueRelationsController < ApplicationController
|
||||
respond_to do |format|
|
||||
format.html { redirect_to :controller => 'issues', :action => 'show', :id => @issue }
|
||||
format.js do
|
||||
@relations = @issue.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? }
|
||||
render :update do |page|
|
||||
page.replace_html "relations", :partial => 'issues/relations'
|
||||
if @relation.errors.empty?
|
||||
@@ -47,7 +48,10 @@ class IssueRelationsController < ApplicationController
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html { redirect_to :controller => 'issues', :action => 'show', :id => @issue }
|
||||
format.js { render(:update) {|page| page.replace_html "relations", :partial => 'issues/relations'} }
|
||||
format.js {
|
||||
@relations = @issue.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? }
|
||||
render(:update) {|page| page.replace_html "relations", :partial => 'issues/relations'}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ class IssuesController < ApplicationController
|
||||
before_filter :find_optional_project, :only => [:index]
|
||||
before_filter :check_for_default_issue_status, :only => [:new, :create]
|
||||
before_filter :build_new_issue_from_params, :only => [:new, :create]
|
||||
accept_key_auth :index, :show
|
||||
accept_key_auth :index, :show, :create, :update, :destroy
|
||||
|
||||
rescue_from Query::StatementInvalid, :with => :query_statement_invalid
|
||||
|
||||
@@ -44,6 +44,8 @@ class IssuesController < ApplicationController
|
||||
include AttachmentsHelper
|
||||
helper :queries
|
||||
include QueriesHelper
|
||||
helper :repositories
|
||||
include RepositoriesHelper
|
||||
helper :sort
|
||||
include SortHelper
|
||||
include IssuesHelper
|
||||
@@ -65,27 +67,29 @@ class IssuesController < ApplicationController
|
||||
sort_update(@query.sortable_columns)
|
||||
|
||||
if @query.valid?
|
||||
limit = case params[:format]
|
||||
case params[:format]
|
||||
when 'csv', 'pdf'
|
||||
Setting.issues_export_limit.to_i
|
||||
@limit = Setting.issues_export_limit.to_i
|
||||
when 'atom'
|
||||
Setting.feeds_limit.to_i
|
||||
@limit = Setting.feeds_limit.to_i
|
||||
when 'xml', 'json'
|
||||
@offset, @limit = api_offset_and_limit
|
||||
else
|
||||
per_page_option
|
||||
@limit = per_page_option
|
||||
end
|
||||
|
||||
@issue_count = @query.issue_count
|
||||
@issue_pages = Paginator.new self, @issue_count, limit, params['page']
|
||||
@issue_pages = Paginator.new self, @issue_count, @limit, params['page']
|
||||
@offset ||= @issue_pages.current.offset
|
||||
@issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version],
|
||||
:order => sort_clause,
|
||||
:offset => @issue_pages.current.offset,
|
||||
:limit => limit)
|
||||
:offset => @offset,
|
||||
:limit => @limit)
|
||||
@issue_count_by_group = @query.issue_count_by_group
|
||||
|
||||
respond_to do |format|
|
||||
format.html { render :template => 'issues/index.rhtml', :layout => !request.xhr? }
|
||||
format.xml { render :layout => false }
|
||||
format.json { render :text => @issues.to_json, :layout => false }
|
||||
format.api
|
||||
format.atom { render_feed(@issues, :title => "#{@project || Setting.app_title}: #{l(:label_issue_plural)}") }
|
||||
format.csv { send_data(issues_to_csv(@issues, @project), :type => 'text/csv; header=present', :filename => 'export.csv') }
|
||||
format.pdf { send_data(issues_to_pdf(@issues, @project, @query), :type => 'application/pdf', :filename => 'export.pdf') }
|
||||
@@ -104,14 +108,14 @@ class IssuesController < ApplicationController
|
||||
@journals.reverse! if User.current.wants_comments_in_reverse_order?
|
||||
@changesets = @issue.changesets.visible.all
|
||||
@changesets.reverse! if User.current.wants_comments_in_reverse_order?
|
||||
@relations = @issue.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? }
|
||||
@allowed_statuses = @issue.new_statuses_allowed_to(User.current)
|
||||
@edit_allowed = User.current.allowed_to?(:edit_issues, @project)
|
||||
@priorities = IssuePriority.all
|
||||
@time_entry = TimeEntry.new
|
||||
respond_to do |format|
|
||||
format.html { render :template => 'issues/show.rhtml' }
|
||||
format.xml { render :layout => false }
|
||||
format.json { render :text => @issue.to_json, :layout => false }
|
||||
format.api
|
||||
format.atom { render :template => 'journals/index', :layout => false, :content_type => 'application/atom+xml' }
|
||||
format.pdf { send_data(issue_to_pdf(@issue), :type => 'application/pdf', :filename => "#{@project.identifier}-#{@issue.id}.pdf") }
|
||||
end
|
||||
@@ -138,23 +142,17 @@ class IssuesController < ApplicationController
|
||||
redirect_to(params[:continue] ? { :action => 'new', :project_id => @project, :issue => {:tracker_id => @issue.tracker, :parent_issue_id => @issue.parent_issue_id}.reject {|k,v| v.nil?} } :
|
||||
{ :action => 'show', :id => @issue })
|
||||
}
|
||||
format.xml { render :action => 'show', :status => :created, :location => url_for(:controller => 'issues', :action => 'show', :id => @issue) }
|
||||
format.json { render :text => @issue.to_json, :status => :created, :location => url_for(:controller => 'issues', :action => 'show'), :layout => false }
|
||||
format.api { render :action => 'show', :status => :created, :location => issue_url(@issue) }
|
||||
end
|
||||
return
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html { render :action => 'new' }
|
||||
format.xml { render(:xml => @issue.errors, :status => :unprocessable_entity); return }
|
||||
format.json { render :text => object_errors_to_json(@issue), :status => :unprocessable_entity, :layout => false }
|
||||
format.api { render_validation_errors(@issue) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Attributes that can be updated on workflow transition (without :edit permission)
|
||||
# TODO: make it configurable (at least per role)
|
||||
UPDATABLE_ATTRS_ON_TRANSITION = %w(status_id assigned_to_id fixed_version_id done_ratio) unless const_defined?(:UPDATABLE_ATTRS_ON_TRANSITION)
|
||||
|
||||
|
||||
def edit
|
||||
update_issue_from_params
|
||||
|
||||
@@ -175,8 +173,7 @@ class IssuesController < ApplicationController
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_back_or_default({:action => 'show', :id => @issue}) }
|
||||
format.xml { head :ok }
|
||||
format.json { head :ok }
|
||||
format.api { head :ok }
|
||||
end
|
||||
else
|
||||
render_attachment_warning_if_needed(@issue)
|
||||
@@ -185,8 +182,7 @@ class IssuesController < ApplicationController
|
||||
|
||||
respond_to do |format|
|
||||
format.html { render :action => 'edit' }
|
||||
format.xml { render :xml => @issue.errors, :status => :unprocessable_entity }
|
||||
format.json { render :text => object_errors_to_json(@issue), :status => :unprocessable_entity, :layout => false }
|
||||
format.api { render_validation_errors(@issue) }
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -236,17 +232,14 @@ class IssuesController < ApplicationController
|
||||
TimeEntry.update_all("issue_id = #{reassign_to.id}", ['issue_id IN (?)', @issues])
|
||||
end
|
||||
else
|
||||
unless params[:format] == 'xml' || params[:format] == 'json'
|
||||
# display the destroy form if it's a user request
|
||||
return
|
||||
end
|
||||
# display the destroy form if it's a user request
|
||||
return unless api_request?
|
||||
end
|
||||
end
|
||||
@issues.each(&:destroy)
|
||||
respond_to do |format|
|
||||
format.html { redirect_back_or_default(:action => 'index', :project_id => @project) }
|
||||
format.xml { head :ok }
|
||||
format.json { head :ok }
|
||||
format.api { head :ok }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -273,17 +266,11 @@ private
|
||||
@priorities = IssuePriority.all
|
||||
@edit_allowed = User.current.allowed_to?(:edit_issues, @project)
|
||||
@time_entry = TimeEntry.new
|
||||
@time_entry.attributes = params[:time_entry]
|
||||
|
||||
@notes = params[:notes] || (params[:issue].present? ? params[:issue][:notes] : nil)
|
||||
@issue.init_journal(User.current, @notes)
|
||||
# User can change issue attributes only if he has :edit permission or if a workflow transition is allowed
|
||||
if (@edit_allowed || !@allowed_statuses.empty?) && params[:issue]
|
||||
attrs = params[:issue].dup
|
||||
attrs.delete_if {|k,v| !UPDATABLE_ATTRS_ON_TRANSITION.include?(k) } unless @edit_allowed
|
||||
attrs.delete(:status_id) unless @allowed_statuses.detect {|s| s.id.to_s == attrs[:status_id].to_s}
|
||||
@issue.safe_attributes = attrs
|
||||
end
|
||||
|
||||
@issue.safe_attributes = params[:issue]
|
||||
end
|
||||
|
||||
# TODO: Refactor, lots of extra code in here
|
||||
@@ -304,6 +291,7 @@ private
|
||||
render_error l(:error_no_tracker_in_project)
|
||||
return false
|
||||
end
|
||||
@issue.start_date ||= Date.today
|
||||
if params[:issue].is_a?(Hash)
|
||||
@issue.safe_attributes = params[:issue]
|
||||
if User.current.allowed_to?(:add_issue_watchers, @project) && @issue.new_record?
|
||||
@@ -311,7 +299,6 @@ private
|
||||
end
|
||||
end
|
||||
@issue.author = User.current
|
||||
@issue.start_date ||= Date.today
|
||||
@priorities = IssuePriority.all
|
||||
@allowed_statuses = @issue.new_statuses_allowed_to(User.current, true)
|
||||
end
|
||||
|
||||
@@ -19,9 +19,11 @@ class JournalsController < ApplicationController
|
||||
before_filter :find_journal, :only => [:edit]
|
||||
before_filter :find_issue, :only => [:new]
|
||||
before_filter :find_optional_project, :only => [:index]
|
||||
before_filter :authorize, :only => [:new, :edit]
|
||||
accept_key_auth :index
|
||||
|
||||
helper :issues
|
||||
helper :custom_fields
|
||||
helper :queries
|
||||
include QueriesHelper
|
||||
helper :sort
|
||||
@@ -74,6 +76,14 @@ class JournalsController < ApplicationController
|
||||
format.html { redirect_to :controller => 'issues', :action => 'show', :id => @journal.journalized_id }
|
||||
format.js { render :action => 'update' }
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
# TODO: implement non-JS journal update
|
||||
render :nothing => true
|
||||
}
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ class MyController < ApplicationController
|
||||
before_filter :require_login
|
||||
|
||||
helper :issues
|
||||
helper :users
|
||||
helper :custom_fields
|
||||
|
||||
BLOCKS = { 'issuesassignedtome' => :label_assigned_to_me_issues,
|
||||
@@ -53,21 +54,18 @@ class MyController < ApplicationController
|
||||
@user = User.current
|
||||
@pref = @user.pref
|
||||
if request.post?
|
||||
@user.attributes = params[:user]
|
||||
@user.mail_notification = params[:notification_option] || 'only_my_events'
|
||||
@user.safe_attributes = params[:user]
|
||||
@user.pref.attributes = params[:pref]
|
||||
@user.pref[:no_self_notified] = (params[:no_self_notified] == '1')
|
||||
if @user.save
|
||||
@user.pref.save
|
||||
@user.notified_project_ids = (params[:notification_option] == 'selected' ? params[:notified_project_ids] : [])
|
||||
@user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : [])
|
||||
set_language_if_valid @user.language
|
||||
flash[:notice] = l(:notice_account_updated)
|
||||
redirect_to :action => 'account'
|
||||
return
|
||||
end
|
||||
end
|
||||
@notification_options = @user.valid_notification_options
|
||||
@notification_option = @user.mail_notification #? ? 'all' : (@user.notified_projects_ids.empty? ? 'none' : 'selected')
|
||||
end
|
||||
|
||||
# Manage user's password
|
||||
|
||||
@@ -26,15 +26,26 @@ class NewsController < ApplicationController
|
||||
accept_key_auth :index
|
||||
|
||||
def index
|
||||
@news_pages, @newss = paginate :news,
|
||||
:per_page => 10,
|
||||
:conditions => Project.allowed_to_condition(User.current, :view_news, :project => @project),
|
||||
:include => [:author, :project],
|
||||
:order => "#{News.table_name}.created_on DESC"
|
||||
case params[:format]
|
||||
when 'xml', 'json'
|
||||
@offset, @limit = api_offset_and_limit
|
||||
else
|
||||
@limit = 10
|
||||
end
|
||||
|
||||
scope = @project ? @project.news.visible : News.visible
|
||||
|
||||
@news_count = scope.count
|
||||
@news_pages = Paginator.new self, @news_count, @limit, params['page']
|
||||
@offset ||= @news_pages.current.offset
|
||||
@newss = scope.all(:include => [:author, :project],
|
||||
:order => "#{News.table_name}.created_on DESC",
|
||||
:offset => @offset,
|
||||
:limit => @limit)
|
||||
|
||||
respond_to do |format|
|
||||
format.html { render :layout => false if request.xhr? }
|
||||
format.xml { render :xml => @newss.to_xml }
|
||||
format.json { render :json => @newss.to_json }
|
||||
format.api
|
||||
format.atom { render_feed(@newss, :title => (@project ? @project.name : Setting.app_title) + ": #{l(:label_news_plural)}") }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -24,7 +24,7 @@ class ProjectsController < ApplicationController
|
||||
before_filter :authorize, :except => [ :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy]
|
||||
before_filter :authorize_global, :only => [:new, :create]
|
||||
before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy ]
|
||||
accept_key_auth :index
|
||||
accept_key_auth :index, :show, :create, :update, :destroy
|
||||
|
||||
after_filter :only => [:create, :edit, :update, :archive, :unarchive, :destroy] do |controller|
|
||||
if controller.request.post?
|
||||
@@ -32,9 +32,6 @@ class ProjectsController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
# TODO: convert to PUT only
|
||||
verify :method => [:post, :put], :only => :update, :render => {:nothing => true, :status => :method_not_allowed }
|
||||
|
||||
helper :sort
|
||||
include SortHelper
|
||||
helper :custom_fields
|
||||
@@ -52,8 +49,10 @@ class ProjectsController < ApplicationController
|
||||
format.html {
|
||||
@projects = Project.visible.find(:all, :order => 'lft')
|
||||
}
|
||||
format.xml {
|
||||
@projects = Project.visible.find(:all, :order => 'lft')
|
||||
format.api {
|
||||
@offset, @limit = api_offset_and_limit
|
||||
@project_count = Project.visible.count
|
||||
@projects = Project.visible.all(:offset => @offset, :limit => @limit, :order => 'lft')
|
||||
}
|
||||
format.atom {
|
||||
projects = Project.visible.find(:all, :order => 'created_on DESC',
|
||||
@@ -67,19 +66,15 @@ class ProjectsController < ApplicationController
|
||||
@issue_custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position")
|
||||
@trackers = Tracker.all
|
||||
@project = Project.new(params[:project])
|
||||
|
||||
@project.identifier = Project.next_identifier if Setting.sequential_project_identifiers?
|
||||
@project.trackers = Tracker.all
|
||||
@project.is_public = Setting.default_projects_public?
|
||||
@project.enabled_module_names = Setting.default_projects_modules
|
||||
end
|
||||
|
||||
verify :method => :post, :only => :create, :render => {:nothing => true, :status => :method_not_allowed }
|
||||
def create
|
||||
@issue_custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position")
|
||||
@trackers = Tracker.all
|
||||
@project = Project.new(params[:project])
|
||||
@project = Project.new
|
||||
@project.safe_attributes = params[:project]
|
||||
|
||||
@project.enabled_module_names = params[:enabled_modules]
|
||||
if validate_parent_id && @project.save
|
||||
@project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
|
||||
# Add current user as a project member if he is not admin
|
||||
@@ -93,12 +88,12 @@ class ProjectsController < ApplicationController
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
redirect_to :controller => 'projects', :action => 'settings', :id => @project
|
||||
}
|
||||
format.xml { head :created, :location => url_for(:controller => 'projects', :action => 'show', :id => @project.id) }
|
||||
format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => @project.id) }
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html { render :action => 'new' }
|
||||
format.xml { render :xml => @project.errors, :status => :unprocessable_entity }
|
||||
format.api { render_validation_errors(@project) }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -120,18 +115,19 @@ class ProjectsController < ApplicationController
|
||||
end
|
||||
else
|
||||
Mailer.with_deliveries(params[:notifications] == '1') do
|
||||
@project = Project.new(params[:project])
|
||||
@project = Project.new
|
||||
@project.safe_attributes = params[:project]
|
||||
@project.enabled_module_names = params[:enabled_modules]
|
||||
if validate_parent_id && @project.copy(@source_project, :only => params[:only])
|
||||
@project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
redirect_to :controller => 'projects', :action => 'settings'
|
||||
redirect_to :controller => 'projects', :action => 'settings', :id => @project
|
||||
elsif !@project.new_record?
|
||||
# Project was created
|
||||
# But some objects were not copied due to validation failures
|
||||
# (eg. issues from disabled trackers)
|
||||
# TODO: inform about that
|
||||
redirect_to :controller => 'projects', :action => 'settings'
|
||||
redirect_to :controller => 'projects', :action => 'settings', :id => @project
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -169,7 +165,7 @@ class ProjectsController < ApplicationController
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.xml
|
||||
format.api
|
||||
end
|
||||
end
|
||||
|
||||
@@ -185,8 +181,10 @@ class ProjectsController < ApplicationController
|
||||
def edit
|
||||
end
|
||||
|
||||
# TODO: convert to PUT only
|
||||
verify :method => [:post, :put], :only => :update, :render => {:nothing => true, :status => :method_not_allowed }
|
||||
def update
|
||||
@project.attributes = params[:project]
|
||||
@project.safe_attributes = params[:project]
|
||||
if validate_parent_id && @project.save
|
||||
@project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
|
||||
respond_to do |format|
|
||||
@@ -194,7 +192,7 @@ class ProjectsController < ApplicationController
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to :action => 'settings', :id => @project
|
||||
}
|
||||
format.xml { head :ok }
|
||||
format.api { head :ok }
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
@@ -202,13 +200,14 @@ class ProjectsController < ApplicationController
|
||||
settings
|
||||
render :action => 'settings'
|
||||
}
|
||||
format.xml { render :xml => @project.errors, :status => :unprocessable_entity }
|
||||
format.api { render_validation_errors(@project) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
verify :method => :post, :only => :modules, :render => {:nothing => true, :status => :method_not_allowed }
|
||||
def modules
|
||||
@project.enabled_module_names = params[:enabled_modules]
|
||||
@project.enabled_module_names = params[:enabled_module_names]
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to :action => 'settings', :id => @project, :tab => 'modules'
|
||||
end
|
||||
@@ -233,11 +232,11 @@ class ProjectsController < ApplicationController
|
||||
if request.get?
|
||||
# display confirmation view
|
||||
else
|
||||
if params[:format] == 'xml' || params[:confirm]
|
||||
if api_request? || params[:confirm]
|
||||
@project_to_destroy.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to :controller => 'admin', :action => 'projects' }
|
||||
format.xml { head :ok }
|
||||
format.api { head :ok }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -123,7 +123,7 @@ class RepositoriesController < ApplicationController
|
||||
(show_error_not_found; return) unless @content
|
||||
if 'raw' == params[:format] || @content.is_binary_data? || (@entry.size && @entry.size > Setting.file_max_size_displayed.to_i.kilobyte)
|
||||
# Force the download
|
||||
send_data @content, :filename => @path.split('/').last
|
||||
send_data @content, :filename => filename_for_content_disposition(@path.split('/').last)
|
||||
else
|
||||
# Prevent empty lines when displaying a file with Windows style eol
|
||||
@content.gsub!("\r\n", "\n")
|
||||
@@ -139,6 +139,7 @@ class RepositoriesController < ApplicationController
|
||||
end
|
||||
|
||||
def revision
|
||||
raise ChangesetNotFound if @rev.nil? || @rev.empty?
|
||||
@changeset = @repository.find_changeset_by_name(@rev)
|
||||
raise ChangesetNotFound unless @changeset
|
||||
|
||||
@@ -174,6 +175,9 @@ class RepositoriesController < ApplicationController
|
||||
@diff = @repository.diff(@path, @rev, @rev_to)
|
||||
show_error_not_found unless @diff
|
||||
end
|
||||
|
||||
@changeset = @repository.find_changeset_by_name(@rev)
|
||||
@changeset_to = @rev_to ? @repository.find_changeset_by_name(@rev_to) : nil
|
||||
end
|
||||
end
|
||||
|
||||
@@ -196,7 +200,10 @@ class RepositoriesController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
private
|
||||
|
||||
REV_PARAM_RE = %r{\A[a-f0-9]*\Z}i
|
||||
|
||||
def find_repository
|
||||
@project = Project.find(params[:id])
|
||||
@repository = @project.repository
|
||||
@@ -205,6 +212,12 @@ private
|
||||
@path ||= ''
|
||||
@rev = params[:rev].blank? ? @repository.default_branch : params[:rev].strip
|
||||
@rev_to = params[:rev_to]
|
||||
|
||||
unless @rev.to_s.match(REV_PARAM_RE) && @rev_to.to_s.match(REV_PARAM_RE)
|
||||
if @repository.branches.blank?
|
||||
raise InvalidRevisionParam
|
||||
end
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
rescue InvalidRevisionParam
|
||||
@@ -212,7 +225,7 @@ private
|
||||
end
|
||||
|
||||
def show_error_not_found
|
||||
render_error l(:error_scm_not_found)
|
||||
render_error :message => l(:error_scm_not_found), :status => 404
|
||||
end
|
||||
|
||||
# Handler for Redmine::Scm::Adapters::CommandFailed exception
|
||||
|
||||
@@ -44,6 +44,8 @@ class SettingsController < ApplicationController
|
||||
|
||||
@guessed_host_and_path = request.host_with_port.dup
|
||||
@guessed_host_and_path << ('/'+ Redmine::Utils.relative_url_root.gsub(%r{^\/}, '')) unless Redmine::Utils.relative_url_root.blank?
|
||||
|
||||
Redmine::Themes.rescan
|
||||
end
|
||||
|
||||
def plugin
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# redMine - project management software
|
||||
# Copyright (C) 2006-2007 Jean-Philippe Lang
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2010 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -17,9 +17,12 @@
|
||||
|
||||
class TimelogController < ApplicationController
|
||||
menu_item :issues
|
||||
before_filter :find_project, :authorize, :only => [:new, :create, :edit, :update, :destroy]
|
||||
before_filter :find_project, :only => [:new, :create]
|
||||
before_filter :find_time_entry, :only => [:show, :edit, :update, :destroy]
|
||||
before_filter :authorize, :except => [:index]
|
||||
before_filter :find_optional_project, :only => [:index]
|
||||
|
||||
accept_key_auth :index, :show, :create, :update, :destroy
|
||||
|
||||
helper :sort
|
||||
include SortHelper
|
||||
helper :issues
|
||||
@@ -64,6 +67,16 @@ class TimelogController < ApplicationController
|
||||
|
||||
render :layout => !request.xhr?
|
||||
}
|
||||
format.api {
|
||||
@entry_count = TimeEntry.count(:include => [:project, :issue], :conditions => cond.conditions)
|
||||
@entry_pages = Paginator.new self, @entry_count, per_page_option, params['page']
|
||||
@entries = TimeEntry.find(:all,
|
||||
:include => [:project, :activity, :user, {:issue => :tracker}],
|
||||
:conditions => cond.conditions,
|
||||
:order => sort_clause,
|
||||
:limit => @entry_pages.items_per_page,
|
||||
:offset => @entry_pages.current.offset)
|
||||
}
|
||||
format.atom {
|
||||
entries = TimeEntry.find(:all,
|
||||
:include => [:project, :activity, :user, {:issue => :tracker}],
|
||||
@@ -83,6 +96,14 @@ class TimelogController < ApplicationController
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
respond_to do |format|
|
||||
# TODO: Implement html response
|
||||
format.html { render :nothing => true, :status => 406 }
|
||||
format.api
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
@time_entry ||= TimeEntry.new(:project => @project, :issue => @issue, :user => User.current, :spent_on => User.current.today)
|
||||
@@ -100,15 +121,22 @@ class TimelogController < ApplicationController
|
||||
call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry })
|
||||
|
||||
if @time_entry.save
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_back_or_default :action => 'index', :project_id => @time_entry.project
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_back_or_default :action => 'index', :project_id => @time_entry.project
|
||||
}
|
||||
format.api { render :action => 'show', :status => :created, :location => time_entry_url(@time_entry) }
|
||||
end
|
||||
else
|
||||
render :action => 'edit'
|
||||
respond_to do |format|
|
||||
format.html { render :action => 'edit' }
|
||||
format.api { render_validation_errors(@time_entry) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
(render_403; return) if @time_entry && !@time_entry.editable_by?(User.current)
|
||||
@time_entry.attributes = params[:time_entry]
|
||||
|
||||
call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry })
|
||||
@@ -116,43 +144,67 @@ class TimelogController < ApplicationController
|
||||
|
||||
verify :method => :put, :only => :update, :render => {:nothing => true, :status => :method_not_allowed }
|
||||
def update
|
||||
(render_403; return) if @time_entry && !@time_entry.editable_by?(User.current)
|
||||
@time_entry.attributes = params[:time_entry]
|
||||
|
||||
call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry })
|
||||
|
||||
if @time_entry.save
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_back_or_default :action => 'index', :project_id => @time_entry.project
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_back_or_default :action => 'index', :project_id => @time_entry.project
|
||||
}
|
||||
format.api { head :ok }
|
||||
end
|
||||
else
|
||||
render :action => 'edit'
|
||||
respond_to do |format|
|
||||
format.html { render :action => 'edit' }
|
||||
format.api { render_validation_errors(@time_entry) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
verify :method => :delete, :only => :destroy, :render => {:nothing => true, :status => :method_not_allowed }
|
||||
def destroy
|
||||
(render_404; return) unless @time_entry
|
||||
(render_403; return) unless @time_entry.editable_by?(User.current)
|
||||
if @time_entry.destroy && @time_entry.destroyed?
|
||||
flash[:notice] = l(:notice_successful_delete)
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
flash[:notice] = l(:notice_successful_delete)
|
||||
redirect_to :back
|
||||
}
|
||||
format.api { head :ok }
|
||||
end
|
||||
else
|
||||
flash[:error] = l(:notice_unable_delete_time_entry)
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
flash[:error] = l(:notice_unable_delete_time_entry)
|
||||
redirect_to :back
|
||||
}
|
||||
format.api { render_validation_errors(@time_entry) }
|
||||
end
|
||||
end
|
||||
redirect_to :back
|
||||
rescue ::ActionController::RedirectBackError
|
||||
redirect_to :action => 'index', :project_id => @time_entry.project
|
||||
end
|
||||
|
||||
private
|
||||
def find_time_entry
|
||||
@time_entry = TimeEntry.find(params[:id])
|
||||
unless @time_entry.editable_by?(User.current)
|
||||
render_403
|
||||
return false
|
||||
end
|
||||
@project = @time_entry.project
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
def find_project
|
||||
if params[:id]
|
||||
@time_entry = TimeEntry.find(params[:id])
|
||||
@project = @time_entry.project
|
||||
elsif params[:issue_id]
|
||||
@issue = Issue.find(params[:issue_id])
|
||||
if (issue_id = (params[:issue_id] || params[:time_entry] && params[:time_entry][:issue_id])).present?
|
||||
@issue = Issue.find(issue_id)
|
||||
@project = @issue.project
|
||||
elsif params[:project_id]
|
||||
@project = Project.find(params[:project_id])
|
||||
elsif (project_id = (params[:project_id] || params[:time_entry] && params[:time_entry][:project_id])).present?
|
||||
@project = Project.find(project_id)
|
||||
else
|
||||
render_404
|
||||
return false
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2009 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2010 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -19,6 +19,8 @@ class UsersController < ApplicationController
|
||||
layout 'admin'
|
||||
|
||||
before_filter :require_admin, :except => :show
|
||||
before_filter :find_user, :only => [:show, :edit, :update, :edit_membership, :destroy_membership]
|
||||
accept_key_auth :index, :show, :create, :update
|
||||
|
||||
helper :sort
|
||||
include SortHelper
|
||||
@@ -29,6 +31,13 @@ class UsersController < ApplicationController
|
||||
sort_init 'login', 'asc'
|
||||
sort_update %w(login firstname lastname mail admin created_on last_login_on)
|
||||
|
||||
case params[:format]
|
||||
when 'xml', 'json'
|
||||
@offset, @limit = api_offset_and_limit
|
||||
else
|
||||
@limit = per_page_option
|
||||
end
|
||||
|
||||
@status = params[:status] ? params[:status].to_i : 1
|
||||
c = ARCondition.new(@status == 0 ? "status <> 0" : ["status = ?", @status])
|
||||
|
||||
@@ -38,21 +47,21 @@ class UsersController < ApplicationController
|
||||
end
|
||||
|
||||
@user_count = User.count(:conditions => c.conditions)
|
||||
@user_pages = Paginator.new self, @user_count,
|
||||
per_page_option,
|
||||
params['page']
|
||||
@users = User.find :all,:order => sort_clause,
|
||||
@user_pages = Paginator.new self, @user_count, @limit, params['page']
|
||||
@offset ||= @user_pages.current.offset
|
||||
@users = User.find :all,
|
||||
:order => sort_clause,
|
||||
:conditions => c.conditions,
|
||||
:limit => @user_pages.items_per_page,
|
||||
:offset => @user_pages.current.offset
|
||||
:limit => @limit,
|
||||
:offset => @offset
|
||||
|
||||
render :layout => !request.xhr?
|
||||
respond_to do |format|
|
||||
format.html { render :layout => !request.xhr? }
|
||||
format.api
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@user = User.find(params[:id])
|
||||
@custom_values = @user.custom_values
|
||||
|
||||
# show projects based on current user visibility
|
||||
@memberships = @user.memberships.all(:conditions => Project.visible_by(User.current))
|
||||
|
||||
@@ -65,104 +74,110 @@ class UsersController < ApplicationController
|
||||
return
|
||||
end
|
||||
end
|
||||
render :layout => 'base'
|
||||
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
|
||||
respond_to do |format|
|
||||
format.html { render :layout => 'base' }
|
||||
format.api
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
@notification_options = User::MAIL_NOTIFICATION_OPTIONS
|
||||
@notification_option = Setting.default_notification_option
|
||||
|
||||
@user = User.new(:language => Setting.default_language)
|
||||
@user = User.new(:language => Setting.default_language, :mail_notification => Setting.default_notification_option)
|
||||
@auth_sources = AuthSource.find(:all)
|
||||
end
|
||||
|
||||
verify :method => :post, :only => :create, :render => {:nothing => true, :status => :method_not_allowed }
|
||||
def create
|
||||
@notification_options = User::MAIL_NOTIFICATION_OPTIONS
|
||||
@notification_option = Setting.default_notification_option
|
||||
|
||||
@user = User.new(params[:user])
|
||||
@user = User.new(:language => Setting.default_language, :mail_notification => Setting.default_notification_option)
|
||||
@user.safe_attributes = params[:user]
|
||||
@user.admin = params[:user][:admin] || false
|
||||
@user.login = params[:user][:login]
|
||||
@user.password, @user.password_confirmation = params[:password], params[:password_confirmation] unless @user.auth_source_id
|
||||
@user.password, @user.password_confirmation = params[:user][:password], params[:user][:password_confirmation] unless @user.auth_source_id
|
||||
|
||||
# TODO: Similar to My#account
|
||||
@user.mail_notification = params[:notification_option] || 'only_my_events'
|
||||
@user.pref.attributes = params[:pref]
|
||||
@user.pref[:no_self_notified] = (params[:no_self_notified] == '1')
|
||||
|
||||
if @user.save
|
||||
@user.pref.save
|
||||
@user.notified_project_ids = (params[:notification_option] == 'selected' ? params[:notified_project_ids] : [])
|
||||
@user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : [])
|
||||
|
||||
Mailer.deliver_account_information(@user, params[:password]) if params[:send_information]
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
redirect_to(params[:continue] ? {:controller => 'users', :action => 'new'} :
|
||||
{:controller => 'users', :action => 'edit', :id => @user})
|
||||
return
|
||||
Mailer.deliver_account_information(@user, params[:user][:password]) if params[:send_information]
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
redirect_to(params[:continue] ?
|
||||
{:controller => 'users', :action => 'new'} :
|
||||
{:controller => 'users', :action => 'edit', :id => @user}
|
||||
)
|
||||
}
|
||||
format.api { render :action => 'show', :status => :created, :location => user_url(@user) }
|
||||
end
|
||||
else
|
||||
@auth_sources = AuthSource.find(:all)
|
||||
@notification_option = @user.mail_notification
|
||||
# Clear password input
|
||||
@user.password = @user.password_confirmation = nil
|
||||
|
||||
render :action => 'new'
|
||||
respond_to do |format|
|
||||
format.html { render :action => 'new' }
|
||||
format.api { render_validation_errors(@user) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@user = User.find(params[:id])
|
||||
@notification_options = @user.valid_notification_options
|
||||
@notification_option = @user.mail_notification
|
||||
|
||||
@auth_sources = AuthSource.find(:all)
|
||||
@membership ||= Member.new
|
||||
end
|
||||
|
||||
verify :method => :put, :only => :update, :render => {:nothing => true, :status => :method_not_allowed }
|
||||
def update
|
||||
@user = User.find(params[:id])
|
||||
@notification_options = @user.valid_notification_options
|
||||
@notification_option = @user.mail_notification
|
||||
|
||||
@user.admin = params[:user][:admin] if params[:user][:admin]
|
||||
@user.login = params[:user][:login] if params[:user][:login]
|
||||
if params[:password].present? && (@user.auth_source_id.nil? || params[:user][:auth_source_id].blank?)
|
||||
@user.password, @user.password_confirmation = params[:password], params[:password_confirmation]
|
||||
if params[:user][:password].present? && (@user.auth_source_id.nil? || params[:user][:auth_source_id].blank?)
|
||||
@user.password, @user.password_confirmation = params[:user][:password], params[:user][:password_confirmation]
|
||||
end
|
||||
@user.group_ids = params[:user][:group_ids] if params[:user][:group_ids]
|
||||
@user.attributes = params[:user]
|
||||
@user.safe_attributes = params[:user]
|
||||
# Was the account actived ? (do it before User#save clears the change)
|
||||
was_activated = (@user.status_change == [User::STATUS_REGISTERED, User::STATUS_ACTIVE])
|
||||
# TODO: Similar to My#account
|
||||
@user.mail_notification = params[:notification_option] || 'only_my_events'
|
||||
@user.pref.attributes = params[:pref]
|
||||
@user.pref[:no_self_notified] = (params[:no_self_notified] == '1')
|
||||
|
||||
if @user.save
|
||||
@user.pref.save
|
||||
@user.notified_project_ids = (params[:notification_option] == 'selected' ? params[:notified_project_ids] : [])
|
||||
@user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : [])
|
||||
|
||||
if was_activated
|
||||
Mailer.deliver_account_activated(@user)
|
||||
elsif @user.active? && params[:send_information] && !params[:password].blank? && @user.auth_source_id.nil?
|
||||
Mailer.deliver_account_information(@user, params[:password])
|
||||
elsif @user.active? && params[:send_information] && !params[:user][:password].blank? && @user.auth_source_id.nil?
|
||||
Mailer.deliver_account_information(@user, params[:user][:password])
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to :back
|
||||
}
|
||||
format.api { head :ok }
|
||||
end
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to :back
|
||||
else
|
||||
@auth_sources = AuthSource.find(:all)
|
||||
@membership ||= Member.new
|
||||
# Clear password input
|
||||
@user.password = @user.password_confirmation = nil
|
||||
|
||||
render :action => :edit
|
||||
respond_to do |format|
|
||||
format.html { render :action => :edit }
|
||||
format.api { render_validation_errors(@user) }
|
||||
end
|
||||
end
|
||||
rescue ::ActionController::RedirectBackError
|
||||
redirect_to :controller => 'users', :action => 'edit', :id => @user
|
||||
end
|
||||
|
||||
def edit_membership
|
||||
@user = User.find(params[:id])
|
||||
@membership = Member.edit_membership(params[:membership_id], params[:membership], @user)
|
||||
@membership.save if request.post?
|
||||
respond_to do |format|
|
||||
@@ -185,7 +200,6 @@ class UsersController < ApplicationController
|
||||
end
|
||||
|
||||
def destroy_membership
|
||||
@user = User.find(params[:id])
|
||||
@membership = Member.find(params[:membership_id])
|
||||
if request.post? && @membership.deletable?
|
||||
@membership.destroy
|
||||
@@ -195,4 +209,17 @@ class UsersController < ApplicationController
|
||||
format.js { render(:update) {|page| page.replace_html "tab-content-memberships", :partial => 'users/memberships'} }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_user
|
||||
if params[:id] == 'current'
|
||||
require_login || return
|
||||
@user = User.current
|
||||
else
|
||||
@user = User.find(params[:id])
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
end
|
||||
|
||||
@@ -109,6 +109,10 @@ class VersionsController < ApplicationController
|
||||
if @version.update_attributes(attributes)
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html { render :action => 'edit' }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -17,20 +17,39 @@
|
||||
|
||||
require 'diff'
|
||||
|
||||
# The WikiController follows the Rails REST controller pattern but with
|
||||
# a few differences
|
||||
#
|
||||
# * index - shows a list of WikiPages grouped by page or date
|
||||
# * new - not used
|
||||
# * create - not used
|
||||
# * show - will also show the form for creating a new wiki page
|
||||
# * edit - used to edit an existing or new page
|
||||
# * update - used to save a wiki page update to the database, including new pages
|
||||
# * destroy - normal
|
||||
#
|
||||
# Other member and collection methods are also used
|
||||
#
|
||||
# TODO: still being worked on
|
||||
class WikiController < ApplicationController
|
||||
default_search_scope :wiki_pages
|
||||
before_filter :find_wiki, :authorize
|
||||
before_filter :find_existing_page, :only => [:rename, :protect, :history, :diff, :annotate, :add_attachment, :destroy]
|
||||
|
||||
verify :method => :post, :only => [:destroy, :protect], :redirect_to => { :action => :show }
|
||||
verify :method => :post, :only => [:protect], :redirect_to => { :action => :show }
|
||||
|
||||
helper :attachments
|
||||
include AttachmentsHelper
|
||||
helper :watchers
|
||||
|
||||
# List of pages, sorted alphabetically and by parent (hierarchy)
|
||||
def index
|
||||
load_pages_grouped_by_date_without_content
|
||||
end
|
||||
|
||||
# display a page (in editing mode if it doesn't exist)
|
||||
def show
|
||||
page_title = params[:page]
|
||||
page_title = params[:id]
|
||||
@page = @wiki.find_or_new_page(page_title)
|
||||
if @page.new_record?
|
||||
if User.current.allowed_to?(:edit_wiki_pages, @project) && editable?
|
||||
@@ -63,7 +82,7 @@ class WikiController < ApplicationController
|
||||
|
||||
# edit an existing page or a new one
|
||||
def edit
|
||||
@page = @wiki.find_or_new_page(params[:page])
|
||||
@page = @wiki.find_or_new_page(params[:id])
|
||||
return render_403 unless editable?
|
||||
@page.content = WikiContent.new(:page => @page) if @page.new_record?
|
||||
|
||||
@@ -79,10 +98,10 @@ class WikiController < ApplicationController
|
||||
flash[:error] = l(:notice_locking_conflict)
|
||||
end
|
||||
|
||||
verify :method => :post, :only => :update, :render => {:nothing => true, :status => :method_not_allowed }
|
||||
verify :method => :put, :only => :update, :render => {:nothing => true, :status => :method_not_allowed }
|
||||
# Creates a new page or updates an existing one
|
||||
def update
|
||||
@page = @wiki.find_or_new_page(params[:page])
|
||||
@page = @wiki.find_or_new_page(params[:id])
|
||||
return render_403 unless editable?
|
||||
@page.content = WikiContent.new(:page => @page) if @page.new_record?
|
||||
|
||||
@@ -95,7 +114,7 @@ class WikiController < ApplicationController
|
||||
attachments = Attachment.attach_files(@page, params[:attachments])
|
||||
render_attachment_warning_if_needed(@page)
|
||||
# don't save if text wasn't changed
|
||||
redirect_to :action => 'show', :project_id => @project, :page => @page.title
|
||||
redirect_to :action => 'show', :project_id => @project, :id => @page.title
|
||||
return
|
||||
end
|
||||
@content.attributes = params[:content]
|
||||
@@ -105,7 +124,9 @@ class WikiController < ApplicationController
|
||||
attachments = Attachment.attach_files(@page, params[:attachments])
|
||||
render_attachment_warning_if_needed(@page)
|
||||
call_hook(:controller_wiki_edit_after_save, { :params => params, :page => @page})
|
||||
redirect_to :action => 'show', :project_id => @project, :page => @page.title
|
||||
redirect_to :action => 'show', :project_id => @project, :id => @page.title
|
||||
else
|
||||
render :action => 'edit'
|
||||
end
|
||||
|
||||
rescue ActiveRecord::StaleObjectError
|
||||
@@ -121,13 +142,13 @@ class WikiController < ApplicationController
|
||||
@original_title = @page.pretty_title
|
||||
if request.post? && @page.update_attributes(params[:wiki_page])
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to :action => 'show', :project_id => @project, :page => @page.title
|
||||
redirect_to :action => 'show', :project_id => @project, :id => @page.title
|
||||
end
|
||||
end
|
||||
|
||||
def protect
|
||||
@page.update_attribute :protected, params[:protected]
|
||||
redirect_to :action => 'show', :project_id => @project, :page => @page.title
|
||||
redirect_to :action => 'show', :project_id => @project, :id => @page.title
|
||||
end
|
||||
|
||||
# show page history
|
||||
@@ -153,7 +174,8 @@ class WikiController < ApplicationController
|
||||
@annotate = @page.annotate(params[:version])
|
||||
render_404 unless @annotate
|
||||
end
|
||||
|
||||
|
||||
verify :method => :delete, :only => [:destroy], :redirect_to => { :action => :show }
|
||||
# Removes a wiki page and its history
|
||||
# Children can be either set as root pages, removed or reassigned to another parent page
|
||||
def destroy
|
||||
@@ -180,7 +202,7 @@ class WikiController < ApplicationController
|
||||
end
|
||||
end
|
||||
@page.destroy
|
||||
redirect_to :action => 'page_index', :project_id => @project
|
||||
redirect_to :action => 'index', :project_id => @project
|
||||
end
|
||||
|
||||
# Export wiki to a single html file
|
||||
@@ -190,20 +212,16 @@ class WikiController < ApplicationController
|
||||
export = render_to_string :action => 'export_multiple', :layout => false
|
||||
send_data(export, :type => 'text/html', :filename => "wiki.html")
|
||||
else
|
||||
redirect_to :action => 'show', :project_id => @project, :page => nil
|
||||
redirect_to :action => 'show', :project_id => @project, :id => nil
|
||||
end
|
||||
end
|
||||
|
||||
def page_index
|
||||
load_pages_grouped_by_date_without_content
|
||||
end
|
||||
|
||||
def date_index
|
||||
load_pages_grouped_by_date_without_content
|
||||
end
|
||||
|
||||
def preview
|
||||
page = @wiki.find_page(params[:page])
|
||||
page = @wiki.find_page(params[:id])
|
||||
# page is nil when previewing a new page
|
||||
return render_403 unless page.nil? || editable?(page)
|
||||
if page
|
||||
@@ -218,7 +236,7 @@ class WikiController < ApplicationController
|
||||
return render_403 unless editable?
|
||||
attachments = Attachment.attach_files(@page, params[:attachments])
|
||||
render_attachment_warning_if_needed(@page)
|
||||
redirect_to :action => 'show', :page => @page.title
|
||||
redirect_to :action => 'show', :id => @page.title, :project_id => @project
|
||||
end
|
||||
|
||||
private
|
||||
@@ -233,7 +251,7 @@ private
|
||||
|
||||
# Finds the requested page and returns a 404 error if it doesn't exist
|
||||
def find_existing_page
|
||||
@page = @wiki.find_page(params[:page])
|
||||
@page = @wiki.find_page(params[:id])
|
||||
render_404 if @page.nil?
|
||||
end
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# redMine - project management software
|
||||
# Copyright (C) 2006-2007 Jean-Philippe Lang
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2010 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -104,8 +104,10 @@ module ApplicationHelper
|
||||
# * :text - Link text (default to the formatted revision)
|
||||
def link_to_revision(revision, project, options={})
|
||||
text = options.delete(:text) || format_revision(revision)
|
||||
rev = revision.respond_to?(:identifier) ? revision.identifier : revision
|
||||
|
||||
link_to(text, {:controller => 'repositories', :action => 'revision', :id => project, :rev => revision}, :title => l(:label_revision_id, revision))
|
||||
link_to(text, {:controller => 'repositories', :action => 'revision', :id => project, :rev => rev},
|
||||
:title => l(:label_revision_id, format_revision(revision)))
|
||||
end
|
||||
|
||||
# Generates a link to a project if active
|
||||
@@ -177,7 +179,7 @@ module ApplicationHelper
|
||||
content << "<ul class=\"pages-hierarchy\">\n"
|
||||
pages[node].each do |page|
|
||||
content << "<li>"
|
||||
content << link_to(h(page.pretty_title), {:controller => 'wiki', :action => 'show', :project_id => page.project, :page => page.title},
|
||||
content << link_to(h(page.pretty_title), {:controller => 'wiki', :action => 'show', :project_id => page.project, :id => page.title},
|
||||
:title => (page.respond_to?(:updated_on) ? l(:label_updated_time, distance_of_time_in_words(Time.now, page.updated_on)) : nil))
|
||||
content << "\n" + render_page_hierarchy(pages, page.id) if pages[page.id]
|
||||
content << "</li>\n"
|
||||
@@ -238,15 +240,10 @@ module ApplicationHelper
|
||||
end
|
||||
|
||||
# Yields the given block for each project with its level in the tree
|
||||
#
|
||||
# Wrapper for Project#project_tree
|
||||
def project_tree(projects, &block)
|
||||
ancestors = []
|
||||
projects.sort_by(&:lft).each do |project|
|
||||
while (ancestors.any? && !project.is_descendant_of?(ancestors.last))
|
||||
ancestors.pop
|
||||
end
|
||||
yield project, ancestors.size
|
||||
ancestors << project
|
||||
end
|
||||
Project.project_tree(projects, &block)
|
||||
end
|
||||
|
||||
def project_nested_ul(projects, &block)
|
||||
@@ -454,12 +451,19 @@ module ApplicationHelper
|
||||
only_path = options.delete(:only_path) == false ? false : true
|
||||
|
||||
text = Redmine::WikiFormatting.to_html(Setting.text_formatting, text, :object => obj, :attribute => attr) { |macro, args| exec_macro(macro, obj, args) }
|
||||
|
||||
parse_non_pre_blocks(text) do |text|
|
||||
[:parse_inline_attachments, :parse_wiki_links, :parse_redmine_links].each do |method_name|
|
||||
|
||||
@parsed_headings = []
|
||||
text = parse_non_pre_blocks(text) do |text|
|
||||
[:parse_inline_attachments, :parse_wiki_links, :parse_redmine_links, :parse_headings].each do |method_name|
|
||||
send method_name, text, project, obj, attr, only_path, options
|
||||
end
|
||||
end
|
||||
|
||||
if @parsed_headings.any?
|
||||
replace_toc(text, @parsed_headings)
|
||||
end
|
||||
|
||||
text
|
||||
end
|
||||
|
||||
def parse_non_pre_blocks(text)
|
||||
@@ -529,7 +533,7 @@ module ApplicationHelper
|
||||
esc, all, page, title = $1, $2, $3, $5
|
||||
if esc.nil?
|
||||
if page =~ /^([^\:]+)\:(.*)$/
|
||||
link_project = Project.find_by_name($1) || Project.find_by_identifier($1)
|
||||
link_project = Project.find_by_identifier($1) || Project.find_by_name($1)
|
||||
page = $2
|
||||
title ||= $1 if page.blank?
|
||||
end
|
||||
@@ -546,7 +550,8 @@ module ApplicationHelper
|
||||
when :local; "#{title}.html"
|
||||
when :anchor; "##{title}" # used for single-file wiki export
|
||||
else
|
||||
url_for(:only_path => only_path, :controller => 'wiki', :action => 'show', :project_id => link_project, :page => Wiki.titleize(page), :anchor => anchor)
|
||||
wiki_page_id = page.present? ? Wiki.titleize(page) : nil
|
||||
url_for(:only_path => only_path, :controller => 'wiki', :action => 'show', :project_id => link_project, :id => wiki_page_id, :anchor => anchor)
|
||||
end
|
||||
link_to((title || page), url, :class => ('wiki-page' + (wiki_page ? '' : ' new')))
|
||||
else
|
||||
@@ -677,6 +682,55 @@ module ApplicationHelper
|
||||
leading + (link || "#{prefix}#{sep}#{identifier}")
|
||||
end
|
||||
end
|
||||
|
||||
HEADING_RE = /<h(1|2|3|4)( [^>]+)?>(.+?)<\/h(1|2|3|4)>/i unless const_defined?(:HEADING_RE)
|
||||
|
||||
# Headings and TOC
|
||||
# Adds ids and links to headings unless options[:headings] is set to false
|
||||
def parse_headings(text, project, obj, attr, only_path, options)
|
||||
return if options[:headings] == false
|
||||
|
||||
text.gsub!(HEADING_RE) do
|
||||
level, attrs, content = $1.to_i, $2, $3
|
||||
item = strip_tags(content).strip
|
||||
anchor = item.gsub(%r{[^\w\s\-]}, '').gsub(%r{\s+(\-+\s*)?}, '-')
|
||||
@parsed_headings << [level, anchor, item]
|
||||
"<h#{level} #{attrs} id=\"#{anchor}\">#{content}<a href=\"##{anchor}\" class=\"wiki-anchor\">¶</a></h#{level}>"
|
||||
end
|
||||
end
|
||||
|
||||
TOC_RE = /<p>\{\{([<>]?)toc\}\}<\/p>/i unless const_defined?(:TOC_RE)
|
||||
|
||||
# Renders the TOC with given headings
|
||||
def replace_toc(text, headings)
|
||||
text.gsub!(TOC_RE) do
|
||||
if headings.empty?
|
||||
''
|
||||
else
|
||||
div_class = 'toc'
|
||||
div_class << ' right' if $1 == '>'
|
||||
div_class << ' left' if $1 == '<'
|
||||
out = "<ul class=\"#{div_class}\"><li>"
|
||||
root = headings.map(&:first).min
|
||||
current = root
|
||||
started = false
|
||||
headings.each do |level, anchor, item|
|
||||
if level > current
|
||||
out << '<ul><li>' * (level - current)
|
||||
elsif level < current
|
||||
out << "</li></ul>\n" * (current - level) + "</li><li>"
|
||||
elsif started
|
||||
out << '</li><li>'
|
||||
end
|
||||
out << "<a href=\"##{anchor}\">#{item}</a>"
|
||||
current = level
|
||||
started = true
|
||||
end
|
||||
out << '</li></ul>' * (current - root)
|
||||
out << '</li></ul>'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Same as Rails' simple_format helper without using paragraphs
|
||||
def simple_format_without_paragraph(text)
|
||||
@@ -826,7 +880,29 @@ module ApplicationHelper
|
||||
def favicon
|
||||
"<link rel='shortcut icon' href='#{image_path('/favicon.ico')}' />"
|
||||
end
|
||||
|
||||
# Returns true if arg is expected in the API response
|
||||
def include_in_api_response?(arg)
|
||||
unless @included_in_api_response
|
||||
param = params[:include]
|
||||
@included_in_api_response = param.is_a?(Array) ? param.collect(&:to_s) : param.to_s.split(',')
|
||||
@included_in_api_response.collect!(&:strip)
|
||||
end
|
||||
@included_in_api_response.include?(arg.to_s)
|
||||
end
|
||||
|
||||
# Returns options or nil if nometa param or X-Redmine-Nometa header
|
||||
# was set in the request
|
||||
def api_meta(options)
|
||||
if params[:nometa].present? || request.headers['X-Redmine-Nometa']
|
||||
# compatibility mode for activeresource clients that raise
|
||||
# an error when unserializing an array with attributes
|
||||
nil
|
||||
else
|
||||
options
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def wiki_helper
|
||||
|
||||
@@ -104,4 +104,15 @@ module CustomFieldsHelper
|
||||
def custom_field_formats_for_select
|
||||
Redmine::CustomFieldFormat.as_select
|
||||
end
|
||||
|
||||
# Renders the custom_values in api views
|
||||
def render_api_custom_values(custom_values, api)
|
||||
api.array :custom_fields do
|
||||
custom_values.each do |custom_value|
|
||||
api.custom_field :id => custom_value.custom_field_id, :name => custom_value.custom_field.name do
|
||||
api.value custom_value.value
|
||||
end
|
||||
end
|
||||
end unless custom_values.empty?
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,6 +16,31 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
module GanttHelper
|
||||
|
||||
def gantt_zoom_link(gantt, in_or_out)
|
||||
case in_or_out
|
||||
when :in
|
||||
if gantt.zoom < 4
|
||||
link_to_remote(l(:text_zoom_in),
|
||||
{:url => gantt.params.merge(:zoom => (gantt.zoom+1)), :method => :get, :update => 'content'},
|
||||
{:href => url_for(gantt.params.merge(:zoom => (gantt.zoom+1))),
|
||||
:class => 'icon icon-zoom-in'})
|
||||
else
|
||||
content_tag('span', l(:text_zoom_in), :class => 'icon icon-zoom-in')
|
||||
end
|
||||
|
||||
when :out
|
||||
if gantt.zoom > 1
|
||||
link_to_remote(l(:text_zoom_out),
|
||||
{:url => gantt.params.merge(:zoom => (gantt.zoom-1)), :method => :get, :update => 'content'},
|
||||
{:href => url_for(gantt.params.merge(:zoom => (gantt.zoom-1))),
|
||||
:class => 'icon icon-zoom-out'})
|
||||
else
|
||||
content_tag('span', l(:text_zoom_out), :class => 'icon icon-zoom-out')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def number_of_issues_on_versions(gantt)
|
||||
versions = gantt.events.collect {|event| (event.is_a? Version) ? event : nil}.compact
|
||||
|
||||
|
||||
@@ -189,6 +189,20 @@ module IssuesHelper
|
||||
end
|
||||
end
|
||||
|
||||
# Renders issue children recursively
|
||||
def render_api_issue_children(issue, api)
|
||||
return if issue.leaf?
|
||||
api.array :children do
|
||||
issue.children.each do |child|
|
||||
api.issue(:id => child.id) do
|
||||
api.tracker(:id => child.tracker_id, :name => child.tracker.name) unless child.tracker.nil?
|
||||
api.subject child.subject
|
||||
render_api_issue_children(child, api)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def issues_to_csv(issues, project = nil)
|
||||
ic = Iconv.new(l(:general_csv_encoding), 'UTF-8')
|
||||
decimal_separator = l(:general_csv_decimal_separator)
|
||||
@@ -246,30 +260,4 @@ module IssuesHelper
|
||||
end
|
||||
export
|
||||
end
|
||||
|
||||
def gantt_zoom_link(gantt, in_or_out)
|
||||
img_attributes = {:style => 'height:1.4em; width:1.4em; margin-left: 3px;'} # em for accessibility
|
||||
|
||||
case in_or_out
|
||||
when :in
|
||||
if gantt.zoom < 4
|
||||
link_to_remote(l(:text_zoom_in) + image_tag('zoom_in.png', img_attributes.merge(:alt => l(:text_zoom_in))),
|
||||
{:url => gantt.params.merge(:zoom => (gantt.zoom+1)), :method => :get, :update => 'content'},
|
||||
{:href => url_for(gantt.params.merge(:zoom => (gantt.zoom+1)))})
|
||||
else
|
||||
l(:text_zoom_in) +
|
||||
image_tag('zoom_in_g.png', img_attributes.merge(:alt => l(:text_zoom_in)))
|
||||
end
|
||||
|
||||
when :out
|
||||
if gantt.zoom > 1
|
||||
link_to_remote(l(:text_zoom_out) + image_tag('zoom_out.png', img_attributes.merge(:alt => l(:text_zoom_out))),
|
||||
{:url => gantt.params.merge(:zoom => (gantt.zoom-1)), :method => :get, :update => 'content'},
|
||||
{:href => url_for(gantt.params.merge(:zoom => (gantt.zoom-1)))})
|
||||
else
|
||||
l(:text_zoom_out) +
|
||||
image_tag('zoom_out_g.png', img_attributes.merge(:alt => l(:text_zoom_out)))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -78,10 +78,9 @@ module QueriesHelper
|
||||
# Give it a name, required to be valid
|
||||
@query = Query.new(:name => "_")
|
||||
@query.project = @project
|
||||
if params[:fields] and params[:fields].is_a? Array
|
||||
params[:fields].each do |field|
|
||||
@query.add_filter(field, params[:operators][field], params[:values][field])
|
||||
end
|
||||
if params[:fields]
|
||||
@query.filters = {}
|
||||
@query.add_filters(params[:fields], params[:operators], params[:values])
|
||||
else
|
||||
@query.available_filters.keys.each do |field|
|
||||
@query.add_short_filter(field, params[field]) if params[field]
|
||||
|
||||
@@ -18,8 +18,12 @@
|
||||
require 'iconv'
|
||||
|
||||
module RepositoriesHelper
|
||||
def format_revision(txt)
|
||||
txt.to_s[0,8]
|
||||
def format_revision(revision)
|
||||
if revision.respond_to? :format_identifier
|
||||
revision.format_identifier
|
||||
else
|
||||
revision.to_s
|
||||
end
|
||||
end
|
||||
|
||||
def truncate_at_line_break(text, length = 255)
|
||||
@@ -87,7 +91,7 @@ module RepositoriesHelper
|
||||
:action => 'show',
|
||||
:id => @project,
|
||||
:path => path_param,
|
||||
:rev => @changeset.revision)
|
||||
:rev => @changeset.identifier)
|
||||
output << "<li class='#{style}'>#{text}</li>"
|
||||
output << render_changes_tree(s)
|
||||
elsif c = tree[file][:c]
|
||||
@@ -97,13 +101,13 @@ module RepositoriesHelper
|
||||
:action => 'entry',
|
||||
:id => @project,
|
||||
:path => path_param,
|
||||
:rev => @changeset.revision) unless c.action == 'D'
|
||||
:rev => @changeset.identifier) unless c.action == 'D'
|
||||
text << " - #{c.revision}" unless c.revision.blank?
|
||||
text << ' (' + link_to('diff', :controller => 'repositories',
|
||||
:action => 'diff',
|
||||
:id => @project,
|
||||
:path => path_param,
|
||||
:rev => @changeset.revision) + ') ' if c.action == 'M'
|
||||
:rev => @changeset.identifier) + ') ' if c.action == 'M'
|
||||
text << ' ' + content_tag('span', c.from_path, :class => 'copied-from') unless c.from_path.blank?
|
||||
output << "<li class='#{style}'>#{text}</li>"
|
||||
end
|
||||
|
||||
@@ -39,7 +39,7 @@ module SearchHelper
|
||||
end
|
||||
|
||||
def type_label(t)
|
||||
l("label_#{t.singularize}_plural")
|
||||
l("label_#{t.singularize}_plural", :default => t.to_s.humanize)
|
||||
end
|
||||
|
||||
def project_select_tag
|
||||
|
||||
@@ -33,6 +33,10 @@ module UsersHelper
|
||||
options
|
||||
end
|
||||
|
||||
def user_mail_notification_options(user)
|
||||
user.valid_notification_options.collect {|o| [l(o.last), o.first]}
|
||||
end
|
||||
|
||||
def change_status_link(user)
|
||||
url = {:controller => 'users', :action => 'update', :id => user, :page => params[:page], :status => params[:status], :tab => nil}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ module WikiHelper
|
||||
attrs << " selected='selected'" if selected == page
|
||||
indent = (level > 0) ? (' ' * level * 2 + '» ') : nil
|
||||
|
||||
s << "<option value='#{page.id}'>#{indent}#{h page.pretty_title}</option>\n" +
|
||||
s << "<option #{attrs}>#{indent}#{h page.pretty_title}</option>\n" +
|
||||
wiki_page_options_for_select(pages, selected, page, level + 1)
|
||||
end
|
||||
s
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
class Board < ActiveRecord::Base
|
||||
belongs_to :project
|
||||
has_many :topics, :class_name => 'Message', :conditions => "#{Message.table_name}.parent_id IS NULL", :order => "#{Message.table_name}.created_on DESC"
|
||||
has_many :messages, :dependent => :delete_all, :order => "#{Message.table_name}.created_on DESC"
|
||||
has_many :messages, :dependent => :destroy, :order => "#{Message.table_name}.created_on DESC"
|
||||
belongs_to :last_message, :class_name => 'Message', :foreign_key => :last_message_id
|
||||
acts_as_list :scope => :project_id
|
||||
acts_as_watchable
|
||||
|
||||
@@ -23,10 +23,10 @@ class Changeset < ActiveRecord::Base
|
||||
has_many :changes, :dependent => :delete_all
|
||||
has_and_belongs_to_many :issues
|
||||
|
||||
acts_as_event :title => Proc.new {|o| "#{l(:label_revision)} #{o.revision}" + (o.short_comments.blank? ? '' : (': ' + o.short_comments))},
|
||||
acts_as_event :title => Proc.new {|o| "#{l(:label_revision)} #{o.format_identifier}" + (o.short_comments.blank? ? '' : (': ' + o.short_comments))},
|
||||
:description => :long_comments,
|
||||
:datetime => :committed_on,
|
||||
:url => Proc.new {|o| {:controller => 'repositories', :action => 'revision', :id => o.repository.project, :rev => o.revision}}
|
||||
:url => Proc.new {|o| {:controller => 'repositories', :action => 'revision', :id => o.repository.project, :rev => o.identifier}}
|
||||
|
||||
acts_as_searchable :columns => 'comments',
|
||||
:include => {:repository => :project},
|
||||
@@ -47,6 +47,15 @@ class Changeset < ActiveRecord::Base
|
||||
def revision=(r)
|
||||
write_attribute :revision, (r.nil? ? nil : r.to_s)
|
||||
end
|
||||
|
||||
# Returns the identifier of this changeset; depending on repository backends
|
||||
def identifier
|
||||
if repository.class.respond_to? :changeset_identifier
|
||||
repository.class.changeset_identifier self
|
||||
else
|
||||
revision.to_s
|
||||
end
|
||||
end
|
||||
|
||||
def comments=(comment)
|
||||
write_attribute(:comments, Changeset.normalize_comments(comment))
|
||||
@@ -56,6 +65,15 @@ class Changeset < ActiveRecord::Base
|
||||
self.commit_date = date
|
||||
super
|
||||
end
|
||||
|
||||
# Returns the readable identifier
|
||||
def format_identifier
|
||||
if repository.class.respond_to? :format_changeset_identifier
|
||||
repository.class.format_changeset_identifier self
|
||||
else
|
||||
identifier
|
||||
end
|
||||
end
|
||||
|
||||
def committer=(arg)
|
||||
write_attribute(:committer, self.class.to_utf8(arg.to_s))
|
||||
@@ -77,52 +95,42 @@ class Changeset < ActiveRecord::Base
|
||||
scan_comment_for_issue_ids
|
||||
end
|
||||
|
||||
TIMELOG_RE = /
|
||||
(
|
||||
((\d+)(h|hours?))((\d+)(m|min)?)?
|
||||
|
|
||||
((\d+)(h|hours?|m|min))
|
||||
|
|
||||
(\d+):(\d+)
|
||||
|
|
||||
(\d+([\.,]\d+)?)h?
|
||||
)
|
||||
/x
|
||||
|
||||
def scan_comment_for_issue_ids
|
||||
return if comments.blank?
|
||||
# keywords used to reference issues
|
||||
ref_keywords = Setting.commit_ref_keywords.downcase.split(",").collect(&:strip)
|
||||
ref_keywords_any = ref_keywords.delete('*')
|
||||
# keywords used to fix issues
|
||||
fix_keywords = Setting.commit_fix_keywords.downcase.split(",").collect(&:strip)
|
||||
|
||||
kw_regexp = (ref_keywords + fix_keywords).collect{|kw| Regexp.escape(kw)}.join("|")
|
||||
return if kw_regexp.blank?
|
||||
|
||||
referenced_issues = []
|
||||
|
||||
if ref_keywords.delete('*')
|
||||
# find any issue ID in the comments
|
||||
target_issue_ids = []
|
||||
comments.scan(%r{([\s\(\[,-]|^)#(\d+)(?=[[:punct:]]|\s|<|$)}).each { |m| target_issue_ids << m[1] }
|
||||
referenced_issues += find_referenced_issues_by_id(target_issue_ids)
|
||||
end
|
||||
|
||||
comments.scan(Regexp.new("(#{kw_regexp})[\s:]+(([\s,;&]*#?\\d+)+)", Regexp::IGNORECASE)).each do |match|
|
||||
action = match[0]
|
||||
target_issue_ids = match[1].scan(/\d+/)
|
||||
target_issues = find_referenced_issues_by_id(target_issue_ids)
|
||||
if fix_keywords.include?(action.downcase) && fix_status = IssueStatus.find_by_id(Setting.commit_fix_status_id)
|
||||
# update status of issues
|
||||
logger.debug "Issues fixed by changeset #{self.revision}: #{issue_ids.join(', ')}." if logger && logger.debug?
|
||||
target_issues.each do |issue|
|
||||
# the issue may have been updated by the closure of another one (eg. duplicate)
|
||||
issue.reload
|
||||
# don't change the status is the issue is closed
|
||||
next if issue.status.is_closed?
|
||||
csettext = "r#{self.revision}"
|
||||
if self.scmid && (! (csettext =~ /^r[0-9]+$/))
|
||||
csettext = "commit:\"#{self.scmid}\""
|
||||
end
|
||||
journal = issue.init_journal(user || User.anonymous, ll(Setting.default_language, :text_status_changed_by_changeset, csettext))
|
||||
issue.status = fix_status
|
||||
unless Setting.commit_fix_done_ratio.blank?
|
||||
issue.done_ratio = Setting.commit_fix_done_ratio.to_i
|
||||
end
|
||||
Redmine::Hook.call_hook(:model_changeset_scan_commit_for_issue_ids_pre_issue_update,
|
||||
{ :changeset => self, :issue => issue })
|
||||
issue.save
|
||||
comments.scan(/([\s\(\[,-]|^)((#{kw_regexp})[\s:]+)?(#\d+(\s+@#{TIMELOG_RE})?([\s,;&]+#\d+(\s+@#{TIMELOG_RE})?)*)(?=[[:punct:]]|\s|<|$)/i) do |match|
|
||||
action, refs = match[2], match[3]
|
||||
next unless action.present? || ref_keywords_any
|
||||
|
||||
refs.scan(/#(\d+)(\s+@#{TIMELOG_RE})?/).each do |m|
|
||||
issue, hours = find_referenced_issue_by_id(m[0].to_i), m[2]
|
||||
if issue
|
||||
referenced_issues << issue
|
||||
fix_issue(issue) if fix_keywords.include?(action.to_s.downcase)
|
||||
log_time(issue, hours) if hours && Setting.commit_logtime_enabled?
|
||||
end
|
||||
end
|
||||
referenced_issues += target_issues
|
||||
end
|
||||
|
||||
referenced_issues.uniq!
|
||||
@@ -136,6 +144,14 @@ class Changeset < ActiveRecord::Base
|
||||
def long_comments
|
||||
@long_comments || split_comments.last
|
||||
end
|
||||
|
||||
def text_tag
|
||||
if scmid?
|
||||
"commit:#{scmid}"
|
||||
else
|
||||
"r#{revision}"
|
||||
end
|
||||
end
|
||||
|
||||
# Returns the previous changeset
|
||||
def previous
|
||||
@@ -163,13 +179,64 @@ class Changeset < ActiveRecord::Base
|
||||
|
||||
private
|
||||
|
||||
# Finds issues that can be referenced by the commit message
|
||||
# i.e. issues that belong to the repository project, a subproject or a parent project
|
||||
def find_referenced_issues_by_id(ids)
|
||||
return [] if ids.compact.empty?
|
||||
Issue.find_all_by_id(ids, :include => :project).select {|issue|
|
||||
project == issue.project || project.is_ancestor_of?(issue.project) || project.is_descendant_of?(issue.project)
|
||||
}
|
||||
# Finds an issue that can be referenced by the commit message
|
||||
# i.e. an issue that belong to the repository project, a subproject or a parent project
|
||||
def find_referenced_issue_by_id(id)
|
||||
return nil if id.blank?
|
||||
issue = Issue.find_by_id(id.to_i, :include => :project)
|
||||
if issue
|
||||
unless project == issue.project || project.is_ancestor_of?(issue.project) || project.is_descendant_of?(issue.project)
|
||||
issue = nil
|
||||
end
|
||||
end
|
||||
issue
|
||||
end
|
||||
|
||||
def fix_issue(issue)
|
||||
status = IssueStatus.find_by_id(Setting.commit_fix_status_id.to_i)
|
||||
if status.nil?
|
||||
logger.warn("No status macthes commit_fix_status_id setting (#{Setting.commit_fix_status_id})") if logger
|
||||
return issue
|
||||
end
|
||||
|
||||
# the issue may have been updated by the closure of another one (eg. duplicate)
|
||||
issue.reload
|
||||
# don't change the status is the issue is closed
|
||||
return if issue.status && issue.status.is_closed?
|
||||
|
||||
journal = issue.init_journal(user || User.anonymous, ll(Setting.default_language, :text_status_changed_by_changeset, text_tag))
|
||||
issue.status = status
|
||||
unless Setting.commit_fix_done_ratio.blank?
|
||||
issue.done_ratio = Setting.commit_fix_done_ratio.to_i
|
||||
end
|
||||
Redmine::Hook.call_hook(:model_changeset_scan_commit_for_issue_ids_pre_issue_update,
|
||||
{ :changeset => self, :issue => issue })
|
||||
unless issue.save
|
||||
logger.warn("Issue ##{issue.id} could not be saved by changeset #{id}: #{issue.errors.full_messages}") if logger
|
||||
end
|
||||
issue
|
||||
end
|
||||
|
||||
def log_time(issue, hours)
|
||||
time_entry = TimeEntry.new(
|
||||
:user => user,
|
||||
:hours => hours,
|
||||
:issue => issue,
|
||||
:spent_on => commit_date,
|
||||
:comments => l(:text_time_logged_by_changeset, :value => text_tag, :locale => Setting.default_language)
|
||||
)
|
||||
time_entry.activity = log_time_activity unless log_time_activity.nil?
|
||||
|
||||
unless time_entry.save
|
||||
logger.warn("TimeEntry could not be created by changeset #{id}: #{time_entry.errors.full_messages}") if logger
|
||||
end
|
||||
time_entry
|
||||
end
|
||||
|
||||
def log_time_activity
|
||||
if Setting.commit_logtime_activity_id.to_i > 0
|
||||
TimeEntryActivity.find_by_id(Setting.commit_logtime_activity_id.to_i)
|
||||
end
|
||||
end
|
||||
|
||||
def split_comments
|
||||
|
||||
@@ -34,6 +34,10 @@ class CustomValue < ActiveRecord::Base
|
||||
custom_field.editable?
|
||||
end
|
||||
|
||||
def visible?
|
||||
custom_field.visible?
|
||||
end
|
||||
|
||||
def required?
|
||||
custom_field.is_required?
|
||||
end
|
||||
|
||||
@@ -31,6 +31,7 @@ class Group < Principal
|
||||
|
||||
def user_added(user)
|
||||
members.each do |member|
|
||||
next if member.project.nil?
|
||||
user_member = Member.find_by_project_id_and_user_id(member.project_id, user.id) || Member.new(:project_id => member.project_id, :user_id => user.id)
|
||||
member.member_roles.each do |member_role|
|
||||
user_member.member_roles << MemberRole.new(:role => member_role.role, :inherited_from => member_role.id)
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class Issue < ActiveRecord::Base
|
||||
include Redmine::SafeAttributes
|
||||
|
||||
belongs_to :project
|
||||
belongs_to :tracker
|
||||
belongs_to :status, :class_name => 'IssueStatus', :foreign_key => 'status_id'
|
||||
@@ -68,8 +70,7 @@ class Issue < ActiveRecord::Base
|
||||
:conditions => ["#{Project.table_name}.status=#{Project::STATUS_ACTIVE}"]
|
||||
named_scope :for_gantt, lambda {
|
||||
{
|
||||
:include => [:tracker, :status, :assigned_to, :priority, :project, :fixed_version],
|
||||
:order => "#{Issue.table_name}.due_date ASC, #{Issue.table_name}.start_date ASC, #{Issue.table_name}.id ASC"
|
||||
:include => [:tracker, :status, :assigned_to, :priority, :project, :fixed_version]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,32 +216,47 @@ class Issue < ActiveRecord::Base
|
||||
write_attribute :estimated_hours, (h.is_a?(String) ? h.to_hours : h)
|
||||
end
|
||||
|
||||
SAFE_ATTRIBUTES = %w(
|
||||
tracker_id
|
||||
status_id
|
||||
parent_issue_id
|
||||
category_id
|
||||
assigned_to_id
|
||||
priority_id
|
||||
fixed_version_id
|
||||
subject
|
||||
description
|
||||
start_date
|
||||
due_date
|
||||
done_ratio
|
||||
estimated_hours
|
||||
custom_field_values
|
||||
lock_version
|
||||
) unless const_defined?(:SAFE_ATTRIBUTES)
|
||||
safe_attributes 'tracker_id',
|
||||
'status_id',
|
||||
'parent_issue_id',
|
||||
'category_id',
|
||||
'assigned_to_id',
|
||||
'priority_id',
|
||||
'fixed_version_id',
|
||||
'subject',
|
||||
'description',
|
||||
'start_date',
|
||||
'due_date',
|
||||
'done_ratio',
|
||||
'estimated_hours',
|
||||
'custom_field_values',
|
||||
'custom_fields',
|
||||
'lock_version',
|
||||
:if => lambda {|issue, user| issue.new_record? || user.allowed_to?(:edit_issues, issue.project) }
|
||||
|
||||
safe_attributes 'status_id',
|
||||
'assigned_to_id',
|
||||
'fixed_version_id',
|
||||
'done_ratio',
|
||||
:if => lambda {|issue, user| issue.new_statuses_allowed_to(user).any? }
|
||||
|
||||
# Safely sets attributes
|
||||
# Should be called from controllers instead of #attributes=
|
||||
# attr_accessible is too rough because we still want things like
|
||||
# Issue.new(:project => foo) to work
|
||||
# TODO: move workflow/permission checks from controllers to here
|
||||
def safe_attributes=(attrs, user=User.current)
|
||||
return if attrs.nil?
|
||||
attrs = attrs.reject {|k,v| !SAFE_ATTRIBUTES.include?(k)}
|
||||
return unless attrs.is_a?(Hash)
|
||||
|
||||
# User can change issue attributes only if he has :edit permission or if a workflow transition is allowed
|
||||
attrs = delete_unsafe_attributes(attrs, user)
|
||||
return if attrs.empty?
|
||||
|
||||
# Tracker must be set before since new_statuses_allowed_to depends on it.
|
||||
if t = attrs.delete('tracker_id')
|
||||
self.tracker_id = t
|
||||
end
|
||||
|
||||
if attrs['status_id']
|
||||
unless new_statuses_allowed_to(user).collect(&:id).include?(attrs['status_id'].to_i)
|
||||
attrs.delete('status_id')
|
||||
@@ -255,7 +271,7 @@ class Issue < ActiveRecord::Base
|
||||
if !user.allowed_to?(:manage_subtasks, project)
|
||||
attrs.delete('parent_issue_id')
|
||||
elsif !attrs['parent_issue_id'].blank?
|
||||
attrs.delete('parent_issue_id') unless Issue.visible(user).exists?(attrs['parent_issue_id'])
|
||||
attrs.delete('parent_issue_id') unless Issue.visible(user).exists?(attrs['parent_issue_id'].to_i)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -84,14 +84,15 @@ class IssueRelation < ActiveRecord::Base
|
||||
|
||||
def set_issue_to_dates
|
||||
soonest_start = self.successor_soonest_start
|
||||
if soonest_start
|
||||
if soonest_start && issue_to
|
||||
issue_to.reschedule_after(soonest_start)
|
||||
end
|
||||
end
|
||||
|
||||
def successor_soonest_start
|
||||
return nil unless (TYPE_PRECEDES == self.relation_type) && (issue_from.start_date || issue_from.due_date)
|
||||
(issue_from.due_date || issue_from.start_date) + 1 + delay
|
||||
if (TYPE_PRECEDES == self.relation_type) && delay && issue_from && (issue_from.start_date || issue_from.due_date)
|
||||
(issue_from.due_date || issue_from.start_date) + 1 + delay
|
||||
end
|
||||
end
|
||||
|
||||
def <=>(relation)
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
class MailHandler < ActionMailer::Base
|
||||
include ActionView::Helpers::SanitizeHelper
|
||||
include Redmine::I18n
|
||||
|
||||
class UnauthorizedAction < StandardError; end
|
||||
class MissingInformation < StandardError; end
|
||||
@@ -99,7 +100,7 @@ class MailHandler < ActionMailer::Base
|
||||
elsif m = email.subject.match(MESSAGE_REPLY_SUBJECT_RE)
|
||||
receive_message_reply(m[1].to_i)
|
||||
else
|
||||
receive_issue
|
||||
dispatch_to_default
|
||||
end
|
||||
rescue ActiveRecord::RecordInvalid => e
|
||||
# TODO: send a email to the user
|
||||
@@ -112,40 +113,28 @@ class MailHandler < ActionMailer::Base
|
||||
logger.error "MailHandler: unauthorized attempt from #{user}" if logger
|
||||
false
|
||||
end
|
||||
|
||||
def dispatch_to_default
|
||||
receive_issue
|
||||
end
|
||||
|
||||
# Creates a new issue
|
||||
def receive_issue
|
||||
project = target_project
|
||||
tracker = (get_keyword(:tracker) && project.trackers.find_by_name(get_keyword(:tracker))) || project.trackers.find(:first)
|
||||
category = (get_keyword(:category) && project.issue_categories.find_by_name(get_keyword(:category)))
|
||||
priority = (get_keyword(:priority) && IssuePriority.find_by_name(get_keyword(:priority)))
|
||||
status = (get_keyword(:status) && IssueStatus.find_by_name(get_keyword(:status)))
|
||||
assigned_to = (get_keyword(:assigned_to, :override => true) && find_user_from_keyword(get_keyword(:assigned_to, :override => true)))
|
||||
due_date = get_keyword(:due_date, :override => true)
|
||||
start_date = get_keyword(:start_date, :override => true)
|
||||
|
||||
# check permission
|
||||
unless @@handler_options[:no_permission_check]
|
||||
raise UnauthorizedAction unless user.allowed_to?(:add_issues, project)
|
||||
end
|
||||
|
||||
issue = Issue.new(:author => user, :project => project, :tracker => tracker, :category => category, :priority => priority, :due_date => due_date, :start_date => start_date, :assigned_to => assigned_to)
|
||||
# check workflow
|
||||
if status && issue.new_statuses_allowed_to(user).include?(status)
|
||||
issue.status = status
|
||||
end
|
||||
issue.subject = email.subject.chomp[0,255]
|
||||
issue = Issue.new(:author => user, :project => project)
|
||||
issue.safe_attributes = issue_attributes_from_keywords(issue)
|
||||
issue.safe_attributes = {'custom_field_values' => custom_field_values_from_keywords(issue)}
|
||||
issue.subject = email.subject.to_s.chomp[0,255]
|
||||
if issue.subject.blank?
|
||||
issue.subject = '(no subject)'
|
||||
end
|
||||
# custom fields
|
||||
issue.custom_field_values = issue.available_custom_fields.inject({}) do |h, c|
|
||||
if value = get_keyword(c.name, :override => true)
|
||||
h[c.id] = value
|
||||
end
|
||||
h
|
||||
end
|
||||
issue.description = cleaned_up_text_body
|
||||
|
||||
# add To and Cc as watchers before saving so the watchers can reply to Redmine
|
||||
add_watchers(issue)
|
||||
issue.save!
|
||||
@@ -154,41 +143,22 @@ class MailHandler < ActionMailer::Base
|
||||
issue
|
||||
end
|
||||
|
||||
def target_project
|
||||
# TODO: other ways to specify project:
|
||||
# * parse the email To field
|
||||
# * specific project (eg. Setting.mail_handler_target_project)
|
||||
target = Project.find_by_identifier(get_keyword(:project))
|
||||
raise MissingInformation.new('Unable to determine target project') if target.nil?
|
||||
target
|
||||
end
|
||||
|
||||
# Adds a note to an existing issue
|
||||
def receive_issue_reply(issue_id)
|
||||
status = (get_keyword(:status) && IssueStatus.find_by_name(get_keyword(:status)))
|
||||
due_date = get_keyword(:due_date, :override => true)
|
||||
start_date = get_keyword(:start_date, :override => true)
|
||||
assigned_to = (get_keyword(:assigned_to, :override => true) && find_user_from_keyword(get_keyword(:assigned_to, :override => true)))
|
||||
|
||||
issue = Issue.find_by_id(issue_id)
|
||||
return unless issue
|
||||
# check permission
|
||||
unless @@handler_options[:no_permission_check]
|
||||
raise UnauthorizedAction unless user.allowed_to?(:add_issue_notes, issue.project) || user.allowed_to?(:edit_issues, issue.project)
|
||||
raise UnauthorizedAction unless status.nil? || user.allowed_to?(:edit_issues, issue.project)
|
||||
end
|
||||
|
||||
# add the note
|
||||
journal = issue.init_journal(user, cleaned_up_text_body)
|
||||
add_attachments(issue)
|
||||
# check workflow
|
||||
if status && issue.new_statuses_allowed_to(user).include?(status)
|
||||
issue.status = status
|
||||
end
|
||||
issue.start_date = start_date if start_date
|
||||
issue.due_date = due_date if due_date
|
||||
issue.assigned_to = assigned_to if assigned_to
|
||||
|
||||
# ignore CLI-supplied defaults for new issues
|
||||
@@handler_options[:issue].clear
|
||||
|
||||
journal = issue.init_journal(user, cleaned_up_text_body)
|
||||
issue.safe_attributes = issue_attributes_from_keywords(issue)
|
||||
issue.safe_attributes = {'custom_field_values' => custom_field_values_from_keywords(issue)}
|
||||
add_attachments(issue)
|
||||
issue.save!
|
||||
logger.info "MailHandler: issue ##{issue.id} updated by #{user}" if logger && logger.info
|
||||
journal
|
||||
@@ -255,8 +225,8 @@ class MailHandler < ActionMailer::Base
|
||||
@keywords[attr]
|
||||
else
|
||||
@keywords[attr] = begin
|
||||
if (options[:override] || @@handler_options[:allow_override].include?(attr.to_s)) && plain_text_body.gsub!(/^#{attr.to_s.humanize}[ \t]*:[ \t]*(.+)\s*$/i, '')
|
||||
$1.strip
|
||||
if (options[:override] || @@handler_options[:allow_override].include?(attr.to_s)) && (v = extract_keyword!(plain_text_body, attr, options[:format]))
|
||||
v
|
||||
elsif !@@handler_options[:issue][attr].blank?
|
||||
@@handler_options[:issue][attr]
|
||||
end
|
||||
@@ -264,6 +234,65 @@ class MailHandler < ActionMailer::Base
|
||||
end
|
||||
end
|
||||
|
||||
# Destructively extracts the value for +attr+ in +text+
|
||||
# Returns nil if no matching keyword found
|
||||
def extract_keyword!(text, attr, format=nil)
|
||||
keys = [attr.to_s.humanize]
|
||||
if attr.is_a?(Symbol)
|
||||
keys << l("field_#{attr}", :default => '', :locale => user.language) if user
|
||||
keys << l("field_#{attr}", :default => '', :locale => Setting.default_language)
|
||||
end
|
||||
keys.reject! {|k| k.blank?}
|
||||
keys.collect! {|k| Regexp.escape(k)}
|
||||
format ||= '.+'
|
||||
text.gsub!(/^(#{keys.join('|')})[ \t]*:[ \t]*(#{format})\s*$/i, '')
|
||||
$2 && $2.strip
|
||||
end
|
||||
|
||||
def target_project
|
||||
# TODO: other ways to specify project:
|
||||
# * parse the email To field
|
||||
# * specific project (eg. Setting.mail_handler_target_project)
|
||||
target = Project.find_by_identifier(get_keyword(:project))
|
||||
raise MissingInformation.new('Unable to determine target project') if target.nil?
|
||||
target
|
||||
end
|
||||
|
||||
# Returns a Hash of issue attributes extracted from keywords in the email body
|
||||
def issue_attributes_from_keywords(issue)
|
||||
assigned_to = (k = get_keyword(:assigned_to, :override => true)) && find_user_from_keyword(k)
|
||||
assigned_to = nil if assigned_to && !issue.assignable_users.include?(assigned_to)
|
||||
|
||||
attrs = {
|
||||
'tracker_id' => (k = get_keyword(:tracker)) && issue.project.trackers.find_by_name(k).try(:id),
|
||||
'status_id' => (k = get_keyword(:status)) && IssueStatus.find_by_name(k).try(:id),
|
||||
'priority_id' => (k = get_keyword(:priority)) && IssuePriority.find_by_name(k).try(:id),
|
||||
'category_id' => (k = get_keyword(:category)) && issue.project.issue_categories.find_by_name(k).try(:id),
|
||||
'assigned_to_id' => assigned_to.try(:id),
|
||||
'fixed_version_id' => (k = get_keyword(:fixed_version, :override => true)) && issue.project.shared_versions.find_by_name(k).try(:id),
|
||||
'start_date' => get_keyword(:start_date, :override => true, :format => '\d{4}-\d{2}-\d{2}'),
|
||||
'due_date' => get_keyword(:due_date, :override => true, :format => '\d{4}-\d{2}-\d{2}'),
|
||||
'estimated_hours' => get_keyword(:estimated_hours, :override => true),
|
||||
'done_ratio' => get_keyword(:done_ratio, :override => true, :format => '(\d|10)?0')
|
||||
}.delete_if {|k, v| v.blank? }
|
||||
|
||||
if issue.new_record? && attrs['tracker_id'].nil?
|
||||
attrs['tracker_id'] = issue.project.trackers.find(:first).try(:id)
|
||||
end
|
||||
|
||||
attrs
|
||||
end
|
||||
|
||||
# Returns a Hash of issue custom field values extracted from keywords in the email body
|
||||
def custom_field_values_from_keywords(customized)
|
||||
customized.custom_field_values.inject({}) do |h, v|
|
||||
if value = get_keyword(v.custom_field.name, :override => true)
|
||||
h[v.custom_field.id.to_s] = value
|
||||
end
|
||||
h
|
||||
end
|
||||
end
|
||||
|
||||
# Returns the text/plain part of the email
|
||||
# If not found (eg. HTML-only email), returns the body with tags removed
|
||||
def plain_text_body
|
||||
@@ -318,7 +347,7 @@ class MailHandler < ActionMailer::Base
|
||||
def cleanup_body(body)
|
||||
delimiters = Setting.mail_handler_body_delimiters.to_s.split(/[\r\n]+/).reject(&:blank?).map {|s| Regexp.escape(s)}
|
||||
unless delimiters.empty?
|
||||
regex = Regexp.new("^(#{ delimiters.join('|') })\s*[\r\n].*", Regexp::MULTILINE)
|
||||
regex = Regexp.new("^[> ]*(#{ delimiters.join('|') })\s*[\r\n].*", Regexp::MULTILINE)
|
||||
body = body.gsub(regex, '')
|
||||
end
|
||||
body.strip
|
||||
|
||||
@@ -178,9 +178,9 @@ class Mailer < ActionMailer::Base
|
||||
message_id wiki_content
|
||||
recipients wiki_content.recipients
|
||||
cc(wiki_content.page.wiki.watcher_recipients - recipients)
|
||||
subject "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_added, :page => wiki_content.page.pretty_title)}"
|
||||
subject "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_added, :id => wiki_content.page.pretty_title)}"
|
||||
body :wiki_content => wiki_content,
|
||||
:wiki_content_url => url_for(:controller => 'wiki', :action => 'index', :id => wiki_content.project, :page => wiki_content.page.title)
|
||||
:wiki_content_url => url_for(:controller => 'wiki', :action => 'show', :project_id => wiki_content.project, :id => wiki_content.page.title)
|
||||
render_multipart('wiki_content_added', body)
|
||||
end
|
||||
|
||||
@@ -195,10 +195,10 @@ class Mailer < ActionMailer::Base
|
||||
message_id wiki_content
|
||||
recipients wiki_content.recipients
|
||||
cc(wiki_content.page.wiki.watcher_recipients + wiki_content.page.watcher_recipients - recipients)
|
||||
subject "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_updated, :page => wiki_content.page.pretty_title)}"
|
||||
subject "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_updated, :id => wiki_content.page.pretty_title)}"
|
||||
body :wiki_content => wiki_content,
|
||||
:wiki_content_url => url_for(:controller => 'wiki', :action => 'index', :id => wiki_content.project, :page => wiki_content.page.title),
|
||||
:wiki_diff_url => url_for(:controller => 'wiki', :action => 'diff', :id => wiki_content.project, :page => wiki_content.page.title, :version => wiki_content.version)
|
||||
:wiki_content_url => url_for(:controller => 'wiki', :action => 'show', :project_id => wiki_content.project, :id => wiki_content.page.title),
|
||||
:wiki_diff_url => url_for(:controller => 'wiki', :action => 'diff', :project_id => wiki_content.project, :id => wiki_content.page.title, :version => wiki_content.version)
|
||||
render_multipart('wiki_content_updated', body)
|
||||
end
|
||||
|
||||
|
||||
@@ -29,6 +29,11 @@ class News < ActiveRecord::Base
|
||||
acts_as_activity_provider :find_options => {:include => [:project, :author]},
|
||||
:author_key => :author_id
|
||||
|
||||
named_scope :visible, lambda {|*args| {
|
||||
:include => :project,
|
||||
:conditions => Project.allowed_to_condition(args.first || User.current, :view_news)
|
||||
}}
|
||||
|
||||
def visible?(user=User.current)
|
||||
!user.nil? && user.allowed_to?(:view_news, project)
|
||||
end
|
||||
|
||||
@@ -16,10 +16,15 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class Project < ActiveRecord::Base
|
||||
include Redmine::SafeAttributes
|
||||
|
||||
# Project statuses
|
||||
STATUS_ACTIVE = 1
|
||||
STATUS_ARCHIVED = 9
|
||||
|
||||
# Maximum length for project identifiers
|
||||
IDENTIFIER_MAX_LENGTH = 100
|
||||
|
||||
# Specific overidden Activities
|
||||
has_many :time_entry_activities
|
||||
has_many :members, :include => [:user, :roles], :conditions => "#{User.table_name}.type='User' AND #{User.table_name}.status=#{User::STATUS_ACTIVE}"
|
||||
@@ -61,14 +66,14 @@ class Project < ActiveRecord::Base
|
||||
:url => Proc.new {|o| {:controller => 'projects', :action => 'show', :id => o}},
|
||||
:author => nil
|
||||
|
||||
attr_protected :status, :enabled_module_names
|
||||
attr_protected :status
|
||||
|
||||
validates_presence_of :name, :identifier
|
||||
validates_uniqueness_of :name, :identifier
|
||||
validates_uniqueness_of :identifier
|
||||
validates_associated :repository, :wiki
|
||||
validates_length_of :name, :maximum => 30
|
||||
validates_length_of :name, :maximum => 255
|
||||
validates_length_of :homepage, :maximum => 255
|
||||
validates_length_of :identifier, :in => 1..20
|
||||
validates_length_of :identifier, :in => 1..IDENTIFIER_MAX_LENGTH
|
||||
# donwcase letters, digits, dashes but not digits only
|
||||
validates_format_of :identifier, :with => /^(?!\d+$)[a-z0-9\-]*$/, :if => Proc.new { |p| p.identifier_changed? }
|
||||
# reserved words
|
||||
@@ -81,6 +86,24 @@ class Project < ActiveRecord::Base
|
||||
named_scope :all_public, { :conditions => { :is_public => true } }
|
||||
named_scope :visible, lambda { { :conditions => Project.visible_by(User.current) } }
|
||||
|
||||
def initialize(attributes = nil)
|
||||
super
|
||||
|
||||
initialized = (attributes || {}).stringify_keys
|
||||
if !initialized.key?('identifier') && Setting.sequential_project_identifiers?
|
||||
self.identifier = Project.next_identifier
|
||||
end
|
||||
if !initialized.key?('is_public')
|
||||
self.is_public = Setting.default_projects_public?
|
||||
end
|
||||
if !initialized.key?('enabled_module_names')
|
||||
self.enabled_module_names = Setting.default_projects_modules
|
||||
end
|
||||
if !initialized.key?('trackers') && !initialized.key?('tracker_ids')
|
||||
self.trackers = Tracker.all
|
||||
end
|
||||
end
|
||||
|
||||
def identifier=(identifier)
|
||||
super unless identifier_frozen?
|
||||
end
|
||||
@@ -220,6 +243,10 @@ class Project < ActiveRecord::Base
|
||||
self.status == STATUS_ACTIVE
|
||||
end
|
||||
|
||||
def archived?
|
||||
self.status == STATUS_ARCHIVED
|
||||
end
|
||||
|
||||
# Archives the project and its descendants
|
||||
def archive
|
||||
# Check that there is no issue of a non descendant project that is assigned
|
||||
@@ -424,24 +451,20 @@ class Project < ActiveRecord::Base
|
||||
|
||||
# The earliest start date of a project, based on it's issues and versions
|
||||
def start_date
|
||||
if module_enabled?(:issue_tracking)
|
||||
[
|
||||
issues.minimum('start_date'),
|
||||
shared_versions.collect(&:effective_date),
|
||||
shared_versions.collect {|v| v.fixed_issues.minimum('start_date')}
|
||||
].flatten.compact.min
|
||||
end
|
||||
[
|
||||
issues.minimum('start_date'),
|
||||
shared_versions.collect(&:effective_date),
|
||||
shared_versions.collect(&:start_date)
|
||||
].flatten.compact.min
|
||||
end
|
||||
|
||||
# The latest due date of an issue or version
|
||||
def due_date
|
||||
if module_enabled?(:issue_tracking)
|
||||
[
|
||||
issues.maximum('due_date'),
|
||||
shared_versions.collect(&:effective_date),
|
||||
shared_versions.collect {|v| v.fixed_issues.maximum('due_date')}
|
||||
].flatten.compact.max
|
||||
end
|
||||
[
|
||||
issues.maximum('due_date'),
|
||||
shared_versions.collect(&:effective_date),
|
||||
shared_versions.collect {|v| v.fixed_issues.maximum('due_date')}
|
||||
].flatten.compact.max
|
||||
end
|
||||
|
||||
def overdue?
|
||||
@@ -485,7 +508,7 @@ class Project < ActiveRecord::Base
|
||||
|
||||
def enabled_module_names=(module_names)
|
||||
if module_names && module_names.is_a?(Array)
|
||||
module_names = module_names.collect(&:to_s)
|
||||
module_names = module_names.collect(&:to_s).reject(&:blank?)
|
||||
# remove disabled modules
|
||||
enabled_modules.each {|mod| mod.destroy unless module_names.include?(mod.name)}
|
||||
# add new modules
|
||||
@@ -494,7 +517,25 @@ class Project < ActiveRecord::Base
|
||||
enabled_modules.clear
|
||||
end
|
||||
end
|
||||
|
||||
# Returns an array of the enabled modules names
|
||||
def enabled_module_names
|
||||
enabled_modules.collect(&:name)
|
||||
end
|
||||
|
||||
safe_attributes 'name',
|
||||
'description',
|
||||
'homepage',
|
||||
'is_public',
|
||||
'identifier',
|
||||
'custom_field_values',
|
||||
'custom_fields',
|
||||
'tracker_ids',
|
||||
'issue_custom_field_ids'
|
||||
|
||||
safe_attributes 'enabled_module_names',
|
||||
:if => lambda {|project, user| project.new_record? || user.allowed_to?(:select_project_modules, project) }
|
||||
|
||||
# Returns an array of projects that are in this project's hierarchy
|
||||
#
|
||||
# Example: parents, children, siblings
|
||||
@@ -565,6 +606,18 @@ class Project < ActiveRecord::Base
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
# Yields the given block for each project with its level in the tree
|
||||
def self.project_tree(projects, &block)
|
||||
ancestors = []
|
||||
projects.sort_by(&:lft).each do |project|
|
||||
while (ancestors.any? && !project.is_descendant_of?(ancestors.last))
|
||||
ancestors.pop
|
||||
end
|
||||
yield project, ancestors.size
|
||||
ancestors << project
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -650,12 +703,20 @@ class Project < ActiveRecord::Base
|
||||
end
|
||||
|
||||
self.issues << new_issue
|
||||
issues_map[issue.id] = new_issue
|
||||
if new_issue.new_record?
|
||||
logger.info "Project#copy_issues: issue ##{issue.id} could not be copied: #{new_issue.errors.full_messages}" if logger && logger.info
|
||||
else
|
||||
issues_map[issue.id] = new_issue unless new_issue.new_record?
|
||||
end
|
||||
end
|
||||
|
||||
# Relations after in case issues related each other
|
||||
project.issues.each do |issue|
|
||||
new_issue = issues_map[issue.id]
|
||||
unless new_issue
|
||||
# Issue was not copied
|
||||
next
|
||||
end
|
||||
|
||||
# Relations
|
||||
issue.relations_from.each do |source_relation|
|
||||
@@ -682,7 +743,12 @@ class Project < ActiveRecord::Base
|
||||
|
||||
# Copies members from +project+
|
||||
def copy_members(project)
|
||||
project.memberships.each do |member|
|
||||
# Copy users first, then groups to handle members with inherited and given roles
|
||||
members_to_copy = []
|
||||
members_to_copy += project.memberships.select {|m| m.principal.is_a?(User)}
|
||||
members_to_copy += project.memberships.select {|m| !m.principal.is_a?(User)}
|
||||
|
||||
members_to_copy.each do |member|
|
||||
new_member = Member.new
|
||||
new_member.attributes = member.attributes.dup.except("id", "project_id", "created_on")
|
||||
# only copy non inherited roles
|
||||
|
||||
@@ -187,10 +187,18 @@ class Query < ActiveRecord::Base
|
||||
if project
|
||||
user_values += project.users.sort.collect{|s| [s.name, s.id.to_s] }
|
||||
else
|
||||
project_ids = Project.all(:conditions => Project.visible_by(User.current)).collect(&:id)
|
||||
if project_ids.any?
|
||||
# members of the user's projects
|
||||
user_values += User.active.find(:all, :conditions => ["#{User.table_name}.id IN (SELECT DISTINCT user_id FROM members WHERE project_id IN (?))", project_ids]).sort.collect{|s| [s.name, s.id.to_s] }
|
||||
all_projects = Project.visible.all
|
||||
if all_projects.any?
|
||||
# members of visible projects
|
||||
user_values += User.active.find(:all, :conditions => ["#{User.table_name}.id IN (SELECT DISTINCT user_id FROM members WHERE project_id IN (?))", all_projects.collect(&:id)]).sort.collect{|s| [s.name, s.id.to_s] }
|
||||
|
||||
# project filter
|
||||
project_values = []
|
||||
Project.project_tree(all_projects) do |p, level|
|
||||
prefix = (level > 0 ? ('--' * level + ' ') : '')
|
||||
project_values << ["#{prefix}#{p.name}", p.id.to_s]
|
||||
end
|
||||
@available_filters["project_id"] = { :type => :list, :order => 1, :values => project_values} unless project_values.empty?
|
||||
end
|
||||
end
|
||||
@available_filters["assigned_to_id"] = { :type => :list_optional, :order => 4, :values => user_values } unless user_values.empty?
|
||||
@@ -225,12 +233,6 @@ class Query < ActiveRecord::Base
|
||||
@available_filters["fixed_version_id"] = { :type => :list_optional, :order => 7, :values => system_shared_versions.sort.collect{|s| ["#{s.project.name} - #{s.name}", s.id.to_s] } }
|
||||
end
|
||||
add_custom_fields_filters(IssueCustomField.find(:all, :conditions => {:is_filter => true, :is_for_all => true}))
|
||||
# project filter
|
||||
project_values = Project.all(:conditions => Project.visible_by(User.current), :order => 'lft').map do |p|
|
||||
pre = (p.level > 0 ? ('--' * p.level + ' ') : '')
|
||||
["#{pre}#{p.name}",p.id.to_s]
|
||||
end
|
||||
@available_filters["project_id"] = { :type => :list, :order => 1, :values => project_values}
|
||||
end
|
||||
@available_filters
|
||||
end
|
||||
@@ -258,8 +260,10 @@ class Query < ActiveRecord::Base
|
||||
|
||||
# Add multiple filters using +add_filter+
|
||||
def add_filters(fields, operators, values)
|
||||
fields.each do |field|
|
||||
add_filter(field, operators[field], values[field])
|
||||
if fields.is_a?(Array) && operators.is_a?(Hash) && values.is_a?(Hash)
|
||||
fields.each do |field|
|
||||
add_filter(field, operators[field], values[field])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -374,15 +378,15 @@ class Query < ActiveRecord::Base
|
||||
|
||||
# Returns true if the query is a grouped query
|
||||
def grouped?
|
||||
!group_by.blank?
|
||||
!group_by_column.nil?
|
||||
end
|
||||
|
||||
def group_by_column
|
||||
groupable_columns.detect {|c| c.name.to_s == group_by}
|
||||
groupable_columns.detect {|c| c.groupable && c.name.to_s == group_by}
|
||||
end
|
||||
|
||||
def group_by_statement
|
||||
group_by_column.groupable
|
||||
group_by_column.try(:groupable)
|
||||
end
|
||||
|
||||
def project_statement
|
||||
@@ -562,9 +566,19 @@ class Query < ActiveRecord::Base
|
||||
sql = ''
|
||||
case operator
|
||||
when "="
|
||||
sql = "#{db_table}.#{db_field} IN (" + value.collect{|val| "'#{connection.quote_string(val)}'"}.join(",") + ")"
|
||||
if value.any?
|
||||
sql = "#{db_table}.#{db_field} IN (" + value.collect{|val| "'#{connection.quote_string(val)}'"}.join(",") + ")"
|
||||
else
|
||||
# IN an empty set
|
||||
sql = "1=0"
|
||||
end
|
||||
when "!"
|
||||
sql = "(#{db_table}.#{db_field} IS NULL OR #{db_table}.#{db_field} NOT IN (" + value.collect{|val| "'#{connection.quote_string(val)}'"}.join(",") + "))"
|
||||
if value.any?
|
||||
sql = "(#{db_table}.#{db_field} IS NULL OR #{db_table}.#{db_field} NOT IN (" + value.collect{|val| "'#{connection.quote_string(val)}'"}.join(",") + "))"
|
||||
else
|
||||
# NOT IN an empty set
|
||||
sql = "1=1"
|
||||
end
|
||||
when "!*"
|
||||
sql = "#{db_table}.#{db_field} IS NULL"
|
||||
sql << " OR #{db_table}.#{db_field} = ''" if is_custom_filter
|
||||
|
||||
@@ -91,12 +91,13 @@ class Repository < ActiveRecord::Base
|
||||
def relative_path(path)
|
||||
path
|
||||
end
|
||||
|
||||
|
||||
# Finds and returns a revision with a number or the beginning of a hash
|
||||
def find_changeset_by_name(name)
|
||||
return nil if name.blank?
|
||||
changesets.find(:first, :conditions => (name.match(/^\d*$/) ? ["revision = ?", name.to_s] : ["revision LIKE ?", name + '%']))
|
||||
end
|
||||
|
||||
|
||||
def latest_changeset
|
||||
@latest_changeset ||= changesets.find(:first)
|
||||
end
|
||||
|
||||
@@ -29,6 +29,16 @@ class Repository::Git < Repository
|
||||
'Git'
|
||||
end
|
||||
|
||||
# Returns the identifier for the given git changeset
|
||||
def self.changeset_identifier(changeset)
|
||||
changeset.scmid
|
||||
end
|
||||
|
||||
# Returns the readable identifier for the given git changeset
|
||||
def self.format_changeset_identifier(changeset)
|
||||
changeset.revision[0, 8]
|
||||
end
|
||||
|
||||
def branches
|
||||
scm.branches
|
||||
end
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
require 'redmine/scm/adapters/mercurial_adapter'
|
||||
|
||||
class Repository::Mercurial < Repository
|
||||
# sort changesets by revision number
|
||||
has_many :changesets, :order => "#{Changeset.table_name}.id DESC", :foreign_key => 'repository_id'
|
||||
|
||||
attr_protected :root_url
|
||||
validates_presence_of :url
|
||||
|
||||
@@ -52,6 +55,18 @@ class Repository::Mercurial < Repository
|
||||
entries
|
||||
end
|
||||
|
||||
# Returns the latest changesets for +path+; sorted by revision number
|
||||
def latest_changesets(path, rev, limit=10)
|
||||
if path.blank?
|
||||
changesets.find(:all, :include => :user, :limit => limit)
|
||||
else
|
||||
changes.find(:all, :include => {:changeset => :user},
|
||||
:conditions => ["path = ?", path.with_leading_slash],
|
||||
:order => "#{Changeset.table_name}.id DESC",
|
||||
:limit => limit).collect(&:changeset)
|
||||
end
|
||||
end
|
||||
|
||||
def fetch_changesets
|
||||
scm_info = scm.info
|
||||
if scm_info
|
||||
|
||||
@@ -27,7 +27,7 @@ class TimeEntry < ActiveRecord::Base
|
||||
|
||||
acts_as_customizable
|
||||
acts_as_event :title => Proc.new {|o| "#{l_hours(o.hours)} (#{(o.issue || o.project).event_title})"},
|
||||
:url => Proc.new {|o| {:controller => 'timelog', :action => 'details', :project_id => o.project, :issue_id => o.issue}},
|
||||
:url => Proc.new {|o| {:controller => 'timelog', :action => 'index', :project_id => o.project, :issue_id => o.issue}},
|
||||
:author => :user,
|
||||
:description => :comments
|
||||
|
||||
@@ -66,6 +66,9 @@ class TimeEntry < ActiveRecord::Base
|
||||
# these attributes make time aggregations easier
|
||||
def spent_on=(date)
|
||||
super
|
||||
if spent_on.is_a?(Time)
|
||||
self.spent_on = spent_on.to_date
|
||||
end
|
||||
self.tyear = spent_on ? spent_on.year : nil
|
||||
self.tmonth = spent_on ? spent_on.month : nil
|
||||
self.tweek = spent_on ? Date.civil(spent_on.year, spent_on.month, spent_on.day).cweek : nil
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
require "digest/sha1"
|
||||
|
||||
class User < Principal
|
||||
|
||||
include Redmine::SafeAttributes
|
||||
|
||||
# Account statuses
|
||||
STATUS_ANONYMOUS = 0
|
||||
STATUS_ACTIVE = 1
|
||||
@@ -34,13 +35,13 @@ class User < Principal
|
||||
}
|
||||
|
||||
MAIL_NOTIFICATION_OPTIONS = [
|
||||
[:all, :label_user_mail_option_all],
|
||||
[:selected, :label_user_mail_option_selected],
|
||||
[:none, :label_user_mail_option_none],
|
||||
[:only_my_events, :label_user_mail_option_only_my_events],
|
||||
[:only_assigned, :label_user_mail_option_only_assigned],
|
||||
[:only_owner, :label_user_mail_option_only_owner]
|
||||
]
|
||||
['all', :label_user_mail_option_all],
|
||||
['selected', :label_user_mail_option_selected],
|
||||
['only_my_events', :label_user_mail_option_only_my_events],
|
||||
['only_assigned', :label_user_mail_option_only_assigned],
|
||||
['only_owner', :label_user_mail_option_only_owner],
|
||||
['none', :label_user_mail_option_none]
|
||||
]
|
||||
|
||||
has_and_belongs_to_many :groups, :after_add => Proc.new {|user, group| group.user_added(user)},
|
||||
:after_remove => Proc.new {|user, group| group.user_removed(user)}
|
||||
@@ -59,7 +60,7 @@ class User < Principal
|
||||
attr_accessor :password, :password_confirmation
|
||||
attr_accessor :last_before_login_on
|
||||
# Prevents unauthorized assignments
|
||||
attr_protected :login, :admin, :password, :password_confirmation, :hashed_password, :group_ids
|
||||
attr_protected :login, :admin, :password, :password_confirmation, :hashed_password
|
||||
|
||||
validates_presence_of :login, :firstname, :lastname, :mail, :if => Proc.new { |user| !user.is_a?(AnonymousUser) }
|
||||
validates_uniqueness_of :login, :if => Proc.new { |user| !user.login.blank? }, :case_sensitive => false
|
||||
@@ -72,6 +73,7 @@ class User < Principal
|
||||
validates_format_of :mail, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, :allow_nil => true
|
||||
validates_length_of :mail, :maximum => 60, :allow_nil => true
|
||||
validates_confirmation_of :password, :allow_nil => true
|
||||
validates_inclusion_of :mail_notification, :in => MAIL_NOTIFICATION_OPTIONS.collect(&:first), :allow_blank => true
|
||||
|
||||
def before_create
|
||||
self.mail_notification = Setting.default_notification_option if self.mail_notification.blank?
|
||||
@@ -259,12 +261,16 @@ class User < Principal
|
||||
notified_projects_ids
|
||||
end
|
||||
|
||||
# Only users that belong to more than 1 project can select projects for which they are notified
|
||||
def valid_notification_options
|
||||
self.class.valid_notification_options(self)
|
||||
end
|
||||
|
||||
# Only users that belong to more than 1 project can select projects for which they are notified
|
||||
def self.valid_notification_options(user=nil)
|
||||
# Note that @user.membership.size would fail since AR ignores
|
||||
# :include association option when doing a count
|
||||
if memberships.length < 1
|
||||
MAIL_NOTIFICATION_OPTIONS.delete_if {|option| option.first == :selected}
|
||||
if user.nil? || user.memberships.length < 1
|
||||
MAIL_NOTIFICATION_OPTIONS.reject {|option| option.first == 'selected'}
|
||||
else
|
||||
MAIL_NOTIFICATION_OPTIONS
|
||||
end
|
||||
@@ -390,32 +396,54 @@ class User < Principal
|
||||
def allowed_to_globally?(action, options)
|
||||
allowed_to?(action, nil, options.reverse_merge(:global => true))
|
||||
end
|
||||
|
||||
safe_attributes 'login',
|
||||
'firstname',
|
||||
'lastname',
|
||||
'mail',
|
||||
'mail_notification',
|
||||
'language',
|
||||
'custom_field_values',
|
||||
'custom_fields',
|
||||
'identity_url'
|
||||
|
||||
safe_attributes 'status',
|
||||
'auth_source_id',
|
||||
:if => lambda {|user, current_user| current_user.admin?}
|
||||
|
||||
safe_attributes 'group_ids',
|
||||
:if => lambda {|user, current_user| current_user.admin? && !user.new_record?}
|
||||
|
||||
# Utility method to help check if a user should be notified about an
|
||||
# event.
|
||||
#
|
||||
# TODO: only supports Issue events currently
|
||||
def notify_about?(object)
|
||||
case mail_notification.to_sym
|
||||
when :all
|
||||
case mail_notification
|
||||
when 'all'
|
||||
true
|
||||
when :selected
|
||||
# Handled by the Project
|
||||
when :none
|
||||
false
|
||||
when :only_my_events
|
||||
when 'selected'
|
||||
# user receives notifications for created/assigned issues on unselected projects
|
||||
if object.is_a?(Issue) && (object.author == self || object.assigned_to == self)
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
when :only_assigned
|
||||
when 'none'
|
||||
false
|
||||
when 'only_my_events'
|
||||
if object.is_a?(Issue) && (object.author == self || object.assigned_to == self)
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
when 'only_assigned'
|
||||
if object.is_a?(Issue) && object.assigned_to == self
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
when :only_owner
|
||||
when 'only_owner'
|
||||
if object.is_a?(Issue) && object.author == self
|
||||
true
|
||||
else
|
||||
|
||||
@@ -43,7 +43,7 @@ class Version < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def start_date
|
||||
effective_date
|
||||
@start_date ||= fixed_issues.minimum('start_date')
|
||||
end
|
||||
|
||||
def due_date
|
||||
@@ -77,8 +77,7 @@ class Version < ActiveRecord::Base
|
||||
def behind_schedule?
|
||||
if completed_pourcent == 100
|
||||
return false
|
||||
elsif due_date && fixed_issues.present? && fixed_issues.minimum('start_date') # TODO: should use #start_date but that method is wrong...
|
||||
start_date = fixed_issues.minimum('start_date')
|
||||
elsif due_date && start_date
|
||||
done_date = start_date + ((due_date - start_date+1)* completed_pourcent/100).floor
|
||||
return done_date <= Date.today
|
||||
else
|
||||
|
||||
@@ -46,10 +46,10 @@ class Wiki < ActiveRecord::Base
|
||||
def find_page(title, options = {})
|
||||
title = start_page if title.blank?
|
||||
title = Wiki.titleize(title)
|
||||
page = pages.find_by_title(title)
|
||||
page = pages.first(:conditions => ["LOWER(title) LIKE LOWER(?)", title])
|
||||
if !page && !(options[:with_redirect] == false)
|
||||
# search for a redirect
|
||||
redirect = redirects.find_by_title(title)
|
||||
redirect = redirects.first(:conditions => ["LOWER(title) LIKE LOWER(?)", title])
|
||||
page = find_page(redirect.redirects_to, :with_redirect => false) if redirect
|
||||
end
|
||||
page
|
||||
|
||||
@@ -54,7 +54,7 @@ class WikiContent < ActiveRecord::Base
|
||||
:description => :comments,
|
||||
:datetime => :updated_on,
|
||||
:type => 'wiki-page',
|
||||
:url => Proc.new {|o| {:controller => 'wiki', :id => o.page.wiki.project_id, :page => o.page.title, :version => o.version}}
|
||||
:url => Proc.new {|o| {:controller => 'wiki', :action => 'show', :project_id => o.page.wiki.project, :id => o.page.title, :version => o.version}}
|
||||
|
||||
acts_as_activity_provider :type => 'wiki_edits',
|
||||
:timestamp => "#{WikiContent.versioned_table_name}.updated_on",
|
||||
|
||||
@@ -28,7 +28,7 @@ class WikiPage < ActiveRecord::Base
|
||||
acts_as_event :title => Proc.new {|o| "#{l(:label_wiki)}: #{o.title}"},
|
||||
:description => :text,
|
||||
:datetime => :created_on,
|
||||
:url => Proc.new {|o| {:controller => 'wiki', :id => o.wiki.project, :page => o.title}}
|
||||
:url => Proc.new {|o| {:controller => 'wiki', :action => 'show', :project_id => o.wiki.project, :id => o.title}}
|
||||
|
||||
acts_as_searchable :columns => ['title', 'text'],
|
||||
:include => [{:wiki => :project}, :content],
|
||||
@@ -139,7 +139,7 @@ class WikiPage < ActiveRecord::Base
|
||||
parent_page = t.blank? ? nil : self.wiki.find_page(t)
|
||||
self.parent = parent_page
|
||||
end
|
||||
|
||||
|
||||
protected
|
||||
|
||||
def validate
|
||||
|
||||
@@ -69,4 +69,5 @@
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@project}: #{@board}") %>
|
||||
<%= stylesheet_link_tag 'scm' %>
|
||||
<% end %>
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
<h2>403</h2>
|
||||
|
||||
<p><%= l(:notice_not_authorized) %></p>
|
||||
<p><a href="javascript:history.back()">Back</a></p>
|
||||
|
||||
<% html_title '403' %>
|
||||
@@ -1,6 +0,0 @@
|
||||
<h2>404</h2>
|
||||
|
||||
<p><%= l(:notice_file_not_found) %></p>
|
||||
<p><a href="javascript:history.back()">Back</a></p>
|
||||
|
||||
<% html_title '404' %>
|
||||
6
app/views/common/error.html.erb
Normal file
6
app/views/common/error.html.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
<h2><%=h @status %></h2>
|
||||
|
||||
<p id="errorExplanation"><%=h @message %></p>
|
||||
<p><a href="javascript:history.back()">Back</a></p>
|
||||
|
||||
<% html_title @status %>
|
||||
@@ -9,7 +9,7 @@
|
||||
:class => 'icon-edit', :disabled => !@can[:edit] %></li>
|
||||
<% end %>
|
||||
|
||||
<% unless @allowed_statuses.empty? %>
|
||||
<% if @allowed_statuses.present? %>
|
||||
<li class="folder">
|
||||
<a href="#" class="submenu" onclick="return false;"><%= l(:field_status) %></a>
|
||||
<ul>
|
||||
@@ -57,7 +57,7 @@
|
||||
</ul>
|
||||
</li>
|
||||
<% end %>
|
||||
<% unless @assignables.nil? || @assignables.empty? -%>
|
||||
<% if @assignables.present? -%>
|
||||
<li class="folder">
|
||||
<a href="#" class="submenu"><%= l(:field_assigned_to) %></a>
|
||||
<ul>
|
||||
@@ -98,7 +98,7 @@
|
||||
|
||||
<% if !@issue.nil? %>
|
||||
<% if @can[:log_time] -%>
|
||||
<li><%= context_menu_link l(:button_log_time), {:controller => 'timelog', :action => 'edit', :issue_id => @issue},
|
||||
<li><%= context_menu_link l(:button_log_time), {:controller => 'timelog', :action => 'new', :issue_id => @issue},
|
||||
:class => 'icon-time-add' %></li>
|
||||
<% end %>
|
||||
<% if User.current.logged? %>
|
||||
|
||||
@@ -86,10 +86,12 @@ when "IssueCustomField" %>
|
||||
|
||||
<% when "UserCustomField" %>
|
||||
<p><%= f.check_box :is_required %></p>
|
||||
<p><%= f.check_box :visible %></p>
|
||||
<p><%= f.check_box :editable %></p>
|
||||
|
||||
<% when "ProjectCustomField" %>
|
||||
<p><%= f.check_box :is_required %></p>
|
||||
<p><%= f.check_box :visible %></p>
|
||||
<p><%= f.check_box :searchable %></p>
|
||||
|
||||
<% when "TimeEntryCustomField" %>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<p style="float:right;">
|
||||
<p class="contextual">
|
||||
<%= gantt_zoom_link(@gantt, :in) %>
|
||||
<%= gantt_zoom_link(@gantt, :out) %>
|
||||
</p>
|
||||
@@ -59,10 +59,19 @@ end
|
||||
|
||||
# Width of the entire chart
|
||||
g_width = (@gantt.date_to - @gantt.date_from + 1)*zoom
|
||||
# Collect the number of issues on Versions
|
||||
|
||||
@gantt.render(:top => headers_height + 8, :zoom => zoom, :g_width => g_width, :subject_width => subject_width)
|
||||
|
||||
g_height = [(20 * (@gantt.number_of_rows + 6))+150, 206].max
|
||||
t_height = g_height + headers_height
|
||||
|
||||
|
||||
%>
|
||||
|
||||
<% if @gantt.truncated %>
|
||||
<p class="warning"><%= l(:notice_gantt_chart_truncated, :max => @gantt.max_rows) %></p>
|
||||
<% end %>
|
||||
|
||||
<table width="100%" style="border:0; border-collapse: collapse;">
|
||||
<tr>
|
||||
<td style="width:<%= subject_width %>px; padding:0px;">
|
||||
@@ -70,9 +79,10 @@ t_height = g_height + headers_height
|
||||
<div style="position:relative;height:<%= t_height + 24 %>px;width:<%= subject_width + 1 %>px;">
|
||||
<div style="right:-2px;width:<%= subject_width %>px;height:<%= headers_height %>px;background: #eee;" class="gantt_hdr"></div>
|
||||
<div style="right:-2px;width:<%= subject_width %>px;height:<%= t_height %>px;border-left: 1px solid #c0c0c0;overflow:hidden;" class="gantt_hdr"></div>
|
||||
<% top = headers_height + 8 %>
|
||||
|
||||
<%= @gantt.subjects(:headers_height => headers_height, :top => top, :g_width => g_width) %>
|
||||
<div class="gantt_subjects">
|
||||
<%= @gantt.subjects %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
@@ -151,9 +161,7 @@ if show_days
|
||||
end
|
||||
end %>
|
||||
|
||||
<% top = headers_height + 10 %>
|
||||
|
||||
<%= @gantt.lines(:top => top, :zoom => zoom, :g_width => g_width ) %>
|
||||
<%= @gantt.lines %>
|
||||
|
||||
<%
|
||||
#
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<% remote_form_for(:group, @group, :url => {:controller => 'groups', :action => 'add_users', :id => @group}, :method => :post) do |f| %>
|
||||
<fieldset><legend><%=l(:label_user_new)%></legend>
|
||||
|
||||
<p><%= text_field_tag 'user_search', nil %></p>
|
||||
<p><%= label_tag "user_search", l(:label_user_search) %><%= text_field_tag 'user_search', nil %></p>
|
||||
<%= observe_field(:user_search,
|
||||
:frequency => 0.5,
|
||||
:update => :users,
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
|
||||
<div class="box">
|
||||
<p><%= f.text_field :name, :size => 30, :required => true %></p>
|
||||
<p><%= f.select :assigned_to_id, @project.users.collect{|u| [u.name, u.id]}, :include_blank => true %></p>
|
||||
<p><%= f.select :assigned_to_id, @project.users.sort.collect{|u| [u.name, u.id]}, :include_blank => true %></p>
|
||||
</div>
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
<%= @issues.collect {|i| hidden_field_tag('ids[]', i.id)}.join %>
|
||||
|
||||
<div class="box tabular">
|
||||
<fieldset class="attributes">
|
||||
<legend><%= l(:label_change_properties) %></legend>
|
||||
|
||||
<div class="splitcontentleft">
|
||||
<p><label for="new_project_id"><%=l(:field_project)%>:</label>
|
||||
<%= select_tag "new_project_id",
|
||||
project_tree_options_for_select(@allowed_projects, :selected => @target_project),
|
||||
@@ -21,18 +25,25 @@
|
||||
<p><label for="new_tracker_id"><%=l(:field_tracker)%>:</label>
|
||||
<%= select_tag "new_tracker_id", "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_from_collection_for_select(@trackers, "id", "name") %></p>
|
||||
|
||||
<p>
|
||||
<label><%= l(:field_status) %></label>
|
||||
<%= select_tag('status_id', "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_from_collection_for_select(@available_statuses, :id, :name)) %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label><%= l(:field_priority) %></label>
|
||||
<%= select_tag('priority_id', "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_from_collection_for_select(IssuePriority.all, :id, :name)) %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label><%= l(:field_assigned_to) %></label>
|
||||
<%= select_tag('assigned_to_id', content_tag('option', l(:label_no_change_option), :value => '') +
|
||||
content_tag('option', l(:label_nobody), :value => 'none') +
|
||||
options_from_collection_for_select(@target_project.assignable_users, :id, :name)) %>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<label><%= l(:field_status) %></label>
|
||||
<%= select_tag('status_id', "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_from_collection_for_select(@available_statuses, :id, :name)) %>
|
||||
</p>
|
||||
|
||||
<div class="splitcontentright">
|
||||
<p>
|
||||
<label><%= l(:field_start_date) %></label>
|
||||
<%= text_field_tag 'start_date', '', :size => 10 %><%= calendar_for('start_date') %>
|
||||
@@ -42,6 +53,14 @@
|
||||
<label><%= l(:field_due_date) %></label>
|
||||
<%= text_field_tag 'due_date', '', :size => 10 %><%= calendar_for('due_date') %>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<fieldset><legend><%= l(:field_notes) %></legend>
|
||||
<%= text_area_tag 'notes', @notes, :cols => 60, :rows => 10, :class => 'wiki-edit' %>
|
||||
<%= wikitoolbar_for 'notes' %>
|
||||
</fieldset>
|
||||
|
||||
<%= call_hook(:view_issues_move_bottom, :issues => @issues, :target_project => @target_project, :copy => !!@copy) %>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
<%= error_messages_for 'relation' %>
|
||||
|
||||
<p><%= f.select :relation_type, collection_for_relation_type_select, {}, :onchange => "setPredecessorFieldsVisibility();" %>
|
||||
<%= l(:label_issue) %> #<%= f.text_field :issue_to_id, :size => 6 %>
|
||||
<%= l(:label_issue) %> #<%= f.text_field :issue_to_id, :size => 10 %>
|
||||
<div id="related_issue_candidates" class="autocomplete"></div>
|
||||
<%= javascript_tag "observeRelatedIssueField('#{auto_complete_issues_path(:id => @issue, :project_id => @project) }')" %>
|
||||
<span id="predecessor_fields" style="display:none;">
|
||||
<%= l(:field_delay) %>: <%= f.text_field :delay, :size => 3 %> <%= l(:label_day_plural) %>
|
||||
</span>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<% changesets.each do |changeset| %>
|
||||
<div class="changeset <%= cycle('odd', 'even') %>">
|
||||
<p><%= link_to("#{l(:label_revision)} #{changeset.revision}",
|
||||
:controller => 'repositories', :action => 'revision', :id => changeset.project, :rev => changeset.revision) %><br />
|
||||
<p><%= link_to_revision(changeset, changeset.project,
|
||||
:text => "#{l(:label_revision)} #{changeset.format_identifier}") %><br />
|
||||
<span class="author"><%= authoring(changeset.committed_on, changeset.author) %></span></p>
|
||||
<div class="changeset-changes">
|
||||
<%= textilizable(changeset, :comments) %>
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
|
||||
<p><%= f.text_field :subject, :size => 80, :required => true %></p>
|
||||
|
||||
<% unless (@issue.new_record? && @issue.parent_issue_id.nil?) || !User.current.allowed_to?(:manage_subtasks, @project) %>
|
||||
<p><%= f.text_field :parent_issue_id, :size => 10 %></p>
|
||||
<% if User.current.allowed_to?(:manage_subtasks, @project) %>
|
||||
<p id="parent_issue"><%= f.text_field :parent_issue_id, :size => 10 %></p>
|
||||
<div id="parent_issue_candidates" class="autocomplete"></div>
|
||||
<%= javascript_tag "observeParentIssueField('#{auto_complete_issues_path(:id => @issue, :project_id => @project) }')" %>
|
||||
<% end %>
|
||||
@@ -26,11 +26,11 @@
|
||||
</div>
|
||||
|
||||
<% if @issue.new_record? %>
|
||||
<p><%= label_tag('attachments[1][file]', l(:label_attachment_plural))%><%= render :partial => 'attachments/form' %></p>
|
||||
<p id="attachments_form"><%= label_tag('attachments[1][file]', l(:label_attachment_plural))%><%= render :partial => 'attachments/form' %></p>
|
||||
<% end %>
|
||||
|
||||
<% if @issue.new_record? && User.current.allowed_to?(:add_issue_watchers, @project) -%>
|
||||
<p><label><%= l(:label_issue_watchers) %></label>
|
||||
<p id="watchers_form"><label><%= l(:label_issue_watchers) %></label>
|
||||
<% @issue.project.users.sort.each do |user| -%>
|
||||
<label class="floating"><%= check_box_tag 'issue[watcher_user_ids][]', user.id, @issue.watched_by?(user) %> <%=h user %></label>
|
||||
<% end -%>
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
<p><strong><%=l(:label_related_issues)%></strong></p>
|
||||
|
||||
<% if @issue.relations.any? %>
|
||||
<% if @relations.present? %>
|
||||
<table style="width:100%">
|
||||
<% @issue.relations.select {|r| r.other_issue(@issue).visible? }.each do |relation| %>
|
||||
<% @relations.each do |relation| %>
|
||||
<tr>
|
||||
<td><%= l(relation.label_for(@issue)) %> <%= "(#{l('datetime.distance_in_words.x_days', :count => relation.delay)})" if relation.delay && relation.delay != 0 %>
|
||||
<%= h(relation.other_issue(@issue).project) + ' - ' if Setting.cross_project_issue_relations? %>
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
<label><%= l(:field_fixed_version) %></label>
|
||||
<%= select_tag('issue[fixed_version_id]', content_tag('option', l(:label_no_change_option), :value => '') +
|
||||
content_tag('option', l(:label_none), :value => 'none') +
|
||||
version_options_for_select(@project.shared_versions.open)) %>
|
||||
version_options_for_select(@project.shared_versions.open.sort)) %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
|
||||
28
app/views/issues/index.api.rsb
Normal file
28
app/views/issues/index.api.rsb
Normal file
@@ -0,0 +1,28 @@
|
||||
api.array :issues, api_meta(:total_count => @issue_count, :offset => @offset, :limit => @limit) do
|
||||
@issues.each do |issue|
|
||||
api.issue do
|
||||
api.id issue.id
|
||||
api.project(:id => issue.project_id, :name => issue.project.name) unless issue.project.nil?
|
||||
api.tracker(:id => issue.tracker_id, :name => issue.tracker.name) unless issue.tracker.nil?
|
||||
api.status(:id => issue.status_id, :name => issue.status.name) unless issue.status.nil?
|
||||
api.priority(:id => issue.priority_id, :name => issue.priority.name) unless issue.priority.nil?
|
||||
api.author(:id => issue.author_id, :name => issue.author.name) unless issue.author.nil?
|
||||
api.assigned_to(:id => issue.assigned_to_id, :name => issue.assigned_to.name) unless issue.assigned_to.nil?
|
||||
api.category(:id => issue.category_id, :name => issue.category.name) unless issue.category.nil?
|
||||
api.fixed_version(:id => issue.fixed_version_id, :name => issue.fixed_version.name) unless issue.fixed_version.nil?
|
||||
api.parent(:id => issue.parent_id) unless issue.parent.nil?
|
||||
|
||||
api.subject issue.subject
|
||||
api.description issue.description
|
||||
api.start_date issue.start_date
|
||||
api.due_date issue.due_date
|
||||
api.done_ratio issue.done_ratio
|
||||
api.estimated_hours issue.estimated_hours
|
||||
|
||||
render_api_custom_values issue.custom_field_values, api
|
||||
|
||||
api.created_on issue.created_on
|
||||
api.updated_on issue.updated_on
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,33 +0,0 @@
|
||||
xml.instruct!
|
||||
xml.issues :type => 'array' do
|
||||
@issues.each do |issue|
|
||||
xml.issue do
|
||||
xml.id issue.id
|
||||
xml.project(:id => issue.project_id, :name => issue.project.name) unless issue.project.nil?
|
||||
xml.tracker(:id => issue.tracker_id, :name => issue.tracker.name) unless issue.tracker.nil?
|
||||
xml.status(:id => issue.status_id, :name => issue.status.name) unless issue.status.nil?
|
||||
xml.priority(:id => issue.priority_id, :name => issue.priority.name) unless issue.priority.nil?
|
||||
xml.author(:id => issue.author_id, :name => issue.author.name) unless issue.author.nil?
|
||||
xml.assigned_to(:id => issue.assigned_to_id, :name => issue.assigned_to.name) unless issue.assigned_to.nil?
|
||||
xml.category(:id => issue.category_id, :name => issue.category.name) unless issue.category.nil?
|
||||
xml.fixed_version(:id => issue.fixed_version_id, :name => issue.fixed_version.name) unless issue.fixed_version.nil?
|
||||
xml.parent(:id => issue.parent_id) unless issue.parent.nil?
|
||||
|
||||
xml.subject issue.subject
|
||||
xml.description issue.description
|
||||
xml.start_date issue.start_date
|
||||
xml.due_date issue.due_date
|
||||
xml.done_ratio issue.done_ratio
|
||||
xml.estimated_hours issue.estimated_hours
|
||||
|
||||
xml.custom_fields do
|
||||
issue.custom_field_values.each do |custom_value|
|
||||
xml.custom_field custom_value.value, :id => custom_value.custom_field_id, :name => custom_value.custom_field.name
|
||||
end
|
||||
end
|
||||
|
||||
xml.created_on issue.created_on
|
||||
xml.updated_on issue.updated_on
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,7 +1,7 @@
|
||||
<h2><%=l(:label_issue_new)%></h2>
|
||||
|
||||
<% labelled_tabular_form_for :issue, @issue, :url => {:controller => 'issues', :action => 'create', :project_id => @project},
|
||||
:html => {:multipart => true, :id => 'issue-form'} do |f| %>
|
||||
:html => {:multipart => true, :id => 'issue-form', :class => 'tabular new-issue-form'} do |f| %>
|
||||
<%= error_messages_for 'issue' %>
|
||||
<div class="box">
|
||||
<%= render :partial => 'issues/form', :locals => {:f => f} %>
|
||||
|
||||
61
app/views/issues/show.api.rsb
Normal file
61
app/views/issues/show.api.rsb
Normal file
@@ -0,0 +1,61 @@
|
||||
api.issue do
|
||||
api.id @issue.id
|
||||
api.project(:id => @issue.project_id, :name => @issue.project.name) unless @issue.project.nil?
|
||||
api.tracker(:id => @issue.tracker_id, :name => @issue.tracker.name) unless @issue.tracker.nil?
|
||||
api.status(:id => @issue.status_id, :name => @issue.status.name) unless @issue.status.nil?
|
||||
api.priority(:id => @issue.priority_id, :name => @issue.priority.name) unless @issue.priority.nil?
|
||||
api.author(:id => @issue.author_id, :name => @issue.author.name) unless @issue.author.nil?
|
||||
api.assigned_to(:id => @issue.assigned_to_id, :name => @issue.assigned_to.name) unless @issue.assigned_to.nil?
|
||||
api.category(:id => @issue.category_id, :name => @issue.category.name) unless @issue.category.nil?
|
||||
api.fixed_version(:id => @issue.fixed_version_id, :name => @issue.fixed_version.name) unless @issue.fixed_version.nil?
|
||||
api.parent(:id => @issue.parent_id) unless @issue.parent.nil?
|
||||
|
||||
api.subject @issue.subject
|
||||
api.description @issue.description
|
||||
api.start_date @issue.start_date
|
||||
api.due_date @issue.due_date
|
||||
api.done_ratio @issue.done_ratio
|
||||
api.estimated_hours @issue.estimated_hours
|
||||
api.spent_hours(@issue.spent_hours) if User.current.allowed_to?(:view_time_entries, @project)
|
||||
|
||||
render_api_custom_values @issue.custom_field_values, api
|
||||
|
||||
api.created_on @issue.created_on
|
||||
api.updated_on @issue.updated_on
|
||||
|
||||
render_api_issue_children(@issue, api) if include_in_api_response?('children')
|
||||
|
||||
api.array :relations do
|
||||
@relations.each do |relation|
|
||||
api.relation(:id => relation.id, :issue_id => relation.other_issue(@issue).id, :relation_type => relation.relation_type_for(@issue), :delay => relation.delay)
|
||||
end
|
||||
end if include_in_api_response?('relations') && @relations.present?
|
||||
|
||||
api.array :changesets do
|
||||
@issue.changesets.each do |changeset|
|
||||
api.changeset :revision => changeset.revision do
|
||||
api.user(:id => changeset.user_id, :name => changeset.user.name) unless changeset.user.nil?
|
||||
api.comments changeset.comments
|
||||
api.committed_on changeset.committed_on
|
||||
end
|
||||
end
|
||||
end if include_in_api_response?('changesets') && User.current.allowed_to?(:view_changesets, @project)
|
||||
|
||||
api.array :journals do
|
||||
@issue.journals.each do |journal|
|
||||
api.journal :id => journal.id do
|
||||
api.user(:id => journal.user_id, :name => journal.user.name) unless journal.user.nil?
|
||||
api.notes journal.notes
|
||||
api.created_on journal.created_on
|
||||
api.array :details do
|
||||
journal.details.each do |detail|
|
||||
api.detail :property => detail.property, :name => detail.prop_key do
|
||||
api.old_value detail.old_value
|
||||
api.new_value detail.value
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end if include_in_api_response?('journals')
|
||||
end
|
||||
@@ -47,14 +47,16 @@
|
||||
|
||||
<% if @issue.description? || @issue.attachments.any? -%>
|
||||
<hr />
|
||||
<div class="contextual">
|
||||
<%= link_to_remote_if_authorized(l(:button_quote), { :url => {:action => 'reply', :id => @issue} }, :class => 'icon icon-comment') if @issue.description? %>
|
||||
</div>
|
||||
|
||||
<div class="wiki">
|
||||
<%= textilizable @issue, :description, :attachments => @issue.attachments %>
|
||||
</div>
|
||||
|
||||
<% if @issue.description? %>
|
||||
<div class="contextual">
|
||||
<%= link_to_remote_if_authorized(l(:button_quote), { :url => {:controller => 'journals', :action => 'new', :id => @issue} }, :class => 'icon icon-comment') %>
|
||||
</div>
|
||||
|
||||
<p><strong><%=l(:field_description)%></strong></p>
|
||||
<div class="wiki">
|
||||
<%= textilizable @issue, :description, :attachments => @issue.attachments %>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= link_to_attachments @issue %>
|
||||
<% end -%>
|
||||
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
xml.instruct!
|
||||
xml.issue do
|
||||
xml.id @issue.id
|
||||
xml.project(:id => @issue.project_id, :name => @issue.project.name) unless @issue.project.nil?
|
||||
xml.tracker(:id => @issue.tracker_id, :name => @issue.tracker.name) unless @issue.tracker.nil?
|
||||
xml.status(:id => @issue.status_id, :name => @issue.status.name) unless @issue.status.nil?
|
||||
xml.priority(:id => @issue.priority_id, :name => @issue.priority.name) unless @issue.priority.nil?
|
||||
xml.author(:id => @issue.author_id, :name => @issue.author.name) unless @issue.author.nil?
|
||||
xml.assigned_to(:id => @issue.assigned_to_id, :name => @issue.assigned_to.name) unless @issue.assigned_to.nil?
|
||||
xml.category(:id => @issue.category_id, :name => @issue.category.name) unless @issue.category.nil?
|
||||
xml.fixed_version(:id => @issue.fixed_version_id, :name => @issue.fixed_version.name) unless @issue.fixed_version.nil?
|
||||
xml.parent(:id => @issue.parent_id) unless @issue.parent.nil?
|
||||
|
||||
xml.subject @issue.subject
|
||||
xml.description @issue.description
|
||||
xml.start_date @issue.start_date
|
||||
xml.due_date @issue.due_date
|
||||
xml.done_ratio @issue.done_ratio
|
||||
xml.estimated_hours @issue.estimated_hours
|
||||
if User.current.allowed_to?(:view_time_entries, @project)
|
||||
xml.spent_hours @issue.spent_hours
|
||||
end
|
||||
|
||||
xml.custom_fields do
|
||||
@issue.custom_field_values.each do |custom_value|
|
||||
xml.custom_field custom_value.value, :id => custom_value.custom_field_id, :name => custom_value.custom_field.name
|
||||
end
|
||||
end unless @issue.custom_field_values.empty?
|
||||
|
||||
xml.created_on @issue.created_on
|
||||
xml.updated_on @issue.updated_on
|
||||
|
||||
xml.relations do
|
||||
@issue.relations.select {|r| r.other_issue(@issue).visible? }.each do |relation|
|
||||
xml.relation(:id => relation.id, :issue_id => relation.other_issue(@issue).id, :relation_type => relation.relation_type_for(@issue), :delay => relation.delay)
|
||||
end
|
||||
end
|
||||
|
||||
xml.changesets do
|
||||
@issue.changesets.each do |changeset|
|
||||
xml.changeset :revision => changeset.revision do
|
||||
xml.user(:id => changeset.user_id, :name => changeset.user.name) unless changeset.user.nil?
|
||||
xml.comments changeset.comments
|
||||
xml.committed_on changeset.committed_on
|
||||
end
|
||||
end
|
||||
end if User.current.allowed_to?(:view_changesets, @project) && @issue.changesets.any?
|
||||
|
||||
xml.journals do
|
||||
@issue.journals.each do |journal|
|
||||
xml.journal :id => journal.id do
|
||||
xml.user(:id => journal.user_id, :name => journal.user.name) unless journal.user.nil?
|
||||
xml.notes journal.notes
|
||||
xml.details do
|
||||
journal.details.each do |detail|
|
||||
xml.detail :property => detail.property, :name => detail.prop_key, :old => detail.old_value, :new => detail.value
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end unless @issue.journals.empty?
|
||||
end
|
||||
@@ -9,6 +9,7 @@
|
||||
<%= stylesheet_link_tag 'application', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_include_tag :defaults %>
|
||||
<%= heads_for_theme %>
|
||||
<%= heads_for_wiki_formatter %>
|
||||
<!--[if IE]>
|
||||
<style type="text/css">
|
||||
@@ -20,7 +21,7 @@
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
</head>
|
||||
<body class="<%= body_css_classes %>">
|
||||
<body class="<%=h body_css_classes %>">
|
||||
<div id="wrapper">
|
||||
<div id="wrapper2">
|
||||
<div id="top-menu">
|
||||
@@ -68,7 +69,7 @@
|
||||
|
||||
<div id="footer">
|
||||
<div class="bgl"><div class="bgr">
|
||||
Powered by <%= link_to Redmine::Info.app_name, Redmine::Info.url %> © 2006-2010 Jean-Philippe Lang
|
||||
Powered by <%= link_to Redmine::Info.app_name, Redmine::Info.url %> © 2006-2011 Jean-Philippe Lang
|
||||
</div></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -25,6 +25,7 @@ hr {
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<span class="header"><%= Redmine::WikiFormatting.to_html(Setting.text_formatting, Setting.emails_header) %></span>
|
||||
<%= yield %>
|
||||
<hr />
|
||||
<span class="footer"><%= Redmine::WikiFormatting.to_html(Setting.text_formatting, Setting.emails_footer) %></span>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<%= Setting.emails_header %>
|
||||
<%= yield %>
|
||||
--
|
||||
<%= Setting.emails_footer %>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<p><%= l(:mail_body_wiki_content_added, :page => link_to(h(@wiki_content.page.pretty_title), @wiki_content_url),
|
||||
<p><%= l(:mail_body_wiki_content_added, :id => link_to(h(@wiki_content.page.pretty_title), @wiki_content_url),
|
||||
:author => h(@wiki_content.author)) %><br />
|
||||
<em><%=h @wiki_content.comments %></em></p>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<%= l(:mail_body_wiki_content_added, :page => h(@wiki_content.page.pretty_title),
|
||||
<%= l(:mail_body_wiki_content_added, :id => h(@wiki_content.page.pretty_title),
|
||||
:author => h(@wiki_content.author)) %>
|
||||
<%= @wiki_content.comments %>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<p><%= l(:mail_body_wiki_content_updated, :page => link_to(h(@wiki_content.page.pretty_title), @wiki_content_url),
|
||||
<p><%= l(:mail_body_wiki_content_updated, :id => link_to(h(@wiki_content.page.pretty_title), @wiki_content_url),
|
||||
:author => h(@wiki_content.author)) %><br />
|
||||
<em><%=h @wiki_content.comments %></em></p>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<%= l(:mail_body_wiki_content_updated, :page => h(@wiki_content.page.pretty_title),
|
||||
<%= l(:mail_body_wiki_content_updated, :id => h(@wiki_content.page.pretty_title),
|
||||
:author => h(@wiki_content.author)) %>
|
||||
<%= @wiki_content.comments %>
|
||||
|
||||
|
||||
@@ -12,3 +12,7 @@
|
||||
}, :accesskey => accesskey(:preview) %>
|
||||
<% end %>
|
||||
<div id="preview" class="wiki"></div>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= stylesheet_link_tag 'scm' %>
|
||||
<% end %>
|
||||
|
||||
@@ -5,9 +5,9 @@ function recreateSortables() {
|
||||
Sortable.destroy('list-left');
|
||||
Sortable.destroy('list-right');
|
||||
|
||||
Sortable.create("list-top", {constraint:false, containment:['list-top','list-left','list-right'], dropOnEmpty:true, handle:'handle', onUpdate:function(){new Ajax.Request('/my/order_blocks?group=top', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize("list-top")})}, only:'mypage-box', tag:'div'})
|
||||
Sortable.create("list-left", {constraint:false, containment:['list-top','list-left','list-right'], dropOnEmpty:true, handle:'handle', onUpdate:function(){new Ajax.Request('/my/order_blocks?group=left', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize("list-left")})}, only:'mypage-box', tag:'div'})
|
||||
Sortable.create("list-right", {constraint:false, containment:['list-top','list-left','list-right'], dropOnEmpty:true, handle:'handle', onUpdate:function(){new Ajax.Request('/my/order_blocks?group=right', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize("list-right")})}, only:'mypage-box', tag:'div'})
|
||||
Sortable.create("list-top", {constraint:false, containment:['list-top','list-left','list-right'], dropOnEmpty:true, handle:'handle', onUpdate:function(){new Ajax.Request('<%= url_for(:controller => 'my', :action => 'order_blocks', :group => 'top') %>', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize("list-top")})}, only:'mypage-box', tag:'div'})
|
||||
Sortable.create("list-left", {constraint:false, containment:['list-top','list-left','list-right'], dropOnEmpty:true, handle:'handle', onUpdate:function(){new Ajax.Request('<%= url_for(:controller => 'my', :action => 'order_blocks', :group => 'left') %>', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize("list-left")})}, only:'mypage-box', tag:'div'})
|
||||
Sortable.create("list-right", {constraint:false, containment:['list-top','list-left','list-right'], dropOnEmpty:true, handle:'handle', onUpdate:function(){new Ajax.Request('<%= url_for(:controller => 'my', :action => 'order_blocks', :group => 'right') %>', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize("list-right")})}, only:'mypage-box', tag:'div'})
|
||||
}
|
||||
|
||||
function updateSelect() {
|
||||
|
||||
14
app/views/news/index.api.rsb
Normal file
14
app/views/news/index.api.rsb
Normal file
@@ -0,0 +1,14 @@
|
||||
api.array :news, api_meta(:total_count => @news_count, :offset => @offset, :limit => @limit) do
|
||||
@newss.each do |news|
|
||||
api.news do
|
||||
api.id news.id
|
||||
api.project(:id => news.project_id, :name => news.project.name) unless news.project.nil?
|
||||
api.author(:id => news.author_id, :name => news.author.name) unless news.author.nil?
|
||||
|
||||
api.title news.title
|
||||
api.summary news.summary
|
||||
api.description news.description
|
||||
api.created_on news.created_on
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,10 +1,14 @@
|
||||
<div class="contextual">
|
||||
<%= link_to_if_authorized l(:button_edit),
|
||||
edit_news_path(@news),
|
||||
:class => 'icon icon-edit',
|
||||
:accesskey => accesskey(:edit),
|
||||
:onclick => 'Element.show("edit-news"); return false;' %>
|
||||
<%= link_to_if_authorized l(:button_delete), news_path(@news), :confirm => l(:text_are_you_sure), :method => :delete, :class => 'icon icon-del' %>
|
||||
<%= link_to(l(:button_edit),
|
||||
edit_news_path(@news),
|
||||
:class => 'icon icon-edit',
|
||||
:accesskey => accesskey(:edit),
|
||||
:onclick => 'Element.show("edit-news"); return false;') if User.current.allowed_to?(:manage_news, @project) %>
|
||||
<%= link_to(l(:button_delete),
|
||||
news_path(@news),
|
||||
:confirm => l(:text_are_you_sure),
|
||||
:method => :delete,
|
||||
:class => 'icon icon-del') if User.current.allowed_to?(:manage_news, @project) %>
|
||||
</div>
|
||||
|
||||
<h2><%= avatar(@news.author, :size => "24") %><%=h @news.title %></h2>
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
|
||||
<div class="box">
|
||||
<!--[form:project]-->
|
||||
<p><%= f.text_field :name, :required => true, :maxlength => 30 %><br /><em><%= l(:text_caracters_maximum, 30) %></em></p>
|
||||
<p><%= f.text_field :name, :required => true, :size => 60 %></p>
|
||||
|
||||
<% unless @project.allowed_parents.compact.empty? %>
|
||||
<p><%= label(:project, :parent_id, l(:field_parent)) %><%= parent_project_select_tag(@project) %></p>
|
||||
<% end %>
|
||||
|
||||
<p><%= f.text_area :description, :rows => 5, :class => 'wiki-edit' %></p>
|
||||
<p><%= f.text_field :identifier, :required => true, :disabled => @project.identifier_frozen?, :maxlength => 20 %>
|
||||
<p><%= f.text_field :identifier, :required => true, :size => 60, :disabled => @project.identifier_frozen? %>
|
||||
<% unless @project.identifier_frozen? %>
|
||||
<br /><em><%= l(:text_length_between, :min => 1, :max => 20) %> <%= l(:text_project_identifier_info) %></em>
|
||||
<br /><em><%= l(:text_length_between, :min => 1, :max => Project::IDENTIFIER_MAX_LENGTH) %> <%= l(:text_project_identifier_info) %></em>
|
||||
<% end %></p>
|
||||
<p><%= f.text_field :homepage, :size => 60 %></p>
|
||||
<p><%= f.check_box :is_public %></p>
|
||||
@@ -23,8 +23,22 @@
|
||||
<%= call_hook(:view_projects_form, :project => @project, :form => f) %>
|
||||
</div>
|
||||
|
||||
<% if @project.new_record? %>
|
||||
<fieldset class="box"><legend><%= l(:label_module_plural) %></legend>
|
||||
<% Redmine::AccessControl.available_project_modules.each do |m| %>
|
||||
<label class="floating">
|
||||
<%= check_box_tag 'project[enabled_module_names][]', m, @project.module_enabled?(m), :id => "project_enabled_module_names_#{m}" %>
|
||||
<%= l_or_humanize(m, :prefix => "project_module_") %>
|
||||
</label>
|
||||
<% end %>
|
||||
<%= hidden_field_tag 'project[enabled_module_names][]', '' %>
|
||||
<%= javascript_tag 'observeProjectModules()' %>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<% if @project.new_record? || @project.module_enabled?('issue_tracking') %>
|
||||
<% unless @trackers.empty? %>
|
||||
<fieldset class="box"><legend><%=l(:label_tracker_plural)%></legend>
|
||||
<fieldset class="box" id="project_trackers"><legend><%=l(:label_tracker_plural)%></legend>
|
||||
<% @trackers.each do |tracker| %>
|
||||
<label class="floating">
|
||||
<%= check_box_tag 'project[tracker_ids][]', tracker.id, @project.trackers.include?(tracker) %>
|
||||
@@ -36,7 +50,7 @@
|
||||
<% end %>
|
||||
|
||||
<% unless @issue_custom_fields.empty? %>
|
||||
<fieldset class="box"><legend><%=l(:label_custom_field_plural)%></legend>
|
||||
<fieldset class="box" id="project_issue_custom_fields"><legend><%=l(:label_custom_field_plural)%></legend>
|
||||
<% @issue_custom_fields.each do |custom_field| %>
|
||||
<label class="floating">
|
||||
<%= check_box_tag 'project[issue_custom_field_ids][]', custom_field.id, (@project.all_issue_custom_fields.include? custom_field), (custom_field.is_for_all? ? {:disabled => "disabled"} : {}) %>
|
||||
@@ -46,4 +60,5 @@
|
||||
<%= hidden_field_tag 'project[issue_custom_field_ids][]', '' %>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<!--[eoform:project]-->
|
||||
|
||||
16
app/views/projects/index.api.rsb
Normal file
16
app/views/projects/index.api.rsb
Normal file
@@ -0,0 +1,16 @@
|
||||
api.array :projects, api_meta(:total_count => @project_count, :offset => @offset, :limit => @limit) do
|
||||
@projects.each do |project|
|
||||
api.project do
|
||||
api.id project.id
|
||||
api.name project.name
|
||||
api.identifier project.identifier
|
||||
api.description project.description
|
||||
api.parent(:id => project.parent_id, :name => project.parent.name) unless project.parent.nil?
|
||||
|
||||
render_api_custom_values project.visible_custom_field_values, api
|
||||
|
||||
api.created_on project.created_on
|
||||
api.updated_on project.updated_on
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,19 +0,0 @@
|
||||
xml.instruct!
|
||||
xml.projects :type => 'array' do
|
||||
@projects.each do |project|
|
||||
xml.project do
|
||||
xml.id project.id
|
||||
xml.name project.name
|
||||
xml.identifier project.identifier
|
||||
xml.description project.description
|
||||
xml.parent(:id => project.parent_id, :name => project.parent.name) unless project.parent.nil?
|
||||
xml.custom_fields do
|
||||
project.custom_field_values.each do |custom_value|
|
||||
xml.custom_field custom_value.value, :id => custom_value.custom_field_id, :name => custom_value.custom_field.name
|
||||
end
|
||||
end unless project.custom_field_values.empty?
|
||||
xml.created_on project.created_on
|
||||
xml.updated_on project.updated_on
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -2,16 +2,6 @@
|
||||
|
||||
<% labelled_tabular_form_for :project, @project, :url => { :action => "create" } do |f| %>
|
||||
<%= render :partial => 'form', :locals => { :f => f } %>
|
||||
|
||||
<fieldset class="box"><legend><%= l(:label_module_plural) %></legend>
|
||||
<% Redmine::AccessControl.available_project_modules.each do |m| %>
|
||||
<label class="floating">
|
||||
<%= check_box_tag 'enabled_modules[]', m, @project.module_enabled?(m) %>
|
||||
<%= l_or_humanize(m, :prefix => "project_module_") %>
|
||||
</label>
|
||||
<% end %>
|
||||
</fieldset>
|
||||
|
||||
<%= submit_tag l(:button_save) %>
|
||||
<%= javascript_tag "Form.Element.focus('project_name');" %>
|
||||
<% end %>
|
||||
|
||||
@@ -55,10 +55,12 @@
|
||||
|
||||
<div class="splitcontentright">
|
||||
<% if roles.any? && principals.any? %>
|
||||
<% remote_form_for(:member, @member, :url => {:controller => 'members', :action => 'new', :id => @project}, :method => :post) do |f| %>
|
||||
<% remote_form_for(:member, @member, :url => {:controller => 'members', :action => 'new', :id => @project}, :method => :post,
|
||||
:loading => '$(\'member-add-submit\').disable();',
|
||||
:complete => 'if($(\'member-add-submit\')) $(\'member-add-submit\').enable();') do |f| %>
|
||||
<fieldset><legend><%=l(:label_member_new)%></legend>
|
||||
|
||||
<p><%= text_field_tag 'principal_search', nil %></p>
|
||||
<p><%= label_tag "principal_search", l(:label_principal_search) %><%= text_field_tag 'principal_search', nil %></p>
|
||||
<%= observe_field(:principal_search,
|
||||
:frequency => 0.5,
|
||||
:update => :principals,
|
||||
@@ -75,7 +77,7 @@
|
||||
<label><%= check_box_tag 'member[role_ids][]', role.id %> <%=h role %></label>
|
||||
<% end %></p>
|
||||
|
||||
<p><%= submit_tag l(:button_add) %></p>
|
||||
<p><%= submit_tag l(:button_add), :id => 'member-add-submit' %></p>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<legend><%= l(:text_select_project_modules) %></legend>
|
||||
|
||||
<% Redmine::AccessControl.available_project_modules.each do |m| %>
|
||||
<p><label><%= check_box_tag 'enabled_modules[]', m, @project.module_enabled?(m) -%>
|
||||
<p><label><%= check_box_tag 'enabled_module_names[]', m, @project.module_enabled?(m) -%>
|
||||
<%= l_or_humanize(m, :prefix => "project_module_") %></label></p>
|
||||
<% end %>
|
||||
</fieldset>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<th><%= l(:field_description) %></th>
|
||||
<th><%= l(:field_status) %></th>
|
||||
<th><%= l(:field_sharing) %></th>
|
||||
<th><%= l(:label_wiki_page) unless @project.wiki.nil? %></th>
|
||||
<th><%= l(:label_wiki_page) %></th>
|
||||
<th style="width:15%"></th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
@@ -17,7 +17,7 @@
|
||||
<td class="description"><%=h version.description %></td>
|
||||
<td class="status"><%= l("version_status_#{version.status}") %></td>
|
||||
<td class="sharing"><%=h format_version_sharing(version.sharing) %></td>
|
||||
<td><%= link_to(h(version.wiki_page_title), :controller => 'wiki', :page => Wiki.titleize(version.wiki_page_title)) unless version.wiki_page_title.blank? || @project.wiki.nil? %></td>
|
||||
<td><%= link_to_if_authorized(h(version.wiki_page_title), {:controller => 'wiki', :action => 'show', :project_id => version.project, :id => Wiki.titleize(version.wiki_page_title)}) || h(version.wiki_page_title) unless version.wiki_page_title.blank? || version.project.wiki.nil? %></td>
|
||||
<td class="buttons">
|
||||
<% if version.project == @project %>
|
||||
<%= link_to_if_authorized l(:button_edit), {:controller => 'versions', :action => 'edit', :id => version }, :class => 'icon icon-edit' %>
|
||||
|
||||
18
app/views/projects/show.api.rsb
Normal file
18
app/views/projects/show.api.rsb
Normal file
@@ -0,0 +1,18 @@
|
||||
api.project do
|
||||
api.id @project.id
|
||||
api.name @project.name
|
||||
api.identifier @project.identifier
|
||||
api.description @project.description
|
||||
api.homepage @project.homepage
|
||||
|
||||
render_api_custom_values @project.visible_custom_field_values, api
|
||||
|
||||
api.created_on @project.created_on
|
||||
api.updated_on @project.updated_on
|
||||
|
||||
api.array :trackers do
|
||||
@project.trackers.each do |tracker|
|
||||
api.tracker(:id => tracker.id, :name => tracker.name)
|
||||
end
|
||||
end if include_in_api_response?('trackers')
|
||||
end
|
||||
@@ -16,7 +16,7 @@
|
||||
<li><%=l(:label_subproject_plural)%>:
|
||||
<%= @subprojects.collect{|p| link_to(h(p), :action => 'show', :id => p)}.join(", ") %></li>
|
||||
<% end %>
|
||||
<% @project.custom_values.each do |custom_value| %>
|
||||
<% @project.visible_custom_field_values.each do |custom_value| %>
|
||||
<% if !custom_value.value.blank? %>
|
||||
<li><%= custom_value.custom_field.name%>: <%=h show_value(custom_value) %></li>
|
||||
<% end %>
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
xml.instruct!
|
||||
xml.project do
|
||||
xml.id @project.id
|
||||
xml.name @project.name
|
||||
xml.identifier @project.identifier
|
||||
xml.description @project.description
|
||||
xml.homepage @project.homepage
|
||||
|
||||
xml.custom_fields do
|
||||
@project.custom_field_values.each do |custom_value|
|
||||
xml.custom_field custom_value.value, :id => custom_value.custom_field_id, :name => custom_value.custom_field.name
|
||||
end
|
||||
end unless @project.custom_field_values.empty?
|
||||
|
||||
xml.created_on @project.created_on
|
||||
xml.updated_on @project.updated_on
|
||||
|
||||
xml.trackers do
|
||||
@project.trackers.each do |tracker|
|
||||
xml.tracker(:id => tracker.id, :name => tracker.name)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -114,3 +114,4 @@ Event.observe(document,"dom:loaded", apply_filters_observer);
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<%= hidden_field_tag 'fields[]', '' %>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
</td>
|
||||
<td class="size"><%= (entry.size ? number_to_human_size(entry.size) : "?") unless entry.is_dir? %></td>
|
||||
<% changeset = @project.repository.changesets.find_by_revision(entry.lastrev.identifier) if entry.lastrev && entry.lastrev.identifier %>
|
||||
<td class="revision"><%= link_to_revision(changeset.revision, @project) if changeset %></td>
|
||||
<td class="revision"><%= link_to_revision(changeset, @project) if changeset %></td>
|
||||
<td class="age"><%= distance_of_time_in_words(entry.lastrev.time, Time.now) if entry.lastrev && entry.lastrev.time %></td>
|
||||
<td class="author"><%= changeset.nil? ? h(entry.lastrev.author.to_s.split('<').first) : changeset.author if entry.lastrev %></td>
|
||||
<td class="comments"><%=h truncate(changeset.comments, :length => 50) unless changeset.nil? %></td>
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
<% line_num = 1 %>
|
||||
<% revisions.each do |changeset| %>
|
||||
<tr class="changeset <%= cycle 'odd', 'even' %>">
|
||||
<td class="id"><%= link_to_revision(changeset.revision, project) %></td>
|
||||
<td class="checkbox"><%= radio_button_tag('rev', changeset.revision, (line_num==1), :id => "cb-#{line_num}", :onclick => "$('cbto-#{line_num+1}').checked=true;") if show_diff && (line_num < revisions.size) %></td>
|
||||
<td class="checkbox"><%= radio_button_tag('rev_to', changeset.revision, (line_num==2), :id => "cbto-#{line_num}", :onclick => "if ($('cb-#{line_num}').checked==true) {$('cb-#{line_num-1}').checked=true;}") if show_diff && (line_num > 1) %></td>
|
||||
<td class="id"><%= link_to_revision(changeset, project) %></td>
|
||||
<td class="checkbox"><%= radio_button_tag('rev', changeset.identifier, (line_num==1), :id => "cb-#{line_num}", :onclick => "$('cbto-#{line_num+1}').checked=true;") if show_diff && (line_num < revisions.size) %></td>
|
||||
<td class="checkbox"><%= radio_button_tag('rev_to', changeset.identifier, (line_num==2), :id => "cbto-#{line_num}", :onclick => "if ($('cb-#{line_num}').checked==true) {$('cb-#{line_num-1}').checked=true;}") if show_diff && (line_num > 1) %></td>
|
||||
<td class="committed_on"><%= format_time(changeset.committed_on) %></td>
|
||||
<td class="author"><%=h changeset.author %></td>
|
||||
<td class="comments"><%= textilizable(truncate_at_line_break(changeset.comments)) %></td>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<tr class="bloc-<%= revision.nil? ? 0 : colors[revision.identifier || revision.revision] %>">
|
||||
<th class="line-num" id="L<%= line_num %>"><a href="#L<%= line_num %>"><%= line_num %></a></th>
|
||||
<td class="revision">
|
||||
<%= (revision.identifier ? link_to(format_revision(revision.identifier), :action => 'revision', :id => @project, :rev => revision.identifier) : format_revision(revision.revision)) if revision %></td>
|
||||
<%= (revision.identifier ? link_to_revision(revision, @project) : format_revision(revision)) if revision %></td>
|
||||
<td class="author"><%= h(revision.author.to_s.split('<').first) if revision %></td>
|
||||
<td class="line-code"><pre><%= line %></pre></td>
|
||||
</tr>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<h2><%= l(:label_revision) %> <%= format_revision(@rev_to) + ':' if @rev_to %><%= format_revision(@rev) %> <%=h @path %></h2>
|
||||
<h2><%= l(:label_revision) %> <%= format_revision(@changeset_to) + ':' if @changeset_to %><%= format_revision(@changeset) %> <%=h @path %></h2>
|
||||
|
||||
<!-- Choose view type -->
|
||||
<% form_tag({:path => to_path_param(@path)}, :method => 'get') do %>
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
<div class="contextual">
|
||||
«
|
||||
<% unless @changeset.previous.nil? -%>
|
||||
<%= link_to_revision(@changeset.previous.revision, @project, :text => l(:label_previous)) %>
|
||||
<%= link_to_revision(@changeset.previous, @project, :text => l(:label_previous)) %>
|
||||
<% else -%>
|
||||
<%= l(:label_previous) %>
|
||||
<% end -%>
|
||||
|
|
||||
<% unless @changeset.next.nil? -%>
|
||||
<%= link_to_revision(@changeset.next.revision, @project, :text => l(:label_next)) %>
|
||||
<%= link_to_revision(@changeset.next, @project, :text => l(:label_next)) %>
|
||||
<% else -%>
|
||||
<%= l(:label_next) %>
|
||||
<% end -%>
|
||||
»
|
||||
|
||||
<% form_tag({:controller => 'repositories', :action => 'revision', :id => @project, :rev => nil}, :method => :get) do %>
|
||||
<%= text_field_tag 'rev', @rev[0,8], :size => 8 %>
|
||||
<%= text_field_tag 'rev', @rev, :size => 8 %>
|
||||
<%= submit_tag 'OK', :name => nil %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<h2><%= l(:label_revision) %> <%= format_revision(@changeset.revision) %></h2>
|
||||
<h2><%= l(:label_revision) %> <%= format_revision(@changeset) %></h2>
|
||||
|
||||
<p><% if @changeset.scmid %>ID: <%= @changeset.scmid %><br /><% end %>
|
||||
<span class="author"><%= authoring(@changeset.committed_on, @changeset.author) %></span></p>
|
||||
@@ -45,7 +45,7 @@
|
||||
<li class="change change-D"><%= l(:label_deleted) %></li>
|
||||
</ul>
|
||||
|
||||
<p><%= link_to(l(:label_view_diff), :action => 'diff', :id => @project, :path => "", :rev => @changeset.revision) if @changeset.changes.any? %></p>
|
||||
<p><%= link_to(l(:label_view_diff), :action => 'diff', :id => @project, :path => "", :rev => @changeset.identifier) if @changeset.changes.any? %></p>
|
||||
|
||||
<div class="changeset-changes">
|
||||
<%= render_changeset_changes %>
|
||||
@@ -56,4 +56,4 @@
|
||||
<%= stylesheet_link_tag "scm" %>
|
||||
<% end %>
|
||||
|
||||
<% html_title("#{l(:label_revision)} #{@changeset.revision}") -%>
|
||||
<% html_title("#{l(:label_revision)} #{format_revision(@changeset)}") -%>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<div class="box tabular settings">
|
||||
<p><%= setting_check_box :login_required %></p>
|
||||
|
||||
<p><%= setting_select :autologin, [1, 7, 30, 365].collect{|days| [l('datetime.distance_in_words.x_days', :count => days), days.to_s]}, :blank => :label_disabled %></p>
|
||||
<p><%= setting_select :autologin, [[l(:label_disabled), 0]] + [1, 7, 30, 365].collect{|days| [l('datetime.distance_in_words.x_days', :count => days), days.to_s]} %></p>
|
||||
|
||||
<p><%= setting_select :self_registration, [[l(:label_disabled), "0"],
|
||||
[l(:label_registration_activation_by_email), "1"],
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
<p><%= setting_check_box :gravatar_enabled %></p>
|
||||
|
||||
<p><%= setting_select :gravatar_default, [["Wavatars", 'wavatar'], ["Identicons", 'identicon'], ["Monster ids", 'monsterid']], :blank => :label_none %></p>
|
||||
<p><%= setting_select :gravatar_default, [["Wavatars", 'wavatar'], ["Identicons", 'identicon'], ["Monster ids", 'monsterid'], ["Retro", "retro"]], :blank => :label_none %></p>
|
||||
</div>
|
||||
|
||||
<%= submit_tag l(:button_save) %>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<p><%= setting_text_area :welcome_text, :cols => 60, :rows => 5, :class => 'wiki-edit' %></p>
|
||||
<%= wikitoolbar_for 'settings_welcome_text' %>
|
||||
|
||||
<p><%= setting_text_field :attachment_max_size, :size => 6 %> KB</p>
|
||||
<p><%= setting_text_field :attachment_max_size, :size => 6 %> <%= l(:"number.human.storage_units.units.kb") %></p>
|
||||
|
||||
<p><%= setting_text_field :per_page_options, :size => 20 %><br />
|
||||
<em><%= l(:text_comma_separated) %></em></p>
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
<p><%= setting_text_field :feeds_limit, :size => 6 %></p>
|
||||
|
||||
<p><%= setting_text_field :file_max_size_displayed, :size => 6 %> KB</p>
|
||||
<p><%= setting_text_field :file_max_size_displayed, :size => 6 %> <%= l(:"number.human.storage_units.units.kb") %></p>
|
||||
|
||||
<p><%= setting_text_field :diff_max_lines_displayed, :size => 6 %></p>
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
<p><%= setting_select :issue_done_ratio, Issue::DONE_RATIO_OPTIONS.collect {|i| [l("setting_issue_done_ratio_#{i}"), i]} %></p>
|
||||
|
||||
<p><%= setting_text_field :issues_export_limit, :size => 6 %></p>
|
||||
|
||||
<p><%= setting_text_field :gantt_items_limit, :size => 6 %></p>
|
||||
</div>
|
||||
|
||||
<fieldset class="box settings"><legend><%= l(:setting_issue_list_default_columns) %></legend>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user