Revision 1297:0a574315af3e .svn/pristine/23
| .svn/pristine/23/23161378fd0429fed8a9ad8cd7fdacb71cc2db68.svn-base | ||
|---|---|---|
| 1 |
<%= error_messages_for @group %> |
|
| 2 |
|
|
| 3 |
<div class="box tabular"> |
|
| 4 |
<p><%= f.text_field :name %></p> |
|
| 5 |
<% @group.custom_field_values.each do |value| %> |
|
| 6 |
<p><%= custom_field_tag_with_label :group, value %></p> |
|
| 7 |
<% end %> |
|
| 8 |
</div> |
|
| .svn/pristine/23/231b70e58d27161a5f2deb16ab2e057f571aa2ab.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 'blankslate' |
|
| 19 |
|
|
| 20 |
module Redmine |
|
| 21 |
module Views |
|
| 22 |
module Builders |
|
| 23 |
class Json < Structure |
|
| 24 |
attr_accessor :jsonp |
|
| 25 |
|
|
| 26 |
def initialize(request, response) |
|
| 27 |
super |
|
| 28 |
self.jsonp = (request.params[:callback] || request.params[:jsonp]).to_s.gsub(/[^a-zA-Z0-9_]/, '') |
|
| 29 |
end |
|
| 30 |
|
|
| 31 |
def output |
|
| 32 |
json = @struct.first.to_json |
|
| 33 |
if jsonp.present? |
|
| 34 |
json = "#{jsonp}(#{json})"
|
|
| 35 |
response.content_type = 'application/javascript' |
|
| 36 |
end |
|
| 37 |
json |
|
| 38 |
end |
|
| 39 |
end |
|
| 40 |
end |
|
| 41 |
end |
|
| 42 |
end |
|
| .svn/pristine/23/2334e365cbae3c0f02226259643ce7e569ce00f6.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 |
|
|
| 20 |
class CommentsControllerTest < ActionController::TestCase |
|
| 21 |
fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :news, :comments |
|
| 22 |
|
|
| 23 |
def setup |
|
| 24 |
User.current = nil |
|
| 25 |
end |
|
| 26 |
|
|
| 27 |
def test_add_comment |
|
| 28 |
@request.session[:user_id] = 2 |
|
| 29 |
post :create, :id => 1, :comment => { :comments => 'This is a test comment' }
|
|
| 30 |
assert_redirected_to '/news/1' |
|
| 31 |
|
|
| 32 |
comment = News.find(1).comments.last |
|
| 33 |
assert_not_nil comment |
|
| 34 |
assert_equal 'This is a test comment', comment.comments |
|
| 35 |
assert_equal User.find(2), comment.author |
|
| 36 |
end |
|
| 37 |
|
|
| 38 |
def test_empty_comment_should_not_be_added |
|
| 39 |
@request.session[:user_id] = 2 |
|
| 40 |
assert_no_difference 'Comment.count' do |
|
| 41 |
post :create, :id => 1, :comment => { :comments => '' }
|
|
| 42 |
assert_response :redirect |
|
| 43 |
assert_redirected_to '/news/1' |
|
| 44 |
end |
|
| 45 |
end |
|
| 46 |
|
|
| 47 |
def test_create_should_be_denied_if_news_is_not_commentable |
|
| 48 |
News.any_instance.stubs(:commentable?).returns(false) |
|
| 49 |
@request.session[:user_id] = 2 |
|
| 50 |
assert_no_difference 'Comment.count' do |
|
| 51 |
post :create, :id => 1, :comment => { :comments => 'This is a test comment' }
|
|
| 52 |
assert_response 403 |
|
| 53 |
end |
|
| 54 |
end |
|
| 55 |
|
|
| 56 |
def test_destroy_comment |
|
| 57 |
comments_count = News.find(1).comments.size |
|
| 58 |
@request.session[:user_id] = 2 |
|
| 59 |
delete :destroy, :id => 1, :comment_id => 2 |
|
| 60 |
assert_redirected_to '/news/1' |
|
| 61 |
assert_nil Comment.find_by_id(2) |
|
| 62 |
assert_equal comments_count - 1, News.find(1).comments.size |
|
| 63 |
end |
|
| 64 |
end |
|
| .svn/pristine/23/23389be83ae1e1f9aef946f48e6c0e1c8c6bbfb1.svn-base | ||
|---|---|---|
| 1 |
<% @gantt.view = self %> |
|
| 2 |
<h2><%= @query.new_record? ? l(:label_gantt) : h(@query.name) %></h2> |
|
| 3 |
|
|
| 4 |
<%= form_tag({:controller => 'gantts', :action => 'show',
|
|
| 5 |
:project_id => @project, :month => params[:month], |
|
| 6 |
:year => params[:year], :months => params[:months]}, |
|
| 7 |
:method => :get, :id => 'query_form') do %> |
|
| 8 |
<%= hidden_field_tag 'set_filter', '1' %> |
|
| 9 |
<fieldset id="filters" class="collapsible <%= @query.new_record? ? "" : "collapsed" %>"> |
|
| 10 |
<legend onclick="toggleFieldset(this);"><%= l(:label_filter_plural) %></legend> |
|
| 11 |
<div style="<%= @query.new_record? ? "" : "display: none;" %>"> |
|
| 12 |
<%= render :partial => 'queries/filters', :locals => {:query => @query} %>
|
|
| 13 |
</div> |
|
| 14 |
</fieldset> |
|
| 15 |
|
|
| 16 |
<p class="contextual"> |
|
| 17 |
<%= gantt_zoom_link(@gantt, :in) %> |
|
| 18 |
<%= gantt_zoom_link(@gantt, :out) %> |
|
| 19 |
</p> |
|
| 20 |
|
|
| 21 |
<p class="buttons"> |
|
| 22 |
<%= text_field_tag 'months', @gantt.months, :size => 2 %> |
|
| 23 |
<%= l(:label_months_from) %> |
|
| 24 |
<%= select_month(@gantt.month_from, :prefix => "month", :discard_type => true) %> |
|
| 25 |
<%= select_year(@gantt.year_from, :prefix => "year", :discard_type => true) %> |
|
| 26 |
<%= hidden_field_tag 'zoom', @gantt.zoom %> |
|
| 27 |
|
|
| 28 |
<%= link_to_function l(:button_apply), '$("#query_form").submit()',
|
|
| 29 |
:class => 'icon icon-checked' %> |
|
| 30 |
<%= link_to l(:button_clear), { :project_id => @project, :set_filter => 1 },
|
|
| 31 |
:class => 'icon icon-reload' %> |
|
| 32 |
</p> |
|
| 33 |
<% end %> |
|
| 34 |
|
|
| 35 |
<%= error_messages_for 'query' %> |
|
| 36 |
<% if @query.valid? %> |
|
| 37 |
<% |
|
| 38 |
zoom = 1 |
|
| 39 |
@gantt.zoom.times { zoom = zoom * 2 }
|
|
| 40 |
|
|
| 41 |
subject_width = 330 |
|
| 42 |
header_heigth = 18 |
|
| 43 |
|
|
| 44 |
headers_height = header_heigth |
|
| 45 |
show_weeks = false |
|
| 46 |
show_days = false |
|
| 47 |
|
|
| 48 |
if @gantt.zoom > 1 |
|
| 49 |
show_weeks = true |
|
| 50 |
headers_height = 2 * header_heigth |
|
| 51 |
if @gantt.zoom > 2 |
|
| 52 |
show_days = true |
|
| 53 |
headers_height = 3 * header_heigth |
|
| 54 |
end |
|
| 55 |
end |
|
| 56 |
|
|
| 57 |
# Width of the entire chart |
|
| 58 |
g_width = ((@gantt.date_to - @gantt.date_from + 1) * zoom).to_i |
|
| 59 |
@gantt.render(:top => headers_height + 8, |
|
| 60 |
:zoom => zoom, |
|
| 61 |
:g_width => g_width, |
|
| 62 |
:subject_width => subject_width) |
|
| 63 |
g_height = [(20 * (@gantt.number_of_rows + 6)) + 150, 206].max |
|
| 64 |
t_height = g_height + headers_height |
|
| 65 |
%> |
|
| 66 |
|
|
| 67 |
<% if @gantt.truncated %> |
|
| 68 |
<p class="warning"><%= l(:notice_gantt_chart_truncated, :max => @gantt.max_rows) %></p> |
|
| 69 |
<% end %> |
|
| 70 |
|
|
| 71 |
<table style="width:100%; border:0; border-collapse: collapse;"> |
|
| 72 |
<tr> |
|
| 73 |
<td style="width:<%= subject_width %>px; padding:0px;"> |
|
| 74 |
<% |
|
| 75 |
style = "" |
|
| 76 |
style += "position:relative;" |
|
| 77 |
style += "height: #{t_height + 24}px;"
|
|
| 78 |
style += "width: #{subject_width + 1}px;"
|
|
| 79 |
%> |
|
| 80 |
<%= content_tag(:div, :style => style) do %> |
|
| 81 |
<% |
|
| 82 |
style = "" |
|
| 83 |
style += "right:-2px;" |
|
| 84 |
style += "width: #{subject_width}px;"
|
|
| 85 |
style += "height: #{headers_height}px;"
|
|
| 86 |
style += 'background: #eee;' |
|
| 87 |
%> |
|
| 88 |
<%= content_tag(:div, "", :style => style, :class => "gantt_hdr") %> |
|
| 89 |
<% |
|
| 90 |
style = "" |
|
| 91 |
style += "right:-2px;" |
|
| 92 |
style += "width: #{subject_width}px;"
|
|
| 93 |
style += "height: #{t_height}px;"
|
|
| 94 |
style += 'border-left: 1px solid #c0c0c0;' |
|
| 95 |
style += 'overflow: hidden;' |
|
| 96 |
%> |
|
| 97 |
<%= content_tag(:div, "", :style => style, :class => "gantt_hdr") %> |
|
| 98 |
<%= content_tag(:div, :class => "gantt_subjects") do %> |
|
| 99 |
<%= @gantt.subjects.html_safe %> |
|
| 100 |
<% end %> |
|
| 101 |
<% end %> |
|
| 102 |
</td> |
|
| 103 |
|
|
| 104 |
<td> |
|
| 105 |
<div style="position:relative;height:<%= t_height + 24 %>px;overflow:auto;"> |
|
| 106 |
<% |
|
| 107 |
style = "" |
|
| 108 |
style += "width: #{g_width - 1}px;"
|
|
| 109 |
style += "height: #{headers_height}px;"
|
|
| 110 |
style += 'background: #eee;' |
|
| 111 |
%> |
|
| 112 |
<%= content_tag(:div, ' '.html_safe, :style => style, :class => "gantt_hdr") %> |
|
| 113 |
|
|
| 114 |
<% ###### Months headers ###### %> |
|
| 115 |
<% |
|
| 116 |
month_f = @gantt.date_from |
|
| 117 |
left = 0 |
|
| 118 |
height = (show_weeks ? header_heigth : header_heigth + g_height) |
|
| 119 |
%> |
|
| 120 |
<% @gantt.months.times do %> |
|
| 121 |
<% |
|
| 122 |
width = (((month_f >> 1) - month_f) * zoom - 1).to_i |
|
| 123 |
style = "" |
|
| 124 |
style += "left: #{left}px;"
|
|
| 125 |
style += "width: #{width}px;"
|
|
| 126 |
style += "height: #{height}px;"
|
|
| 127 |
%> |
|
| 128 |
<%= content_tag(:div, :style => style, :class => "gantt_hdr") do %> |
|
| 129 |
<%= link_to h("#{month_f.year}-#{month_f.month}"),
|
|
| 130 |
@gantt.params.merge(:year => month_f.year, :month => month_f.month), |
|
| 131 |
:title => "#{month_name(month_f.month)} #{month_f.year}" %>
|
|
| 132 |
<% end %> |
|
| 133 |
<% |
|
| 134 |
left = left + width + 1 |
|
| 135 |
month_f = month_f >> 1 |
|
| 136 |
%> |
|
| 137 |
<% end %> |
|
| 138 |
|
|
| 139 |
<% ###### Weeks headers ###### %> |
|
| 140 |
<% if show_weeks %> |
|
| 141 |
<% |
|
| 142 |
left = 0 |
|
| 143 |
height = (show_days ? header_heigth - 1 : header_heigth - 1 + g_height) |
|
| 144 |
%> |
|
| 145 |
<% if @gantt.date_from.cwday == 1 %> |
|
| 146 |
<% |
|
| 147 |
# @date_from is monday |
|
| 148 |
week_f = @gantt.date_from |
|
| 149 |
%> |
|
| 150 |
<% else %> |
|
| 151 |
<% |
|
| 152 |
# find next monday after @date_from |
|
| 153 |
week_f = @gantt.date_from + (7 - @gantt.date_from.cwday + 1) |
|
| 154 |
width = (7 - @gantt.date_from.cwday + 1) * zoom - 1 |
|
| 155 |
style = "" |
|
| 156 |
style += "left: #{left}px;"
|
|
| 157 |
style += "top: 19px;" |
|
| 158 |
style += "width: #{width}px;"
|
|
| 159 |
style += "height: #{height}px;"
|
|
| 160 |
%> |
|
| 161 |
<%= content_tag(:div, ' '.html_safe, |
|
| 162 |
:style => style, :class => "gantt_hdr") %> |
|
| 163 |
<% left = left + width + 1 %> |
|
| 164 |
<% end %> |
|
| 165 |
<% while week_f <= @gantt.date_to %> |
|
| 166 |
<% |
|
| 167 |
width = ((week_f + 6 <= @gantt.date_to) ? |
|
| 168 |
7 * zoom - 1 : |
|
| 169 |
(@gantt.date_to - week_f + 1) * zoom - 1).to_i |
|
| 170 |
style = "" |
|
| 171 |
style += "left: #{left}px;"
|
|
| 172 |
style += "top: 19px;" |
|
| 173 |
style += "width: #{width}px;"
|
|
| 174 |
style += "height: #{height}px;"
|
|
| 175 |
%> |
|
| 176 |
<%= content_tag(:div, :style => style, :class => "gantt_hdr") do %> |
|
| 177 |
<%= content_tag(:small) do %> |
|
| 178 |
<%= week_f.cweek if width >= 16 %> |
|
| 179 |
<% end %> |
|
| 180 |
<% end %> |
|
| 181 |
<% |
|
| 182 |
left = left + width + 1 |
|
| 183 |
week_f = week_f + 7 |
|
| 184 |
%> |
|
| 185 |
<% end %> |
|
| 186 |
<% end %> |
|
| 187 |
|
|
| 188 |
<% ###### Days headers ####### %> |
|
| 189 |
<% if show_days %> |
|
| 190 |
<% |
|
| 191 |
left = 0 |
|
| 192 |
height = g_height + header_heigth - 1 |
|
| 193 |
wday = @gantt.date_from.cwday |
|
| 194 |
%> |
|
| 195 |
<% (@gantt.date_to - @gantt.date_from + 1).to_i.times do %> |
|
| 196 |
<% |
|
| 197 |
width = zoom - 1 |
|
| 198 |
style = "" |
|
| 199 |
style += "left: #{left}px;"
|
|
| 200 |
style += "top:37px;" |
|
| 201 |
style += "width: #{width}px;"
|
|
| 202 |
style += "height: #{height}px;"
|
|
| 203 |
style += "font-size:0.7em;" |
|
| 204 |
clss = "gantt_hdr" |
|
| 205 |
clss << " nwday" if @gantt.non_working_week_days.include?(wday) |
|
| 206 |
%> |
|
| 207 |
<%= content_tag(:div, :style => style, :class => clss) do %> |
|
| 208 |
<%= day_letter(wday) %> |
|
| 209 |
<% end %> |
|
| 210 |
<% |
|
| 211 |
left = left + width + 1 |
|
| 212 |
wday = wday + 1 |
|
| 213 |
wday = 1 if wday > 7 |
|
| 214 |
%> |
|
| 215 |
<% end %> |
|
| 216 |
<% end %> |
|
| 217 |
|
|
| 218 |
<%= @gantt.lines.html_safe %> |
|
| 219 |
|
|
| 220 |
<% ###### Today red line (excluded from cache) ###### %> |
|
| 221 |
<% if Date.today >= @gantt.date_from and Date.today <= @gantt.date_to %> |
|
| 222 |
<% |
|
| 223 |
today_left = (((Date.today - @gantt.date_from + 1) * zoom).floor() - 1).to_i |
|
| 224 |
style = "" |
|
| 225 |
style += "position: absolute;" |
|
| 226 |
style += "height: #{g_height}px;"
|
|
| 227 |
style += "top: #{headers_height + 1}px;"
|
|
| 228 |
style += "left: #{today_left}px;"
|
|
| 229 |
style += "width:10px;" |
|
| 230 |
style += "border-left: 1px dashed red;" |
|
| 231 |
%> |
|
| 232 |
<%= content_tag(:div, ' '.html_safe, :style => style) %> |
|
| 233 |
<% end %> |
|
| 234 |
|
|
| 235 |
</div> |
|
| 236 |
</td> |
|
| 237 |
</tr> |
|
| 238 |
</table> |
|
| 239 |
|
|
| 240 |
<table style="width:100%"> |
|
| 241 |
<tr> |
|
| 242 |
<td align="left"> |
|
| 243 |
<%= link_to_content_update("\xc2\xab " + l(:label_previous),
|
|
| 244 |
params.merge(@gantt.params_previous)) %> |
|
| 245 |
</td> |
|
| 246 |
<td align="right"> |
|
| 247 |
<%= link_to_content_update(l(:label_next) + " \xc2\xbb", |
|
| 248 |
params.merge(@gantt.params_next)) %> |
|
| 249 |
</td> |
|
| 250 |
</tr> |
|
| 251 |
</table> |
|
| 252 |
|
|
| 253 |
<% other_formats_links do |f| %> |
|
| 254 |
<%= f.link_to 'PDF', :url => params.merge(@gantt.params) %> |
|
| 255 |
<%= f.link_to('PNG', :url => params.merge(@gantt.params)) if @gantt.respond_to?('to_image') %>
|
|
| 256 |
<% end %> |
|
| 257 |
<% end # query.valid? %> |
|
| 258 |
|
|
| 259 |
<% content_for :sidebar do %> |
|
| 260 |
<%= render :partial => 'issues/sidebar' %> |
|
| 261 |
<% end %> |
|
| 262 |
|
|
| 263 |
<% html_title(l(:label_gantt)) -%> |
|
| .svn/pristine/23/234b04ce45c5af02990560943c7a01a17b8c1584.svn-base | ||
|---|---|---|
| 1 |
<%= javascript_tag do %> |
|
| 2 |
function revisionGraphHandler(){
|
|
| 3 |
drawRevisionGraph( |
|
| 4 |
document.getElementById('holder'),
|
|
| 5 |
<%= commits.to_json.html_safe %>, |
|
| 6 |
<%= space %> |
|
| 7 |
); |
|
| 8 |
} |
|
| 9 |
$(document).ready(revisionGraphHandler); |
|
| 10 |
$(window).resize(revisionGraphHandler); |
|
| 11 |
<% end %> |
|
| 12 |
|
|
| 13 |
<div id="holder" class="revision-graph"></div> |
|
| 14 |
|
|
| 15 |
<% content_for :header_tags do %> |
|
| 16 |
<%= javascript_include_tag 'raphael' %> |
|
| 17 |
<%= javascript_include_tag 'revision_graph' %> |
|
| 18 |
<% end %> |
|
Also available in: Unified diff