[Rt-commit] rt branch, 5.0/remove-catalog-modal, repushed

Michel Rodriguez michel at bestpractical.com
Mon Mar 23 11:50:55 EDT 2020


The branch 5.0/remove-catalog-modal was deleted and repushed:
       was 7546e0518870245f7205d431cc6b2bcb276a89d3
       now a4a4bd10b4ba168db8d9756f13f99d160cf44c6f

1: 996302c7d2 ! 1: a1c7567523 Select Catalog in Asset Create page.
    @@ -36,23 +36,16 @@
            <div class="col-md-6">
              <&| /Widgets/TitleBox, title => loc("Basics"), class => "asset-basics", title_class => "inverse" &>
     -          <& Elements/EditBasics, %ARGS, AssetObj => $asset, CatalogObj => $catalog &>
    --        </&>
     +          <& Elements/EditBasics, %ARGS, AssetObj => $asset, CatalogObj => $catalog, AutoSubmit => 1 &>
    -+       </&>
    +         </&>
            </div>
      
    -       <div class="col-md-6">
     @@
      <%init>
      my $asset   = RT::Asset->new( $session{CurrentUser} );
      my $catalog = RT::Catalog->new( $session{CurrentUser} );
     -$catalog->Load($Catalog);
    -+if ( $Catalog ) {
    -+    $catalog->Load($Catalog);
    -+}
    -+else {
    -+    $catalog = LoadDefaultCatalog( $ARGS{Catalog} || '' );
    -+}
    ++$catalog = LoadDefaultCatalog( $Catalog || '' );
      
      Abort(loc("Unable to find catalog '[_1]'", $Catalog))
          unless $catalog->id;
3: 6c8534b927 ! 2: a765566c18 Remove select catalog modal popup on asset creation.
    @@ -15,18 +15,6 @@
          }
      
     
    -diff --git a/lib/RT/Test/Assets.pm b/lib/RT/Test/Assets.pm
    ---- a/lib/RT/Test/Assets.pm
    -+++ b/lib/RT/Test/Assets.pm
    -@@
    -     return $obj;
    - }
    - 
    --
    - sub create_asset {
    -     my %info  = @_;
    -     my $asset = RT::Asset->new( RT->SystemUser );
    -
     diff --git a/share/html/Asset/CreateInCatalog.html b/share/html/Asset/CreateInCatalog.html
     deleted file mode 100644
     --- a/share/html/Asset/CreateInCatalog.html
    @@ -95,7 +83,7 @@
     +<form action="<% RT->Config->Get('WebPath') %>/Asset/Create.html">
        <div class="create-asset-button">
     -    <input type="submit" class="btn btn-primary asset-create-modal" value="<&|/l&>Create new asset</&>" />
    -+    <input type="submit" class="btn btn-primary" value="<&|/l&>Create new asset 1</&>" />
    ++    <input type="submit" class="btn btn-primary" value="<&|/l&>Create new asset</&>" />
        </div>
      </form>
     
2: e07ee4d4a9 ! 3: a4a4bd10b4 Test catalog select on asset create page
    @@ -47,6 +47,22 @@
     +
      1;
     
    +diff --git a/t/assets/web.t b/t/assets/web.t
    +--- a/t/assets/web.t
    ++++ b/t/assets/web.t
    +@@
    + diag "Create basic asset (no CFs)";
    + {
    +     $m->follow_link_ok({ id => "assets-create" }, "Asset create link");
    +-    $m->submit_form_ok({ with_fields => { Catalog => $catalog->id } }, "Picked a catalog");
    +     $m->submit_form_ok({
    +         with_fields => {
    +             id          => 'new',
    ++            Catalog     => $catalog->id,
    +             Name        => 'Thinkpad T420s',
    +             Description => 'A laptop',
    +         },
    +
     diff --git a/t/web/asset_create.t b/t/web/asset_create.t
     new file mode 100644
     --- /dev/null
    @@ -77,19 +93,11 @@
     +# populate test catalogs and test user
     +my $catalog_1 = RT::Test::Assets->load_or_create_catalog( Name => 'Default catalog' );
     +ok( $catalog_1, 'created catalog 1' );
    -+my $catalog_2 = RT::Test::Assets::->load_or_create_catalog( Name => 'Another catalog' );
    ++my $catalog_2 = RT::Test::Assets->load_or_create_catalog( Name => 'Another catalog', Lifecycle => 'foo' );
     +ok( $catalog_2, 'created catalog 2 id:' . $catalog_2->id );
    -+my $user   = RT::Test::Assets->load_or_create_user(
    -+    Name     => 'user',
    -+    Password => 'password',
    -+);
     +
     +my ( $baseurl, $m ) = RT::Test->started_ok;
     +ok $m->login;
    -+
    -+#set up lifecycle for catalog 2
    -+$catalog_2->SetLifecycle( 'foo');
    -+is( $catalog_2->Lifecycle, 'foo', 'catalog lifecycle changed to foo' );
     +
     +# set up custom field on catalog 2
     +my $cf = RT::Test::Assets::create_cf( Name => 'test_cf', Catalog => $catalog_2->Name, Type => 'FreeformSingle' );
    @@ -103,11 +111,6 @@
     +note('load create asset page with defaults');
     +$m->get_ok('/Asset/Create.html?');
     +
    -+ok( !$m->form_name('CreateAsset')->find_input($cf_form_id), 'custom field not present' );
    -+is( $m->form_name('CreateAsset')->value('Catalog'), $catalog_1->id, 'Catalog selection dropdown populated and pre-selected' );
    -+is( $m->form_name('CreateAsset')->value('Status'), 'new', 'Status selection dropdown populated and pre-selected' );
    -+
    -+$m->get_ok( '/Asset/Create.html', 'go to asset create page with no catalog id' );
     +ok( !$m->form_name('CreateAsset')->find_input($cf_form_id), 'custom field not present' );
     +is( $m->form_name('CreateAsset')->value('Catalog'), $catalog_1->id, 'Catalog selection dropdown populated and pre-selected' );
     +is( $m->form_name('CreateAsset')->value('Status'), 'new', 'Status selection dropdown populated and pre-selected' );
    @@ -137,4 +140,3 @@
     +is( $asset->CatalogObj->id, $catalog_2->id, 'asset created with correct catalog' );
     +
     +done_testing();
    -
4: 7546e05188 < -:  ------- Fixed tests to pass without modal catalog choice.



More information about the rt-commit mailing list