c80_contest 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b67512c64a0116f899791b232453e32c48fc92ec
4
- data.tar.gz: b9403eff035448dc0de9302796d4dbe3d1da76db
3
+ metadata.gz: e1e0d9110a81f4e649d7e7b39ae5cb91726ed2d1
4
+ data.tar.gz: f7e602e7497286134e8f00eb8e79b5801bb0a582
5
5
  SHA512:
6
- metadata.gz: 9dbe501af079144e075ec2c2a4ae824aa0e7e2eac9d15da047d37d105bef428ea9177c0c3b4ba30bfa9dac740687d93f8be8738baee59e88baff59f30258b22c
7
- data.tar.gz: 5aa1e8fb39f208fee91bec4d783c5d7f237851ba10c62f5a7093da6bf9b3164dde9deb7b3d50dd981657b85ac76b6a464962a27b1f2fe012023d614955f7355c
6
+ metadata.gz: 3dd4f431f6bbc7ec360b60fa640f7ec2837ffdf4603618ae5ddada817092fd92661795097103f1d3c9b46a90c908e3566f6c184fe3d8544266204b9b0d856284
7
+ data.tar.gz: '06194298a22aeb03e06b0f6ef9b5a15cbd8e0dbd9e4fc771ea0e730535643d1898add924aa6bf0ce8f92cee296e57e782692853e56e6ac4e5d7559915a1cf2af'
data/.gitignore CHANGED
@@ -14,4 +14,5 @@
14
14
  .rspec_status
15
15
  .env
16
16
  *.log
17
- .byebug_history
17
+ .byebug_history
18
+ .zeus.sock
data/Gemfile CHANGED
@@ -1,4 +1,37 @@
1
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in c80_contest.gemspec
4
4
  gemspec
5
+
6
+ group :development, :test do
7
+
8
+ # You need these
9
+ gem 'rspec-rails'
10
+ gem 'guard'
11
+ gem 'guard-rspec'
12
+ gem 'guard-zeus'
13
+ gem 'guard-bundler'
14
+
15
+ gem 'factory_girl_rails'
16
+
17
+ # You don't need these, but I use them
18
+ # gem 'rb-fsevent'
19
+ gem 'ffaker'
20
+ # gem 'pry'
21
+
22
+ end
23
+
24
+ group :development do
25
+ # You don't need these, but I use them
26
+ # gem 'better_errors'
27
+ gem 'awesome_print'
28
+ # gem 'brakeman'
29
+ end
30
+
31
+ group :test do
32
+ # You don't need these, but I use them
33
+ # gem 'vcr'
34
+ # gem 'webmock'
35
+ gem 'capybara'
36
+ # gem 'simplecov', require: false
37
+ end
data/Guardfile ADDED
@@ -0,0 +1,59 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ ## Uncomment and set this to only include directories you want to watch
5
+ # directories %w(app lib config test spec features) \
6
+ # .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
7
+
8
+ ## Note: if you are using the `directories` clause above and you are not
9
+ ## watching the project directory ('.'), then you will want to move
10
+ ## the Guardfile to a watched dir and symlink it back, e.g.
11
+ #
12
+ # $ mkdir config
13
+ # $ mv Guardfile config/
14
+ # $ ln -s config/Guardfile .
15
+ #
16
+ # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
17
+
18
+ guard 'zeus' do
19
+ require 'ostruct'
20
+
21
+ rspec = OpenStruct.new
22
+ rspec.spec_dir = 'spec'
23
+ rspec.spec = ->(m) { "#{rspec.spec_dir}/#{m}_spec.rb" }
24
+ rspec.spec_helper = "#{rspec.spec_dir}/spec_helper.rb"
25
+
26
+ # matchers
27
+ rspec.spec_files = /^#{rspec.spec_dir}\/.+_spec\.rb$/
28
+
29
+ # Ruby apps
30
+ ruby = OpenStruct.new
31
+ ruby.lib_files = /^(lib\/.+)\.rb$/
32
+
33
+ watch(rspec.spec_files)
34
+ watch(rspec.spec_helper) { rspec.spec_dir }
35
+ watch(ruby.lib_files) { |m| rspec.spec.call(m[1]) }
36
+
37
+ # Rails example
38
+ rails = OpenStruct.new
39
+ rails.app_files = /^app\/(.+)\.rb$/
40
+ rails.views_n_layouts = /^app\/(.+(?:\.erb|\.haml|\.slim))$/
41
+ rails.controllers = %r{^app/controllers/(.+)_controller\.rb$}
42
+
43
+ watch(rails.app_files) { |m| rspec.spec.call(m[1]) }
44
+ watch(rails.views_n_layouts) { |m| rspec.spec.call(m[1]) }
45
+ watch(rails.controllers) do |m|
46
+ [
47
+ rspec.spec.call("routing/#{m[1]}_routing"),
48
+ rspec.spec.call("controllers/#{m[1]}_controller"),
49
+ rspec.spec.call("acceptance/#{m[1]}")
50
+ ]
51
+ end
52
+
53
+ # TestUnit
54
+ # watch(%r|^test/(.*)_test\.rb$|)
55
+ # watch(%r|^lib/(.*)([^/]+)\.rb$|) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
56
+ # watch(%r|^test/test_helper\.rb$|) { "test" }
57
+ # watch(%r|^app/controllers/(.*)\.rb$|) { |m| "test/functional/#{m[1]}_test.rb" }
58
+ # watch(%r|^app/models/(.*)\.rb$|) { |m| "test/unit/#{m[1]}_test.rb" }
59
+ end
data/README.md CHANGED
@@ -110,4 +110,6 @@ div#lo {
110
110
  * [ ] Проверить, удаляются ли окна из html, когда их закрываем или когда они сами исчезают
