Merge pull request #1795 from Fandekasp/remove_website

remove broken website field from profile
This commit is contained in:
Tyler Renelle
2013-11-13 23:09:27 -08:00
12 changed files with 13 additions and 70 deletions

View File

@@ -24,7 +24,6 @@
"PhotoUrl": "Линк към снимка", "PhotoUrl": "Линк към снимка",
"FullName": "Име", "FullName": "Име",
"Blurb": "Blurb", "Blurb": "Blurb",
"Websites": "Уебсайт",
"Achievements": "Постижения", "Achievements": "Постижения",
"OriginalUser": "Автентичен юзър", "OriginalUser": "Автентичен юзър",
"Inventory": "Инвентория", "Inventory": "Инвентория",

View File

@@ -136,8 +136,6 @@
"photoUrl": "Photo Url", "photoUrl": "Photo Url",
"fullName": "Full Name", "fullName": "Full Name",
"blurb": "Blurb", "blurb": "Blurb",
"websites": "Websites",
"addWebsites": "Add Websites",
"items" : "Items", "items" : "Items",
"weapon" : "Weapon", "weapon" : "Weapon",
"armor" : "armor", "armor" : "armor",

View File

@@ -24,7 +24,6 @@
"PhotoUrl": "Foto URL", "PhotoUrl": "Foto URL",
"FullName": "Volledige Naam", "FullName": "Volledige Naam",
"Blurb": "Blurp", "Blurb": "Blurp",
"Websites": "Voeg Website Toe",
"Achievements": "Prestaties", "Achievements": "Prestaties",
"OriginalUser": "Originele Gebruiker!", "OriginalUser": "Originele Gebruiker!",
"Inventory": "Inventaris", "Inventory": "Inventaris",

View File

@@ -0,0 +1,7 @@
// Migrate all users websites to the profile blurb field
db.users.find({'profile.websites':{$exists: true}}).forEach(function(user){
db.users.update({_id: user._id}, {
$set: {"profile.blurb": user.profile.blurb + '\n * ' + user.profile.websites.join('\n * ')},
$unset: {'profile.websites': ''}
})
})

View File

@@ -16,15 +16,6 @@ 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);
}
// ------ Modals ------ // ------ Modals ------
$scope.clickMember = function(uid, forceShow) { $scope.clickMember = function(uid, forceShow) {

View File

@@ -26,15 +26,6 @@ habitrpg.controller("UserCtrl", ['$rootScope', '$scope', '$location', 'User', '$
$scope._editing.profile = false; $scope._editing.profile = false;
} }
$scope.addWebsite = function(){
if (!$scope.editingProfile.websites) $scope.editingProfile.websites = [];
$scope.editingProfile.websites.push($scope._newWebsite);
$scope._newWebsite = '';
}
$scope.removeWebsite = function($index){
$scope.editingProfile.websites.splice($index,1);
}
$scope.unlock = User.unlock; $scope.unlock = User.unlock;
} }

View File

@@ -196,7 +196,7 @@ api.update = function(req, res, next) {
if(group.leader !== user._id) if(group.leader !== user._id)
return res.json(401, {err: "Only the group leader can update the group!"}); return res.json(401, {err: "Only the group leader can update the group!"});
'name description logo websites logo leaderMessage leader'.split(' ').forEach(function(attr){ 'name description logo logo leaderMessage leader'.split(' ').forEach(function(attr){
group[attr] = req.body[attr]; group[attr] = req.body[attr];
}); });
@@ -414,4 +414,4 @@ api.removeMember = function(req, res, next){
return res.json(400, {err: "User not found among group's members!"}); return res.json(400, {err: "User not found among group's members!"});
} }
} }

View File

