include Redmine::I18n
layout 'base'
- exempt_from_layout 'builder', 'apit'
+ exempt_from_layout 'builder', 'rsb'
# Remove broken cookie after upgrade from 0.8.x (#4292)
# See https://rails.lighthouseapp.com/projects/8994/tickets/3360
)
render options
end
+
+ # Overrides #default_template so that the api template
+ # is used automatically if it exists
+ def default_template(action_name = self.action_name)
+ if api_request?
+ begin
+ return self.view_paths.find_template(default_template_name(action_name), 'api')
+ rescue ::ActionView::MissingTemplate
+ # the api template was not found
+ # fallback to the default behaviour
+ end
+ end
+ super
+ end
+
+ # Overrides #pick_layout so that #render with no arguments
+ # doesn't use the layout for api requests
+ def pick_layout(*args)
+ api_request? ? nil : super
+ end
end
respond_to do |format|
format.html { render :template => 'issues/index.rhtml', :layout => !request.xhr? }
- format.api { render :template => 'issues/index.apit' }
+ format.api
format.atom { render_feed(@issues, :title => "#{@project || Setting.app_title}: #{l(:label_issue_plural)}") }
format.csv { send_data(issues_to_csv(@issues, @project), :type => 'text/csv; header=present', :filename => 'export.csv') }
format.pdf { send_data(issues_to_pdf(@issues, @project, @query), :type => 'application/pdf', :filename => 'export.pdf') }
@time_entry = TimeEntry.new
respond_to do |format|
format.html { render :template => 'issues/show.rhtml' }
- format.api { render :template => 'issues/show.apit' }
+ format.api
format.atom { render :template => 'journals/index', :layout => false, :content_type => 'application/atom+xml' }
format.pdf { send_data(issue_to_pdf(@issue), :type => 'application/pdf', :filename => "#{@project.identifier}-#{@issue.id}.pdf") }
end
redirect_to(params[:continue] ? { :action => 'new', :project_id => @project, :issue => {:tracker_id => @issue.tracker, :parent_issue_id => @issue.parent_issue_id}.reject {|k,v| v.nil?} } :
{ :action => 'show', :id => @issue })
}
- format.api { render :template => 'issues/show.apit', :status => :created, :location => issue_url(@issue) }
+ format.api { render :action => 'show', :status => :created, :location => issue_url(@issue) }
end
return
else
}
format.api {
@projects = Project.visible.find(:all, :order => 'lft')
- render :template => 'projects/index.apit'
}
format.atom {
projects = Project.visible.find(:all, :order => 'created_on DESC',
flash[:notice] = l(:notice_successful_create)
redirect_to :controller => 'projects', :action => 'settings', :id => @project
}
- format.api { render :template => 'projects/show.apit', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => @project.id) }
+ format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => @project.id) }
end
else
respond_to do |format|
respond_to do |format|
format.html
- format.api { render :template => 'projects/show.apit'}
+ format.api
end
end
:order => sort_clause,
:limit => @entry_pages.items_per_page,
:offset => @entry_pages.current.offset)
-
- render :template => 'timelog/index.apit'
}
format.atom {
entries = TimeEntry.find(:all,
respond_to do |format|
# TODO: Implement html response
format.html { render :nothing => true, :status => 406 }
- format.api { render :template => 'timelog/show.apit' }
+ format.api
end
end
flash[:notice] = l(:notice_successful_update)
redirect_back_or_default :action => 'index', :project_id => @time_entry.project
}
- format.api { render :template => 'timelog/show.apit', :status => :created, :location => time_entry_url(@time_entry) }
+ format.api { render :action => 'show', :status => :created, :location => time_entry_url(@time_entry) }
end
else
respond_to do |format|
respond_to do |format|
format.html { render :layout => !request.xhr? }
- format.api { render :template => 'users/index.apit' }
+ format.api
end
end
respond_to do |format|
format.html { render :layout => 'base' }
- format.api { render :template => 'users/show.apit' }
+ format.api
end
rescue ActiveRecord::RecordNotFound
render_404
{:controller => 'users', :action => 'edit', :id => @user}
)
}
- format.api { render :template => 'users/show.apit', :status => :created, :location => user_url(@user) }
+ format.api { render :action => 'show', :status => :created, :location => user_url(@user) }
end
else
@auth_sources = AuthSource.find(:all)
format.register :textile, Redmine::WikiFormatting::Textile::Formatter, Redmine::WikiFormatting::Textile::Helper
end
-ActionView::Template.register_template_handler :apit, Redmine::Views::ApiTemplateHandler
+ActionView::Template.register_template_handler :rsb, Redmine::Views::ApiTemplateHandler