github.com/gocaveman/caveman@v0.0.0-20191211162744-0ddf99dbdf6e/gen/view-model-listing.go (about)

     1  package gen
     2  
     3  // listing - probably loads ajax (rather than page data), because
     4  // search will need that anyway
     5  
     6  // mobile-first
     7  
     8  // embedability - think about what happens if we want to move this to an include file
     9  //  and call it from JS in a modal or something, what can we do to make that scenario painless
    10  
    11  // sort by columns
    12  
    13  // max record limit
    14  
    15  // ability to add the idea that you can drag and drop a sequnece for things - not core functionalityu
    16  // but needs to be addable if needed; possibly a separate generator
    17  
    18  // paging - think about how it integrates with search, and how permalinks work
    19  
    20  // fancy search: Here’s the idea I’m leaning toward:
    21  // In our listing pages, we basically have a pattern where we
    22  // have a set of which fields are searched.  The case of a single
    23  // ‘word’ typed in (i.e. no space) to the search, would result in
    24  // an AJAX query for each of the fields, in sequence, with a max
    25  // limit on each one, for example 50.  It also stops when it gets
    26  // 50 results.  Example - we search “email”, “phone”, “company_name”,
    27  // “first_name”, “last_name” - in that sequence.  And just fill up to
    28  // 50 records.  So the guy types in a phone number, great, one match.
    29  // Same with and email.  But if he types in “joe” it will end up
    30  // searching for “joe%” in those fields and probably return some
    31  // things for the company, first and last. It would be a bit slower,
    32  // but it would be really cool and useful.  And once the pattern is there,
    33  // pretty easy to do. (And if you want fast and simple single-field
    34  // searches, you just make the field list just one field and it has
    35  // the right behavior.)
    36  
    37  // think through how case-sensitivity works
    38  // current idea: both mysql and sqlite3 provide case-insensitive collations, it
    39  // makes good sense to just use the right collation for fields in the migrations
    40  // we provide and then like 'joe%' will do the right thing.  (need to make sure that
    41  // string keys (base64 uuids) are case sensitive but pretty much everything else is
    42  // case insensitive); for postgress we need to use ILIKE, maybe it can be a hack
    43  // in the store layer to structure the query in that way (or look at adding it to
    44  // dbrobj to help abstract it away) - either way, get the database to do it for us -
    45  // it's somewhat obscure but is actually supported if you know what you're doing;
    46  // user can also just change the collation for a field if case-insensitivity is wrong,
    47  // but for common cases it will be correct.
    48  
    49  // toggle which fields it searches?
    50  
    51  // option to edit records inline! (to add them too? delete? - what about field validation...
    52  // this starts to get really compilcated, see if it's worth it, or if there is some
    53  // simplification than can be done to limit the complexity on how this is implemented -
    54  // it would very very cool though...)  See if there is a way to combine logic with the
    55  // detail page, otherwise it may start to be duplicative... such as...:
    56  // error message handling on saving
    57  // including login redirection for when login times out