Revision 1297:0a574315af3e .svn/pristine/50
| .svn/pristine/50/500090a8cee3e18d3330d97210a96eb6f5618b4a.svn-base | ||
|---|---|---|
| 1 |
<% if @project.shared_versions.any? %> |
|
| 2 |
<table class="list versions"> |
|
| 3 |
<thead><tr> |
|
| 4 |
<th><%= l(:label_version) %></th> |
|
| 5 |
<th><%= l(:field_effective_date) %></th> |
|
| 6 |
<th><%= l(:field_description) %></th> |
|
| 7 |
<th><%= l(:field_status) %></th> |
|
| 8 |
<th><%= l(:field_sharing) %></th> |
|
| 9 |
<th><%= l(:label_wiki_page) %></th> |
|
| 10 |
<th style="width:15%"></th> |
|
| 11 |
</tr></thead> |
|
| 12 |
<tbody> |
|
| 13 |
<% for version in @project.shared_versions.sort %> |
|
| 14 |
<tr class="version <%= cycle 'odd', 'even' %> <%=h version.status %> <%= 'shared' if version.project != @project %>"> |
|
| 15 |
<td class="name"><%= link_to_version version %></td> |
|
| 16 |
<td class="date"><%= format_date(version.effective_date) %></td> |
|
| 17 |
<td class="description"><%=h version.description %></td> |
|
| 18 |
<td class="status"><%= l("version_status_#{version.status}") %></td>
|
|
| 19 |
<td class="sharing"><%=h format_version_sharing(version.sharing) %></td> |
|
| 20 |
<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>
|
|
| 21 |
<td class="buttons"> |
|
| 22 |
<% if version.project == @project && User.current.allowed_to?(:manage_versions, @project) %> |
|
| 23 |
<%= link_to l(:button_edit), edit_version_path(version), :class => 'icon icon-edit' %> |
|
| 24 |
<%= delete_link version_path(version) %> |
|
| 25 |
<% end %> |
|
| 26 |
</td> |
|
| 27 |
</tr> |
|
| 28 |
<% end; reset_cycle %> |
|
| 29 |
</tbody> |
|
| 30 |
</table> |
|
| 31 |
<% else %> |
|
| 32 |
<p class="nodata"><%= l(:label_no_data) %></p> |
|
| 33 |
<% end %> |
|
| 34 |
|
|
| 35 |
<div class="contextual"> |
|
| 36 |
<% if @project.versions.any? %> |
|
| 37 |
<%= link_to l(:label_close_versions), close_completed_project_versions_path(@project), :method => :put %> |
|
| 38 |
<% end %> |
|
| 39 |
</div> |
|
| 40 |
|
|
| 41 |
<p><%= link_to l(:label_version_new), new_project_version_path(@project, :back_url => ''), :class => 'icon icon-add' if User.current.allowed_to?(:manage_versions, @project) %></p> |
|
| .svn/pristine/50/5011cfcaf73ed9e80ee3628efe2190f52626265d.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 BoardsController < ApplicationController |
|
| 19 |
default_search_scope :messages |
|
| 20 |
before_filter :find_project_by_project_id, :find_board_if_available, :authorize |
|
| 21 |
accept_rss_auth :index, :show |
|
| 22 |
|
|
| 23 |
helper :sort |
|
| 24 |
include SortHelper |
|
| 25 |
helper :watchers |
|
| 26 |
|
|
| 27 |
def index |
|
| 28 |
@boards = @project.boards.includes(:last_message => :author).all |
|
| 29 |
# show the board if there is only one |
|
| 30 |
if @boards.size == 1 |
|
| 31 |
@board = @boards.first |
|
| 32 |
show |
|
| 33 |
end |
|
| 34 |
end |
|
| 35 |
|
|
| 36 |
def show |
|
| 37 |
respond_to do |format| |
|
| 38 |
format.html {
|
|
| 39 |
sort_init 'updated_on', 'desc' |
|
| 40 |
sort_update 'created_on' => "#{Message.table_name}.created_on",
|
|
| 41 |
'replies' => "#{Message.table_name}.replies_count",
|
|
| 42 |
'updated_on' => "#{Message.table_name}.updated_on"
|
|
| 43 |
|
|
| 44 |
@topic_count = @board.topics.count |
|
| 45 |
@topic_pages = Paginator.new self, @topic_count, per_page_option, params['page'] |
|
| 46 |
@topics = @board.topics.reorder("#{Message.table_name}.sticky DESC").order(sort_clause).all(
|
|
| 47 |
:include => [:author, {:last_reply => :author}],
|
|
| 48 |
:limit => @topic_pages.items_per_page, |
|
| 49 |
:offset => @topic_pages.current.offset) |
|
| 50 |
@message = Message.new(:board => @board) |
|
| 51 |
render :action => 'show', :layout => !request.xhr? |
|
| 52 |
} |
|
| 53 |
format.atom {
|
|
| 54 |
@messages = @board.messages.find :all, :order => 'created_on DESC', |
|
| 55 |
:include => [:author, :board], |
|
| 56 |
:limit => Setting.feeds_limit.to_i |
|
| 57 |
render_feed(@messages, :title => "#{@project}: #{@board}")
|
|
| 58 |
} |
|
| 59 |
end |
|
| 60 |
end |
|
| 61 |
|
|
| 62 |
def new |
|
| 63 |
@board = @project.boards.build |
|
| 64 |
@board.safe_attributes = params[:board] |
|
| 65 |
end |
|
| 66 |
|
|
| 67 |
def create |
|
| 68 |
@board = @project.boards.build |
|
| 69 |
@board.safe_attributes = params[:board] |
|
| 70 |
if @board.save |
|
| 71 |
flash[:notice] = l(:notice_successful_create) |
|
| 72 |
redirect_to_settings_in_projects |
|
| 73 |
else |
|
| 74 |
render :action => 'new' |
|
| 75 |
end |
|
| 76 |
end |
|
| 77 |
|
|
| 78 |
def edit |
|
| 79 |
end |
|
| 80 |
|
|
| 81 |
def update |
|
| 82 |
@board.safe_attributes = params[:board] |
|
| 83 |
if @board.save |
|
| 84 |
redirect_to_settings_in_projects |
|
| 85 |
else |
|
| 86 |
render :action => 'edit' |
|
| 87 |
end |
|
| 88 |
end |
|
| 89 |
|
|
| 90 |
def destroy |
|
| 91 |
@board.destroy |
|
| 92 |
redirect_to_settings_in_projects |
|
| 93 |
end |
|
| 94 |
|
|
| 95 |
private |
|
| 96 |
def redirect_to_settings_in_projects |
|
| 97 |
redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'boards' |
|
| 98 |
end |
|
| 99 |
|
|
| 100 |
def find_board_if_available |
|
| 101 |
@board = @project.boards.find(params[:id]) if params[:id] |
|
| 102 |
rescue ActiveRecord::RecordNotFound |
|
| 103 |
render_404 |
|
| 104 |
end |
|
| 105 |
end |
|
| .svn/pristine/50/504856dc790e00e3ac8d8064fe856cf6af4e3121.svn-base | ||
|---|---|---|
| 1 |
Date: Tue, 20 Nov 2012 23:08:25 +0900 |
|
| 2 |
Message-ID: <CANBr5-UZM=Odz4U3Q6vHd_9cd2tCT-_P9xDd=hRJ0aoMNTWXbw@mail.gmail.com> |
|
| 3 |
Subject: test |
|
| 4 |
From: John Smith <JSmith@somenet.foo> |
|
| 5 |
To: redmine@somenet.foo |
|
| 6 |
Content-Type: multipart/mixed; boundary=14dae93a13bf76ca5d04ceedc458 |
|
| 7 |
|
|
| 8 |
--14dae93a13bf76ca5d04ceedc458 |
|
| 9 |
Content-Type: text/plain; charset=ISO-8859-1 |
|
| 10 |
|
|
| 11 |
test |
|
| 12 |
|
|
| 13 |
--14dae93a13bf76ca5d04ceedc458 |
|
| 14 |
Content-Type: text/plain; charset=US-ASCII; |
|
| 15 |
name="=?ISO-8859-1?B?xOTW9tz8xOTW9tz8xOTW9tz8xOTW9tz8xOTW9tw=?= |
|
| 16 |
=?ISO-8859-1?B?/MTk1vbc/MTk1vbc/MTk1vbc/MTk1vbc/MTk1vbc?= |
|
| 17 |
=?ISO-8859-1?B?/MTk1vbc/C50eHQ=?=" |
|
| 18 |
Content-Disposition: attachment; |
|
| 19 |
filename="=?ISO-8859-1?B?xOTW9tz8xOTW9tz8xOTW9tz8xOTW9tz8xOTW9tw=?= |
|
| 20 |
=?ISO-8859-1?B?/MTk1vbc/MTk1vbc/MTk1vbc/MTk1vbc/MTk1vbc?= |
|
| 21 |
=?ISO-8859-1?B?/MTk1vbc/C50eHQ=?=" |
|
| 22 |
Content-Transfer-Encoding: base64 |
|
| 23 |
X-Attachment-Id: f_h9r3mcjz0 |
|
| 24 |
|
|
| 25 |
dGVzdAo= |
|
| 26 |
--14dae93a13bf76ca5d04ceedc458-- |
|
| .svn/pristine/50/50beaf110ddcbb163c71b8aaaf14269834bbd169.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 |
require File.expand_path('../../test_helper', __FILE__)
|
|
| 19 |
require 'members_controller' |
|
| 20 |
|
|
| 21 |
# Re-raise errors caught by the controller. |
|
| 22 |
class MembersController; def rescue_action(e) raise e end; end |
|
| 23 |
|
|
| 24 |
|
|
| 25 |
class MembersControllerTest < ActionController::TestCase |
|
| 26 |
fixtures :projects, :members, :member_roles, :roles, :users |
|
| 27 |
|
|
| 28 |
def setup |
|
| 29 |
@controller = MembersController.new |
|
| 30 |
@request = ActionController::TestRequest.new |
|
| 31 |
@response = ActionController::TestResponse.new |
|
| 32 |
User.current = nil |
|
| 33 |
@request.session[:user_id] = 2 |
|
| 34 |
end |
|
| 35 |
|
|
| 36 |
def test_create |
|
| 37 |
assert_difference 'Member.count' do |
|
| 38 |
post :create, :project_id => 1, :membership => {:role_ids => [1], :user_id => 7}
|
|
| 39 |
end |
|
| 40 |
assert_redirected_to '/projects/ecookbook/settings/members' |
|
| 41 |
assert User.find(7).member_of?(Project.find(1)) |
|
| 42 |
end |
|
| 43 |
|
|
| 44 |
def test_create_multiple |
|
| 45 |
assert_difference 'Member.count', 3 do |
|
| 46 |
post :create, :project_id => 1, :membership => {:role_ids => [1], :user_ids => [7, 8, 9]}
|
|
| 47 |
end |
|
| 48 |
assert_redirected_to '/projects/ecookbook/settings/members' |
|
| 49 |
assert User.find(7).member_of?(Project.find(1)) |
|
| 50 |
end |
|
| 51 |
|
|
| 52 |
def test_xhr_create |
|
| 53 |
assert_difference 'Member.count', 3 do |
|
| 54 |
xhr :post, :create, :project_id => 1, :membership => {:role_ids => [1], :user_ids => [7, 8, 9]}
|
|
| 55 |
assert_response :success |
|
| 56 |
assert_template 'create' |
|
| 57 |
assert_equal 'text/javascript', response.content_type |
|
| 58 |
end |
|
| 59 |
assert User.find(7).member_of?(Project.find(1)) |
|
| 60 |
assert User.find(8).member_of?(Project.find(1)) |
|
| 61 |
assert User.find(9).member_of?(Project.find(1)) |
|
| 62 |
assert_include 'tab-content-members', response.body |
|
| 63 |
end |
|
| 64 |
|
|
| 65 |
def test_xhr_create_with_failure |
|
| 66 |
assert_no_difference 'Member.count' do |
|
| 67 |
xhr :post, :create, :project_id => 1, :membership => {:role_ids => [], :user_ids => [7, 8, 9]}
|
|
| 68 |
assert_response :success |
|
| 69 |
assert_template 'create' |
|
| 70 |
assert_equal 'text/javascript', response.content_type |
|
| 71 |
end |
|
| 72 |
assert_match /alert/, response.body, "Alert message not sent" |
|
| 73 |
end |
|
| 74 |
|
|
| 75 |
def test_edit |
|
| 76 |
assert_no_difference 'Member.count' do |
|
| 77 |
put :update, :id => 2, :membership => {:role_ids => [1], :user_id => 3}
|
|
| 78 |
end |
|
| 79 |
assert_redirected_to '/projects/ecookbook/settings/members' |
|
| 80 |
end |
|
| 81 |
|
|
| 82 |
def test_xhr_edit |
|
| 83 |
assert_no_difference 'Member.count' do |
|
| 84 |
xhr :put, :update, :id => 2, :membership => {:role_ids => [1], :user_id => 3}
|
|
| 85 |
assert_response :success |
|
| 86 |
assert_template 'update' |
|
| 87 |
assert_equal 'text/javascript', response.content_type |
|
| 88 |
end |
|
| 89 |
member = Member.find(2) |
|
| 90 |
assert_equal [1], member.role_ids |
|
| 91 |
assert_equal 3, member.user_id |
|
| 92 |
assert_include 'tab-content-members', response.body |
|
| 93 |
end |
|
| 94 |
|
|
| 95 |
def test_destroy |
|
| 96 |
assert_difference 'Member.count', -1 do |
|
| 97 |
delete :destroy, :id => 2 |
|
| 98 |
end |
|
| 99 |
assert_redirected_to '/projects/ecookbook/settings/members' |
|
| 100 |
assert !User.find(3).member_of?(Project.find(1)) |
|
| 101 |
end |
|
| 102 |
|
|
| 103 |
def test_xhr_destroy |
|
| 104 |
assert_difference 'Member.count', -1 do |
|
| 105 |
xhr :delete, :destroy, :id => 2 |
|
| 106 |
assert_response :success |
|
| 107 |
assert_template 'destroy' |
|
| 108 |
assert_equal 'text/javascript', response.content_type |
|
| 109 |
end |
|
| 110 |
assert_nil Member.find_by_id(2) |
|
| 111 |
assert_include 'tab-content-members', response.body |
|
| 112 |
end |
|
| 113 |
|
|
| 114 |
def test_autocomplete |
|
| 115 |
get :autocomplete, :project_id => 1, :q => 'mis' |
|
| 116 |
assert_response :success |
|
| 117 |
assert_template 'autocomplete' |
|
| 118 |
|
|
| 119 |
assert_tag :label, :content => /User Misc/, |
|
| 120 |
:child => { :tag => 'input', :attributes => { :name => 'membership[user_ids][]', :value => '8' } }
|
|
| 121 |
end |
|
| 122 |
end |
|
Also available in: Unified diff