This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(document).on "page:change page:load", -> | |
| $table = $('#dt_basic') | |
| #setting defaults | |
| $.extend $.fn.dataTable.defaults, | |
| processing: true | |
| serverSide: true | |
| type: "POST" | |
| "sServerMethod": "POST" | |
| pagingType: 'full_numbers' | |
| ajax: $table.attr('data-source') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %table#dt_basic.remote{ data: { source: datatables_index_products_path(product_search: params[:product_search]) } } | |
| %thead | |
| %tr | |
| %th= 'Name' | |
| %th= 'Prototype name' | |
| %th= 'Producer' | |
| %th= 'Category' | |
| %th= 'Margin' | |
| %th{ 'data-datatable' => '{"bSortable":false}' } | |
| %tbody |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def datatables_index | |
| render json: ProductDatatable.new(view_context, { current_user: current_user, search_params: params[:product_search] }) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ProductDatatable < AjaxDatatablesRails::Base | |
| def_delegators :@view, :render, :to_price | |
| def sortable_columns | |
| @sortable_columns ||= [ | |
| 'Product.name', | |
| 'Prototype.name', | |
| 'ProducersDictionary.name', | |
| 'ProductCategory.name', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| begin | |
| smtp = Net::SMTP.new(@website_setting.smtp_server, @website_setting.smtp_port) | |
| smtp.enable_starttls | |
| smtp.start(@website_setting.smtp_domain, @website_setting.smtp_user_name, @website_setting.smtp_password, :plain) | |
| rescue Net::SMTPAuthenticationError | |
| #rescue here | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| after_filter :cors_set_access_control_headers | |
| private | |
| def cors_set_access_control_headers | |
| headers['Access-Control-Allow-Origin'] = 'http://registraion-form-for-app.domain.pl' | |
| headers['Access-Control-Allow-Methods'] = 'POST' | |
| headers['Access-Control-Max-Age'] = "1728000" | |
| end |