Merge branch 'backbone_mediator' of https://github.com/rubenvereecken/codecombat into feature/jsondiffpatch

Conflicts:
	app/initialize.coffee
	bower.json
This commit is contained in:
Scott Erickson 2014-04-11 10:32:19 -07:00
commit 97a7bc7614
85 changed files with 1107 additions and 6134 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 559 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 890 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 750 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 791 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 B

View file

@ -112,7 +112,7 @@ module.exports = class LevelBus extends Bus
@changedSessionProperties.teamSpells = true
@session.set({'teamSpells': @teamSpellMap})
@saveSession()
if spellTeam is me.team
if spellTeam is me.team or spellTeam is "common"
@onSpellChanged e # Save the new spell to the session, too.
onScriptStateChanged: (e) ->

View file

@ -11,7 +11,6 @@ init = ->
me.set 'testGroupNumber', Math.floor(Math.random() * 256)
me.save()
me.loadGravatarProfile() if me.get('email')
Backbone.listenTo(me, 'sync', Backbone.Mediator.publish('me:synced', {me:me}))
module.exports.createUser = (userObject, failure=backboneFailure, nextURL=null) ->
@ -52,4 +51,3 @@ trackFirstArrival = ->
storage.save(BEEN_HERE_BEFORE_KEY, true)
init()

View file

@ -1,16 +1,9 @@
module.exports.sendContactMessage = (contactMessageObject, modal) ->
modal.find('.sending-indicator').show()
jqxhr = $.post '/contact',
email: contactMessageObject.email
message: contactMessageObject.message
,
(response) ->
console.log "Got contact response:", response
modal.find('.sending-indicator').hide()
modal.find('#contact-message').val("Thanks!")
_.delay ->
modal.find('#contact-message').val("")
modal.modal 'hide'
, 1000
jqxhr = $.post '/contact', contactMessageObject, (response) ->
modal.find('.sending-indicator').hide()
modal.find('#contact-message').val("Thanks!")
_.delay ->
modal.find('#contact-message').val("")
modal.modal 'hide'
, 1000

View file

@ -3,6 +3,7 @@ module.exports = nativeDescription: "English", englishDescription: "English", tr
loading: "Loading..."
saving: "Saving..."
sending: "Sending..."
send: "Send"
cancel: "Cancel"
save: "Save"
create: "Create"
@ -111,6 +112,8 @@ module.exports = nativeDescription: "English", englishDescription: "English", tr
forum_page: "our forum"
forum_suffix: " instead."
send: "Send Feedback"
contact_candidate: "Contact Candidate"
recruitment_reminder: "Use this form to get in touch with candidates you are interested in interviewing. Remember that CodeCombat charges 18% of first-year salary for any full-time candidate you hire who stays 90 days, but that part-timers, remote employees, contractors, and interns are free."
diplomat_suggestion:
title: "Help translate CodeCombat!"
@ -142,9 +145,6 @@ module.exports = nativeDescription: "English", englishDescription: "English", tr
password_tab: "Password"
emails_tab: "Emails"
admin: "Admin"
gravatar_select: "Select which Gravatar photo to use"
gravatar_add_photos: "Add thumbnails and photos to a Gravatar account for your email to choose an image."
gravatar_add_more_photos: "Add more photos to your Gravatar account to access them here."
wizard_color: "Wizard Clothes Color"
new_password: "New Password"
new_password_verify: "Verify"
@ -166,17 +166,6 @@ module.exports = nativeDescription: "English", englishDescription: "English", tr
edit_settings: "Edit Settings"
profile_for_prefix: "Profile for "
profile_for_suffix: ""
profile: "Profile"
user_not_found: "No user found. Check the URL?"
gravatar_not_found_mine: "We couldn't find your profile associated with:"
gravatar_not_found_email_suffix: "."
gravatar_signup_prefix: "Sign up at "
gravatar_signup_suffix: " to get set up!"
gravatar_not_found_other: "Alas, there's no profile associated with this person's email address."
gravatar_contact: "Contact"
gravatar_websites: "Websites"
gravatar_accounts: "As Seen On"
gravatar_profile_link: "Full Gravatar Profile"
play_level:
level_load_error: "Level could not be loaded: "
@ -345,6 +334,7 @@ module.exports = nativeDescription: "English", englishDescription: "English", tr
results: "Results"
description: "Description"
or: "or"
subject: "Subject"
email: "Email"
password: "Password"
message: "Message"
@ -626,4 +616,6 @@ module.exports = nativeDescription: "English", englishDescription: "English", tr
facebook_friend_sessions: "Facebook Friend Sessions"
gplus_friends: "G+ Friends"
gplus_friend_sessions: "G+ Friend Sessions"
leaderboard: 'leaderboard'
leaderboard: "Leaderboard"
user_schema: "User Schema"
user_profile: "User Profile"

View file

@ -102,7 +102,7 @@ module.exports = nativeDescription: "русский", englishDescription: "Russi
spectate: "Наблюдать"
contact:
contact_us: "Связаться с CodeCombat"
contact_us: "Связаться с Нами"
welcome: "Мы рады вашему сообщению! Используйте эту форму, чтобы отправить нам email. "
contribute_prefix: "Если вы хотите внести свой вклад в проект, зайдите на нашу "
contribute_page: "страницу сотрудничества"
@ -604,21 +604,21 @@ module.exports = nativeDescription: "русский", englishDescription: "Russi
so_ready: "Я полностью готов(а) для этого"
# loading_error:
# could_not_load: "Error loading from server"
# connection_failure: "Connection failed."
# could_not_load: "Ошибка соединения с сервером"
# connection_failure: "Соединение потеряно."
# unauthorized: "You need to be signed in. Do you have cookies disabled?"
# forbidden: "You do not have the permissions."
# not_found: "Not found."
# not_found: "Не наидено."
# not_allowed: "Method not allowed."
# timeout: "Server timeout."
# conflict: "Resource conflict."
# bad_input: "Bad input."
# server_error: "Server error."
# unknown: "Unknown error."
# server_error: "Ошибка сервера."
# unknown: "Неизвестная ошибка."
# resources:
# your_sessions: "Your Sessions"
# level: "Level"
# level: "Уровень"
# social_network_apis: "Social Network APIs"
# facebook_status: "Facebook Status"
# facebook_friends: "Facebook Friends"

View file

@ -5,7 +5,7 @@ module.exports = nativeDescription: "Türkçe", englishDescription: "Turkish", t
sending: "Gönderiliyor..."
cancel: "İptal"
save: "Kaydet"
# create: "Create"
create: "Oluştur"
delay_1_sec: "1 saniye"
delay_3_sec: "3 saniye"
delay_5_sec: "5 saniye"
@ -16,11 +16,11 @@ module.exports = nativeDescription: "Türkçe", englishDescription: "Turkish", t
units:
second: "saniye"
seconds: "saniyeler"
seconds: "saniye"
minute: "dakika"
minutes: "dakikalar"
minutes: "dakika"
hour: "saat"
hours: "saatler"
hours: "saat"
modal:
close: "Kapat"
@ -224,13 +224,13 @@ module.exports = nativeDescription: "Türkçe", englishDescription: "Turkish", t
tome_available_spells: "Kullanılabilir Büyüler"
hud_continue: "Devam (ÜstKarakter+Boşluk)"
spell_saved: "Büyü Kaydedildi"
# skip_tutorial: "Skip (esc)"
skip_tutorial: "Atla (esc)"
# editor_config: "Editor Config"
# editor_config_title: "Editor Configuration"
# editor_config_language_label: "Programming Language"
# editor_config_language_description: "Define the programming language you want to code in."
# editor_config_keybindings_label: "Key Bindings"
# editor_config_keybindings_default: "Default (Ace)"
editor_config_keybindings_default: "Varsayılan (Ace)"
# editor_config_keybindings_description: "Adds additional shortcuts known from the common editors."
# editor_config_invisibles_label: "Show Invisibles"
# editor_config_invisibles_description: "Displays invisibles such as spaces or tabs."
@ -238,7 +238,7 @@ module.exports = nativeDescription: "Türkçe", englishDescription: "Turkish", t
# editor_config_indentguides_description: "Displays vertical lines to see indentation better."
# editor_config_behaviors_label: "Smart Behaviors"
# editor_config_behaviors_description: "Autocompletes brackets, braces, and quotes."
# loading_ready: "Ready!"
loading_ready: "Hazır!"
# tip_insert_positions: "Shift+Click a point on the map to insert it into the spell editor."
# tip_toggle_play: "Toggle play/paused with Ctrl+P."
# tip_scrub_shortcut: "Ctrl+[ and Ctrl+] rewind and fast-forward."
@ -267,9 +267,9 @@ module.exports = nativeDescription: "Türkçe", englishDescription: "Turkish", t
# tip_impossible: "It always seems impossible until it's done. - Nelson Mandela"
# tip_talk_is_cheap: "Talk is cheap. Show me the code. - Linus Torvalds"
# tip_first_language: "The most disastrous thing that you can ever learn is your first programming language. - Alan Kay"
# time_current: "Now:"
# time_total: "Max:"
# time_goto: "Go to:"
time_current: "Şimdi:"
time_total: "Max:"
time_goto: "Git:"
admin:
av_title: "Yönetici Görünümleri"

View file

@ -8,53 +8,25 @@ module.exports = class User extends CocoModel
initialize: ->
super()
@on 'change:emailHash', ->
@gravatarProfile = null
@loadGravatarProfile()
isAdmin: ->
permissions = @attributes['permissions'] or []
return 'admin' in permissions
gravatarAvatarURL: ->
avatar_url = GRAVATAR_URL + 'avatar/'
return avatar_url if not @emailHash
return avatar_url + @emailHash
loadGravatarProfile: ->
emailHash = @get('emailHash')
return if not emailHash
functionName = 'gotProfile'+emailHash
profileUrl = "#{GRAVATAR_URL}#{emailHash}.json?callback=#{functionName}"
script = $("<script src='#{profileUrl}' type='text/javascript'></script>")
$('head').append(script)
window[functionName] = (profile) =>
@gravatarProfile = profile
@trigger('change', @)
func = => @gravatarProfile = null unless @gravatarProfile
setTimeout(func, 1000)
displayName: ->
@get('name') or @gravatarName() or "Anoner"
@get('name') or "Anoner"
lang: ->
@get('preferredLanguage') or "en-US"
gravatarName: ->
@gravatarProfile?.entry[0]?.name?.formatted or ''
gravatarPhotoURLs: ->
photos = @gravatarProfile?.entry[0]?.photos
return if not photos
(photo.value for photo in photos)
getPhotoURL: ->
photoURL = @get('photoURL')
validURLs = @gravatarPhotoURLs()
return @gravatarAvatarURL() unless validURLs and validURLs.length
return validURLs[0] unless photoURL in validURLs
return photoURL
getPhotoURL: (size=80, useJobProfilePhoto=false) ->
photoURL = if useJobProfilePhoto then @get('jobProfile')?.photoURL else null
photoURL ||= @get('photoURL')
if photoURL
prefix = if photoURL.search(/\?/) is -1 then "?" else "&"
return "#{photoURL}#{prefix}s=#{size}" if photoURL.search('http') isnt -1 # legacy
return "/file/#{photoURL}#{prefix}s=#{size}"
return "/db/user/#{@id}/avatar?s=#{size}"
@getByID = (id, properties, force) ->
{me} = require('lib/auth')
@ -66,7 +38,7 @@ module.exports = class User extends CocoModel
success: ->
user.loading = false
Backbone.Mediator.publish('user:fetched')
user.loadGravatarProfile()
#user.trigger 'sync' # needed?
)
cache[id] = user
user

View file

@ -1,15 +1,195 @@
#profile-view
button
float: right
i
margin-right: 5px
.profile-control-bar
background-color: rgb(78, 78, 78)
width: 100%
text-align: center
img.img-thumbnail
margin: 20px 0
button.edit-settings-button
margin: 2px
i
margin-right: 5px
li
list-style: none
.approved, .not-approved
display: none
ul
margin: 0
.main-content-area
padding: 0
.flat-button
width: 100%
margin-bottom: 10px
background: rgb(78, 78, 78)
border: 0
border-radius: 0
padding: 10px
.public-profile-container
padding: 20px
img.profile-photo
width: 256px
border-radius: 6px
.job-profile-container
width: 100%
height: 100%
padding: 0
display: table
h1, h2, h3, h4, h5, h6
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif
color: #555
ul.links, ul.projects
margin: 0
padding: 0
li
list-style: none
.job-profile-row
height: 100%
display: table-row
.full-height-column
height: 100%
padding: 5px
display: table-cell
vertical-align: top
h3:first-child
margin: 5px 0 5px 0
.left-column
width: 250px
padding: 5px
background-color: rgb(220, 220, 220)
.profile-photo-container
position: relative
margin-bottom: 10px
img.profile-photo
width: 240px
border-radius: 6px
.profile-caption
background-color: rgba(0, 0, 0, 0.5)
color: white
border-bottom-right-radius: 6px
border-bottom-left-radius: 6px
position: absolute
width: 100%
bottom: 0px
text-align: center
ul.links
li.has-icon
display: inline-block
img
margin: 0 0 10px 0
li.has-icon:not(:nth-child(5))
img
margin: 0 10px 10px 0
#contact-candidate
margin-top: 20px
background-color: rgb(177, 55, 25)
padding: 15px
font-size: 20px
.middle-column
width: 524px
background-color: white
padding-left: 20px
padding-right: 20px
&.double-column
width: 524px + 250px
padding-left: 30px
padding-right: 30px
code
background-color: rgb(220, 220, 220)
color: #555
margin: 2px 0
display: inline-block
text-transform: lowercase
.long-description
margin-top: 10px
img
max-width: 524px - 60px
max-height: 200px
.experience-header
margin-top: 25px
.header-icon
margin-right: 10px
width: 32px
height: 32px
.duration
margin-left: 10px
margin-bottom: 10px
#job-profile-notes
width: 100%
height: 100px
.right-column
width: 250px
background-color: rgb(220, 220, 220)
> h3:first-child
background-color: white
padding: 5px 5px
margin: 5px 2px 5px 2px
ul.projects
li
margin-bottom: 10px
padding: 5px 5px
border: 2px solid rgb(220, 220, 220)
transition: .5s ease-in-out
position: relative
background-color: white
&:hover
border-color: rgb(100, 130, 255)
a
position: relative
z-index: 2
> a
position: absolute
width: 100%
height: 100%
top: 0
left: 0
z-index: 1
.project-image
width: 230px
height: 115px
background-size: cover
background-repeat: no-repeat
background-position: center
-webkit-filter: grayscale(100%)
-webkit-transition: .5s ease-in-out
-moz-filter: grayscale(100%)
-moz-transition: .5s ease-in-out
-o-filter: grayscale(100%)
-o-transition: .5s ease-in-out
filter: grayscale(100%)
transition: .5s ease-in-out
li:hover
.project-image
-webkit-filter: grayscale(0%)
-moz-filter: grayscale(0%)
-o-filter: grayscale(0%)
filter: grayscale(0%)

View file

@ -8,15 +8,20 @@
background: #eee
border-radius: 5px
#save-button
float: right
#save-button-container
position: fixed
top: 100px
width: 1000px
z-index: 10
.thumbnails
text-align: center
.thumbnail
margin-bottom: 30px
margin-right: 20px
float: left
#save-button
float: right
&.btn-info, &.btn-danger
opacity: 1.0
.gravatar-fallback
margin-top: 10px
input.range
position: relative
@ -38,3 +43,14 @@
.form
max-width: 600px
#job-profile-treema
background-color: white
input
width: 790px
.treema-description
font-size: 14px
line-height: 22px
opacity: 1

18
app/styles/employers.sass Normal file
View file

