gofundme link

This commit is contained in:
Seth Call 2020-05-09 08:22:19 -05:00
parent 1ccb6c8a6e
commit 9446de49d4
13 changed files with 148 additions and 7 deletions

View File

@ -0,0 +1,18 @@
ActiveAdmin.register JamRuby::GenericState, :as => 'GenericState' do
menu :parent => 'Operations'
config.clear_action_items!
filter :env
permit_params :top_message
actions :all, :except => [:destroy]
index do
selectable_column
column :env
actions
end
form :partial => 'form'
end

View File

@ -0,0 +1,7 @@
<%= semantic_form_for([:admin, resource], :url => resource.new_record? ? admin_generic_states_path : "/admin/generic_states/#{resource.id}") do |f| %>
<%= f.semantic_errors *f.object.errors.keys %>
<%= f.inputs do %>
<%= f.input(:top_message, :input_html => {:maxlength => 10000, :rows=>10, :class => 'autogrow'}) %>
<% end %>
<%= f.actions %>
<% end %>

View File

@ -393,4 +393,4 @@ store_backend_details_rate_session.sql
invited_user_receiver.sql
live_streams.sql
live_stream_notify.sql
find_sessions_2020.sql
find_sessions_2020.sql

View File

@ -31,4 +31,8 @@ CREATE TABLE arses (
active BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
);
------
ALTER TABLE generic_state ADD COLUMN top_message VARCHAR(100000);

View File

@ -2,6 +2,9 @@
module JamRuby
class GenericState < ActiveRecord::Base
attr_accessible :top_message, as: :admin
self.table_name = 'generic_state'
validates :env, :inclusion => {:in => ['development', 'staging', 'production', 'test']}
@ -31,6 +34,10 @@ module JamRuby
GenericState.singleton.bounce_check_at
end
def self.top_message
GenericState.singleton.top_message
end
def self.singleton
GenericState.find('default')
end

View File

@ -2697,6 +2697,20 @@
});
}
function getConfigClient(options) {
if (!options) {
options = {}
}
return $.ajax({
type: "GET",
url: "/api/config/client?" + $.param(options),
dataType: "json",
contentType: 'application/json'
});
}
function createReview(options) {
return $.ajax({
@ -3113,6 +3127,7 @@
this.updateOnboarding = updateOnboarding;
this.findFriendSessions = findFriendSessions;
this.findPublicSessions = findPublicSessions;
this.getConfigClient = getConfigClient;
return this;
};
})(window, jQuery);

View File

@ -239,15 +239,25 @@
var broadcastWidth = findCardLayout.width + feedCardLayout.width; //+ opts.gridPadding * 2;
layoutBroadcast(broadcastWidth, findCardLayout.left);
//layoutBroadcast(broadcastWidth, findCardLayout.left);
layoutTopMessage(broadcastWidth, findCardLayout.left)
}
/**
function layoutBroadcast(width, left) {
var css = {
width:width + opts.gridPadding * 2,
left:left
}
$('[data-react-class="BroadcastHolder"]').animate(css, opts.animationDuration)
}*/
function layoutTopMessage(width, left) {
var css = {
width:width + opts.gridPadding * 2,
left:left
}
$('[data-react-class="TopMessageHolder"]').animate(css, opts.animationDuration)
}
function layoutSidebar(screenWidth, screenHeight) {

View File

@ -0,0 +1,34 @@
context = window
ConfigStore = context.ConfigStore
ReactCSSTransitionGroup = React.addons.CSSTransitionGroup;
@TopMessageHolder = React.createClass(
{
displayName: 'Top Message Holder',
mixins: [Reflux.listenTo(ConfigStore, "onConfig")]
getInitialState: () ->
{}
onConfig: (configs) ->
if configs.top_message
@setState({top_message: configs.top_message})
componentDidUpdate:() ->
$root = $(this.getDOMNode())
context.JK.popExternalLinks($root)
return false
render: () ->
if @state.top_message
`<div id="broadcast-notification-holder" className="broadcast-notification-holder" >
<div className="broadcast-notification config" dangerouslySetInnerHTML={{__html:this.state.top_message}}>
</div>
</div>`
else
return null
});

View File

@ -0,0 +1,31 @@
$ = jQuery
context = window
logger = context.JK.logger
rest = new context.JK.Rest()
@ConfigStore = Reflux.createStore(
{
top_message: null
#listenables: @ConfigActions
init: ->
this.listenTo(context.AppStore, this.onAppInit)
onAppInit: (@app) ->
setTimeout((() =>
rest.getConfigClient()
.done((response) =>
@top_message = response.top_message
@changed()
)
.fail((jqXHR) =>
console.log("failed to fetch config")
)
), 2000)
changed:() ->
@trigger({top_message: @top_message})
}
)

View File

@ -12,7 +12,7 @@
}
}
[data-react-class="BroadcastHolder"] {
[data-react-class="BroadcastHolder"], [data-react-class="TopMessageHolder"] {
position:relative;
min-height: 125px;
bottom: 60px;
@ -31,6 +31,10 @@
@include border_box_sizing;
&.config {
border-width:0;
}
&.lesson {
p {
text-align:center;

View File

@ -8,8 +8,17 @@ class ApiConfigsController < ApiController
websocket_gateway_uri: APP_CONFIG.websocket_gateway_uri,
websocket_gateway_uri_ssl: APP_CONFIG.websocket_gateway_uri_ssl
}
render :json => configs, :status => 200
end
# should be nginx cached on 5 minutes
def client
configs =
{
top_message: GenericState.top_message
}
render :json => configs, :status => 200
end
end

View File

@ -12,8 +12,8 @@
<%= render "users/user_dropdown" %>
<%= react_component 'BroadcastHolder', {is_guitar_center: @is_guitar_center} %>
<!--<%= react_component 'BroadcastHolder', {is_guitar_center: @is_guitar_center} %>-->
<%= react_component 'TopMessageHolder', {is_guitar_center: @is_guitar_center} %>
</div>
<!-- Templates -->
<script type="text/template" id="template-search-section">

View File

@ -684,7 +684,9 @@ Rails.application.routes.draw do
get '/versioncheck' => 'artifacts#versioncheck'
# discover websocket gateway info
get '/config' => 'api_configs#index'
get '/config' => 'api_configs#index'
match '/config/client' => 'api_configs#client', :via => :get
# no-op method to see if server is running
get '/healthcheck' => 'artifacts#healthcheck'