Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Исправления в synergy #1

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions app/controllers/admin/products_controller_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
Admin::ProductsController.class_eval do
require 'nokogiri'
require 'open-uri'


update.before :modify_products_fields
create.before :modify_products_fields

def import_from_yandex_market
if params[:model_id].to_i > 0
market_url = "http://market.yandex.ru/model.xml?modelid=#{params[:model_id]}"
Expand Down Expand Up @@ -52,9 +55,19 @@ def import_from_yandex_market
end
redirect_to admin_products_path
end


def modify_products_fields
parameters = params[object_name]

if parameters[:description] && ActionController::Base.helpers.strip_tags(parameters[:description]).gsub(' ', '').strip.empty?
parameters[:description] = nil
end

params[object_name] = parameters
end

private

def download_remote_image(image_url)
io = open(URI.parse(image_url))
def io.original_filename; [base_uri.path.split('/').last, '.jpg'].join; end
Expand Down
5 changes: 5 additions & 0 deletions app/controllers/users_controller_decorator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
UsersController.class_eval do
def show
@orders = @user.orders.complete.order('created_at DESC')
end
end
4 changes: 4 additions & 0 deletions public/stylesheets/admin/synergy.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ ul#shipping-specs li {
display: block;
list-style-image: none;
}

#content {
position: relative;
}