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
[WIP] Ajout d'une interface de merge pour les contenus #4151
Closed
Closed
Changes from 93 commits
Commits
Show all changes
97 commits
Select commit
Hold shift + click to select a range
d19997d
First commit
Anto59290 12e6167
ajout de routes, netoyage, test
Anto59290 1d6c888
Remove useless routes, add tests, add permissions, typos, styling
Anto59290 9fb78c1
Ajout de test, retrait de todo
Anto59290 2ff88ac
Testing
Anto59290 520c8bd
Tests
Anto59290 a86b075
Add validator, test
Anto59290 d64117f
Fixing tests, adding tests
Anto59290 615f5d4
tests
Anto59290 fa17b76
fixing test
Anto59290 4ecf63c
testing'
Anto59290 89eda18
Remove useless code, update todo list, style
Anto59290 d209ad7
Update settings.py
Anto59290 405f17c
First POC
Anto59290 6b78028
clean, remove useless file
Anto59290 2b19e0d
Clean, industrialisation du processus, divers bugs réglés
Anto59290 68ecbb1
ajout de la conclusion
Anto59290 14e987a
change alert to msg
Anto59290 8be724e
Nettoyage et style, diverses améliorations visuelles
Anto59290 0977079
style
Anto59290 c465f32
style
Anto59290 cbfe255
ajout du package, simplifie le formulaire
Anto59290 1daa48a
js plus logique
Anto59290 25276f0
Documentation JS, Refacto JS, ajout d'un TODO
Anto59290 1ec13cc
Style
Anto59290 9335ccc
better UX, remove todo
Anto59290 1e40465
ajout de l'interface de merge aux autres formulaires
Anto59290 f64b319
Update forms.py
Anto59290 e81dc71
ajout aux autres forms
Anto59290 9a62434
Merge branch 'dev' into 3251_git_diff_2
Anto59290 0541a3e
Update forms.py
Anto59290 b091f73
merge
Anto59290 20bf699
fix style
Anto59290 a199b20
fix style
Anto59290 f30e30d
merge
Anto59290 f32e2ba
Update forms.py
Anto59290 185cc00
Update settings.py
Anto59290 4e2dbfb
Update auto-merge.js
Anto59290 7f2c913
Update forms.py
Anto59290 3c735ff
Remove mege info
Anto59290 f411710
Merging
Anto59290 3227078
Merging
Anto59290 6b73cfc
Merge branch 'dev' into 3251_git_diff_2
Anto59290 6033f61
Update forms.py
Anto59290 e5fe212
Update forms.py
Anto59290 42d52aa
Update forms.py
Anto59290 43a76af
Update main.scss
Anto59290 7e12347
Merge branch 'dev' into 3251_git_diff_2
Anto59290 516583f
Merge branch 'dev' of https://github.com/zestedesavoir/zds-site into …
Anto59290 dd0444c
Fix styles, add sccs files
Anto59290 ed5e0cf
merge
Anto59290 c30ad5f
Update models.py
Anto59290 ca9952d
Update models.py
Anto59290 e61d8cf
Update models.py
Anto59290 588b3a9
Update models.py
Anto59290 32e5899
Update forms.py
Anto59290 868945a
Update forms.py
Anto59290 ab60b13
Remove files
Anto59290 8feb1ec
Merge branch '3251_git_diff_2' of https://github.com/Anto59290/zds-si…
Anto59290 aa4afcc
Fix rebase
Anto59290 ba88ccc
Update tests_models.py
Anto59290 e924cc3
Update permissions.py
Anto59290 21141ef
Update forms.py
Anto59290 42b4996
Update tests.py
Anto59290 696bb81
Update views.py
Anto59290 868f7c3
Update
Anto59290 ef875a5
Update urls.py
Anto59290 dc5c9e4
Update permissions.py
Anto59290 9b94737
Update forms.py
Anto59290 0d19446
Update models.py
Anto59290 c0d07af
Update urls.py
Anto59290 59cd3d4
Merge branch 'dev' into 3251_git_diff_2
Anto59290 39ead6e
Remove old code
Anto59290 b4567b8
Peping
Anto59290 d00b293
Style
Anto59290 c80d546
fix tests
Anto59290 63075aa
Just PEPing
Anto59290 fba3423
Just PEPing so more forms
Anto59290 f64ec59
Merge branch 'dev' into 3251_git_diff_2
Anto59290 5863c8c
Refacto
Anto59290 c7e8103
Merge branch 'dev' into 3251_git_diff_2
Anto59290 2602d09
I hate Js
Anto59290 cbf62b2
Merge branch 'dev' into 3251_git_diff_2
Anto59290 fcd9eee
Working example
Anto59290 3571d27
Merge branch '3251_git_diff_2' of https://github.com/Anto59290/zds-si…
Anto59290 3df61ec
Code style
Anto59290 782c8aa
Try to rebase
Anto59290 21ee83f
Fixing merge
Anto59290 1623c63
Update settings.py
Anto59290 dd97dde
Refactoring
Anto59290 af4f552
Merge branch '3251_git_diff_2' of https://github.com/Anto59290/zds-si…
Anto59290 08a2c30
Merge branch 'dev' into 3251_git_diff_2
Anto59290 909b53e
Linting
Anto59290 af170c0
Linting and remove py2 u
Anto59290 b95cc17
Update auto-merge.js
Anto59290 88a9290
Update auto-merge.js
Anto59290 21255b0
Merge branch 'dev' into 3251_git_diff_2
Anto59290 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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,65 @@ | ||
(function($, undefined) { | ||
"use strict"; | ||
|
||
$(document).ready(function () { | ||
|
||
/** | ||
* Sets up the merge interface (using codemirror) in the $div Object. | ||
* Data is generally retrieved from a form field or an aditionnal | ||
* div exposing the old data,also generated in the form. | ||
* @param {Object} $div - The base object used to set up the interface. Generally created in forms files. | ||
* @param {Object} $left - The object from which we will pick the content to put in the left hand side (lhs) of the editor. | ||
* @param {Object} $right - The object from which we will pick the content to put in the right hand side (rhs) of the editor. | ||
*/ | ||
function mergeUISetUp(selector, $left, $right){ | ||
var target = document.getElementsByClassName(selector)[0]; // TODO remplacer par ID ou objet | ||
if (target) { | ||
target.innerHTML = ""; | ||
var merge = CodeMirror.MergeView(target, { | ||
value: $left.html(), | ||
orig: $right.html(), | ||
lineNumbers: true, | ||
highlightDifferences: true, | ||
connect: "align", | ||
collapseIdentical: true | ||
}); | ||
return merge; | ||
} | ||
} | ||
|
||
var mergeInterfaceList = {}; | ||
mergeInterfaceList.introduction = mergeUISetUp("compare-introduction",$("#your_introduction"),$("#id_introduction")); | ||
mergeInterfaceList.conclusion = mergeUISetUp("compare-conclusion",$("#your_conclusion"),$("#id_conclusion")); | ||
mergeInterfaceList.text = mergeUISetUp("compare-text",$("#your_text"),$("#id_text")); | ||
|
||
$(".CodeMirror-merge-editor").append("Votre Version"); | ||
$(".CodeMirror-merge-right").append("La version courante"); | ||
|
||
/** | ||
* Merge content | ||
*/ | ||
$(".merge-btn").on("click", function(e){ | ||
e.stopPropagation(); | ||
e.preventDefault(); | ||
var button = $(this); | ||
|
||
Array.from(this.classList).forEach(function(element){ | ||
if (element.indexOf("need-to-merge-") >= 0) { | ||
var substring = element.substring(14); | ||
var toMerge = mergeInterfaceList[substring].editor().getValue(); | ||
$("#id_" + substring).text(toMerge); | ||
|
||
// Confirmation message | ||
var msg = "<div class='alert-box success alert-merge'>" + | ||
"<span>Le contenu a bien été validé.</span>" + | ||
"<a href='#close-alert-box' class='close-alert-box ico-after cross white'>Masquer l'alerte</a>" + | ||
"</div>"; | ||
button.before(msg); | ||
setTimeout(function() { | ||
$(".alert-merge").fadeOut("fast"); | ||
}, 2000); | ||
} | ||
}); | ||
}); | ||
}); | ||
})(jQuery); |
This file contains 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,3 @@ | ||
#compare-lhs-margin, #compare-rhs-margin { | ||
display: none; | ||
} |
Oops, something went wrong.
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.
Il faudrait réindenter ce fichier comme le reste, avec des espaces et non des tabulations.