Skip to content

Commit 13494b5

Browse files
committed
Updated grunt-contrib-less to amend modifyVars (for image paths).
1 parent aeb3237 commit 13494b5

File tree

6 files changed

+95
-37
lines changed

6 files changed

+95
-37
lines changed

Gruntfile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ module.exports = function (grunt) {
6868
paths: ['less'],
6969
cleancss: false,
7070
modifyVars: {
71-
imgBaseUrl: '../images'
71+
imgBaseUrl: '"../assets"'
7272
}
7373
},
7474
files: {
@@ -80,7 +80,7 @@ module.exports = function (grunt) {
8080
paths: ['less'],
8181
cleancss: true,
8282
modifyVars: {
83-
imgBaseUrl: '../images'
83+
imgBaseUrl: '"../assets"'
8484
}
8585
},
8686
files: {

dist_rails/javascripts/framework7.js

Lines changed: 70 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
* Licensed under MIT
1212
*
13-
* Released on: April 6, 2014
13+
* Released on: April 11, 2014
1414
*/
1515
(function () {
1616

@@ -97,13 +97,14 @@
9797
app.addView = function (viewSelector, viewParams) {
9898
if (!viewSelector) return;
9999
var container = $(viewSelector)[0];
100+
var startUrl = container.getAttribute('data-url') || viewParams.startUrl;
100101
var view = {
101102
container: container,
102103
selector: viewSelector,
103104
params: viewParams || {},
104105
history: [],
105106
contentCache: {},
106-
url: '',
107+
url: startUrl || '',
107108
pagesContainer: $('.pages', container)[0],
108109
main: $(container).hasClass('view-main'),
109110
loadContent: function (content) {
@@ -130,7 +131,10 @@
130131
};
131132
// Store to history main view's url
132133
if (view.main) {
133-
view.url = document.location.href;
134+
view.url = startUrl || document.location.href;
135+
view.history.push(view.url);
136+
}
137+
else if (startUrl) {
134138
view.history.push(view.url);
135139
}
136140
// Store View in element for easy access
@@ -489,7 +493,7 @@
489493
if (app.params.onPageBeforeInit) {
490494
app.params.onPageBeforeInit(pageData);
491495
}
492-
if (view.params.onPageBeforeInit) {
496+
if (view && view.params.onPageBeforeInit) {
493497
view.params.onPageBeforeInit(pageData);
494498
}
495499
$(document).trigger('pageBeforeInit', {page: pageData});
@@ -498,7 +502,7 @@
498502
if (app.params.onPageInit) {
499503
app.params.onPageInit(pageData);
500504
}
501-
if (view.params.onPageInit) {
505+
if (view && view.params.onPageInit) {
502506
view.params.onPageInit(pageData);
503507
}
504508
$(document).trigger('pageInit', {page: pageData});
@@ -527,6 +531,9 @@
527531

528532
}
529533
if (callback === 'before') {
534+
// Add data-page on view
535+
$(view.container).attr('data-page', pageData.name);
536+
530537
// Hide/show navbar dynamically
531538
if (newPage.hasClass('no-navbar') && !oldPage.hasClass('no-navbar')) {
532539
view.hideNavbar();
@@ -1122,11 +1129,25 @@
11221129
app.openModal(modal);
11231130
return modal[0];
11241131
};
1125-
app.popover = function (modal, target) {
1132+
app.popover = function (modal, target, removeOnClose) {
1133+
if (typeof removeOnClose === 'undefined') removeOnClose = true;
1134+
if (typeof modal === 'string' && modal.indexOf('<') >= 0) {
1135+
var _modal = document.createElement('div');
1136+
_modal.innerHTML = modal;
1137+
if (_modal.childNodes.length > 0) {
1138+
modal = _modal.childNodes[0];
1139+
if (removeOnClose) modal.classList.add('remove-on-close');
1140+
$('body').append(modal);
1141+
}
1142+
else return false; //nothing found
1143+
}
11261144
modal = $(modal);
1145+
console.log(target);
11271146
target = $(target);
11281147
if (modal.length === 0 || target.length === 0) return false;
1129-
1148+
if (modal.find('.popover-angle').length === 0) {
1149+
modal.append('<div class="popover-angle"></div>');
1150+
}
11301151
modal.show();
11311152

11321153
function sizePopover() {
@@ -1214,7 +1235,18 @@
12141235
app.openModal(modal);
12151236
return modal[0];
12161237
};
1217-
app.popup = function (modal) {
1238+
app.popup = function (modal, removeOnClose) {
1239+
if (typeof removeOnClose === 'undefined') removeOnClose = true;
1240+
if (typeof modal === 'string' && modal.indexOf('<') >= 0) {
1241+
var _modal = document.createElement('div');
1242+
_modal.innerHTML = modal;
1243+
if (_modal.childNodes.length > 0) {
1244+
modal = _modal.childNodes[0];
1245+
if (removeOnClose) modal.classList.add('remove-on-close');
1246+
$('body').append(modal);
1247+
}
1248+
else return false; //nothing found
1249+
}
12181250
modal = $(modal);
12191251
if (modal.length === 0) return false;
12201252
modal.show();
@@ -1252,15 +1284,18 @@
12521284
modal.trigger('close');
12531285
var isPopover = modal.hasClass('popover');
12541286
var isPopup = modal.hasClass('popup');
1287+
var removeOnClose = modal.hasClass('remove-on-close');
12551288
if (!isPopover) {
12561289
modal.removeClass('modal-in').addClass('modal-out').transitionEnd(function (e) {
12571290
modal.trigger('closed');
12581291
if (!isPopup) modal.remove();
12591292
if (isPopup) modal.removeClass('modal-out').hide();
1293+
if (removeOnClose) modal.remove();
12601294
});
12611295
}
12621296
else {
12631297
modal.removeClass('modal-in modal-out').trigger('closed').hide();
1298+
if (removeOnClose) modal.remove();
12641299
}
12651300
return true;
12661301
};
@@ -1773,6 +1808,9 @@
17731808
}
17741809
else {
17751810
view = clicked.parents('.view')[0] && clicked.parents('.view')[0].f7View;
1811+
if (view && view.params.linksView) {
1812+
view = $(view.params.linksView)[0].f7View;
1813+
}
17761814
}
17771815
if (!view) {
17781816
for (var i = 0; i < app.views.length; i++) {
@@ -1829,9 +1867,20 @@
18291867
device.os = 'ios';
18301868
}
18311869
// iOS
1832-
if (iphone && !ipod) device.osVersion = iphone[2].replace(/_/g, '.');
1833-
if (ipad) device.osVersion = ipad[2].replace(/_/g, '.');
1834-
if (ipod) device.osVersion = ipod[3] ? ipod[3].replace(/_/g, '.') : null;
1870+
device.iphone = false;
1871+
device.ipad = false;
1872+
if (iphone && !ipod) {
1873+
device.osVersion = iphone[2].replace(/_/g, '.');
1874+
device.iphone = true;
1875+
}
1876+
if (ipad) {
1877+
device.osVersion = ipad[2].replace(/_/g, '.');
1878+
device.ipad = true;
1879+
}
1880+
if (ipod) {
1881+
device.osVersion = ipod[3] ? ipod[3].replace(/_/g, '.') : null;
1882+
device.iphone = true;
1883+
}
18351884

18361885
// Webview
18371886
device.webview = (iphone || ipad || ipod) && ua.match(/.*AppleWebKit(?!.*Safari)/i);
@@ -1902,7 +1951,14 @@
19021951
if (app.initPullToRefresh && app.params.pullToRefresh) app.initPullToRefresh();
19031952
// Init each page callbacks
19041953
$('.page').each(function () {
1905-
app.initPage(this);
1954+
var pageContainer = $(this);
1955+
var viewContainer = pageContainer.parents('.view');
1956+
var view = viewContainer[0].f7View || false;
1957+
var url = view && view.url ? view.url : false;
1958+
if (viewContainer) {
1959+
viewContainer.attr('data-page', pageContainer.attr('data-page') || undefined);
1960+
}
1961+
app.pageInitCallback(view, this, url, 'center');
19061962
});
19071963
// Init resize events
19081964
if (app.initResize) app.initResize();
@@ -2426,4 +2482,6 @@
24262482
return !!(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch);
24272483
})();
24282484
$.fn = Dom7.prototype;
2485+
// Export Selectors engine to global Framework7
2486+
Framework7.$ = $;
24292487
})();

dist_rails/javascripts/framework7.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist_rails/stylesheets/framework7.css

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
* Licensed under MIT
1212
*
13-
* Released on: April 6, 2014
13+
* Released on: April 11, 2014
1414
*/
1515
/*=============
1616
Framework 7
@@ -890,57 +890,57 @@ i.icon.icon-bars-black {
890890
i.icon.icon-f7 {
891891
width: 29px;
892892
height: 29px;
893-
background-image: url("../img/i-f7.png");
893+
background-image: url("../assets/i-f7.png");
894894
}
895895
i.icon.icon-form-name {
896896
width: 29px;
897897
height: 29px;
898-
background-image: url("../img/i-form-name.png");
898+
background-image: url("../assets/i-form-name.png");
899899
}
900900
i.icon.icon-form-password {
901901
width: 29px;
902902
height: 29px;
903-
background-image: url("../img/i-form-password.png");
903+
background-image: url("../assets/i-form-password.png");
904904
}
905905
i.icon.icon-form-email {
906906
width: 29px;
907907
height: 29px;
908-
background-image: url("../img/i-form-email.png");
908+
background-image: url("../assets/i-form-email.png");
909909
}
910910
i.icon.icon-form-calendar {
911911
width: 29px;
912912
height: 29px;
913-
background-image: url("../img/i-form-calendar.png");
913+
background-image: url("../assets/i-form-calendar.png");
914914
}
915915
i.icon.icon-form-tel {
916916
width: 29px;
917917
height: 29px;
918-
background-image: url("../img/i-form-tel.png");
918+
background-image: url("../assets/i-form-tel.png");
919919
}
920920
i.icon.icon-form-gender {
921921
width: 29px;
922922
height: 29px;
923-
background-image: url("../img/i-form-gender.png");
923+
background-image: url("../assets/i-form-gender.png");
924924
}
925925
i.icon.icon-form-toggle {
926926
width: 29px;
927927
height: 29px;
928-
background-image: url("../img/i-form-toggle.png");
928+
background-image: url("../assets/i-form-toggle.png");
929929
}
930930
i.icon.icon-form-comment {
931931
width: 29px;
932932
height: 29px;
933-
background-image: url("../img/i-form-comment.png");
933+
background-image: url("../assets/i-form-comment.png");
934934
}
935935
i.icon.icon-form-settings {
936936
width: 29px;
937937
height: 29px;
938-
background-image: url("../img/i-form-settings.png");
938+
background-image: url("../assets/i-form-settings.png");
939939
}
940940
i.icon.icon-form-url {
941941
width: 29px;
942942
height: 29px;
943-
background-image: url("../img/i-form-url.png");
943+
background-image: url("../assets/i-form-url.png");
944944
}
945945
.badge {
946946
font-size: 13px;
@@ -1710,7 +1710,7 @@ label.label-checkbox input[type="radio"] {
17101710
label.label-checkbox input[type="checkbox"]:checked + .item-media i.icon-form-checkbox:after,
17111711
label.label-checkbox input[type="radio"]:checked + .item-media i.icon-form-checkbox:after {
17121712
border: none;
1713-
background: #007aff url("../img/i-form-checkbox-white.png") no-repeat center;
1713+
background: #007aff url("../assets/i-form-checkbox-white.png") no-repeat center;
17141714
-webkit-background-size: auto 9px;
17151715
background-size: auto 9px;
17161716
}
@@ -1727,10 +1727,10 @@ label.label-radio input[type="radio"] ~ .item-inner {
17271727
}
17281728
label.label-radio input[type="checkbox"]:checked ~ .item-inner,
17291729
label.label-radio input[type="radio"]:checked ~ .item-inner {
1730-
background: url("../img/i-form-radio-blue.png") no-repeat -webkit-calc(100% - 15px center;
1731-
background: url("../img/i-form-radio-blue.png") no-repeat -moz-calc(100% - 15px center;
1732-
background: url("../img/i-form-radio-blue.png") no-repeat -ms-calc(100% - 15px center;
1733-
background: url("../img/i-form-radio-blue.png") no-repeat calc(100% - 15px center;
1730+
background: url("../assets/i-form-radio-blue.png") no-repeat -webkit-calc(100% - 15px center;
1731+
background: url("../assets/i-form-radio-blue.png") no-repeat -moz-calc(100% - 15px center;
1732+
background: url("../assets/i-form-radio-blue.png") no-repeat -ms-calc(100% - 15px center;
1733+
background: url("../assets/i-form-radio-blue.png") no-repeat calc(100% - 15px center;
17341734
-webkit-background-size: auto 10px;
17351735
background-size: auto 10px;
17361736
}

dist_rails/stylesheets/framework7.min.css

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"grunt-contrib-concat": "~0.3.0",
3333
"grunt-contrib-jshint": "~0.7.2",
3434
"grunt-contrib-uglify": "~0.4.0",
35-
"grunt-contrib-less": "~0.9.0",
35+
"grunt-contrib-less": "^0.11.0",
3636
"grunt-contrib-jade": "~0.9.0",
3737
"grunt-contrib-watch": "~0.5.3",
3838
"grunt-contrib-copy": "~0.5.0",

0 commit comments

Comments
 (0)