Skip to content

Commit

Permalink
fixes #126
Browse files Browse the repository at this point in the history
  • Loading branch information
kawasima committed Sep 23, 2012
1 parent 7cf80e0 commit ab02a0b
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 36 deletions.
2 changes: 1 addition & 1 deletion app/controllers/impasse_test_plans_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def statistics
else
format.html
end
format.json { render :json => @statistics }
format.json_impasse { render :json => @statistics }
end
end

Expand Down
19 changes: 14 additions & 5 deletions app/views/impasse_execution_bugs/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
<%= call_hook(:view_issues_form_details_top, { :issue => @issue, :form => f }) %>

<div id="issue_descr_fields" <%= 'style="display:none"' unless @issue.new_record? || @issue.errors.any? %>>
<p><%= f.select :tracker_id, @project.trackers.collect {|t| [t.name, t.id]}, :required => true %></p>
<%= observe_field :issue_tracker_id, :url => { :action => :new, :project_id => @project, :id => @issue },
:update => :attributes,
:with => "Form.serialize('issue-form')" %>
<% if Rails::VERSION::MAJOR < 3 %>
<p><%= f.select :tracker_id, @project.trackers.collect {|t| [t.name, t.id]}, :required => true %></p>
<%= observe_field :issue_tracker_id, :url => { :action => :new, :project_id => @project, :id => @issue },
:update => :attributes,
:with => "Form.serialize('issue-form')" %>
<% else %>
<p><%= f.select :tracker_id, @issue.project.trackers.collect {|t| [t.name, t.id]}, {:required => true},
:onchange => "updateIssueFrom('#{escape_javascript project_issue_form_path(@project, :id => @issue, :format => 'js')}')" %></p>
<% end %>

<p><%= f.text_field :subject, :size => 80, :required => true %></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) }')" %>
<% if Redmine::VERSION::MAJOR < 2 or Redmine::VERSION::MINOR < 1 %>
<%= javascript_tag "observeParentIssueField('#{auto_complete_issues_path(:id => @issue, :project_id => @project) }')" %>
<% else %>
<%= javascript_tag "observeAutocompleteField('issue_parent_issue_id', '#{escape_javascript auto_complete_issues_path(:project_id => @issue.project)}')" %>
<% end %>
<% end %>

<p><%= f.text_area :description,
Expand Down
20 changes: 14 additions & 6 deletions app/views/impasse_test_plans/statistics.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,26 @@
<div>
<p style="height: 4em;"/>
<h3><%=l(:field_category)%></h3>
<%=link_to_remote l(:label_impasse_stat_overview), :update => 'statistics-view',
:url => { :action => :statistics, :project_id => @project, :id => @test_plan} %><br/>
<%=link_to l(:label_impasse_stat_overview),
{ :action => :statistics, :project_id => @project, :id => @test_plan}, :class => "statistics-link" %><br/>

<%=link_to_remote l(:label_impasse_stat_members), :update => 'statistics-view',
:url => { :action => :statistics, :type => 'members', :project_id => @project, :id => @test_plan} %><br/>
<%=link_to l(:label_impasse_stat_members),
{ :action => :statistics, :type => 'members', :project_id => @project, :id => @test_plan}, :class => "statistics-link" %><br/>

<%=link_to_remote l(:label_impasse_stat_daily), :update=>'statistics-view',
:url => { :action => :statistics, :type => 'daily', :project_id => @project, :id => @test_plan} %><br/>
<%=link_to l(:label_impasse_stat_daily),
{ :action => :statistics, :type => 'daily', :project_id => @project, :id => @test_plan}, :class => "statistics-link" %><br/>
</div>
<% end %>

<div id="statistics-view">
<%= render :partial=>"impasse_test_plans/statistics/#{params[:type]}"%>
</div>

<script>
jQuery(document).ready(function($) {
$(".statistics-link").click(function(e) {
$("#statistics-view").load($(this).attr("href"));
return false;
});
});
</script>
5 changes: 3 additions & 2 deletions app/views/impasse_test_plans/statistics/_daily.html.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@

