Added zeptojs and enter directive

This commit is contained in:
Fergal Moran
2014-04-17 23:10:41 +01:00
parent 7a752c6c37
commit 575dfd8438
8 changed files with 3447 additions and 2 deletions

3
.gitignore vendored
View File

@@ -1,4 +1,5 @@
db.sqlite3
.idea
*.pyc
shortio/localsettings.py
shortio/localsettings.py
CACHE

1739
static/css/font-awesome.css vendored Normal file

File diff suppressed because it is too large Load Diff

24
static/css/site.css Normal file
View File

@@ -0,0 +1,24 @@
body {
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
.navbar-wrapper {
position: absolute;
top: 0;
left: 0;
right: 0;
z-index: 10;
}
.navbar-wrapper {
margin-top: 20px;
margin-bottom: -90px; /* Negative margin to pull up carousel. 90px is roughly margins and height of navbar. */
}
/* The navbar becomes detached from the top, so we round the corners */
.navbar-wrapper .navbar {
border-radius: 4px;
}

View File

@@ -20,4 +20,5 @@ angular.module('shortioApp')
$scope.error = "Not a valid url";
}
};
$('#url').focus();
});

View File

@@ -0,0 +1,13 @@
angular.module('shortioApp')
.directive('ngEnter', function () {
return function (scope, element, attrs) {
element.bind("keydown keypress", function (event) {
if (event.which === 13) {
scope.$apply(function () {
scope.$eval(attrs.ngEnter);
});
event.preventDefault();
}
});
};
});

View File

@@ -1,5 +1,6 @@
<div ng-controller="UrlCtrl" class="login-popup">
<input type="text" class="form-control text-center text" id="" placeholder="URL to shorten" ng-model="url">
<input type="text" class="form-control text-center text" id="url" placeholder="URL to shorten"
ng-enter="shortenUrl()" ng-model="url">
<button type="submit" class="btn btn-default submit" ng-click="shortenUrl()">Do It</button>
<div class="alert alert-success" ng-show="shortened_url.length">
<a ng-href="{{shortened_url}}" ng-bind="shortened_url"></a>

1664
static/js/zepto.js Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -54,9 +54,11 @@
<script src="{% static "js/underscore/underscore.js" %}"></script>
<script src="{% static "js/angular/angular.min.js" %}"></script>
<script src="{% static "js/angular/angular-resource.min.js" %}"></script>
<script src="{% static "js/zepto.js" %}"></script>
<script src="{% static "js/script.js" %}"></script>
<script src="{% static "js/app/app.js" %}"></script>
<script src="{% static "js/app/directives/enter.js" %}"></script>
<script src="{% static "js/app/controllers/url.js" %}"></script>
<script src="{% static "js/app/services/url.js" %}"></script>
{% endcompress %}