From c32169f8892bd6f3396ca8872e4468cc1507310e Mon Sep 17 00:00:00 2001 From: Jaime Pillora Date: Sat, 18 Jan 2014 20:59:43 +1100 Subject: [PATCH] updated --- docs/js/app.js | 10 ++++++---- docs/src/scripts/build-tool.coffee | 17 ++++++++--------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/docs/js/app.js b/docs/js/app.js index c566d91..a5d1a7d 100644 --- a/docs/js/app.js +++ b/docs/js/app.js @@ -737,7 +737,7 @@ PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\ App = window.App = App || {}; - window.BuildController = function($scope) { + window.BuildController = function($scope, $timeout) { var elem, getStyleName; $scope.premadeStyles = [ { @@ -766,7 +766,6 @@ PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\ premade: premade }); }; - $scope.addStyle($(".happyblue-example").text()); $scope.settings = { minify: false, "default": $scope.styles[0] @@ -777,6 +776,7 @@ PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\ if (!style) { return; } + $scope.premadeStyle = null; baseUrl = "dist/styles/" + style.name + "/notify-" + style.name; $.ajax({ url: "" + baseUrl + ".js", @@ -799,6 +799,8 @@ PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\ } }); }; + $scope.premadeStyle = $scope.premadeStyles[0]; + $scope.loadStyle; $scope.toggle = function() { $(".build-tool-toggle").toggleClass('active'); return $(".build-tool").toggle(400); @@ -825,7 +827,7 @@ PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\ return m[1]; }; $scope.test = function(event, style, global) { - var className, classes, code, contentText, e, name, notifyStyle, obj, rand, testBtn; + var className, classes, code, contentText, e, name, notifyStyle, obj, rand, testBtn, _ref; testBtn = $(event.target); contentText = testBtn.parent().parent().find('.code'); code = style.code; @@ -856,7 +858,7 @@ PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\ rand = Math.floor(Math.random() * classes.length); className = classes[rand]; obj = className === 'base' ? 'no class' : "'" + className + "'"; - if (style.premade) { + if ((_ref = style.premade) != null ? _ref.test : void 0) { obj = style.premade.test(obj); } try { diff --git a/docs/src/scripts/build-tool.coffee b/docs/src/scripts/build-tool.coffee index 3f01c9c..6ee4d0a 100644 --- a/docs/src/scripts/build-tool.coffee +++ b/docs/src/scripts/build-tool.coffee @@ -1,7 +1,7 @@ App = window.App = App or {} -window.BuildController = ($scope) -> +window.BuildController = ($scope,$timeout) -> $scope.premadeStyles = [ { @@ -19,30 +19,25 @@ window.BuildController = ($scope) -> } ] + $(".build-tool-loading").hide() $(".build-tool-toggle").show() App.buildTool = $scope $scope.styles = [] - $scope.addStyle = (code, premade) -> $scope.styles.push { active: true, code, premade:premade } - #use one of the examples - $scope.addStyle $(".happyblue-example").text() - $scope.settings = { minify: false default: $scope.styles[0] } $scope.loadStyle = -> - style = $scope.premadeStyle - return unless style - + $scope.premadeStyle = null baseUrl = "dist/styles/#{style.name}/notify-#{style.name}" $.ajax @@ -62,6 +57,10 @@ window.BuildController = ($scope) -> $scope.$digest() return + #load bootstrap + $scope.premadeStyle = $scope.premadeStyles[0] + $scope.loadStyle + #angular has loaded $scope.toggle = -> $(".build-tool-toggle").toggleClass('active') @@ -123,7 +122,7 @@ window.BuildController = ($scope) -> obj = if className is 'base' then 'no class' else "'#{className}'" - if style.premade + if style.premade?.test obj = style.premade.test obj try