111
111
  * [ ] Вывести в настройки размер кнопки-картинки, использовать их в uploader-е и в css прелоадера
112
112
  * [ ] Дописать тесты
113
- * [ ] Допилить Readme
113
+ * [ ] Допилить Readme
114
+ * [ ] ActiveAdmin: Settings: решить вопрос, почему не хочет обновлять данные в базе "из коробки",
115
+ пришлось лепить контроллер, и времени не хватило, не показывает ошибки валидации.
@@ -17,16 +17,42 @@ ActiveAdmin.register C80Contest::Bid, :as => 'Bid' do
17
17
 
18
18
  index do
19
19
  id_column
20
- column :created_at
20
+ column :created_at do |bid|
21
+ l(bid.created_at.in_time_zone('Moscow'), {:format => '%Y-%b-%d [%H:%M:%S]'})
22
+ end
21
23
  column :title
22
24
  column :phone
23
25
  column :photo do |bid|
24
26
  if bid.photo.present?
25
- link_to image_tag(bid.photo.thumb.url), bid.photo.url
27
+ # link_to image_tag(bid.photo.thumb.url), bid.photo.url
28
+ thumb_base_file_name = File.basename(bid.photo.thumb.url)
29
+ base_file_name = File.basename(bid.photo.url)
30
+ link_to image_tag("/uploads/bids/#{thumb_base_file_name}"),
31
+ "/uploads/bids/#{base_file_name}"
26
32
  end
27
33
  end
28
34
 
29
35
  actions
30
36
  end
31
37
 
38
+ show do
39
+ attributes_table do
40
+ row :title
41
+ row :phone
42
+ row :created_at do |bid|
43
+ # bid.created_at.in_time_zone('Moscow').strftime('%Y-%b-%d %H:%M:%S')
44
+ l(bid.created_at.in_time_zone('Moscow'), {:format => '%Y-%b-%d [%H:%M:%S]'})
45
+ end
46
+ row :photo do |bid|
47
+ if bid.photo.present?
48
+ # link_to image_tag(bid.photo.thumb.url), bid.photo.url
49
+ thumb_base_file_name = File.basename(bid.photo.thumb.url)
50
+ base_file_name = File.basename(bid.photo.url)
51
+ link_to image_tag("/uploads/bids/#{thumb_base_file_name}"),
52
+ "/uploads/bids/#{base_file_name}"
53
+ end
54
+ end
55
+ end
56
+ end
57
+
32
58
  end
