mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
fetch feed name
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
<div class="control-group" ng-class="{error : !subscribeForm.url.$valid}">
|
||||
<label class="control-label">Feed URL</label>
|
||||
<div class="controls">
|
||||
<input type="text" name="url" ng-model="sub.url" placeholder="http://example.com/feed" class="input-block-level" required></input>
|
||||
<input type="text" name="url" ng-model="sub.url" ng-blur="urlChanged()" placeholder="http://example.com/feed" class="input-block-level" required></input>
|
||||
<span class="help-block" ng-show="!subscribeForm.url.$valid">Required</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
var module = angular.module('commafeed.directives', []);
|
||||
|
||||
app.directive('ngBlur', function() {
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function(scope, elm, attrs) {
|
||||
elm.bind('blur', function() {
|
||||
scope.$apply(attrs.ngBlur);
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
module.directive('scrollTo', function() {
|
||||
return {
|
||||
restrict : 'A',
|
||||
@@ -46,6 +57,19 @@ module.directive('subscribe', function(SubscriptionService) {
|
||||
$scope.close = function() {
|
||||
$scope.isOpen = false;
|
||||
};
|
||||
|
||||
|
||||
$scope.urlChanged = function() {
|
||||
if ($scope.sub.url && !$scope.sub.title) {
|
||||
$scope.sub.title = 'Loading';
|
||||
SubscriptionService.fetch({
|
||||
url : $scope.sub.url
|
||||
}, function(data) {
|
||||
console.log(data)
|
||||
$scope.sub.title = data.title;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.save = function() {
|
||||
SubscriptionService.subscribe($scope.sub);
|
||||
|
||||
@@ -21,6 +21,12 @@ module.factory('SubscriptionService', [
|
||||
return array;
|
||||
}
|
||||
var actions = {
|
||||
fetch : {
|
||||
method : 'GET',
|
||||
params : {
|
||||
_method : 'fetch'
|
||||
}
|
||||
},
|
||||
get : {
|
||||
method : 'GET',
|
||||
params : {
|
||||
@@ -58,6 +64,7 @@ module.factory('SubscriptionService', [
|
||||
callback(data);
|
||||
});
|
||||
};
|
||||
s.fetch = res.fetch;
|
||||
s.subscribe = function(sub, callback) {
|
||||
res.subscribe(sub, function(data) {
|
||||
s.init();
|
||||
|
||||
Reference in New Issue
Block a user