@ -0,0 +1,18 @@
#employers-view
.tablesorter
//img
// display: none
.tablesorter-header
cursor: pointer
&:hover
color: black
.tablesorter-headerAsc
background-color: #cfc
.tablesorter-headerDesc
background-color: #ccf
tr
cursor: pointer

View file

@ -22,7 +22,9 @@
position: absolute
z-index: 20
$UNVEIL_TIME: 1.2s
pointer-events: none
&.unveiled
pointer-events: none
.loading-details
position: absolute

View file

@ -0,0 +1,8 @@
h3(data-i18n="account_settings.job_profile") Job Profile
if me.get('jobProfileApproved')
p.lead(data-i18n="account_settings.job_profile_approved") Your job profile has been approved by CodeCombat. Hungry employers will see it until you mark it inactive or it is stale for two months.
else
p.lead(data-i18n="account_settings.job_profile_explanation") Hi! Fill this out, and if we think we can find you a software developer job, we will get in touch to approve your profile.
#job-profile-treema

View file

@ -2,71 +2,99 @@ extends /templates/base
block content
if myProfile
a(href="/account/settings")
button.btn
i.icon-cog
span(data-i18n="account_profile.edit_settings") Edit Settings
if myProfile || (me.isAdmin() && user.get('jobProfile'))
.profile-control-bar
if myProfile
a(href="/account/settings")
button.btn.edit-settings-button
i.icon-cog
span(data-i18n="account_profile.edit_settings") Edit Settings
if me.isAdmin() && user.get('jobProfile')
button.btn.edit-settings-button#toggle-job-profile-approved
i.icon-cog
span(data-i18n='account_profile.approved').approved Approved
span(data-i18n='account_profile.approved').not-approved Not Approved
h2
if grav && grav.name && grav.name.formatted
span(data-i18n="account_profile.profile_for_prefix") Profile for
span= grav.name.formatted
span(data-i18n="account_profile.profile_for_suffix")
else
span(data-i18n="account_profile.profile") Profile
if user.get('jobProfile')
- var profile = user.get('jobProfile');
.job-profile-container
.job-profile-row
.left-column.full-height-column
.profile-photo-container
img.profile-photo(src=user.getPhotoURL(240, true))
.profile-caption= profile.jobTitle || 'Software Developer'
if loadingProfile
p(data-i18n="common.loading") Loading...
if profileLinks.length
ul.links
each link in profileLinks
li(title=profile.name + " on " + link.name, class=link.icon ? "has-icon" : "")
a(href=link.link)
if link.icon
img(src=link.icon.url, alt=link.icon.name)
else
button.btn.btn-large.btn-inverse.flat-button= link.name
else if !user.get('emailHash')
p(data-i18n="account_profile.user_not_found") No user found. Check the URL?
div= profile.city + ', ' + profile.country
div= profile.visa
div Looking for: #{profile.lookingFor}
div Last updated #{moment(profile.updated).fromNow()}
else if !user.gravatarProfile
if myProfile
p
span(data-i18n="account_profile.gravatar_not_found_mine") We couldn't find your profile associated with:
strong "#{me.get('email')}"
span(data-i18n="account_profile.gravatar_not_found_email_suffix") .
span
span(data-i18n="account_profile.gravatar_signup_prefix") Sign up at
a(href="http://en.gravatar.com/") Gravatar
span(data-i18n="account_profile.gravatar_signup_suffix") to get set up!
else
p(data-i18n="account_profile.gravatar_not_found_other")
| Alas, there's no profile associated with this person's email address.
button#contact-candidate.btn.btn-large.btn-inverse.flat-button Contact #{profile.name.split(' ')[0]}
.middle-column.full-height-column
h3= profile.name
p= profile.shortDescription
each skill in profile.skills
code= skill
span
div.long-description!= marked(profile.longDescription)
if profile.work.length
h3.experience-header
img.header-icon(src="/images/pages/account/profile/work.png", alt="")
| Work Experience
each job in profile.work
div.duration.pull-right= job.duration
| #{job.role} at #{job.employer}
.clearfix
if profile.education.length
h3.experience-header
img.header-icon(src="/images/pages/account/profile/education.png", alt="")
| Education
each school in profile.education
div.duration.pull-right= school.duration
| #{school.degree} at #{school.school}
.clearfix
if user.get('jobProfileNotes') || me.isAdmin()
h3.experience-header Our Notes
- var notes = user.get('jobProfileNotes') || '';
if me.isAdmin()
textarea#job-profile-notes!= notes
else
div!= marked(notes)
.right-column.full-height-column
if profile.projects.length
h3 Projects
ul.projects
each project in profile.projects
li
a(href=project.link)
.project-image(style="background-image: url(/file/" + project.picture + ")")
p= project.name
div!= marked(project.description)
else
.container
div.row
div.col-xs-3
img(src=photoURL).img-thumbnail
.public-profile-container
h2
span(data-i18n="account_profile.profile_for_prefix") Profile for
span= user.get('name')
span(data-i18n="account_profile.profile_for_suffix")
p.about-me #{grav.aboutMe}
img.profile-photo(src=user.getPhotoURL(256))
if grav.emails
div.col-xs-3
h3(data-i18n="account_profile.gravatar_contact") Contact
ul
each email in grav.emails
li #{email.value}
if grav.urls && grav.urls.length
div.col-xs-3
h3(data-i18n="account_profile.gravatar_websites") Websites
ul
each url in grav.urls
li
a(href="#{url.value}") #{url.title}
if grav.accounts
div.col-xs-3
h3(data-i18n="account_profile.gravatar_accounts") As Seen On
ul
each account in grav.accounts
li
a(href="#{account.url}") #{account.domain}
hr
p
a(href="#{grav.profileUrl}", data-i18n="account_profile.gravatar_profile_link") Full Gravatar Profile
h2 TODO
p Public user profiles are not ready yet.

View file

@ -8,7 +8,8 @@ block content
p(data-i18n="account_settings.not_logged_in") Log in or create an account to change your settings.
else
button.btn#save-button.disabled.secret(data-i18n="account_settings.autosave") Changes Save Automatically
#save-button-container
button.btn#save-button.disabled.secret(data-i18n="account_settings.autosave") Changes Save Automatically
ul.nav.nav-pills#settings-tabs
li
@ -21,6 +22,9 @@ block content
a(href="#password-pane", data-toggle="tab", data-i18n="account_settings.password_tab") Password
li
a(href="#email-pane", data-toggle="tab", data-i18n="account_settings.emails_tab") Emails
if showsJobProfileTab
li
a(href="#job-profile-pane", data-toggle="tab", data-i18n="account_settings.job_profile_tab") Job Profile
.tab-content#settings-panes
#general-pane.tab-pane
@ -28,7 +32,7 @@ block content
.form
.form-group
label.control-label(for="name", data-i18n="general.name") Name
input#name.form-control(name="name", type="text", value="#{me.get('name')||''}", placeholder="#{gravatarName}")
input#name.form-control(name="name", type="text", value="#{me.get('name') || ''}")
.form-group
label.control-label(for="email", data-i18n="general.email") Email
input#email.form-control(name="email", type="text", value="#{me.get('email')}")
@ -39,22 +43,10 @@ block content
#picture-pane.tab-pane
h3(data-i18n="account_settings.gravatar_select") Select which Gravatar photo to use
p
if !photos
span(data-i18n="account_settings.gravatar_add_photos") Add thumbnails and photos to a Gravatar account for your email to choose an image.
else
.thumbnails
each photo, i in photos
.thumbnail
label(for="photo-#{i}")
img(src=photo)
br
input(type="radio", name="photoURL", value="#{photo}", id="photo-#{i}", checked=photo==chosenPhoto)
.clearfix
p
a(href="http://en.gravatar.com/profiles/edit/?noclose#your-images", target="_blank", data-i18n="account_settings.gravatar_add_more_photos") Add more photos to your Gravatar account to access them here.
h3(data-i18n="account_settings.upload_picture") Upload a picture
#picture-treema
.gravatar-fallback
img(src=me.getPhotoURL(256), alt="Gravatar", title="Gravatar fallback image")
#wizard-pane.tab-pane
#wizard-settings-view
@ -153,3 +145,6 @@ block content
span(data-i18n="contribute.ambassador_subscribe_desc").help-block Get emails on support updates and multiplayer developments.
button.btn#toggle-all-button(data-i18n="account_settings.email_toggle") Toggle All
#job-profile-pane.tab-pane
#job-profile-view

View file

@ -33,7 +33,7 @@ body
if me.get('anonymous') === false
button.btn.btn-primary.navbuttontext.header-font#logout-button(data-i18n="login.log_out") Log Out
a.btn.btn-primary.navbuttontext.header-font(href="/account/profile/#{me.id}")
a.btn.btn-primary.navbuttontext.header-font(href=me.get('jobProfile') ? "/account/profile/#{me.id}" : "/account/settings")
div.navbuttontext-user-name
| #{me.displayName()}
i.icon-cog.icon-white.big

View file

@ -32,3 +32,54 @@ block content
h4 Skill: from interns and entry level to senior developers and management
h4 Technologies: just about everything
h4 Countries: USA, Canada, Australia, and many more
if candidates.length
table.table.table-condensed.table-hover.table-responsive.tablesorter
thead
tr
th Name
th Location
th Looking For
th Top 5 Skills
th Yrs Exp
th Last Updated
th Current Job
if me.isAdmin()
th ✓?
tbody
for candidate, index in candidates
- var profile = candidate.get('jobProfile');
- var authorized = candidate.id; // If we have the id, then we are authorized.
tr(data-candidate-id=candidate.id)
td
if authorized
img(src=candidate.getPhotoURL(50), alt=profile.name, title=profile.name, width=50)
p= profile.name
else
img(src="/images/pages/contribute/archmage.png", alt="", title="Sign up as an employer to see our candidates", width=50)
p Developer ##{index + 1}
if profile.country == 'USA'
td= profile.city
else
td= profile.country
td= profile.lookingFor
td
each skill in profile.skills.slice(0, 5)
code= skill
span
td= profile.experience
td= moment(profile.updated).fromNow()
if authorized
if profile.work.length
td= profile.work[0].role + ' at ' + profile.work[0].employer
else
td
else
td
em Employer sign-up required.
if me.isAdmin()
if candidate.get('jobProfileApproved')
td ✓
else
td ✗

View file

@ -1,7 +1,7 @@
extends /templates/modal/modal_base
block modal-header-content
h3(data-i18n="diplomat_suggestion.title")
h3(data-i18n="diplomat_suggestion.title") Help translate CodeCombat!
block modal-body-content
h4(data-i18n="diplomat_suggestion.sub_heading") We need your language skills.

View file

@ -0,0 +1,9 @@
extends /templates/modal/modal_base
block modal-header-content
h3(data-i18n="employer_signup.title") Hire CodeCombat Players
block modal-body-content
h4(data-i18n="employer_signup.sub_heading") Let us find your next brilliant developers.
p(data-i18n="employer_signup.pitch_body") When you hire one of our players, you will pay CodeCombat 18% of her first-year salary, payable within 30 days of when she starts working. We will fully refund our placement fee if she leaves or is fired within 90 days. Cool? Email george@codecombat.com to get set up with employer permissions to see our candidates.

View file

@ -0,0 +1,22 @@
extends /templates/modal/contact
block modal-header-content
h3(data-i18n="contact.contact_candidate") Contact Candidate
block modal-body-content
p(data-i18n="contact.recruitment_reminder") Use this form to get in touch with candidates you are interested in interviewing. Remember that CodeCombat charges 18% of first-year salary for any full-time candidate you hire who stays 90 days, but that part-timers, remote employees, contractors, and interns are free.
.form
.form-group
label.control-label(for="contact-email", data-i18n="general.email") Email
input#contact-email.form-control(name="email", type="email", value=me.get('email'), placeholder="Where should the candidate reply?")
.form-group
label.control-label(for="contact-subject", data-i18n="general.subject") Subject
input#contact-subject.form-control(name="subject", type="text", value="Job interest", placeholder="Subject of the email the candidate will receive.")
.form-group
label.control-label(for="contact-message", data-i18n="general.message") Message
textarea#contact-message.form-control(name="message", rows=8)
block modal-footer-content
span.sending-indicator.pull-left.secret(data-i18n="common.sending") Sending...
a(href='#', data-dismiss="modal", aria-hidden="true", data-i18n="common.cancel").btn Cancel
button.btn.btn-primary#contact-submit-button(data-i18n="common.send") Send

File diff suppressed because one or more lines are too long

View file

@ -1,36 +1,75 @@
View = require 'views/kinds/RootView'
template = require 'templates/account/profile'
User = require 'models/User'
JobProfileContactView = require 'views/modal/job_profile_contact_modal'
module.exports = class ProfileView extends View
id: "profile-view"
template: template
loadingProfile: true
events:
'click #toggle-job-profile-approved': 'toggleJobProfileApproved'
'keyup #job-profile-notes': 'onJobProfileNotesChanged'
'click #contact-candidate': 'onContactCandidate'
constructor: (options, @userID) ->
@onJobProfileNotesChanged = _.debounce @onJobProfileNotesChanged, 1000
super options
@user = User.getByID(@userID)
@loadingProfile = false if 'gravatarProfile' of @user
@listenTo(@user, 'change', @userChanged)
@listenTo(@user, 'error', @userError)
userChanged: (user) ->
@loadingProfile = false if 'gravatarProfile' of user
@render()
userError: (user) ->
@loadingProfile = false
@render()
if @userID is me.id
@user = me
else
@user = User.getByID(@userID)
@addResourceToLoad @user, 'user_profile'
getRenderData: ->
context = super()
grav = @user.gravatarProfile
grav = grav.entry[0] if grav
addedContext =
user: @user
loadingProfile: @loadingProfile
myProfile: @user.id is context.me.id
grav: grav
photoURL: @user.getPhotoURL()
context[key] = addedContext[key] for key of addedContext
context.user = @user
context.myProfile = @user.id is context.me.id
context.marked = marked
context.moment = moment
context.iconForLink = @iconForLink
if links = @user.get('jobProfile')?.links
links = ($.extend(true, {}, link) for link in links)
link.icon = @iconForLink link for link in links
context.profileLinks = _.sortBy links, (link) -> not link.icon # icons first
context
afterRender: ->
super()
@updateProfileApproval() if me.isAdmin()
unless @user.get('jobProfile')?.projects?.length
@$el.find('.right-column').hide()
@$el.find('.middle-column').addClass('double-column')
updateProfileApproval: ->
approved = @user.get 'jobProfileApproved'
@$el.find('.approved').toggle Boolean(approved)
@$el.find('.not-approved').toggle not approved
toggleJobProfileApproved: ->
approved = not @user.get 'jobProfileApproved'
@user.set 'jobProfileApproved', approved
@user.save()
@updateProfileApproval()
onJobProfileNotesChanged: (e) =>
notes = @$el.find("#job-profile-notes").val()
@user.set 'jobProfileNotes', notes
@user.save()
iconForLink: (link) ->
icons = [
{icon: 'facebook', name: 'Facebook', domain: 'facebook.com', match: /facebook/i}
{icon: 'twitter', name: 'Twitter', domain: 'twitter.com', match: /twitter/i}
{icon: 'github', name: 'GitHub', domain: 'github.com', match: /github/i}
{icon: 'gplus', name: 'Google Plus', domain: 'plus.google.com', match: /(google|^g).?(\+|plus)/i}
{icon: 'linkedin', name: 'LinkedIn', domain: 'linkedin.com', match: /(google|^g).?(\+|plus)/i}
]
for icon in icons
if (link.name.search(icon.match) isnt -1) or (link.link.search(icon.domain) isnt -1)
icon.url = "/images/pages/account/profile/icon_#{icon.icon}.png"
return icon
null
onContactCandidate: (e) ->
@openModalView new JobProfileContactView recipientID: @user.id

