Skip to content

Commit

Permalink
2012 выборы вверх. в массовой загрузке увеличины превью. гем лок верн…
Browse files Browse the repository at this point in the history
…ул нормальный.
  • Loading branch information
oshlykov committed Mar 3, 2012
1 parent 999534a commit 770d259
Show file tree
Hide file tree
Showing 13 changed files with 113 additions and 142 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ gem "guard-rails", ">= 0.0.3", :group => :development
gem "guard-livereload", ">= 0.3.0", :group => :development
gem "guard-rspec", ">= 0.4.3", :group => :development
gem "guard-cucumber", ">= 0.6.1", :group => :development
gem "devise", ">= 1.5.0"
#gem "devise", ">= 1.5.0"
gem 'bcrypt-ruby'
gem 'cancan'
gem "twitter-bootstrap-rails", ">= 2.0.0", :platform => :ruby
Expand Down
128 changes: 59 additions & 69 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ GIT

GIT
remote: git://github.com/plataformatec/simple_form.git
revision: 2830fd37ff9ff8b6bb2388d404704a88dfa9b8c2
revision: cd3eeb7d1a7303633529dedb9ec69d6c1cad91a9
specs:
simple_form (2.0.1)
simple_form (2.0.0.rc)
actionpack (~> 3.0)
activemodel (~> 3.0)

