CatalystX-CRUD-YUI

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

 - remove old crud/yui_related_datatable_js.tt
 - fix console js bug evidenced with new Firebug release

0.012 12 Dec 2008
 - split related_field_info BLOCK into its own related_field_link.tt file.
   Then use it in autocomplete_field.tt
 - tweeks to results livegrid size
 - textarea fields use <pre>+autowrap+htmlescape unless they have HTML
   markup in them.
 - click on related_field_link always defaults to 'view' regardless of
   can_write. may be overridden with c.session.prefs.default_crud_action
 - add html_escape feature to Serializer
 - support dot notation for field_methods that chain related objects
   together.
 - skip ManyToOne and OneToOne rels in filter_relationships.tt since we
   assume those are handled by related_field_link.tt

0.011 02 Dec 2008
 - revert crud.js to ignore m2m_url on livegrid row click. The feature
   needs more thought.
 - fix bug with limit != count so increased livegrid buffer size from 50 to

Changes  view on Meta::CPAN

 - add error tagset to end of autocomplete input 
 - revert to 2.5.1 of YUI lib till bugs using 2.5.2 are identified
 - move most of ::TT into Template::Plugin::Handy
 - remove static height on tabbed relationship container css 
 - add support for form.metadata.default_selected to Tabs in
   show_relationships.tt
 - allow for explicit sort direction in initial datatable sort

0.006 26 Sept 2008
 - clarify debugging statement in Controller->end
 - allow for per-session prefs
 - make tab label different than viewable label
 - pass tabindex to autocomplete field maker
 - bump default yui version and set default var types if not using
   tt_config.tt

0.005 16 Sept 2008
 - add missing generic crud/count.tt file to flesh out API support
 - fix bug in form.tt with generating url for related foreign object.
 - fix bug in form.tt to allow related_value map to use non-unique column
 - add calendar popup feature to Date and DateTime field types

lib/CatalystX/CRUD/YUI/TT/crud/filter_relationships.tt  view on Meta::CPAN

            #THROW crud '"map_to" not yet supported for multiple-column FKs in ' _ component.name;
            map_to = rel_info.cmap.values.join(';;');
        END;
    END;
            
    USE create_new_url    = url(base_url _ "/create", map_params);  
    USE export_as_xls_url = url(base_url _ "/search", map_params);
    export_as_xls_url     = export_as_xls_url _ '&cxc-fmt=xls&cxc-no_page=1';
    
    SET num_fields        = rel_controller.field_names(c).size;
    SET rowclick_action   = c.session.prefs.default_crud_action || 'view';
    IF (EDITMODE);
        rowclick_action   = 'edit';
    END;
    IF (LIVEGRID_FORM_SIZE > num_fields && EDITMODE && !map_form_url);   # experimental
        rowclick_action = 'livegrid_edit_form';
    END;
    
    RelsToShow.push({
        'authz_controller'  => authz_controller,
        'method'            => method,

lib/CatalystX/CRUD/YUI/TT/crud/livegrid_js.tt  view on Meta::CPAN

            }
        [%- END -%]
        ],
        title       : '[% livegrid.title %]',
        clickhandler: function(sm, rowIndex, r) {
            if (!r) {
                YAHOO.crud.log('no row passed on click');
                return;
            }
            window.location.href = '[% c.uri_for("/" _ livegrid.controller.action_namespace) %]/' + 
                                r.id + '/' + '[% (c.session.prefs.default_crud_action || 'view') %]';
        },
        filters     : [% livegrid.col_filter.as_json || '[]' %],
        text_columns: [% livegrid.text_columns.as_json || '[]' %]
    };
    YAHOO.util.Event.onDOMReady(function() {
        YAHOO.crud.new_livegrid([% livegrid.counter || 0 %]); 
    });
    YAHOO.crud.TABS[[% livegrid.counter || 0 %]] = relTab;
/* ]]> */
</script>

lib/CatalystX/CRUD/YUI/TT/crud/livegrid_related_js.tt  view on Meta::CPAN

[% 
    IF (!r.defined);
        THROW crud '"r" must be defined in ' _ component.name;
    END;
    
    SET base_url = c.uri_for('/' _ r.livegrid.controller.path_prefix);
    SET foreign = {
        'url'           => base_url,
        'chooser_url'   => base_url _ '/livegrid?',
        'column_map'    => r.rel_info.cmap.list('each') || 0,
        'action'        => (c.session.prefs.default_crud_action 
                            || (rel_info.controller.can_write(c) 
                                    ? 'edit' : 'view')),
        'name'          => r.method,
        'can_read'      => r.authz_controller.can_read(c),
        'can_write'     => r.authz_controller.can_write(c),
        'rm_button'     => 0,
        'm2m'           => 0
    };
    
    # controller can define extra query params to limit the returned dataset

lib/CatalystX/CRUD/YUI/TT/crud/related_field_link.tt  view on Meta::CPAN

    SET viewable_value  = object.$method.unique_value;
    SET myval_uri_safe  = field.internal_value | uri;
    
    SET base_foreign_url = c.uri_for('/' _ rel_info.controller.path_prefix);
    
    # change to link directly to foreign object
    # must check if controller isa REST controller as URI format is different
    IF (rel_info.controller.isa('CatalystX::CRUD::REST'));
        myurl = base_foreign_url _ '/' _ myval_uri_safe;
    ELSE;
        myurl = base_foreign_url _ '/' _ myval_uri_safe _ '/' _ (c.session.prefs.default_crud_action || 'view');
    END;
    
    IF viewable_value.length;
        "&nbsp;<a href='$myurl'>$viewable_value</a>";
    END;
  ELSE;
     # show link to related record
     SET viewable_value  = object.$method.unique_value;
     IF !viewable_value.length;
         viewable_value = 'Related record';



( run in 1.112 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )