Skip to content

Commit

Permalink
:wq
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel Zaitsev authored and pavelz committed Aug 19, 2020
1 parent ff29c1b commit ce0a7b9
Show file tree
Hide file tree
Showing 10 changed files with 8,958 additions and 867 deletions.
5 changes: 4 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ gem 'jbuilder', '~> 2.5'
gem 'sidekiq'
gem 'faraday' #https get

gem 'chartkick'

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.1.0', require: false

Expand Down Expand Up @@ -107,6 +109,7 @@ group :test do
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
#gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]


gem 'irb', require: false
3 changes: 2 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ GEM
rack-test (>= 0.6.3)
regexp_parser (~> 1.5)
xpath (~> 3.2)
chartkick (3.3.2)
childprocess (3.0.0)
coderay (1.1.2)
coffee-rails (4.2.2)
Expand Down Expand Up @@ -369,6 +370,7 @@ DEPENDENCIES
capistrano-rvm
capistrano3-puma
capybara (>= 2.15)
chartkick
coffee-rails (~> 4.2)
devise
factory_bot_rails
Expand Down Expand Up @@ -402,7 +404,6 @@ DEPENDENCIES
spring-watcher-listen (~> 2.0.0)
thin
turbolinks (~> 5)
tzinfo-data
uglifier (>= 1.3.0)
web-console (>= 3.3.0)
webdrivers (~> 4.0)
Expand Down
6 changes: 2 additions & 4 deletions app/controllers/photos_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ def index


@feed = [photos, videos].flatten(1).sort_by{|a| a.created_at}.reverse()[0..MAX_FEED]
#binding.pry
respond_to do |f|
f.html
f.json { render json: @feed.map{|p| {
url: p.class == Photo ? p.image(:medium).url : p.video.url,
class: p.class.name,
image: Base64.encode64( (p.class == Photo ? p.image(:medium) : p.video).read).gsub("\n",''),
#image: Base64.encode64( (p.class == Photo ? p.image(:medium) : p.video).read).gsub("\n",''),

name: p.name,
filename: p.name,
Expand Down Expand Up @@ -60,7 +59,6 @@ def create
@location.save!

@photo.location_id = @location.id

@photo.save!

HardWorker.perform_async(@location.id)
Expand All @@ -79,5 +77,5 @@ def location_params

def photo_params
params.require(:photo).permit!
end
end
end
2 changes: 1 addition & 1 deletion app/javascript/components/Photos.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Photos extends React.Component {

{photos.slice((this.state.activePage-1)*10, (this.state.activePage)*10).map(photo =>(
<React.Fragment key={photo.id}>
<b>{photo.name}</b><br/>
{/*<b>{photo.name}</b><br/>*/}
{(() => {
switch(photo.class) {
case 'Photo':
Expand Down
2 changes: 1 addition & 1 deletion app/models/video.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class VideoUploader < Shrine
plugin :validation_helpers

Attacher.validate do
validate_mime_type_inclusion ["video/mp4"]
validate_mime_type_inclusion ["video/mp4","video/quicktime"]
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<%= csp_meta_tag %>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
<%= javascript_pack_tag 'application' %>
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload'%>
</head>

<body>
Expand Down
4 changes: 3 additions & 1 deletion app/views/photos/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
Insta
.fa.fa-camera-retro
.fa.fa-github
= link_to "https://github.com/pavelz"
= link_to "https://github.com/pavelz", "https://github.com/pavelz"
.fa.fa-book
= link_to "https://blog.arslogi.ca/", "https://blog.arslogi.ca/"

.col-10
.text-center
Expand Down
Loading

0 comments on commit ce0a7b9

Please sign in to comment.