操作
Enhancement(機能追加・改善) #4183
完了JavaScript から route (app_url_for, url_for) を呼び出せる機能が欲しい
開始日:
2020-01-31
期日:
進捗率:
100%
予定工数:
(合計: 0:00時間)
説明
概要¶
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
操作