use markdown for profile-editing. Add save button. will remove linky

once everything's in markdown
This commit is contained in:
Tyler Renelle
2013-09-09 13:27:25 -04:00
parent 41cc18c1db
commit 6e800ea2d9
6 changed files with 60 additions and 30 deletions

View File

@@ -16,6 +16,8 @@ module.exports = function(grunt) {
'public/bower_components/bootstrap-growl/jquery.bootstrap-growl.min.js', 'public/bower_components/bootstrap-growl/jquery.bootstrap-growl.min.js',
'public/bower_components/angular/angular.min.js', 'public/bower_components/angular/angular.min.js',
'public/bower_components/angular-sanitize/angular-sanitize.min.js', 'public/bower_components/angular-sanitize/angular-sanitize.min.js',
'public/bower_components/showdown/compressed/showdown.js',
'public/bower_components/angular-markdown-directive/markdown.js',
'public/bower_components/angular-route/angular-route.min.js', 'public/bower_components/angular-route/angular-route.min.js',
'public/bower_components/angular-resource/angular-resource.min.js', 'public/bower_components/angular-resource/angular-resource.min.js',
'public/bower_components/angular-ui/build/angular-ui.min.js', 'public/bower_components/angular-ui/build/angular-ui.min.js',

View File

@@ -31,9 +31,12 @@
"bootstrap": "v2.3.2", "bootstrap": "v2.3.2",
"angular-route": "1.2.0-rc.1", "angular-route": "1.2.0-rc.1",
"angular-ui-utils": "~0.0.4", "angular-ui-utils": "~0.0.4",
"angular-sanitize": "1.2.0-rc.1" "angular-sanitize": "1.2.0-rc.1",
"angular-markdown-directive": "~0.1.0"
}, },
"resolutions": { "resolutions": {
"jquery": "~2.0.3" "jquery": "~2.0.3",
"angular": "1.2.0-rc.1",
"bootstrap": "v2.3.2"
} }
} }

View File

@@ -1,7 +1,7 @@
"use strict"; "use strict";
window.habitrpg = angular.module('habitrpg', window.habitrpg = angular.module('habitrpg',
['ngRoute', 'ngResource', 'ngSanitize', 'userServices', 'groupServices', 'memberServices', 'sharedServices', 'authServices', 'notificationServices', 'ui.bootstrap', 'ui.keypress']) ['ngRoute', 'ngResource', 'ngSanitize', 'userServices', 'groupServices', 'memberServices', 'sharedServices', 'authServices', 'notificationServices', 'ui.bootstrap', 'ui.keypress', 'btford.markdown'])
.constant("API_URL", "") .constant("API_URL", "")
.constant("STORAGE_USER_ID", 'habitrpg-user') .constant("STORAGE_USER_ID", 'habitrpg-user')

View File

@@ -29,7 +29,11 @@ html
script(type='text/javascript', src='/bower_components/jquery/jquery.min.js') script(type='text/javascript', src='/bower_components/jquery/jquery.min.js')
script(type='text/javascript', src='/bower_components/bootstrap-growl/jquery.bootstrap-growl.min.js') script(type='text/javascript', src='/bower_components/bootstrap-growl/jquery.bootstrap-growl.min.js')
script(type='text/javascript', src='/bower_components/angular/angular.min.js') script(type='text/javascript', src='/bower_components/angular/angular.min.js')
script(type='text/javascript', src='/bower_components/angular-sanitize/angular-sanitize.min.js') script(type='text/javascript', src='/bower_components/angular-sanitize/angular-sanitize.min.js')
script(type='text/javascript', src='/bower_components/showdown/compressed/showdown.js')
script(type='text/javascript', src='/bower_components/angular-markdown-directive/markdown.js')
script(type='text/javascript', src='/bower_components/angular-route/angular-route.min.js') script(type='text/javascript', src='/bower_components/angular-route/angular-route.min.js')
script(type='text/javascript', src='/bower_components/angular-resource/angular-resource.min.js') script(type='text/javascript', src='/bower_components/angular-resource/angular-resource.min.js')
script(type='text/javascript', src='/bower_components/angular-ui/build/angular-ui.min.js') script(type='text/javascript', src='/bower_components/angular-ui/build/angular-ui.min.js')