@@ -1,6 +1,7 @@
1
1
  module C80Contest
2
- class ApplicationController < ActionController::Base
3
- protect_from_forgery with: :exception
2
+ # This line will inherit from the host applications ApplicationController,
3
+ # giving access to your authentication, current_user, etc...
4
+ class ApplicationController < ::ApplicationController
4
5
 
5
6
  # noinspection RubyResolve
6
7
  before_filter :check_is_active
@@ -0,0 +1,10 @@
1
+ module C80Contest
2
+ class BidPhotosController < ApplicationController
3
+ before_filter :authenticate_user!
4
+ skip_before_filter :verify_authenticity_token
5
+ def image
6
+ path = "uploads/bids/#{params[:file_name]}.#{params[:ext]}"
7
+ send_file path, :x_sendfile => true, :disposition => :inline
8
+ end
9
+ end
10
+ end
@@ -12,7 +12,7 @@ module C80Contest
12
12
  end
13
13
 
14
14
  def store_dir
15
- 'uploads/bids/'
15
+ "#{Rails.root}/uploads/bids/"
16
16
  end
17
17
 
18
18
  def filename
data/c80_contest.gemspec CHANGED
@@ -39,7 +39,7 @@ Gem::Specification.new do |spec|
39
39
  spec.add_development_dependency 'bootstrap-sass', '>= 3.3.5.1'
40
40
  spec.add_development_dependency 'sass-rails', '>= 5.0.4'
41
41
  spec.add_development_dependency 'c80_modal_forms', '~> 0.1.0.1'
42
- spec.add_dependency 'byebug', '~> 9.0.6'
42
+ # spec.add_dependency 'byebug', '~> 9.0.6'
43
43
 
44
44
  # spec.add_development_dependency 'combustion', '~> 0.6.0'
45
45
 
data/config/routes.rb CHANGED
@@ -2,4 +2,7 @@ C80Contest::Engine.routes.draw do
2
2
  match '/give_me_bid_form', :to => 'site#give_me_form', :via => :post, :defaults => { :format => 'js' }
3
3
  match '/make_bid', :to => 'bid#make_bid', :via => :post, :defaults => { :format => 'js' }
4
4
  match '/rules_page', :to => 'pages#rules_page', :via => :get
5
+
6
+ get '/uploads/bids/:file_name.:ext', :to => 'bid_photos#image'
7
+
5
8
  end
data/custom_plan.rb ADDED
@@ -0,0 +1,11 @@
1
+ require 'zeus/rails'
2
+
3
+ class CustomPlan < Zeus::Rails
4
+
5
+ # def my_custom_command
6
+ # # see https://github.com/burke/zeus/blob/master/docs/ruby/modifying.md
7
+ # end
8
+
9
+ end
10
+
11
+ Zeus.plan = CustomPlan.new
data/engine_plan.rb ADDED
@@ -0,0 +1,14 @@
1
+ require 'zeus/rails'
2
+
3
+ ROOT_PATH = File.expand_path(Dir.pwd)
4
+ ENVIRONMENT_PATH = File.expand_path('spec/dummy/config/environment', ROOT_PATH)
5
+ ENV_PATH = File.expand_path('spec/dummy/config/environment', ROOT_PATH)
6
+ BOOT_PATH = File.expand_path('spec/dummy/config/boot', ROOT_PATH)
7
+ APP_PATH = File.expand_path('spec/dummy/config/application', ROOT_PATH)
8
+ ENGINE_ROOT = File.expand_path(Dir.pwd)
9
+ ENGINE_PATH = File.expand_path('lib/c80_contest/engine', ENGINE_ROOT)
10
+
11
+ class EnginePlan < Zeus::Rails
12
+ end
13
+
14
+ Zeus.plan = EnginePlan.new
data/lib/c80_contest.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'c80_contest/version'
2
2
  require 'c80_contest/engine'
