pull in some changes from private branch

This commit is contained in:
Tyler Renelle
2012-09-06 15:33:06 -04:00
parent da6b3d32af
commit 9fd4367a8a
5 changed files with 16 additions and 31 deletions

View File

@@ -71,8 +71,9 @@ get('/:uidParam?', function(page, model, _arg, next) {
});
ready(function(model) {
var poormanscron, setupSortable, step, tour, type, _i, _j, _len, _len1, _ref1, _ref2;
$('#purl-link').val(window.location.toString() + model.get('_userId'));
var pathParts, poormanscron, setupSortable, step, tour, type, _i, _j, _len, _len1, _ref1, _ref2;
pathParts = window.location.toString().split('/');
$('#purl').val("" + pathParts[0] + "//" + pathParts[2] + "/" + (model.get('_userId')));
$('[rel=tooltip]').tooltip();
$('[rel=popover]').popover();
model.on('set', '*', function() {
@@ -278,7 +279,7 @@ ready(function(model) {
return chart.draw(data, options);
};
exports.buyItem = function(e, el, next) {
var hp, index, money, task, taskId, user, value, _ref3, _results;
var hp, index, money, user, value, _ref3;
user = model.at('_user');
money = user.get('stats.money');
_ref3 = [$(el).attr('data-type'), $(el).attr('data-value'), $(el).attr('data-index')], type = _ref3[0], value = _ref3[1], index = _ref3[2];
@@ -299,17 +300,6 @@ ready(function(model) {
hp = 50;
}
return user.set('stats.hp', hp);
} else if (type === 'reroll') {
_results = [];
for (taskId in user.get('tasks')) {
task = model.at('_user.tasks.' + taskId);
if (task.get('type') !== 'reward') {
_results.push(task.set('value', 0));
} else {
_results.push(void 0);
}
}
return _results;
}
};
exports.vote = function(e, el, next) {

View File

@@ -66,13 +66,13 @@ habitrpgMiddleware = function(req, res, next) {
expressApp.use(express.favicon()).use(gzippo.staticGzip(publicPath, {
maxAge: ONE_YEAR
})).use(express.compress()).use(express.cookieParser()).use(store.sessionMiddleware({
})).use(express.compress()).use(express.bodyParser()).use(express.cookieParser()).use(store.sessionMiddleware({
secret: process.env.SESSION_SECRET || 'YOUR SECRET HERE',
cookie: {
maxAge: ONE_YEAR
},
store: new MongoStore({
db: 'habitrpg'
url: process.env.NODE_DB_URI
})
})).use(store.modelMiddleware()).use(habitrpgMiddleware).use(app.router()).use(expressApp.router).use(serverError(root));

View File

@@ -63,11 +63,11 @@ get '/:uidParam?', (page, model, {uidParam}, next) ->
# ========== CONTROLLER FUNCTIONS ==========
ready (model) ->
# TODO should all UI stuff be placed in this.on('render',function(){}) ? see chat example
# FIXME weirdest thing: doing model.set('_purl',...) and binding {_purl} in the view does not work
$('#purl-link').val(window.location.toString() + model.get('_userId'))
# protocol+host+port = window.location.origin, only webkit. stupid.
# also, {_purl} in template won't register, have to use $().val something is messed up
pathParts = window.location.toString().split('/')
$('#purl').val "#{pathParts[0]}//#{pathParts[2]}/#{model.get('_userId')}"
$('[rel=tooltip]').tooltip()
$('[rel=popover]').popover()
@@ -246,12 +246,7 @@ ready (model) ->
hp += 15
hp = 50 if hp > 50
user.set 'stats.hp', hp
else if type == 'reroll'
for taskId of user.get('tasks')
task = model.at('_user.tasks.'+taskId)
task.set('value', 0) unless task.get('type')=='reward'
exports.vote = (e, el, next) ->
direction = $(el).attr('data-direction')
direction = 'up' if direction == 'true/'

View File

@@ -63,7 +63,7 @@ expressApp
.use(express.compress())
# Uncomment to add form data parsing support
# .use(express.bodyParser())
.use(express.bodyParser())
# .use(express.methodOverride())
# Uncomment and supply secret to add Derby session handling
@@ -72,7 +72,7 @@ expressApp
.use(store.sessionMiddleware
secret: process.env.SESSION_SECRET || 'YOUR SECRET HERE'
cookie: {maxAge: ONE_YEAR}
store: new MongoStore(db: 'habitrpg')
store: new MongoStore(url: process.env.NODE_DB_URI)
)
# Adds req.getModel method

View File

@@ -17,7 +17,7 @@
<p>Authentication isn't yet available (<a href="https://github.com/lefnire/habitrpg#how-do-i-log-in--save-my-data">follow progress here</a>),<br/>
In the meantime a persistent URL can be used accross <br/>
browsers to access your data. Bookmark the following URL.</p>
<input id="purl-link" type=text class=input-xlarge value="" />
<input id='purl' type=text class=input-xlarge value="" />
</div>
</div>
@@ -135,7 +135,7 @@
{#with _items.armor as :item}<app:item />{/}
{#with _items.weapon as :item}<app:item />{/}
{#with _items.potion as :item}<app:item />{/}
{#with _items.reroll as :item}<app:item />{/}
{#with _items.reroll as :item}<app:item reroll=true/>{/}
</ul>
{/}