View file

@ -5,6 +5,7 @@ forms = require('lib/forms')
User = require('models/User')
WizardSettingsView = require './wizard_settings_view'
JobProfileView = require './job_profile_view'
module.exports = class SettingsView extends View
id: 'account-settings-view'
@ -19,18 +20,7 @@ module.exports = class SettingsView extends View
@save = _.debounce(@save, 200)
super options
return unless me
@listenTo(me, 'change', @refreshPicturePane) # depends on gravatar load
@listenTo(me, 'invalid', (errors) -> forms.applyErrorsToForm(@$el, me.validationError))
window.f = @getSubscriptions
refreshPicturePane: ->
h = $(@template(@getRenderData()))
newPane = $('#picture-pane', h)
oldPane = $('#picture-pane')
active = oldPane.hasClass('active')
oldPane.replaceWith(newPane)
newPane.i18n()
newPane.addClass('active') if active
afterRender: ->
super()
@ -45,9 +35,19 @@ module.exports = class SettingsView extends View
)
@chooseTab(location.hash.replace('#',''))
WizardSettingsView = new WizardSettingsView()
@listenTo(WizardSettingsView, 'change', @save)
@insertSubView WizardSettingsView
wizardSettingsView = new WizardSettingsView()
@listenTo wizardSettingsView, 'change', @save
@insertSubView wizardSettingsView
@jobProfileView = new JobProfileView()
@listenTo @jobProfileView, 'change', @save
@insertSubView @jobProfileView
if me.schema().loaded
@buildPictureTreema()
else
@listenToOnce me, 'schema-loaded', @buildPictureTreema
chooseTab: (category) ->
id = "##{category}-pane"
@ -62,11 +62,9 @@ module.exports = class SettingsView extends View
getRenderData: ->
c = super()
return c unless me
c.gravatarName = c.me?.gravatarName()
c.photos = me.gravatarPhotoURLs()
c.chosenPhoto = me.getPhotoURL()
c.subs = {}
c.subs[sub] = 1 for sub in c.me.get('emailSubscriptions') or ['announcement', 'notification', 'tester', 'level_creator', 'developer']
c.showsJobProfileTab = me.isAdmin() or me.get('jobProfile') or location.hash.search('job-profile-') isnt -1
c
getSubscriptions: ->
@ -81,6 +79,30 @@ module.exports = class SettingsView extends View
$('#email-pane input[type="checkbox"]', @$el).prop('checked', not Boolean(subs.length))
@save()
buildPictureTreema: ->
data = photoURL: me.get('photoURL')
if data.photoURL?.search('gravatar') isnt -1
# Old style
data.photoURL = null
schema = _.cloneDeep me.schema().attributes
schema.properties = _.pick me.schema().get('properties'), 'photoURL'
schema.required = ['photoURL']
console.log 'schema is', schema
treemaOptions =
filePath: "db/user/#{me.id}"
schema: schema
data: data
callbacks: {change: @onPictureChanged}
@pictureTreema = @$el.find('#picture-treema').treema treemaOptions
@pictureTreema.build()
@pictureTreema.open()
@$el.find('.gravatar-fallback').toggle not me.get 'photoURL'
onPictureChanged: (e) =>
@trigger 'change'
@$el.find('.gravatar-fallback').toggle not me.get 'photoURL'
save: ->
forms.clearFormAlerts(@$el)
@grabData()
@ -94,14 +116,14 @@ module.exports = class SettingsView extends View
res = me.save()
return unless res
save = $('#save-button', @$el).text($.i18n.t('common.saving', defaultValue: 'Saving...'))
.addClass('btn-info').show().removeClass('btn-danger')
.removeClass('btn-danger').addClass('btn-success').show()
res.error ->
errors = JSON.parse(res.responseText)
forms.applyErrorsToForm(@$el, errors)
save.text($.i18n.t('account_settings.error_saving', defaultValue: 'Error Saving')).removeClass('btn-info').addClass('btn-danger')
save.text($.i18n.t('account_settings.error_saving', defaultValue: 'Error Saving')).removeClass('btn-success').addClass('btn-danger', 500)
res.success (model, response, options) ->
save.text($.i18n.t('account_settings.saved', defaultValue: 'Changes Saved')).removeClass('btn-info')
save.text($.i18n.t('account_settings.saved', defaultValue: 'Changes Saved')).removeClass('btn-success', 500)
grabData: ->
@grabPasswordData()
@ -120,12 +142,22 @@ module.exports = class SettingsView extends View
me.set('password', password1)
grabOtherData: ->
me.set('name', $('#name', @$el).val())
me.set('email', $('#email', @$el).val())
me.set('emailSubscriptions', @getSubscriptions())
me.set 'name', $('#name', @$el).val()
me.set 'email', $('#email', @$el).val()
me.set 'emailSubscriptions', @getSubscriptions()
me.set 'photoURL', @pictureTreema.get('/photoURL')
adminCheckbox = @$el.find('#admin')
if adminCheckbox.length
permissions = []
permissions.push 'admin' if adminCheckbox.prop('checked')
me.set('permissions', permissions)
jobProfile = me.get('jobProfile') ? {}
updated = false
for key, val of @jobProfileView.getData()
updated = updated or jobProfile[key] isnt val
jobProfile[key] = val
if updated
jobProfile.updated = (new Date()).toISOString()
me.set 'jobProfile', jobProfile

View file

@ -16,9 +16,9 @@ module.exports = class LevelSessionsView extends View
@getLevelSessions()
getLevelSessions: ->
@sessions = new LevelSessionCollection
@sessions = new LevelSessionCollection()
@sessions.fetch()
@listenTo(@sessions, 'all', @render)
@listenToOnce @sessions, 'all', @render
getRenderData: =>
c = super()

View file

@ -1,6 +1,6 @@
SearchView = require 'views/kinds/SearchView'
module.exports = class ThangTypeHomeView extends SearchView
module.exports = class EditorSearchView extends SearchView
id: "editor-level-home-view"
modelLabel: 'Level'
model: require 'models/Level'

View file

@ -1,6 +1,90 @@
View = require 'views/kinds/RootView'
template = require 'templates/employers'
app = require 'application'
User = require 'models/User'
CocoCollection = require 'models/CocoCollection'
employerSignupTemplate = require 'templates/modal/employer_signup_modal'
ModalView = require 'views/kinds/ModalView'
class CandidatesCollection extends CocoCollection
url: '/db/user/x/candidates'
model: User
module.exports = class EmployersView extends View
id: "employers-view"
template: template
events:
'click tbody tr': 'onCandidateClicked'
constructor: (options) ->
super options
@getCandidates()
afterRender: ->
super()
@sortTable() if @candidates.models.length
getRenderData: ->
c = super()
c.candidates = @candidates.models
c.moment = moment
c
getCandidates: ->
@candidates = new CandidatesCollection()
@candidates.fetch()
# Re-render when we have fetched them, but don't wait and show a progress bar while loading.
@listenToOnce @candidates, 'all', @render
sortTable: ->
# http://mottie.github.io/tablesorter/docs/example-widget-bootstrap-theme.html
$.extend $.tablesorter.themes.bootstrap,
# these classes are added to the table. To see other table classes available,
# look here: http://twitter.github.com/bootstrap/base-css.html#tables
table: "table table-bordered"
caption: "caption"
header: "bootstrap-header" # give the header a gradient background
footerRow: ""
footerCells: ""
icons: "" # add "icon-white" to make them white; this icon class is added to the <i> in the header
sortNone: "bootstrap-icon-unsorted"
sortAsc: "icon-chevron-up" # glyphicon glyphicon-chevron-up" # we are still using v2 icons
sortDesc: "icon-chevron-down" # glyphicon-chevron-down" # we are still using v2 icons
active: "" # applied when column is sorted
hover: "" # use custom css here - bootstrap class may not override it
filterRow: "" # filter row class
even: "" # odd row zebra striping
odd: "" # even row zebra striping
# call the tablesorter plugin and apply the uitheme widget
@$el.find(".tablesorter").tablesorter(
theme: "bootstrap"
widthFixed: true
headerTemplate: "{content} {icon}"
# widget code contained in the jquery.tablesorter.widgets.js file
# use the zebra stripe widget if you plan on hiding any rows (filter widget)
widgets: [
"uitheme"
"zebra"
]
widgetOptions:
# using the default zebra striping class name, so it actually isn't included in the theme variable above
# this is ONLY needed for bootstrap theming if you are using the filter widget, because rows are hidden
zebra: [
"even"
"odd"
]
# reset filters button
filter_reset: ".reset"
)
onCandidateClicked: (e) ->
id = $(e.target).closest('tr').data('candidate-id')
if id
url = "/account/profile/#{id}"
app.router.navigate url, {trigger: true}
else
employerSignupModal = new ModalView()
employerSignupModal.template = employerSignupTemplate
@openModalView employerSignupModal

View file

@ -8,7 +8,7 @@ class SearchCollection extends Backbone.Collection
@url = "#{modelURL}/search?project=true"
@url += "&term=#{term}" if @term
module.exports = class ThangTypeHomeView extends View
module.exports = class SearchView extends View
template: template
className: 'search-view'

View file

@ -6,16 +6,15 @@ forms = require 'lib/forms'
contactSchema =
additionalProperties: false
required: ['email', 'message']
properties:
email:
required: true
type: 'string'
maxLength: 100
minLength: 1
format: 'email'
message:
required: true
type: 'string'
minLength: 1

View file

@ -0,0 +1,41 @@
ContactView = require 'views/modal/contact_modal'
template = require 'templates/modal/job_profile_contact'
forms = require 'lib/forms'
{sendContactMessage} = require 'lib/contact'
contactSchema =
additionalProperties: false
required: ['email', 'message']
properties:
email:
type: 'string'
maxLength: 100
minLength: 1
format: 'email'
subject:
type: 'string'
minLength: 1
message:
type: 'string'
minLength: 1
recipientID:
type: 'string'
minLength: 1
module.exports = class JobProfileContactView extends ContactView
id: "job-profile-contact-modal"
template: template
contact: ->
forms.clearFormAlerts @$el
contactMessage = forms.formToObject @$el
contactMessage.recipientID = @options.recipientID
res = tv4.validateMultiple contactMessage, contactSchema
return forms.applyErrorsToForm @$el, res.errors unless res.valid
contactMessage.message += '\n\n\n\n[CodeCombat says: please let us know if you end up accepting this job. Thanks!]'
window.tracker?.trackEvent 'Sent Job Profile Message', message: contactMessage
sendContactMessage contactMessage, @$el

View file

@ -11,6 +11,7 @@ module.exports = class LadderPlayModal extends View
closeButton: true
startsLoading: true
@shownTutorialButton: false
tutorialLevelExists: null
events:
'click #skip-tutorial-button': 'hideTutorialButtons'
@ -58,9 +59,11 @@ module.exports = class LadderPlayModal extends View
# PART 4: Render
finishRendering: ->
@startsLoading = false
@render()
@maybeShowTutorialButtons()
@checkTutorialLevelExists (exists) =>
@tutorialLevelExists = exists
@startsLoading = false
@render()
@maybeShowTutorialButtons()
getRenderData: ->
ctx = super()
@ -94,7 +97,7 @@ module.exports = class LadderPlayModal extends View
ctx
maybeShowTutorialButtons: ->
return if @session or LadderPlayModal.shownTutorialButton
return if @session or LadderPlayModal.shownTutorialButton or not @tutorialLevelExists
@$el.find('#normal-view').addClass('secret')
@$el.find('.modal-header').addClass('secret')
@$el.find('#noob-view').removeClass('secret')
@ -105,6 +108,17 @@ module.exports = class LadderPlayModal extends View
@$el.find('.modal-header').removeClass('secret')
@$el.find('#noob-view').addClass('secret')
checkTutorialLevelExists: (cb) ->
levelID = @level.get('slug') or @level.id
tutorialLevelID = "#{levelID}-tutorial"
success = => cb true
failure = => cb false
$.ajax
type: "GET"
url: "/db/level/#{tutorialLevelID}/exists"
success: success
error: failure
# Choosing challengers
getChallengers: ->

View file

@ -34,6 +34,7 @@ module.exports = class LevelLoadingView extends View
reallyUnveil: =>
return if @destroyed
@$el.addClass 'unveiled'
loadingDetails = @$el.find('.loading-details')
duration = parseFloat loadingDetails.css 'transition-duration'
loadingDetails.css 'top', -loadingDetails.outerHeight(true)

View file

@ -90,6 +90,8 @@ module.exports = class Spell
problems:
jshint_W040: {level: "ignore"}
jshint_W030: {level: "ignore"} # aether_NoEffect instead
jshint_W038: {level: "ignore"} #eliminates hoisting problems
jshint_W091: {level: "ignore"} #eliminates more hoisting problems
aether_MissingThis: {level: (if thang.requiresThis then 'error' else 'warning')}
language: aceConfig.language ? 'javascript'
functionName: @name

View file

