Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added first application to display a random word

  • Loading branch information...
commit 736b4e6f2fcde9ffe831f58fe460cfe52d3c6f34 1 parent ef031e9
Zac Hansen authored
View
13 app/assets/javascripts/words.js.coffee → app/assets/javascripts/desktop.js.coffee
@@ -287,9 +287,16 @@ class MyApplication extends JoeApplication
@window = @desktop.new_window()
console.log @window
@window.html("<P>HI</P>")
- $.delay(5).ajax()
-
-
+ # set up a timer to start loading words
+ @update_word()
+ setInterval(( => @update_word()), 10000)
+
+
+ update_word: ->
+ console.log "updating word"
+ $.getJSON("/words", (data) =>
+ console.log @window
+ $(@window).html(data[0]))
$(->
# random crap for IE user-selectable in case I want it later
View
0  app/assets/stylesheets/words.css.scss → app/assets/stylesheets/desktop.css.scss
File renamed without changes
View
25 app/controllers/words_controller.rb
@@ -1,25 +0,0 @@
-class WordsController < ApplicationController
-
- def index
-
- File.open("/usr/share/dict/words") do |io|
-
- end
-
- render :text => 'hi'
-
- end
-
- def show
-
- @words = []
- File.open("/usr/share/dict/words") do |io|
- line_count = 0
- io.each do |line|
- line_count += 1
- break if line_count > 100
- @words << line
- end
- end
- end
-end
View
17 app/controllers/words_controller.rb~
@@ -1,17 +0,0 @@
-class WordsController < ApplicationController
-
- def index
-
- File.open("/usr/share/dict/words") do |io|
-
- end
-
- render :text => 'hi'
-
- end
-
- def show
- render :text => "show"
- end
-
-end
View
4 config/routes.rb
@@ -14,8 +14,10 @@
# Sample resource route (maps HTTP verbs to controller actions automatically):
# resources :products
+ resource :desktop do
+ end
- resource :words do
+ resources :words do
end
# Sample resource route with options:
View
5 config/routes.rb~
@@ -1,4 +1,6 @@
Joe::Application.routes.draw do
+ resources :ihateerbs
+
# The priority is based upon order of creation:
# first created -> highest priority.
@@ -13,7 +15,8 @@ Joe::Application.routes.draw do
# Sample resource route (maps HTTP verbs to controller actions automatically):
# resources :products
- resource :words
+ resource :words do
+ end
# Sample resource route with options:
# resources :products do
Please sign in to comment.
Something went wrong with that request. Please try again.