Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add: PagingInformation (SettingsController)

add: IndexAction(IssuesController)
  • Loading branch information...
commit 8d2e3f5ebf46fb9ef15c032aa4746f4fe9c2bb82 1 parent 9e57b94
Sven Krzyzak authored
View
48 app/controllers/mylyn_connector/issues_controller.rb
@@ -6,11 +6,15 @@ class MylynConnector::IssuesController < ApplicationController
skip_before_filter :verify_authenticity_token
+ before_filter :find_optional_project, :only => [:index]
before_filter :find_issue, :only => [:show]
before_filter :find_project, :only => [:show]
before_filter :authorize
helper MylynConnector::MylynHelper
+ helper :queries
+ include QueriesHelper
+
def show
respond_to do |format|
@@ -18,6 +22,27 @@ def show
end
end
+ #TODO not tested
+ def index
+ retrieve_query
+
+ if @query.valid?
+ @issues = @query.issues
+
+ respond_to do |format|
+ format.xml {render :layout => false}
+ end
+
+ else
+ respond_to do |format|
+ format.xml { head 422 }
+ end
+ end
+
+ rescue ActiveRecord::RecordNotFound
+ render_404
+ end
+
def query
query = retrieve_query params[:query_id], params[:query_string]
if !query.blank? && query.valid?
@@ -106,23 +131,10 @@ def find_project
end
end
- def retrieve_query query_id, query_string
- query = nil
- if query_id!=nil && query_id.to_i>0 then
- begin
- # Code form Issue_helper
- visible = ARCondition.new(["is_public = ? OR user_id = ?", true, User.current.id])
- visible << (["project_id IS NULL OR project_id = ?", @project.id]) if @project
-
- query = Query.find(query_id, :conditions => visible.conditions)
- rescue
- query = Query.new
- end
- query.project = @project if @project
- else
- querydecoder = MylynConnector::QueryStringDecoder.new(query_string)
- query = querydecoder.query
- end
- return query
+ def find_optional_project
+ @project = Project.find(params[:project_id]) unless params[:project_id].blank?
+ rescue ActiveRecord::RecordNotFound
+ render_404
end
+
end
View
13 app/views/mylyn_connector/issues/_partialissue.rxml
@@ -0,0 +1,13 @@
+xml.issue({:id => issue.id, :editAllowed => edit_allowed?(issue)}.merge(attr||={}) ) do
+
+ #Ticket
+ xml.subject issue.subject
+ xml.updatedOn issue.updated_on.xmlschema, :unixtime => issue.updated_on.to_i
+
+ #References
+ xml.projectId issue.project_id
+ xml.statusId issue.status_id
+ xml.priorityId issue.priority_id
+
+end
+
View
4 app/views/mylyn_connector/issues/index.xml.builder
@@ -0,0 +1,4 @@
+xml.instruct! :xml, :encoding => "UTF-8"
+xml.issues :xmlns => 'http://redmin-mylyncon.sf.net/api', :api=>api_version do
+ xml << render(:partial => 'partialissue.rxml', :collection => @issues, :as => :issue) unless @issues.empty?
+end
View
1  app/views/mylyn_connector/settings/all.xml.builder
@@ -1,4 +1,5 @@
xml.instruct! :xml, :encoding => "UTF-8"
xml.settings :xmlns => 'http://redmin-mylyncon.sf.net/api', :api=>api_version do
xml.useIssueDoneRatio Setting.issue_done_ratio != 'issue_status'
+ xml.maxPerPage Setting.per_page_options_array.max
end
View
1  config/routes.rb
@@ -24,6 +24,7 @@
rmc.connect "mylyn/issue/:id", :controller => "MylynConnector::Issues", :action => "show"
rmc.connect "mylyn/issues/updatedsince", :controller => "MylynConnector::Issues", :action => "updated_since"
rmc.connect "mylyn/issues/list", :controller => "MylynConnector::Issues", :action => "list"
+ rmc.connect "mylyn/issues", :controller => "MylynConnector::Issues", :action => "index"
end
end
View
1  test/functional/settings_controller_test.rb
@@ -19,6 +19,7 @@ def test_all
assert valid , 'Ergebnis passt nicht zum Schema ' + 'settings'
assert_tag :tag => 'useissuedoneratio', :content => 'true', :parent => {:tag => 'settings', :attributes => {:api => /^2.7.0/}}
+ assert_tag :tag => 'maxperpage', :content => '100', :parent => {:tag => 'settings', :attributes => {:api => /^2.7.0/}}
end
View
1  test/schema/settings.xsd
@@ -11,6 +11,7 @@
<xsd:complexType>
<xsd:sequence >
<xsd:element name="useIssueDoneRatio" type="xsd:boolean" />
+ <xsd:element name="maxPerPage" type="xsd:integer" />
</xsd:sequence>
<xsd:attribute name="api" type="tns:versionstring" use="required" />
</xsd:complexType>
Please sign in to comment.
Something went wrong with that request. Please try again.