@ -24,7 +24,7 @@
"test"
],
"dependencies": {
"jquery": "~2.0.3",
"jquery": "~2.1.0",
"lodash": "~2.4.1",
"backbone": "1.1.0",
"jquery-mousewheel": "~3.1.9",
@ -37,8 +37,15 @@
"firebase": "~1.0.2",
"catiline": "~2.9.3",
"d3": "~3.4.4",
<<<<<<< HEAD
"jsondiffpatch": "~0.1.5",
"nanoscroller": "~0.8.0"
=======
"nanoscroller": "~0.8.0",
"jquery.tablesorter": "~2.15.13",
"treema": "~0.0.1",
"bootstrap": "~3.1.1"
>>>>>>> master
},
"overrides": {
"backbone": {
@ -53,8 +60,26 @@
"underscore.string": {
"main": "lib/underscore.string.js"
},
<<<<<<< HEAD
"jsondiffpatch": {
"main": ["build/bundle-full.js", "build/formatters.js", "src/formatters/html.css"]
=======
"jquery.tablesorter": {
"main": [
"js/jquery.tablesorter.js",
"js/jquery.tablesorter.widgets.js",
"css/theme.bootstrap.css"
]
},
"bootstrap": {
"main": [
"./dist/js/bootstrap.js",
"./dist/fonts/glyphicons-halflings-regular.eot",
"./dist/fonts/glyphicons-halflings-regular.svg",
"./dist/fonts/glyphicons-halflings-regular.ttf",
"./dist/fonts/glyphicons-halflings-regular.woff"
]
>>>>>>> master
}
}
}

View file

@ -41,21 +41,11 @@ exports.config =
'test/javascripts/test-vendor.js': /^test[\/\\](?=vendor)/
order:
before: [
'bower_components/jquery/jquery.js'
'bower_components/jquery/dist/jquery.js'
'bower_components/lodash/dist/lodash.js'
'bower_components/backbone/backbone.js'
# Twitter Bootstrap jquery plugins
'vendor/scripts/bootstrap/transition.js'
'vendor/scripts/bootstrap/affix.js'
'vendor/scripts/bootstrap/alert.js'
'vendor/scripts/bootstrap/button.js'
'vendor/scripts/bootstrap/carousel.js'
'vendor/scripts/bootstrap/collapse.js'
'vendor/scripts/bootstrap/dropdown.js'
'vendor/scripts/bootstrap/modal.js'
'vendor/scripts/bootstrap/scrollspy.js'
'vendor/scripts/bootstrap/tab.js'
'vendor/scripts/bootstrap/tooltip.js'
'bower_components/bootstrap/dist/bootstrap.js'
# CreateJS dependencies
'vendor/scripts/easeljs-NEXT.combined.js'
'vendor/scripts/preloadjs-NEXT.combined.js'

View file

@ -73,7 +73,6 @@
"css-brunch": "> 1.0 < 1.8",
"jade-brunch": "> 1.0 < 1.8",
"uglify-js-brunch": "~1.7.4",
"clean-css-brunch": "> 1.0 < 1.8",
"auto-reload-brunch": "> 1.0 < 1.8",
"brunch": "~1.7.4",
"jasmine-node": "1.13.x",

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<variables>
<version>2.1</version>
<version>3.3</version>
<author>GlenDC</author>
<copyright>CodeCombat.com © 2013-2014</copyright>
<github_url>https://github.com/codecombat/codecombat.git</github_url>

View file

@ -20,18 +20,18 @@
</general>
<Win7>
<b32>
<mongodb>http://fastdl.mongodb.org/win32/mongodb-win32-i386-2.5.4.zip</mongodb>
<mongodb>https://fastdl.mongodb.org/win32/mongodb-win32-i386-2.6.0.zip</mongodb>
</b32>
<b64>
<mongodb>http://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-2.5.4.zip</mongodb>
<mongodb>https://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-2.6.0.zip</mongodb>
</b64>
</Win7>
<Vista>
<b32>
<mongodb>http://fastdl.mongodb.org/win32/mongodb-win32-i386-2.5.4.zip</mongodb>
<mongodb>https://fastdl.mongodb.org/win32/mongodb-win32-i386-2.6.0.zip</mongodb>
</b32>
<b64>
<mongodb>http://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2.5.4.zip</mongodb>
<mongodb>https://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2.6.0.zip</mongodb>
</b64>
</Vista>
</variables>

Binary file not shown.

View file

@ -53,6 +53,11 @@
<ssh>Willst du das Repository via SSH auschecken?</ssh>
</process>
</github>
<switch>
<install>The installation of your local environment was succesfull!</install>
<close>You can now close this setup.</close>
<open>After that, you should open the configuration setup to automaticly configure your environment...</open>
</switch>
<npm>
<install>Installing bower, brunch, nodemon and sendwithus...</install>
<binstall>Installing bower packages...</binstall>

View file

@ -60,6 +60,11 @@
<process>Thank you... Configuring your local repistory right now...</process>
</config>
</github>
<switch>
<install>The installation of your local environment was succesfull!</install>
<close>You can now close this setup.</close>
<open>After that, you should open the configuration setup to automaticly configure your environment...</open>
</switch>
<npm>
<install>Installing bower, brunch, nodemon and sendwithus...</install>
<binstall>Installing bower packages...</binstall>

View file

@ -53,6 +53,11 @@
<ssh>Do you want to checkout the repository via ssh?</ssh>
</process>
</github>
<switch>
<install>The installation of your local environment was succesfull!</install>
<close>You can now close this setup.</close>
<open>After that, you should open the configuration setup to automaticly configure your environment...</open>
</switch>
<npm>
<install>Installing bower, brunch, nodemon and sendwithus...</install>
<binstall>Installing bower packages...</binstall>

View file

@ -2,6 +2,5 @@ en
nl
de
fr
zh
zh-HANT
zh-HANS

View file

@ -53,6 +53,11 @@
<ssh>Wil je het git project downloaden via ssh?</ssh>
</process>
</github>
<switch>
<install>The installation of your local environment was succesfull!</install>
<close>You can now close this setup.</close>
<open>After that, you should open the configuration setup to automaticly configure your environment...</open>
</switch>
<npm>
<install>Installing bower, brunch, nodemon and sendwithus...</install>
<binstall>Installing bower packages...</binstall>

View file

@ -53,6 +53,11 @@
<ssh>你是否想使用 ssh 来检出(checkout)库(repository)?</ssh>
</process>
</github>
<switch>
<install>The installation of your local environment was succesfull!</install>
<close>You can now close this setup.</close>
<open>After that, you should open the configuration setup to automaticly configure your environment...</open>
</switch>
<npm>
<install>正在安装 bower, brunch, nodemon 和 sendwithus...</install>
<binstall>正在用 bower 安装依赖包...</binstall>

View file

@ -53,6 +53,11 @@
<ssh>Do you want to checkout the repository via ssh?</ssh>
</process>
</github>
<switch>
<install>The installation of your local environment was succesfull!</install>
<close>You can now close this setup.</close>
<open>After that, you should open the configuration setup to automaticly configure your environment...</open>
</switch>
<npm>
<install>Installing bower, brunch, nodemon and sendwithus...</install>
<binstall>Installing bower packages...</binstall>

View file

@ -1,84 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<variables>
<global>
<native>中文</native>
<description>Chinese</description>
<intro>From now on we'll send our feedback in English!</intro>
</global>
<install>
<system>
<bit>-bit computer detected.</bit>
<prefix>The operating system</prefix>
<sufix>was detected.</sufix>
<xp>We don't support Windows XP, installation cancelled.</xp>
</system>
<process>
<sks>Have you already installed all the software needed for CodeCombat?</sks>
<skq>We recommand that you reply negative in case you're not sure.</skq>
<skc>Skipping the installation of the software...</skc>
<s1>CodeCombat couldn't be developed without third-party software.</s1>
<s2>That's why you'll need to install this software,</s2>
<s3>in order to start contributing to our community.</s3>
<s4>Cancel the installation if you already have the application.</s4>
<winpath>Make sure to select the option that adds the application to your Windows Path, if the option is available.</winpath>
<prefix>Do you already have the latest version of</prefix>
<sufix>installed?</sufix>
<downloading>is downloading...</downloading>
<installing>is installing...</installing>
<unzipping>is unzipping...</unzipping>
<cleaning>is cleaning...</cleaning>
<mongodbpath>Please define the full path where mongodb should be installed</mongodbpath>
</process>
</install>
<github>
<intro>
<opensource>CodeCombat is opensource, like you already know.</opensource>
<online>All our sourcecode can be found online at Github.</online>
<manual>You can choose to do the entire Git setup yourself.</manual>
<norec>However we recommend that you instead let us handle it instead.</norec>
</intro>
<skip>
<question>Do you want to do the Local Git setup manually yourself?</question>
<consequence>Make sure you have correctly setup your repository before processing.</consequence>
<donotclose>Do not close this window please.</donotclose>
<wait>When you're ready, press any key to continue...</wait>
</skip>
<process>
<path>Please give the full path of your CodeCombat git repository: </path>
<checkout>Please enter the full path where you want to install your CodeCombat environment</checkout>
<bashi>This installation requires Git Bash.</bashi>
<bashp64>Git bash is by default installed at 'C:\Program Files (x86)\Git'.</bashp64>
<bashp32>Git bash is by default installed at 'C:\Program Files\Git'.</bashp32>
<bashq>Please enter the full path where git bash is installed or just press enter if it's in the default location</bashq>
<ssh>Do you want to checkout the repository via ssh?</ssh>
</process>
</github>
<npm>
<install>Installing bower, brunch, nodemon and sendwithus...</install>
<binstall>Installing bower packages...</binstall>
<sass>Installing sass...</sass>
<npm>Installing npm...</npm>
<brnch>Starting brunch....</brnch>
<mongodb>Setting up a MongoDB database for you...</mongodb>
<db>Downloading the last version of the CodeCombat database...</db>
<script>Preparing the automatic startup script for you...</script>
<close>Don't close!</close>
</npm>
<error>
<path>That path already exists, are you sure you want to overwrite it?</path>
<exist>That path doesn't exist. Please try again...</exist>
</error>
<end>
<succesfull>The setup of the CodeCombat Dev. Environment was succesfull.</succesfull>
<thankyou>Thank you already for your contribution and see you soon.</thankyou>
<readme>Do you want to read the README for more information?</readme>
</end>
<start>
<s1>From now on you can start the dev. environment at</s1>
<s2>the touch of a single mouse click.</s2>
<s3> 1) Just double click</s3>
<s4> and let the environment start up.</s4>
<s5> 2) Now just open 'localhost:3000' in your prefered browser.</s5>
<s6>That's it, you're now ready to start working on CodeCombat!</s6>
</start>
</variables>

View file

@ -1,6 +1,8 @@
@echo off
setlocal EnableDelayedExpansion
call read_cache
call configuration_cmd
call npm_and_brunch_setup

View file

