merge dashboard list view, wire in live data

This commit is contained in:
Kyle Drake 2015-07-17 13:14:17 -07:00
commit 93427dca14
5 changed files with 168 additions and 10 deletions

View file

@ -61,6 +61,7 @@ end
# :nocov:
if ENV['RACK_ENV'] == 'development'
# Run async jobs immediately in development.
=begin
module Sidekiq
module Worker
module ClassMethods
@ -72,6 +73,7 @@ if ENV['RACK_ENV'] == 'development'
end
end
end
=end
end
# :nocov:

View file

@ -905,9 +905,17 @@ class Site < Sequel::Model
is_root_index: file_path == "#{base_files_path}/index.html"
}
site_file = site_files_dataset.where(path: file_path.gsub(base_files_path, '').sub(/^\//, '')).first
if site_file
file[:size] = site_file.size unless file[:is_directory]
file[:updated_at] = site_file.updated_at
end
file[:is_html] = !(file[:ext].match HTML_REGEX).nil?
file[:is_image] = !(file[:ext].match IMAGE_REGEX).nil?
file[:is_editable] = !(file[:ext].match EDITABLE_FILE_EXT).nil?
file
end

View file

@ -209,8 +209,8 @@
float: left;
@media (max-device-width: 480px), screen and (max-width: 800px) {
margin-left: 22px;
margin-top: 18px;
margin-left: 0px;
margin-top: 16px;
}
}
.welcome {
@ -241,6 +241,35 @@
width: 100%;
position: relative;
margin-top: 7px;
.column, input[type='checkbox'] {
display: none;
}
.btn-group {
float: left;
margin-right: 15px;
margin-left: -3px;
>.btn+.btn {
margin-left: 0px;
border-left: 1px solid rgba(0, 0, 0, 0.1);
}
.btn {
padding: 7px 11px;
margin-top: 1px;
background: #77ABB8;
@include box-shadow(0 0 5px rgba(0, 0, 0, 0.2));
&:hover {
background: #83B3C0;
}
&:focus, &.active {
outline: 0;
background: #4F727B;
}
}
}
}
.files .header {
background: #5E95A1;
@ -263,12 +292,22 @@
}
.files .actions {
float: right;
@media (max-device-width:480px), screen and (max-width:800px) {
float: left;
margin-top: 7px;
.fa {
display: none;
}
}
}
.files .btn-Action {
margin-left: 8px;
@media (max-device-width:480px), screen and (max-width:800px) {
margin: 4px 8px 4px 0;
margin: 4px 3px 4px 0;
padding: 8px 17px;
}
}
.files .list {
@ -364,6 +403,7 @@
white-space: nowrap;
overflow: hidden;
display: block;
text-overflow: ellipsis;
}
.html-thumbnail {
font-size: 11px;
@ -452,6 +492,102 @@
.html-thumbnail.misc.fileimagehover .overlay {
margin: 1px 0 0 2px;
}
.files .list.list-view {
padding: 0;
.upload-Boundary {
padding: 0;
border: 0;
margin: 0;
}
.file {
padding: 10px 20px;
margin: 0;
width: 100%;
&:nth-child(even) {
background: #EFE8DC;
}
.title {
margin: 0;
margin-left: 7px;
margin-top: 2px;
float: left;
font-size: 14px;
text-align: left;
width: 30%;
text-overflow: ellipsis;
@media (max-device-width:480px), screen and (max-width:800px) {
width: 33%;
}
}
input[type='checkbox'] {
display: block;
float: left;
margin-top: 5px;
margin-right: 6px;
}
}
.html-thumbnail, .misc-icon {
margin: 0;
margin-left: 4px;
float: left;
width: 23px;
height: 23px;
background-size: 23px;
padding: 0;
font-size: 8px;
img {
max-width: 23px;
max-height: 23px;
}
}
.misc-icon {
padding-top: 8px;
}
.folder-icon {
background-position: 0 4px;
background-size: 23px;
height: 23px;
}
.file > .overlay {
padding-top: 11px;
margin-left: 20px;
text-align: right;
background-color: transparent;
display: block;
width: 94%;
a {
color: #e93250;
display: inline;
margin-right: 5px;
}
.link-overlay {
width: 30%;
}
@media (max-device-width:480px), screen and (max-width:800px) {
width: 84%;
}
}
.html-thumbnail > .overlay {
display: none;
}
.column {
float: left;
width: 13%;
font-size: 13px;
display: block;
padding-top: 4px;
@media (max-device-width:480px), screen and (max-width:800px) {
display: none;
}
}
}
.site-actions {
float: left;
margin-top: 20px;

View file

@ -82,6 +82,10 @@
</div>
</div>
<div class="header">
<div class="btn-group" role="group" aria-label="...">
<button type="button" class="btn btn-default" title="List View"><i class="fa fa-list"></i></button>
<button type="button" class="btn btn-default" title="Icon View"><i class="fa fa-th"></i></button>
</div>
<div class="breadcrumbs">
<% if params[:dir].nil? || params[:dir].empty? || params[:dir] == '/' %>
Home
@ -106,7 +110,7 @@
<a href="#" class="btn-Action" onclick="clickUploadFiles(); return false"><i class="fa fa-arrow-circle-up"></i> Upload</a>
</div>
</div>
<div class="list">
<div class="list list-view">
<form action="/site_files/upload" class="dropzone" id="uploads">
<div class="dz-message" style="display: none"></div>
<input name="csrf_token" type="hidden" value="<%= csrf_token %>">
@ -114,6 +118,7 @@
<div class="upload-Boundary <%= @file_list.length <= 5 ? 'with-instruction' : '' %>">
<% @file_list.each do |file| %>
<div class="file filehover">
<!-- <input type="checkbox" name="" value="" /> -->
<% if file[:is_html] && current_site.screenshot_exists?(file[:path], '210x158') %>
<div class="html-thumbnail html fileimagehover">
<img src="<%= current_site.screenshot_url(file[:path], '210x158') %>" alt="">
@ -137,12 +142,19 @@
<% end %>
<a class="title">
<% if file[:name].length > 19 %>
<%= file[:name].slice(0..18) %>&hellip;
<% else %>
<%= file[:name] %>
<% end %>
<%= file[:name] %>
</a>
<div class="column size">
<% if file[:size] %>
<%= file[:size].to_bytes_pretty %>
<% end %>
</div>
<div class="column updated">
<% if file[:updated_at] %>
<%= file[:updated_at].ago %>
<% end %>
</div>
<div class="overlay">
<% if file[:is_editable] %>
<a href="/site_files/text_editor<%= file[:path] %>"><i class="fa fa-edit" title="Edit"></i> Edit</a>

View file

@ -3,7 +3,7 @@ class EmailWorker
sidekiq_options queue: :emails, retry: 10, backtrace: true
def perform(args={})
raise 'no' if ENV['RACK_ENV'].nil? || ENV['RACK_ENV'] == 'development'
return if ENV['RACK_ENV'].nil? || ENV['RACK_ENV'] == 'development'
unsubscribe_token = Site.email_unsubscribe_token args['to']
if args['no_footer']