<p class="contextual">
</p>
<div id="test-chart">
</div>
<script>
var ypadding = 1;
jQuery.ajax({
url: '<%=url_for :controller=>:impasse_test_plans, :action=>:statistics, :project_id=>@project, :id=>@test_plan%>',
url: '<%=url_for :controller=>:impasse_test_plans, :action=>:statistics, :project_id=>@project, :id=>@test_plan %>',
type: 'get',
data: { type: "daily", format: "json" },
data: { type: "daily", format: "json_impasse" },
success: function(data) {
var minDate, maxDate, maxCount = 0;
jQuery.each(data, function(i, series) {
Expand Down
2 changes: 1 addition & 1 deletion app/views/impasse_test_plans/statistics/_default.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ ul.container li {
$.ajax({
url: '',
data: {
format: 'json',
format: 'json_impasse',
test_suite_id: self.attr("data-suite-id")
},
success: function(results) {
Expand Down
22 changes: 13 additions & 9 deletions app/views/impasse_test_plans/user_assign.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,19 @@
</fieldset>
<fieldset>
<p><%= label_tag "principal_search", l(:label_user_search) %><%= text_field_tag 'principal_search', nil %></p>
<%= observe_field(:principal_search,
:frequency => 0.5,
:update => :principals,
:url => { :controller => :impasse_test_plans, :action => :autocomplete, :project_id => @project },
:method => :get,
:before => '$("principal_search").addClassName("ajax-loading")',
:complete => '$("principal_search").removeClassName("ajax-loading")',
:with => 'q')
%>
<% if Redmine::VERSION::MAJOR < 2 or Redmine::VERSION::MINOR < 1 %>
<%= observe_field(:principal_search,
:frequency => 0.5,
:update => :principals,
:url => { :controller => :impasse_test_plans, :action => :autocomplete, :project_id => @project },
:method => :get,
:before => '$("principal_search").addClassName("ajax-loading")',
:complete => '$("principal_search").removeClassName("ajax-loading")',
:with => 'q')
%>
<% else %>
<%= javascript_tag "observeSearchfield('principal_search', 'principals', '#{ escape_javascript url_for(:controller => :impasse_test_plans, :action => :autocomplete, :projec_id => @project )}')" %>
<% end %>
<legend><%=l :label_member_plural %></legend>
<div id="principals">
<ul>
Expand Down
5 changes: 2 additions & 3 deletions assets/javascripts/executions.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ jQuery(document).ready(function ($) {
$.ajax({
url: IMPASSE.url.executionsPut,
type: 'POST',
data: $this.serialize() + "&record=true&format=json",
data: $this.serialize() + "&record=true",
success: function(data) {
show_notification_dialog(data.status, data.message);
if (data.errors) {
Expand Down Expand Up @@ -140,8 +140,7 @@ jQuery(document).ready(function ($) {
url: IMPASSE.url.executionBugsCreate,
type: 'POST',
data: $("#issue-form").serialize()
+ "&execution_bug[execution_id]="+ $("#executions-view :hidden#execution_id").val()
+"&format=json",
+ "&execution_bug[execution_id]="+ $("#executions-view :hidden#execution_id").val(),
success: function(data) {
if (data.errors) {
if ($("#issue-dialog .errorExplanation").size() == 0)
Expand Down
4 changes: 1 addition & 3 deletions assets/javascripts/test_case_assign.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ jQuery(document).ready(function ($) {
$.post(
IMPASSE.url.testPlansAdd,
{ test_case_ids: $.map(data.o, function(n, i) { return $this._get_node(n).attr("id").replace("tc_", "") }),
test_plan_id: test_plan_id,
format: "json"
test_plan_id: test_plan_id
},
function(r) {
if(r.status == 'success') {
Expand Down Expand Up @@ -100,7 +99,6 @@ jQuery(document).ready(function ($) {
type: 'POST',
url: IMPASSE.url.testPlansRemove,
data : {
format: "json",
test_plan_id: test_plan_id,
test_case_id: this.id.replace("plan_","")
},
Expand Down
6 changes: 3 additions & 3 deletions assets/javascripts/test_case_tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ jQuery(document).ready(function ($) {
},
error: ajax_error_handler
};
var tc = {"format": "json"};
var tc = {};
dialog[node_type].find(":input:hidden,:text,textarea,:checkbox:checked,radiobutton:checked,select").each(function() {
tc[$(this).attr("name")] = $(this).val();
});
Expand Down Expand Up @@ -337,7 +337,7 @@ jQuery(document).ready(function ($) {
openDialog(data, 'new');
})
.bind("remove.jstree", function (e, data) {
var request = {format: "json", "node[id]": []};
var request = {"node[id]": []};
data.rslt.obj.each(function() {
request["node[id]"].push(this.id.replace("node_", ""));
});
Expand All @@ -362,7 +362,7 @@ jQuery(document).ready(function ($) {
})
.bind("move_node.jstree", function (e, data) {
var url = (data.rslt.cy) ? IMPASSE.url.testCaseCopy : IMPASSE.url.testCaseMove;
var request = { format: "json" };
var request = {};
data.rslt.o.each(function (i, node) {
request["nodes["+i+"][id]"] = $(node).attr("id").replace("node_","");
request["nodes["+i+"][parent_id]"] = data.rslt.cr === -1 ? 1 : data.rslt.np.attr("id").replace("node_","");
Expand Down
3 changes: 0 additions & 3 deletions assets/javascripts/user_assign.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ jQuery(document).ready(function ($) {
type: 'POST',
url: IMPASSE.url.executionsDelete,
data: {
format: "json",
"test_plan_case[test_plan_id]": test_plan_id,
"test_plan_case[test_case_id]": node.attr("id").replace("plan_", "")
},
Expand All @@ -38,7 +37,6 @@ jQuery(document).ready(function ($) {
type: 'POST',
url: IMPASSE.url.testPlansRemove,
data : {
format: "json",
test_plan_id: test_plan_id,
test_case_id: this.id.replace("plan_","")
},
Expand Down Expand Up @@ -112,7 +110,6 @@ jQuery(document).ready(function ($) {
var $this = this;
var draggable = $(data.o).hasClass("jstree-draggable") ? $(data.o) : $(data.o).parents(".jstree-draggable");
var request = {
format: "json",
"test_plan_case[test_plan_id]": test_plan_id,
"test_plan_case[test_case_id]": data.r.attr("id").replace("plan_", "")
};
Expand Down
2 changes: 2 additions & 0 deletions init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,7 @@
menu.push :custom_field, {:controller => 'impasse_custom_fields'}, :caption => :label_custom_field_plural,
:html => {:class => 'custom_fields'}
end

Mime::Type.register "application/json", :json_impasse
end

0 comments on commit ab02a0b

Please sign in to comment.