adding text search to the list view
authorAnthony Talarico <talarico@gaslightmedia.com>
Tue, 21 Nov 2017 20:16:59 +0000 (15:16 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Tue, 21 Nov 2017 20:16:59 +0000 (15:16 -0500)
adding text search to the list view, with pending only checkbox. search results displays the
query

css/admin.css
css/admin.css.map
models/admin/forSale/index.php
scss/admin.scss
views/admin/forSale/list.html

index af3d4c8..6897c1e 100644 (file)
@@ -1,3 +1,3 @@
-.admin-new-item{margin-bottom:15px}.admin-new-item .admin-new-item-link{padding:5px;background:#3D84D0;color:white;text-decoration:none;border-radius:4px}.for-sale-list-wrapper .glm-row{margin:0 !important}.for-sale-list-wrapper .glm-required{color:red}.for-sale-list-wrapper .admin-item-label,.for-sale-list-wrapper .admin-item-input,.for-sale-list-wrapper .admin-item-list{padding:6px 0px 6px 2px}.for-sale-list-wrapper .admin-item-label .admin-item-data,.for-sale-list-wrapper .admin-item-input .admin-item-data,.for-sale-list-wrapper .admin-item-list .admin-item-data{margin-bottom:0px !important}.for-sale-list-wrapper .admin-list-edit-item{padding:5px}.for-sale-list-wrapper .admin-list-edit-items{position:absolute;right:0;max-width:100px;float:right}@media (max-width: 641px){.for-sale-list-wrapper .admin-list-edit-items{margin:0 auto;float:none}}.for-sale-list-wrapper .itemTitle-record{float:left}.for-sale-list-wrapper .no-padding{padding:0}.for-sale-list-wrapper .no-margin{margin:0}.for-sale-list-wrapper .admin-item-list-header{margin-bottom:20px;padding-bottom:2px;border-bottom:1px solid lightgray}.for-sale-list-wrapper .item-company-list-header,.for-sale-list-wrapper .item-date-list-header,.for-sale-list-wrapper .item-title-list-header{font-weight:bold;font-size:16px}.for-sale-list-wrapper .admin-item-list-row:nth-child(odd){background:#e3e3e5}.for-sale-list-wrapper .item-image{display:block;max-width:200px}.for-sale-list-wrapper .item-image-row{border-bottom:1px solid lightgray;padding-bottom:10px}
+.admin-new-item{margin-bottom:15px;clear:both}#item-pending-search{margin-top:3px}.text-set,.pending-set{float:left;margin:0 20px 20px 0}.admin-new-item .admin-new-item-link{padding:5px;background:#3D84D0;color:white;text-decoration:none;border-radius:4px}.for-sale-list-wrapper{clear:both}.for-sale-list-wrapper .glm-row{margin:0 !important}.for-sale-list-wrapper .glm-required{color:red}.for-sale-list-wrapper .admin-item-label,.for-sale-list-wrapper .admin-item-input,.for-sale-list-wrapper .admin-item-list{padding:6px 0px 6px 2px}.for-sale-list-wrapper .admin-item-label .admin-item-data,.for-sale-list-wrapper .admin-item-input .admin-item-data,.for-sale-list-wrapper .admin-item-list .admin-item-data{margin-bottom:0px !important}.for-sale-list-wrapper .admin-list-edit-item{padding:5px}.for-sale-list-wrapper .admin-list-edit-items{position:absolute;right:0;max-width:100px;float:right}@media (max-width: 641px){.for-sale-list-wrapper .admin-list-edit-items{margin:0 auto;float:none}}.for-sale-list-wrapper .itemTitle-record{float:left}.for-sale-list-wrapper .no-padding{padding:0}.for-sale-list-wrapper .no-margin{margin:0}.for-sale-list-wrapper .admin-item-list-header{margin-bottom:20px;padding-bottom:2px;border-bottom:1px solid lightgray}.for-sale-list-wrapper .item-company-list-header,.for-sale-list-wrapper .item-date-list-header,.for-sale-list-wrapper .item-title-list-header{font-weight:bold;font-size:16px}.for-sale-list-wrapper .admin-item-list-row:nth-child(odd){background:#e3e3e5}.for-sale-list-wrapper .item-image{display:block;max-width:200px}.for-sale-list-wrapper .item-image-row{border-bottom:1px solid lightgray;padding-bottom:10px}
 
 /*# sourceMappingURL=admin.css.map */
index f7e6c84..d0d0a05 100644 (file)
@@ -1 +1 @@
-{"version":3,"file":"admin.css","sources":["admin.scss"],"sourcesContent":[".admin-new-item{\n    margin-bottom: 15px;\n}\n.admin-new-item .admin-new-item-link{\n    padding: 5px;\n    background: #3D84D0;\n    color: white;\n    text-decoration: none;\n    border-radius: 4px;\n}\n.for-sale-list-wrapper{\n    .glm-row{\n        margin: 0 !important;\n    }\n    .glm-required{\n        color: red;\n    }\n    .admin-item-label,\n    .admin-item-input,\n    .admin-item-list{\n        padding: 6px 0px 6px 2px;\n        .admin-item-data{\n            margin-bottom: 0px !important;\n        }\n    }\n    .admin-list-edit-item{\n        // float: right;\n        padding: 5px;\n    }\n    .admin-list-edit-items{\n        position: absolute;\n        right: 0;\n        // top: 6px;\n        max-width: 100px;\n        float: right;\n        @media(max-width: 641px){\n            margin: 0 auto;\n            float: none;\n        }\n    }\n    .itemTitle-record{\n        float: left;\n    }\n    \n    .no-padding{\n        padding: 0;\n    }\n    .no-margin{\n        margin: 0;\n    }\n    .admin-item-list-header{\n        margin-bottom: 20px;\n        padding-bottom: 2px;\n        border-bottom: 1px solid lightgray;\n    }\n    .admin-item-list-row{\n        // padding-bottom: 5px;\n    /*    border-bottom: 1px solid lightgray;*/\n    }\n    .item-company-list-header,.item-date-list-header, .item-title-list-header{\n        font-weight: bold;\n        font-size: 16px;\n    }\n    .admin-item-list-row:nth-child(odd){\n        background: #e3e3e5;\n    }\n    .item-image{\n        display: block;\n        max-width: 200px;\n    }\n    .item-image-row{\n        border-bottom: 1px solid lightgray;\n        padding-bottom: 10px;\n    }\n}"],"names":[],"mappings":"AAAA,AAAA,eAAe,AAAA,CACX,aAAa,CAAE,IAAI,CACtB,AACD,AAAgB,eAAD,CAAC,oBAAoB,AAAA,CAChC,OAAO,CAAE,GAAG,CACZ,UAAU,CAAE,OAAO,CACnB,KAAK,CAAE,KAAK,CACZ,eAAe,CAAE,IAAI,CACrB,aAAa,CAAE,GAAG,CACrB,AACD,AACI,sBADkB,CAClB,QAAQ,AAAA,CACJ,MAAM,CAAE,YAAY,CACvB,AAHL,AAII,sBAJkB,CAIlB,aAAa,AAAA,CACT,KAAK,CAAE,GAAG,CACb,AANL,AAOI,sBAPkB,CAOlB,iBAAiB,CAPrB,AAQI,sBARkB,CAQlB,iBAAiB,CARrB,AASI,sBATkB,CASlB,gBAAgB,AAAA,CACZ,OAAO,CAAE,eAAe,CAI3B,AAdL,AAWQ,sBAXc,CAOlB,iBAAiB,CAIb,gBAAgB,CAXxB,AA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,sBA5DkB,CA4DlB,eAAe,AAAA,CACX,aAAa,CAAE,mBAAmB,CAClC,cAAc,CAAE,IAAI,CACvB"}
\ No newline at end of file
+{"version":3,"file":"admin.css","sources":["admin.scss"],"sourcesContent":[".admin-new-item{\n    margin-bottom: 15px;\n    clear: both;\n}\n#item-pending-search{\n    margin-top: 3px;\n}\n.text-set, .pending-set{\n    float: left;\n    margin:0 20px 20px 0;\n}\n.admin-new-item .admin-new-item-link{\n    padding: 5px;\n    background: #3D84D0;\n    color: white;\n    text-decoration: none;\n    border-radius: 4px;\n}\n.for-sale-list-wrapper{\n    clear: both;\n    .glm-row{\n        margin: 0 !important;\n    }\n    .glm-required{\n        color: red;\n    }\n    .admin-item-label,\n    .admin-item-input,\n    .admin-item-list{\n        padding: 6px 0px 6px 2px;\n        .admin-item-data{\n            margin-bottom: 0px !important;\n        }\n    }\n    .admin-list-edit-item{\n        // float: right;\n        padding: 5px;\n    }\n    .admin-list-edit-items{\n        position: absolute;\n        right: 0;\n        // top: 6px;\n        max-width: 100px;\n        float: right;\n        @media(max-width: 641px){\n            margin: 0 auto;\n            float: none;\n        }\n    }\n    .itemTitle-record{\n        float: left;\n    }\n    \n    .no-padding{\n        padding: 0;\n    }\n    .no-margin{\n        margin: 0;\n    }\n    .admin-item-list-header{\n        margin-bottom: 20px;\n        padding-bottom: 2px;\n        border-bottom: 1px solid lightgray;\n    }\n    .admin-item-list-row{\n        // padding-bottom: 5px;\n    /*    border-bottom: 1px solid lightgray;*/\n    }\n    .item-company-list-header,.item-date-list-header, .item-title-list-header{\n        font-weight: bold;\n        font-size: 16px;\n    }\n    .admin-item-list-row:nth-child(odd){\n        background: #e3e3e5;\n    }\n    .item-image{\n        display: block;\n        max-width: 200px;\n    }\n    .item-image-row{\n        border-bottom: 1px solid lightgray;\n        padding-bottom: 10px;\n    }\n}"],"names":[],"mappings":"AAAA,AAAA,eAAe,AAAA,CACX,aAAa,CAAE,IAAI,CACnB,KAAK,CAAE,IAAI,CACd,AAC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AiB,AAAA,CACb,KAAK,CAAE,IAAI,CACd,AAjCL,AAmCI,sBAnCkB,CAmClB,WAAW,AAAA,CACP,OAAO,CAAE,CAAC,CACb,AArCL,AAsCI,sBAtCkB,CAsClB,UAAU,AAAA,CACN,MAAM,CAAE,CAAC,CACZ,AAxCL,AAyCI,sBAzCkB,CAyClB,uBAAuB,AAAA,CACnB,aAAa,CAAE,IAAI,CACnB,cAAc,CAAE,GAAG,CACnB,aAAa,CAAE,mBAAmB,CACrC,AA7CL,AAkDI,sBAlDkB,CAkDlB,yBAAyB,CAlD7B,AAkD8B,sBAlDR,CAkDQ,sBAAsB,CAlDpD,AAkDsD,sBAlDhC,CAkDgC,uBAAuB,AAAA,CACrE,WAAW,CAAE,IAAI,CACjB,SAAS,CAAE,IAAI,CAClB,AArDL,AAsDI,sBAtDkB,CAsDlB,oBAAoB,AAAA,UAAW,CAAA,AAAA,GAAG,CAAC,CAC/B,UAAU,CAAE,OAAO,CACtB,AAxDL,AAyDI,sBAzDkB,CAyDlB,WAAW,AAAA,CACP,OAAO,CAAE,KAAK,CACd,SAAS,CAAE,KAAK,CACnB,AA5DL,AA6DI,sBA7DkB,CA6DlB,eAAe,AAAA,CACX,aAAa,CAAE,mBAAmB,CAClC,cAAc,CAAE,IAAI,CACvB"}
\ No newline at end of file
index 5c4ff45..a8c1274 100644 (file)
@@ -107,8 +107,9 @@ class GlmMembersAdmin_forSale_index extends GlmDataForSale
         $haveMember          = false;
         $where               = 'TRUE';
 
-        $isPending = ( !empty( $_REQUEST['pending-item'] ) ) ? true : false;
-       
+        $isPending  = ( !empty( $_REQUEST['pending-item'] ) ) ? true : false;
+        $textSearch = ( !empty( $_REQUEST['text-search'] ) ) ? filter_var($_REQUEST['text-search'], FILTER_SANITIZE_STRING) : false;
+        
         // Check if there's a logged in user who is locked to their own entity
         $lockedToMember = apply_filters('glm_members_locked_to_member_id', false);
         if ($lockedToMember) {
@@ -183,6 +184,9 @@ class GlmMembersAdmin_forSale_index extends GlmDataForSale
         if($isPending){
             $where .= ' AND active = 0 ';
         }
+        if($textSearch){
+            $where .= " AND title LIKE '%$textSearch%'";
+        }
         $item_data = $this->getList($where,'topic DESC, title');
         switch ($option) {
 
@@ -285,6 +289,7 @@ class GlmMembersAdmin_forSale_index extends GlmDataForSale
             'option'            => $option,
             'item'              => $item,
             'isPending'         => $isPending,
+            'textSearch'        => $textSearch,
             'assetsUrl'         => GLM_MEMBERS_FOR_SALE_PLUGIN_URL . 'assets/',
         );
 
index b6fb2a6..c713dba 100644 (file)
@@ -1,5 +1,13 @@
 .admin-new-item{
     margin-bottom: 15px;
+    clear: both;
+}
+#item-pending-search{
+    margin-top: 3px;
+}
+.text-set, .pending-set{
+    float: left;
+    margin:0 20px 20px 0;
 }
 .admin-new-item .admin-new-item-link{
     padding: 5px;
@@ -9,6 +17,7 @@
     border-radius: 4px;
 }
 .for-sale-list-wrapper{
+    clear: both;
     .glm-row{
         margin: 0 !important;
     }
index e076d16..f7e017e 100644 (file)
@@ -8,15 +8,26 @@
         <input type="hidden" name="option" value="list">
     {/if}
     <div id="item-search">
-        <fieldset>
+        <fieldset class="pending-set">
             <label for="item-search-btn">Pending Only</label>
-            <input {if $isPending} checked {/if} id="item-pending-search" type="checkbox" name="pending-item" value="1">
-
+            <input id="item-pending-search" type="checkbox" name="pending-item" value="1">
         </fieldset>
-        <fieldset>
+        <fieldset class="text-set">
             <input type="text" name="text-search" id="text-search">
             <input type="submit" id="item-search-btn" value="Text Search">
         </fieldset>
+        <div class="search-terms">
+            {if $isPending}
+                <span style="font-weight: bold;" id="search-pending">
+                    Pending Only
+                </span>
+            {/if}
+            {if $textSearch}
+                <span style="font-weight: bold;" id="search-term">
+                    Search Term: {$textSearch}
+                </span>
+            {/if}
+        </div>
     </div>
 
     <div class="admin-new-item">