Skip to content
Browse files

fix(grunt): fixed grunt

  • Loading branch information...
1 parent 1dfe1a4 commit 06599aed10abac09efa5b984cd7195d83710c4df @mgcrea committed
Showing with 142 additions and 115 deletions.
  1. +1 −0 .gitignore
  2. +1 −1 .travis.yml
  3. +127 −0 Gruntfile.js
  4. +2 −3 dist/angular-strap.js
  5. +3 −3 dist/angular-strap.min.js
  6. +0 −104 grunt.js
  7. +8 −4 package.json
View
1 .gitignore
@@ -2,4 +2,5 @@
npm-debug.log
test/coverage
components/
+node_modules/
!.gitignore
View
2 .travis.yml
@@ -10,4 +10,4 @@ before_script:
- npm install -g grunt-cli
script:
- - grunt lint test
+ - grunt
View
127 Gruntfile.js
@@ -0,0 +1,127 @@
+'use strict';
+
+module.exports = function(grunt) {
+
+ // Project configuration.
+ grunt.initConfig({
+ pkg: grunt.file.readJSON('package.json'),
+ meta: {
+ banner: '/**\n' +
+ ' * <%= pkg.description %>\n' +
+ ' * @version v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
+ ' * @link <%= pkg.homepage %>\n' +
+ ' * @author <%= pkg.author %>\n' +
+ ' * @license MIT License, http://www.opensource.org/licenses/MIT\n' +
+ ' */\n'
+ },
+ build: {
+ dest: 'dist'
+ },
+ concat: {
+ options: {
+ banner: '<%= meta.banner %>'
+ },
+ build: {
+ files: {
+ '<%= build.dest %>/<%= pkg.name %>.js': ['src/common.js', 'src/directives/*.js']
+ }
+ }
+ },
+ uglify: {
+ options: {
+ banner: '<%= meta.banner %>'
+ },
+ build: {
+ files: {
+ '<%= build.dest %>/<%= pkg.name %>.min.js': ['<%= build.dest %>/<%= pkg.name %>.js']
+ }
+ }
+ },
+ jshint: {
+ files: ['Gruntfile.js', 'src/directives/*.js', 'test/unit/*.js'],
+ options: {
+ curly: true,
+ browser: true,
+ eqeqeq: true,
+ immed: true,
+ latedef: true,
+ newcap: true,
+ noarg: true,
+ sub: true,
+ undef: true,
+ boss: true,
+ eqnull: true,
+ expr: true,
+ node: true,
+ globals: {
+ exports: true,
+ angular: false,
+ $: false
+ }
+ }
+ },
+ // watch: {
+ // files: '<config:jshint.files>',
+ // tasks: 'default'
+ // },
+ testacular: {
+ options: {
+ configFile: 'test/testacular.conf.js',
+ browsers: ['PhantomJS'],
+ reporters: ['dots'],
+ singleRun: true
+ }
+ }
+ });
+
+ // Load the plugin that provides the "jshint" task.
+ grunt.loadNpmTasks('grunt-contrib-jshint');
+
+ // Load the plugin that provides the "concat" task.
+ grunt.loadNpmTasks('grunt-contrib-concat');
+
+ // Load the plugin that provides the "uglify" task.
+ grunt.loadNpmTasks('grunt-contrib-uglify');
+
+ // Load the plugin that provides the "watch" task.
+ //grunt.loadNpmTasks('grunt-contrib-watch');
+
+
+ // Default task.
+ grunt.registerTask('default', ['jshint', 'testacular']);
+
+ // Build task.
+ grunt.registerTask('build', ['jshint', 'testacular', 'concat', 'uglify']);
+
+
+ // Provides the "testacular" task.
+ grunt.registerTask('testacular', 'Starts up a testacular server.', function() {
+ var done = this.async();
+ require('testacular').server.start(this.options(), function(code) {
+ done(code === 0);
+ });
+ });
+
+ // Provides the "bump" task.
+ grunt.registerTask('bump', 'Increment version number', function() {
+ var versionType = grunt.option('type');
+ function bumpVersion(version, versionType) {
+ var type = {patch: 2, minor: 1, major: 0},
+ parts = version.split('.'),
+ idx = type[versionType || 'patch'];
+ parts[idx] = parseInt(parts[idx], 10) + 1;
+ while(++idx < parts.length) { parts[idx] = 0; }
+ return parts.join('.');
+ }
+ var version;
+ function updateFile(file) {
+ var json = grunt.file.readJSON(file);
+ version = json.version = bumpVersion(json.version, versionType || 'patch');
+ grunt.file.write(file, JSON.stringify(json, null, ' '));
+ }
+ updateFile('package.json');
+ updateFile('component.json');
+ grunt.log.ok('Version bumped to ' + version);
+ });
+
+};
View
5 dist/angular-strap.js
@@ -1,12 +1,11 @@
/**
* AngularStrap - Twitter Bootstrap directives for AngularJS
- * @version v0.6.6 - 2013-02-13
+ * @version v0.6.6 - 2013-02-23
* @link http://mgcrea.github.com/angular-strap
- * @author Olivier Louvignes
+ * @author Olivier Louvignes <olivier@mg-crea.com>
* @license MIT License, http://www.opensource.org/licenses/MIT
*/
-
angular.module('$strap.config', []).value('$strap.config', {});
angular.module('$strap.filters', ['$strap.config']);
angular.module('$strap.directives', ['$strap.config']);
View
6 dist/angular-strap.min.js
@@ -1,8 +1,8 @@
/**
* AngularStrap - Twitter Bootstrap directives for AngularJS
- * @version v0.6.6 - 2013-02-13
+ * @version v0.6.6 - 2013-02-23
* @link http://mgcrea.github.com/angular-strap
- * @author Olivier Louvignes
+ * @author Olivier Louvignes <olivier@mg-crea.com>
* @license MIT License, http://www.opensource.org/licenses/MIT
*/
-angular.module("$strap.config",[]).value("$strap.config",{}),angular.module("$strap.filters",["$strap.config"]),angular.module("$strap.directives",["$strap.config"]),angular.module("$strap",["$strap.filters","$strap.directives","$strap.config"]),angular.module("$strap.directives").directive("bsAlert",["$parse","$timeout","$compile",function(e,t,n){"use strict";return{restrict:"A",link:function(r,i,s){var o=e(s.bsAlert),u=o.assign,a=o(r);s.bsAlert?r.$watch(s.bsAlert,function(e,t){a=e,i.html((e.title?"<strong>"+e.title+"</strong>&nbsp;":"")+e.content||""),!e.closed||i.hide(),n(i.contents())(r);if(e.type||t.type)t.type&&i.removeClass("alert-"+t.type),e.type&&i.addClass("alert-"+e.type);(angular.isUndefined(s.closeButton)||s.closeButton!=="0"&&s.closeButton!=="false")&&i.prepend('<button type="button" class="close" data-dismiss="alert">&times;</button>')},!0):(angular.isUndefined(s.closeButton)||s.closeButton!=="0"&&s.closeButton!=="false")&&i.prepend('<button type="button" class="close" data-dismiss="alert">&times;</button>'),i.addClass("alert").alert(),i.hasClass("fade")&&(i.removeClass("in"),setTimeout(function(){i.addClass("in")}));var f=s.ngRepeat&&s.ngRepeat.split(" in ").pop();i.on("close",function(e){console.warn("close!");var t;f?(e.preventDefault(),i.removeClass("in"),console.warn(r.$parent),t=function(){i.trigger("closed"),r.$parent&&r.$parent.$apply(function(){r.$parent[f].splice(r.$index,1)})},$.support.transition&&i.hasClass("fade")?i.on($.support.transition.end,t):t()):a&&(e.preventDefault(),i.removeClass("in"),t=function(){i.trigger("closed"),r.$apply(function(){a.closed=!0})},$.support.transition&&i.hasClass("fade")?i.on($.support.transition.end,t):t())})}}}]),angular.module("$strap.directives").directive("bsButton",["$parse","$timeout",function(e,t){"use strict";return{restrict:"A",require:"?ngModel",link:function(n,r,i,s){if(s){r.parent('[data-toggle="buttons-checkbox"], [data-toggle="buttons-radio"]').length||r.attr("data-toggle","button");var o=!!n.$eval(i.ngModel);o&&r.addClass("active"),n.$watch(i.ngModel,function(e,t){var n=!!e,i=!!t;n!==i?$.fn.button.Constructor.prototype.toggle.call(u):n&&!o&&r.addClass("active")})}r.hasClass("btn")||r.on("click.button.data-api",function(e){r.button("toggle")}),r.button();var u=r.data("button");u.toggle=function(){if(!s)return $.fn.button.Constructor.prototype.toggle.call(this);var t=r.parent('[data-toggle="buttons-radio"]');t.length?(r.siblings("[ng-model]").each(function(t,r){e($(r).attr("ng-model")).assign(n,!1)}),n.$digest(),s.$modelValue||(s.$setViewValue(!s.$modelValue),n.$digest())):n.$apply(function(){s.$setViewValue(!s.$modelValue)})}}}}]).directive("bsButtonsCheckbox",["$parse",function(e){"use strict";return{restrict:"A",require:"?ngModel",compile:function(t,n,r){t.attr("data-toggle","buttons-checkbox").find("a, button").each(function(e,t){$(t).attr("bs-button","")})}}}]).directive("bsButtonsRadio",["$parse",function(e){"use strict";return{restrict:"A",require:"?ngModel",compile:function(t,n,r){return t.attr("data-toggle","buttons-radio"),n.ngModel||t.find("a, button").each(function(e,t){$(t).attr("bs-button","")}),function(t,n,r,i){i&&(n.find("[value]").button().filter('[value="'+t.$eval(r.ngModel)+'"]').addClass("active"),n.on("click.button.data-api",function(e){t.$apply(function(){i.$setViewValue($(e.target).closest("button").attr("value"))})}),t.$watch(r.ngModel,function(e,i){if(e!==i){var s=n.find('[value="'+t.$eval(r.ngModel)+'"]');s.length&&$.fn.button.Constructor.prototype.toggle.call(s.data("button"))}}))}}}}]),angular.module("$strap.directives").directive("bsButtonSelect",["$parse","$timeout",function(e,t){"use strict";var n="ontouchstart"in window;return{restrict:"A",require:"?ngModel",link:function(r,i,s,o){var u=e(s.bsButtonSelect),a=u.assign;o&&(i.text(r.$eval(s.ngModel)),r.$watch(s.ngModel,function(e,t){i.text(e)}));var f,l,c,h;i.on(n?"touchstart.bsButtonSelect.data-api":"click.bsButtonSelect.data-api",function(e){f=u(r),l=o?r.$eval(s.ngModel):i.text(),c=f.indexOf(l),h=c>f.length-2?f[0]:f[c+1],r.$apply(function(){i.text(h),o&&o.$setViewValue(h)})})}}}]),angular.module("$strap.directives").directive("bsDatepicker",["$timeout",function(e){"use strict";var t="ontouchstart"in window&&!window.navigator.userAgent.match(/PhantomJS/i),n={"/":"[\\/]","-":"[-]",".":"[.]",dd:"(?:(?:[0-2]?[0-9]{1})|(?:[3][01]{1}))",d:"(?:(?:[0-2]?[0-9]{1})|(?:[3][01]{1}))",mm:"(?:[0]?[1-9]|[1][012])",m:"(?:[0]?[1-9]|[1][012])",yyyy:"(?:(?:[1]{1}[0-9]{1}[0-9]{1}[0-9]{1})|(?:[2]{1}[0-9]{3}))(?![[0-9]])",yy:"(?:(?:[0-9]{1}[0-9]{1}))(?![[0-9]])"};return{restrict:"A",require:"?ngModel",link:function(r,i,s,o){var u=function(e,t){t||(t={});var r=e,i=n;return angular.forEach(i,function(e,t){r=r.split(t).join(e)}),new RegExp("^"+r+"$",["i"])},a=t?"yyyy/mm/dd":u(s.dateFormat||"mm/dd/yyyy");o&&o.$parsers.unshift(function(e){return!e||a.test(e)?(o.$setValidity("date",!0),e):(o.$setValidity("date",!1),undefined)});var f=i.next('[data-toggle="datepicker"]');f.length&&f.on("click",function(){t?i.trigger("focus"):i.datepicker("show")});if(t&&i.prop("type")==="text")i.prop("type","date"),i.on("change",function(e){r.$apply(function(){o.$setViewValue(i.val())})});else{o&&i.on("changeDate",function(e){r.$apply(function(){o.$setViewValue(i.val())})});var l=i.closest(".popover");l&&l.on("hide",function(e){var t=i.data("datepicker");t&&(t.picker.remove(),i.data("datepicker",null))}),i.attr("data-toggle","datepicker"),i.datepicker({autoclose:!0,language:s.language||"en"})}}}}]),angular.module("$strap.directives").directive("bsDropdown",["$parse","$compile",function(e,t){"use strict";var n=Array.prototype.slice,r='<ul class="dropdown-menu" role="menu" aria-labelledby="drop1"><li ng-repeat="item in items" ng-class="{divider: !!item.divider, \'dropdown-submenu\': !!item.submenu && item.submenu.length}"><a ng-hide="!!item.divider" tabindex="-1" ng-href="{{item.href}}" ng-click="{{item.click}}" target="{{item.target}}" ng-bind-html-unsafe="item.text"></a></li></ul>',i=function(e,n,i){var o,u,a;for(var f=0,l=e.length;f<l;f++)if(o=e[f].submenu)a=i.$new(),a.items=o,u=t(r)(a),u=u.appendTo(n.children("li:nth-child("+(f+1)+")")),s(o,u,a)},s=function(){var e=n.call(arguments);setTimeout(function(){i.apply(null,e)})};return{restrict:"EA",scope:!0,link:function(i,o,u){var a=e(u.bsDropdown);i.items=a(i);var f=t(r)(i);s(i.items,f,i),f.insertAfter(o),o.addClass("dropdown-toggle").attr("data-toggle","dropdown")}}}]),angular.module("$strap.directives").directive("bsModal",["$parse","$compile","$http","$timeout","$q","$templateCache",function(e,t,n,r,i,s){"use strict";return{restrict:"A",scope:!0,link:function(u,a,f,l){var c=e(f.bsModal),h=c.assign,p=c(u);i.when(s.get(p)||n.get(p,{cache:!0})).then(function(n){angular.isObject(n)&&(n=n.data);var i=c(u).replace(".html","").replace(/\//g,"-").replace(/\./g,"-")+"-"+u.$id,s=$('<div class="modal hide" tabindex="-1"></div>').attr("id",i).attr("data-backdrop",f.backdrop||!0).attr("data-keyboard",f.keyboard||!0).addClass(f.modalClass?"fade "+f.modalClass:"fade").html(n);$("body").append(s),a.attr("href","#"+i).attr("data-toggle","modal"),r(function(){t(s)(u)}),u._modal=function(e){s.modal(e)},u.hide=function(){s.modal("hide")},u.show=function(){s.modal("show")},u.dismiss=u.hide})}}}]),angular.module("$strap.directives").directive("bsNavbar",["$location",function(e){"use strict";return{restrict:"A",link:function(n,r,i,s){n.$watch(function(){return e.path()},function(e,t){r.find("li[data-match-route]").each(function(t,n){var r=angular.element(n),i=r.attr("data-match-route"),s=new RegExp("^"+i+"$",["i"]);s.test(e)?r.addClass("active"):r.removeClass("active")})})}}}]),angular.module("$strap.directives").directive("bsPopover",["$parse","$compile","$http","$timeout","$q","$templateCache",function(e,t,n,r,i,s){"use strict";return $("body").on("keyup",function(e){e.keyCode===27&&$(".popover.in").each(function(){$(this).popover("hide")})}),{restrict:"A",scope:!0,link:function(o,u,a,f){var l=e(a.bsPopover),c=l.assign,h=l(o),p={};angular.isObject(h)&&(p=h),i.when(p.content||s.get(h)||n.get(h,{cache:!0})).then(function(n){angular.isObject(n)&&(n=n.data),!a.unique||u.on("show",function(e){$(".popover.in").each(function(){var e=$(this),t=e.data("popover");t&&!t.$element.is(u)&&e.popover("hide")})}),!a.hide||o.$watch(a.hide,function(e,t){e?r.hide():e!==t&&r.show()}),u.popover(angular.extend({},p,{content:n,html:!0}));var r=u.data("popover");r.hasContent=function(){return this.getTitle()||n},r.getPosition=function(){var e=$.fn.popover.Constructor.prototype.getPosition.apply(this,arguments);return t(this.$tip)(o),o.$digest(),this.$tip.data("popover",this),e},o._popover=function(e){u.popover(e)},o.hide=function(){u.popover("hide")},o.show=function(){u.popover("show")},o.dismiss=o.hide})}}}]),angular.module("$strap.directives").directive("bsTimepicker",["$timeout",function(e){"use strict";var t="((?:(?:[0-1][0-9])|(?:[2][0-3])|(?:[0-9])):(?:[0-5][0-9])(?::[0-5][0-9])?(?:\\s?(?:am|AM|pm|PM))?)";return{restrict:"A",require:"?ngModel",link:function(n,r,i,s){s&&r.on("change",function(e){n.$apply(function(){s.$setViewValue(r.val())})});var o=new RegExp("^"+t+"$",["i"]);s.$parsers.unshift(function(e){return!e||o.test(e)?(s.$setValidity("time",!0),e):(s.$setValidity("time",!1),undefined)});var u=r.closest(".popover");u&&u.on("hide",function(e){var t=r.data("timepicker");t&&(t.$widget.remove(),r.data("timepicker",null))}),r.attr("data-toggle","timepicker"),r.timepicker()}}}]),angular.module("$strap.directives").directive("bsTooltip",["$parse","$compile",function(e,t){"use strict";return{restrict:"A",scope:!0,link:function(n,r,i,s){var o=e(i.bsTooltip),u=o.assign,a=o(n);n.$watch(i.bsTooltip,function(e,t){e!==t&&(a=e)}),!i.unique||r.on("show",function(e){$(".tooltip.in").each(function(){var e=$(this),t=e.data("tooltip");t&&!t.$element.is(r)&&e.tooltip("hide")})}),r.tooltip({title:function(){return angular.isFunction(a)?a.apply(null,arguments):a},html:!0});var f=r.data("tooltip");f.show=function(){var e=$.Event("show");this.$element.trigger(e);if(e.isDefaultPrevented())return;var t=$.fn.tooltip.Constructor.prototype.show.apply(this,arguments);return this.tip().data("tooltip",this),t},f.hide=function(){var e=$.Event("hide");this.$element.trigger(e);if(e.isDefaultPrevented())return;return $.fn.tooltip.Constructor.prototype.hide.apply(this,arguments)},n._tooltip=function(e){r.tooltip(e)},n.hide=function(){r.tooltip("hide")},n.show=function(){r.tooltip("show")},n.dismiss=n.hide}}}]),angular.module("$strap.directives").directive("bsTypeahead",["$parse",function(e){"use strict";return{restrict:"A",require:"?ngModel",link:function(n,r,i,s){var o=e(i.bsTypeahead),u=o.assign,a=o(n);n.$watch(i.bsTypeahead,function(e,t){e!==t&&(a=e)}),r.attr("data-provide","typeahead"),r.typeahead({source:function(e){return angular.isFunction(a)?a.apply(null,arguments):a},minLength:i.minLength||1,items:i.items,updater:function(e){return s&&n.$apply(function(){s.$setViewValue(e)}),e}});var f=r.data("typeahead");f.lookup=function(e){var t;return this.query=this.$element.val()||"",this.query.length<this.options.minLength?this.shown?this.hide():this:(t=$.isFunction(this.source)?this.source(this.query,$.proxy(this.process,this)):this.source,t?this.process(t):this)},i.minLength==="0"&&setTimeout(function(){r.on("focus",function(){setTimeout(r.typeahead.bind(r,"lookup"),200)})})}}}]);
+angular.module("$strap.config",[]).value("$strap.config",{}),angular.module("$strap.filters",["$strap.config"]),angular.module("$strap.directives",["$strap.config"]),angular.module("$strap",["$strap.filters","$strap.directives","$strap.config"]),angular.module("$strap.directives").directive("bsAlert",["$parse","$timeout","$compile",function(t,e,n){"use strict";return{restrict:"A",link:function(e,i,o){var a=t(o.bsAlert),r=(a.assign,a(e));o.bsAlert?e.$watch(o.bsAlert,function(t,a){r=t,i.html((t.title?"<strong>"+t.title+"</strong>&nbsp;":"")+t.content||""),t.closed&&i.hide(),n(i.contents())(e),(t.type||a.type)&&(a.type&&i.removeClass("alert-"+a.type),t.type&&i.addClass("alert-"+t.type)),(angular.isUndefined(o.closeButton)||"0"!==o.closeButton&&"false"!==o.closeButton)&&i.prepend('<button type="button" class="close" data-dismiss="alert">&times;</button>')},!0):(angular.isUndefined(o.closeButton)||"0"!==o.closeButton&&"false"!==o.closeButton)&&i.prepend('<button type="button" class="close" data-dismiss="alert">&times;</button>'),i.addClass("alert").alert(),i.hasClass("fade")&&(i.removeClass("in"),setTimeout(function(){i.addClass("in")}));var s=o.ngRepeat&&o.ngRepeat.split(" in ").pop();i.on("close",function(t){console.warn("close!");var n;s?(t.preventDefault(),i.removeClass("in"),console.warn(e.$parent),n=function(){i.trigger("closed"),e.$parent&&e.$parent.$apply(function(){e.$parent[s].splice(e.$index,1)})},$.support.transition&&i.hasClass("fade")?i.on($.support.transition.end,n):n()):r&&(t.preventDefault(),i.removeClass("in"),n=function(){i.trigger("closed"),e.$apply(function(){r.closed=!0})},$.support.transition&&i.hasClass("fade")?i.on($.support.transition.end,n):n())})}}}]),angular.module("$strap.directives").directive("bsButton",["$parse","$timeout",function(t){"use strict";return{restrict:"A",require:"?ngModel",link:function(e,n,i,o){if(o){n.parent('[data-toggle="buttons-checkbox"], [data-toggle="buttons-radio"]').length||n.attr("data-toggle","button");var a=!!e.$eval(i.ngModel);a&&n.addClass("active"),e.$watch(i.ngModel,function(t,e){var i=!!t,o=!!e;i!==o?$.fn.button.Constructor.prototype.toggle.call(r):i&&!a&&n.addClass("active")})}n.hasClass("btn")||n.on("click.button.data-api",function(){n.button("toggle")}),n.button();var r=n.data("button");r.toggle=function(){if(!o)return $.fn.button.Constructor.prototype.toggle.call(this);var i=n.parent('[data-toggle="buttons-radio"]');i.length?(n.siblings("[ng-model]").each(function(n,i){t($(i).attr("ng-model")).assign(e,!1)}),e.$digest(),o.$modelValue||(o.$setViewValue(!o.$modelValue),e.$digest())):e.$apply(function(){o.$setViewValue(!o.$modelValue)})}}}}]).directive("bsButtonsCheckbox",["$parse",function(){"use strict";return{restrict:"A",require:"?ngModel",compile:function(t){t.attr("data-toggle","buttons-checkbox").find("a, button").each(function(t,e){$(e).attr("bs-button","")})}}}]).directive("bsButtonsRadio",["$parse",function(){"use strict";return{restrict:"A",require:"?ngModel",compile:function(t,e){return t.attr("data-toggle","buttons-radio"),e.ngModel||t.find("a, button").each(function(t,e){$(e).attr("bs-button","")}),function(t,e,n,i){i&&(e.find("[value]").button().filter('[value="'+t.$eval(n.ngModel)+'"]').addClass("active"),e.on("click.button.data-api",function(e){t.$apply(function(){i.$setViewValue($(e.target).closest("button").attr("value"))})}),t.$watch(n.ngModel,function(i,o){if(i!==o){var a=e.find('[value="'+t.$eval(n.ngModel)+'"]');a.length&&$.fn.button.Constructor.prototype.toggle.call(a.data("button"))}}))}}}}]),angular.module("$strap.directives").directive("bsButtonSelect",["$parse","$timeout",function(t){"use strict";var e="ontouchstart"in window;return{restrict:"A",require:"?ngModel",link:function(n,i,o,a){var r=t(o.bsButtonSelect);r.assign,a&&(i.text(n.$eval(o.ngModel)),n.$watch(o.ngModel,function(t){i.text(t)}));var s,u,l,c;i.on(e?"touchstart.bsButtonSelect.data-api":"click.bsButtonSelect.data-api",function(){s=r(n),u=a?n.$eval(o.ngModel):i.text(),l=s.indexOf(u),c=l>s.length-2?s[0]:s[l+1],n.$apply(function(){i.text(c),a&&a.$setViewValue(c)})})}}}]),angular.module("$strap.directives").directive("bsDatepicker",["$timeout",function(){"use strict";var t="ontouchstart"in window&&!window.navigator.userAgent.match(/PhantomJS/i),e={"/":"[\\/]","-":"[-]",".":"[.]",dd:"(?:(?:[0-2]?[0-9]{1})|(?:[3][01]{1}))",d:"(?:(?:[0-2]?[0-9]{1})|(?:[3][01]{1}))",mm:"(?:[0]?[1-9]|[1][012])",m:"(?:[0]?[1-9]|[1][012])",yyyy:"(?:(?:[1]{1}[0-9]{1}[0-9]{1}[0-9]{1})|(?:[2]{1}[0-9]{3}))(?![[0-9]])",yy:"(?:(?:[0-9]{1}[0-9]{1}))(?![[0-9]])"};return{restrict:"A",require:"?ngModel",link:function(n,i,o,a){var r=function(t,n){n||(n={});var i=t,o=e;return angular.forEach(o,function(t,e){i=i.split(e).join(t)}),RegExp("^"+i+"$",["i"])},s=t?"yyyy/mm/dd":r(o.dateFormat||"mm/dd/yyyy");a&&a.$parsers.unshift(function(t){return!t||s.test(t)?(a.$setValidity("date",!0),t):(a.$setValidity("date",!1),void 0)});var u=i.next('[data-toggle="datepicker"]');if(u.length&&u.on("click",function(){t?i.trigger("focus"):i.datepicker("show")}),t&&"text"===i.prop("type"))i.prop("type","date"),i.on("change",function(){n.$apply(function(){a.$setViewValue(i.val())})});else{a&&i.on("changeDate",function(){n.$apply(function(){a.$setViewValue(i.val())})});var l=i.closest(".popover");l&&l.on("hide",function(){var t=i.data("datepicker");t&&(t.picker.remove(),i.data("datepicker",null))}),i.attr("data-toggle","datepicker"),i.datepicker({autoclose:!0,language:o.language||"en"})}}}}]),angular.module("$strap.directives").directive("bsDropdown",["$parse","$compile",function(t,e){"use strict";var n=Array.prototype.slice,i='<ul class="dropdown-menu" role="menu" aria-labelledby="drop1"><li ng-repeat="item in items" ng-class="{divider: !!item.divider, \'dropdown-submenu\': !!item.submenu && item.submenu.length}"><a ng-hide="!!item.divider" tabindex="-1" ng-href="{{item.href}}" ng-click="{{item.click}}" target="{{item.target}}" ng-bind-html-unsafe="item.text"></a></li></ul>',o=function(t,n,o){for(var r,s,u,l=0,c=t.length;c>l;l++)(r=t[l].submenu)&&(u=o.$new(),u.items=r,s=e(i)(u),s=s.appendTo(n.children("li:nth-child("+(l+1)+")")),a(r,s,u))},a=function(){var t=n.call(arguments);setTimeout(function(){o.apply(null,t)})};return{restrict:"EA",scope:!0,link:function(n,o,r){var s=t(r.bsDropdown);n.items=s(n);var u=e(i)(n);a(n.items,u,n),u.insertAfter(o),o.addClass("dropdown-toggle").attr("data-toggle","dropdown")}}}]),angular.module("$strap.directives").directive("bsModal",["$parse","$compile","$http","$timeout","$q","$templateCache",function(t,e,n,i,o,a){"use strict";return{restrict:"A",scope:!0,link:function(r,s,u){var l=t(u.bsModal),c=(l.assign,l(r));o.when(a.get(c)||n.get(c,{cache:!0})).then(function(t){angular.isObject(t)&&(t=t.data);var n=l(r).replace(".html","").replace(/\//g,"-").replace(/\./g,"-")+"-"+r.$id,o=$('<div class="modal hide" tabindex="-1"></div>').attr("id",n).attr("data-backdrop",u.backdrop||!0).attr("data-keyboard",u.keyboard||!0).addClass(u.modalClass?"fade "+u.modalClass:"fade").html(t);$("body").append(o),s.attr("href","#"+n).attr("data-toggle","modal"),i(function(){e(o)(r)}),r._modal=function(t){o.modal(t)},r.hide=function(){o.modal("hide")},r.show=function(){o.modal("show")},r.dismiss=r.hide})}}}]),angular.module("$strap.directives").directive("bsNavbar",["$location",function(t){"use strict";return{restrict:"A",link:function(e,n){e.$watch(function(){return t.path()},function(t){n.find("li[data-match-route]").each(function(e,n){var i=angular.element(n),o=i.attr("data-match-route"),a=RegExp("^"+o+"$",["i"]);a.test(t)?i.addClass("active"):i.removeClass("active")})})}}}]),angular.module("$strap.directives").directive("bsPopover",["$parse","$compile","$http","$timeout","$q","$templateCache",function(t,e,n,i,o,a){"use strict";return $("body").on("keyup",function(t){27===t.keyCode&&$(".popover.in").each(function(){$(this).popover("hide")})}),{restrict:"A",scope:!0,link:function(i,r,s){var u=t(s.bsPopover),l=(u.assign,u(i)),c={};angular.isObject(l)&&(c=l),o.when(c.content||a.get(l)||n.get(l,{cache:!0})).then(function(t){angular.isObject(t)&&(t=t.data),s.unique&&r.on("show",function(){$(".popover.in").each(function(){var t=$(this),e=t.data("popover");e&&!e.$element.is(r)&&t.popover("hide")})}),s.hide&&i.$watch(s.hide,function(t,e){t?n.hide():t!==e&&n.show()}),r.popover(angular.extend({},c,{content:t,html:!0}));var n=r.data("popover");n.hasContent=function(){return this.getTitle()||t},n.getPosition=function(){var t=$.fn.popover.Constructor.prototype.getPosition.apply(this,arguments);return e(this.$tip)(i),i.$digest(),this.$tip.data("popover",this),t},i._popover=function(t){r.popover(t)},i.hide=function(){r.popover("hide")},i.show=function(){r.popover("show")},i.dismiss=i.hide})}}}]),angular.module("$strap.directives").directive("bsTimepicker",["$timeout",function(){"use strict";var t="((?:(?:[0-1][0-9])|(?:[2][0-3])|(?:[0-9])):(?:[0-5][0-9])(?::[0-5][0-9])?(?:\\s?(?:am|AM|pm|PM))?)";return{restrict:"A",require:"?ngModel",link:function(e,n,i,o){o&&n.on("change",function(){e.$apply(function(){o.$setViewValue(n.val())})});var a=RegExp("^"+t+"$",["i"]);o.$parsers.unshift(function(t){return!t||a.test(t)?(o.$setValidity("time",!0),t):(o.$setValidity("time",!1),void 0)});var r=n.closest(".popover");r&&r.on("hide",function(){var t=n.data("timepicker");t&&(t.$widget.remove(),n.data("timepicker",null))}),n.attr("data-toggle","timepicker"),n.timepicker()}}}]),angular.module("$strap.directives").directive("bsTooltip",["$parse","$compile",function(t){"use strict";return{restrict:"A",scope:!0,link:function(e,n,i){var o=t(i.bsTooltip),a=(o.assign,o(e));e.$watch(i.bsTooltip,function(t,e){t!==e&&(a=t)}),i.unique&&n.on("show",function(){$(".tooltip.in").each(function(){var t=$(this),e=t.data("tooltip");e&&!e.$element.is(n)&&t.tooltip("hide")})}),n.tooltip({title:function(){return angular.isFunction(a)?a.apply(null,arguments):a},html:!0});var r=n.data("tooltip");r.show=function(){var t=$.Event("show");if(this.$element.trigger(t),!t.isDefaultPrevented()){var e=$.fn.tooltip.Constructor.prototype.show.apply(this,arguments);return this.tip().data("tooltip",this),e}},r.hide=function(){var t=$.Event("hide");return this.$element.trigger(t),t.isDefaultPrevented()?void 0:$.fn.tooltip.Constructor.prototype.hide.apply(this,arguments)},e._tooltip=function(t){n.tooltip(t)},e.hide=function(){n.tooltip("hide")},e.show=function(){n.tooltip("show")},e.dismiss=e.hide}}}]),angular.module("$strap.directives").directive("bsTypeahead",["$parse",function(t){"use strict";return{restrict:"A",require:"?ngModel",link:function(e,n,i,o){var a=t(i.bsTypeahead),r=(a.assign,a(e));e.$watch(i.bsTypeahead,function(t,e){t!==e&&(r=t)}),n.attr("data-provide","typeahead"),n.typeahead({source:function(){return angular.isFunction(r)?r.apply(null,arguments):r},minLength:i.minLength||1,items:i.items,updater:function(t){return o&&e.$apply(function(){o.$setViewValue(t)}),t}});var s=n.data("typeahead");s.lookup=function(){var t;return this.query=this.$element.val()||"",this.query.length<this.options.minLength?this.shown?this.hide():this:(t=$.isFunction(this.source)?this.source(this.query,$.proxy(this.process,this)):this.source,t?this.process(t):this)},"0"===i.minLength&&setTimeout(function(){n.on("focus",function(){setTimeout(n.typeahead.bind(n,"lookup"),200)})})}}}]);
View
104 grunt.js
@@ -1,104 +0,0 @@
-'use strict';
-
-module.exports = function(grunt) {
-
- // Project configuration.
- grunt.initConfig({
- pkg: '<json:package.json>',
- meta: {
- banner: '/**\n' + ' * <%= pkg.description %>\n' +
- ' * @version v<%= pkg.version %> - ' +
- '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
- ' * @link <%= pkg.homepage %>\n' +
- ' * @author <%= pkg.author %>\n' +
- ' * @license MIT License, http://www.opensource.org/licenses/MIT\n' + ' */'
- },
- lint: {
- files: ['grunt.js', 'src/directives/*.js', 'test/unit/*.js']
- },
- builddir: 'dist',
- concat: {
- build: {
- src: ['<banner:meta.banner>', 'src/common.js', 'src/directives/*.js'],
- dest: '<%= builddir %>/<%= pkg.name %>.js'
- }
- },
- min: {
- build: {
- src: ['<banner:meta.banner>', '<config:concat.build.dest>'],
- dest: '<%= builddir %>/<%= pkg.name %>.min.js'
- }
- },
- watch: {
- files: '<config:lint.files>',
- tasks: 'default'
- },
- jshint: {
- options: {
- curly: true,
- browser: true,
- eqeqeq: true,
- immed: true,
- latedef: true,
- newcap: true,
- noarg: true,
- sub: true,
- undef: true,
- boss: true,
- eqnull: true,
- expr: true,
- node: true
- },
- globals: {
- exports: true,
- angular: false,
- $: false
- }
- }
- });
-
- // Default task.
- grunt.registerTask('default', 'lint test');
-
- // Build task.
- grunt.registerTask('build', 'lint test concat min');
-
- // Test task.
- grunt.registerTask('test', 'run tests', function () {
- var done = this.async();
- grunt.utils.spawn({
- cmd: process.platform === 'win32' ? 'testacular.cmd' : 'testacular',
- args: process.env.TRAVIS ? ['start', 'test/testacular.conf.js', '--single-run', '--no-auto-watch', '--reporters=dots', '--browsers=PhantomJS'] : ['start', 'test/testacular.conf.js', '--single-run', '--no-auto-watch', '--browsers=PhantomJS']
- }, function (error, result, code) {
- if (error) {
- grunt.warn(error.stdout + error.stderr);
- setTimeout(done, 1000);
- } else {
- grunt.log.write(result.stdout);
- done();
- }
- });
- });
-
- grunt.registerTask('bump', 'Increment version number', function() {
- var versionType = grunt.option('type');
- function bumpVersion(version, versionType) {
- var type = {patch: 2, minor: 1, major: 0},
- parts = version.split('.'),
- idx = type[versionType || 'patch'];
- parts[idx] = parseInt(parts[idx], 10) + 1;
- while(++idx < parts.length) { parts[idx] = 0; }
- return parts.join('.');
- }
- var version;
- function updateFile(file) {
- var json = grunt.file.readJSON(file);
- version = json.version = bumpVersion(json.version, versionType || 'patch');
- grunt.file.write(file, JSON.stringify(json, null, ' '));
- }
- updateFile('package.json');
- updateFile('component.json');
- grunt.log.ok('Version bumped to ' + version);
- });
-
-};
View
12 package.json
@@ -1,9 +1,9 @@
{
- "author": "Olivier Louvignes",
"name": "angular-strap",
"description": "AngularStrap - Twitter Bootstrap directives for AngularJS",
"version": "0.6.6",
"homepage": "http://mgcrea.github.com/angular-strap",
+ "author": "Olivier Louvignes <olivier@mg-crea.com>",
"repository": {
"type": "git",
"url": "git://github.com/angular-strap/angular-strap.git"
@@ -13,11 +13,15 @@
},
"dependencies": {},
"devDependencies": {
- "testacular": ">= 0.4.0",
- "grunt": ">= 0.3.17"
+ "testacular": ">= 0.6.0",
+ "grunt": ">= 0.4.0",
+ "grunt-contrib-concat": "*",
+ "grunt-contrib-jshint": "*",
+ "grunt-contrib-uglify": "*",
+ "grunt-testacular": "~0.3.0"
},
"scripts": {
"test": "testacular start test/testacular.conf.js --single-run --browsers PhantomJS",
"test-server": "testacular start test/testacular.conf.js --browsers PhantomJS"
}
-}
+}

0 comments on commit 06599ae

Please sign in to comment.
Something went wrong with that request. Please try again.