port group websites

This commit is contained in:
Matteo Pagliazzi
2013-10-28 21:58:38 +01:00
parent f5777dc0d0
commit 5744146ff6
4 changed files with 18 additions and 6 deletions

View File

@@ -15,6 +15,15 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Groups', '$http', 'A
group._editing = false; group._editing = false;
} }
$scope.addWebsite = function(group){
group.websites.push(group._newWebsite);
group._newWebsite = '';
}
$scope.removeWebsite = function(group, $index){
group.websites.splice($index,1);
}
// ------ Loading ------ // ------ Loading ------
$scope.groups = Groups.groups; $scope.groups = Groups.groups;

View File

@@ -76,7 +76,6 @@ function removeDuplicates(doc){
if (uniqWebsites.length != doc.websites.length) { if (uniqWebsites.length != doc.websites.length) {
doc.websites = uniqWebsites; doc.websites = uniqWebsites;
} }
console.log(doc.websites);
} }
} }

View File

@@ -26,9 +26,14 @@ a.pull-right.gem-wallet(popover-trigger='mouseenter', popover-title='Guild Bank'
label.control-label Logo URL label.control-label Logo URL
input.option-content(type='url', placeholder='Logo URL', ng-model='group.logo') input.option-content(type='url', placeholder='Logo URL', ng-model='group.logo')
.control-group.option-large .control-group.option-large
form.form-inline(x-bind='submit:groupAddWebsite', ng-submit='notPorted()') label.control-label Websites
input.option-content(type='url', placeholder='Website', value='{{_newGroupWebsite}}') form(ng-submit='addWebsite(group)')
input.btn(type='submit', value='Add') input.option-content(type='url', ng-model='group._newWebsite', placeholder='Add Website')
ul
li(ng-repeat='website in group.websites')
| {{website}}
a(ng-click='removeWebsite(group, $index)')
i.icon-remove
h4 Assign Group Leader h4 Assign Group Leader
select#group-leader-selection select#group-leader-selection
@@ -48,7 +53,7 @@ a.pull-right.gem-wallet(popover-trigger='mouseenter', popover-title='Guild Bank'
markdown(ng-model='group.description') markdown(ng-model='group.description')
div(ng-show='group.websites') div(ng-show='group.websites')
h4 Websites h4 Websites
ul.unstyled ul
li(ng-repeat='website in group.websites') li(ng-repeat='website in group.websites')
a(target='_blank', ng-href='{{website}}') {{website}} a(target='_blank', ng-href='{{website}}') {{website}}

View File

@@ -121,7 +121,6 @@
form(ng-submit='addWebsite()') form(ng-submit='addWebsite()')
input.option-content(type='url', ng-model='_newWebsite', placeholder='Add Website') input.option-content(type='url', ng-model='_newWebsite', placeholder='Add Website')
ul ul
// would prefer if there were and index in #each, instead using data-website to search with indexOf
li(ng-repeat='website in editingProfile.websites') li(ng-repeat='website in editingProfile.websites')
| {{website}} | {{website}}
a(ng-click='removeWebsite($index)') a(ng-click='removeWebsite($index)')