Skip to content

Commit 86b62e9

Browse files
authored
Merge pull request #114 from ibrahemomari/language-settings-and-css-injection
Language settings and css injection
2 parents cf86bca + a29c08d commit 86b62e9

9 files changed

Lines changed: 96 additions & 32 deletions

File tree

plugin.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,20 @@
1616
},
1717
"settings": {
1818
"enabled": false
19+
},
20+
"language": {
21+
"enabled": true,
22+
"languageJsonPath": "resources/languages.json"
23+
},
24+
"cssInjection": {
25+
"enabled": true,
26+
"layouts": [
27+
{
28+
"name": "Layout 1",
29+
"imageUrl": "resources/layouts_img/layout1.png",
30+
"cssPath": "widget/layouts/layout1.css"
31+
}
32+
]
1933
}
2034
},
2135
"widget": {

resources/languages.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"sections": {
3+
"general": {
4+
"title": "General",
5+
"labels": {
6+
"contactInfo": {
7+
"title": "Contact Info",
8+
"defaultValue": "Contact Info",
9+
"placeholder": "Contact Info",
10+
"toolTip":"Contact Info button label"
11+
},
12+
"done": {
13+
"title": "Done",
14+
"defaultValue": "Done",
15+
"maxLength":15,
16+
"placeholder": "Done",
17+
"toolTip":"Close contact information dialog label"
18+
}
19+
}
20+
}
21+
}
22+
}

resources/layouts_img/layout1.png

52.1 KB
Loading

widget/controllers/widget.home.controller.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
var WidgetHome = this;
88
var currentListLayout = null;
99
WidgetHome.data = {};
10+
WidgetHome.closeButtonText = 'Done';
1011

1112
//create new instance of buildfire carousel viewer
1213
WidgetHome.view = null;
@@ -150,6 +151,12 @@
150151
console.log("Error while getting the device context data", error)
151152
};
152153
buildfire.getContext(getDevice);
154+
155+
buildfire.language.get({stringKey: "general.done"}, (err, result) => {
156+
if (err) return console.error("Error while retrieving string value", err);
157+
WidgetHome.closeButtonText = result;
158+
});
159+
153160
cb();
154161

155162
}
@@ -232,7 +239,7 @@
232239
});
233240

