From 618c3580ad9b04fc5f8743a2e95fde96296382c9 Mon Sep 17 00:00:00 2001 From: Mateus Machado Luna Date: Mon, 4 Jun 2018 16:06:45 -0300 Subject: [PATCH 1/4] Adds most of new Modals styling from Design team changes. --- .../edition/category-edition-form.vue | 17 +++--- .../edition/collection-edition-form.vue | 2 + .../components/edition/item-edition-form.vue | 17 +++--- .../components/lists/categories-list.vue | 12 +++- .../components/lists/collections-list.vue | 12 +++- src/admin/components/lists/fields-list.vue | 19 +++--- src/admin/components/lists/filters-list.vue | 19 +++--- src/admin/components/lists/items-list.vue | 12 +++- src/admin/components/lists/terms-list.vue | 15 +++-- src/admin/scss/_modals.scss | 60 ++++++++++++++++++- src/admin/scss/_variables.scss | 1 + src/admin/tainacan-admin-i18n.php | 2 + 12 files changed, 143 insertions(+), 45 deletions(-) diff --git a/src/admin/components/edition/category-edition-form.vue b/src/admin/components/edition/category-edition-form.vue index 0c50a64da..e5f973225 100644 --- a/src/admin/components/edition/category-edition-form.vue +++ b/src/admin/components/edition/category-edition-form.vue @@ -195,14 +195,17 @@ if (formNotSaved) { this.$dialog.confirm({ + title: this.$i18n.get('label_warning'), message: this.$i18n.get('info_warning_category_not_saved'), - onConfirm: () => { - next(); - }, - cancelText: this.$i18n.get('cancel'), - confirmText: this.$i18n.get('continue'), - type: 'is-secondary' - }); + onConfirm: () => { + next(); + }, + icon: 'alert-circle', + hasIcon: true, + cancelText: this.$i18n.get('cancel'), + confirmText: this.$i18n.get('continue'), + type: 'is-success' + }); } else { next() } diff --git a/src/admin/components/edition/collection-edition-form.vue b/src/admin/components/edition/collection-edition-form.vue index 30c03068b..9bcc36dce 100644 --- a/src/admin/components/edition/collection-edition-form.vue +++ b/src/admin/components/edition/collection-edition-form.vue @@ -301,6 +301,7 @@ class="control" custom> {{ registeredViewModes[viewMode].label }} @@ -326,6 +327,7 @@ @focus="clearErrors('default_view_mode')"> diff --git a/src/admin/components/edition/item-edition-form.vue b/src/admin/components/edition/item-edition-form.vue index 921a2fe3e..aa8b805c1 100644 --- a/src/admin/components/edition/item-edition-form.vue +++ b/src/admin/components/edition/item-edition-form.vue @@ -676,14 +676,17 @@ export default { beforeRouteLeave ( to, from, next ) { if (this.item.status == 'auto-draft') { this.$dialog.confirm({ + title: this.$i18n.get('label_warning'), message: this.$i18n.get('info_warning_item_not_saved'), - onConfirm: () => { - next(); - }, - cancelText: this.$i18n.get('cancel'), - confirmText: this.$i18n.get('continue'), - type: 'is-secondary' - }); + onConfirm: () => { + next(); + }, + icon: 'alert-circle', + hasIcon: true, + cancelText: this.$i18n.get('cancel'), + confirmText: this.$i18n.get('continue'), + type: 'is-success' + }); } else { next() } diff --git a/src/admin/components/lists/categories-list.vue b/src/admin/components/lists/categories-list.vue index 60d4db813..985d10fcb 100644 --- a/src/admin/components/lists/categories-list.vue +++ b/src/admin/components/lists/categories-list.vue @@ -180,6 +180,7 @@ }, deleteOneCategory(categoryId) { this.$dialog.confirm({ + title: this.$i18n.get('label_warning'), message: this.$i18n.get('info_warning_category_delete'), onConfirm: () => { this.deleteCategory(categoryId) @@ -205,11 +206,15 @@ // queue: true // }); }); - } + }, + icon: 'alert-circle', + hasIcon: true, + type: 'is-success' }); }, deleteSelectedCategories() { this.$dialog.confirm({ + title: this.$i18n.get('label_warning'), message: this.$i18n.get('info_warning_selected_categories_delete'), onConfirm: () => { @@ -237,7 +242,10 @@ } } this.allCategoriesOnPageSelected = false; - } + }, + icon: 'alert-circle', + hasIcon: true, + type: 'is-success' }); }, goToCategoryPage(categoryId) { diff --git a/src/admin/components/lists/collections-list.vue b/src/admin/components/lists/collections-list.vue index f4630dcfb..1c70f6143 100644 --- a/src/admin/components/lists/collections-list.vue +++ b/src/admin/components/lists/collections-list.vue @@ -230,6 +230,7 @@ export default { }, deleteOneCollection(collectionId) { this.$dialog.confirm({ + title: this.$i18n.get('label_warning'), message: this.isOnTrash ? this.$i18n.get('info_warning_collection_delete') : this.$i18n.get('info_warning_collection_trash'), onConfirm: () => { this.deleteCollection({ collectionId: collectionId, isPermanently: this.isOnTrash }) @@ -254,11 +255,15 @@ export default { // queue: true // }) }); - } + }, + icon: 'alert-circle', + hasIcon: true, + type: 'is-success' }); }, deleteSelectedCollections() { this.$dialog.confirm({ + title: this.$i18n.get('label_warning'), message: this.isOnTrash ? this.$i18n.get('info_warning_selected_collections_delete') : this.$i18n.get('info_warning_selected_collections_trash'), onConfirm: () => { @@ -286,7 +291,10 @@ export default { } } this.allCollectionsOnPageSelected = false; - } + }, + icon: 'alert-circle', + hasIcon: true, + type: 'is-success' }); }, goToCollectionPage(collectionId) { diff --git a/src/admin/components/lists/fields-list.vue b/src/admin/components/lists/fields-list.vue index dfb25e567..aaed4f7e7 100644 --- a/src/admin/components/lists/fields-list.vue +++ b/src/admin/components/lists/fields-list.vue @@ -195,15 +195,18 @@ export default { } if ((this.openedFieldId != '' && this.openedFieldId != undefined) || hasUnsavedForms ) { this.$dialog.confirm({ + title: this.$i18n.get('label_warning'), message: this.$i18n.get('info_warning_fields_not_saved'), - onConfirm: () => { - this.onEditionCanceled(); - next(); - }, - cancelText: this.$i18n.get('cancel'), - confirmText: this.$i18n.get('continue'), - type: 'is-secondary' - }); + onConfirm: () => { + this.onEditionCanceled(); + next(); + }, + icon: 'alert-circle', + hasIcon: true, + cancelText: this.$i18n.get('cancel'), + confirmText: this.$i18n.get('continue'), + type: 'is-success' + }); } else { next() } diff --git a/src/admin/components/lists/filters-list.vue b/src/admin/components/lists/filters-list.vue index b2f184081..a05dc6e11 100644 --- a/src/admin/components/lists/filters-list.vue +++ b/src/admin/components/lists/filters-list.vue @@ -222,15 +222,18 @@ export default { } if ((this.openedFilterId != '' && this.openedFilterId != undefined) || hasUnsavedForms ) { this.$dialog.confirm({ + title: this.$i18n.get('label_warning'), message: this.$i18n.get('info_warning_filters_not_saved'), - onConfirm: () => { - this.onEditionCanceled(); - next(); - }, - cancelText: this.$i18n.get('cancel'), - confirmText: this.$i18n.get('continue'), - type: 'is-secondary' - }); + onConfirm: () => { + this.onEditionCanceled(); + next(); + }, + icon: 'alert-circle', + hasIcon: true, + cancelText: this.$i18n.get('cancel'), + confirmText: this.$i18n.get('continue'), + type: 'is-success' + }); } else { next() } diff --git a/src/admin/components/lists/items-list.vue b/src/admin/components/lists/items-list.vue index 35f1153cd..0d887c83a 100644 --- a/src/admin/components/lists/items-list.vue +++ b/src/admin/components/lists/items-list.vue @@ -214,6 +214,7 @@ export default { }, deleteOneItem(itemId) { this.$dialog.confirm({ + title: this.$i18n.get('label_warning'), message: this.isOnTrash ? this.$i18n.get('info_warning_item_delete') : this.$i18n.get('info_warning_item_trash'), onConfirm: () => { this.deleteItem({ itemId: itemId, isPermanently: this.isOnTrash }) @@ -239,11 +240,15 @@ export default { // queue: true // }) }); - } + }, + icon: 'alert-circle', + hasIcon: true, + type: 'is-success' }); }, deleteSelectedItems() { this.$dialog.confirm({ + title: this.$i18n.get('label_warning'), message: this.isOnTrash ? this.$i18n.get('info_warning_selected_items_delete') : this.$i18n.get('info_warning_selected_items_trash'), onConfirm: () => { @@ -275,7 +280,10 @@ export default { } } this.allItemsOnPageSelected = false; - } + }, + icon: 'alert-circle', + hasIcon: true, + type: 'is-success' }); }, goToItemPage(item) { diff --git a/src/admin/components/lists/terms-list.vue b/src/admin/components/lists/terms-list.vue index 918ff369a..9a0586306 100644 --- a/src/admin/components/lists/terms-list.vue +++ b/src/admin/components/lists/terms-list.vue @@ -213,13 +213,16 @@ export default { // Checks if user is deleting a term with unsaved info. if (term.id == 'new' || !term.saved || term.opened) { this.$dialog.confirm({ + title: this.$i18n.get('label_warning'), message: this.$i18n.get('info_warning_terms_not_saved'), - onCancel: () => { return }, - onConfirm: () => { this.removeTerm(term);}, - cancelText: this.$i18n.get('cancel'), - confirmText: this.$i18n.get('continue'), - type: 'is-secondary' - }); + onCancel: () => { return }, + onConfirm: () => { this.removeTerm(term); }, + icon: 'alert-circle', + hasIcon: true, + cancelText: this.$i18n.get('cancel'), + confirmText: this.$i18n.get('continue'), + type: 'is-success' + }); } else{ this.removeTerm(term); } diff --git a/src/admin/scss/_modals.scss b/src/admin/scss/_modals.scss index 637c2ad51..2e517cd91 100644 --- a/src/admin/scss/_modals.scss +++ b/src/admin/scss/_modals.scss @@ -1,4 +1,3 @@ - // Tainacan modals .tainacan-modal-title { h1, h2 { @@ -35,9 +34,64 @@ padding: 80px 0em 0.4em 0em !important; } } +// Bulma modals customized for Tainacan +.dialog{ + .modal-background { + background-color: rgba(0, 0, 0, 0.70); + } + .modal-card { + background-color: $modal-backgound-color; + color: $secondary; + border-radius: 10px; -.modal-background { - background-color: rgba(0, 0, 0, 0.70); + .modal-card-head, .modal-card-body, .modal-card-foot { + background-color: $modal-backgound-color; + color: $secondary; + border: none; + } + .modal-card-head { + p { color: $secondary; } + font-weight: normal; + padding: 30px 35px 0px 35px; + } + .modal-card-body { + padding: 16px 35px; + + i { + color: white !important; + &::before { + background-color: $danger; + border-radius: 55px; + display: initial; + } + } + } + .modal-card-foot { + justify-content: space-between; + padding: 0px 35px 30px 35px; + + .button { + border-radius: 6px !important; + font-weight: normal; + padding: 2px 15px !important; + margin-top: 0px !important; + margin-bottom: 0px !important; + height: inherit !important; + box-shadow: none !important; + display: inline-flex !important; + cursor: pointer; + font-size: 13px !important; + } + .button.is-success { + border: none; + } + .button:not(.is-success) { + background-color: white; + color: $tertiary; + border: 1px solid $gray-light; + } + } + } } // WordPress Media Modal customization diff --git a/src/admin/scss/_variables.scss b/src/admin/scss/_variables.scss index 1e46513db..d0848ebce 100644 --- a/src/admin/scss/_variables.scss +++ b/src/admin/scss/_variables.scss @@ -18,6 +18,7 @@ $primary-darker: darken($primary-dark, 5%); $success: #25a189; $success-invert: findColorInvert($success); +$modal-backgound-color: #bfd8dd; $separator-color: #2b98a4; $tainacan-input-color: #1d1d1d; $tainacan-input-background: #e5e5e5; diff --git a/src/admin/tainacan-admin-i18n.php b/src/admin/tainacan-admin-i18n.php index d784127ae..36f06217f 100644 --- a/src/admin/tainacan-admin-i18n.php +++ b/src/admin/tainacan-admin-i18n.php @@ -197,6 +197,8 @@ return [ 'label_default_view_mode' => __( 'Default view mode', 'tainacan' ), 'label_enabled_view_modes' => __( 'Enabled view modes', 'tainacan' ), 'label_view_modes_available' => __( 'View modes available on theme', 'tainacan' ), + 'label_warning' => __( 'Warning', 'tainacan' ), + 'label_error' => __( 'Erro', 'tainacan' ), // Instructions. More complex sentences to guide user and placeholders 'instruction_delete_selected_collections' => __( 'Delete selected collections', 'tainacan' ), From 6b3e2738571b39595ccdc316c66e296c8f51d61a Mon Sep 17 00:00:00 2001 From: weryques Date: Mon, 4 Jun 2018 16:29:22 -0300 Subject: [PATCH 2/4] Fixes errors in tests and fixes has content in Custom Interval component --- .../endpoints/class-tainacan-rest-filters-controller.php | 2 +- .../filter-types/custom-interval/CustomInterval.vue | 8 ++++---- src/importer/class-tainacan-importer.php | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/api/endpoints/class-tainacan-rest-filters-controller.php b/src/api/endpoints/class-tainacan-rest-filters-controller.php index c1e9d168c..7a93f4c13 100644 --- a/src/api/endpoints/class-tainacan-rest-filters-controller.php +++ b/src/api/endpoints/class-tainacan-rest-filters-controller.php @@ -327,7 +327,7 @@ class REST_Filters_Controller extends REST_Controller { $item_arr['enabled'] = $item->get_enabled_for_collection(); } - $item_arr['filter_type_object'] = $item->get_filter_type_object()->_toArray(); + $item_arr['filter_type_object'] = $item->get_filter_type_object() ? $item->get_filter_type_object()->_toArray() : $item->get_filter_type_object(); return $item_arr; } diff --git a/src/classes/filter-types/custom-interval/CustomInterval.vue b/src/classes/filter-types/custom-interval/CustomInterval.vue index 4b08e2ef3..2ebbf6999 100644 --- a/src/classes/filter-types/custom-interval/CustomInterval.vue +++ b/src/classes/filter-types/custom-interval/CustomInterval.vue @@ -4,7 +4,7 @@
get_id().'.txt', 'w' ); fwrite( $file, $tmp['body'] ); fclose( $file ); From 7f56e379e587a5fcb60df64bfa217c601d36bdbd Mon Sep 17 00:00:00 2001 From: weryques Date: Mon, 4 Jun 2018 16:30:32 -0300 Subject: [PATCH 3/4] Initiaded advanced search (issue #22) --- .../advanced-search/advanced-search.vue | 123 ++++++++++++++++++ .../components/navigation/tainacan-header.vue | 13 +- src/admin/js/router.js | 2 +- src/admin/pages/lists/items-page.vue | 17 ++- 4 files changed, 149 insertions(+), 6 deletions(-) create mode 100644 src/admin/components/advanced-search/advanced-search.vue diff --git a/src/admin/components/advanced-search/advanced-search.vue b/src/admin/components/advanced-search/advanced-search.vue new file mode 100644 index 000000000..27afacd4d --- /dev/null +++ b/src/admin/components/advanced-search/advanced-search.vue @@ -0,0 +1,123 @@ + + + + + \ No newline at end of file diff --git a/src/admin/components/navigation/tainacan-header.vue b/src/admin/components/navigation/tainacan-header.vue index 2f6b0abc1..5fa34bcb6 100644 --- a/src/admin/components/navigation/tainacan-header.vue +++ b/src/admin/components/navigation/tainacan-header.vue @@ -20,7 +20,7 @@
@@ -28,7 +28,7 @@
- {{ $i18n.get('advanced_search') }} + {{ $i18n.get('advanced_search') }}

- +
{{ $i18n.get('advanced_search') }}

{{ $i18n.get('filters') }}

- + @@ -361,6 +365,10 @@ enabledViewModes: Object // Used only on theme }, computed: { + openAdvancedSearch(){ + console.log('Called here', this.$route.meta); + return this.$route.meta.openAdvancedSearch; + }, items() { return this.getItems(); }, @@ -428,6 +436,11 @@ 'getViewMode', 'getTotalItems' ]), + openAdvancedSearchComponent(){ + console.log('Called here', this.$route.meta); + this.$set(this.$route.meta, 'openAdvancedSearch', !this.$route.meta.openAdvancedSearch); + console.log('Called here', this.$route.meta); + }, updateSearch() { this.$eventBusSearch.setSearchQuery(this.futureSearchQuery); }, From 980ffa7c6409d93b0aae7169f6675ff4c713d78e Mon Sep 17 00:00:00 2001 From: eduardohumberto Date: Mon, 4 Jun 2018 21:41:14 -0300 Subject: [PATCH 4/4] begin script file for import old tainacan --- src/importer/import.php | 90 +++++++++++++++++++++++++++++++++++++++++ tests/test-importer.php | 4 ++ 2 files changed, 94 insertions(+) create mode 100644 src/importer/import.php diff --git a/src/importer/import.php b/src/importer/import.php new file mode 100644 index 000000000..11d819694 --- /dev/null +++ b/src/importer/import.php @@ -0,0 +1,90 @@ +parse_args($argv); + $this->run(); + + } + + /** + * parse args from and set the attributs + * 1 - Old Tainacan url (required) + */ + function parse_args($argv) { + + if (!is_array($argv)) + return; + + + if (isset($argv[1])) { + + if (filter_var($argv[1], FILTER_VALIDATE_URL)) { + $this->url = $argv[1]; + } + + } + + if (isset($argv[2])) { + + if (is_numeric($argv[2])) { + $this->step = $argv[2]; + } else { + $this->run = ''; + } + + } + + } + + /** + * echo message in prompt line + */ + function log($msg) { + + echo $msg . PHP_EOL; + + } + + function run() { + + $start = $partial = microtime(true); + + // Avoid warnings + $_SERVER['SERVER_PROTOCOL'] = "HTTP/1.1"; + $_SERVER['REQUEST_METHOD'] = "GET"; + + define( 'WP_USE_THEMES', false ); + define( 'SHORTINIT', false ); + require( dirname(__FILE__) . '/../../../../wp-blog-header.php' ); + + $old_tainacan = new \Tainacan\Importer\Old_Tainacan(); + $id = $old_tainacan->get_id(); + + $_SESSION['tainacan_importer'][$id]->set_url($url); + $_SESSION['tainacan_importer'][$id]->set_repository(); + + while (!$_SESSION['tainacan_importer'][$id]->is_finished()){ + $_SESSION['tainacan_importer'][$id]->run(); + } + + $scripttime = microtime(true) - $start; + + $this->log("=========================================================="); + $this->log("=========================================================="); + $this->log("=== Fim do script. Tempo de execução {$scripttime}s"); + $this->log("=========================================================="); + $this->log("=========================================================="); + + } +} + +$x = new ScriptTainacanOld($argv); \ No newline at end of file diff --git a/tests/test-importer.php b/tests/test-importer.php index 908d074c1..064c5e66f 100644 --- a/tests/test-importer.php +++ b/tests/test-importer.php @@ -55,6 +55,10 @@ class ImporterTests extends TAINACAN_UnitTestCase { $_SESSION['tainacan_importer'][$id]->run(); } + $Tainacan_Collections = \Tainacan\Repositories\Collections::get_instance(); + $collections = $Tainacan_Collections->fetch([], 'OBJECT'); + $this->assertEquals(3, $collections, 'total collection in this url does not match'); + $this->assertTrue(true); }*/