VRFS-1654 - configure feed layout
This commit is contained in:
parent
6be0791adb
commit
8f06168f1c
|
|
@ -102,7 +102,7 @@ group :development, :test do
|
||||||
gem 'rspec-rails'
|
gem 'rspec-rails'
|
||||||
gem 'guard-rspec', '0.5.5'
|
gem 'guard-rspec', '0.5.5'
|
||||||
gem 'jasmine', '1.3.1'
|
gem 'jasmine', '1.3.1'
|
||||||
gem 'pry'
|
# gem 'pry'
|
||||||
gem 'execjs', '1.4.0'
|
gem 'execjs', '1.4.0'
|
||||||
gem 'therubyracer' #, '0.11.0beta8'
|
gem 'therubyracer' #, '0.11.0beta8'
|
||||||
gem 'factory_girl_rails', '4.1.0'
|
gem 'factory_girl_rails', '4.1.0'
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
ActiveAdmin.register_page 'Feed' do
|
||||||
|
content do
|
||||||
|
|
||||||
|
# get user information via params
|
||||||
|
user_id = nil
|
||||||
|
user_id = params[:feed][:user_id] if params[:feed]
|
||||||
|
user_name = User.find(user_id).name if user_id
|
||||||
|
user_name = "All" unless user_id
|
||||||
|
|
||||||
|
render :partial => 'form', :locals => {param: params}
|
||||||
|
|
||||||
|
offset = 0
|
||||||
|
limit = 10
|
||||||
|
|
||||||
|
# get feed ids
|
||||||
|
where_sql = ''
|
||||||
|
where_sql = "where user_id = '#{user_id}'" if user_id
|
||||||
|
sql_feed_ids = "SELECT id, 'music_session_histories' as type, created_at FROM music_sessions_history #{where_sql}
|
||||||
|
UNION ALL
|
||||||
|
SELECT DISTINCT recording_id as id, 'recordings' as type, created_at FROM recorded_tracks #{where_sql}
|
||||||
|
UNION ALL
|
||||||
|
SELECT id, 'diagnostics' as type, created_at FROM diagnostics #{where_sql}
|
||||||
|
ORDER BY created_at DESC
|
||||||
|
OFFSET #{offset}
|
||||||
|
LIMIT #{limit};"
|
||||||
|
|
||||||
|
models = []
|
||||||
|
id_types = ActiveRecord::Base.connection.execute(sql_feed_ids).values
|
||||||
|
id_types.each do |id_and_type|
|
||||||
|
if id_and_type[1] == "music_session_histories"
|
||||||
|
models << JamRuby::MusicSessionHistory.find(id_and_type[0])
|
||||||
|
# elsif id_and_type[1] == "recordings"
|
||||||
|
# models << JamRuby::Recording.find(id_and_type[0])
|
||||||
|
elsif id_and_type[1] == "recordings"
|
||||||
|
models << JamRuby::Diagnostics.find(id_and_type[0])
|
||||||
|
else
|
||||||
|
raise "Unknown type returned from feed ids"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
columns do
|
||||||
|
column do
|
||||||
|
panel "Activity - #{user_name}" do
|
||||||
|
para id_types.inspect
|
||||||
|
ul do
|
||||||
|
models.each do |model|
|
||||||
|
li do
|
||||||
|
text_node model.inspect
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
controller do
|
||||||
|
def index
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -24,8 +24,8 @@ ActiveAdmin.register JamRuby::Mix, :as => 'Mixes' do
|
||||||
attributes_table_for(mix) do
|
attributes_table_for(mix) do
|
||||||
row :recording do |mix| auto_link(mix.recording, mix.recording.id) end
|
row :recording do |mix| auto_link(mix.recording, mix.recording.id) end
|
||||||
row :created_at do |mix| mix.created_at.strftime('%b %d %Y, %H:%M') end
|
row :created_at do |mix| mix.created_at.strftime('%b %d %Y, %H:%M') end
|
||||||
row :s3_url do |mix| mix.url end
|
# row :s3_url do |mix| mix.url end
|
||||||
row :manifest do |mix| mix.manifest end
|
# row :manifest do |mix| mix.manifest end
|
||||||
row :completed do |mix| "#{mix.completed ? "finished" : "not finished"}" end
|
row :completed do |mix| "#{mix.completed ? "finished" : "not finished"}" end
|
||||||
if mix.completed
|
if mix.completed
|
||||||
row :completed_at do |mix| mix.completed_at.strftime('%b %d %Y, %H:%M') end
|
row :completed_at do |mix| mix.completed_at.strftime('%b %d %Y, %H:%M') end
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*= require jquery.ui.all
|
*= require jquery.ui.all
|
||||||
|
*= require custom
|
||||||
*/
|
*/
|
||||||
// Active Admin's got SASS!
|
// Active Admin's got SASS!
|
||||||
@import "active_admin/mixins";
|
@import "active_admin/mixins";
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,19 @@
|
||||||
.version-info {
|
.version-info {
|
||||||
font-size:small;
|
font-size:small;
|
||||||
color:lightgray;
|
color:lightgray;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feed-pagination {
|
||||||
|
height: 20px;
|
||||||
|
.pagination {
|
||||||
|
float: left !important;
|
||||||
|
|
||||||
|
ul {
|
||||||
|
list-style-type: none;
|
||||||
|
|
||||||
|
li {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<%= semantic_form_for :feed, url: admin_feed_path, method: :get do |f| %>
|
||||||
|
<%= f.inputs do %>
|
||||||
|
<%= f.input :user, :as => :autocomplete, :url => autocomplete_user_email_admin_users_path, :input_html => { :id_element => "#feed_user_id" }%>
|
||||||
|
<%= f.input :user_id, :as => :hidden %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
<table class="index_table index">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<td>User Name - <%= @user_id %></td>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @users.each do |user| %>
|
||||||
|
<tr class="odd">
|
||||||
|
<td>
|
||||||
|
<p>
|
||||||
|
<%= link_to admin_feed_path(feed: {user_id: user.id}) do %>
|
||||||
|
<%= user.name %>
|
||||||
|
<% end %></p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="feed-pagination">
|
||||||
|
<%= will_paginate @users %>
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<atlassian-ide-plugin>
|
||||||
|
<project-configuration id="1">
|
||||||
|
<servers id="2" />
|
||||||
|
</project-configuration>
|
||||||
|
</atlassian-ide-plugin>
|
||||||
Loading…
Reference in New Issue