234241
if (actionItems && actionItems.length) {
235-
var options = {};
242+
var options = {closeButtonText : WidgetHome.closeButtonText};
236243
var callback = function (error, result) {
237244
if (error) {
238245
console.error('Error:', error);

widget/css/widget.app.css

Lines changed: 42 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,33 @@
11
/* Plugin CSS */
2-
.contact-plugin.layout2 .contact-maps{
3-
position:relative;
2+
.contact-plugin.layout1 .contact-info-button {
3+
max-width: 100%;
4+
overflow: hidden;
5+
text-overflow: ellipsis;
6+
white-space: nowrap;
7+
}
8+
9+
.contact-plugin.layout2 .contact-info-button {
10+
display: block;
11+
max-width: 100%;
12+
overflow: hidden;
13+
text-overflow: ellipsis;
14+
white-space: nowrap;
415
}
5-
.contact-plugin.layout2 .plugin-slider .plugin-slide{
6-
background:none;
16+
17+
.contact-plugin.layout2 .contact-maps {
18+
position: relative;
19+
}
20+
21+
.contact-plugin.layout2 .plugin-slider .plugin-slide {
22+
background: none;
723
}
8-
.contact-plugin.layout2 .plugin-slider,
9-
.contact-plugin.layout2 .plugin-slider .contact-slide{
10-
max-height:100px;
11-
background:none;
24+
25+
.contact-plugin.layout2 .plugin-slider,
26+
.contact-plugin.layout2 .plugin-slider .contact-slide {
27+
max-height: 100px;
28+
background: none;
1229
}
30+
1331
/* End Plugin CSS */
1432

1533
/* Styles for home page carousel - to align and style the slider items*/
@@ -20,13 +38,13 @@
2038

2139
/* To hide map report error link */
2240

23-
.gmnoprint a{
24-
display:none;
41+
.gmnoprint a {
42+
display: none;
2543
}
2644

2745
/* To overlay texts on background */
28-
.text-overlay{
29-
position:relative
46+
.text-overlay {
47+
position: relative
3048
}
3149

3250
/*background image css class*/
@@ -50,18 +68,17 @@
5068
text-align: center;
5169
}
5270

53-
.mapSize{
54-
height: 192px;
55-
}
56-
57-
.holder .info-bar{
58-
position:absolute;
59-
bottom:0;
60-
left:0;
61-
width:100%;
62-
padding:10px 0;
63-
opacity:0.85;
64-
z-index:9;
65-
-webkit-transform:translate3d(0,0,0);
71+
.map-size {
72+
height: 192px;
6673
}
6774

75+
.holder .info-bar {
76+
position: absolute;
77+
bottom: 0;
78+
left: 0;
79+
width: 100%;
80+
padding: 10px 0;
81+
opacity: 0.85;
82+
z-index: 9;
83+
-webkit-transform: translate3d(0, 0, 0);
84+
}

widget/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<html ng-app="contactUsPluginWidget">
33
<head>
44
<!--<base href="./"/>-->
5+
<meta name="buildfire" content="enablePluginJsonLoad">
56

67
<!-- CSS -->
78
<link rel="stylesheet" href="../../../styles/siteIcons.css">

widget/layouts/layout1.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* Here you can add your own custom CSS */

widget/templates/Layout_1.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
</div>
88
<div class="padded text-center text-overlay"
99
ng-if="WidgetHome.data.content.links[0] || WidgetHome.data.content.addressTitle||WidgetHome.data.content.address.location">
10-
<a class="btn btn-primary" ng-show="WidgetHome.data.content.links[0]"
11-
ng-click="WidgetHome.openLinks(WidgetHome.data.content.links, $event)">Contact
10+
<a class="contact-info-button btn btn-primary" ng-show="WidgetHome.data.content.links[0]"
11+
ng-click="WidgetHome.openLinks(WidgetHome.data.content.links, $event)"
12+
bfString="general.contactInfo">Contact
1213
info</a>
1314
<hr class="small" ng-show="WidgetHome.data.content.links[0]">
1415
<p class="margin-bottom-zero text-primary"
@@ -24,7 +25,7 @@
2425
</div>
2526
<div class="contact-maps text-center"
2627
ng-if="WidgetHome.data.content.address && WidgetHome.data.content.showMap">
27-
<div google-map class="mapSize"
28+
<div google-map class="map-size"
2829
coordinates="WidgetHome.data.content.address.location_coordinates"></div>
2930
</div>
3031
<div class="padded text-overlay">

widget/templates/Layout_2.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="contact-plugin layout2">
33
<div class="contact-maps text-center"
44
ng-if="WidgetHome.data.content.addressTitle || WidgetHome.data.content.address.location">
5-
<div google-map class="mapSize"
5+
<div google-map class="map-size"
66
ng-if="WidgetHome.data.content.address && WidgetHome.data.content.showMap"
77
coordinates="WidgetHome.data.content.address.location_coordinates"></div>
88
<div class="contact-address info-bar titleBarBackgroundTheme">
@@ -35,8 +35,9 @@
3535
</div>
3636

3737
<div class="margin-top-ten text-overlay text-center">
38-
<a class="text-primary" ng-show="WidgetHome.data.content.links[0]"
39-
ng-click="WidgetHome.openLinks(WidgetHome.data.content.links, $event)">Contact
38+
<a class="contact-info-button text-primary" ng-show="WidgetHome.data.content.links[0]"
39+
ng-click="WidgetHome.openLinks(WidgetHome.data.content.links, $event)"
40+
bfString="general.contactInfo">Contact
4041
info</a>
4142
<hr class="small "
4243
ng-show="WidgetHome.data.content.links[0]">

0 commit comments

Comments
 (0)