Skip to content

Commit

Permalink
Merge pull request #467 from IgniteUI/dTsvetkov/fix-dv-samples-codesa…
Browse files Browse the repository at this point in the history
…ndbox

Fix dv samples git path for codesandbox
  • Loading branch information
hanastasov authored Jun 24, 2024
2 parents 1ac031a + e4abf23 commit 6374217
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/app/services/code-view/angular-code-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,13 @@ export class AngularCodeService extends CodeService {
return `https://codesandbox.io/s/github/IgniteUI/${repositoryPath}${branch}/${sampleUrl}`;
}

private getGitHubSampleUrl(demosBaseUrl: string, sampleUrl: string) {
private getGitHubSampleUrl(demosBaseUrl: string, sampleUrl: string, gitSrc?: string) {
// Get sample application base path
const projectPath = demosBaseUrl.substring(demosBaseUrl.lastIndexOf("/") + 1)
let demoPath = sampleUrl.replace(demosBaseUrl + "/", projectPath + "/");

if (util.isLocalhost) {
demoPath = this.isDvSample(demosBaseUrl, sampleUrl) ? demoPath.replace(projectPath, 'samples') : demoPath.replace(projectPath, 'angular-demos');
if (this.isDvSample(demosBaseUrl, sampleUrl) && gitSrc) {
demoPath = 'samples/' + gitSrc;
}
return demoPath;
}
Expand All @@ -150,7 +150,7 @@ export class AngularCodeService extends CodeService {
const codeService = this;
codeService.isButtonClickInProgress = true;
let demosBaseUrl = $codeView.attr(codeService.demosBaseUrlAttrName)!;
let sampleFileUrl = codeService.getGitHubSampleUrl(demosBaseUrl, $codeView.attr(codeService.sampleUrlAttrName)!);
let sampleFileUrl = codeService.getGitHubSampleUrl(demosBaseUrl, $codeView.attr(codeService.sampleUrlAttrName)!, $codeView.attr(codeService.githubSrc)!);
let editor = $button.hasClass(codeService.stkbButtonClass) ? "stackblitz" : "codesandbox";
let branch = demosBaseUrl.indexOf("staging.infragistics.com") !== -1 ? "vNext" : "master";
window.open(codeService.getAngularGitHubSampleUrl(editor, sampleFileUrl, branch, demosBaseUrl), '_blank');
Expand Down
1 change: 1 addition & 0 deletions src/app/services/code-view/base-code-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export abstract class CodeService {
protected buttonSampleSourceAttrName = "data-sample-src";
protected demosBaseUrlAttrName = "data-demos-base-url";
protected sampleUrlAttrName = "iframe-src";
protected githubSrc = "github-src";
protected isButtonClickInProgress = false;
protected demosUrls: Map<string, ISampleData[]> = new Map();

Expand Down
2 changes: 1 addition & 1 deletion src/app/services/localization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class LocalizationService {
"ctaGenericActionText": "60+ reusable components",
"ctaGridText": "A {{actionText}}, covering everything from paging, sorting, filtering, editing, grouping to virtualization on rows and columns, and beyond. No limits for .NET developers.",
"ctaGridActionText": "full set of ready-to-use features",
"ctaChartText": "Transform raw data into stunning visualizations and ensure the best UX, using {{actionText}} and graphs optimized for Blazor WebAssembly and Blazor Server.",
"ctaChartText": "Transform raw data into stunning visualizations and ensure the best UX, {{actionText}} and graphs optimized for Blazor WebAssembly and Blazor Server.",
"ctaChartActionText": "using 60+ high-performance charts",
},
"hljs": {
Expand Down

0 comments on commit 6374217

Please sign in to comment.