@ -21,7 +21,7 @@ call get_extension %2 download_extension
call get_local_text install_process_downloading install process downloading
echo %1 !install_process_downloading!
set "install_file=!temp_directory!%1.!download_extension!"
%curl_app% -k %2 -o !install_file!
start /wait cmd.exe /c "TITLE %1 !install_process_downloading! && %curl_app% -k -m 10800 --retry 100 -o !install_file! %2"
if "%download_extension%"=="zip" (
set "package_path=!temp_directory!%1\"
@ -50,7 +50,7 @@ if "%download_extension%"=="zip" (
%systemroot%\System32\xcopy !package_path!!mongodb_original_directory! !mongodb_path! /r /h /s /e /y
setx path ";!mongodb_path!\bin"
call set_environment_var "!mongodb_path!\bin"
goto:clean_up
)

View file

@ -0,0 +1,3 @@
for /F "delims=" %%F in ('call run_script .\\get_var.ps1 ..\\config\\cache.coco %1') do (
set "%1=%%F"
)

View file

@ -136,8 +136,8 @@ goto:eof
set cur_dir=%CD%
cd !repository_path!\coco
git remote rm origin
git remote add origin https://!git_username!:!git_password!@github.com/!git_username!/codecombat.git
"%git_app_path%" remote rm origin
"%git_app_path%" remote add origin https://!git_username!:!git_password!@github.com/!git_username!/codecombat.git
cd !cur_dir!

View file

@ -2,6 +2,6 @@ call print_dashed_seperator
call get_local_text npm_script npm script
echo %npm_script%
echo start cmd.exe cmd /c "TITLE CodeCombat.com - nodemon server & call nodemon -w server -w server_config.js">%~1\SCOCODE.bat
echo start cmd.exe cmd /c "TITLE CodeCombat.com - brunch - live compiler & call brunch w">>%~1\SCOCODE.bat
echo start cmd.exe cmd /c "TITLE CodeCombat.com - mongodb database & mongod --setParameter textSearchEnabled=true --dbpath %~2">>%~1\SCOCODE.bat
echo start cmd.exe cmd /c "TITLE CodeCombat.com - mongodb database & mongod --setParameter textSearchEnabled=true --dbpath %~2">%~1\SCOCODE.bat
echo start cmd.exe cmd /c "TITLE CodeCombat.com - nodemon server & nodemon index.js">>%~1\SCOCODE.bat
echo start cmd.exe cmd /c "TITLE CodeCombat.com - brunch - live compiler & brunch w">>%~1\SCOCODE.bat

View file

@ -20,7 +20,7 @@ cd /D %~1
start cmd /c "TITLE MongoDB - %npm_close% & mongod --setParameter textSearchEnabled=true --dbpath %~1"
%work_directory%\%curl_app% -k %database_backup% -o dump.tar.gz
start /wait cmd.exe /c "TITLE downloading database backup... && %work_directory%\%curl_app% -k -m 10800 --retry 100 -o dump.tar.gz %database_backup%"
start /wait cmd /c "%work_directory%\%zu_app% e dump.tar.gz && del dump.tar.gz && %work_directory%\%zu_app% x dump.tar && del dump.tar"
@ -32,4 +32,6 @@ call %work_directory%\print_dashed_seperator
taskkill /F /fi "IMAGENAME eq mongod.exe"
del /F %~1\mongod.lock
cd /D %work_directory%

View file

@ -0,0 +1,2 @@
call get_cache_var language_id
call get_cache_var repository_path

View file

@ -0,0 +1 @@
setx path ";%~1"

View file

@ -5,6 +5,16 @@ call configuration_cmd
call github_setup
start cmd /c "setup_p3.bat"
call write_cache
call get_local_text switch_install switch install
call get_local_text switch_close switch close
call get_local_text switch_open switch open
echo %switch_install%
echo %switch_close%
echo.
set /p "dummy=%switch_open%"
endlocal

View file

@ -0,0 +1,10 @@
set "cache=..\\config\\cache.coco"
echo ^<?xml version="1.0" encoding="ISO-8859-1" ?^>>%cache%
echo ^<variables^>>>%cache%
echo ^<language_id^>%language_id%^</language_id^>>>%cache%
echo ^<repository_path^>%repository_path%^</repository_path^>>>%cache%
echo ^</variables^>>>%cache%

View file

@ -8,6 +8,8 @@ combine = (base, ext) ->
return base unless ext?
return _.extend(base, ext)
urlPattern = '^(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&%\$#_=]*)?$'
# Common schema properties
me.object = (ext, props) -> combine {type: 'object', additionalProperties: false, properties: props or {}}, ext
me.array = (ext, items) -> combine {type: 'array', items: items or {}}, ext
@ -16,6 +18,7 @@ me.pct = (ext) -> combine({type: 'number', maximum: 1.0, minimum: 0.0}, ext)
me.date = (ext) -> combine({type: ['object', 'string'], format: 'date-time'}, ext)
# should just be string (Mongo ID), but sometimes mongoose turns them into objects representing those, so we are lenient
me.objectId = (ext) -> schema = combine({type: ['object', 'string'] }, ext)
me.url = (ext) -> combine({type: 'string', format: 'url', pattern: urlPattern}, ext)
PointSchema = me.object {title: "Point", description: "An {x, y} coordinate point.", format: "point2d", required: ["x", "y"]},
x: {title: "x", description: "The x coordinate.", type: "number", "default": 15}

View file

@ -38,7 +38,12 @@ LevelHandler = class LevelHandler extends Handler
return @getLeaderboardFacebookFriends(req, res, args[0]) if args[1] is 'leaderboard_facebook_friends'
return @getLeaderboardGPlusFriends(req, res, args[0]) if args[1] is 'leaderboard_gplus_friends'
return @getHistogramData(req, res, args[0]) if args[1] is 'histogram_data'
<<<<<<< HEAD
super(arguments...)
=======
return @checkExistence(req, res, args[0]) if args[1] is 'exists'
return @sendNotFoundError(res)
>>>>>>> master
fetchLevelByIDAndHandleErrors: (id, req, res, callback) ->
@getDocumentForIdOrSlug id, (err, level) =>
@ -131,6 +136,22 @@ LevelHandler = class LevelHandler extends Handler
valueArray = _.pluck data, "totalScore"
@sendSuccess res, valueArray
checkExistence: (req, res, slugOrID) ->
findParameters = {}
if Handler.isID slugOrID
findParameters["_id"] = slugOrID
else
findParameters["slug"] = slugOrID
selectString = 'original version.major permissions'
query = Level.findOne(findParameters)
.select(selectString)
.lean()
query.exec (err, level) =>
return @sendDatabaseError(res, err) if err
return @sendNotFoundError(res) unless level?
res.send({"exists":true})
res.end()
getLeaderboard: (req, res, id) ->
sessionsQueryParameters = @makeLeaderboardQueryParameters(req, id)

View file

@ -1,26 +1,38 @@
config = require '../../server_config'
log = require 'winston'
mail = require '../commons/mail'
User = require '../users/User'
module.exports.setup = (app) ->
app.post '/contact', (req, res) ->
return res.end() unless req.user
log.info "Sending mail from #{req.body.email} saying #{req.body.message}"
if config.isProduction
options = createMailOptions req.body.email, req.body.message, req.user
mail.transport.sendMail options, (error, response) ->
if error
log.error "Error sending mail: #{error.message or error}"
else
log.info "Mail sent successfully. Response: #{response.message}"
createMailOptions req.body.email, req.body.message, req.user, req.body.recipientID, req.body.subject, (options) ->
mail.transport.sendMail options, (error, response) ->
if error
log.error "Error sending mail: #{error.message or error}"
else
log.info "Mail sent successfully. Response: #{response.message}"
return res.end()
createMailOptions = (sender, message, user) ->
createMailOptions = (sender, message, user, recipientID, subject, done) ->
# TODO: use email templates here
options =
from: config.mail.username
to: config.mail.username
replyTo: sender
subject: "[CodeCombat] Feedback - #{sender}"
subject: "[CodeCombat] #{subject ? ('Feedback - ' + sender)}"
text: "#{message}\n\nUsername: #{user.get('name') or 'Anonymous'}\nID: #{user._id}"
#html: message.replace '\n', '<br>\n'
if recipientID and (user.isAdmin() or ('employer' in (user.permissions ? [])))
User.findById(recipientID, 'email').exec (err, document) ->
if err
log.error "Error looking up recipient to email from #{recipientID}: #{err}" if err
else
options.bcc = options.to
options.to = document.get('email')
done options
else
done options

View file

@ -37,7 +37,7 @@ getTimeFromDaysAgo = (now, daysAgo) ->
t = now - 86400 * 1000 * daysAgo - LADDER_PREGAME_INTERVAL
isRequestFromDesignatedCronHandler = (req, res) ->
requestIP = req.headers['x-forwarded-for'][0]
requestIP = req.headers['x-forwarded-for']?.replace(" ","").split(",")[0]
if requestIP isnt config.mail.cronHandlerPublicIP and requestIP isnt config.mail.cronHandlerPrivateIP
console.log "RECEIVED REQUEST FROM IP #{requestIP}(headers indicate #{req.headers['x-forwarded-for']}"
console.log "UNAUTHORIZED ATTEMPT TO SEND TRANSACTIONAL LADDER EMAIL THROUGH CRON MAIL HANDLER"

View file

@ -9,12 +9,16 @@ errors = require '../commons/errors'
async = require 'async'
log = require 'winston'
LevelSession = require('../levels/sessions/LevelSession')
LevelSessionHandler = require '../levels/sessions/level_session_handler'
serverProperties = ['passwordHash', 'emailLower', 'nameLower', 'passwordReset']
privateProperties = [
'permissions', 'email', 'firstName', 'lastName', 'gender', 'facebookID',
'gplusID', 'music', 'volume', 'aceConfig'
]
candidateProperties = [
'jobProfile', 'jobProfileApproved', 'jobProfileNotes'
]
UserHandler = class UserHandler extends Handler
modelClass: User
@ -23,7 +27,7 @@ UserHandler = class UserHandler extends Handler
'name', 'photoURL', 'password', 'anonymous', 'wizardColor1', 'volume',
'firstName', 'lastName', 'gender', 'facebookID', 'gplusID', 'emailSubscriptions',
'testGroupNumber', 'music', 'hourOfCode', 'hourOfCodeComplete', 'preferredLanguage',
'wizard', 'aceConfig', 'autocastDelay', 'lastLevel'
'wizard', 'aceConfig', 'autocastDelay', 'lastLevel', 'jobProfile'
]
jsonSchema: schema
@ -32,21 +36,19 @@ UserHandler = class UserHandler extends Handler
super(arguments...)
@editableProperties.push('permissions') unless config.isProduction
getEditableProperties: (req, document) ->
props = super req, document
props.push 'jobProfileApproved', 'jobProfileNotes' if req.user.isAdmin()
props
formatEntity: (req, document) ->
return null unless document?
obj = document.toObject()
delete obj[prop] for prop in serverProperties
includePrivates = req.user and (req.user?.isAdmin() or req.user?._id.equals(document._id))
includePrivates = req.user and (req.user.isAdmin() or req.user._id.equals(document._id))
delete obj[prop] for prop in privateProperties unless includePrivates
# emailHash is used by gravatar
hash = crypto.createHash('md5')
if document.get('email')
hash.update(_.trim(document.get('email')).toLowerCase())
else
hash.update(@_id+'')
obj.emailHash = hash.digest('hex')
includeCandidate = includePrivates or (obj.jobProfileApproved and req.user and ('employer' in (req.user.permissions ? [])))
delete obj[prop] for prop in candidateProperties unless includeCandidate
return obj
waterfallFunctions: [
@ -115,7 +117,7 @@ UserHandler = class UserHandler extends Handler
getById: (req, res, id) ->
if req.user?._id.equals(id)
return @sendSuccess(res, @formatEntity(req, req.user))
return @sendSuccess(res, @formatEntity(req, req.user, 256))
super(req, res, id)
getNamesByIds: (req, res) ->
@ -171,7 +173,12 @@ UserHandler = class UserHandler extends Handler
return @getNamesByIds(req, res) if args[1] is 'names'
return @nameToID(req, res, args[0]) if args[1] is 'nameToID'
return @getLevelSessions(req, res, args[0]) if args[1] is 'level.sessions'
<<<<<<< HEAD
super(arguments...)
=======
return @getCandidates(req, res) if args[1] is 'candidates'
return @sendNotFoundError(res)
>>>>>>> master
agreeToCLA: (req, res) ->
return @sendUnauthorizedError(res) unless req.user
@ -191,9 +198,11 @@ UserHandler = class UserHandler extends Handler
@sendSuccess(res, {result:'success'})
avatar: (req, res, id) ->
@modelClass.findById(id).exec (err, document) ->
@modelClass.findById(id).exec (err, document) =>
return @sendDatabaseError(res, err) if err
res.redirect(document?.get('photoURL') or '/images/generic-wizard-icon.png')
photoURL = document?.get('photoURL')
photoURL ||= @buildGravatarURL document
res.redirect photoURL
res.end()
getLevelSessions: (req, res, userID) ->
@ -205,8 +214,46 @@ UserHandler = class UserHandler extends Handler
projection[field] = 1 for field in req.query.project.split(',')
LevelSession.find(query).select(projection).exec (err, documents) =>
return @sendDatabaseError(res, err) if err
documents = (@formatEntity(req, doc) for doc in documents)
documents = (LevelSessionHandler.formatEntity(req, doc) for doc in documents)
@sendSuccess(res, documents)
getCandidates: (req, res) ->
authorized = req.user.isAdmin() or ('employer' in req.user.get('permissions'))
since = (new Date((new Date()) - 2 * 30.4 * 86400 * 1000)).toISOString()
#query = {'jobProfileApproved': true, 'jobProfile.active': true, 'jobProfile.updated': {$gt: since}}
query = {'jobProfile.active': true, 'jobProfile.updated': {$gt: since}} # testing
query.jobProfileApproved = true unless req.user.isAdmin()
selection = 'jobProfile'
selection += ' email' if authorized
selection += ' jobProfileApproved' if req.user.isAdmin()
User.find(query).select(selection).exec (err, documents) =>
return @sendDatabaseError(res, err) if err
candidates = (@formatCandidate(authorized, doc) for doc in documents)
@sendSuccess(res, candidates)
formatCandidate: (authorized, document) ->
fields = if authorized then ['jobProfile', 'jobProfileApproved', 'photoURL', '_id'] else ['jobProfile']
obj = _.pick document.toObject(), fields
obj.photoURL ||= obj.jobProfile.photoURL if authorized
obj.photoURL ||= @buildGravatarURL document if authorized
subfields = ['country', 'city', 'lookingFor', 'skills', 'experience', 'updated']
if authorized
subfields = subfields.concat ['name', 'work']
obj.jobProfile = _.pick obj.jobProfile, subfields
obj
buildGravatarURL: (user) ->
emailHash = @buildEmailHash user
defaultAvatar = "http://codecombat.com/file/db/thang.type/52a00d55cf1818f2be00000b/portrait.png"
"https://www.gravatar.com/avatar/#{emailHash}?default=#{defaultAvatar}"
buildEmailHash: (user) ->
# emailHash is used by gravatar
hash = crypto.createHash('md5')
if user.get('email')
hash.update(_.trim(user.get('email')).toLowerCase())
else
hash.update(user.get('_id') + '')
hash.digest('hex')
module.exports = new UserHandler()

View file

@ -9,7 +9,7 @@ UserSchema = c.object {},
gender: {type: 'string', 'enum': ['male', 'female']}
password: {type: 'string', maxLength: 256, minLength: 2, title:'Password'}
passwordReset: {type: 'string'}
photoURL: {type: 'string', format: 'url', required: false}
photoURL: {type: 'string', format: 'image-file', title: 'Profile Picture', description: 'Upload a 256x256px or larger image to serve as your profile picture.'}
facebookID: c.shortString({title: 'Facebook ID'})
gplusID: c.shortString({title: 'G+ ID'})
@ -36,7 +36,6 @@ UserSchema = c.object {},
passwordHash: {type: 'string', maxLength: 256}
# client side
#gravatarProfile: {} (should only ever be kept locally)
emailHash: {type: 'string'}
#Internationalization stuff
@ -56,6 +55,44 @@ UserSchema = c.object {},
simulatedBy: {type: 'integer', minimum: 0, default: 0}
simulatedFor: {type: 'integer', minimum: 0, default: 0}
jobProfile: c.object {title: 'Job Profile', required: ['lookingFor', 'jobTitle', 'active', 'name', 'city', 'country', 'skills', 'experience', 'shortDescription', 'longDescription', 'visa', 'work', 'education', 'projects', 'links']},
lookingFor: {title: 'Looking For', type: 'string', enum: ['Full-time', 'Part-time', 'Remote', 'Contracting', 'Internship'], default: 'Full-time', description: 'What kind of developer position do you want?'}
jobTitle: {type: 'string', maxLength: 50, title: 'Desired Job Title', description: 'What role are you looking for? Ex.: "Full Stack Engineer", "Front-End Developer", "iOS Developer"', default: 'Software Developer'}
active: {title: 'Active', type: 'boolean', description: 'Want interview offers right now?'}
updated: c.date {title: 'Last Updated', description: 'How fresh your profile appears to employers. The fresher, the better. Profiles go inactive after 30 days.'}
name: c.shortString {title: 'Name', description: 'Name you want employers to see, like "Nick Winter".'}
city: c.shortString {title: 'City', description: 'City you want to work in (or live in now), like "San Francisco" or "Lubbock, TX".', default: 'Defaultsville, CA', format: 'city'}
country: c.shortString {title: 'Country', description: 'Country you want to work in (or live in now), like "USA" or "France".', default: 'USA', format: 'country'}
skills: c.array {title: 'Skills', description: 'Tag relevant developer skills in order of proficiency. Employers will see the first five at a glance.', default: ['javascript'], minItems: 1, maxItems: 30, uniqueItems: true},
{type: 'string', minLength: 1, maxLength: 20, description: 'Ex.: "objective-c", "mongodb", "rails", "android", "javascript"', format: 'skill'}
experience: {type: 'integer', title: 'Years of Experience', minimum: 0, description: 'How many years of professional experience (getting paid) developing software do you have?'}
shortDescription: {type: 'string', maxLength: 140, title: 'Short Description', description: 'Who are you, and what are you looking for? 140 characters max.', default: 'Programmer seeking to build great software.'}
longDescription: {type: 'string', maxLength: 600, title: 'Description', description: 'Describe yourself to potential employers. Keep it short and to the point. We recommend outlining the position that would most interest you. Tasteful markdown okay; 600 characters max.', format: 'markdown', default: '* I write great code.\n* You need great code?\n* Great!'}
visa: c.shortString {title: 'US Work Status', description: 'Are you authorized to work in the US, or do you need visa sponsorship?', enum: ['Authorized to work in the US', 'Need visa sponsorship'], default: 'Authorized to work in the US'}
work: c.array {title: 'Work Experience', description: 'List your relevant work experience, most recent first.'},
c.object {title: 'Job', description: 'Some work experience you had.', required: ['employer', 'role', 'duration']},
employer: c.shortString {title: 'Employer', description: 'Name of your employer.'}
role: c.shortString {title: 'Job Title', description: 'What was your job title or role?'}
duration: c.shortString {title: 'Duration', description: 'When did you hold this gig? Ex.: "Feb 2013 - present".'}
education: c.array {title: 'Education', description: 'List your academic ordeals.'},
c.object {title: 'Ordeal', description: 'Some education that befell you.', required: ['school', 'degree', 'duration']},
school: c.shortString {title: 'School', description: 'Name of your school.'}
degree: c.shortString {title: 'Degree', description: 'What was your degree and field of study? Ex. Ph.D. Human-Computer Interaction (incomplete)'}
duration: c.shortString {title: 'Dates', description: 'When? Ex.: "Aug 2004 - May 2008".'}
projects: c.array {title: 'Projects', description: 'Highlight your projects to amaze employers.'},
c.object {title: 'Project', description: 'A project you created.', required: ['name', 'description', 'picture'], default: {name: 'My Project', description: 'A project I worked on.', link: 'http://example.com', picture: ''}},
name: c.shortString {title: 'Project Name', description: 'What was the project called?', default: 'My Project'}
description: {type: 'string', title: 'Description', description: 'Briefly describe the project.', maxLength: 400, default: 'A project I worked on.', format: 'markdown'}
picture: {type: 'string', title: 'Picture', format: 'image-file', description: 'Upload a 230x115px or larger image showing off the project.'}
link: c.url {title: 'Link', description: 'Link to the project.', default: 'http://example.com'}
links: c.array {title: 'Personal and Social Links', description: 'Link any other sites or profiles you want to highlight, like your GitHub, your LinkedIn, or your blog.'},
c.object {title: 'Link', description: 'A link to another site you want to highlight, like your GitHub, your LinkedIn, or your blog.', required: ['name', 'link']},
name: {type: 'string', maxLength: 30, title: 'Link Name', description: 'What are you linking to? Ex: "Personal Website", "Twitter"', format: 'link-name'}
link: c.url {title: 'Link', description: 'The URL.', default: 'http://example.com'}
photoURL: {type: 'string', format: 'image-file', title: 'Profile Picture', description: 'Upload a 256x256px or larger image if you want to show a different profile picture to employers than your normal avatar.'}
jobProfileApproved: {title: 'Job Profile Approved', type: 'boolean', description: 'Whether your profile has been approved by CodeCombat.'}
jobProfileNotes: {type: 'string', maxLength: 1000, title: 'Our Notes', description: "CodeCombat's notes on the candidate.", format: 'markdown', default: ''}
c.extendBasicProperties UserSchema, 'user'
module.exports = UserSchema

View file

@ -3,6 +3,7 @@ path = require 'path'
authentication = require 'passport'
useragent = require 'express-useragent'
fs = require 'graceful-fs'
log = require('winston')
database = require './server/commons/database'
baseRoute = require './server/routes/base'
@ -96,7 +97,8 @@ setupFallbackRouteToIndex = (app) ->
auth.loginUser(req, res, user, false, next)
sendMain = (req, res) ->
fs.readFile path.join(__dirname, 'public', 'main.html'), 'utf8', (err,data) ->
fs.readFile path.join(__dirname, 'public', 'main.html'), 'utf8', (err, data) ->
log.error "Error modifying main.html: #{err}" if err
# insert the user object directly into the html so the application can have it immediately
data = data.replace('"userObjectTag"', JSON.stringify(UserHandler.formatEntity(req, req.user)))
res.send data

View file

@ -1,126 +0,0 @@
/* ========================================================================
* Bootstrap: affix.js v3.0.3
* http://getbootstrap.com/javascript/#affix
* ========================================================================
* Copyright 2013 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ======================================================================== */
+function ($) { "use strict";
// AFFIX CLASS DEFINITION
// ======================
var Affix = function (element, options) {
this.options = $.extend({}, Affix.DEFAULTS, options)
this.$window = $(window)
.on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
.on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
this.$element = $(element)
this.affixed =
this.unpin = null
this.checkPosition()
}
Affix.RESET = 'affix affix-top affix-bottom'
Affix.DEFAULTS = {
offset: 0
}
Affix.prototype.checkPositionWithEventLoop = function () {
setTimeout($.proxy(this.checkPosition, this), 1)
}
Affix.prototype.checkPosition = function () {
if (!this.$element.is(':visible')) return
var scrollHeight = $(document).height()
var scrollTop = this.$window.scrollTop()
var position = this.$element.offset()
var offset = this.options.offset
var offsetTop = offset.top
var offsetBottom = offset.bottom
if (typeof offset != 'object') offsetBottom = offsetTop = offset
if (typeof offsetTop == 'function') offsetTop = offset.top()
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom()
var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false :
offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false
if (this.affixed === affix) return
if (this.unpin) this.$element.css('top', '')
this.affixed = affix
this.unpin = affix == 'bottom' ? position.top - scrollTop : null
this.$element.removeClass(Affix.RESET).addClass('affix' + (affix ? '-' + affix : ''))
if (affix == 'bottom') {
this.$element.offset({ top: document.body.offsetHeight - offsetBottom - this.$element.height() })
}
}
// AFFIX PLUGIN DEFINITION
// =======================
var old = $.fn.affix
$.fn.affix = function (option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.affix')
var options = typeof option == 'object' && option
if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
if (typeof option == 'string') data[option]()
})
}
$.fn.affix.Constructor = Affix
// AFFIX NO CONFLICT
// =================
$.fn.affix.noConflict = function () {
$.fn.affix = old
return this
}
// AFFIX DATA-API
// ==============
$(window).on('load', function () {
$('[data-spy="affix"]').each(function () {
var $spy = $(this)
var data = $spy.data()
data.offset = data.offset || {}
if (data.offsetBottom) data.offset.bottom = data.offsetBottom
if (data.offsetTop) data.offset.top = data.offsetTop
$spy.affix(data)
})
})
}(jQuery);

