Skip to content

Commit

Permalink
Fix bug with classic site
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Apr 16, 2017
1 parent bff3117 commit abafcf7
Show file tree
Hide file tree
Showing 18 changed files with 71 additions and 14 deletions.
19 changes: 17 additions & 2 deletions src/webparts/accordion/AccordionWebPart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
} from '@microsoft/sp-webpart-base';
import { DisplayMode, Version } from '@microsoft/sp-core-library';
import { SPComponentLoader } from '@microsoft/sp-loader';
import { Environment, EnvironmentType } from '@microsoft/sp-core-library';

import * as strings from 'AccordionStrings';
import { IAccordionWebPartProps } from './IAccordionWebPartProps';
Expand Down Expand Up @@ -49,8 +50,10 @@ export default class AccordionWebPart extends BaseClientSideWebPart<IAccordionWe
//we need to bind this object on it first
this.onPropertyPaneFieldChanged = this.onPropertyPaneFieldChanged.bind(this);

//Load the JQuery smoothness CSS file
SPComponentLoader.loadCss('//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css');
if (Environment.type !== EnvironmentType.ClassicSharePoint) {
//Load the JQuery smoothness CSS file
SPComponentLoader.loadCss('//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css');
}
}

/**
Expand All @@ -67,6 +70,18 @@ export default class AccordionWebPart extends BaseClientSideWebPart<IAccordionWe
*/
public render(): void {

if (Environment.type === EnvironmentType.ClassicSharePoint) {
var errorHtml = '';
errorHtml += '<div style="color: red;">';
errorHtml += '<div style="display:inline-block; vertical-align: middle;"><i class="ms-Icon ms-Icon--Error" style="font-size: 20px"></i></div>';
errorHtml += '<div style="display:inline-block; vertical-align: middle;margin-left:7px;"><span>';
errorHtml += strings.ErrorClassicSharePoint;
errorHtml += '</span></div>';
errorHtml += '</div>';
this.domElement.innerHTML = errorHtml;
return;
}

var html = '';

//Define the main div
Expand Down
3 changes: 2 additions & 1 deletion src/webparts/accordion/loc/de-de.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ define([], function() {
"Collapsible": "Zusammenklappbar",
"Animate": "Animieren",
"Speed": "Geschwindigkeit (Millisekunden)",
"HeightStyle": "Höhe Stil"
"HeightStyle": "Höhe Stil",
"ErrorClassicSharePoint": "Sorry, aber das Web funktioniert nicht in einer Sharepoint -Website klassischen, aber nur in einem modernen Ort."
}
});
3 changes: 2 additions & 1 deletion src/webparts/accordion/loc/en-us.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ define([], function() {
"Collapsible": "Collapsible",
"Animate": "Animate",
"Speed": "Speed (ms)",
"HeightStyle": "Height Style"
"HeightStyle": "Height Style",
"ErrorClassicSharePoint": "Sorry, but this Web Part does not work in a classic SharePoint site, but only in a modern site."
}
});
3 changes: 2 additions & 1 deletion src/webparts/accordion/loc/es-es.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ define([], function() {
"Collapsible": "Plegable",
"Animate": "Animar",
"Speed": "Velocidad (milisegundo)",
"HeightStyle": "Estilo de altura"
"HeightStyle": "Estilo de altura",
"ErrorClassicSharePoint": "Lo sentimos pero la web no funciona en un sitio de SharePoint clásico, pero sólo en un sitio moderno."
}
});
3 changes: 2 additions & 1 deletion src/webparts/accordion/loc/fr-fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ define([], function() {
"Collapsible": "Rétractable",
"Animate": "Animation",
"Speed": "Vitesse (ms)",
"HeightStyle": "Hauteur"
"HeightStyle": "Hauteur",
"ErrorClassicSharePoint": "Désolé mais cette WebPart ne fonctionne pas dans un site SharePoint classique, mais uniquement dans un site moderne."
}
});
1 change: 1 addition & 0 deletions src/webparts/accordion/loc/mystrings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ declare interface IAccordionStrings {
Animate: string;
Speed: string;
HeightStyle: string;
ErrorClassicSharePoint: string;
}

declare module 'AccordionStrings' {
Expand Down
14 changes: 14 additions & 0 deletions src/webparts/fckText/FckTextWebPart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
PropertyPaneToggle
} from '@microsoft/sp-webpart-base';
import { DisplayMode, Version } from '@microsoft/sp-core-library';
import { Environment, EnvironmentType } from '@microsoft/sp-core-library';

