forked from hotsh/rstat.us
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app_index.html
422 lines (419 loc) · 20.9 KB
/
app_index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>app | Rstat.us Code Walkthrough</title>
<link rel="stylesheet" href="http://jashkenas.github.com/docco/resources/docco.css">
<style type="text/css">
hr.light { color: #fefefe; }
</style>
<script type="text/javascript" src="https://www.google.com/jsapi?key=ABQIAAAAabBpI2NWdOQQ88JkjvfYvxTbJmkTZigc5kHRomvftpLfPYfatxS9Io1VmGVmlYHarQswoz1Vjjy5gw"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
$(document).ready(function(){
});
});
</script>
</head>
<body>
<div id='container'>
<div id="background"></div>
<div id="jump_to">
Jump To …
<div id="jump_wrapper">
<div id="jump_page">
<a class="source" href="app/controllers/application_controller.html">application_controller.rb</a>
<a class="source" href="app/controllers/auth_controller.html">auth_controller.rb</a>
<a class="source" href="app/controllers/feeds_controller.html">feeds_controller.rb</a>
<a class="source" href="app/controllers/salmon_controller.html">salmon_controller.rb</a>
<a class="source" href="app/controllers/searches_controller.html">searches_controller.rb</a>
<a class="source" href="app/controllers/sessions_controller.html">sessions_controller.rb</a>
<a class="source" href="app/controllers/static_controller.html">static_controller.rb</a>
<a class="source" href="app/controllers/subscriptions_controller.html">subscriptions_controller.rb</a>
<a class="source" href="app/controllers/updates_controller.html">updates_controller.rb</a>
<a class="source" href="app/controllers/users_controller.html">users_controller.rb</a>
<a class="source" href="app/controllers/webfinger_controller.html">webfinger_controller.rb</a>
<a class="source" href="app/decorators/application_decorator.html">application_decorator.rb</a>
<a class="source" href="app/decorators/author_decorator.html">author_decorator.rb</a>
<a class="source" href="app/decorators/author_json_decorator.html">author_json_decorator.rb</a>
<a class="source" href="app/decorators/time_decorator.html">time_decorator.rb</a>
<a class="source" href="app/decorators/update_decorator.html">update_decorator.rb</a>
<a class="source" href="app/decorators/user_decorator.html">user_decorator.rb</a>
<a class="source" href="app/models/author.html">author.rb</a>
<a class="source" href="app/models/authorization.html">authorization.rb</a>
<a class="source" href="app/models/feed.html">feed.rb</a>
<a class="source" href="app/models/notifier.html">notifier.rb</a>
<a class="source" href="app/models/salmon_author.html">salmon_author.rb</a>
<a class="source" href="app/models/salmon_interpreter.html">salmon_interpreter.rb</a>
<a class="source" href="app/models/update.html">update.rb</a>
<a class="source" href="app/models/user.html">user.rb</a>
<a class="source" href="app/models/webfinger.html">webfinger.rb</a>
</div>
</div>
</div>
<table cellspacing=0 cellpadding=0>
<thead>
<tr>
<th class=docs><h1>The app directory</h1></th>
<th class=code></th>
</tr>
</thead>
<tbody>
<tr id='section-intro' class="intro">
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-intro">¶</a>
</div>
<p><a href="index.html">Return to the main rstat.us index</a></p>
<p>The <code>app</code> directory contains so much that it gets its own index. Rails uses the <a href="http://guides.rubyonrails.org/getting_started.html#the-mvc-architecture">MVC architecture</a> so there are directories for the <code>controllers</code>, <code>models</code>, and <code>views</code>. We're also starting to use the Decorator pattern for view logic, so there's a directory of <code>decorators</code>.</p>
</td>
<td class=code>
</td>
</tr>
<tr id='section-assets'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-assets">¶</a>
</div>
<p>The <code>assets</code> directory contains rstat.us' images, uncompressed javascript (and <a href="http://coffeescript.org/">coffeescript</a>), and uncompiled <a href="http://sass-lang.com/">SCSS stylesheets</a>.</p>
</td>
<td class=code>
<div class='highlight'><pre>assets/</pre></div>
</td>
</tr>
<tr id='section-controllers'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-controllers">¶</a>
</div>
<p><a href="http://guides.rubyonrails.org/action_controller_overview.html">Controllers</a> do things like handling authentication, asking models for data, and providing that data to the appropriate view for the request.</p>
</td>
<td class=code>
<div class='highlight'><pre>controllers/</pre></div>
</td>
</tr>
<tr id='section-controllers-application'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-controllers-application">¶</a>
</div>
<p>The Application Controller defines controller methods that are useful for many of the other controllers, like <code>current_user</code> and <code>set_params_page</code>.</p>
</td>
<td class=code>
<div class='highlight'><pre>|- <a class="source" href="app/controllers/application_controller.html">application_controller.rb</a></pre></div>
</td>
</tr>
<tr id='section-controllers-auth'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-controllers-auth">¶</a>
</div>
<p>The Auth Controller handles external <a href="http://oauth.net/">OAuth</a> requests.</p>
</td>
<td class=code>
<div class='highlight'><pre>|- <a class="source" href="app/controllers/auth_controller.html">auth_controller.rb</a></pre></div>
</td>
</tr>
<tr id='section-controllers-feeds'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-controllers-feeds">¶</a>
</div>
<p>The Feeds Controller shows a Feed, which is important for <a href="https://code.google.com/p/pubsubhubbub/">PubSubHubbub</a> support.</p>
</td>
<td class=code>
<div class='highlight'><pre>|- <a class="source" href="app/controllers/feeds_controller.html">feeds_controller.rb</a></pre></div>
</td>
</tr>
<tr id='section-controllers-salmon'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-controllers-salmon">¶</a>
</div>
<p>The Salmon Controller helps implement the <a href="https://salmon-protocol.googlecode.com/svn/trunk/draft-panzer-salmon-00.html">Salmon Protocol</a> for distribution of non-content-based interaction, such as following someone or replying to someone.</p>
</td>
<td class=code>
<div class='highlight'><pre>|- <a class="source" href="app/controllers/salmon_controller.html">salmon_controller.rb</a></pre></div>
</td>
</tr>
<tr id='section-controllers-searches'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-controllers-searches">¶</a>
</div>
<p>The Searches Controller handles searching.</p>
</td>
<td class=code>
<div class='highlight'><pre>|- <a class="source" href="app/controllers/searches_controller.html">searches_controller.rb</a></pre></div>
</td>
</tr>
<tr id='section-controllers-sessions'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-controllers-sessions">¶</a>
</div>
<p>The Sessions Controller is for logging in and logging out with a username and password.</p>
</td>
<td class=code>
<div class='highlight'><pre>|- <a class="source" href="app/controllers/sessions_controller.html">sessions_controller.rb</a></pre></div>
</td>
</tr>
<tr id='section-controllers-static'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-controllers-static">¶</a>
</div>
<p>The Static Controller just goes to the pages on rstat.us that just show information and don't have much interactivity to them.</p>
</td>
<td class=code>
<div class='highlight'><pre>|- <a class="source" href="app/controllers/static_controller.html">static_controller.rb</a></pre></div>
</td>
</tr>
<tr id='section-controllers-subscriptions'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-controllers-subscriptions">¶</a>
</div>
<p>The Subscriptions Controller is in charge of following and unfollowing.</p>
</td>
<td class=code>
<div class='highlight'><pre>|- <a class="source" href="app/controllers/subscriptions_controller.html">subscriptions_controller.rb</a></pre></div>
</td>
</tr>
<tr id='section-controllers-updates'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-controllers-updates">¶</a>
</div>
<p>The Updates Controller is what does the posting and displaying of statuses.</p>
</td>
<td class=code>
<div class='highlight'><pre>|- <a class="source" href="app/controllers/updates_controller.html">updates_controller.rb</a></pre></div>
</td>
</tr>
<tr id='section-controllers-users'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-controllers-users">¶</a>
</div>
<p>The Users Controller is what gets called when someone signs up for an account, edits their profile, requests a password reset, or resets their password. It also shows an individual user profile as well as a user's following and followers pages.</p>
</td>
<td class=code>
<div class='highlight'><pre>|- <a class="source" href="app/controllers/users_controller.html">users_controller.rb</a></pre></div>
</td>
</tr>
<tr id='section-controllers-webfinger'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-controllers-webfinger">¶</a>
</div>
<p>The Webfinger Controller is what implements the <a href="https://code.google.com/p/webfinger/wiki/WebFingerProtocol">Webfinger protocol</a>, which is a way to figure out user information from an identifier like <em>[email protected]</em>.</p>
</td>
<td class=code>
<div class='highlight'><pre>|- <a class="source" href="app/controllers/webfinger_controller.html">webfinger_controller.rb</a></pre></div>
</td>
</tr>
<tr id='section-decorators'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-decorators">¶</a>
</div>
<p>The <code>decorators</code> directory holds View Model objects that use the <a href="https://github.com/jcasimir/draper">draper gem</a>. They help us to generate some of the HTML in an object-oriented way, rather than the more procedural helper functions do. There's a great <a href="http://railscasts.com/episodes/286-draper">RailsCast</a> on this subject.</p>
</td>
<td class=code>
<div class='highlight'><pre>decorators/</pre></div>
</td>
</tr>
<tr id='section-decorators-application'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-decorators-application">¶</a>
</div>
<p>This is a decorator that the other decorators inherit from. It contains methods that are applicable to multiple decorators.</p>
</td>
<td class=code>
<div class='highlight'><pre>|- <a class="source" href="app/decorators/application_decorator.html">application_decorator.rb</a></pre></div>
</td>
</tr>
<tr id='section-decorators-author'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-decorators-author">¶</a>
</div>
<p>The author decorator handles display items for authors of statuses displayed on rstat.us, whether or not they are users on rstat.us. An example is an author's avatar.</p>
</td>
<td class=code>
<div class='highlight'><pre>|- <a class="source" href="app/decorators/author_decorator.html">author_decorator.rb</a></pre></div>
</td>
</tr>
<tr id='section-decorators-author-json'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-decorators-author-json">¶</a>
</div>
<p>The author json decorator handles the json representation of an author. This decorator makes use of some of the author decorator methods.</p>
</td>
<td class=code>
<div class='highlight'><pre>|- <a class="source" href="app/decorators/author_json_decorator.html">author_json_decorator.rb</a></pre></div>
</td>
</tr>
<tr id='section-decorators-time'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-decorators-time">¶</a>
</div>
<p>The time decorator has the logic needed for displaying time attributes and markup with different time formats for updates.</p>
</td>
<td class=code>
<div class='highlight'><pre>|- <a class="source" href="app/decorators/time_decorator.html">time_decorator.rb</a></pre></div>
</td>
</tr>
<tr id='section-decorators-update_json'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-decorators-update_json">¶</a>
</div>
<p>The update json decorator creates the json representation of an update. It calls the author json decorator to embed the author.</p>
</td>
<td class=code>
<div class='highlight'><pre>|- <a class="source" href="app/decorators/update_json_decorator.html">update_json_decorator.rb</a></pre></div>
</td>
</tr>
<tr id='section-decorators-user'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-decorators-user">¶</a>
</div>
<p>The user decorator contains only display items that users who have accounts on rstat.us should see. It also has an associated author decorator.</p>
</td>
<td class=code>
<div class='highlight'><pre>|- <a class="source" href="app/decorators/user_decorator.html">user_decorator.rb</a></pre></div>
</td>
</tr>
<tr id='section-models'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-models">¶</a>
</div>
<p>The classes in <code>models</code> are the business objects of the system. If you are familiar with Rails, you will notice that these objects do not inherit from <code>ActiveRecord::Base</code> like most Rails models do-- instead, they <code>include MongoMapper::Document</code>. This is because rstat.us uses <a href="http://www.mongodb.org/">MongoDB</a> (a NoSQL database) and <a href="http://mongomapper.com/">MongoMapper</a> to interface with Rails.</p>
</td>
<td class=code>
<div class='highlight'><pre>models/</pre></div>
</td>
</tr>
<tr id='section-models-author'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-models-author">¶</a>
</div>
<p>An Author is an entity that produces Updates. Authors <strong>may</strong> have corresponding rstat.us Users as well, but they may also be users on another OStatus site.</p>
</td>
<td class=code>
<div class='highlight'><pre>|- <a class="source" href="app/models/author.html">author.rb</a></pre></div>
</td>
</tr>
<tr id='section-models-authorization'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-models-authorization">¶</a>
</div>
<p>An Authorization is an ability of a User to log in to rstat.us. Currently, the only ways an Authorization is created are if a User logs in to rstat.us with Twitter or a User associates their Twitter account with their existing rstat.us username account.</p>
</td>
<td class=code>
<div class='highlight'><pre>|- <a class="source" href="app/models/authorization.html">authorization.rb</a></pre></div>
</td>
</tr>
<tr id='section-models-feed'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-models-feed">¶</a>
</div>
<p>Feeds are representations of <a href="http://ostatus.org/sites/default/files/ostatus-1.0-draft-2-specification.html">PuSH enabled Atom feeds</a>. Each rstat.us User has a Feed of their updates, and rstat.us keeps a local Feed for each remote Feed that an rstat.us User subscribes to.</p>
</td>
<td class=code>
<div class='highlight'><pre>|- <a class="source" href="app/models/feed.html">feed.rb</a></pre></div>
</td>
</tr>
<tr id='section-models-notifier'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-models-notifier">¶</a>
</div>
<p>Notifier is a class that sends emails to Users such as password reset links or email confirmation links.</p>
</td>
<td class=code>
<div class='highlight'><pre>|- <a class="source" href="app/models/notifier.html">notifier.rb</a></pre></div>
</td>
</tr>
<tr id='section-models-salmon-author'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-models-salmon-author">¶</a>
</div>
<p>The salmon author model is a non-database model. It's a wrapper around an author that is returned from a Salmon response through the OStatus gem. This class makes it easier to treat an author from a Salmon response in the same way as an rstat.us Author without needing to know about OStatus authors' structure.</p>
</td>
<td class=code>
<div class='highlight'><pre>|- <a class="source" href="app/models/salmon_author.html">salmon_author.rb</a></pre></div>
</td>
</tr>
<tr id='section-models-salmon-interpreter'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-models-salmon-interpreter">¶</a>
</div>
<p>The salmon interpreter model is another non-database model that does a lot of the work of carrying out the actions that a Salmon notification tells us about.</p>
</td>
<td class=code>
<div class='highlight'><pre>|- <a class="source" href="app/models/salmon_interpreter.html">salmon_interpreter.rb</a></pre></div>
</td>
</tr>
<tr id='section-models-update'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-models-update">¶</a>
</div>
<p>An Update is an individual status posted either by an rstat.us User or a remote user being followed by someone on rstat.us.</p>
</td>
<td class=code>
<div class='highlight'><pre>|- <a class="source" href="app/models/update.html">update.rb</a></pre></div>
</td>
</tr>
<tr id='section-models-user'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-models-user">¶</a>
</div>
<p>A User is someone who has signed in to rstat.us. All Users have Authors and Feeds associated with them.</p>
</td>
<td class=code>
<div class='highlight'><pre>|- <a class="source" href="app/models/user.html">user.rb</a></pre></div>
</td>
</tr>
<tr id='section-models-webfinger'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-models-webfinger">¶</a>
</div>
<p>This object is responsible for looking up users by webfinger identifier. The Webfinger class is only a business logic object; there are no instances of Webfingers in the database.</p>
</td>
<td class=code>
<div class='highlight'><pre>|- <a class="source" href="app/models/webfinger.html">webfinger.rb</a></pre></div>
</td>
</tr>
<tr id='section-views'>
<td class=docs>
<div class="pilwrap">
<a class="pilcrow" href="#section-views">¶</a>
</div>
<p><a href="http://guides.rubyonrails.org/layouts_and_rendering.html">Views</a> are templates for rendering HTML. Rstat.us uses <a href="http://haml-lang.com/">haml</a> as its templating language instead of the Rails default of erb. The subdirectories loosely correspond to the controllers' actions, plus common outer HTML in <code>layouts</code> and common repeated HTML in <code>shared</code>.</p>
</td>
<td class=code>
<div class='highlight'><pre>views/</pre></div>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>