diff --git a/Block/BibleTools/VerseConfig.php b/Block/BibleTools/VerseConfig.php new file mode 100644 index 0000000..dbf0629 --- /dev/null +++ b/Block/BibleTools/VerseConfig.php @@ -0,0 +1,42 @@ +tabs = $data['tabs'] ?? []; + parent::__construct($context, $data); + } + + /** + */ + public function getTabs(): array + { + return $this->tabs; + } + + /** + */ + public function getActiveTab() + { + $keys = array_keys($this->tabs); + return reset($keys); + } +} diff --git a/Block/BibleTools/VerseSearch.php b/Block/BibleTools/VerseSearch.php new file mode 100644 index 0000000..5aef545 --- /dev/null +++ b/Block/BibleTools/VerseSearch.php @@ -0,0 +1,12 @@ +resultPageFactory = $resultPageFactory; + parent::__construct($context); + } + + /** + * @inheritDoc + */ + public function execute() + { + return $this->resultPageFactory->create(); + } +} diff --git a/Model/Config.php b/Model/Config.php index dc5e27f..94604e7 100755 --- a/Model/Config.php +++ b/Model/Config.php @@ -130,7 +130,7 @@ class Config public const CONFIG_PATH_TORAHINPUT_DIVISION = 'jaroslawzielinski_torah/torah_input/division'; - public const CONFIG_PATH_TORAHINPUT_FRONTENDENABLED = 'jaroslawzielinski_torah/torah_input/frontend_enabled'; + public const CONFIG_PATH_TORAHINPUT_BIBLETOOLSENABLED = 'jaroslawzielinski_torah/torah_input/bibletools_enabled'; /** * @var ScopeConfigInterface @@ -500,9 +500,9 @@ public function getTorahInputDivision(): string ->getValue(self::CONFIG_PATH_TORAHINPUT_DIVISION, ScopeInterface::SCOPE_STORE); } - public function isTorahInputFrontendEnabled(): bool + public function isTorahInputBibleToolsEnabled(): bool { return $this->scopeConfig - ->isSetFlag(self::CONFIG_PATH_TORAHINPUT_FRONTENDENABLED, ScopeInterface::SCOPE_STORE); + ->isSetFlag(self::CONFIG_PATH_TORAHINPUT_BIBLETOOLSENABLED, ScopeInterface::SCOPE_STORE); } } diff --git a/Plugin/Backend/Model/Menu/BuilderPlugin.php b/Plugin/Backend/Model/Menu/BuilderPlugin.php index 73709f9..e7075ad 100755 --- a/Plugin/Backend/Model/Menu/BuilderPlugin.php +++ b/Plugin/Backend/Model/Menu/BuilderPlugin.php @@ -25,8 +25,8 @@ public function afterGetResult(Builder $subject, Menu $result): Menu if (!$this->config->isModuleMenuEnabled()) { $result->remove('JaroslawZielinski_TorahVerse::menu'); } else { - if (!$this->config->isTorahInputFrontendEnabled()) { - $result->remove('JaroslawZielinski_TorahVerse::versepick'); + if (!$this->config->isTorahInputBibleToolsEnabled()) { + $result->remove('JaroslawZielinski_TorahVerse::tools'); } } return $result; diff --git a/Plugin/Backend/Model/Menu/ItemPlugin.php b/Plugin/Backend/Model/Menu/ItemPlugin.php index 63918f1..ee5672a 100755 --- a/Plugin/Backend/Model/Menu/ItemPlugin.php +++ b/Plugin/Backend/Model/Menu/ItemPlugin.php @@ -24,7 +24,10 @@ public function __construct(UrlInterface $frontUrlModel) public function afterGetUrl(Item $subject, $result) { $info = $subject->toArray(); - if ('JaroslawZielinski_TorahVerse::versepick' === $info['resource']) { + if (in_array($info['resource'], [ + 'JaroslawZielinski_TorahVerse::versesearch', + 'JaroslawZielinski_TorahVerse::verseconfig' + ])) { return $this->frontUrlModel->getUrl($info['action']); } return $result; diff --git a/etc/acl.xml b/etc/acl.xml index a281325..5d07b7d 100755 --- a/etc/acl.xml +++ b/etc/acl.xml @@ -18,7 +18,8 @@ - + + diff --git a/etc/adminhtml/menu.xml b/etc/adminhtml/menu.xml index 6834f33..4b21463 100755 --- a/etc/adminhtml/menu.xml +++ b/etc/adminhtml/menu.xml @@ -37,8 +37,8 @@ title="Bible Tools" translate="title" module="JaroslawZielinski_TorahVerse" parent="JaroslawZielinski_TorahVerse::menu" sortOrder="30"/> - diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index 3b3c9e2..86736b3 100755 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -9,8 +9,11 @@
separator-top + + torah + JaroslawZielinski_TorahVerse::configuration + Magento\Config\Model\Config\Source\Yesno + Magento\Config\Model\Config\Source\Yesno + 1 @@ -35,7 +41,9 @@ + + 1 @@ -44,8 +52,11 @@ + + Magento\Config\Model\Config\Source\Yesno + 1 @@ -54,9 +65,12 @@ + + 1 + 1 @@ -64,8 +78,11 @@ + + Magento\Config\Model\Config\Source\Yesno + 1 @@ -74,9 +91,12 @@ + url, textColour, colour, groupName, antiColour, content, description written in {}]]> + 1 + 1 @@ -84,9 +104,12 @@ + url, textColour, colour, groupName, antiColour, content, description written in {}]]> + 1 + 1 @@ -94,9 +117,12 @@ + textColour, colour, groupName, antiColour, content, author, description written in {}]]> + 1 + 1 @@ -104,9 +130,12 @@ + textColour, colour, groupName, antiColour, content, author, description written in {}]]> + 1 + 1 @@ -114,9 +143,12 @@ + textColour, colour, groupName, antiColour, content, author, description written in {}]]> + 1 + 1 @@ -124,9 +156,12 @@ + textColour, colour, groupName, antiColour, content, author, description written in {}]]> + 1 + 1 @@ -134,8 +169,11 @@ + + Magento\Config\Model\Config\Source\Yesno + 1 @@ -145,7 +183,9 @@ + JaroslawZielinski\TorahVerse\Block\Colour + 1 @@ -154,7 +194,9 @@ + JaroslawZielinski\TorahVerse\Block\Colour + 1 @@ -163,7 +205,9 @@ + JaroslawZielinski\TorahVerse\Model\Config\Source\Sliders\Mode + 1 @@ -172,6 +216,7 @@ + 1 @@ -180,11 +225,13 @@ + content_shown_rows = 2:

.verse-slider .slider, .verse-slider .item { height: 98px; }
.verse-slider .content { max-height: 47px; }
.verse-slider .content .transformed { height: 47px; } ]]>
+ 1 @@ -200,19 +247,23 @@ + Magento\Config\Model\Config\Source\Yesno + Magento\Config\Model\Config\Source\Enabledisable + + 1 @@ -221,8 +272,11 @@ + + Magento\Config\Model\Config\Source\Yesno + 1 @@ -231,9 +285,12 @@ + + 1 + 1 @@ -241,8 +298,11 @@ + + Magento\Config\Model\Config\Source\Yesno + 1 @@ -251,8 +311,11 @@ + + Magento\Config\Model\Config\Source\Yesno + 1 @@ -261,7 +324,9 @@ + JaroslawZielinski\TorahVerse\Block\Colour + 1 @@ -270,7 +335,9 @@ + JaroslawZielinski\TorahVerse\Model\Config\Source\Sliders\Mode + 1 @@ -279,9 +346,13 @@ + JaroslawZielinski\TorahVerse\Model\Config\Source\Sliders\Groups + JaroslawZielinski\TorahVerse\Block\Adminhtml\MultiUiSelect + 1 + @@ -298,20 +369,25 @@ + + Magento\Config\Model\Config\Source\Yesno + Magento\Config\Model\Config\Source\Enabledisable + + 1 @@ -320,8 +396,11 @@ + + Magento\Config\Model\Config\Source\Yesno + 1 @@ -330,9 +409,12 @@ + + 1 + 1 @@ -340,8 +422,11 @@ + + Magento\Config\Model\Config\Source\Yesno + 1 @@ -350,8 +435,11 @@ + + Magento\Config\Model\Config\Source\Yesno + 1 @@ -360,7 +448,9 @@ + JaroslawZielinski\TorahVerse\Block\Colour + 1 @@ -369,7 +459,9 @@ + JaroslawZielinski\TorahVerse\Model\Config\Source\Sliders\Mode + 1 @@ -378,16 +470,22 @@ + required-entry + JaroslawZielinski\TorahVerse\Model\Config\Source\Sliders\Placement + JaroslawZielinski\TorahVerse\Model\Config\Source\Sliders\Groups + JaroslawZielinski\TorahVerse\Block\Adminhtml\MultiUiSelect + 1 + @@ -405,19 +503,23 @@ + Magento\Config\Model\Config\Source\Yesno + Magento\Config\Model\Config\Source\Enabledisable + + 1 @@ -426,8 +528,11 @@ + + Magento\Config\Model\Config\Source\Yesno + 1 @@ -436,9 +541,12 @@ + + 1 + 1 @@ -446,8 +554,11 @@ + + Magento\Config\Model\Config\Source\Yesno + 1 @@ -456,8 +567,11 @@ + + Magento\Config\Model\Config\Source\Yesno + 1 @@ -466,7 +580,9 @@ + JaroslawZielinski\TorahVerse\Block\Colour + 1 @@ -475,7 +591,9 @@ + JaroslawZielinski\TorahVerse\Model\Config\Source\Sliders\Mode + 1 @@ -484,8 +602,11 @@ + + JaroslawZielinski\TorahVerse\Block\Adminhtml\System\Config\Form\Field\Sliders + Magento\Config\Model\Config\Backend\Serialized\ArraySerialized @@ -500,8 +621,11 @@
separator-top + + torah + JaroslawZielinski_Torah::configuration + + JaroslawZielinski\TorahVerse\Model\Config\Source\Sliders\Language +
Please remember to save change of language first.]]>
+ JaroslawZielinski\TorahVerse\Block\Adminhtml\System\Config\TranslatePreset
@@ -536,13 +664,18 @@ + + JaroslawZielinski\TorahVerse\Model\Config\Source\Verses\Division - - + + + Verse Pick and Verse Search enabled.]]> + Magento\Config\Model\Config\Source\Yesno @@ -560,14 +693,19 @@ + Magento\Config\Model\Config\Source\Yesno + + JaroslawZielinski\TorahVerse\Block\Adminhtml\Widget\BTButton + + 1 @@ -575,8 +713,11 @@ + JaroslawZielinski\TorahVerse\Block\Adminhtml\Widget\BWButton + + 1 @@ -584,8 +725,11 @@ + JaroslawZielinski\TorahVerse\Block\Adminhtml\Widget\BRButton + + 1 @@ -593,8 +737,11 @@ + JaroslawZielinski\TorahVerse\Block\Adminhtml\Widget\ESPButton + + 1 @@ -602,8 +749,11 @@ + JaroslawZielinski\TorahVerse\Block\Adminhtml\Widget\BGButton + + 1 @@ -611,8 +761,11 @@ + JaroslawZielinski\TorahVerse\Block\Adminhtml\Widget\NGButton + + 1 @@ -620,8 +773,11 @@ + JaroslawZielinski\TorahVerse\Block\Adminhtml\Widget\UGButton + + 1 @@ -629,8 +785,11 @@ + JaroslawZielinski\TorahVerse\Block\Adminhtml\Widget\BBButton + + 1 @@ -638,8 +797,11 @@ + JaroslawZielinski\TorahVerse\Block\Adminhtml\Widget\BPButton + + 1 @@ -647,8 +809,11 @@ + JaroslawZielinski\TorahVerse\Block\Adminhtml\Widget\JWButton + + 1 @@ -656,8 +821,11 @@ + JaroslawZielinski\TorahVerse\Block\Adminhtml\Widget\BMButton + + 1 @@ -665,8 +833,11 @@ + JaroslawZielinski\TorahVerse\Block\Adminhtml\Widget\NSButton + + 1 @@ -674,8 +845,11 @@ + JaroslawZielinski\TorahVerse\Block\Adminhtml\Widget\BLButton + + 1 @@ -683,8 +857,11 @@ + JaroslawZielinski\TorahVerse\Block\Adminhtml\Widget\SZButton + + 1 @@ -692,8 +869,11 @@ + JaroslawZielinski\TorahVerse\Block\Adminhtml\Widget\EIBButton + + 1 @@ -701,8 +881,11 @@ + JaroslawZielinski\TorahVerse\Block\Adminhtml\Widget\TNPButton + + 1 @@ -710,8 +893,11 @@ + JaroslawZielinski\TorahVerse\Block\Adminhtml\Widget\KJVButton + + 1 @@ -719,8 +905,11 @@ + JaroslawZielinski\TorahVerse\Block\Adminhtml\Widget\WEBButton + + 1 @@ -728,8 +917,11 @@ + JaroslawZielinski\TorahVerse\Block\Adminhtml\Widget\YLTButton + + 1 @@ -737,8 +929,11 @@ + JaroslawZielinski\TorahVerse\Block\Adminhtml\Widget\VULButton + + 1 @@ -746,8 +941,11 @@ + JaroslawZielinski\TorahVerse\Block\Adminhtml\Widget\GRButton + + 1 diff --git a/etc/config.xml b/etc/config.xml index ad3886d..c2c974e 100755 --- a/etc/config.xml +++ b/etc/config.xml @@ -153,7 +153,7 @@ three-division - 1 + 1 diff --git a/i18n/en_US.csv b/i18n/en_US.csv index ace8e0a..94c272e 100644 --- a/i18n/en_US.csv +++ b/i18n/en_US.csv @@ -198,3 +198,6 @@ "October","October" "November","November" "December","December" +"Verse Pick","Verse Pick" +"Verse Search","Verse Search" +"Sigla are not valid or '.' button not pressed yet.","Sigla are not valid or '.' button not pressed yet." diff --git a/i18n/pl_PL.csv b/i18n/pl_PL.csv index 461989f..86c4f79 100644 --- a/i18n/pl_PL.csv +++ b/i18n/pl_PL.csv @@ -190,3 +190,6 @@ "October","Październik" "November","Listopad" "December","Grudzień" +"Verse Pick","Wybierz wers" +"Verse Search","Znajdź wers" +"Sigla are not valid or '.' button not pressed yet.","Sigla nieprawidłowe, albo nie wciśnięto '.' przycisku." diff --git a/view/base/web/js/form/element/siglum.js b/view/base/web/js/form/element/siglum.js index d0dacd2..687ae9c 100755 --- a/view/base/web/js/form/element/siglum.js +++ b/view/base/web/js/form/element/siglum.js @@ -31,13 +31,40 @@ define([ this.previewSiglum(); return this; }, + validate: function () { + this._super(); + + let value = this.value(), + message = '', + isValid = true; + + const results = this.previewSiglum(); + const status = null !== results ? results['status'] : 'error'; + if (status !== 'ok' || 6 !== parseInt(this.progressPointer)) { + isValid = false; + message = $t("Sigla are not valid or '.' button not pressed yet.") + '[' + value + ']'; + } + + this.error(message); + this.error.valueHasMutated(); + this.bubble('error', message); + + //TODO: Implement proper result propagation for form + if (this.source && !isValid) { + this.source.set('params.invalid', true); + } + + return { + valid: isValid, + target: this + }; + }, /** * Callback that fires when 'value' property is updated. */ onUpdate: function () { this.bubble('update', this.hasChanged()); this.validate(); - this.previewSiglum(); }, /** * Refresh buttons and add onclick handling @@ -46,6 +73,7 @@ define([ handling = undefined !== handling ? handling : true; try { this.value(this.updateValue()); + this.onUpdate(); $('#buttons').html(this.renderButtons()); if (handling) { this.handleButtons(); @@ -182,7 +210,7 @@ define([ resultId = self.resultSelector; if (undefined !== translationCode && undefined !== siglumCode) { let formKey = window.FORM_KEY || $('input[name="form_key"]').val(); - utils.ajaxGetItJson(ajaxUrl, { + return utils.ajaxGetItJson(ajaxUrl, { isAjax: true, form_key: formKey, translation: translationCode, @@ -191,6 +219,7 @@ define([ $(resultId).html(data['result']); }); } + return null; }, renderDivisionArray: function () { if (utils.inArray(this.parts.translation, ['eib', 'sz', 'tnp'])) { @@ -366,8 +395,8 @@ define([ verse: self.parts.verseStart }, function (ajaxData) { let ajaxButtons = JSON.parse(ajaxData['result']), - m = 4, - n = Object.keys(ajaxButtons).length / m; + m = 4, + n = Object.keys(ajaxButtons).length / m; const ajaxTemplateData = { m: m, n: n, diff --git a/view/base/web/js/verses/utils.js b/view/base/web/js/verses/utils.js index 952c675..06eafce 100755 --- a/view/base/web/js/verses/utils.js +++ b/view/base/web/js/verses/utils.js @@ -12,6 +12,7 @@ define([ }; return { + ajaxResults: null, stringToLinesByChunkSize: function (string, chunkSize) { const words = string.split(' '); let measure = ''; @@ -134,6 +135,7 @@ define([ return (!str || str.length === 0 ); }, ajaxGetItJson: function (ajaxUrl, data, callBack) { + let self = this; $.ajax({ showLoader: false, url: ajaxUrl, @@ -142,7 +144,9 @@ define([ dataType: 'json' }).done(function (data) { callBack(data); + self.ajaxResults = data; }); + return self.ajaxResults; }, fixArray: function (array) { return JSON.parse(JSON.stringify(array)); diff --git a/view/frontend/layout/jaroslawzielinski_torahverse_bibletools_verseconfig.xml b/view/frontend/layout/jaroslawzielinski_torahverse_bibletools_verseconfig.xml new file mode 100755 index 0000000..edb3e1a --- /dev/null +++ b/view/frontend/layout/jaroslawzielinski_torahverse_bibletools_verseconfig.xml @@ -0,0 +1,41 @@ + + + + Bible Tools + + + + + + + + + + + + + + Verse Pick + + + + + + + dicta-ignacy-loyola + + + + + + + + + + + diff --git a/view/frontend/layout/jaroslawzielinski_torahverse_bibletools_versesearch.xml b/view/frontend/layout/jaroslawzielinski_torahverse_bibletools_versesearch.xml new file mode 100755 index 0000000..cb676a0 --- /dev/null +++ b/view/frontend/layout/jaroslawzielinski_torahverse_bibletools_versesearch.xml @@ -0,0 +1,17 @@ + + + + Verse Search + + + + + + + + + + diff --git a/view/frontend/layout/jaroslawzielinski_torahverse_siglum_pick.xml b/view/frontend/layout/jaroslawzielinski_torahverse_siglum_pick.xml deleted file mode 100755 index e82d3f1..0000000 --- a/view/frontend/layout/jaroslawzielinski_torahverse_siglum_pick.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - Bible Tools - - - - - - - - - dicta-ignacy-loyola - - - - - - - - diff --git a/view/frontend/templates/bibletools/search.phtml b/view/frontend/templates/bibletools/search.phtml new file mode 100644 index 0000000..b63631c --- /dev/null +++ b/view/frontend/templates/bibletools/search.phtml @@ -0,0 +1,4 @@ + + diff --git a/view/frontend/templates/bibletools/verseconfig.phtml b/view/frontend/templates/bibletools/verseconfig.phtml new file mode 100644 index 0000000..897cb8a --- /dev/null +++ b/view/frontend/templates/bibletools/verseconfig.phtml @@ -0,0 +1,40 @@ + +
+
+ +
    + getTabs() as $tabId => $tabLabel): ?> + + +
+ +
+ getTabs() as $tabId => $tabLabel): ?> +
+ getChildHtml($tabId); ?> +
+ +
+
+
+ + diff --git a/view/frontend/web/css/bibletools/verseconfig.less b/view/frontend/web/css/bibletools/verseconfig.less new file mode 100644 index 0000000..762b78e --- /dev/null +++ b/view/frontend/web/css/bibletools/verseconfig.less @@ -0,0 +1,75 @@ +@superWidth: 114%; +.tabs-wrapper { + .tabs-container { + display: flex; + .tab-content { + padding: 0 15px 15px; + border-top: 1px solid #ccc; + border-right: 1px solid #ccc; + border-bottom: 1px solid #ccc; + width: ~"calc(100% - 200px)"; + #torahverse-pick { + .legend { + display: none; + } + .verse-slider, .verse-slider.paused-slider { + .item, .item.container { + width: 100% !important; + } + } + label[for="dicta"].label { + display: none; + } + label.label { + width: 8.8%; + } + .admin__fieldset { + .label + .control > .container { + width: @superWidth !important; + } + } + } + } + .tabs { + list-style-type: none; + margin: 0; + padding: 0; + width: 200px; + border-right: 1px solid #ccc; + li { + display: block; + margin-bottom: 5px; + a { + display: block; + padding: 10px 15px; + text-decoration: none; + background-color: #f1f1f1; + border: 1px solid #ccc; + border-right: none; + cursor: pointer; + color: #000; + } + &.active { + a { + background-color: white; + font-weight: bold; + border-right: 1px solid #fff; + } + } + } + } + } + @media screen and (max-width: 768px) { + .tabs-container { + flex-direction: column; + .tab-content { + width: 100%; + } + .tabs { + width: 100%; + border-right: none; + border-bottom: 1px solid #ccc; + } + } + } +} diff --git a/view/frontend/web/css/bibletools/versesearch.less b/view/frontend/web/css/bibletools/versesearch.less new file mode 100644 index 0000000..f8caa5e --- /dev/null +++ b/view/frontend/web/css/bibletools/versesearch.less @@ -0,0 +1,3 @@ +#versesearch { + width: 100%; +}