import * as strings from 'fckTextStrings';
import { IFckTextWebPartProps } from './IFckTextWebPartProps';
Expand Down Expand Up @@ -49,6 +50,19 @@ export default class FckTextWebPart extends BaseClientSideWebPart<IFckTextWebPar
*/
public render(): void {

if (Environment.type === EnvironmentType.ClassicSharePoint) {
var errorHtml = '';
errorHtml += '<div style="color: red;">';
errorHtml += '<div style="display:inline-block; vertical-align: middle;"><i class="ms-Icon ms-Icon--Error" style="font-size: 20px"></i></div>';
errorHtml += '<div style="display:inline-block; vertical-align: middle;margin-left:7px;"><span>';
errorHtml += strings.ErrorClassicSharePoint;
errorHtml += '</span></div>';
errorHtml += '</div>';
this.domElement.innerHTML = errorHtml;
return;
}


if (this.displayMode == DisplayMode.Edit) {
//Edit mode
var html = '';
Expand Down
3 changes: 2 additions & 1 deletion src/webparts/fckText/loc/de-de.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ define([], function() {
"PropertyPaneDescription": "Passen Sie Ihre webpart",
"BasicGroupName": "Text-Editor-Einstellungen",
"DescriptionFieldLabel": "Beschreibung",
"Inline": "Inline"
"Inline": "Inline",
"ErrorClassicSharePoint": "Sorry, aber das Web funktioniert nicht in einer Sharepoint -Website klassischen, aber nur in einem modernen Ort."
}
});
3 changes: 2 additions & 1 deletion src/webparts/fckText/loc/en-us.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ define([], function() {
"PropertyPaneDescription": "Customize your Text Editor",
"BasicGroupName": "Text Editor Settings",
"DescriptionFieldLabel": "Description Field",
"Inline": "Inline"
"Inline": "Inline",
"ErrorClassicSharePoint": "Sorry, but this Web Part does not work in a classic SharePoint site, but only in a modern site."
}
});
3 changes: 2 additions & 1 deletion src/webparts/fckText/loc/es-es.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ define([], function() {
"PropertyPaneDescription": "Personaliza tu WebPart",
"BasicGroupName": "Configuración del Editor de texto",
"DescriptionFieldLabel": "Descripción",
"Inline": "En línea"
"Inline": "En línea",
"ErrorClassicSharePoint": "Lo sentimos pero la web no funciona en un sitio de SharePoint clásico, pero sólo en un sitio moderno."
}
});
3 changes: 2 additions & 1 deletion src/webparts/fckText/loc/fr-fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ define([], function() {
"PropertyPaneDescription": "Personnalisez votre web part",
"BasicGroupName": "Paramètres de l'éditeur",
"DescriptionFieldLabel": "Description",
"Inline": "Inline"
"Inline": "Inline",
"ErrorClassicSharePoint": "Désolé mais cette WebPart ne fonctionne pas dans un site SharePoint classique, mais uniquement dans un site moderne."
}
});
1 change: 1 addition & 0 deletions src/webparts/fckText/loc/mystrings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ declare interface IFckTextStrings {
PropertyPaneDescription: string;
BasicGroupName: string;
Inline: string;
ErrorClassicSharePoint: string;
}

declare module 'fckTextStrings' {
Expand Down
13 changes: 13 additions & 0 deletions src/webparts/tabs/TabsWebPart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
} from '@microsoft/sp-webpart-base';
import { DisplayMode, Version } from '@microsoft/sp-core-library';
import { SPComponentLoader } from '@microsoft/sp-loader';
import { Environment, EnvironmentType } from '@microsoft/sp-core-library';

import * as strings from 'TabsStrings';
import { ITabsWebPartProps } from './ITabsWebPartProps';
Expand Down Expand Up @@ -55,6 +56,18 @@ export default class TabsWebPart extends BaseClientSideWebPart<ITabsWebPartProps
*/
public render(): void {

if (Environment.type === EnvironmentType.ClassicSharePoint) {
var errorHtml = '';
errorHtml += '<div style="color: red;">';
errorHtml += '<div style="display:inline-block; vertical-align: middle;"><i class="ms-Icon ms-Icon--Error" style="font-size: 20px"></i></div>';
errorHtml += '<div style="display:inline-block; vertical-align: middle;margin-left:7px;"><span>';
errorHtml += strings.ErrorClassicSharePoint;
errorHtml += '</span></div>';
errorHtml += '</div>';
this.domElement.innerHTML = errorHtml;
return;
}

var html = '';
html += `
<style>
Expand Down
3 changes: 2 additions & 1 deletion src/webparts/tabs/loc/de-de.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ define([], function() {
"ManageTabs": "Verwalten von Tabs",
"Tabs": "Tabs",
"DisableColor": "Inaktive Tab-Farbe",
"SelectedColor": "Ausgewählte Tabrandfarbe"
"SelectedColor": "Ausgewählte Tabrandfarbe",
"ErrorClassicSharePoint": "Sorry, aber das Web funktioniert nicht in einer Sharepoint -Website klassischen, aber nur in einem modernen Ort."
}
});
3 changes: 2 additions & 1 deletion src/webparts/tabs/loc/en-us.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ define([], function() {
"ManageTabs": "Manage Tabs",
"Tabs": "Tabs",
"DisableColor": "Inactive Tab Color",
"SelectedColor": "Selected Tab Border Color"
"SelectedColor": "Selected Tab Border Color",
"ErrorClassicSharePoint": "Sorry, but this Web Part does not work in a classic SharePoint site, but only in a modern site."
}
});
3 changes: 2 additions & 1 deletion src/webparts/tabs/loc/es-es.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ define([], function() {
"ManageTabs": "Administrar pestañas",
"Tabs": "Pestañas",
"DisableColor": "Color de la pestaña inactiva",
"SelectedColor": "Color del borde de la ficha seleccionada"
"SelectedColor": "Color del borde de la ficha seleccionada",
"ErrorClassicSharePoint": "Lo sentimos pero la web no funciona en un sitio de SharePoint clásico, pero sólo en un sitio moderno."
}
});
3 changes: 2 additions & 1 deletion src/webparts/tabs/loc/fr-fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ define([], function() {
"ManageTabs": "Gérer les onglets",
"Tabs": "Onglets",
"DisableColor": "Couleur des onglets inactifs",
"SelectedColor": "Couleur de l'onglet sélectionné"
"SelectedColor": "Couleur de l'onglet sélectionné",
"ErrorClassicSharePoint": "Désolé mais cette WebPart ne fonctionne pas dans un site SharePoint classique, mais uniquement dans un site moderne."
}
});
1 change: 1 addition & 0 deletions src/webparts/tabs/loc/mystrings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ declare interface ITabsStrings {
Tabs: string;
DisableColor: string;
SelectedColor: string;
ErrorClassicSharePoint: string;
}

declare module 'TabsStrings' {
Expand Down

0 comments on commit abafcf7

Please sign in to comment.