Skip to content

Commit

Permalink
Add client time for #348.
Browse files Browse the repository at this point in the history
  • Loading branch information
bamnet committed Mar 19, 2013
1 parent bd3bb06 commit 370e71a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
16 changes: 16 additions & 0 deletions app/models/client_time.rb
@@ -0,0 +1,16 @@
class ClientTime < Content

DISPLAY_NAME = 'Client Time'

after_initialize :set_kind

# Validations
validates :duration, :numericality => { :greater_than => 0, :less_than => 60 }

# Automatically set the kind for the content
# if it is new.
def set_kind
return unless new_record?
self.kind = Kind.where(:name => 'Text').first
end
end
1 change: 1 addition & 0 deletions config/routes.rb
Expand Up @@ -88,6 +88,7 @@

resources :tickers, :controller => :contents, :except => [:index, :show], :path => "content"
resources :html_texts, :controller => :contents, :except => [:index, :show], :path => "content"
resources :client_times, :controller => :contents, :except => [:index, :show], :path => "content"

#Set a non-restful route to the dashboard
match 'dashboard/' => 'dashboard#index'
Expand Down
2 changes: 1 addition & 1 deletion public/frontend_js/contents/client_time.js
Expand Up @@ -27,7 +27,7 @@ concerto.frontend.Content.ClientTime = function(data) {
goog.inherits(concerto.frontend.Content.ClientTime, concerto.frontend.Content);

// Register the content type.
concerto.frontend.ContentTypeRegistry['TimeDisplay'] =
concerto.frontend.ContentTypeRegistry['ClientTime'] =
concerto.frontend.Content.ClientTime;


Expand Down

0 comments on commit 370e71a

Please sign in to comment.