View File

@@ -38,28 +38,49 @@
// ------- Edit ------- // ------- Edit -------
.span4 .span4
button.btn.btn-default(ng-click='_editing.profile = true', ng-show='!_editing.profile') Edit
button.btn.btn-primary(ng-click='_editing.profile = false', ng-show='_editing.profile') Save
div(ng-show='!_editing.profile')
h4 Display Name
span(ng-show='profile.profile.name') {{profile.profile.name}}
span.muted(ng-hide='profile.profile.name') - None -
h4 Photo
img(ng-show='profile.profile.imageUrl', ng-src='{{profile.profile.imageUrl}}')
span.muted(ng-hide='profile.profile.imageUrl') - None -
h4 Blurb
p(ng-show='profile.profile.blurb', btf-markdown='profile.profile.blurb')
span.muted(ng-hide='profile.profile.blurb') - None -
//{{profile.profile.blurb | linky:'_blank'}}
h4 Websites
ul(ng-show='profile.profile.websites')
// 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') - None -
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
img.pull-right(ng-src='{{user.profile.imageUrl}}') .control-group.option-large
.control-group label.control-label Display Name
label.control-label(for='profileImageUrl') Photo Url input.option-content(type='text', placeholder='Full Name', ng-model='user.profile.name', ng-blur='set("profile.name", user.profile.name)', )
.controls .control-group.option-large
input#profileImageUrl(type='url', ng-model='user.profile.imageUrl', placeholder='Image Url', ng-blur='set("profile.imageUrl", user.profile.imageUrl)') label.control-label Photo Url
.control-group input.option-content(type='url', ng-model='user.profile.imageUrl', placeholder='Image Url', ng-blur='set("profile.imageUrl", user.profile.imageUrl)')
label.control-label(for='profileFullName') Full Name .control-group.option-large
.controls label.control-label Blurb
input#profileFullName(type='text', placeholder='Full Name', ng-model='user.profile.name', ng-blur='set("profile.name", user.profile.name)', ) textarea.option-content(style='height:15em;', placeholder='Blurb', ng-model='user.profile.blurb', ng-blur='set("profile.blurb", user.profile.blurb)')
.control-group small
label.control-label(for='profileBlurb') Blurb a(target='_blank', href='http://daringfireball.net/projects/markdown/') Use Markdown form formatting
.controls .control-group.option-large
textarea#profileBlurb(placeholder='Blurb', ng-model='user.profile.blurb', ng-blur='set("profile.blurb", user.profile.blurb)') label.control-label Websites
.control-group
label.control-label(for='profileWebsite') Websites
.controls
form(ng-submit='addWebsite()') form(ng-submit='addWebsite()')
input#profileWebsite(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 // would prefer if there were and index in #each, instead using data-website to search with indexOf
li(ng-repeat='website in user.profile.websites') li(ng-repeat='website in user.profile.websites')
| {{website}} | {{website}}
a(data-website='{{website}}', ng-click='removeWebsite($index)') a(ng-click='removeWebsite($index)')
i.icon-remove i.icon-remove

View File

@@ -8,10 +8,10 @@ div(ng-controller='MemberModalCtrl')
.row-fluid .row-fluid
.span6 .span6
img(ng-show='profile.profile.imageUrl', ng-src='{{profile.profile.imageUrl}}') img(ng-show='profile.profile.imageUrl', ng-src='{{profile.profile.imageUrl}}')
p(ng-show='profile.profile.blurb') {{profile.profile.blurb | linky:'_blank'}} p(ng-show='profile.profile.blurb', btf-markdown='profile.profile.blurb')
ul(ng-show='profile.profile.websites') ul(ng-show='profile.profile.websites')
li(ng-repeat='website in profile.profile.websites') li(ng-repeat='website in profile.profile.websites')
a(href='{{website}}') {{website}} a(href='{{website}}', target='_blank') {{website}}
h3 Stats h3 Stats
include ../profiles/stats include ../profiles/stats
.span6 .span6