Revision 1297:0a574315af3e .svn/pristine/d2
| .svn/pristine/d2/d20eef4d6912b004ef4d39c2028db24d0652606b.svn-base | ||
|---|---|---|
| 1 |
# Redmine - project management software |
|
| 2 |
# Copyright (C) 2006-2012 Jean-Philippe Lang |
|
| 3 |
# |
|
| 4 |
# This program is free software; you can redistribute it and/or |
|
| 5 |
# modify it under the terms of the GNU General Public License |
|
| 6 |
# as published by the Free Software Foundation; either version 2 |
|
| 7 |
# of the License, or (at your option) any later version. |
|
| 8 |
# |
|
| 9 |
# This program is distributed in the hope that it will be useful, |
|
| 10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 12 |
# GNU General Public License for more details. |
|
| 13 |
# |
|
| 14 |
# You should have received a copy of the GNU General Public License |
|
| 15 |
# along with this program; if not, write to the Free Software |
|
| 16 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
| 17 |
|
|
| 18 |
class DocumentsController < ApplicationController |
|
| 19 |
default_search_scope :documents |
|
| 20 |
model_object Document |
|
| 21 |
before_filter :find_project_by_project_id, :only => [:index, :new, :create] |
|
| 22 |
before_filter :find_model_object, :except => [:index, :new, :create] |
|
| 23 |
before_filter :find_project_from_association, :except => [:index, :new, :create] |
|
| 24 |
before_filter :authorize |
|
| 25 |
|
|
| 26 |
helper :attachments |
|
| 27 |
|
|
| 28 |
def index |
|
| 29 |
@sort_by = %w(category date title author).include?(params[:sort_by]) ? params[:sort_by] : 'category' |
|
| 30 |
documents = @project.documents.find :all, :include => [:attachments, :category] |
|
| 31 |
case @sort_by |
|
| 32 |
when 'date' |
|
| 33 |
@grouped = documents.group_by {|d| d.updated_on.to_date }
|
|
| 34 |
when 'title' |
|
| 35 |
@grouped = documents.group_by {|d| d.title.first.upcase}
|
|
| 36 |
when 'author' |
|
| 37 |
@grouped = documents.select{|d| d.attachments.any?}.group_by {|d| d.attachments.last.author}
|
|
| 38 |
else |
|
| 39 |
@grouped = documents.group_by(&:category) |
|
| 40 |
end |
|
| 41 |
@document = @project.documents.build |
|
| 42 |
render :layout => false if request.xhr? |
|
| 43 |
end |
|
| 44 |
|
|
| 45 |
def show |
|
| 46 |
@attachments = @document.attachments.find(:all, :order => "created_on DESC") |
|
| 47 |
end |
|
| 48 |
|
|
| 49 |
def new |
|
| 50 |
@document = @project.documents.build |
|
| 51 |
@document.safe_attributes = params[:document] |
|
| 52 |
end |
|
| 53 |
|
|
| 54 |
def create |
|
| 55 |
@document = @project.documents.build |
|
| 56 |
@document.safe_attributes = params[:document] |
|
| 57 |
@document.save_attachments(params[:attachments]) |
|
| 58 |
if @document.save |
|
| 59 |
render_attachment_warning_if_needed(@document) |
|
| 60 |
flash[:notice] = l(:notice_successful_create) |
|
| 61 |
redirect_to :action => 'index', :project_id => @project |
|
| 62 |
else |
|
| 63 |
render :action => 'new' |
|
| 64 |
end |
|
| 65 |
end |
|
| 66 |
|
|
| 67 |
def edit |
|
| 68 |
end |
|
| 69 |
|
|
| 70 |
def update |
|
| 71 |
@document.safe_attributes = params[:document] |
|
| 72 |
if request.put? and @document.save |
|
| 73 |
flash[:notice] = l(:notice_successful_update) |
|
| 74 |
redirect_to :action => 'show', :id => @document |
|
| 75 |
else |
|
| 76 |
render :action => 'edit' |
|
| 77 |
end |
|
| 78 |
end |
|
| 79 |
|
|
| 80 |
def destroy |
|
| 81 |
@document.destroy if request.delete? |
|
| 82 |
redirect_to :controller => 'documents', :action => 'index', :project_id => @project |
|
| 83 |
end |
|
| 84 |
|
|
| 85 |
def add_attachment |
|
| 86 |
attachments = Attachment.attach_files(@document, params[:attachments]) |
|
| 87 |
render_attachment_warning_if_needed(@document) |
|
| 88 |
|
|
| 89 |
if attachments.present? && attachments[:files].present? && Setting.notified_events.include?('document_added')
|
|
| 90 |
Mailer.attachments_added(attachments[:files]).deliver |
|
| 91 |
end |
|
| 92 |
redirect_to :action => 'show', :id => @document |
|
| 93 |
end |
|
| 94 |
end |
|
| .svn/pristine/d2/d22f32dc9c0be86582aa704e517560621de1823c.svn-base | ||
|---|---|---|
| 1 |
--- |
|
| 2 |
issues_001: |
|
| 3 |
created_on: <%= 3.days.ago.to_s(:db) %> |
|
| 4 |
project_id: 1 |
|
| 5 |
updated_on: <%= 1.day.ago.to_s(:db) %> |
|
| 6 |
priority_id: 4 |
|
| 7 |
subject: Can't print recipes |
|
| 8 |
id: 1 |
|
| 9 |
fixed_version_id: |
|
| 10 |
category_id: 1 |
|
| 11 |
description: Unable to print recipes |
|
| 12 |
tracker_id: 1 |
|
| 13 |
assigned_to_id: |
|
| 14 |
author_id: 2 |
|
| 15 |
status_id: 1 |
|
| 16 |
start_date: <%= 1.day.ago.to_date.to_s(:db) %> |
|
| 17 |
due_date: <%= 10.day.from_now.to_date.to_s(:db) %> |
|
| 18 |
root_id: 1 |
|
| 19 |
lft: 1 |
|
| 20 |
rgt: 2 |
|
| 21 |
lock_version: 3 |
|
| 22 |
issues_002: |
|
| 23 |
created_on: 2006-07-19 21:04:21 +02:00 |
|
| 24 |
project_id: 1 |
|
| 25 |
updated_on: 2006-07-19 21:09:50 +02:00 |
|
| 26 |
priority_id: 5 |
|
| 27 |
subject: Add ingredients categories |
|
| 28 |
id: 2 |
|
| 29 |
fixed_version_id: 2 |
|
| 30 |
category_id: |
|
| 31 |
description: Ingredients of the recipe should be classified by categories |
|
| 32 |
tracker_id: 2 |
|
| 33 |
assigned_to_id: 3 |
|
| 34 |
author_id: 2 |
|
| 35 |
status_id: 2 |
|
| 36 |
start_date: <%= 2.day.ago.to_date.to_s(:db) %> |
|
| 37 |
due_date: |
|
| 38 |
root_id: 2 |
|
| 39 |
lft: 1 |
|
| 40 |
rgt: 2 |
|
| 41 |
lock_version: 3 |
|
| 42 |
done_ratio: 30 |
|
| 43 |
issues_003: |
|
| 44 |
created_on: 2006-07-19 21:07:27 +02:00 |
|
| 45 |
project_id: 1 |
|
| 46 |
updated_on: 2006-07-19 21:07:27 +02:00 |
|
| 47 |
priority_id: 4 |
|
| 48 |
subject: Error 281 when updating a recipe |
|
| 49 |
id: 3 |
|
| 50 |
fixed_version_id: |
|
| 51 |
category_id: |
|
| 52 |
description: Error 281 is encountered when saving a recipe |
|
| 53 |
tracker_id: 1 |
|
| 54 |
assigned_to_id: 3 |
|
| 55 |
author_id: 2 |
|
| 56 |
status_id: 1 |
|
| 57 |
start_date: <%= 15.day.ago.to_date.to_s(:db) %> |
|
| 58 |
due_date: <%= 5.day.ago.to_date.to_s(:db) %> |
|
| 59 |
root_id: 3 |
|
| 60 |
lft: 1 |
|
| 61 |
rgt: 2 |
|
| 62 |
issues_004: |
|
| 63 |
created_on: <%= 5.days.ago.to_s(:db) %> |
|
| 64 |
project_id: 2 |
|
| 65 |
updated_on: <%= 2.days.ago.to_s(:db) %> |
|
| 66 |
priority_id: 4 |
|
| 67 |
subject: Issue on project 2 |
|
| 68 |
id: 4 |
|
| 69 |
fixed_version_id: |
|
| 70 |
category_id: |
|
| 71 |
description: Issue on project 2 |
|
| 72 |
tracker_id: 1 |
|
| 73 |
assigned_to_id: 2 |
|
| 74 |
author_id: 2 |
|
| 75 |
status_id: 1 |
|
| 76 |
root_id: 4 |
|
| 77 |
lft: 1 |
|
| 78 |
rgt: 2 |
|
| 79 |
issues_005: |
|
| 80 |
created_on: <%= 5.days.ago.to_s(:db) %> |
|
| 81 |
project_id: 3 |
|
| 82 |
updated_on: <%= 2.days.ago.to_s(:db) %> |
|
| 83 |
priority_id: 4 |
|
| 84 |
subject: Subproject issue |
|
| 85 |
id: 5 |
|
| 86 |
fixed_version_id: |
|
| 87 |
category_id: |
|
| 88 |
description: This is an issue on a cookbook subproject |
|
| 89 |
tracker_id: 1 |
|
| 90 |
assigned_to_id: |
|
| 91 |
author_id: 2 |
|
| 92 |
status_id: 1 |
|
| 93 |
root_id: 5 |
|
| 94 |
lft: 1 |
|
| 95 |
rgt: 2 |
|
| 96 |
issues_006: |
|
| 97 |
created_on: <%= 1.minute.ago.to_s(:db) %> |
|
| 98 |
project_id: 5 |
|
| 99 |
updated_on: <%= 1.minute.ago.to_s(:db) %> |
|
| 100 |
priority_id: 4 |
|
| 101 |
subject: Issue of a private subproject |
|
| 102 |
id: 6 |
|
| 103 |
fixed_version_id: |
|
| 104 |
category_id: |
|
| 105 |
description: This is an issue of a private subproject of cookbook |
|
| 106 |
tracker_id: 1 |
|
| 107 |
assigned_to_id: |
|
| 108 |
author_id: 2 |
|
| 109 |
status_id: 1 |
|
| 110 |
start_date: <%= Date.today.to_s(:db) %> |
|
| 111 |
due_date: <%= 1.days.from_now.to_date.to_s(:db) %> |
|
| 112 |
root_id: 6 |
|
| 113 |
lft: 1 |
|
| 114 |
rgt: 2 |
|
| 115 |
issues_007: |
|
| 116 |
created_on: <%= 10.days.ago.to_s(:db) %> |
|
| 117 |
project_id: 1 |
|
| 118 |
updated_on: <%= 10.days.ago.to_s(:db) %> |
|
| 119 |
priority_id: 5 |
|
| 120 |
subject: Issue due today |
|
| 121 |
id: 7 |
|
| 122 |
fixed_version_id: |
|
| 123 |
category_id: |
|
| 124 |
description: This is an issue that is due today |
|
| 125 |
tracker_id: 1 |
|
| 126 |
assigned_to_id: |
|
| 127 |
author_id: 2 |
|
| 128 |
status_id: 1 |
|
| 129 |
start_date: <%= 10.days.ago.to_s(:db) %> |
|
| 130 |
due_date: <%= Date.today.to_s(:db) %> |
|
| 131 |
lock_version: 0 |
|
| 132 |
root_id: 7 |
|
| 133 |
lft: 1 |
|
| 134 |
rgt: 2 |
|
| 135 |
issues_008: |
|
| 136 |
created_on: <%= 10.days.ago.to_s(:db) %> |
|
| 137 |
project_id: 1 |
|
| 138 |
updated_on: <%= 10.days.ago.to_s(:db) %> |
|
| 139 |
priority_id: 5 |
|
| 140 |
subject: Closed issue |
|
| 141 |
id: 8 |
|
| 142 |
fixed_version_id: |
|
| 143 |
category_id: |
|
| 144 |
description: This is a closed issue. |
|
| 145 |
tracker_id: 1 |
|
| 146 |
assigned_to_id: |
|
| 147 |
author_id: 2 |
|
| 148 |
status_id: 5 |
|
| 149 |
start_date: |
|
| 150 |
due_date: |
|
| 151 |
lock_version: 0 |
|
| 152 |
root_id: 8 |
|
| 153 |
lft: 1 |
|
| 154 |
rgt: 2 |
|
| 155 |
issues_009: |
|
| 156 |
created_on: <%= 1.minute.ago.to_s(:db) %> |
|
| 157 |
project_id: 5 |
|
| 158 |
updated_on: <%= 1.minute.ago.to_s(:db) %> |
|
| 159 |
priority_id: 5 |
|
| 160 |
subject: Blocked Issue |
|
| 161 |
id: 9 |
|
| 162 |
fixed_version_id: |
|
| 163 |
category_id: |
|
| 164 |
description: This is an issue that is blocked by issue #10 |
|
| 165 |
tracker_id: 1 |
|
| 166 |
assigned_to_id: |
|
| 167 |
author_id: 2 |
|
| 168 |
status_id: 1 |
|
| 169 |
start_date: <%= Date.today.to_s(:db) %> |
|
| 170 |
due_date: <%= 1.days.from_now.to_date.to_s(:db) %> |
|
| 171 |
root_id: 9 |
|
| 172 |
lft: 1 |
|
| 173 |
rgt: 2 |
|
| 174 |
issues_010: |
|
| 175 |
created_on: <%= 1.minute.ago.to_s(:db) %> |
|
| 176 |
project_id: 5 |
|
| 177 |
updated_on: <%= 1.minute.ago.to_s(:db) %> |
|
| 178 |
priority_id: 5 |
|
| 179 |
subject: Issue Doing the Blocking |
|
| 180 |
id: 10 |
|
| 181 |
fixed_version_id: |
|
| 182 |
category_id: |
|
| 183 |
description: This is an issue that blocks issue #9 |
|
| 184 |
tracker_id: 1 |
|
| 185 |
assigned_to_id: |
|
| 186 |
author_id: 2 |
|
| 187 |
status_id: 1 |
|
| 188 |
start_date: <%= Date.today.to_s(:db) %> |
|
| 189 |
due_date: <%= 1.days.from_now.to_date.to_s(:db) %> |
|
| 190 |
root_id: 10 |
|
| 191 |
lft: 1 |
|
| 192 |
rgt: 2 |
|
| 193 |
issues_011: |
|
| 194 |
created_on: <%= 3.days.ago.to_s(:db) %> |
|
| 195 |
project_id: 1 |
|
| 196 |
updated_on: <%= 1.day.ago.to_s(:db) %> |
|
| 197 |
priority_id: 5 |
|
| 198 |
subject: Closed issue on a closed version |
|
| 199 |
id: 11 |
|
| 200 |
fixed_version_id: 1 |
|
| 201 |
category_id: 1 |
|
| 202 |
description: |
|
| 203 |
tracker_id: 1 |
|
| 204 |
assigned_to_id: |
|
| 205 |
author_id: 2 |
|
| 206 |
status_id: 5 |
|
| 207 |
start_date: <%= 1.day.ago.to_date.to_s(:db) %> |
|
| 208 |
due_date: |
|
| 209 |
root_id: 11 |
|
| 210 |
lft: 1 |
|
| 211 |
rgt: 2 |
|
| 212 |
issues_012: |
|
| 213 |
created_on: <%= 3.days.ago.to_s(:db) %> |
|
| 214 |
project_id: 1 |
|
| 215 |
updated_on: <%= 1.day.ago.to_s(:db) %> |
|
| 216 |
priority_id: 5 |
|
| 217 |
subject: Closed issue on a locked version |
|
| 218 |
id: 12 |
|
| 219 |
fixed_version_id: 2 |
|
| 220 |
category_id: 1 |
|
| 221 |
description: |
|
| 222 |
tracker_id: 1 |
|
| 223 |
assigned_to_id: |
|
| 224 |
author_id: 3 |
|
| 225 |
status_id: 5 |
|
| 226 |
start_date: <%= 1.day.ago.to_date.to_s(:db) %> |
|
| 227 |
due_date: |
|
| 228 |
root_id: 12 |
|
| 229 |
lft: 1 |
|
| 230 |
rgt: 2 |
|
| 231 |
issues_013: |
|
| 232 |
created_on: <%= 5.days.ago.to_s(:db) %> |
|
| 233 |
project_id: 3 |
|
| 234 |
updated_on: <%= 2.days.ago.to_s(:db) %> |
|
| 235 |
priority_id: 4 |
|
| 236 |
subject: Subproject issue two |
|
| 237 |
id: 13 |
|
| 238 |
fixed_version_id: |
|
| 239 |
category_id: |
|
| 240 |
description: This is a second issue on a cookbook subproject |
|
| 241 |
tracker_id: 1 |
|
| 242 |
assigned_to_id: |
|
| 243 |
author_id: 2 |
|
| 244 |
status_id: 1 |
|
| 245 |
root_id: 13 |
|
| 246 |
lft: 1 |
|
| 247 |
rgt: 2 |
|
| 248 |
issues_014: |
|
| 249 |
id: 14 |
|
| 250 |
created_on: <%= 15.days.ago.to_s(:db) %> |
|
| 251 |
project_id: 3 |
|
| 252 |
updated_on: <%= 15.days.ago.to_s(:db) %> |
|
| 253 |
priority_id: 5 |
|
| 254 |
subject: Private issue on public project |
|
| 255 |
fixed_version_id: |
|
| 256 |
category_id: |
|
| 257 |
description: This is a private issue |
|
| 258 |
tracker_id: 1 |
|
| 259 |
assigned_to_id: |
|
| 260 |
author_id: 2 |
|
| 261 |
status_id: 1 |
|
| 262 |
is_private: true |
|
| 263 |
root_id: 14 |
|
| 264 |
lft: 1 |
|
| 265 |
rgt: 2 |
|
| .svn/pristine/d2/d27387abf40cb290649a11cf867b6086844c45be.svn-base | ||
|---|---|---|
| 1 |
<h2><%= link_to l(:label_group_plural), groups_path %> » <%= l(:label_group_new) %></h2> |
|
| 2 |
|
|
| 3 |
<%= labelled_form_for @group do |f| %> |
|
| 4 |
<%= render :partial => 'form', :locals => { :f => f } %>
|
|
| 5 |
<p> |
|
| 6 |
<%= f.submit l(:button_create) %> |
|
| 7 |
<%= f.submit l(:button_create_and_continue), :name => 'continue' %> |
|
| 8 |
</p> |
|
| 9 |
<% end %> |
|
| .svn/pristine/d2/d290eee74cbe20f80a2e1db7f27a9b1e012b2872.svn-base | ||
|---|---|---|
| 1 |
<h2><%= l(:label_search) %></h2> |
|
| 2 |
|
|
| 3 |
<div class="box"> |
|
| 4 |
<%= form_tag({}, :method => :get) do %>
|
|
| 5 |
<%= label_tag "search-input", l(:description_search), :class => "hidden-for-sighted" %> |
|
| 6 |
<p><%= text_field_tag 'q', @question, :size => 60, :id => 'search-input' %> |
|
| 7 |
<%= javascript_tag "$('#search-input').focus()" %>
|
|
| 8 |
<%= project_select_tag %> |
|
| 9 |
<%= hidden_field_tag 'all_words', '', :id => nil %> |
|
| 10 |
<label><%= check_box_tag 'all_words', 1, @all_words %> <%= l(:label_all_words) %></label> |
|
| 11 |
<%= hidden_field_tag 'titles_only', '', :id => nil %> |
|
| 12 |
<label><%= check_box_tag 'titles_only', 1, @titles_only %> <%= l(:label_search_titles_only) %></label> |
|
| 13 |
</p> |
|
| 14 |
<p> |
|
| 15 |
<% @object_types.each do |t| %> |
|
| 16 |
<label><%= check_box_tag t, 1, @scope.include?(t) %> <%= type_label(t) %></label> |
|
| 17 |
<% end %> |
|
| 18 |
</p> |
|
| 19 |
|
|
| 20 |
<p><%= submit_tag l(:button_submit), :name => 'submit' %></p> |
|
| 21 |
<% end %> |
|
| 22 |
</div> |
|
| 23 |
|
|
| 24 |
<% if @results %> |
|
| 25 |
<div id="search-results-counts"> |
|
| 26 |
<%= render_results_by_type(@results_by_type) unless @scope.size == 1 %> |
|
| 27 |
</div> |
|
| 28 |
|
|
| 29 |
<h3><%= l(:label_result_plural) %> (<%= @results_by_type.values.sum %>)</h3> |
|
| 30 |
<dl id="search-results"> |
|
| 31 |
<% @results.each do |e| %> |
|
| 32 |
<dt class="<%= e.event_type %>"><%= content_tag('span', h(e.project), :class => 'project') unless @project == e.project %> <%= link_to highlight_tokens(truncate(e.event_title, :length => 255), @tokens), e.event_url %></dt>
|
|
| 33 |
<dd><span class="description"><%= highlight_tokens(e.event_description, @tokens) %></span> |
|
| 34 |
<span class="author"><%= format_time(e.event_datetime) %></span></dd> |
|
| 35 |
<% end %> |
|
| 36 |
</dl> |
|
| 37 |
<% end %> |
|
| 38 |
|
|
| 39 |
<p><center> |
|
| 40 |
<% if @pagination_previous_date %> |
|
| 41 |
<%= link_to_content_update("\xc2\xab " + l(:label_previous),
|
|
| 42 |
params.merge(:previous => 1, |
|
| 43 |
:offset => @pagination_previous_date.strftime("%Y%m%d%H%M%S"))) %>
|
|
| 44 |
<% end %> |
|
| 45 |
<% if @pagination_next_date %> |
|
| 46 |
<%= link_to_content_update(l(:label_next) + " \xc2\xbb", |
|
| 47 |
params.merge(:previous => nil, |
|
| 48 |
:offset => @pagination_next_date.strftime("%Y%m%d%H%M%S"))) %>
|
|
| 49 |
<% end %> |
|
| 50 |
</center></p> |
|
| 51 |
|
|
| 52 |
<% html_title(l(:label_search)) -%> |
|
| .svn/pristine/d2/d2c4be81b4c44a84d29e119ba1a5fbaec2efd425.svn-base | ||
|---|---|---|
| 1 |
require File.expand_path('../../test_helper', __FILE__)
|
|
| 2 |
|
|
| 3 |
class <%= @controller_class %>ControllerTest < ActionController::TestCase |
|
| 4 |
# Replace this with your real tests. |
|
| 5 |
def test_truth |
|
| 6 |
assert true |
|
| 7 |
end |
|
| 8 |
end |
|
| .svn/pristine/d2/d2d75f5282e4774cc6782dd489046bdab3498c66.svn-base | ||
|---|---|---|
| 1 |
<%= error_messages_for 'member' %> |
|
| 2 |
<% roles = Role.find_all_givable |
|
| 3 |
members = @project.member_principals.find(:all, :include => [:roles, :principal]).sort %> |
|
| 4 |
|
|
| 5 |
<div class="splitcontentleft"> |
|
| 6 |
<% if members.any? %> |
|
| 7 |
<table class="list members"> |
|
| 8 |
<thead><tr> |
|
| 9 |
<th><%= l(:label_user) %> / <%= l(:label_group) %></th> |
|
| 10 |
<th><%= l(:label_role_plural) %></th> |
|
| 11 |
<th style="width:15%"></th> |
|
| 12 |
<%= call_hook(:view_projects_settings_members_table_header, :project => @project) %> |
|
| 13 |
</tr></thead> |
|
| 14 |
<tbody> |
|
| 15 |
<% members.each do |member| %> |
|
| 16 |
<% next if member.new_record? %> |
|
| 17 |
<tr id="member-<%= member.id %>" class="<%= cycle 'odd', 'even' %> member"> |
|
| 18 |
<td class="<%= member.principal.class.name.downcase %>"><%= link_to_user member.principal %></td> |
|
| 19 |
<td class="roles"> |
|
| 20 |
<span id="member-<%= member.id %>-roles"><%=h member.roles.sort.collect(&:to_s).join(', ') %></span>
|
|
| 21 |
<%= form_for(member, {:as => :membership, :remote => true, :url => membership_path(member),
|
|
| 22 |
:method => :put, |
|
| 23 |
:html => { :id => "member-#{member.id}-roles-form", :class => 'hol' }}
|
|
| 24 |
) do |f| %> |
|
| 25 |
<p><% roles.each do |role| %> |
|
| 26 |
<label><%= check_box_tag 'membership[role_ids][]', role.id, member.roles.include?(role), |
|
| 27 |
:disabled => member.member_roles.detect {|mr| mr.role_id == role.id && !mr.inherited_from.nil?} %> <%=h role %></label><br />
|
|
| 28 |
<% end %></p> |
|
| 29 |
<%= hidden_field_tag 'membership[role_ids][]', '' %> |
|
| 30 |
<p><%= submit_tag l(:button_change), :class => "small" %> |
|
| 31 |
<%= link_to_function l(:button_cancel), |
|
| 32 |
"$('#member-#{member.id}-roles').show(); $('#member-#{member.id}-roles-form').hide(); return false;"
|
|
| 33 |
%></p> |
|
| 34 |
<% end %> |
|
| 35 |
</td> |
|
| 36 |
<td class="buttons"> |
|
| 37 |
<%= link_to_function l(:button_edit), |
|
| 38 |
"$('#member-#{member.id}-roles').hide(); $('#member-#{member.id}-roles-form').show(); return false;",
|
|
| 39 |
:class => 'icon icon-edit' %> |
|
| 40 |
<%= delete_link membership_path(member), |
|
| 41 |
:remote => true, |
|
| 42 |
:data => (!User.current.admin? && member.include?(User.current) ? {:confirm => l(:text_own_membership_delete_confirmation)} : {}) if member.deletable? %>
|
|
| 43 |
</td> |
|
| 44 |
<%= call_hook(:view_projects_settings_members_table_row, { :project => @project, :member => member}) %>
|
|
| 45 |
</tr> |
|
| 46 |
<% end; reset_cycle %> |
|
| 47 |
</tbody> |
|
| 48 |
</table> |
|
| 49 |
<% else %> |
|
| 50 |
<p class="nodata"><%= l(:label_no_data) %></p> |
|
| 51 |
<% end %> |
|
| 52 |
</div> |
|
| 53 |
|
|
| 54 |
<% principals = Principal.active.not_member_of(@project).all(:limit => 100, :order => 'type, login, lastname ASC') %> |
|
| 55 |
|
|
| 56 |
<div class="splitcontentright"> |
|
| 57 |
<% if roles.any? && principals.any? %> |
|
| 58 |
<%= form_for(@member, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %>
|
|
| 59 |
<fieldset><legend><%=l(:label_member_new)%></legend> |
|
| 60 |
|
|
| 61 |
<p><%= label_tag "principal_search", l(:label_principal_search) %><%= text_field_tag 'principal_search', nil %></p> |
|
| 62 |
<%= javascript_tag "observeSearchfield('principal_search', 'principals', '#{ escape_javascript autocomplete_project_memberships_path(@project) }')" %>
|
|
| 63 |
|
|
| 64 |
<div id="principals"> |
|
| 65 |
<%= principals_check_box_tags 'membership[user_ids][]', principals %> |
|
| 66 |
</div> |
|
| 67 |
|
|
| 68 |
<p><%= l(:label_role_plural) %>: |
|
| 69 |
<% roles.each do |role| %> |
|
| 70 |
<label><%= check_box_tag 'membership[role_ids][]', role.id %> <%=h role %></label> |
|
| 71 |
<% end %></p> |
|
| 72 |
|
|
| 73 |
<p><%= submit_tag l(:button_add), :id => 'member-add-submit' %></p> |
|
| 74 |
</fieldset> |
|
| 75 |
<% end %> |
|
| 76 |
<% end %> |
|
| 77 |
</div> |
|
Also available in: Unified diff