View file

@ -1,98 +0,0 @@
/* ========================================================================
* Bootstrap: alert.js v3.0.3
* http://getbootstrap.com/javascript/#alerts
* ========================================================================
* Copyright 2013 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ======================================================================== */
+function ($) { "use strict";
// ALERT CLASS DEFINITION
// ======================
var dismiss = '[data-dismiss="alert"]'
var Alert = function (el) {
$(el).on('click', dismiss, this.close)
}
Alert.prototype.close = function (e) {
var $this = $(this)
var selector = $this.attr('data-target')
if (!selector) {
selector = $this.attr('href')
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
}
var $parent = $(selector)
if (e) e.preventDefault()
if (!$parent.length) {
$parent = $this.hasClass('alert') ? $this : $this.parent()
}
$parent.trigger(e = $.Event('close.bs.alert'))
if (e.isDefaultPrevented()) return
$parent.removeClass('in')
function removeElement() {
$parent.trigger('closed.bs.alert').remove()
}
$.support.transition && $parent.hasClass('fade') ?
$parent
.one($.support.transition.end, removeElement)
.emulateTransitionEnd(150) :
removeElement()
}
// ALERT PLUGIN DEFINITION
// =======================
var old = $.fn.alert
$.fn.alert = function (option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.alert')
if (!data) $this.data('bs.alert', (data = new Alert(this)))
if (typeof option == 'string') data[option].call($this)
})
}
$.fn.alert.Constructor = Alert
// ALERT NO CONFLICT
// =================
$.fn.alert.noConflict = function () {
$.fn.alert = old
return this
}
// ALERT DATA-API
// ==============
$(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
}(jQuery);

View file

@ -1,12 +0,0 @@
//= require affix
//= require alert
//= require button
//= require carousel
//= require collapse
//= require dropdown
//= require tab
//= require transition
//= require scrollspy
//= require modal
//= require tooltip
//= require popover

View file

@ -1,115 +0,0 @@
/* ========================================================================
* Bootstrap: button.js v3.0.3
* http://getbootstrap.com/javascript/#buttons
* ========================================================================
* Copyright 2013 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ======================================================================== */
+function ($) { "use strict";
// BUTTON PUBLIC CLASS DEFINITION
// ==============================
var Button = function (element, options) {
this.$element = $(element)
this.options = $.extend({}, Button.DEFAULTS, options)
}
Button.DEFAULTS = {
loadingText: 'loading...'
}
Button.prototype.setState = function (state) {
var d = 'disabled'
var $el = this.$element
var val = $el.is('input') ? 'val' : 'html'
var data = $el.data()
state = state + 'Text'
if (!data.resetText) $el.data('resetText', $el[val]())
$el[val](data[state] || this.options[state])
// push to event loop to allow forms to submit
setTimeout(function () {
state == 'loadingText' ?
$el.addClass(d).attr(d, d) :
$el.removeClass(d).removeAttr(d);
}, 0)
}
Button.prototype.toggle = function () {
var $parent = this.$element.closest('[data-toggle="buttons"]')
var changed = true
if ($parent.length) {
var $input = this.$element.find('input')
if ($input.prop('type') === 'radio') {
// see if clicking on current one
if ($input.prop('checked') && this.$element.hasClass('active'))
changed = false
else
$parent.find('.active').removeClass('active')
}
if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
}
if (changed) this.$element.toggleClass('active')
}
// BUTTON PLUGIN DEFINITION
// ========================
var old = $.fn.button
$.fn.button = function (option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.button')
var options = typeof option == 'object' && option
if (!data) $this.data('bs.button', (data = new Button(this, options)))
if (option == 'toggle') data.toggle()
else if (option) data.setState(option)
})
}
$.fn.button.Constructor = Button
// BUTTON NO CONFLICT
// ==================
$.fn.button.noConflict = function () {
$.fn.button = old
return this
}
// BUTTON DATA-API
// ===============
$(document).on('click.bs.button.data-api', '[data-toggle^=button]', function (e) {
var $btn = $(e.target)
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
$btn.button('toggle')
e.preventDefault()
})
}(jQuery);

View file

@ -1,217 +0,0 @@
/* ========================================================================
* Bootstrap: carousel.js v3.0.3
* http://getbootstrap.com/javascript/#carousel
* ========================================================================
* Copyright 2013 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ======================================================================== */
+function ($) { "use strict";
// CAROUSEL CLASS DEFINITION
// =========================
var Carousel = function (element, options) {
this.$element = $(element)
this.$indicators = this.$element.find('.carousel-indicators')
this.options = options
this.paused =
this.sliding =
this.interval =
this.$active =
this.$items = null
this.options.pause == 'hover' && this.$element
.on('mouseenter', $.proxy(this.pause, this))
.on('mouseleave', $.proxy(this.cycle, this))
}
Carousel.DEFAULTS = {
interval: 5000
, pause: 'hover'
, wrap: true
}
Carousel.prototype.cycle = function (e) {
e || (this.paused = false)
this.interval && clearInterval(this.interval)
this.options.interval
&& !this.paused
&& (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
return this
}
Carousel.prototype.getActiveIndex = function () {
this.$active = this.$element.find('.item.active')
this.$items = this.$active.parent().children()
return this.$items.index(this.$active)
}
Carousel.prototype.to = function (pos) {
var that = this
var activeIndex = this.getActiveIndex()
if (pos > (this.$items.length - 1) || pos < 0) return
if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) })
if (activeIndex == pos) return this.pause().cycle()
return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))
}
Carousel.prototype.pause = function (e) {
e || (this.paused = true)
if (this.$element.find('.next, .prev').length && $.support.transition.end) {
this.$element.trigger($.support.transition.end)
this.cycle(true)
}
this.interval = clearInterval(this.interval)
return this
}
Carousel.prototype.next = function () {
if (this.sliding) return
return this.slide('next')
}
Carousel.prototype.prev = function () {
if (this.sliding) return
return this.slide('prev')
}
Carousel.prototype.slide = function (type, next) {
var $active = this.$element.find('.item.active')
var $next = next || $active[type]()
var isCycling = this.interval
var direction = type == 'next' ? 'left' : 'right'
var fallback = type == 'next' ? 'first' : 'last'
var that = this
if (!$next.length) {
if (!this.options.wrap) return
$next = this.$element.find('.item')[fallback]()
}
this.sliding = true
isCycling && this.pause()
var e = $.Event('slide.bs.carousel', { relatedTarget: $next[0], direction: direction })
if ($next.hasClass('active')) return
if (this.$indicators.length) {
this.$indicators.find('.active').removeClass('active')
this.$element.one('slid.bs.carousel', function () {
var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()])
$nextIndicator && $nextIndicator.addClass('active')
})
}
if ($.support.transition && this.$element.hasClass('slide')) {
this.$element.trigger(e)
if (e.isDefaultPrevented()) return
$next.addClass(type)
$next[0].offsetWidth // force reflow
$active.addClass(direction)
$next.addClass(direction)
$active
.one($.support.transition.end, function () {
$next.removeClass([type, direction].join(' ')).addClass('active')
$active.removeClass(['active', direction].join(' '))
that.sliding = false
setTimeout(function () { that.$element.trigger('slid.bs.carousel') }, 0)
})
.emulateTransitionEnd(600)
} else {
this.$element.trigger(e)
if (e.isDefaultPrevented()) return
$active.removeClass('active')
$next.addClass('active')
this.sliding = false
this.$element.trigger('slid.bs.carousel')
}
isCycling && this.cycle()
return this
}
// CAROUSEL PLUGIN DEFINITION
// ==========================
var old = $.fn.carousel
$.fn.carousel = function (option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.carousel')
var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
var action = typeof option == 'string' ? option : options.slide
if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
if (typeof option == 'number') data.to(option)
else if (action) data[action]()
else if (options.interval) data.pause().cycle()
})
}
$.fn.carousel.Constructor = Carousel
// CAROUSEL NO CONFLICT
// ====================
$.fn.carousel.noConflict = function () {
$.fn.carousel = old
return this
}
// CAROUSEL DATA-API
// =================
$(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
var $this = $(this), href
var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
var options = $.extend({}, $target.data(), $this.data())
var slideIndex = $this.attr('data-slide-to')
if (slideIndex) options.interval = false
$target.carousel(options)
if (slideIndex = $this.attr('data-slide-to')) {
$target.data('bs.carousel').to(slideIndex)
}
e.preventDefault()
})
$(window).on('load', function () {
$('[data-ride="carousel"]').each(function () {
var $carousel = $(this)
$carousel.carousel($carousel.data())
})
})
}(jQuery);

View file

@ -1,179 +0,0 @@
/* ========================================================================
* Bootstrap: collapse.js v3.0.3
* http://getbootstrap.com/javascript/#collapse
* ========================================================================
* Copyright 2013 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ======================================================================== */
+function ($) { "use strict";
// COLLAPSE PUBLIC CLASS DEFINITION
// ================================
var Collapse = function (element, options) {
this.$element = $(element)
this.options = $.extend({}, Collapse.DEFAULTS, options)
this.transitioning = null
if (this.options.parent) this.$parent = $(this.options.parent)
if (this.options.toggle) this.toggle()
}
Collapse.DEFAULTS = {
toggle: true
}
Collapse.prototype.dimension = function () {
var hasWidth = this.$element.hasClass('width')
return hasWidth ? 'width' : 'height'
}
Collapse.prototype.show = function () {
if (this.transitioning || this.$element.hasClass('in')) return
var startEvent = $.Event('show.bs.collapse')
this.$element.trigger(startEvent)
if (startEvent.isDefaultPrevented()) return
var actives = this.$parent && this.$parent.find('> .panel > .in')
if (actives && actives.length) {
var hasData = actives.data('bs.collapse')
if (hasData && hasData.transitioning) return
actives.collapse('hide')
hasData || actives.data('bs.collapse', null)
}
var dimension = this.dimension()
this.$element
.removeClass('collapse')
.addClass('collapsing')
[dimension](0)
this.transitioning = 1
var complete = function () {
this.$element
.removeClass('collapsing')
.addClass('in')
[dimension]('auto')
this.transitioning = 0
this.$element.trigger('shown.bs.collapse')
}
if (!$.support.transition) return complete.call(this)
var scrollSize = $.camelCase(['scroll', dimension].join('-'))
this.$element
.one($.support.transition.end, $.proxy(complete, this))
.emulateTransitionEnd(350)
[dimension](this.$element[0][scrollSize])
}
Collapse.prototype.hide = function () {
if (this.transitioning || !this.$element.hasClass('in')) return
var startEvent = $.Event('hide.bs.collapse')
this.$element.trigger(startEvent)
if (startEvent.isDefaultPrevented()) return
var dimension = this.dimension()
this.$element
[dimension](this.$element[dimension]())
[0].offsetHeight
this.$element
.addClass('collapsing')
.removeClass('collapse')
.removeClass('in')
this.transitioning = 1
var complete = function () {
this.transitioning = 0
this.$element
.trigger('hidden.bs.collapse')
.removeClass('collapsing')
.addClass('collapse')
}
if (!$.support.transition) return complete.call(this)
this.$element
[dimension](0)
.one($.support.transition.end, $.proxy(complete, this))
.emulateTransitionEnd(350)
}
Collapse.prototype.toggle = function () {
this[this.$element.hasClass('in') ? 'hide' : 'show']()
}
// COLLAPSE PLUGIN DEFINITION
// ==========================
var old = $.fn.collapse
$.fn.collapse = function (option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.collapse')
var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
if (typeof option == 'string') data[option]()
})
}
$.fn.collapse.Constructor = Collapse
// COLLAPSE NO CONFLICT
// ====================
$.fn.collapse.noConflict = function () {
$.fn.collapse = old
return this
}
// COLLAPSE DATA-API
// =================
$(document).on('click.bs.collapse.data-api', '[data-toggle=collapse]', function (e) {
var $this = $(this), href
var target = $this.attr('data-target')
|| e.preventDefault()
|| (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
var $target = $(target)
var data = $target.data('bs.collapse')
var option = data ? 'toggle' : $this.data()
var parent = $this.attr('data-parent')
var $parent = parent && $(parent)
if (!data || !data.transitioning) {
if ($parent) $parent.find('[data-toggle=collapse][data-parent="' + parent + '"]').not($this).addClass('collapsed')
$this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
}
$target.collapse(option)
})
}(jQuery);

View file

