зеркало из https://github.com/nextcloud/cookbook.git
Make /recipes route return json and /tmpl/recipes html
Trying to stick to this manual https://docs.nextcloud.com/server/13/developer_manual/app/tutorial.html /recipes should return json.
This commit is contained in:
Родитель
29e9ed47a0
Коммит
95ba8b9cfa
|
@ -12,8 +12,8 @@ return [
|
|||
['name' => 'page#index', 'url' => '/', 'verb' => 'GET'],
|
||||
['name' => 'page#recipe', 'url' => '/recipe', 'verb' => 'GET'],
|
||||
['name' => 'page#edit', 'url' => '/edit', 'verb' => 'GET'],
|
||||
['name' => 'page#recipes', 'url' => '/recipes', 'verb' => 'GET'],
|
||||
['name' => 'recipe#all', 'url' => '/all', 'verb' => 'GET'],
|
||||
['name' => 'page#recipes', 'url' => '/tmpl/recipes', 'verb' => 'GET'],
|
||||
['name' => 'recipe#index', 'url' => '/recipes', 'verb' => 'GET'],
|
||||
['name' => 'recipe#add', 'url' => '/add', 'verb' => 'POST'],
|
||||
['name' => 'recipe#delete', 'url' => '/delete', 'verb' => 'DELETE'],
|
||||
['name' => 'recipe#update', 'url' => '/update', 'verb' => 'POST'],
|
||||
|
|
|
@ -77,7 +77,7 @@ Cookbook.prototype = {
|
|||
loadAll: function () {
|
||||
var deferred = $.Deferred();
|
||||
var self = this;
|
||||
$.get(this._baseUrl + '/all').done(function (recipes) {
|
||||
$.get(this._baseUrl + '/recipes').done(function (recipes) {
|
||||
self._recipes = recipes;
|
||||
deferred.resolve();
|
||||
}).fail(function () {
|
||||
|
@ -398,7 +398,7 @@ var Nav = function (cookbook) {
|
|||
*/
|
||||
self.render = function () {
|
||||
$.ajax({
|
||||
url: cookbook._baseUrl + '/recipes?keywords=' + self.getKeywords(),
|
||||
url: cookbook._baseUrl + '/tmpl/recipes?keywords=' + self.getKeywords(),
|
||||
method: 'GET',
|
||||
})
|
||||
.done(function(html) {
|
||||
|
|
|
@ -27,7 +27,7 @@ class RecipeController extends Controller {
|
|||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
*/
|
||||
public function all() {
|
||||
public function index() {
|
||||
$data = $this->service->getAllRecipesInSearchIndex();
|
||||
|
||||
return new DataResponse($data, Http::STATUS_OK, [ 'Content-Type' => 'application/json' ]);
|
||||
|
|
Загрузка…
Ссылка в новой задаче