Ignore:
Timestamp:
2014/05/16 14:46:38 (10 years ago)
Author:
pineray
Message:

#2549 jQuery Mobile への依存を無くす

新着情報とメール詳細の表示を、 colorbox によるものへ変更.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_13-dev/data/Smarty/templates/sphone/frontparts/bloc/news.tpl

    r23419 r23423  
    122122                    } 
    123123                    else if (result != null) { 
    124                         var news = result; 
    125                         var maxCnt = 0; 
     124                        var dialog = $("#news-dialog"); 
    126125 
    127126                        //件名をセット 
    128                         $($("#windowcolumn dl.view_detail dt a").get(maxCnt)).text(news.news_title); 
    129                         if (news.news_url != null) { 
    130                             $($("#windowcolumn dl.view_detail dt a").get(maxCnt)).attr("href", news.news_url); 
     127                        $("#news-dialog-title").remove(); 
     128                        if (result.news_url != null) { 
     129                            dialog.find(".dialog-content").append( 
     130                                $('<h3 id="news-dialog-title">').append( 
     131                                    $('<a>') 
     132                                        .attr('href', result.news_url) 
     133                                        .attr('rel', "external") 
     134                                        .attr('target', "_blank") 
     135                                        .text(result.news_title) 
     136                                ) 
     137                            ); 
    131138                        } else { 
    132                             $($("#windowcolumn dl.view_detail dt a").get(maxCnt)).attr("href", "#"); 
     139                            dialog.find(".dialog-content").append( 
     140                                $('<h3 id="news-dialog-title">').text(result.news_title) 
     141                            ); 
    133142                        } 
    134143 
    135                         //年月をセット 
    136                         //var newsDateDispArray = news.cast_news_date.split("-"); //ハイフンで年月日を分解 
    137                         //var newsDateDisp = newsDateDispArray[0] + "年 " + newsDateDispArray[1] + "月 " + newsDateDispArray[2] + "日"; 
    138                         //$($("#windowcolumn dl.view_detail dt").get(maxCnt)).text(newsDateDisp); 
     144                        //本文をセット 
     145                        $("#news-dialog-body").remove(); 
     146                        if (result.news_comment != null) { 
     147                            dialog.find(".dialog-content").append( 
     148                                $('<div id="news-dialog-body">').html(result.news_comment.replace(/\n/g,"<br />")) 
     149                            ); 
     150                        } 
    139151 
    140                         //コメントをセット(iphone4の場合、innerHTMLの再描画が行われない為、タイマーで無理やり再描画させる) 
    141                         setTimeout( function() { 
    142                             news.news_comment == null ? $("#newsComment").html("") : $("#newsComment").html(news.news_comment.replace(/\n/g,"<br />")); 
    143                         }, 10); 
    144                         $.mobile.changePage('#windowcolumn', {transition: "slideup"}); 
    145                         //ダイアログが開き終わるまで待機 
    146                         setTimeout( function() { 
     152                        //ダイアログをモーダルウィンドウで表示 
     153                        $.colorbox({inline: true, href: dialog, onOpen: function(){ 
     154                            dialog.show().css('width', String($('body').width() * 0.9) + 'px'); 
     155                        }, onComplete: function(){ 
    147156                            eccube.hideLoading(); 
    148157                            loadingState = 0; 
    149                         }, 1000); 
     158                        }, onClosed: function(){ 
     159                            dialog.hide(); 
     160                        }}); 
    150161                    } 
    151162                    else { 
     
    159170    } 
    160171</script> 
     172 
     173<!--{include file="`$smarty.const.SMARTPHONE_TEMPLATE_REALDIR`frontparts/dialog_modal.tpl" dialog_id="news-dialog" dialog_title="新着情報"}--> 
Note: See TracChangeset for help on using the changeset viewer.