Project

General

Profile

Enhancement(機能追加・改善) #4183

JavaScript から route (app_url_for, url_for) を呼び出せる機能が欲しい

Added by Shinichi Urabe over 3 years ago. Updated 2 months ago.

Status:
Fixed(完了)
Priority:
Normal(通常)
Assignee:
Target version:
Start date:
2020-01-31
Due date:
% Done:

100%


Description

概要

JS から app_url_for, url_for などのヘルパーの結果を問い合わせる機構の作成

仕様

opUrl.app_url_for

jsDoc
  /** 
   * method app_url_for().
   *
   * @param  {strina} application ex: api ...
   * @param  {string} internalUri 'module/action' or '@rule' of the action
   * @param {boolean} absolute  return absolute path?
   * @returns {Deferred} Return a Deferred's Promise object. opUrl.url_for(... snip ...).done(function(url) {... snip ...}).fail(function(xhr, textStatus, errorThrown) {... snip ...})
   */

code example.

// no problem url.
opUrl.app_url_for(
  'api',
  '@homepage',
  false
).done(function(url) { console.log(url); });

// -> /api.php/

// invalidUrl
opUrl.app_url_for(
  'api',
  '@invalidUrl',
  false
).done(
  function(url) { console.log(url); }
).fail(
  function(xhr, textStatus, errorThrown) { console.log(xhr, textStatus, errorThrown); }
);

// -> xhr object, status, error


opUrl.url_for

for pc_frontend.

jsDoc
  /** 
   * method url_for().
   *
   * @param {string} internalUri 'module/action' or '@rule' of the action
   * @param {boolean} absolute  return absolute path?
   * @returns {Deferred} Return a Deferred's Promise object. opUrl.url_for(... snip ...).done(function(url) {... snip ...}).fail(function(xhr, textStatus, errorThrown) {... snip ...})
   */

code example.

// no problem url.
opUrl.url_for(
  '@homepage',
  true,
).done(function(url) { console.log(url); });

// -> http://example.com/

// invalidUrl
opUrl.url_for(
  '@invalidUrl',
  true,
).done(
  function(url) { console.log(url); }
).fail(
  function(xhr, textStatus, errorThrown) { console.log(xhr, textStatus, errorThrown); }
);

// -> xhr object, status, error



Subtasks

Backport(バックポート) #4360: JavaScript から route (app_url_for, url_for) を呼び出せる機能が欲しいWon't fix(対応せず)kaoru n

Backport(バックポート) #4361: JavaScript から route (app_url_for, url_for) を呼び出せる機能が欲しいFixed(完了)kaoru n

Backport(バックポート) #4377: JavaScript から route (app_url_for, url_for) を呼び出せる機能が欲しいFixed(完了)isao sano


Related issues

Related to opSkinThemePlugin - Enhancement(機能追加・改善) #4476: #4183 に対応する Fixed(完了) 2020-06-23

History

#1 Updated by Shinichi Urabe about 3 years ago

  • Status changed from New(新規) to Accepted(着手)
  • Assignee set to Shinichi Urabe

#2 Updated by Shinichi Urabe about 3 years ago

  • Subject changed from JavaScript から route (app_url_for, url_for ) を呼び出せる機能が欲しい to JavaScript から route (app_url_for, url_for) を呼び出せる機能が欲しい
  • Description updated (diff)
  • Status changed from Accepted(着手) to Pending Review(レビュー待ち)
  • % Done changed from 0 to 50

#3 Updated by Shinichi Urabe about 3 years ago

  • Status changed from Pending Review(レビュー待ち) to Rejected(差し戻し)

「引数でcallback渡すよりはPromise的なオブジェクトを返した方が今どきな感じがありそう」 という意見をもらったので、折角なので、その方針で検討

#4 Updated by Shinichi Urabe about 3 years ago

  • Description updated (diff)
  • Status changed from Rejected(差し戻し) to Pending Review(レビュー待ち)

追加修正で callback を引数に追加させるのをやめ、 Deferred.Promise オブジェクトを返すようにした
PR: https://github.com/openpne/OpenPNE3/pull/471

#5 Updated by kaoru n 7 months ago

  • Target version changed from OpenPNE 3.9.0 to OpenPNE 3.10.x

#6 Updated by kaoru n 6 months ago

  • Assignee changed from Shinichi Urabe to kaoru n

https://github.com/openpne/OpenPNE3/pull/567
にてプルリクエストしました

https://github.com/openpne/OpenPNE3/pull/471
はコンフリクトしていたため close します

#7 Updated by Rimpei Ogawa 2 months ago

  • Status changed from Pending Review(レビュー待ち) to Pending Testing(テスト待ち)
  • % Done changed from 50 to 70

#8 Updated by isao sano 2 months ago

  • Status changed from Pending Testing(テスト待ち) to Pending Merge(マージ待ち)
  • % Done changed from 70 to 80

試験完了しました。
問題ありません。

#9 Updated by kaoru n 2 months ago

  • Status changed from Pending Merge(マージ待ち) to Fixed(完了)
  • % Done changed from 80 to 100

マージしました

#10 Updated by kaoru n about 2 months ago

Also available in: Atom PDF