You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

120 lines
4.8 KiB

7 years ago
  1. <?=form_open(NULL, array('class'=>'form-flex'))?>
  2. <input type="hidden" name="mnu_idx" value="<?=$mnu_idx?>">
  3. <input type="hidden" name="mnu_parent" value="<?=$mnu_parent?>">
  4. <div class="form-group">
  5. <label class="control-label control-label-sm">메뉴 이름</label>
  6. <div class="controls">
  7. <input class="form-control" name="mnu_name" value="<?=element('mnu_name', $view)?>" required maxlength="30">
  8. </div>
  9. </div>
  10. <div class="form-group">
  11. <label class="control-label control-label-sm">메뉴 링크 타입</label>
  12. <div class="controls">
  13. <select class="form-control" id="menu-helper">
  14. <option value="">직접입력</option>
  15. <option value="#" <?=element('mnu_link',$view)=='#'?'selected':''?>>링크 없음</option>
  16. <option value="board">게시판</option>
  17. <option value="pages">일반페이지</option>
  18. </select>
  19. </div>
  20. </div>
  21. <div class="form-group">
  22. <label class="control-label control-label-sm">메뉴 링크</label>
  23. <div class="controls" id="menu-helper-input">
  24. <select class="form-control">
  25. <option value="">직접입력</option>
  26. <option value="#" <?=element('mnu_link',$view)=='#'?'selected':''?>>링크 없음</option>
  27. <option value="board">게시판</option>
  28. <option value="pages">일반페이지</option>
  29. </select>
  30. </div>
  31. </div>
  32. <div class="form-group">
  33. <label class="control-label control-label-sm">PC</label>
  34. <div class="controls">
  35. <label class="w-check">
  36. <input type="checkbox" name="mnu_desktop" value="Y" <?=element('mnu_desktop',$view,'Y')=='Y'?'checked':''?>>
  37. <span>PC버젼 표시</span>
  38. </label>
  39. </div>
  40. </div>
  41. <div class="form-group">
  42. <label class="control-label control-label-sm">모바일</label>
  43. <div class="controls">
  44. <label class="w-check">
  45. <input type="checkbox" name="mnu_mobile" value="Y" <?=element('mnu_mobile',$view,'Y')=='Y'?'checked':''?>>
  46. <span>모바일버젼 표시</span>
  47. </label>
  48. </div>
  49. </div>
  50. <div class="form-group">
  51. <label class="control-label control-label-sm">새창</label>
  52. <div class="controls">
  53. <label class="w-check">
  54. <input type="checkbox" name="mnu_newtab" value="Y" <?=element('mnu_newtab',$view,'Y')=='N'?'checked':''?>>
  55. <span>새창으로 열기</span>
  56. </label>
  57. </div>
  58. </div>
  59. <div class="form-group">
  60. <label class="control-label control-label-sm">Active </label>
  61. <div class="controls" id="menu-helper-input">
  62. <label class="w-check">
  63. <input class="form-control" name="mnu_active_key" value="<?=element('mnu_active_key',$view)?>">
  64. <p class="form-control-static">현재 메뉴 Active상태를 판별하기 위한 키값</p>
  65. </label>
  66. </div>
  67. </div>
  68. <div class="text-center MT10">
  69. <button class="btn btn-primary"><i class="far fa-save"></i> 저장하기</button>
  70. </div>
  71. <?=form_close()?>
  72. <script>
  73. var mnu_link = "<?=element('mnu_link', $view)?>";
  74. var board_link = <?=json_encode($board_list)?>;
  75. var pages_link = [
  76. { url : '/customer/faq', name : 'FAQ'},
  77. { url : '/customer/qna', name : 'Q&A'},
  78. { url : '/contact', name : 'Contact'},
  79. { url : '/agreement/site', name:'이용약관'},
  80. { url : '/agreement/privacy', name:'개인정보취급방침'}
  81. ];
  82. $(function(){
  83. $("#menu-helper").change(function(){
  84. var $this = $(this);
  85. $("#menu-helper-input").empty();
  86. if( $this.val() == '' )
  87. {
  88. var input = $("<input>").addClass('form-control').attr('name', "mnu_link").attr('required','required').val( mnu_link );
  89. $("#menu-helper-input").append( input);
  90. }
  91. else if ( $this.val() == '#' )
  92. {
  93. var input = $("<input>").addClass('form-control').attr('name', "mnu_link").val( '#' ).attr('readonly','readonly');
  94. $("#menu-helper-input").append( input);
  95. }
  96. else if ( $this.val() == 'board' || $this.val() == 'pages' ) {
  97. var data_list = [];
  98. if( $this.val() == 'board' ) {
  99. data_list = board_link;
  100. }
  101. else if ($this.val() == 'pages') {
  102. data_list = pages_link;
  103. }
  104. var select = $("<select>").addClass('form-control').attr('name', 'mnu_link');
  105. for(var i=0; i<data_list.length; i++ )
  106. {
  107. var option = $("<option>").attr('value', data_list[i].url ).text( data_list[i].name );
  108. select.append(option);
  109. }
  110. $("#menu-helper-input").append( select );
  111. }
  112. }).change();
  113. });
  114. </script>