Skip to content
This repository
Browse code

UI cleanup

  • Loading branch information...
commit b83d5108612573e87e355b4e1bdf3c0322069c8f 1 parent 9bf1d97
Rinat Khaziev authored
13 ad-code-manager.php
@@ -230,7 +230,7 @@ function get_ad_codes_ajax() {
230 230 $pass = array();
231 231 foreach ( $ad_codes as $ad_code ) {
232 232 $pass[] = array(
233   - 'id' => $ad_code[ 'post_id' ],
  233 + 'id' => $ad_code['post_id'],
234 234 'site_name' => $ad_code[ 'url_vars' ][ 'site_name' ] ,
235 235 'zone1' => $ad_code[ 'url_vars' ][ 'zone1' ],
236 236 'act' => '',
@@ -523,12 +523,19 @@ function action_admin_menu() {
523 523 */
524 524 function admin_view_controller() {
525 525 ?>
  526 + <div class="acm-ui-wrapper">
526 527 <h2>Ad Code Manager</h2>
  528 +
  529 + <p>Quick start note: Create an ad code, then click on the row and start adding <a href="javascript:;">conditionals</a>.</p>
  530 +
527 531 <table id="acm-codes-list"></table>
528 532 <div id="acm-codes-pager"></div>
529 533
530   - <table id="acm-codes-conditionals-list"></table>
531   - <div id="acm-codes-conditionals-pager"></div>
  534 + <div class="acm-conditionals-wrapper hidden">
  535 + <table id="acm-codes-conditionals-list"></table>
  536 + <div id="acm-codes-conditionals-pager"></div>
  537 + </div>
  538 + </div>
532 539 <?php
533 540 }
534 541
18 common/css/ui.jqgrid.css
... ... @@ -1,5 +1,5 @@
1 1 /*Grid*/
2   -.ui-jqgrid {position: relative; font-size:11px;}
  2 +.ui-jqgrid {position: relative; font-size:12;}
3 3 .ui-jqgrid .ui-jqgrid-view {position: relative;left:0px; top: 0px; padding: .0em;}
4 4 /* caption*/
5 5 .ui-jqgrid .ui-jqgrid-titlebar {padding: .3em .2em .2em .3em; position: relative; border-left: 0px none;border-right: 0px none; border-top: 0px none;}
@@ -33,7 +33,7 @@ tr.ui-search-toolbar select {margin: 1px 0px 0px 0px}
33 33 .ui-jqgrid .ui-jqgrid-btable {table-layout:fixed; margin:0em; outline-style: none; }
34 34 .ui-jqgrid tr.jqgrow { outline-style: none; }
35 35 .ui-jqgrid tr.jqgroup { outline-style: none; }
36   -.ui-jqgrid tr.jqgrow td {font-weight: normal; overflow: hidden; white-space: pre; height: 22px;padding: 0 2px 0 2px;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}
  36 +.ui-jqgrid tr.jqgrow td {font-weight: normal; overflow: hidden; white-space: pre; height: 22px;padding: 4px 2px 4px 2px;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}
37 37 .ui-jqgrid tr.jqgfirstrow td {padding: 0 2px 0 2px;border-right-width: 1px; border-right-style: solid;}
38 38 .ui-jqgrid tr.jqgroup td {font-weight: normal; overflow: hidden; white-space: pre; height: 22px;padding: 0 2px 0 2px;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}
39 39 .ui-jqgrid tr.jqfoot td {font-weight: bold; overflow: hidden; white-space: pre; height: 22px;padding: 0 2px 0 2px;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}
@@ -56,7 +56,7 @@ tr.ui-search-toolbar select {margin: 1px 0px 0px 0px}
56 56 .ui-jqgrid .ui-pg-button span { display: block; margin: 1px; float:left;}
57 57 .ui-jqgrid .ui-pg-button:hover { padding: 0px; }
58 58 .ui-jqgrid .ui-state-disabled:hover {padding:1px;}
59   -.ui-jqgrid .ui-pg-input { height:13px;font-size:.8em; margin: 0em;}
  59 +.ui-jqgrid .ui-pg-input { height:20px;font-size:.8em; margin: 0em;}
60 60 .ui-jqgrid .ui-pg-selbox {font-size:.8em; line-height:18px; display:block; height:18px; margin: 0em;}
61 61 .ui-jqgrid .ui-separator {height: 18px; border-left: 1px solid #ccc ; border-right: 1px solid #ccc ; margin: 1px; float: right;}
62 62 .ui-jqgrid .ui-paging-info {font-weight: normal;height:19px; margin-top:3px;margin-right:4px;}
@@ -134,3 +134,15 @@ tr.ui-search-toolbar select {margin: 1px 0px 0px 0px}
134 134 .ui-jqgrid .tree-wrap-ltr {float: left;}
135 135 .ui-jqgrid .tree-wrap-rtl {float: right;}
136 136 .ui-jqgrid .ui-ellipsis {text-overflow:ellipsis; -moz-binding:url('ellipsis-xbl.xml#ellipsis');}
  137 +
  138 +.acm-conditionals-wrapper {
  139 + margin-top: 20px;
  140 +}
  141 +
  142 +.acm-ui-wrapper .button {
  143 + margin-right: 10px;
  144 +}
  145 +
  146 +.acm-ui-wrapper p {
  147 +
  148 +}
24 common/js/acm.js
@@ -18,16 +18,18 @@ jQuery( document ).ready( function( $ ) {
18 18 editurl: actions.codes_edit,
19 19 height: 400,
20 20 width: 600,
21   - colNames:['Id','Site Name', 'Zone1', 'Actions'],
  21 + multiselect: false,
  22 + // @todo remove hardcode, colNames and colModel should be set in provider config and printed in head section
  23 + colNames:['ID', 'Site Name', 'Zone1', 'Actions'],
22 24 colModel:[
23   - {name:'id',index:'id', width:60, sorttype:"int"},
  25 + {name:'id',index:'id', width:40, align: 'center' },
24 26 {name:'site_name',index:'site_name', width:200, editable: true, edittype:'text'},
25 27 {name:'zone1',index:'zone1', width:100, editable: true},
26 28 {name:'act',index:'act', width:125,sortable:false, align: 'center'},
27 29 ],
28 30 prmNames:{ page: 'acm-grid-page' },
29   - rowNum:10,
30   - rowList:[10,20,30],
  31 + rowNum:50,
  32 + rowList:[20,50,100],
31 33 pager: '#acm-codes-pager',
32 34 sortname: 'id',
33 35 viewrecords: true,
@@ -38,15 +40,16 @@ jQuery( document ).ready( function( $ ) {
38 40 var ids = grid_selector.jqGrid( 'getDataIDs' );
39 41 for(var i=0;i < ids.length;i++){
40 42 var cl = ids[i];
41   - be = "<input style='height:22px;width:50px;' type='button' value='Edit' onclick=\"jQuery( '#acm-codes-list' ).editRow( '"+cl+"' );\" />";
42   - se = "<input style='height:22px;width:50px;' type='button' value='Save' onclick=\"jQuery( '#acm-codes-list' ).saveRow( '"+cl+"' );\" />";
  43 + be = "<input type='button' value='Edit' onclick=\"grid_selector.editRow( '"+cl+"' );\" class='button' />";
  44 + se = "<input type='button' value='Save' onclick=\"grid_selector.saveRow( '"+cl+"' );\" class='button button-primary' />";
43 45 grid_selector.jqGrid( 'setRowData',ids[i],{act:be+se});
44 46 }
  47 +
45 48 },
46 49 onSelectRow: function(ids) {
47   - if(ids == null) {
  50 + if (ids == null) {
48 51 ids=0;
49   - if(subgrid_selector.jqGrid( 'getGridParam','records' ) >0 )
  52 + if (subgrid_selector.jqGrid( 'getGridParam','records' ) > 0 )
50 53 {
51 54 subgrid_selector.jqGrid( 'setGridParam',{ url:actions.conditionals_datasource + "&id="+ids, page:1, editurl: actions.conditionals_edit + "&id="+ids } );
52 55 subgrid_selector.jqGrid( 'setCaption',"Conditionals for Ad Code #: "+ids)
@@ -57,6 +60,7 @@ jQuery( document ).ready( function( $ ) {
57 60 subgrid_selector.jqGrid( 'setCaption',"Conditionals for Ad Code # "+ids)
58 61 .trigger( 'reloadGrid' );
59 62 }
  63 + jQuery('.acm-conditionals-wrapper').removeClass( 'hidden' );
60 64 }
61 65 });
62 66
@@ -79,8 +83,8 @@ jQuery( document ).ready( function( $ ) {
79 83 subgrid_selector.jqGrid('editRow',id,true);
80 84 subgrid_lastsel=id;
81 85 }},
82   - rowNum:5,
83   - rowList:[5,10,20,50,100],
  86 + rowNum:10,
  87 + rowList:[10,20,50],
84 88 pager: '#acm-codes-conditionals-pager',
85 89 sortname: 'item',
86 90 jsonReader : { repeatitems: false }, // workaround for jqGrid issue

0 comments on commit b83d510

Please sign in to comment.
Something went wrong with that request. Please try again.