@@ -13,7 +13,6 @@ var GroupSchema = new Schema({
type: {type: String, "enum": ['guild', 'party']}, type: {type: String, "enum": ['guild', 'party']},
privacy: {type: String, "enum": ['private', 'public']}, privacy: {type: String, "enum": ['private', 'public']},
_v: {type: Number,'default': 0}, _v: {type: Number,'default': 0},
websites: Array,
chat: Array, chat: Array,
/* /*
# [{ # [{
@@ -49,13 +48,6 @@ function removeDuplicates(doc){
doc.members = uniqMembers; doc.members = uniqMembers;
} }
} }
if (doc.websites) {
var uniqWebsites = _.uniq(doc.websites);
if (uniqWebsites.length != doc.websites.length) {
doc.websites = uniqWebsites;
}
}
} }
// FIXME this isn't always triggered, since we sometimes use update() or findByIdAndUpdate() // FIXME this isn't always triggered, since we sometimes use update() or findByIdAndUpdate()
@@ -80,4 +72,4 @@ GroupSchema.methods.toJSON = function(){
} }
module.exports.schema = GroupSchema; module.exports.schema = GroupSchema;
module.exports.model = mongoose.model("Group", GroupSchema); module.exports.model = mongoose.model("Group", GroupSchema);

View File

@@ -178,7 +178,6 @@ var UserSchema = new Schema({
blurb: String, blurb: String,
imageUrl: String, imageUrl: String,
name: String, name: String,
websites: Array // styled like --> ["http://ocdevel.com" ]
}, },
stats: { stats: {
hp: Number, hp: Number,
@@ -300,4 +299,4 @@ UserSchema.methods.unlink = function(options, cb) {
} }
module.exports.schema = UserSchema; module.exports.schema = UserSchema;
module.exports.model = mongoose.model("User", UserSchema); module.exports.model = mongoose.model("User", UserSchema);

View File

@@ -92,13 +92,6 @@ script(id='partials/options.profile.profile.html', type='text/ng-template')
span.muted(ng-hide='profile.profile.blurb') - None - span.muted(ng-hide='profile.profile.blurb') - None -
//{{profile.profile.blurb | linky:'_blank'}} //{{profile.profile.blurb | linky:'_blank'}}
h4 Websites
ul(ng-show='profile.profile.websites.length > 0')
// TODO let's remove links eventually, since we can do markdown on profiles
li(ng-repeat='website in profile.profile.websites')
a(target='_blank', ng-href='{{website}}') {{website}}
span.muted(ng-hide='profile.profile.websites.length > 0') - None -
div.whatever-options(ng-show='_editing.profile') div.whatever-options(ng-show='_editing.profile')
// TODO use photo-upload instead: https://groups.google.com/forum/?fromgroups=#!topic/derbyjs/xMmADvxBOak // TODO use photo-upload instead: https://groups.google.com/forum/?fromgroups=#!topic/derbyjs/xMmADvxBOak
.control-group.option-large .control-group.option-large
@@ -111,15 +104,6 @@ script(id='partials/options.profile.profile.html', type='text/ng-template')
label.control-label Blurb label.control-label Blurb
textarea.option-content(style='height:15em;', placeholder='Blurb', ng-model='editingProfile.blurb') textarea.option-content(style='height:15em;', placeholder='Blurb', ng-model='editingProfile.blurb')
include ../shared/formatting-help include ../shared/formatting-help
.control-group.option-large
label.control-label Websites
form(ng-submit='addWebsite()')
input.option-content(type='url', ng-model='_newWebsite', placeholder='Add Website')
ul
li(ng-repeat='website in editingProfile.websites')
| {{website}}
a(ng-click='removeWebsite($index)')
i.icon-remove
script(id='partials/options.profile.html', type="text/ng-template") script(id='partials/options.profile.html', type="text/ng-template")
ul.nav.nav-tabs ul.nav.nav-tabs
@@ -135,4 +119,4 @@ script(id='partials/options.profile.html', type="text/ng-template")
.tab-content .tab-content
.tab-pane.active .tab-pane.active
div(ui-view) div(ui-view)

View File

@@ -25,27 +25,13 @@ a.pull-right.gem-wallet(popover-trigger='mouseenter', popover-title='Guild Bank'
.control-group.option-large .control-group.option-large
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
label.control-label Websites
form(ng-submit='addWebsite(group)')
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(ng-model='group._newLeader', ng-options='member.profile.name for member in group.members') select#group-leader-selection(ng-model='group._newLeader', ng-options='member.profile.name for member in group.members')
div(ng-show='!group._editing') div(ng-show='!group._editing')
img.pull-right(ng-show='group.logo', style='max-width:150px', ng-src='{{group.logo}}') img.pull-right(ng-show='group.logo', style='max-width:150px', ng-src='{{group.logo}}')
markdown(ng-model='group.description') markdown(ng-model='group.description')
div(ng-show='group.websites')
h4 Websites
ul
li(ng-repeat='website in group.websites')
a(target='_blank', ng-href='{{website}}') {{website}}
include ./challenge-box include ./challenge-box

View File

@@ -9,9 +9,6 @@ div(ng-controller='MemberModalCtrl')
.span6 .span6
img(ng-show='profile.profile.imageUrl', ng-src='{{profile.profile.imageUrl}}') img(ng-show='profile.profile.imageUrl', ng-src='{{profile.profile.imageUrl}}')
markdown(ng-show='profile.profile.blurb', ng-model='profile.profile.blurb') markdown(ng-show='profile.profile.blurb', ng-model='profile.profile.blurb')
ul(ng-show='profile.profile.websites')
li(ng-repeat='website in profile.profile.websites')
a(href='{{website}}', target='_blank') {{website}}
ul.muted.unstyled(ng-if='profile.auth.timestamps', style='margin-top:10px;') ul.muted.unstyled(ng-if='profile.auth.timestamps', style='margin-top:10px;')
li {{profile._id}} li {{profile._id}}
li(ng-show='profile.auth.timestamps.created') - Member since {{timestamp(profile.auth.timestamps.created)}} - li(ng-show='profile.auth.timestamps.created') - Member since {{timestamp(profile.auth.timestamps.created)}} -