3
- require 'byebug'
3
+ # require 'byebug'
4
4
 
5
5
  module C80Contest
6
6
  def self.table_name_prefix
@@ -1,3 +1,3 @@
1
1
  module C80Contest
2
- VERSION = '0.1.4'
2
+ VERSION = '0.1.5'
3
3
  end
data/zeus.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "command": "ruby -rubygems -r./engine_plan -eZeus.go",
3
+
4
+ "plan": {
5
+ "boot": {
6
+ "default_bundle": {
7
+ "development_environment": {
8
+ },
9
+ "test_environment": {
10
+ "test_helper": {"test": ["rspec", "testrb"]}
11
+ }
12
+ }
13
+ }
14
+ }
15
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: c80_contest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - C80609A
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-19 00:00:00.000000000 Z
11
+ date: 2017-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -234,20 +234,6 @@ dependencies:
234
234
  - - "~>"
235
235
  - !ruby/object:Gem::Version
236
236
  version: 0.1.0.1
237
- - !ruby/object:Gem::Dependency
238
- name: byebug
239
- requirement: !ruby/object:Gem::Requirement
240
- requirements:
241
- - - "~>"
242
- - !ruby/object:Gem::Version
243
- version: 9.0.6
244
- type: :runtime
245
- prerelease: false
246
- version_requirements: !ruby/object:Gem::Requirement
247
- requirements:
248
- - - "~>"
249
- - !ruby/object:Gem::Version
250
- version: 9.0.6
251
237
  description: Пришли чек и участвуй в розыгрыше 500 литров бензина
252
238
  email:
253
239
  - c080609a@gmail.com
@@ -262,6 +248,7 @@ files:
262
248
  - ".travis.yml"
263
249
  - CODE_OF_CONDUCT.md
264
250
  - Gemfile
251
+ - Guardfile
265
252
  - LICENSE.txt
266
253
  - MIT-LICENSE
267
254
  - README.md
@@ -286,6 +273,7 @@ files:
286
273
  - app/assets/stylesheets/lib/fileinput/themes/explorer/theme.scss
287
274
  - app/controllers/c80_contest/application_controller.rb
288
275
  - app/controllers/c80_contest/bid_controller.rb
276
+ - app/controllers/c80_contest/bid_photos_controller.rb
289
277
  - app/controllers/c80_contest/pages_controller.rb
290
278
  - app/controllers/c80_contest/site_controller.rb
291
279
  - app/helpers/c80_contest/application_helper.rb
@@ -308,6 +296,7 @@ files:
308
296
  - c80_contest.gemspec
309
297
  - config/routes.rb
310
298
  - create_base.rb
299
+ - custom_plan.rb
311
300
  - db/migrate/20170510124400_create_c80_contest_bids.rb
312
301
  - db/migrate/20170511145501_create_c80_contest_settings.rb
313
302
  - db/migrate/20170512114103_add_c80_contest_admin_labels_to_settings.rb
@@ -315,10 +304,12 @@ files:
315
304
  - db/migrate/20170518165005_add_c80_contest_is_active_to_settings.rb
316
305
  - db/migrate/20170518191906_add_c80_contest_button_photo_to_settings.rb
317
306
  - db/seeds/c80_contest_fill_settings.rb
307
+ - engine_plan.rb
318
308
  - lib/c80_contest.rb
319
309
  - lib/c80_contest/engine.rb
320
310
  - lib/c80_contest/version.rb
321
311
  - lib/tasks/c80_contest_tasks.rake
312
+ - zeus.json
322
313
  homepage: https://github.com/c80609a/c80_contest
323
314
  licenses:
324
315
  - MIT