Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Chat main window

  • Loading branch information...
commit 24e4b9c369cf9f93d16e529b7a537ac80f180369 1 parent d6bd8eb
@Vanuan Vanuan authored
View
2  chat/app/assets/javascripts/application.js
@@ -15,4 +15,4 @@
//= require lib/underscore
//= require lib/backbone
//= require lib/marionette
-//= require modules/app
+//= require_tree ./modules/chat
View
10 chat/app/assets/javascripts/modules/chat/apps/footer/footer_app.js.coffee
@@ -0,0 +1,10 @@
+Chat.module "FooterApp", (FooterApp, App, Backbone, Marionette, $, _) ->
+
+ API =
+ showFooter: ->
+ FooterApp.Show.Controller.showFooter()
+
+ FooterApp.on "start", ->
+ API.showFooter()
+
+
View
10 chat/app/assets/javascripts/modules/chat/apps/footer/show/show_controller.js.coffee
@@ -0,0 +1,10 @@
+@Chat.module "FooterApp.Show", (Show, App, Backbone, Marionette, $, _) ->
+ Show.Controller =
+
+ showFooter: ->
+ footerView = @getFooterView()
+ App.footerRegion.show footerView
+
+ getFooterView: ->
+ new Show.Footer
+
View
5 chat/app/assets/javascripts/modules/chat/apps/footer/show/show_view.js.coffee
@@ -0,0 +1,5 @@
+Chat.module "FooterApp.Show", (Show, App, Backbone, Marionette, $, _) ->
+
+ class Show.Footer extends Marionette.ItemView
+ template: "footer/show/templates/show_footer"
+ tagName: "li"
View
0  chat/app/assets/javascripts/modules/app.js.coffee → ...ts/modules/chat/apps/footer/templates/show.js.eco
File renamed without changes
View
18 chat/app/assets/javascripts/modules/chat/chat_app.js.coffee
@@ -0,0 +1,18 @@
+@Chat = do (Backbone, Marionette) ->
+
+ @startWithParent = false
+ App = new Marionette.Application
+
+ App.addRegions
+ headerRegion: "#header-region"
+ mainRegion: "#main-region"
+ footerRegion: "#footer-region"
+
+ App.addInitializer ->
+ App.module("FooterApp").start()
+
+ App.on "initialize:after", ->
+ if Backbone.history
+ Backbone.history.start()
+
+ App
View
5 chat/app/assets/javascripts/modules/chat/config/marionette/renderer.js.coffee
@@ -0,0 +1,5 @@
+Backbone.Marionette.Renderer.render = (template, data) ->
+ path = JST["chat/apps/" + template]
+ unless path
+ throw "Template #{template} not found"
+ path(data)
View
1  chat/app/controllers/application_controller.rb
@@ -4,6 +4,5 @@ class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
def index
-
end
end
View
2  chat/app/controllers/chat_controller.rb
@@ -0,0 +1,2 @@
+class ChatController < ApplicationController
+end
View
6 chat/app/views/application/index.html.erb
@@ -1,5 +1,9 @@
+<div id="header-region"></div>
+<div id="main-region"></div>
+<div id="footer-region"></div>
+
<%= javascript_tag do %>
$(function(){
Chat.start();
});
-<% end %>
+<% end %>
View
1  chat/config/routes.rb
@@ -5,6 +5,7 @@
resources :users
get 'admin' => 'admin#index'
+ get 'chat' => 'chat#index'
root to: 'application#index'
# The priority is based upon order of creation: first created -> highest priority.
Please sign in to comment.
Something went wrong with that request. Please try again.