@ -1,154 +0,0 @@
/* ========================================================================
* Bootstrap: dropdown.js v3.0.3
* http://getbootstrap.com/javascript/#dropdowns
* ========================================================================
* Copyright 2013 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ======================================================================== */
+function ($) { "use strict";
// DROPDOWN CLASS DEFINITION
// =========================
var backdrop = '.dropdown-backdrop'
var toggle = '[data-toggle=dropdown]'
var Dropdown = function (element) {
$(element).on('click.bs.dropdown', this.toggle)
}
Dropdown.prototype.toggle = function (e) {
var $this = $(this)
if ($this.is('.disabled, :disabled')) return
var $parent = getParent($this)
var isActive = $parent.hasClass('open')
clearMenus()
if (!isActive) {
if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
// if mobile we use a backdrop because click events don't delegate
$('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
}
$parent.trigger(e = $.Event('show.bs.dropdown'))
if (e.isDefaultPrevented()) return
$parent
.toggleClass('open')
.trigger('shown.bs.dropdown')
$this.focus()
}
return false
}
Dropdown.prototype.keydown = function (e) {
if (!/(38|40|27)/.test(e.keyCode)) return
var $this = $(this)
e.preventDefault()
e.stopPropagation()
if ($this.is('.disabled, :disabled')) return
var $parent = getParent($this)
var isActive = $parent.hasClass('open')
if (!isActive || (isActive && e.keyCode == 27)) {
if (e.which == 27) $parent.find(toggle).focus()
return $this.click()
}
var $items = $('[role=menu] li:not(.divider):visible a', $parent)
if (!$items.length) return
var index = $items.index($items.filter(':focus'))
if (e.keyCode == 38 && index > 0) index-- // up
if (e.keyCode == 40 && index < $items.length - 1) index++ // down
if (!~index) index=0
$items.eq(index).focus()
}
function clearMenus() {
$(backdrop).remove()
$(toggle).each(function (e) {
var $parent = getParent($(this))
if (!$parent.hasClass('open')) return
$parent.trigger(e = $.Event('hide.bs.dropdown'))
if (e.isDefaultPrevented()) return
$parent.removeClass('open').trigger('hidden.bs.dropdown')
})
}
function getParent($this) {
var selector = $this.attr('data-target')
if (!selector) {
selector = $this.attr('href')
selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
}
var $parent = selector && $(selector)
return $parent && $parent.length ? $parent : $this.parent()
}
// DROPDOWN PLUGIN DEFINITION
// ==========================
var old = $.fn.dropdown
$.fn.dropdown = function (option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.dropdown')
if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
if (typeof option == 'string') data[option].call($this)
})
}
$.fn.dropdown.Constructor = Dropdown
// DROPDOWN NO CONFLICT
// ====================
$.fn.dropdown.noConflict = function () {
$.fn.dropdown = old
return this
}
// APPLY TO STANDARD DROPDOWN ELEMENTS
// ===================================
$(document)
.on('click.bs.dropdown.data-api', clearMenus)
.on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
.on('click.bs.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
.on('keydown.bs.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
}(jQuery);

View file

@ -1,246 +0,0 @@
/* ========================================================================
* Bootstrap: modal.js v3.0.3
* http://getbootstrap.com/javascript/#modals
* ========================================================================
* Copyright 2013 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ======================================================================== */
+function ($) { "use strict";
// MODAL CLASS DEFINITION
// ======================
var Modal = function (element, options) {
this.options = options
this.$element = $(element)
this.$backdrop =
this.isShown = null
if (this.options.remote) this.$element.load(this.options.remote)
}
Modal.DEFAULTS = {
backdrop: true
, keyboard: true
, show: true
}
Modal.prototype.toggle = function (_relatedTarget) {
return this[!this.isShown ? 'show' : 'hide'](_relatedTarget)
}
Modal.prototype.show = function (_relatedTarget) {
var that = this
var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
this.$element.trigger(e)
if (this.isShown || e.isDefaultPrevented()) return
this.isShown = true
this.escape()
this.$element.on('click.dismiss.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
this.backdrop(function () {
var transition = $.support.transition && that.$element.hasClass('fade')
if (!that.$element.parent().length) {
that.$element.appendTo(document.body) // don't move modals dom position
}
that.$element.show()
if (transition) {
that.$element[0].offsetWidth // force reflow
}
that.$element
.addClass('in')
.attr('aria-hidden', false)
that.enforceFocus()
var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
transition ?
that.$element.find('.modal-dialog') // wait for modal to slide in
.one($.support.transition.end, function () {
that.$element.focus().trigger(e)
})
.emulateTransitionEnd(300) :
that.$element.focus().trigger(e)
})
}
Modal.prototype.hide = function (e) {
if (e) e.preventDefault()
e = $.Event('hide.bs.modal')
this.$element.trigger(e)
if (!this.isShown || e.isDefaultPrevented()) return
this.isShown = false
this.escape()
$(document).off('focusin.bs.modal')
this.$element
.removeClass('in')
.attr('aria-hidden', true)
.off('click.dismiss.modal')
$.support.transition && this.$element.hasClass('fade') ?
this.$element
.one($.support.transition.end, $.proxy(this.hideModal, this))
.emulateTransitionEnd(300) :
this.hideModal()
}
Modal.prototype.enforceFocus = function () {
$(document)
.off('focusin.bs.modal') // guard against infinite focus loop
.on('focusin.bs.modal', $.proxy(function (e) {
if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
this.$element.focus()
}
}, this))
}
Modal.prototype.escape = function () {
if (this.isShown && this.options.keyboard) {
this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) {
e.which == 27 && this.hide()
}, this))
} else if (!this.isShown) {
this.$element.off('keyup.dismiss.bs.modal')
}
}
Modal.prototype.hideModal = function () {
var that = this
this.$element.hide()
this.backdrop(function () {
that.removeBackdrop()
that.$element.trigger('hidden.bs.modal')
})
}
Modal.prototype.removeBackdrop = function () {
this.$backdrop && this.$backdrop.remove()
this.$backdrop = null
}
Modal.prototype.backdrop = function (callback) {
var that = this
var animate = this.$element.hasClass('fade') ? 'fade' : ''
if (this.isShown && this.options.backdrop) {
var doAnimate = $.support.transition && animate
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
.appendTo(document.body)
this.$element.on('click.dismiss.modal', $.proxy(function (e) {
if (e.target !== e.currentTarget) return
this.options.backdrop == 'static'
? this.$element[0].focus.call(this.$element[0])
: this.hide.call(this)
}, this))
if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
this.$backdrop.addClass('in')
if (!callback) return
doAnimate ?
this.$backdrop
.one($.support.transition.end, callback)
.emulateTransitionEnd(150) :
callback()
} else if (!this.isShown && this.$backdrop) {
this.$backdrop.removeClass('in')
$.support.transition && this.$element.hasClass('fade')?
this.$backdrop
.one($.support.transition.end, callback)
.emulateTransitionEnd(150) :
callback()
} else if (callback) {
callback()
}
}
// MODAL PLUGIN DEFINITION
// =======================
var old = $.fn.modal
$.fn.modal = function (option, _relatedTarget) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.modal')
var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
if (typeof option == 'string') data[option](_relatedTarget)
else if (options.show) data.show(_relatedTarget)
})
}
$.fn.modal.Constructor = Modal
// MODAL NO CONFLICT
// =================
$.fn.modal.noConflict = function () {
$.fn.modal = old
return this
}
// MODAL DATA-API
// ==============
$(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
var $this = $(this)
var href = $this.attr('href')
var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
var option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
e.preventDefault()
$target
.modal(option, this)
.one('hide', function () {
$this.is(':visible') && $this.focus()
})
})
$(document)
.on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') })
.on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') })
}(jQuery);

View file

@ -1,117 +0,0 @@
/* ========================================================================
* Bootstrap: popover.js v3.0.3
* http://getbootstrap.com/javascript/#popovers
* ========================================================================
* Copyright 2013 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ======================================================================== */
+function ($) { "use strict";
// POPOVER PUBLIC CLASS DEFINITION
// ===============================
var Popover = function (element, options) {
this.init('popover', element, options)
}
if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
Popover.DEFAULTS = $.extend({} , $.fn.tooltip.Constructor.DEFAULTS, {
placement: 'right'
, trigger: 'click'
, content: ''
, template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
})
// NOTE: POPOVER EXTENDS tooltip.js
// ================================
Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
Popover.prototype.constructor = Popover
Popover.prototype.getDefaults = function () {
return Popover.DEFAULTS
}
Popover.prototype.setContent = function () {
var $tip = this.tip()
var title = this.getTitle()
var content = this.getContent()
$tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
$tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content)
$tip.removeClass('fade top bottom left right in')
// IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
// this manually by checking the contents.
if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
}
Popover.prototype.hasContent = function () {
return this.getTitle() || this.getContent()
}
Popover.prototype.getContent = function () {
var $e = this.$element
var o = this.options
return $e.attr('data-content')
|| (typeof o.content == 'function' ?
o.content.call($e[0]) :
o.content)
}
Popover.prototype.arrow = function () {
return this.$arrow = this.$arrow || this.tip().find('.arrow')
}
Popover.prototype.tip = function () {
if (!this.$tip) this.$tip = $(this.options.template)
return this.$tip
}
// POPOVER PLUGIN DEFINITION
// =========================
var old = $.fn.popover
$.fn.popover = function (option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.popover')
var options = typeof option == 'object' && option
if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
if (typeof option == 'string') data[option]()
})
}
$.fn.popover.Constructor = Popover
// POPOVER NO CONFLICT
// ===================
$.fn.popover.noConflict = function () {
$.fn.popover = old
return this
}
}(jQuery);

View file

@ -1,158 +0,0 @@
/* ========================================================================
* Bootstrap: scrollspy.js v3.0.3
* http://getbootstrap.com/javascript/#scrollspy
* ========================================================================
* Copyright 2013 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ======================================================================== */
+function ($) { "use strict";
// SCROLLSPY CLASS DEFINITION
// ==========================
function ScrollSpy(element, options) {
var href
var process = $.proxy(this.process, this)
this.$element = $(element).is('body') ? $(window) : $(element)
this.$body = $('body')
this.$scrollElement = this.$element.on('scroll.bs.scroll-spy.data-api', process)
this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
this.selector = (this.options.target
|| ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|| '') + ' .nav li > a'
this.offsets = $([])
this.targets = $([])
this.activeTarget = null
this.refresh()
this.process()
}
ScrollSpy.DEFAULTS = {
offset: 10
}
ScrollSpy.prototype.refresh = function () {
var offsetMethod = this.$element[0] == window ? 'offset' : 'position'
this.offsets = $([])
this.targets = $([])
var self = this
var $targets = this.$body
.find(this.selector)
.map(function () {
var $el = $(this)
var href = $el.data('target') || $el.attr('href')
var $href = /^#\w/.test(href) && $(href)
return ($href
&& $href.length
&& [[ $href[offsetMethod]().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]]) || null
})
.sort(function (a, b) { return a[0] - b[0] })
.each(function () {
self.offsets.push(this[0])
self.targets.push(this[1])
})
}
ScrollSpy.prototype.process = function () {
var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
var scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
var maxScroll = scrollHeight - this.$scrollElement.height()
var offsets = this.offsets
var targets = this.targets
var activeTarget = this.activeTarget
var i
if (scrollTop >= maxScroll) {
return activeTarget != (i = targets.last()[0]) && this.activate(i)
}
for (i = offsets.length; i--;) {
activeTarget != targets[i]
&& scrollTop >= offsets[i]
&& (!offsets[i + 1] || scrollTop <= offsets[i + 1])
&& this.activate( targets[i] )
}
}
ScrollSpy.prototype.activate = function (target) {
this.activeTarget = target
$(this.selector)
.parents('.active')
.removeClass('active')
var selector = this.selector
+ '[data-target="' + target + '"],'
+ this.selector + '[href="' + target + '"]'
var active = $(selector)
.parents('li')
.addClass('active')
if (active.parent('.dropdown-menu').length) {
active = active
.closest('li.dropdown')
.addClass('active')
}
active.trigger('activate.bs.scrollspy')
}
// SCROLLSPY PLUGIN DEFINITION
// ===========================
var old = $.fn.scrollspy
$.fn.scrollspy = function (option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.scrollspy')
var options = typeof option == 'object' && option
if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
if (typeof option == 'string') data[option]()
})
}
$.fn.scrollspy.Constructor = ScrollSpy
// SCROLLSPY NO CONFLICT
// =====================
$.fn.scrollspy.noConflict = function () {
$.fn.scrollspy = old
return this
}
// SCROLLSPY DATA-API
// ==================
$(window).on('load', function () {
$('[data-spy="scroll"]').each(function () {
var $spy = $(this)
$spy.scrollspy($spy.data())
})
})
}(jQuery);

View file

@ -1,135 +0,0 @@
/* ========================================================================
* Bootstrap: tab.js v3.0.3
* http://getbootstrap.com/javascript/#tabs
* ========================================================================
* Copyright 2013 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ======================================================================== */
+function ($) { "use strict";
// TAB CLASS DEFINITION
// ====================
var Tab = function (element) {
this.element = $(element)
}
Tab.prototype.show = function () {
var $this = this.element
var $ul = $this.closest('ul:not(.dropdown-menu)')
var selector = $this.data('target')
if (!selector) {
selector = $this.attr('href')
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
}
if ($this.parent('li').hasClass('active')) return
var previous = $ul.find('.active:last a')[0]
var e = $.Event('show.bs.tab', {
relatedTarget: previous
})
$this.trigger(e)
if (e.isDefaultPrevented()) return
var $target = $(selector)
this.activate($this.parent('li'), $ul)
this.activate($target, $target.parent(), function () {
$this.trigger({
type: 'shown.bs.tab'
, relatedTarget: previous
})
})
}
Tab.prototype.activate = function (element, container, callback) {
var $active = container.find('> .active')
var transition = callback
&& $.support.transition
&& $active.hasClass('fade')
function next() {
$active
.removeClass('active')
.find('> .dropdown-menu > .active')
.removeClass('active')
element.addClass('active')
if (transition) {
element[0].offsetWidth // reflow for transition
element.addClass('in')
} else {
element.removeClass('fade')
}
if (element.parent('.dropdown-menu')) {
element.closest('li.dropdown').addClass('active')
}
callback && callback()
}
transition ?
$active
.one($.support.transition.end, next)
.emulateTransitionEnd(150) :
next()
$active.removeClass('in')
}
// TAB PLUGIN DEFINITION
// =====================
var old = $.fn.tab
$.fn.tab = function ( option ) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.tab')
if (!data) $this.data('bs.tab', (data = new Tab(this)))
if (typeof option == 'string') data[option]()
})
}
$.fn.tab.Constructor = Tab
// TAB NO CONFLICT
// ===============
$.fn.tab.noConflict = function () {
$.fn.tab = old
return this
}
// TAB DATA-API
// ============
$(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
e.preventDefault()
$(this).tab('show')
})
}(jQuery);

View file

