diff --git a/addons/default/visiosoft/advs-module/migrations/2018_09_25_211014_visiosoft.module.advs__create_advs_fields.php b/addons/default/visiosoft/advs-module/migrations/2018_09_25_211014_visiosoft.module.advs__create_advs_fields.php index e201368aa..80e21e915 100644 --- a/addons/default/visiosoft/advs-module/migrations/2018_09_25_211014_visiosoft.module.advs__create_advs_fields.php +++ b/addons/default/visiosoft/advs-module/migrations/2018_09_25_211014_visiosoft.module.advs__create_advs_fields.php @@ -219,5 +219,11 @@ class VisiosoftModuleAdvsCreateAdvsFields extends Migration 'default_value' => 0, ] ], + 'count_show_ad' => [ + 'type' => 'anomaly.field_type.integer', + 'config' => [ + 'default_value' => 0, + ] + ], ]; } diff --git a/addons/default/visiosoft/advs-module/migrations/2018_09_25_211039_visiosoft.module.advs__create_advs_stream.php b/addons/default/visiosoft/advs-module/migrations/2018_09_25_211039_visiosoft.module.advs__create_advs_stream.php index 77c2ed644..30e9dcd7b 100644 --- a/addons/default/visiosoft/advs-module/migrations/2018_09_25_211039_visiosoft.module.advs__create_advs_stream.php +++ b/addons/default/visiosoft/advs-module/migrations/2018_09_25_211039_visiosoft.module.advs__create_advs_stream.php @@ -32,7 +32,9 @@ class VisiosoftModuleAdvsCreateAdvsStream extends Migration 'slug' => [ 'required' => true, ], - 'advs_desc', + 'advs_desc' => [ + 'translatable' => true, + ], 'cat1', 'cat2', 'cat3', @@ -68,7 +70,8 @@ class VisiosoftModuleAdvsCreateAdvsStream extends Migration 'adv_day', 'cf_json', 'cover_photo', - 'count_show_phone' + 'count_show_phone', + 'count_show_ad' ]; } diff --git a/addons/default/visiosoft/advs-module/resources/js/new-create.js b/addons/default/visiosoft/advs-module/resources/js/new-create.js index e85dae5e0..b94edf40f 100644 --- a/addons/default/visiosoft/advs-module/resources/js/new-create.js +++ b/addons/default/visiosoft/advs-module/resources/js/new-create.js @@ -62,4 +62,94 @@ $('input[name="price"]').on('click', function () { { $(this).val(""); } -}) \ No newline at end of file +}) + +$(document).on('ajaxComplete ready shown.bs.tab', function () { + + // Initialize WYSIWYG editors. + $('textarea[data-field="advs_desc"]:not(.hasEditor)').each(function () { + + /** + * Gather available buttons / plugins. + */ + let textarea = $(this); + + let buttons = textarea.data('available_buttons'); + let plugins = textarea.data('available_plugins'); + + textarea.addClass('hasEditor'); + + textarea.redactor({ + + element: $(this), + + /** + * Initialize the editor icons. + */ + callbacks: { + init: function () { + + let icons = {}; + + $.each(buttons, function (k, v) { + if (v.icon) { + icons[v.button ? v.button : k] = ''; + } + }); + + $.each(plugins, function (k, v) { + if (v.icon) { + icons[v.button ? v.button : k] = ''; + } + }); + + $.each(this.button.all(), $.proxy(function (i, s) { + + let key = $(s).attr('rel'); + + if (typeof icons[key] !== 'undefined') { + let icon = icons[key]; + let button = this.button.get(key); + this.button.setIcon(button, icon); + } + + }, this)); + } + }, + + /** + * Settings + */ + script: false, + structure: true, + linkTooltip: true, + cleanOnPaste: true, + toolbarFixed: false, + imagePosition: true, + imageResizable: true, + breakline: Boolean(textarea.data('breakline')), + removeNewLines: Boolean(textarea.data('remove_new_lines')), + imageFloatMargin: '20px', + removeEmpty: ['strong', 'em', 'p'], + + /** + * Features + */ + minHeight: textarea.data('height'), + placeholder: textarea.attr('placeholder'), + folders: textarea.data('folders').toString().split(','), + buttons: textarea.data('buttons').toString().split(','), + plugins: textarea.data('plugins').toString().split(',') + }); + + textarea.closest('form').on('submit', function () { + textarea.val(textarea.redactor('code.get')); + }); + + if (textarea.is('[readonly]') || textarea.is('[disabled]')) { + textarea.redactor('button.disableAll'); + textarea.redactor('core.editor') + .attr('contenteditable', false); + } + }); +}); diff --git a/addons/default/visiosoft/advs-module/resources/js/viewed.js b/addons/default/visiosoft/advs-module/resources/js/viewed.js new file mode 100644 index 000000000..f507cfa28 --- /dev/null +++ b/addons/default/visiosoft/advs-module/resources/js/viewed.js @@ -0,0 +1,9 @@ +function viewed_ad() { + var id = $('#adv-id').val(); + $.ajax({ + type: 'get', + url: '/ajax/viewed/' + id, + }); +} + +viewed_ad(); \ No newline at end of file diff --git a/addons/default/visiosoft/advs-module/resources/views/advs/list-item.twig b/addons/default/visiosoft/advs-module/resources/views/advs/list-item.twig index 32abe6815..b94137a6b 100644 --- a/addons/default/visiosoft/advs-module/resources/views/advs/list-item.twig +++ b/addons/default/visiosoft/advs-module/resources/views/advs/list-item.twig @@ -3,7 +3,7 @@ {% block ogdata %} - + @@ -134,8 +134,11 @@
{{ adv.created_at|date('d/m/Y') }} - {{ adv.city_name }} + + {% if setting_value('visiosoft.module.location::detail_page_location') %} + {{ adv.city_name }} , {{ adv.country_name }} + {% endif %} {% if adv.isCorporate == 2 %} {{ adv.owner }} @@ -278,7 +281,7 @@ {% include "visiosoft.module.customfields::list-item" %} {% endif %} {% endif %} - {% if adv.map_Val != "" %} + {% if adv.map_Val != "" and setting_value('visiosoft.module.location::detail_page_location') %}
{% if entries('advs').isEnabled('streetview') %} @@ -334,9 +337,11 @@
- + {% if setting_value('visiosoft.module.location::detail_page_location') %} + + {% endif %}
@@ -473,6 +478,7 @@ {{ asset_add("scripts.js", "visiosoft.module.advs::js/list-item.js") }} {{ asset_add("scripts.js", "visiosoft.module.advs::js/quantity.js") }} {{ asset_add("scripts.js", "visiosoft.module.advs::js/phoneCounter.js") }} + {{ asset_add("scripts.js", "visiosoft.module.advs::js/viewed.js") }} {% if entries('advs').isEnabled('comments') %} {{ asset_add("scripts.js", "visiosoft.module.comments::js/ajaxcomment.js") }} diff --git a/addons/default/visiosoft/advs-module/resources/views/advs/list.twig b/addons/default/visiosoft/advs-module/resources/views/advs/list.twig index f40427d14..df29c234d 100644 --- a/addons/default/visiosoft/advs-module/resources/views/advs/list.twig +++ b/addons/default/visiosoft/advs-module/resources/views/advs/list.twig @@ -60,6 +60,7 @@