Expand Down Expand Up @@ -43,10 +43,10 @@ GEM
activesupport (= 3.1.1)
activesupport (3.1.1)
multi_json (~> 1.0)
addressable (2.2.7)
addressable (2.2.6)
ancestry (1.2.4)
activerecord (>= 2.2.2)
arel (2.2.3)
arel (2.2.1)
bcrypt-ruby (3.0.1)
builder (3.0.0)
cancan (1.6.7)
Expand All @@ -57,69 +57,63 @@ GEM
rack-test (>= 0.5.4)
selenium-webdriver (~> 2.0)
xpath (~> 0.1.4)
carrierwave (0.5.8)
carrierwave (0.5.7)
activesupport (~> 3.0)
childprocess (0.3.1)
childprocess (0.2.3)
ffi (~> 1.0.6)
coffee-rails (3.1.1)
coffee-script (>= 2.2.0)
railties (~> 3.1.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.2.0)
coffee-script-source (1.1.3)
commonjs (0.2.0)
therubyracer (~> 0.9.9)
cucumber (1.1.9)
cucumber (1.1.3)
builder (>= 2.1.2)
diff-lcs (>= 1.1.2)
gherkin (~> 2.9.0)
gherkin (~> 2.6.7)
json (>= 1.4.6)
term-ansicolor (>= 1.0.6)
cucumber-rails (1.3.0)
capybara (>= 1.1.2)
cucumber (>= 1.1.8)
cucumber-rails (1.2.0)
capybara (>= 1.1.1)
cucumber (>= 1.1.1)
nokogiri (>= 1.5.0)
database_cleaner (0.7.1)
devise (2.0.4)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.0.3)
railties (~> 3.1)
warden (~> 1.1.1)
database_cleaner (0.7.0)
diff-lcs (1.1.3)
em-websocket (0.3.6)
em-websocket (0.3.5)
addressable (>= 2.1.1)
eventmachine (>= 0.12.9)
erubis (2.7.0)
eventmachine (0.12.10)
execjs (1.3.0)
execjs (1.2.9)
multi_json (~> 1.0)
factory_girl (2.6.0)
activesupport (>= 2.3.9)
factory_girl_rails (1.7.0)
factory_girl (~> 2.6.0)
factory_girl (2.3.2)
activesupport
factory_girl_rails (1.4.0)
factory_girl (~> 2.3.0)
railties (>= 3.0.0)
fastercsv (1.5.4)
ffi (1.0.11)
gherkin (2.9.0)
gherkin (2.6.8)
json (>= 1.4.6)
guard (1.0.0)
ffi (>= 0.5.0)
guard (0.8.8)
thor (~> 0.14.6)
guard-bundler (0.1.3)
bundler (>= 1.0.0)
guard (>= 0.2.2)
guard-cucumber (0.7.5)
guard-cucumber (0.7.4)
cucumber (>= 0.10)
guard (>= 0.8.3)
guard-livereload (0.4.2)
guard-livereload (0.3.1)
em-websocket (>= 0.2.0)
guard (>= 0.10.0)
multi_json (~> 1.0)
guard-rails (0.1.0)
guard (>= 0.4.0)
multi_json (~> 1.0.3)
guard-rails (0.0.3)
guard (>= 0.2.2)
guard-rspec (0.6.0)
guard (>= 0.10.0)
guard-rspec (0.5.8)
guard (>= 0.8.4)
haml (3.1.4)
haml-rails (0.3.4)
actionpack (~> 3.0)
Expand All @@ -135,13 +129,13 @@ GEM
jquery-rails (1.0.19)
railties (~> 3.0)
thor (~> 0.14)
json (1.6.5)
json (1.6.2)
launchy (2.0.5)
addressable (~> 2.2.6)
less (2.0.9)
commonjs (~> 0.2.0)
therubyracer (~> 0.9.9)
less-rails (2.1.6)
less-rails (2.1.5)
actionpack (>= 3.1)
less (~> 2.0.7)
libv8 (3.3.10.4)
Expand All @@ -150,14 +144,13 @@ GEM
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.17.2)
mini_magick (3.4)
subexec (~> 0.2.1)
multi_json (1.1.0)
mini_magick (3.3)
subexec (~> 0.1.0)
multi_json (1.0.4)
mysql (2.8.1)
mysql2 (0.3.11)
nokogiri (1.5.0)
orm_adapter (0.0.6)
parallel (0.5.15)
parallel (0.5.11)
polyglot (0.3.3)
rack (1.3.6)
rack-cache (1.1)
Expand Down Expand Up @@ -186,58 +179,56 @@ GEM
rdoc (~> 3.4)
thor (~> 0.14.6)
rake (0.9.2.2)
rdoc (3.12)
rdoc (3.11)
json (~> 1.4)
responders (0.6.5)
rspec (2.8.0)
rspec-core (~> 2.8.0)
rspec-expectations (~> 2.8.0)
rspec-mocks (~> 2.8.0)
rspec-core (2.8.0)
rspec-expectations (2.8.0)
rspec (2.8.0.rc1)
rspec-core (= 2.8.0.rc1)
rspec-expectations (= 2.8.0.rc1)
rspec-mocks (= 2.8.0.rc1)
rspec-core (2.8.0.rc1)
rspec-expectations (2.8.0.rc1)
diff-lcs (~> 1.1.2)
rspec-mocks (2.8.0)
rspec-rails (2.8.1)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec (~> 2.8.0)
rubyzip (0.9.6.1)
sass (3.1.15)
rspec-mocks (2.8.0.rc1)
rspec-rails (2.8.0.rc1)
actionpack (~> 3.0)
activesupport (~> 3.0)
railties (~> 3.0)
rspec (= 2.8.0.rc1)
rubyzip (0.9.5)
sass (3.1.11)
sass-rails (3.1.5)
actionpack (~> 3.1.0)
railties (~> 3.1.0)
sass (~> 3.1.10)
tilt (~> 1.3.2)
selenium-webdriver (2.20.0)
childprocess (>= 0.2.5)
ffi (~> 1.0)
multi_json (~> 1.0)
selenium-webdriver (2.14.0)
childprocess (>= 0.2.1)
ffi (~> 1.0.9)
multi_json (~> 1.0.4)
rubyzip
sprockets (2.0.3)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.5)
subexec (0.2.1)
sqlite3 (1.3.4)
subexec (0.1.0)
term-ansicolor (1.0.7)
therubyracer (0.9.10)
therubyracer (0.9.9)
libv8 (~> 3.3.10)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
twitter-bootstrap-rails (2.0.3)
twitter-bootstrap-rails (2.0.2)
actionpack (>= 3.1)
less-rails (~> 2.1.6)
less-rails (~> 2.1.5)
railties (>= 3.1)
tzinfo (0.3.31)
uglifier (1.2.3)
uglifier (1.1.0)
execjs (>= 0.3.0)
multi_json (>= 1.0.2)
warden (1.1.1)
rack (>= 1.0)
xpath (0.1.4)
nokogiri (~> 1.3)