@ -1,386 +0,0 @@
/* ========================================================================
* Bootstrap: tooltip.js v3.0.3
* http://getbootstrap.com/javascript/#tooltip
* Inspired by the original jQuery.tipsy by Jason Frame
* ========================================================================
* Copyright 2013 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ======================================================================== */
+function ($) { "use strict";
// TOOLTIP PUBLIC CLASS DEFINITION
// ===============================
var Tooltip = function (element, options) {
this.type =
this.options =
this.enabled =
this.timeout =
this.hoverState =
this.$element = null
this.init('tooltip', element, options)
}
Tooltip.DEFAULTS = {
animation: true
, placement: 'top'
, selector: false
, template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
, trigger: 'hover focus'
, title: ''
, delay: 0
, html: false
, container: false
}
Tooltip.prototype.init = function (type, element, options) {
this.enabled = true
this.type = type
this.$element = $(element)
this.options = this.getOptions(options)
var triggers = this.options.trigger.split(' ')
for (var i = triggers.length; i--;) {
var trigger = triggers[i]
if (trigger == 'click') {
this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
} else if (trigger != 'manual') {
var eventIn = trigger == 'hover' ? 'mouseenter' : 'focus'
var eventOut = trigger == 'hover' ? 'mouseleave' : 'blur'
this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
}
}
this.options.selector ?
(this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
this.fixTitle()
}
Tooltip.prototype.getDefaults = function () {
return Tooltip.DEFAULTS
}
Tooltip.prototype.getOptions = function (options) {
options = $.extend({}, this.getDefaults(), this.$element.data(), options)
if (options.delay && typeof options.delay == 'number') {
options.delay = {
show: options.delay
, hide: options.delay
}
}
return options
}
Tooltip.prototype.getDelegateOptions = function () {
var options = {}
var defaults = this.getDefaults()
this._options && $.each(this._options, function (key, value) {
if (defaults[key] != value) options[key] = value
})
return options
}
Tooltip.prototype.enter = function (obj) {
var self = obj instanceof this.constructor ?
obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
clearTimeout(self.timeout)
self.hoverState = 'in'
if (!self.options.delay || !self.options.delay.show) return self.show()
self.timeout = setTimeout(function () {
if (self.hoverState == 'in') self.show()
}, self.options.delay.show)
}
Tooltip.prototype.leave = function (obj) {
var self = obj instanceof this.constructor ?
obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
clearTimeout(self.timeout)
self.hoverState = 'out'
if (!self.options.delay || !self.options.delay.hide) return self.hide()
self.timeout = setTimeout(function () {
if (self.hoverState == 'out') self.hide()
}, self.options.delay.hide)
}
Tooltip.prototype.show = function () {
var e = $.Event('show.bs.'+ this.type)
if (this.hasContent() && this.enabled) {
this.$element.trigger(e)
if (e.isDefaultPrevented()) return
var $tip = this.tip()
this.setContent()
if (this.options.animation) $tip.addClass('fade')
var placement = typeof this.options.placement == 'function' ?
this.options.placement.call(this, $tip[0], this.$element[0]) :
this.options.placement
var autoToken = /\s?auto?\s?/i
var autoPlace = autoToken.test(placement)
if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
$tip
.detach()
.css({ top: 0, left: 0, display: 'block' })
.addClass(placement)
this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
var pos = this.getPosition()
var actualWidth = $tip[0].offsetWidth
var actualHeight = $tip[0].offsetHeight
if (autoPlace) {
var $parent = this.$element.parent()
var orgPlacement = placement
var docScroll = document.documentElement.scrollTop || document.body.scrollTop
var parentWidth = this.options.container == 'body' ? window.innerWidth : $parent.outerWidth()
var parentHeight = this.options.container == 'body' ? window.innerHeight : $parent.outerHeight()
var parentLeft = this.options.container == 'body' ? 0 : $parent.offset().left
placement = placement == 'bottom' && pos.top + pos.height + actualHeight - docScroll > parentHeight ? 'top' :
placement == 'top' && pos.top - docScroll - actualHeight < 0 ? 'bottom' :
placement == 'right' && pos.right + actualWidth > parentWidth ? 'left' :
placement == 'left' && pos.left - actualWidth < parentLeft ? 'right' :
placement
$tip
.removeClass(orgPlacement)
.addClass(placement)
}
var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
this.applyPlacement(calculatedOffset, placement)
this.$element.trigger('shown.bs.' + this.type)
}
}
Tooltip.prototype.applyPlacement = function(offset, placement) {
var replace
var $tip = this.tip()
var width = $tip[0].offsetWidth
var height = $tip[0].offsetHeight
// manually read margins because getBoundingClientRect includes difference
var marginTop = parseInt($tip.css('margin-top'), 10)
var marginLeft = parseInt($tip.css('margin-left'), 10)
// we must check for NaN for ie 8/9
if (isNaN(marginTop)) marginTop = 0
if (isNaN(marginLeft)) marginLeft = 0
offset.top = offset.top + marginTop
offset.left = offset.left + marginLeft
$tip
.offset(offset)
.addClass('in')
// check to see if placing tip in new offset caused the tip to resize itself
var actualWidth = $tip[0].offsetWidth
var actualHeight = $tip[0].offsetHeight
if (placement == 'top' && actualHeight != height) {
replace = true
offset.top = offset.top + height - actualHeight
}
if (/bottom|top/.test(placement)) {
var delta = 0
if (offset.left < 0) {
delta = offset.left * -2
offset.left = 0
$tip.offset(offset)
actualWidth = $tip[0].offsetWidth
actualHeight = $tip[0].offsetHeight
}
this.replaceArrow(delta - width + actualWidth, actualWidth, 'left')
} else {
this.replaceArrow(actualHeight - height, actualHeight, 'top')
}
if (replace) $tip.offset(offset)
}
Tooltip.prototype.replaceArrow = function(delta, dimension, position) {
this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + "%") : '')
}
Tooltip.prototype.setContent = function () {
var $tip = this.tip()
var title = this.getTitle()
$tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
$tip.removeClass('fade in top bottom left right')
}
Tooltip.prototype.hide = function () {
var that = this
var $tip = this.tip()
var e = $.Event('hide.bs.' + this.type)
function complete() {
if (that.hoverState != 'in') $tip.detach()
}
this.$element.trigger(e)
if (e.isDefaultPrevented()) return
$tip.removeClass('in')
$.support.transition && this.$tip.hasClass('fade') ?
$tip
.one($.support.transition.end, complete)
.emulateTransitionEnd(150) :
complete()
this.$element.trigger('hidden.bs.' + this.type)
return this
}
Tooltip.prototype.fixTitle = function () {
var $e = this.$element
if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
$e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
}
}
Tooltip.prototype.hasContent = function () {
return this.getTitle()
}
Tooltip.prototype.getPosition = function () {
var el = this.$element[0]
return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : {
width: el.offsetWidth
, height: el.offsetHeight
}, this.$element.offset())
}
Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
/* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
}
Tooltip.prototype.getTitle = function () {
var title
var $e = this.$element
var o = this.options
title = $e.attr('data-original-title')
|| (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
return title
}
Tooltip.prototype.tip = function () {
return this.$tip = this.$tip || $(this.options.template)
}
Tooltip.prototype.arrow = function () {
return this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')
}
Tooltip.prototype.validate = function () {
if (!this.$element[0].parentNode) {
this.hide()
this.$element = null
this.options = null
}
}
Tooltip.prototype.enable = function () {
this.enabled = true
}
Tooltip.prototype.disable = function () {
this.enabled = false
}
Tooltip.prototype.toggleEnabled = function () {
this.enabled = !this.enabled
}
Tooltip.prototype.toggle = function (e) {
var self = e ? $(e.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type) : this
self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
}
Tooltip.prototype.destroy = function () {
this.hide().$element.off('.' + this.type).removeData('bs.' + this.type)
}
// TOOLTIP PLUGIN DEFINITION
// =========================
var old = $.fn.tooltip
$.fn.tooltip = function (option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.tooltip')
var options = typeof option == 'object' && option
if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
if (typeof option == 'string') data[option]()
})
}
$.fn.tooltip.Constructor = Tooltip
// TOOLTIP NO CONFLICT
// ===================
$.fn.tooltip.noConflict = function () {
$.fn.tooltip = old
return this
}
}(jQuery);

View file

@ -1,56 +0,0 @@
/* ========================================================================
* Bootstrap: transition.js v3.0.3
* http://getbootstrap.com/javascript/#transitions
* ========================================================================
* Copyright 2013 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ======================================================================== */
+function ($) { "use strict";
// CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
// ============================================================
function transitionEnd() {
var el = document.createElement('bootstrap')
var transEndEventNames = {
'WebkitTransition' : 'webkitTransitionEnd'
, 'MozTransition' : 'transitionend'
, 'OTransition' : 'oTransitionEnd otransitionend'
, 'transition' : 'transitionend'
}
for (var name in transEndEventNames) {
if (el.style[name] !== undefined) {
return { end: transEndEventNames[name] }
}
}
}
// http://blog.alexmaccaw.com/css-transitions
$.fn.emulateTransitionEnd = function (duration) {
var called = false, $el = this
$(this).one($.support.transition.end, function () { called = true })
var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
setTimeout(callback, duration)
return this
}
$(function () {
$.support.transition = transitionEnd()
})
}(jQuery);

3430
vendor/scripts/treema.js vendored

File diff suppressed because it is too large Load diff

View file

@ -1,299 +0,0 @@
@media -sass-debug-info{filename{}line{font-family:\000033}}
.treema-node {
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
position: relative;
font-family: Helvetica;
clear: both;
border-bottom: 1px solid #cccccc;
font-size: 13px;
cursor: pointer; }
@media -sass-debug-info{filename{}line{font-family:\0000315}}
.treema-node.treema-root > .treema-row .treema-value {
display: none; }
@media -sass-debug-info{filename{}line{font-family:\0000318}}
.treema-node.treema-open > .treema-children {
padding-top: 1px; }
@media -sass-debug-info{filename{}line{font-family:\0000321}}
.treema-node.treema-root {
outline: none; }
@media -sass-debug-info{filename{}line{font-family:\0000325}}
.treema-node input, .treema-node select {
font-size: 13px;
font-family: Helvetica; }
@media -sass-debug-info{filename{}line{font-family:\0000328}}
.treema-node input {
margin: -3px 0;
width: 200px; }
@media -sass-debug-info{filename{}line{font-family:\0000331}}
.treema-node select {
height: inherit;
margin: 0;
width: inherit; }
@media -sass-debug-info{filename{}line{font-family:\0000336}}
.treema-type-select-container, .treema-schema-select-container {
display: block;
position: relative;
margin-right: 5px;
top: 1px;
float: left; }
@media -sass-debug-info{filename{}line{font-family:\0000343}}
.treema-type-select-container select, .treema-schema-select-container select {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
opacity: 0.01;
width: inherit !important; }
@media -sass-debug-info{filename{}line{font-family:\0000354}}
.treema-type-select-container button, .treema-schema-select-container button {
font-size: 10px;
padding: 0 3px;
width: 19px; }
@media -sass-debug-info{filename{}line{font-family:\0000359}}
.treema-children {
margin-left: 15px;
clear: both; }
@media -sass-debug-info{filename{}line{font-family:\0000363}}
.treema-add-child {
background-color: #eeeeff;
border: 1px solid #aaaaff;
cursor: pointer;
display: inline-block;
margin: 3px 0 10px;
padding: 0px 5px;
font-weight: bold;
position: relative;
left: -10px; }
@media -sass-debug-info{filename{}line{font-family:\0000374}}
.treema-add-child:hover {
background-color: #ccccff; }
@media -sass-debug-info{filename{}line{font-family:\0000377}}
.treema-full > .treema-children > .treema-add-child {
display: none; }
@media -sass-debug-info{filename{}line{font-family:\0000380}}
.treema-full.treema-open > .treema-children {
margin-bottom: 5px; }
@media -sass-debug-info{filename{}line{font-family:\0000383}}
.treema-row {
padding: 2px 3px 2px 3px; }
@media -sass-debug-info{filename{}line{font-family:\0000386}}
.treema-value {
cursor: text;
display: block;
float: left;
max-width: 100%; }
@media -sass-debug-info{filename{}line{font-family:\0000392}}
.treema-key {
color: #5353ac;
float: left;
display: block;
cursor: pointer;
margin-right: 5px; }
@media -sass-debug-info{filename{}line{font-family:\0000399}}
.treema-backdrop {
position: absolute;
top: 0;
left: 0;
height: 25px;
background-color: rgba(64, 128, 255, 0);
pointer-events: none;
width: 100%;
cursor: pointer; }
@media -sass-debug-info{filename{}line{font-family:\00003109}}
.treema-description {
float: right;
opacity: 0.8;
font-size: 11px;
line-height: 13px;
min-width: 200px;
text-align: right;
display: none; }
@media -sass-debug-info{filename{}line{font-family:\00003118}}
.treema-selected > .treema-row > .treema-description {
display: inline; }
@media -sass-debug-info{filename{}line{font-family:\00003121}}
.treema-edit + .treema-description {
display: inline; }
@media -sass-debug-info{filename{}line{font-family:\00003124}}
.treema-selected > .treema-row {
background-color: rgba(64, 128, 255, 0.25); }
@media -sass-debug-info{filename{}line{font-family:\00003129}}
.treema-error {
float: right;
color: darkred;
margin: 2px 10px; }
@media -sass-debug-info{filename{}line{font-family:\00003134}}
.treema-has-error {
background-color: lightpink;
border: 1px solid darkred; }
@media -sass-debug-info{filename{}line{font-family:\00003138}}
.treema-temp-error {
background-color: lightpink;
padding: 2px 3px;
color: darkred;
margin: 0 5px;
border: 1px solid darkred; }
@media -sass-debug-info{filename{}line{font-family:\00003148}}
.treema-toggle-hit-area {
cursor: pointer;
width: 15px;
float: left;
position: absolute;
left: -15px;
top: 0;
bottom: 0; }
@media -sass-debug-info{filename{}line{font-family:\00003157}}
.treema-toggle-hit-area:hover {
background-color: rgba(128, 128, 128, 0.1); }
@media -sass-debug-info{filename{}line{font-family:\00003159}}
.treema-toggle-hit-area:hover .treema-toggle {
opacity: 1; }
@media -sass-debug-info{filename{}line{font-family:\00003162}}
.treema-toggle-hit-area .treema-toggle {
width: 0;
height: 0;
opacity: 0.7;
position: absolute; }
@media -sass-debug-info{filename{}line{font-family:\00003168}}
.treema-closed > .treema-toggle-hit-area .treema-toggle {
border-top: 6px solid transparent;
border-bottom: 6px solid transparent;
border-left: 8px solid #666666;
top: 5px;
left: 5px; }
@media -sass-debug-info{filename{}line{font-family:\00003175}}
.treema-open > .treema-toggle-hit-area .treema-toggle {
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-top: 8px solid #666666;
top: 7px;
left: 3px; }
@media -sass-debug-info{filename{}line{font-family:\00003183}}
.treema-clearfix:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden; }
@media -sass-debug-info{filename{}line{font-family:\00003190}}
.treema-shortened {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap; }
@media -sass-debug-info{filename{}line{font-family:\00003195}}
.treema-multiline {
width: inherit;
margin-top: 20px;
float: none !important; }
@media -sass-debug-info{filename{}line{font-family:\00003201}}
.treema-clipboard-container {
position: fixed;
left: 0px;
top: 0px;
width: 0px;
height: 0px;
z-index: 100;
display: none;
opacity: 0; }
@media -sass-debug-info{filename{}line{font-family:\00003211}}
.treema-clipboard-container .treema-clipboard {
width: 1px;
height: 1px;
padding: 0px; }
@media -sass-debug-info{filename{}line{font-family:\000033}}
.treema-string {
color: #998500; }
@media -sass-debug-info{filename{}line{font-family:\000036}}
.treema-number {
color: #699900; }
@media -sass-debug-info{filename{}line{font-family:\000039}}
.treema-null {
color: #524059;
font-weight: bold; }
@media -sass-debug-info{filename{}line{font-family:\0000313}}
.treema-array {
color: #009905;
cursor: row-resize; }
@media -sass-debug-info{filename{}line{font-family:\0000317}}
.treema-object {
color: #008799;
cursor: row-resize; }
@media -sass-debug-info{filename{}line{font-family:\0000321}}
.treema-boolean {
color: #140099;
cursor: pointer; }
@media -sass-debug-info{filename{}line{font-family:\0000324}}
.treema-boolean.treema-edit {
background-color: rgba(64, 128, 255, 0.25); }
@media -sass-debug-info{filename{}line{font-family:\0000326}}
.treema-boolean input {
opacity: 0; }
@media -sass-debug-info{filename{}line{font-family:\0000329}}
.treema-boolean:hover + .treema-description {
display: inline; }
@media -sass-debug-info{filename{}line{font-family:\000034}}
.treema-point2d input, .treema-point3d input {
width: 40px; }
@media -sass-debug-info{filename{}line{font-family:\000037}}
.treema-search-results {
width: 500px;
margin-top: 10px;
cursor: pointer; }
@media -sass-debug-info{filename{}line{font-family:\0000312}}
.treema-search-result-row:hover {
background-color: rgba(166, 196, 255, 0.25); }
@media -sass-debug-info{filename{}line{font-family:\0000315}}
.treema-search-selected {
background-color: rgba(64, 128, 255, 0.25) !important; }
@media -sass-debug-info{filename{}line{font-family:\0000318}}
.treema-ace.treema-display .treema-shortened {
font-family: monospace; }
@media -sass-debug-info{filename{}line{font-family:\0000321}}
.treema-ace.treema-edit .ace_editor {
width: 100%;
height: 300px;
border: 1px solid gray; }
@media -sass-debug-info{filename{}line{font-family:\0000327}}
.treema-long-string textarea {
width: 100%;
height: 300px; }
/*@ sourceMappingURL=treema.css.map*/