-
Notifications
You must be signed in to change notification settings - Fork 8
Informacja o dawno zadanym pytaniu #297
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
Draft
wizarddos
wants to merge
11
commits into
CodersCommunity:master
Choose a base branch
from
wizarddos:fetaure/outdated-question-info
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
fac6f34
initial commit
wizarddos 1c3a13e
Feature - Added valid info about question
wizarddos 657a33a
Fix - Refactor according to pr suggestions
wizarddos dd46a93
Fix - fix according to pr suggestions
wizarddos fa67d49
Fix-added missing event listener to cancel button
wizarddos afce8f1
Merge branch 'CodersCommunity:master' into fetaure/outdated-question-…
wizarddos b3ea532
Refactor - refactor according to pr suggestions
wizarddos 8d57fa0
Refactor - refactor according to pr suggestions
wizarddos e6348bb
Refactor - Refactor according to pr suggestions
wizarddos ea2ee2d
Refactor - added some spaces+ removed 1 style
wizarddos 80ec452
Fix - Fixed scrolling on full HD in chrome
wizarddos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
forum/qa-plugin/outdated-question-info/frontend/css/styles.css
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| .qa-outdated-question-container{ | ||
| width: 100%; | ||
|
|
||
| text-align: center; | ||
| padding: 1%; | ||
|
|
||
| border: 6px solid #f74040; | ||
| margin-bottom: 2.5%; | ||
| font-size: 1.30rem; | ||
| } | ||
|
|
||
| .hidden{ | ||
| display: none; | ||
| } | ||
|
|
||
|
|
||
|
|
36 changes: 36 additions & 0 deletions
36
forum/qa-plugin/outdated-question-info/frontend/show-outdated-question-info.js
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| const placeOfOutdatedQuestionInfo = document.querySelector('.qa-a-form'); | ||
| if(placeOfOutdatedQuestionInfo){ | ||
| const publishDateSpan = document.querySelector('.published > .value-title'); | ||
| const now = new Date(); | ||
| const publishDate = new Date(publishDateSpan.title); | ||
| const publishYearOlderThanNow = publishDate.getFullYear() < now.getFullYear(); | ||
| const publishMonthNewerThanNow = publishDate.getMonth() - 1 >= now.getMonth(); | ||
|
|
||
| if (publishYearOlderThanNow || publishMonthNewerThanNow) { | ||
| const outdatedQuestionInfoVisibility = placeOfOutdatedQuestionInfo.style.display === 'none' ? 'hidden' : ''; | ||
| placeOfOutdatedQuestionInfo.insertAdjacentHTML('beforebegin', | ||
| `<p class = "qa-outdated-question-container ${outdatedQuestionInfoVisibility}"> | ||
| To pytanie zostało zadane już dawno temu i może być nieaktualne.<br/> | ||
| Upewnij się, że Twoja odpowiedź nadal będzie pomocna. | ||
| </p>`); | ||
| } | ||
| const questionElemExist = document.querySelector('.qa-outdated-question-container'); | ||
|
|
||
| if(questionElemExist){ | ||
| const outdatedInfoContainerClassList = questionElemExist.classList; | ||
| const doesCancelButtonExist = !CKEDITOR.instances.a_content; | ||
|
|
||
| document.querySelector('#q_doanswer').addEventListener('click', ()=>{ | ||
| outdatedInfoContainerClassList.toggle('hidden'); | ||
| questionElemExist.scrollIntoView({ behavior: "smooth", block:'start', inline: 'start'}) | ||
|
|
||
| if(doesCancelButtonExist){ | ||
| const cancelAnswer = CKEDITOR.instances.a_content.element.$.form.docancel; | ||
| cancelAnswer.addEventListener('click', ()=>{ | ||
| outdatedInfoContainerClassList.toggle('hidden'); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nie |
||
| }, {once: true}); | ||
| } | ||
|
|
||
| }) | ||
| } | ||
| } | ||
14 changes: 14 additions & 0 deletions
14
forum/qa-plugin/outdated-question-info/qa-outdated-question-info-layer.php
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <?php | ||
|
|
||
| class qa_html_theme_layer extends qa_html_theme_base | ||
| { | ||
| public function head_script(){ | ||
| parent::head_script(); | ||
| if(qa_get_logged_in_userid()){ | ||
| $this->output(' | ||
| <script src = "'. QA_HTML_THEME_LAYER_URLTOROOT .'frontend/show-outdated-question-info.js?v=" defer></script> | ||
| <link rel = "stylesheet" href = "'. QA_HTML_THEME_LAYER_URLTOROOT .'frontend/css/styles.css?v=" /> | ||
| '); | ||
| } | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <?php | ||
|
|
||
| //Don't let this page to be available directly from browser | ||
| if (!defined('QA_VERSION')) { | ||
| header('Location: ../../'); | ||
| exit; | ||
| } | ||
|
|
||
| qa_register_plugin_layer('qa-outdated-question-info-layer.php', 'Outdated Question Info'); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nie
.toggle('hidden')tylko.remove('hidden')- eksplicytnie usuwamy klasę (pokazując tym samym komunikat) na kliknięcie w przycisk dodający odpowiedź. Tak jak pokazałem w komentarzu.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nie jestem pewny czy to mogłoby zadziałać. Formularz odpowiedzi możemy zamknąć również przyciskiem otwierania odpowiedzi, a nie tylko czerwonym anuluj. Toggle jest tu aby nie było jasno narzucone, którym przyciskiem mamy zamykać formularz
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Faktycznie, przycisk "Odpowiedz" toggluje formularz z edytorem - nie zauważyłem. Więc
.toggle('hidden')może zostać.