From c05c70645529b5ffead0d76131b1f2d0c568ff9b Mon Sep 17 00:00:00 2001 From: Seth Call Date: Fri, 8 Jan 2016 16:13:59 -0600 Subject: [PATCH] * support news --- admin/app/admin/news.rb | 6 ++ db/manifest | 3 +- db/up/news.sql | 8 ++ ruby/lib/jam_ruby.rb | 1 + ruby/lib/jam_ruby/models/news.rb | 14 ++++ .../landing/HomePage.js.jsx.coffee | 84 +++++++------------ .../assets/stylesheets/modern/modern.css.scss | 12 ++- web/app/controllers/users_controller.rb | 2 + 8 files changed, 75 insertions(+), 55 deletions(-) create mode 100644 admin/app/admin/news.rb create mode 100644 db/up/news.sql create mode 100644 ruby/lib/jam_ruby/models/news.rb diff --git a/admin/app/admin/news.rb b/admin/app/admin/news.rb new file mode 100644 index 000000000..996783c7a --- /dev/null +++ b/admin/app/admin/news.rb @@ -0,0 +1,6 @@ +ActiveAdmin.register JamRuby::News, :as => 'News' do + + menu :parent => 'Misc' + + +end diff --git a/db/manifest b/db/manifest index 4b8e8d681..d44b89a14 100755 --- a/db/manifest +++ b/db/manifest @@ -320,4 +320,5 @@ jam_tracks_bpm.sql jam_track_sessions.sql jam_track_sessions_v2.sql email_screening.sql -bounced_email_cleanup.sql \ No newline at end of file +bounced_email_cleanup.sql +news.sql \ No newline at end of file diff --git a/db/up/news.sql b/db/up/news.sql new file mode 100644 index 000000000..2eb981de8 --- /dev/null +++ b/db/up/news.sql @@ -0,0 +1,8 @@ +CREATE TABLE news ( + id VARCHAR(64) PRIMARY KEY DEFAULT uuid_generate_v4(), + title VARCHAR NOT NULL, + body VARCHAR NOT NULL, + position INTEGER NOT NULL UNIQUE, + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +); \ No newline at end of file diff --git a/ruby/lib/jam_ruby.rb b/ruby/lib/jam_ruby.rb index fd91562ab..c9eb23ed4 100755 --- a/ruby/lib/jam_ruby.rb +++ b/ruby/lib/jam_ruby.rb @@ -236,6 +236,7 @@ require "jam_ruby/models/user_sync" require "jam_ruby/models/payment_history" require "jam_ruby/models/video_source" require "jam_ruby/models/text_message" +require "jam_ruby/models/news" require "jam_ruby/models/sale" require "jam_ruby/models/sale_line_item" require "jam_ruby/models/recurly_transaction_web_hook" diff --git a/ruby/lib/jam_ruby/models/news.rb b/ruby/lib/jam_ruby/models/news.rb new file mode 100644 index 000000000..0d126ad38 --- /dev/null +++ b/ruby/lib/jam_ruby/models/news.rb @@ -0,0 +1,14 @@ + +module JamRuby + class News < ActiveRecord::Base + + self.table_name = 'news' + + attr_accessible :title, :body, :position, as: :admin + default_scope { order('position') } + validates :title, presence: true + validates :body, presence: true + validates :position, presence: true, numericality: {only_integer: true}, uniqueness: true + + end +end diff --git a/web/app/assets/javascripts/react-components/landing/HomePage.js.jsx.coffee b/web/app/assets/javascripts/react-components/landing/HomePage.js.jsx.coffee index 4f5c3e3da..03a886376 100644 --- a/web/app/assets/javascripts/react-components/landing/HomePage.js.jsx.coffee +++ b/web/app/assets/javascripts/react-components/landing/HomePage.js.jsx.coffee @@ -17,6 +17,17 @@ context = window alertify.alert("COMING SOON!"); render: () -> + + items = [] + + for item in gon.news + items.push(`
" + item.title + "" + item.body}} key={item.position}>
`) + + news = `
WHAT'S NEW
+ {items}
` + + + `
@@ -304,7 +315,6 @@ context = window about us


-
@@ -315,65 +325,32 @@ context = window
-
WHAT'S NEW
- - Support - -

For technical support and help using our products and services, - please visit the JamKazam - Support Center.

- Partnerships - -

For partnering inquiries, please contact us at: partners@jamkazam.com. -

- Media - -

For inquiries from traditional media, bloggers, and others - interested in sharing news and information - about us with others, please visit the JamKazam Media - Center, and you may also contact us at pr@jamkazam.com. -

- Infringement - -

To report content hosted on the JamKazam platform that that - infringes your copyright or the copyright of - a third party on whose behalf you are entitled to act, please - see the Reporting Infringements section of - the JamKazam Terms of Service.

- General - -

For general inquiries, please contact us at: info@jamkazam.com. -

+ {news}
-
+
+
-
+
+ - - - +
+
+ + + - - - + + + - - - - - - - - -
+ + + + + +
@@ -406,6 +383,7 @@ context = window + diff --git a/web/app/assets/stylesheets/modern/modern.css.scss b/web/app/assets/stylesheets/modern/modern.css.scss index c7c7f4bb3..0c701db05 100644 --- a/web/app/assets/stylesheets/modern/modern.css.scss +++ b/web/app/assets/stylesheets/modern/modern.css.scss @@ -190,6 +190,15 @@ a.sign-in { text-align:center; } +.bottom-row-item { + float:left; + + &img { + margin-top: 10px; + margin-left: 200px; + } +} + .alertify-button { text-shadow:none; box-shadow:none; @@ -206,4 +215,5 @@ a.sign-in { font-family: 'Quicksand', Arial, sans-serif; color:black; font-size:26px; -} \ No newline at end of file +} + diff --git a/web/app/controllers/users_controller.rb b/web/app/controllers/users_controller.rb index 0b672aa3d..2f2381a37 100644 --- a/web/app/controllers/users_controller.rb +++ b/web/app/controllers/users_controller.rb @@ -208,6 +208,8 @@ class UsersController < ApplicationController return end + gon.news = News.all + render :layout => "modern" end