More Related Content Similar to SproutCore and the Future of Web Apps (20) More from Mike Subelsky (11) SproutCore and the Future of Web Apps24. remove_messages: function(message_ids,block) {
OtherInbox.undo_stack.push(new UndoAction(message_ids,Mailbox.current_id,block))
$('undo').writeAttribute('disabled',null)
var affected_mailboxes = $H()
var highest_position = null
var msg_count = 0
message_ids.each(function(id) {
$('msg_row_' + id).remove()
var msg = Message.instances.unset(id)
var position = Message.ordered_instance_keys.indexOf(Number(id))
Message.ordered_instance_keys.splice(position,1)
if ((highest_position == null) || (highest_position < position))
highest_position = position
msg_count++
})
Mailbox.update_message_count(msg_count)
28. OI.executeAjax('/refresh', {
method: 'get',
parameters: parameters,
onSuccess: function(transport) {
OI._parseRefresh(transport);
}
});
removeMessages: function(msgs) {
SC.Store.destroyRecords(msgs);
};
29. class RefreshController < ApplicationController
before_filter :signin_required
def index
render :text => JSON.generate(Refresher.new(params).to_hash)
end
end
30. {quot;recordTypesquot;:[quot;Mailboxquot;,quot;Userquot;,quot;Folderquot;],
quot;deletedquot;:{},
quot;flashquot;:[],
quot;changedquot;:{
quot;Userquot;:
[{quot;namequot;:quot;forfunquot;,quot;preferencesquot;:null,quot;guidquot;:
3,quot;typequot;:quot;Userquot;,quot;adminquot;:true,quot;invitationsRemaining
quot;:1,quot;loginquot;:quot;testuserquot;,quot;statequot;:quot;completedquot;}],
quot;createdquot;:
{quot;Mailboxquot; [{quot;namequot;:quot;Freeslidequot;,quot;unreadCountquot;:null
,quot;guidquot;:quot;12quot;,quot;folderquot;:quot;3quot;,quot;priorityquot;:quot;2quot;,quot;typequot;:
quot;Mailboxquot;}]}}
}
33. sh
Fla
t
ip
S cr
va
Ja
CSS
L
HTM
37. “...writing an app in
Javascript on the web is
akin to writing C on the
desktop: it is just one
level above the 'bare
metal’.”
- Charles Jolley
40. Feels a bit like Rails
Convention over configuration
42. Feels a bit like Rails
Uses Ruby helpers and ERB or Haml
45. Except totally
different
More functionally-oriented (little or no state)
47. Except totally
different
Trust but verify
if (foo && foo.get(‘importantValue’))
49. Except totally
different
JavaScript is awesome
(just avoid the bad parts)
58. Models Build commands
require('core');
require('models/record');
OI.Mailbox = OI.Record.extend({
dataSource: SC.Store,
_messages: null,
isLoading: false,
init: function() { this._messages = { value: [] }; },
lowerCaseName: function() {
var name = this.get('name');
if (name) { return name.toLowerCase(); }
}.property('name'),
59. Models Build commands
require('core');
require('models/record');
OI.Mailbox = OI.Record.extend({
dataSource: SC.Store,
_messages: null,
isLoading: false,
init: function() { this._messages = { value: [] }; },
lowerCaseName: function() {
var name = this.get('name');
if (name) { return name.toLowerCase(); }
}.property('name'),
Computed property
76. SC builds these files as static
assets in production mode
Served by Apache,Varnish, CDN, etc.
Rails-style asset tags
79. Join our team
Upgrade your job Open Positions
• Smart, fun people • Ruby on Rails Developer
• Startup environment • Ruby on Rails Intern
• Cutting edge tech
• Competitive pay
• Stock options
We pay $1,000 for successful referrals!
80. Thank you!
mike@otherinbox.com
subelsky.com - ignitebaltimore.com
@subelsky @ignitebaltimore