Expand All @@ -253,7 +244,6 @@ DEPENDENCIES
coffee-rails (~> 3.1.1)
cucumber-rails (>= 1.2.0)
database_cleaner (>= 0.7.0)
devise (>= 1.5.0)
factory_girl_rails (>= 1.4.0)
fastercsv
guard (>= 0.6.2)
Expand Down
Binary file added app/assets/images/karik_android.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
//= require jquery
//= require jquery_ujs
//= require_tree ../../../vendor/assets/javascripts/.
//= twitter/bootstrap
//= require twitter/bootstrap
//= require_tree .
2 changes: 1 addition & 1 deletion app/assets/javascripts/folders.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ $(document).ready(function(){
downloadTable: $('#pictures'),
buildDownloadRow: function (file) {
return $('<div id="picture_'+file.id+'" class="picture">'+
'<a href="'+file.url+'"><img src="'+file.thumbnail_url+'"/></a>'+
'<a href="'+file.url+'"><img src="'+file.preview_url+'"/></a>'+
'<a rel="nofollow" data-remote="true" data-method="delete" data-confirm="Удалит цифровую копию?" href="'+file.delete_url+'"><i class="icon-remove"></i></a></div>');
}
});
Expand Down
23 changes: 3 additions & 20 deletions app/controllers/pictures_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def create
#mobile upload
if user = User.find_by_email(params['login'])
unless user.authenticate(params['password'])
render(:file => "public/403.html", :status => '403') and return
render(:file => "public/403.html", :status => '207') and return
end

params['picture'] = {"image" => params['file']}
Expand All @@ -25,27 +25,10 @@ def create
end
params['commission_id'] = user.commission_id
else
render :file => "public/404.html", :status => '404' and return
# ИСПРАВИТЬ добавить сохранение неприкреплённых протоколов в Спецхран
render :file => "public/404.html", :status => '208' and return
end

# file = file.with_indifferent_access if file.is_a?(Hash)
# if file.is_a?(Hash) && file.has_key?(:filename) &&
# file.has_key?(:content_type) && file.has_key?(:data) && !file.has_key?(:tempfile)
# file[:tempfile] = StringIO.new(Base64.decode64(file.delete(:data)))
end
=begin
print_r($_FILES);
$heades_printed = print_r($_SERVER, true);
$new_image_name = "namethisimage.MMMMM";
move_uploaded_file($_FILES["file"]["tmp_name"], "/home/borki/public_html/67/sites/default/files/UploadedDocs/".$new_image_name);
$myFile = "/home/borki/public_html/67/sites/default/files/UploadedDocs/headers";
$fh = fopen($myFile, 'w');
fwrite($fh, $heades_printed);
fwrite($fh, print_r($_FILES, true));
fclose($fh);
=end
end
create! do |ok, nok|
ok.js do
Expand Down
1 change: 1 addition & 0 deletions app/models/picture.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def to_jq_upload
"size" => image.size,
"url" => image.url,
"thumbnail_url" => image.thumb.url,
"preview_url" => image.preview.url,
"delete_url" => picture_path(id),
"delete_type" => "DELETE"
}
Expand Down
4 changes: 2 additions & 2 deletions app/uploaders/picture_uploader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ def store_dir
end

version :preview do
process :resize_to_fit => [300, 300]
process :resize_to_limit => [600, 600]
end

def watermark(path_to_file)
manipulate! do |img|
logo = MiniMagick::Image.open(path_to_file)
Expand Down
7 changes: 7 additions & 0 deletions app/views/folders/_picture.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.picture[picture]
%a{:href => picture.image_url, :target => '_blank'}
= image_tag picture.image_url(:preview) if picture.image?
- if can? :destroy, picture
= link_to raw('<i class="icon-remove"></i>'),
picture_path(picture.id), :method => :delete,
:confirm => "Удалить цифровую копию?", :remote => :true
2 changes: 1 addition & 1 deletion app/views/folders/edit.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
= f.submit 'Сохранить'

#pictures
= render :partial => '/pictures/picture', :collection => @folder.pictures
= render :partial => 'picture', :collection => @folder.pictures

= form_for :picture, :url => folder_pictures_path(@folder),
:html => { :class => 'pics_upload', :multipart => true} do |f|
Expand Down
Loading

0 comments on commit 770d259

Please sign in to comment.