├── database ├── .gitignore ├── seeds │ └── DatabaseSeeder.php ├── migrations │ ├── 2019_03_17_110237_add_cities.php │ ├── 2019_02_28_182539_alter_tags_add_color.php │ ├── 2019_02_08_131014_nullable_email.php │ ├── 2019_02_09_181024_nullable_tags.php │ ├── 2019_02_14_211651_add_responses_groups.php │ ├── 2019_02_20_142331_alter_questions_add_minimallevel.php │ ├── 2014_10_12_100000_create_password_resets_table.php │ ├── 2019_02_12_081343_cache_scores.php │ ├── 2019_03_09_081456_create_skips.php │ ├── 2014_10_12_000000_create_users_table.php │ ├── 2019_02_21_102922_create_sessions_table.php │ ├── 2019_03_02_093052_create_results.php │ ├── 2019_02_09_202534_alter_questions_order.php │ ├── 2019_03_02_215039_create_messages_table.php │ ├── 2019_03_24_072702_texts.php │ ├── 2019_02_07_202755_create_audits_table.php │ ├── 2019_02_21_152646_alter_qdr_add_priority.php │ ├── 2019_02_03_181956_create_tags_tables.php │ ├── 2019_02_11_230023_add_roles.php │ └── 2019_01_28_202750_create_debates_tables.php └── factories │ └── UserFactory.php ├── public ├── css │ └── .gitignore ├── js │ └── .gitignore ├── robots.txt ├── logo.png ├── favicon.ico ├── mstile-70x70.png ├── favicon-16x16.png ├── favicon-32x32.png ├── mstile-144x144.png ├── mstile-150x150.png ├── mstile-310x150.png ├── mstile-310x310.png ├── apple-touch-icon.png ├── android-chrome-192x192.png ├── android-chrome-512x512.png ├── fonts │ ├── nunito-v10-latin-900.eot │ ├── nunito-v10-latin-900.ttf │ ├── nunito-v10-latin-900.woff │ ├── nunito-v10-latin-900.woff2 │ ├── nunito-v10-latin-italic.eot │ ├── nunito-v10-latin-italic.ttf │ ├── nunito-v10-latin-italic.woff │ ├── nunito-v10-latin-regular.eot │ ├── nunito-v10-latin-regular.ttf │ ├── nunito-v10-latin-italic.woff2 │ ├── nunito-v10-latin-regular.woff │ └── nunito-v10-latin-regular.woff2 ├── browserconfig.xml ├── site.webmanifest ├── .htaccess ├── safari-pinned-tab.svg ├── resources │ └── README.txt ├── svg │ └── banner.svg └── index.php ├── bootstrap ├── cache │ └── .gitignore └── app.php ├── storage ├── logs │ └── .gitignore ├── app │ ├── public │ │ └── .gitignore │ └── .gitignore ├── debugbar │ └── .gitignore └── framework │ ├── testing │ └── .gitignore │ ├── views │ └── .gitignore │ ├── cache │ ├── data │ │ └── .gitignore │ └── .gitignore │ ├── sessions │ └── .gitignore │ └── .gitignore ├── .gitattributes ├── app ├── Models │ ├── Skip.php │ ├── Action.php │ ├── Message.php │ ├── Result.php │ ├── Debate.php │ ├── Text.php │ ├── Proposal.php │ ├── Question.php │ └── Tag.php ├── Http │ ├── Controllers │ │ ├── Api │ │ │ ├── UserController.php │ │ │ ├── DebateController.php │ │ │ ├── QuestionController.php │ │ │ └── TagController.php │ │ ├── Controller.php │ │ ├── ProposalController.php │ │ ├── MessageController.php │ │ ├── Auth │ │ │ ├── ForgotPasswordController.php │ │ │ ├── ResetPasswordController.php │ │ │ ├── LoginController.php │ │ │ ├── VerificationController.php │ │ │ ├── UserController.php │ │ │ └── RegisterController.php │ │ ├── DebateController.php │ │ ├── MyOverviewController.php │ │ └── TextController.php │ ├── Middleware │ │ ├── EncryptCookies.php │ │ ├── CheckForMaintenanceMode.php │ │ ├── TrimStrings.php │ │ ├── TrustProxies.php │ │ ├── Authenticate.php │ │ ├── VerifyCsrfToken.php │ │ └── RedirectIfAuthenticated.php │ └── Kernel.php ├── Policies │ ├── MessagePolicy.php │ ├── TextPolicy.php │ └── TagPolicy.php ├── Providers │ ├── BroadcastServiceProvider.php │ ├── AppServiceProvider.php │ ├── AuthServiceProvider.php │ ├── EventServiceProvider.php │ └── RouteServiceProvider.php ├── Repositories │ ├── TagRepository.php │ ├── QuestionRepository.php │ └── ResponseRepository.php ├── Notifications │ └── ResetPassword.php ├── Logic │ ├── Stats.php │ ├── Levels.php │ ├── Weights.php │ └── Priority.php ├── Exceptions │ └── Handler.php └── Console │ ├── Commands │ ├── RefreshPriorityQuestions.php │ ├── RefreshPriorityResponses.php │ ├── PrintStats.php │ └── DumpTexts.php │ └── Kernel.php ├── data └── debates.csv ├── resources ├── views │ ├── layouts │ │ ├── back_debates.blade.php │ │ ├── back_questions.blade.php │ │ ├── back_tags.blade.php │ │ ├── footer.blade.php │ │ ├── app.blade.php │ │ └── visitor.blade.php │ ├── responses │ │ ├── value.blade.php │ │ └── show.blade.php │ ├── messages │ │ ├── show.blade.php │ │ └── index.blade.php │ ├── questions │ │ ├── search.blade.php │ │ ├── graph.blade.php │ │ └── show.blade.php │ ├── texts │ │ ├── legal-warning.blade.php │ │ ├── show.blade.php │ │ ├── edit.blade.php │ │ ├── index.blade.php │ │ └── create.blade.php │ ├── auth │ │ ├── verify.blade.php │ │ ├── delete.blade.php │ │ └── passwords │ │ │ ├── email.blade.php │ │ │ └── reset.blade.php │ ├── tags │ │ ├── show.blade.php │ │ ├── create.blade.php │ │ ├── inject.blade.php │ │ ├── edit.blade.php │ │ └── delete.blade.php │ ├── vendor │ │ └── notifications │ │ │ └── email.blade.php │ ├── users │ │ └── edit.blade.php │ ├── proposals │ │ └── show.blade.php │ ├── limits.blade.php │ ├── book.blade.php │ ├── levels.blade.php │ ├── home.blade.php │ └── legal.blade.php ├── sass │ ├── _variables.scss │ └── app.scss ├── lang │ ├── fr │ │ ├── pagination.php │ │ ├── auth.php │ │ └── passwords.php │ └── en │ │ ├── pagination.php │ │ ├── auth.php │ │ └── passwords.php └── js │ ├── bootstrap.js │ ├── components │ ├── Quotation.vue │ ├── ActionButton.vue │ ├── ToggleButton.vue │ ├── Samples.vue │ └── Sample.vue │ └── app.js ├── tests ├── TestCase.php ├── Unit │ └── ExampleTest.php ├── Feature │ └── ExampleTest.php └── CreatesApplication.php ├── .editorconfig ├── .gitignore ├── routes ├── api.php ├── channels.php ├── console.php └── web.php ├── .env.example ├── webpack.mix.js ├── server.php ├── config ├── view.php ├── services.php ├── hashing.php ├── broadcasting.php ├── filesystems.php ├── queue.php ├── logging.php └── cache.php ├── phpunit.xml ├── package.json ├── artisan └── composer.json /database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite 2 | -------------------------------------------------------------------------------- /public/css/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /public/js/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /bootstrap/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /storage/app/public/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/debugbar/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !public/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/framework/testing/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/cache/data/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !data/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /public/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fm89/granddebat/HEAD/public/logo.png -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fm89/granddebat/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /public/mstile-70x70.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fm89/granddebat/HEAD/public/mstile-70x70.png -------------------------------------------------------------------------------- /public/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fm89/granddebat/HEAD/public/favicon-16x16.png -------------------------------------------------------------------------------- /public/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fm89/granddebat/HEAD/public/favicon-32x32.png -------------------------------------------------------------------------------- /public/mstile-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fm89/granddebat/HEAD/public/mstile-144x144.png -------------------------------------------------------------------------------- /public/mstile-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fm89/granddebat/HEAD/public/mstile-150x150.png -------------------------------------------------------------------------------- /public/mstile-310x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fm89/granddebat/HEAD/public/mstile-310x150.png -------------------------------------------------------------------------------- /public/mstile-310x310.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fm89/granddebat/HEAD/public/mstile-310x310.png -------------------------------------------------------------------------------- /public/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fm89/granddebat/HEAD/public/apple-touch-icon.png -------------------------------------------------------------------------------- /public/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fm89/granddebat/HEAD/public/android-chrome-192x192.png -------------------------------------------------------------------------------- /public/android-chrome-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fm89/granddebat/HEAD/public/android-chrome-512x512.png -------------------------------------------------------------------------------- /public/fonts/nunito-v10-latin-900.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fm89/granddebat/HEAD/public/fonts/nunito-v10-latin-900.eot -------------------------------------------------------------------------------- /public/fonts/nunito-v10-latin-900.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fm89/granddebat/HEAD/public/fonts/nunito-v10-latin-900.ttf -------------------------------------------------------------------------------- /public/fonts/nunito-v10-latin-900.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fm89/granddebat/HEAD/public/fonts/nunito-v10-latin-900.woff -------------------------------------------------------------------------------- /public/fonts/nunito-v10-latin-900.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fm89/granddebat/HEAD/public/fonts/nunito-v10-latin-900.woff2 -------------------------------------------------------------------------------- /public/fonts/nunito-v10-latin-italic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fm89/granddebat/HEAD/public/fonts/nunito-v10-latin-italic.eot -------------------------------------------------------------------------------- /public/fonts/nunito-v10-latin-italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fm89/granddebat/HEAD/public/fonts/nunito-v10-latin-italic.ttf -------------------------------------------------------------------------------- /public/fonts/nunito-v10-latin-italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fm89/granddebat/HEAD/public/fonts/nunito-v10-latin-italic.woff -------------------------------------------------------------------------------- /public/fonts/nunito-v10-latin-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fm89/granddebat/HEAD/public/fonts/nunito-v10-latin-regular.eot -------------------------------------------------------------------------------- /public/fonts/nunito-v10-latin-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fm89/granddebat/HEAD/public/fonts/nunito-v10-latin-regular.ttf -------------------------------------------------------------------------------- /public/fonts/nunito-v10-latin-italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fm89/granddebat/HEAD/public/fonts/nunito-v10-latin-italic.woff2 -------------------------------------------------------------------------------- /public/fonts/nunito-v10-latin-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fm89/granddebat/HEAD/public/fonts/nunito-v10-latin-regular.woff -------------------------------------------------------------------------------- /public/fonts/nunito-v10-latin-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fm89/granddebat/HEAD/public/fonts/nunito-v10-latin-regular.woff2 -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.css linguist-vendored 3 | *.scss linguist-vendored 4 | *.js linguist-vendored 5 | CHANGELOG.md export-ignore 6 | -------------------------------------------------------------------------------- /storage/framework/.gitignore: -------------------------------------------------------------------------------- 1 | config.php 2 | routes.php 3 | schedule-* 4 | compiled.php 5 | services.json 6 | events.scanned.php 7 | routes.scanned.php 8 | down 9 | -------------------------------------------------------------------------------- /app/Models/Skip.php: -------------------------------------------------------------------------------- 1 | 2 |
3 | Retour aux Thèmes 4 |
5 | 6 | -------------------------------------------------------------------------------- /resources/views/responses/value.blade.php: -------------------------------------------------------------------------------- 1 | @foreach (explode("\n", $value) as $line) 2 | @if (!$loop->first) 3 |
4 | @endif 5 | {{ $line }} 6 | @endforeach -------------------------------------------------------------------------------- /app/Models/Result.php: -------------------------------------------------------------------------------- 1 | 2 |
3 | Retour aux Thèmes 4 | / Questions 5 |
6 | 7 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | insert_final_newline = true 7 | indent_style = space 8 | indent_size = 4 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | 14 | [*.yml] 15 | indent_size = 2 16 | -------------------------------------------------------------------------------- /public/browserconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | #da532c 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/Models/Debate.php: -------------------------------------------------------------------------------- 1 | hasMany(Question::class); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /public/hot 3 | /public/storage 4 | /public/mix-manifest.json 5 | /public/css/app.css 6 | /public/js/app.js 7 | /public/fonts/vendor 8 | /storage/*.key 9 | /vendor 10 | .idea/ 11 | .env 12 | .phpunit.result.cache 13 | Homestead.json 14 | Homestead.yaml 15 | npm-debug.log 16 | yarn-error.log 17 | -------------------------------------------------------------------------------- /app/Http/Controllers/Api/UserController.php: -------------------------------------------------------------------------------- 1 | user(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /database/seeds/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | call(UsersTableSeeder::class); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/Models/Text.php: -------------------------------------------------------------------------------- 1 | belongsTo(Question::class); 13 | } 14 | 15 | public function user() 16 | { 17 | return $this->belongsTo(User::class); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/Policies/MessagePolicy.php: -------------------------------------------------------------------------------- 1 | user_id == $user->id; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/EncryptCookies.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /resources/views/messages/show.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 | Message {{ $message->title }} 7 |
8 |
9 | {!! \GrahamCampbell\Markdown\Facades\Markdown::convertToHtml($message->content) !!} 10 |
11 |
12 | @endsection 13 | -------------------------------------------------------------------------------- /resources/sass/_variables.scss: -------------------------------------------------------------------------------- 1 | // Body 2 | $body-bg: #f8fafc; 3 | 4 | // Typography 5 | $font-family-sans-serif: "Nunito", sans-serif; 6 | $font-size-base: 0.9rem; 7 | $line-height-base: 1.6; 8 | 9 | // Colors 10 | $blue: #3490dc; 11 | $indigo: #6574cd; 12 | $purple: #9561e2; 13 | $pink: #f66D9b; 14 | $red: #e3342f; 15 | $orange: #f6993f; 16 | $yellow: #ffed4a; 17 | $green: #38c172; 18 | $teal: #4dc0b5; 19 | $cyan: #6cb2eb; 20 | -------------------------------------------------------------------------------- /app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | get('/'); 18 | 19 | $response->assertStatus(200); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /resources/views/questions/search.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 | Recherche pour la question {{ $question->text }} 7 |
8 |
9 | 10 |
11 |
12 | @include('layouts.back_questions') 13 | @endsection 14 | 15 | -------------------------------------------------------------------------------- /app/Models/Proposal.php: -------------------------------------------------------------------------------- 1 | hasMany(Response::class); 15 | } 16 | 17 | public function reference() 18 | { 19 | return '' . floor($this->id / 1000000) . '-' . ($this->id % 1000000); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/CreatesApplication.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class)->bootstrap(); 19 | 20 | return $app; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/Providers/BroadcastServiceProvider.php: -------------------------------------------------------------------------------- 1 | 2 |
3 | Retour aux Thèmes 4 | / Questions 5 | @if (isset($user)) 6 | @if (($question->status === 'open' && $user->scores['total'] >= $question->minimal_score) || ($user->role === 'admin')) 7 | / Tags 8 | @endif 9 | @endif 10 |
11 | 12 | -------------------------------------------------------------------------------- /routes/api.php: -------------------------------------------------------------------------------- 1 | get('/user', 'Api/UserController@show'); 15 | -------------------------------------------------------------------------------- /app/Providers/AppServiceProvider.php: -------------------------------------------------------------------------------- 1 | id === (int) $id; 16 | }); 17 | -------------------------------------------------------------------------------- /app/Http/Middleware/Authenticate.php: -------------------------------------------------------------------------------- 1 | expectsJson()) { 18 | return route('login'); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/Http/Middleware/VerifyCsrfToken.php: -------------------------------------------------------------------------------- 1 | '« Précédent', 15 | 'next' => 'Suivant »', 16 | ]; -------------------------------------------------------------------------------- /webpack.mix.js: -------------------------------------------------------------------------------- 1 | const mix = require('laravel-mix'); 2 | 3 | /* 4 | |-------------------------------------------------------------------------- 5 | | Mix Asset Management 6 | |-------------------------------------------------------------------------- 7 | | 8 | | Mix provides a clean, fluent API for defining some Webpack build steps 9 | | for your Laravel application. By default, we are compiling the Sass 10 | | file for the application as well as bundling up all the JS files. 11 | | 12 | */ 13 | 14 | mix 15 | .js('resources/js/app.js', 'public/js') 16 | .sass('resources/sass/app.scss', 'public/css') 17 | .version(); 18 | -------------------------------------------------------------------------------- /resources/lang/en/pagination.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 'next' => 'Next »', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /routes/console.php: -------------------------------------------------------------------------------- 1 | comment(Inspiring::quote()); 18 | })->describe('Display an inspiring quote'); 19 | -------------------------------------------------------------------------------- /app/Policies/TextPolicy.php: -------------------------------------------------------------------------------- 1 | scores['questions'][$question->id] ?? 0 >= self::MIN_SCORE_PER_QUESTION; 19 | } 20 | 21 | public function update(User $user, Text $text) 22 | { 23 | return $text->user_id == $user->id; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /server.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | 10 | $uri = urldecode( 11 | parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) 12 | ); 13 | 14 | // This file allows us to emulate Apache's "mod_rewrite" functionality from the 15 | // built-in PHP web server. This provides a convenient way to test a Laravel 16 | // application without having installed a "real" web server software here. 17 | if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) { 18 | return false; 19 | } 20 | 21 | require_once __DIR__.'/public/index.php'; 22 | -------------------------------------------------------------------------------- /app/Http/Controllers/ProposalController.php: -------------------------------------------------------------------------------- 1 | responses()->join('questions', 'questions.id', 'responses.question_id')->orderBy('questions.order')->get(); 14 | $debate = Debate::find(floor($proposal->id / 1000000)); 15 | $next_proposal = Proposal::inRandomOrder()->first(); 16 | return view('proposals.show', compact('debate', 'proposal', 'responses', 'next_proposal')); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /resources/views/texts/legal-warning.blade.php: -------------------------------------------------------------------------------- 1 |
2 | En soumettant votre texte de synthèse, vous reconnaissez que celui-ci sera diffusé sur ce site, 3 | et associé au pseudonyme que vous avez utilisé pour votre inscription. 4 | Vous pouvez modifier votre pseudonyme à tout moment depuis l'onglet Mon compte. 5 | Votre texte sera aussi rendu disponible au téléchargement sous la licence 6 | Creative Commons Attribution Share 7 | Alike 4.0 International (CC-BY-SA-4.0) 8 | avec le reste des données produites sur ce site. 9 |
10 | -------------------------------------------------------------------------------- /app/Http/Controllers/Api/DebateController.php: -------------------------------------------------------------------------------- 1 | questionRepository = $questionRepository; 17 | } 18 | 19 | public function show(Debate $debate) 20 | { 21 | $questions = $this->questionRepository->listOfDebate($debate->id); 22 | return compact('questions'); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/Http/Controllers/Api/QuestionController.php: -------------------------------------------------------------------------------- 1 | tagRepository = $tagRepository; 18 | } 19 | 20 | public function tags(Request $request, Question $question) 21 | { 22 | return $this->tagRepository->getJsonTagsForQuestionUser($question, $request->user()); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /public/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews -Indexes 4 | 5 | 6 | RewriteEngine On 7 | 8 | # Handle Authorization Header 9 | RewriteCond %{HTTP:Authorization} . 10 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 11 | 12 | # Redirect Trailing Slashes If Not A Folder... 13 | RewriteCond %{REQUEST_FILENAME} !-d 14 | RewriteCond %{REQUEST_URI} (.+)/$ 15 | RewriteRule ^ %1 [L,R=301] 16 | 17 | # Handle Front Controller... 18 | RewriteCond %{REQUEST_FILENAME} !-d 19 | RewriteCond %{REQUEST_FILENAME} !-f 20 | RewriteRule ^ index.php [L] 21 | 22 | -------------------------------------------------------------------------------- /resources/views/responses/show.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 | 10 | @include('layouts.back_tags') 11 | @endsection 12 | -------------------------------------------------------------------------------- /resources/lang/en/auth.php: -------------------------------------------------------------------------------- 1 | 'These credentials do not match our records.', 17 | 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /app/Http/Controllers/MessageController.php: -------------------------------------------------------------------------------- 1 | user(); 13 | $messages = $user->messages()->orderBy('created_at', 'DESC')->get(); 14 | return view('messages.index', compact('messages')); 15 | } 16 | 17 | public function show(Message $message) 18 | { 19 | $this->authorize('show', $message); 20 | $message->read = true; 21 | $message->save(); 22 | return view('messages.show', compact('message')); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /resources/lang/fr/auth.php: -------------------------------------------------------------------------------- 1 | 'Ces identifiants ne correspondent pas à nos enregistrements', 15 | 'throttle' => 'Tentatives de connexion trop nombreuses. Veuillez essayer de nouveau dans :seconds secondes.', 16 | ]; -------------------------------------------------------------------------------- /app/Http/Middleware/RedirectIfAuthenticated.php: -------------------------------------------------------------------------------- 1 | check()) { 22 | return redirect(RouteServiceProvider::HOME); 23 | } 24 | 25 | return $next($request); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /resources/views/layouts/footer.blade.php: -------------------------------------------------------------------------------- 1 | 14 | -------------------------------------------------------------------------------- /app/Models/Question.php: -------------------------------------------------------------------------------- 1 | belongsTo(Debate::class); 15 | } 16 | 17 | public function responses() 18 | { 19 | return $this->hasMany(Response::class); 20 | } 21 | 22 | public function tags() 23 | { 24 | return $this->hasMany(Tag::class); 25 | } 26 | 27 | public function previous() 28 | { 29 | return $this->belongsTo(Question::class, 'previous_id'); 30 | } 31 | 32 | public function texts() 33 | { 34 | return $this->hasMany(Text::class); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/ForgotPasswordController.php: -------------------------------------------------------------------------------- 1 | 'App\Policies\MessagePolicy', 16 | 'App\Models\Tag' => 'App\Policies\TagPolicy', 17 | 'App\Models\Text' => 'App\Policies\TextPolicy', 18 | ]; 19 | 20 | /** 21 | * Register any authentication / authorization services. 22 | * 23 | * @return void 24 | */ 25 | public function boot() 26 | { 27 | $this->registerPolicies(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /resources/views/auth/verify.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
Vérification de l'adresse électronique
6 | 7 |
8 | @if (session('resent')) 9 | 12 | @endif 13 | 14 | Avant de continuer, veuillez chercher le lien de vérification dans votre courrier électronique. 15 | Si vous n'avez pas reçu le lien, cliquez ici pour en recevoir 16 | un autre. 17 |
18 |
19 | @endsection 20 | -------------------------------------------------------------------------------- /app/Repositories/TagRepository.php: -------------------------------------------------------------------------------- 1 | getTagsForQuestionUser($question, $user)->map(function ($tag) { return $tag->toArray(); }); 13 | } 14 | 15 | public function getTagsForQuestionUser(Question $question, User $user = null) 16 | { 17 | return $question->tags()->where(function ($query) use ($user) { 18 | if ($user == null) { 19 | return $query->whereNull('user_id'); 20 | } else { 21 | return $query->whereNull('user_id')->orWhere('user_id', $user->id); 22 | } 23 | })->orderBy('name')->get(); 24 | } 25 | } -------------------------------------------------------------------------------- /database/migrations/2019_03_17_110237_add_cities.php: -------------------------------------------------------------------------------- 1 | string('city')->default('France'); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | * 25 | * @return void 26 | */ 27 | public function down() 28 | { 29 | Schema::table('proposals', function (Blueprint $table) { 30 | $table->dropColumn('city'); 31 | }); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /database/migrations/2019_02_28_182539_alter_tags_add_color.php: -------------------------------------------------------------------------------- 1 | string('color')->default('blue'); 18 | }); 19 | } 20 | 21 | /** 22 | * Reverse the migrations. 23 | * 24 | * @return void 25 | */ 26 | public function down() 27 | { 28 | Schema::table('tags', function (Blueprint $table) { 29 | $table->dropColumn('color'); 30 | }); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Notifications/ResetPassword.php: -------------------------------------------------------------------------------- 1 | subject('Ré-initialisation de mot de passe pour ' . config('app.name')) 15 | ->line('Vous recevez ce message car nous avons reçu une demande de ré-initialisation de mot de passe pour votre compte.') 16 | ->action('Choisir un nouveau mot de passe', url('password/reset', $this->token)) 17 | ->line("Si vous n'avez pas demandé à ré-initialiser votre mot de passe, aucune action n'est nécessaire de votre part."); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /database/migrations/2019_02_08_131014_nullable_email.php: -------------------------------------------------------------------------------- 1 | string('email')->nullable()->change(); 18 | }); 19 | } 20 | 21 | /** 22 | * Reverse the migrations. 23 | * 24 | * @return void 25 | */ 26 | public function down() 27 | { 28 | Schema::table('users', function (Blueprint $table) { 29 | $table->string('email')->nullable(false)->change(); 30 | }); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /resources/views/tags/show.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 | Exemples de réponses annotées avec la catégorie {{ $tag->getLabel() }} 7 |
8 |
9 | @foreach ($responses as $response) 10 |
11 |

12 | @include('responses.value', ['value' => $response->value]) 13 |

14 | 17 |
18 | @endforeach 19 |
20 |
21 | @include('layouts.back_tags') 22 | @endsection 23 | -------------------------------------------------------------------------------- /database/migrations/2019_02_09_181024_nullable_tags.php: -------------------------------------------------------------------------------- 1 | integer('question_id')->nullable()->change(); 18 | }); 19 | } 20 | 21 | /** 22 | * Reverse the migrations. 23 | * 24 | * @return void 25 | */ 26 | public function down() 27 | { 28 | Schema::table('tags', function (Blueprint $table) { 29 | $table->integer('question_id')->nullable(false)->change(); 30 | }); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /database/migrations/2019_02_14_211651_add_responses_groups.php: -------------------------------------------------------------------------------- 1 | integer('clean_value_group_id')->nullable(); 18 | }); 19 | } 20 | 21 | /** 22 | * Reverse the migrations. 23 | * 24 | * @return void 25 | */ 26 | public function down() 27 | { 28 | Schema::table('responses', function (Blueprint $table) { 29 | $table->dropColumn('clean_value_group_id'); 30 | }); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /resources/js/bootstrap.js: -------------------------------------------------------------------------------- 1 | window._ = require('lodash'); 2 | 3 | /** 4 | * We'll load jQuery and the Bootstrap jQuery plugin which provides support 5 | * for JavaScript based Bootstrap features such as modals and tabs. This 6 | * code may be modified to fit the specific needs of your application. 7 | */ 8 | 9 | try { 10 | window.Popper = require('popper.js').default; 11 | window.$ = window.jQuery = require('jquery'); 12 | 13 | require('bootstrap'); 14 | } catch (e) {} 15 | 16 | /** 17 | * We'll load the axios HTTP library which allows us to easily issue requests 18 | * to our Laravel back-end. This library automatically handles sending the 19 | * CSRF token as a header based on the value of the "XSRF" token cookie. 20 | */ 21 | 22 | window.axios = require('axios'); 23 | 24 | window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 25 | -------------------------------------------------------------------------------- /database/migrations/2019_02_20_142331_alter_questions_add_minimallevel.php: -------------------------------------------------------------------------------- 1 | integer('minimal_score')->default(0); 18 | }); 19 | } 20 | 21 | /** 22 | * Reverse the migrations. 23 | * 24 | * @return void 25 | */ 26 | public function down() 27 | { 28 | Schema::table('questions', function (Blueprint $table) { 29 | $table->dropColumn('minimal_score'); 30 | }); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_100000_create_password_resets_table.php: -------------------------------------------------------------------------------- 1 | string('email')->index(); 18 | $table->string('token'); 19 | $table->timestamp('created_at')->nullable(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::dropIfExists('password_resets'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Providers/EventServiceProvider.php: -------------------------------------------------------------------------------- 1 | [ 19 | SendEmailVerificationNotification::class, 20 | ], 21 | ]; 22 | 23 | /** 24 | * Register any events for your application. 25 | * 26 | * @return void 27 | */ 28 | public function boot() 29 | { 30 | parent::boot(); 31 | 32 | // 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /database/migrations/2019_02_12_081343_cache_scores.php: -------------------------------------------------------------------------------- 1 | jsonb('scores')->default('{"total": 0, "debates": {"1": 0, "2": 0, "3": 0, "4": 0}, "questions": {}}'); 18 | }); 19 | } 20 | 21 | /** 22 | * Reverse the migrations. 23 | * 24 | * @return void 25 | */ 26 | public function down() 27 | { 28 | Schema::table('users', function (Blueprint $table) { 29 | $table->dropColumn('scores'); 30 | }); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /resources/lang/en/passwords.php: -------------------------------------------------------------------------------- 1 | 'Passwords must be at least eight characters and match the confirmation.', 17 | 'reset' => 'Your password has been reset!', 18 | 'sent' => 'We have e-mailed your password reset link!', 19 | 'token' => 'This password reset token is invalid.', 20 | 'user' => "We can't find a user with that e-mail address.", 21 | 22 | ]; 23 | -------------------------------------------------------------------------------- /resources/views/tags/create.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 | Création d'une catégorie pour la question {{ $question->text }} 7 |
8 |
9 | {!! Form::open(['url' => 'questions/' . $question->id . '/tags']) !!} 10 |
11 | 12 | 13 |
14 | 17 | {!! Form::close() !!} 18 |
19 |
20 | @include('layouts.back_tags') 21 | @endsection 22 | -------------------------------------------------------------------------------- /database/factories/UserFactory.php: -------------------------------------------------------------------------------- 1 | define(App\User::class, function (Faker $faker) { 17 | return [ 18 | 'name' => $faker->name, 19 | 'email' => $faker->unique()->safeEmail, 20 | 'email_verified_at' => now(), 21 | 'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret 22 | 'remember_token' => \Illuminate\Support\Str::random(10), 23 | ]; 24 | }); 25 | -------------------------------------------------------------------------------- /app/Policies/TagPolicy.php: -------------------------------------------------------------------------------- 1 | role === 'admin') || ($user->scores['questions'][$question->id] ?? 0) >= 50); 17 | } 18 | 19 | public function inject(User $user, Tag $tag) 20 | { 21 | return ($user != null) && ($user->id === 1) && ($tag->user_id === null); 22 | } 23 | 24 | public function update(User $user, Tag $tag) 25 | { 26 | return $tag->user_id == $user->id || $user->role == 'admin'; 27 | } 28 | 29 | public function delete(User $user, Tag $tag) 30 | { 31 | return $this->update($user, $tag) && ($tag->actions()->doesntExist() || $tag->user_id === $user->id); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /resources/lang/fr/passwords.php: -------------------------------------------------------------------------------- 1 | 'Les mots de passe doivent contenir au moins huit caractères et être identiques.', 15 | 'reset' => 'Votre mot de passe a été réinitialisé !', 16 | 'sent' => 'Nous vous avons envoyé par email le lien de réinitialisation du mot de passe !', 17 | 'token' => "Ce jeton de réinitialisation du mot de passe n'est pas valide.", 18 | 'user' => "Aucun utilisateur n'a été trouvé avec cette adresse email.", 19 | ]; 20 | -------------------------------------------------------------------------------- /resources/views/layouts/app.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Grande Annotation 7 | 8 | 9 | @yield('scripts') 10 | 11 | 12 | 13 |
14 | @include('layouts.navbar') 15 |
16 |
17 |
18 |
19 | @yield('content') 20 |
21 |
22 |
23 |
24 |
25 | @include('layouts.footer') 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/ResetPasswordController.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->integer('user_id'); 19 | $table->foreign('user_id')->references('id')->on('users'); 20 | $table->integer('response_id'); 21 | $table->foreign('response_id')->references('id')->on('responses'); 22 | $table->timestamps(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('skips'); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_000000_create_users_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string('name'); 19 | $table->string('email')->unique(); 20 | $table->timestamp('email_verified_at')->nullable(); 21 | $table->string('password'); 22 | $table->rememberToken(); 23 | $table->timestamps(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('users'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /database/migrations/2019_02_21_102922_create_sessions_table.php: -------------------------------------------------------------------------------- 1 | string('id')->unique(); 18 | $table->unsignedInteger('user_id')->nullable(); 19 | $table->string('ip_address', 45)->nullable(); 20 | $table->text('user_agent')->nullable(); 21 | $table->text('payload'); 22 | $table->integer('last_activity'); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('sessions'); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /database/migrations/2019_03_02_093052_create_results.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->integer('response_id'); 19 | $table->foreign('response_id')->references('id')->on('responses'); 20 | $table->integer('tag_id')->nullable(); 21 | $table->foreign('tag_id')->references('id')->on('tags'); 22 | $table->float('weight'); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('results'); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /database/migrations/2019_02_09_202534_alter_questions_order.php: -------------------------------------------------------------------------------- 1 | integer('order')->default(0); 18 | $table->integer('previous_id')->nullable(); 19 | $table->foreign('previous_id')->references('id')->on('questions'); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::table('questions', function (Blueprint $table) { 31 | $table->dropColumn('order'); 32 | $table->dropColumn('previous_id'); 33 | }); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /resources/views/auth/delete.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
Suppression du compte
6 |
7 |
8 |

9 | Vous allez supprimer votre compte. Votre nom d'affichage et votre adresse électronique seront alors 10 | immédiatement effacés de la base de données. Il ne sera plus possible de récupérer votre compte. 11 | Vos annotations apparaîtront alors sous le pseudonyme Utilisateur supprimé. 12 |

13 | {!! Form::open(['url' => '/quit']) !!} 14 | 18 | {!! Form::close() !!} 19 |
20 |
21 |
22 | @endsection 23 | -------------------------------------------------------------------------------- /resources/views/texts/show.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 | {{ $text->question->text }} 7 |
8 | Texte libre rédigé par {{ $text->user->name }} pour synthétiser 9 | ses {{ $text->user->scores['questions'][$text->question_id] }} propres lectures de cette question 10 | du thème {{ $text->question->debate->name }} 11 |
12 |
13 | {!! \GrahamCampbell\Markdown\Facades\Markdown::convertToHtml($text->content) !!} 14 | @auth 15 | @if ($text->user_id == $user->id) 16 | 17 | 18 | Modifier ce texte 19 | 20 | @endif 21 | @endauth 22 |
23 |
24 | @endsection 25 | -------------------------------------------------------------------------------- /database/migrations/2019_03_02_215039_create_messages_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string('title'); 19 | $table->text('content'); 20 | $table->integer('user_id'); 21 | $table->foreign('user_id')->references('id')->on('users'); 22 | $table->boolean('read')->default(false); 23 | $table->timestamps(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('messages'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /database/migrations/2019_03_24_072702_texts.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->text('content'); 19 | $table->integer('user_id'); 20 | $table->foreign('user_id')->references('id')->on('users'); 21 | $table->integer('question_id'); 22 | $table->foreign('question_id')->references('id')->on('questions'); 23 | $table->timestamps(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('texts'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /resources/views/messages/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 | Boîte de réception 7 |
8 |
9 | 10 | 11 | @foreach ($messages as $message) 12 | 13 | 22 | 23 | 24 | @endforeach 25 | 26 |
14 | 15 | @if ($message->read) 16 | {{ $message->title }} 17 | @else 18 | {{ $message->title }} 19 | @endif 20 | 21 | {{ $message->created_at->format('d/m/Y') }}
27 |
28 |
29 | @endsection 30 | -------------------------------------------------------------------------------- /resources/js/components/Quotation.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 32 | 33 | -------------------------------------------------------------------------------- /app/Logic/Stats.php: -------------------------------------------------------------------------------- 1 | select('tag_id') 15 | ->groupBy('clean_value_group_id', 'tag_id') 16 | ->where('user_id', $user->id) 17 | ->where('question_id', $question->id) 18 | ->get(); 19 | $tagCounts = []; 20 | foreach ($userActions as $userAction) { 21 | $tagCounts[$userAction->tag_id] = ($tagCounts[$userAction->tag_id] ?? 0) + 1; 22 | } 23 | $tags = Tag::whereIn('id', array_keys($tagCounts))->get()->keyBy('id'); 24 | $stats = []; 25 | foreach ($tagCounts as $tagId => $tagCount) { 26 | $stats[$tags[$tagId]->getLabel()] = $tagCount; 27 | } 28 | arsort($stats); 29 | if (count($stats) > 15) { 30 | $stats = array_slice($stats, 0, 15); 31 | } 32 | return $stats; 33 | } 34 | } -------------------------------------------------------------------------------- /public/safari-pinned-tab.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | Created by potrace 1.11, written by Peter Selinger 2001-2013 9 | 10 | 12 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/LoginController.php: -------------------------------------------------------------------------------- 1 | middleware('guest')->except('logout'); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /config/view.php: -------------------------------------------------------------------------------- 1 | [ 17 | resource_path('views'), 18 | ], 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Compiled View Path 23 | |-------------------------------------------------------------------------- 24 | | 25 | | This option determines where all the compiled Blade templates will be 26 | | stored for your application. Typically, this is within the storage 27 | | directory. However, as usual, you are free to change this value. 28 | | 29 | */ 30 | 31 | 'compiled' => env( 32 | 'VIEW_COMPILED_PATH', 33 | realpath(storage_path('framework/views')) 34 | ), 35 | 36 | ]; 37 | -------------------------------------------------------------------------------- /app/Http/Controllers/DebateController.php: -------------------------------------------------------------------------------- 1 | questionRepository = $questionRepository; 19 | } 20 | 21 | public function show(Request $request, Debate $debate) 22 | { 23 | $user = $request->user(); 24 | $progress = []; 25 | foreach ($debate->questions as $question) { 26 | # Show progress with respect to target goal of 10% reading 27 | $progress[$question->id] = min(100, ceil(1000 - $question->priority)); 28 | } 29 | return view('debates.show', compact('debate', 'user', 'progress')); 30 | } 31 | 32 | public function random(Request $request, Debate $debate) 33 | { 34 | $question = $this->questionRepository->randomQuestion($request->user(), $debate); 35 | return redirect('/questions/' . $question->id . '/read'); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | ./tests/Unit 14 | 15 | 16 | 17 | ./tests/Feature 18 | 19 | 20 | 21 | 22 | ./app 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /resources/js/app.js: -------------------------------------------------------------------------------- 1 | /** 2 | * First we will load all of this project's JavaScript dependencies which 3 | * includes Vue and other libraries. It is a great starting point when 4 | * building robust, powerful web applications using Vue and Laravel. 5 | */ 6 | 7 | require('./bootstrap'); 8 | 9 | // This import adds "Promise" support in IE11 which lacks it otherwise 10 | require('es6-promise').polyfill(); 11 | 12 | window.Vue = require('vue'); 13 | 14 | var Chart = require('chart.js'); 15 | export { Chart }; 16 | 17 | /** 18 | * The following block of code may be used to automatically register your 19 | * Vue components. It will recursively scan this directory for the Vue 20 | * components and automatically register them with their "basename". 21 | * 22 | * Eg. ./components/ExampleComponent.vue -> 23 | */ 24 | 25 | const files = require.context('./', true, /\.vue$/i); 26 | files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default)); 27 | 28 | /** 29 | * Next, we will create a fresh Vue application instance and attach it to 30 | * the page. Then, you may begin adding components to this application 31 | * or customize the JavaScript scaffolding to fit your unique needs. 32 | */ 33 | 34 | const app = new Vue({ 35 | el: '#app', 36 | }); 37 | -------------------------------------------------------------------------------- /app/Models/Tag.php: -------------------------------------------------------------------------------- 1 | belongsTo(Question::class); 19 | } 20 | 21 | public function actions() 22 | { 23 | return $this->hasMany(Action::class); 24 | } 25 | 26 | public function user() 27 | { 28 | return $this->belongsTo(User::class); 29 | } 30 | 31 | public function toArray() 32 | { 33 | return [ 34 | 'id' => $this->id, 35 | 'checked' => false, 36 | 'color' => $this->color, 37 | 'label' => $this->getLabel(), 38 | 'name' => $this->name, 39 | 'is_custom' => $this->isCustom(), 40 | ]; 41 | } 42 | 43 | public function getLabel() 44 | { 45 | // Remove the first letter which is used to sort tags 46 | return preg_replace('/^[A-Z] /', '', $this->name); 47 | } 48 | 49 | public function isCustom() 50 | { 51 | return $this->user_id !== null; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/VerificationController.php: -------------------------------------------------------------------------------- 1 | middleware('auth'); 39 | $this->middleware('signed')->only('verify'); 40 | $this->middleware('throttle:6,1')->only('verify', 'resend'); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /database/migrations/2019_02_07_202755_create_audits_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string('user_type')->nullable(); 19 | $table->unsignedBigInteger('user_id')->nullable(); 20 | $table->string('event'); 21 | $table->morphs('auditable'); 22 | $table->text('old_values')->nullable(); 23 | $table->text('new_values')->nullable(); 24 | $table->text('url')->nullable(); 25 | $table->ipAddress('ip_address')->nullable(); 26 | $table->string('user_agent')->nullable(); 27 | $table->string('tags')->nullable(); 28 | $table->timestamps(); 29 | 30 | $table->index(['user_id', 'user_type']); 31 | }); 32 | } 33 | 34 | /** 35 | * Reverse the migrations. 36 | * 37 | * @return void 38 | */ 39 | public function down() 40 | { 41 | Schema::drop('audits'); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /database/migrations/2019_02_21_152646_alter_qdr_add_priority.php: -------------------------------------------------------------------------------- 1 | integer('priority')->default(0); 18 | }); 19 | Schema::table('questions', function (Blueprint $table) { 20 | $table->integer('priority')->default(0); 21 | }); 22 | Schema::table('responses', function (Blueprint $table) { 23 | $table->integer('priority')->default(1); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::table('debates', function (Blueprint $table) { 35 | $table->dropColumn('priority'); 36 | }); 37 | Schema::table('questions', function (Blueprint $table) { 38 | $table->dropColumn('priority'); 39 | }); 40 | Schema::table('responses', function (Blueprint $table) { 41 | $table->dropColumn('priority'); 42 | }); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /config/services.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'domain' => env('MAILGUN_DOMAIN'), 19 | 'secret' => env('MAILGUN_SECRET'), 20 | 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), 21 | ], 22 | 23 | 'ses' => [ 24 | 'key' => env('SES_KEY'), 25 | 'secret' => env('SES_SECRET'), 26 | 'region' => env('SES_REGION', 'us-east-1'), 27 | ], 28 | 29 | 'sparkpost' => [ 30 | 'secret' => env('SPARKPOST_SECRET'), 31 | ], 32 | 33 | 'stripe' => [ 34 | 'model' => App\User::class, 35 | 'key' => env('STRIPE_KEY'), 36 | 'secret' => env('STRIPE_SECRET'), 37 | 'webhook' => [ 38 | 'secret' => env('STRIPE_WEBHOOK_SECRET'), 39 | 'tolerance' => env('STRIPE_WEBHOOK_TOLERANCE', 300), 40 | ], 41 | ], 42 | 43 | ]; 44 | -------------------------------------------------------------------------------- /app/Exceptions/Handler.php: -------------------------------------------------------------------------------- 1 | 5 |
6 | Injection dans la catégorie {{ $tag->name }} pour la question {{ $question->text }} 7 |
8 |
9 |
10 | Attention ! 11 | Vous allez injecter les catégories créées par des utilisateurs dans une catégorie commune. 12 | Les utilisateurs concernés seront avertis par message de l'opération. 13 |
14 | {!! Form::open(['url' => 'tags/' . $tag->id . '/inject']) !!} 15 | @foreach ($customTags as $customTag) 16 |
17 | 18 | 21 |
22 | @endforeach 23 | 26 | {!! Form::close() !!} 27 |
28 | 29 | @include('layouts.back_tags') 30 | @endsection 31 | -------------------------------------------------------------------------------- /resources/views/tags/edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 | Renommage d'une catégorie pour la question {{ $question->text }} 7 |
8 |
9 | @if ($tag->actions()->exists()) 10 |
11 | Attention ! Vous allez renommer une catégorie déjà affectée à des contributions. 12 | Faites en sorte que le nouveau nom garde globalement le même sens pour ne pas biaiser 13 | vos analyses précédentes. Les contributions attachées à l'ancien nom de la catégorie 14 | seront désormais attachées au nouveau nom de la catégorie. 15 |
16 | @endif 17 | {!! Form::open(['url' => 'tags/' . $tag->id]) !!} 18 |
19 | 20 | 21 |
22 | 25 | {!! Form::close() !!} 26 |
27 |
28 | @include('layouts.back_tags') 29 | @endsection 30 | -------------------------------------------------------------------------------- /resources/views/vendor/notifications/email.blade.php: -------------------------------------------------------------------------------- 1 | @component('mail::message') 2 | {{-- Greeting --}} 3 | @if (! empty($greeting)) 4 | # {{ $greeting }} 5 | @else 6 | @if ($level === 'error') 7 | # @lang('Oups !') 8 | @else 9 | # @lang('Bonjour !') 10 | @endif 11 | @endif 12 | 13 | {{-- Intro Lines --}} 14 | @foreach ($introLines as $line) 15 | {{ $line }} 16 | 17 | @endforeach 18 | 19 | {{-- Action Button --}} 20 | @isset($actionText) 21 | 31 | @component('mail::button', ['url' => $actionUrl, 'color' => $color]) 32 | {{ $actionText }} 33 | @endcomponent 34 | @endisset 35 | 36 | {{-- Outro Lines --}} 37 | @foreach ($outroLines as $line) 38 | {{ $line }} 39 | 40 | @endforeach 41 | 42 | {{-- Salutation --}} 43 | @if (! empty($salutation)) 44 | {{ $salutation }} 45 | @else 46 | @lang('Sincèrement'),
{{ config('app.name') }} 47 | @endif 48 | 49 | {{-- Subcopy --}} 50 | @isset($actionText) 51 | @component('mail::subcopy') 52 | @lang( 53 | "Si vous ne parvenez pas à cliquer sur le bouton \":actionText\", vous pouvez copier-coller l'URL ci-dessous \n". 54 | 'dans votre navigateur : [:actionURL](:actionURL)', 55 | [ 56 | 'actionText' => $actionText, 57 | 'actionURL' => $actionUrl, 58 | ] 59 | ) 60 | @endcomponent 61 | @endisset 62 | @endcomponent 63 | -------------------------------------------------------------------------------- /database/migrations/2019_02_03_181956_create_tags_tables.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->text('name'); 19 | $table->integer('question_id'); 20 | $table->foreign('question_id')->references('id')->on('questions'); 21 | $table->timestamps(); 22 | }); 23 | Schema::create('actions', function (Blueprint $table) { 24 | $table->increments('id'); 25 | $table->integer('tag_id'); 26 | $table->foreign('tag_id')->references('id')->on('tags'); 27 | $table->integer('response_id'); 28 | $table->foreign('response_id')->references('id')->on('responses'); 29 | $table->integer('user_id'); 30 | $table->foreign('user_id')->references('id')->on('users'); 31 | $table->timestamps(); 32 | }); 33 | } 34 | 35 | /** 36 | * Reverse the migrations. 37 | * 38 | * @return void 39 | */ 40 | public function down() 41 | { 42 | Schema::dropIfExists('actions'); 43 | Schema::dropIfExists('tags'); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /resources/views/questions/graph.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 | Résultats pour la question fermée {{ $question->text }} 7 |
8 |
9 | 10 |
11 |
12 | @include('layouts.back_questions') 13 | @endsection 14 | 15 | @section('scripts') 16 | 40 | @endsection 41 | -------------------------------------------------------------------------------- /resources/views/users/edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 | Modification de mon compte 7 |
8 |
9 | {!! Form::open(['url' => 'account']) !!} 10 |
11 | 12 | 14 | @if ($errors->has('name')) 15 | 16 | {{ $errors->first('name') }} 17 | 18 | @endif 19 |
20 | Votre pseudonyme est notamment affiché en marge des textes libres de synthèse que vous pouvez 21 | rédiger une fois que vous avez lu {{ \App\Policies\TextPolicy::MIN_SCORE_PER_QUESTION }} réponses 22 | à une même question. Vous êtes libres d'y renseigner votre vrai nom ou non. 23 |
24 |
25 | 28 | {!! Form::close() !!} 29 |
30 |
31 | @endsection 32 | -------------------------------------------------------------------------------- /resources/views/proposals/show.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 | Intégralité de la contribution intitulée "{{ $proposal->title }}" 7 |
8 |
9 |
10 | Voici l'ensemble des réponses fournies par un contributeur du site officiel 11 | aux questions du thème {{ $debate->name }} 12 | le {{ $proposal->published_at->format('j') . ' ' . ['01' => 'janvier', '02' => 'février', '03' => 'mars'][$proposal->published_at->format('m')] }} 2019 13 | à 14 | {{ $proposal->city }} . 15 |
16 | @foreach ($responses as $response) 17 |

18 | {{ $response->question->text }} 19 |
20 | @include('responses.value', ['value' => $response->value]) 21 |
22 |

23 | @endforeach 24 |
25 | 26 | 27 | Lire une autre au hasard 28 | 29 |
30 |
31 | @include('layouts.back_debates') 32 | @endsection 33 | -------------------------------------------------------------------------------- /resources/js/components/ActionButton.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 44 | 45 | 62 | -------------------------------------------------------------------------------- /app/Repositories/QuestionRepository.php: -------------------------------------------------------------------------------- 1 | scores['total']; 13 | if ($debate == null) { 14 | $query = Debate::where('status', 'open'); 15 | if ($user != null) { 16 | $query = $query->orderByRaw('priority DESC, RANDOM()'); 17 | } else { 18 | $query = $query->orderByRaw('RANDOM()'); 19 | } 20 | $debate = $query->first(); 21 | } 22 | $query = Question::where('debate_id', $debate->id) 23 | ->where('is_free', true) 24 | ->where('status', 'open') 25 | ->where('minimal_score', '<=', $current_score); 26 | if ($user != null) { 27 | $query = $query->orderByRaw('priority DESC, RANDOM()'); 28 | } else { 29 | $query = $query->orderByRaw('RANDOM()'); 30 | } 31 | return $query->first(); 32 | } 33 | 34 | public function listOfDebate($debate_id) 35 | { 36 | $questions = Question::where('debate_id', $debate_id) 37 | ->where('is_free', true) 38 | ->orderByRaw('status ASC, minimal_score ASC, RANDOM()') 39 | ->get(); 40 | foreach ($questions as $question) { 41 | if ($question->previous != null) { 42 | $question->text = $question->previous->text . ' ' . $question->text; 43 | } 44 | } 45 | return $questions; 46 | } 47 | } -------------------------------------------------------------------------------- /resources/views/texts/edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
Édition d'un texte existant
6 |
7 |
8 | Cet écran vous permet de modifier un texte libre de synthèse que vous avez déjà écrit. 9 | Pour mettre en forme légèrement votre texte (gras, italique, listes, titres, 10 | liens, etc.) vous pouvez utiliser la syntaxe Markdown. 11 |
12 | {!! Form::open(['url' => 'texts/' . $text->id, 'method' => 'PUT']) !!} 13 |
14 | 15 | 17 |
18 |
19 | 20 | 22 |
23 | @include('texts.legal-warning') 24 | 27 | {!! Form::close() !!} 28 |
29 |
30 | @endsection 31 | -------------------------------------------------------------------------------- /database/migrations/2019_02_11_230023_add_roles.php: -------------------------------------------------------------------------------- 1 | string('status')->default('preparing'); 18 | }); 19 | Schema::table('debates', function (Blueprint $table) { 20 | $table->string('status')->default('preparing'); 21 | }); 22 | Schema::table('users', function (Blueprint $table) { 23 | $table->string('role')->default('user'); 24 | }); 25 | Schema::table('tags', function (Blueprint $table) { 26 | $table->integer('user_id')->nullable(); 27 | $table->foreign('user_id')->references('id')->on('users'); 28 | }); 29 | } 30 | 31 | /** 32 | * Reverse the migrations. 33 | * 34 | * @return void 35 | */ 36 | public function down() 37 | { 38 | Schema::table('questions', function (Blueprint $table) { 39 | $table->dropColumn('status'); 40 | }); 41 | Schema::table('debates', function (Blueprint $table) { 42 | $table->dropColumn('status'); 43 | }); 44 | Schema::table('users', function (Blueprint $table) { 45 | $table->dropColumn('role'); 46 | }); 47 | Schema::table('tags', function (Blueprint $table) { 48 | $table->dropColumn('user_id'); 49 | }); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /resources/views/texts/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
Textes libres de synthèse de la communauté
6 |
7 |
8 | Cette page recense les textes libres écrits par la communauté des annotateurs pour traduire leur 9 | ressenti après la lecture de centaines de réponses à certaines questions. Il ne s'agit pas 10 | des analyses officielles, mais bien d'analyses individuelles, produites par des personnes 11 | ayant utilisé ce site pour comprendre ce qui les contributeurs de 12 | granddebat.fr avaient écrit. 13 | Si vous aussi vous avez beaucoup lu, nous vous invitons à écrire un texte. 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | @foreach ($texts as $text) 23 | 24 | 25 | 26 | 27 | 28 | 29 | @endforeach 30 |
ThèmeQuestionLienAuteur
{{ $text->question->debate->name }}{{ $text->question->text }}{{ $text->user->name }}
31 |
32 |
33 | @endsection 34 | -------------------------------------------------------------------------------- /resources/views/limits.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.visitor') 2 | 3 | @section('jumbo') 4 |
5 | Les limites de l'intelligence artificielle 6 |
7 |

8 | En 2019, même les meilleurs assistants vocaux ne répondent qu'à des commandes basiques. 9 |

10 |

11 | L'IA peut compter des mots et les regrouper par thème, mais ne comprend pas ce qu'elle lit. 12 |

13 |

14 | Sous-entendus, ironie, négations, découvrez ci-dessous quelques difficultés typiques. 15 |

16 | @endsection 17 | 18 | @section('center') 19 |
20 | 21 |
22 | @endsection 23 | 24 | @section('bottom') 25 |

26 | Vous comprenez un texte bien mieux que n'importe quelle IA ! 27 | Venez donc lire vous-même les contributions de vos concitoyens au grand débat. 28 | Promis, vous en apprendrez bien plus qu'en lisant des synthèses artificielles 29 | (qui ne sont que des décomptes des thématiques les plus fréquentes). 30 | Il y a plein d'idées et d'émotions à découvrir. 31 | Ensemble, nous construisons une synthèse collective, transparente et fondée sur 32 | l'intelligence humaine. 33 |

34 |
35 | 36 | Lire et annoter des réponses 37 | 38 |
39 |
40 |
41 | @endsection 42 | -------------------------------------------------------------------------------- /public/resources/README.txt: -------------------------------------------------------------------------------- 1 | Attention ! 2 | Document à lire avant toute utilisation des données ci-jointes 3 | 4 | Par souci de transparence, nous tenons à publier ici les données brutes de 5 | toutes les annotations saisies dans la plateforme. Néanmoins, nous insistons 6 | sur le fait qu'il s'agit de données non retraitées qu'il convient de prendre 7 | avec prudence. En particulier, elles contiennent : 8 | 9 | 1) des tentatives de manipulation frauduleuse de la plateforme (du type, 10 | "je clique toujours sur le même bouton" ou "je clique aléatoirement"), 11 | 12 | 2) des erreurs de saisies, même par les annoteurs vertueux (clic qui dérape, 13 | clic trop rapide), 14 | 15 | 3) toutes les annotations, y compris celles qui n'ont pas (ou pas encore) été 16 | corroborées par trois lectures concordantes. 17 | 18 | Par ailleurs, lorsqu'une personne réalise une annotation sur un texte fréquent 19 | (typiquement, un texte court comme "Santé et éducation"), toutes les réponses 20 | contenant le texte à l'identique sont automatiquement catégorisées aussi, 21 | pour faire gagner du temps à tous. 22 | 23 | Pour toutes ces raisons, il ne faut surtout pas faire d'analyse quantitative du 24 | fichier brut avant d'avoir procédé à un profond nettoyage de données (détection 25 | de fraude, recherche des lectures concordantes, redressement des réponses 26 | fréquentes). Un simple décompte des libellés les plus fréquents dans le fichier 27 | ci-joint aboutira mécaniquement à des biais statistiques majeurs, comme la 28 | sur-représentation des annotations posées sur des textes courts. 29 | 30 | Nous rendrons progressivement disponibles des propositions de scripts de 31 | retraitement. 32 | 33 | Vous pouvez nous contacter (voir la FAQ sur le site https://grandeannotation.fr). 34 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/UserController.php: -------------------------------------------------------------------------------- 1 | user(); 16 | return view('users.show', compact('user')); 17 | } 18 | 19 | public function edit(Request $request) 20 | { 21 | $user = $request->user(); 22 | return view('users.edit', compact('user')); 23 | } 24 | 25 | public function update(Request $request) 26 | { 27 | $user = $request->user(); 28 | $new_name = $request->input('name'); 29 | if (User::where('name', 'ILIKE', $new_name)->where('id', '!=', $user->id)->exists()) { 30 | return redirect('/account/edit') 31 | ->withInput() 32 | ->withErrors(["name" => "Ce pseudonyme est déjà utilisé. Merci d'en choisir un autre."]); 33 | } 34 | $user->name = $new_name; 35 | $user->save(); 36 | return view('users.show', compact('user')); 37 | } 38 | 39 | public function showQuit() 40 | { 41 | return view('auth.delete'); 42 | } 43 | 44 | public function doQuit(Request $request) 45 | { 46 | $user = $request->user(); 47 | $user->name = "Utilisateur supprimé"; 48 | $user->email = null; 49 | $user->password = Hash::make("nopassword"); 50 | $user->save(); 51 | Auth::logoutOtherDevices("nopassword"); 52 | Auth::logout(); 53 | $request->session()->invalidate(); 54 | return redirect('/'); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /config/hashing.php: -------------------------------------------------------------------------------- 1 | 'bcrypt', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Bcrypt Options 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may specify the configuration options that should be used when 26 | | passwords are hashed using the Bcrypt algorithm. This will allow you 27 | | to control the amount of time it takes to hash the given password. 28 | | 29 | */ 30 | 31 | 'bcrypt' => [ 32 | 'rounds' => env('BCRYPT_ROUNDS', 10), 33 | ], 34 | 35 | /* 36 | |-------------------------------------------------------------------------- 37 | | Argon Options 38 | |-------------------------------------------------------------------------- 39 | | 40 | | Here you may specify the configuration options that should be used when 41 | | passwords are hashed using the Argon algorithm. These will allow you 42 | | to control the amount of time it takes to hash the given password. 43 | | 44 | */ 45 | 46 | 'argon' => [ 47 | 'memory' => 1024, 48 | 'threads' => 2, 49 | 'time' => 2, 50 | ], 51 | 52 | ]; 53 | -------------------------------------------------------------------------------- /app/Repositories/ResponseRepository.php: -------------------------------------------------------------------------------- 1 | random($question); 13 | } else { 14 | if ($question->status != 'open') { 15 | // While admins prepare default tags, it is important to navigate randomly without the priority ranking 16 | // Non admin users also should be able to navigate through the whole set (and not just top priority) 17 | $response = $this->untagged($question, $user)->inRandomOrder()->first(); 18 | } else { 19 | // Don't show the user a response he skipped before (to avoid recurring loops) 20 | $response = $this->untagged($question, $user) 21 | ->whereDoesntHave('skips', function ($query) use ($user) { 22 | $query->where('user_id', $user->id); 23 | }) 24 | ->orderByRaw('priority DESC, RANDOM()') 25 | ->first(); 26 | } 27 | if ($response == null) { 28 | return $this->random($question); 29 | } else { 30 | return $response; 31 | } 32 | } 33 | } 34 | 35 | public function random(Question $question) 36 | { 37 | return $question->responses()->inRandomOrder()->first(); 38 | } 39 | 40 | private function untagged(Question $question, $user) 41 | { 42 | return $question->responses()->whereDoesntHave('actions', function ($query) use ($user) { 43 | return $query->where('user_id', '=', $user->id); 44 | }); 45 | } 46 | } -------------------------------------------------------------------------------- /resources/views/auth/passwords/email.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
Réinitialisation du mot de passe
6 | 7 |
8 | @if (session('status')) 9 | 12 | @endif 13 | 14 |
15 | @csrf 16 | 17 |
18 | 19 | 20 |
21 | 24 | 25 | @if ($errors->has('email')) 26 | 27 | {{ $errors->first('email') }} 28 | 29 | @endif 30 |
31 |
32 | 33 |
34 |
35 | 38 |
39 |
40 |
41 |
42 |
43 | @endsection 44 | -------------------------------------------------------------------------------- /public/svg/banner.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | grandeannotation.fr 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /bootstrap/app.php: -------------------------------------------------------------------------------- 1 | singleton( 30 | Illuminate\Contracts\Http\Kernel::class, 31 | App\Http\Kernel::class 32 | ); 33 | 34 | $app->singleton( 35 | Illuminate\Contracts\Console\Kernel::class, 36 | App\Console\Kernel::class 37 | ); 38 | 39 | $app->singleton( 40 | Illuminate\Contracts\Debug\ExceptionHandler::class, 41 | App\Exceptions\Handler::class 42 | ); 43 | 44 | /* 45 | |-------------------------------------------------------------------------- 46 | | Return The Application 47 | |-------------------------------------------------------------------------- 48 | | 49 | | This script returns the application instance. The instance is given to 50 | | the calling script so we can separate the building of the instances 51 | | from the actual running of the application and sending responses. 52 | | 53 | */ 54 | 55 | return $app; 56 | -------------------------------------------------------------------------------- /resources/js/components/ToggleButton.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 26 | 27 | -------------------------------------------------------------------------------- /resources/js/components/Samples.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 41 | 42 | 58 | -------------------------------------------------------------------------------- /config/broadcasting.php: -------------------------------------------------------------------------------- 1 | env('BROADCAST_DRIVER', 'null'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Broadcast Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the broadcast connections that will be used 26 | | to broadcast events to other systems or over websockets. Samples of 27 | | each available type of connection are provided inside this array. 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'pusher' => [ 34 | 'driver' => 'pusher', 35 | 'key' => env('PUSHER_APP_KEY'), 36 | 'secret' => env('PUSHER_APP_SECRET'), 37 | 'app_id' => env('PUSHER_APP_ID'), 38 | 'options' => [ 39 | 'cluster' => env('PUSHER_APP_CLUSTER'), 40 | 'useTLS' => true, 41 | ], 42 | ], 43 | 44 | 'redis' => [ 45 | 'driver' => 'redis', 46 | 'connection' => 'default', 47 | ], 48 | 49 | 'log' => [ 50 | 'driver' => 'log', 51 | ], 52 | 53 | 'null' => [ 54 | 'driver' => 'null', 55 | ], 56 | 57 | ], 58 | 59 | ]; 60 | -------------------------------------------------------------------------------- /resources/views/book.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.visitor') 2 | 3 | @section('jumbo') 4 |
5 | Les contributions libres au grand débat 6 |
7 |

8 | 9 | Plus de 5 millions de textes ont été rédigés en réponse aux questions ouvertes. 10 |

11 |

12 | Ensemble, sur grandeannotation.fr, nous en avons déjà annoté {{ number_format($done_count, 0, ',', ' ') }}. 13 |

14 |

15 | Chacun a été lu et interprété plusieurs fois. À votre tour, lisez-en ci-dessous. 16 |

17 | @endsection 18 | 19 | @section('center') 20 |
21 | 22 |
23 | @endsection 24 | 25 | @section('bottom') 26 |

27 | Vous comprenez un texte bien mieux que n'importe quelle IA ! 28 | Vous souhaitez contribuer et nous aider à construire 29 | une synthèse collective, transparente et fondée sur l'intelligence humaine ? 30 | Il vous suffit de continuer à lire les textes en cochant les idées clefs associées. 31 | En 10 minutes par jour, vous faciliterez les analyses futures de chercheurs, journalistes 32 | ou d'autres citoyens ! 33 |

34 |
35 | 36 | Créer mon compte 37 | 38 |
39 |
40 |
41 | @endsection 42 | -------------------------------------------------------------------------------- /artisan: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | make(Illuminate\Contracts\Console\Kernel::class); 34 | 35 | $status = $kernel->handle( 36 | $input = new Symfony\Component\Console\Input\ArgvInput, 37 | new Symfony\Component\Console\Output\ConsoleOutput 38 | ); 39 | 40 | /* 41 | |-------------------------------------------------------------------------- 42 | | Shutdown The Application 43 | |-------------------------------------------------------------------------- 44 | | 45 | | Once Artisan has finished running, we will fire off the shutdown events 46 | | so that any final work may be done by the application before we shut 47 | | down the process. This is the last thing to happen to the request. 48 | | 49 | */ 50 | 51 | $kernel->terminate($input, $status); 52 | 53 | exit($status); 54 | -------------------------------------------------------------------------------- /app/Http/Controllers/Api/TagController.php: -------------------------------------------------------------------------------- 1 | input('name'); 18 | $question_id = $request->input('question_id'); 19 | $question = Question::find($question_id); 20 | $user = $request->user(); 21 | $tag = ['id' => null]; 22 | if ($question != null) { 23 | $createdTag = $this->doCreate($user, $question, $name); 24 | if ($createdTag != null) { 25 | $tag = $createdTag->toArray(); 26 | } 27 | } 28 | return response()->json($tag); 29 | } 30 | 31 | public function doCreate(User $user, Question $question, $name) 32 | { 33 | $this->authorize('create', [Tag::class, $question]); 34 | $escaped = DB::connection()->getPdo()->quote($name); 35 | $exists = Tag::where('question_id', $question->id) 36 | ->whereRaw("lower(unaccent(name)) = lower(unaccent($escaped))") 37 | ->where(function ($query) use ($user) { 38 | $query->whereNull('user_id') 39 | ->orWhere('user_id', $user->id); 40 | }) 41 | ->exists(); 42 | if (!$exists && strlen($name) >= 2) { 43 | $tag = new Tag(); 44 | $tag->question_id = $question->id; 45 | $tag->name = $name; 46 | if ($user->role != 'admin' || $question->status == 'open') { 47 | $tag->user_id = $user->id; 48 | } 49 | $tag->save(); 50 | return $tag; 51 | } else { 52 | return null; 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fm89/grande-annotation", 3 | "type": "project", 4 | "description": "An open collaborative annotation platform for the 2019 French national debate", 5 | "license": "GNU Affero General Public License v3.0", 6 | "require": { 7 | "php": "^7.2.5", 8 | "ext-zip": "^1.13", 9 | "doctrine/dbal": "^2.10", 10 | "fideloper/proxy": "^4.3", 11 | "graham-campbell/markdown": "^12.0", 12 | "laravel/framework": "^7.9", 13 | "laravel/ui": "^2.0", 14 | "laravelcollective/html": "^6.1", 15 | "owen-it/laravel-auditing": "^10.0" 16 | }, 17 | "require-dev": { 18 | "facade/ignition": "^2.0", 19 | "fzaninotto/faker": "^1.9", 20 | "mockery/mockery": "^1.3", 21 | "nunomaduro/collision": "^4.2", 22 | "phpunit/phpunit": "^9.1" 23 | }, 24 | "config": { 25 | "optimize-autoloader": true, 26 | "preferred-install": "dist", 27 | "sort-packages": true 28 | }, 29 | "extra": { 30 | "laravel": { 31 | "dont-discover": [] 32 | } 33 | }, 34 | "autoload": { 35 | "psr-4": { 36 | "App\\": "app/" 37 | }, 38 | "classmap": [ 39 | "database/seeds", 40 | "database/factories" 41 | ] 42 | }, 43 | "autoload-dev": { 44 | "psr-4": { 45 | "Tests\\": "tests/" 46 | } 47 | }, 48 | "minimum-stability": "dev", 49 | "prefer-stable": true, 50 | "scripts": { 51 | "post-autoload-dump": [ 52 | "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", 53 | "@php artisan package:discover --ansi" 54 | ], 55 | "post-root-package-install": [ 56 | "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" 57 | ], 58 | "post-create-project-cmd": [ 59 | "@php artisan key:generate --ansi" 60 | ] 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /app/Console/Commands/RefreshPriorityQuestions.php: -------------------------------------------------------------------------------- 1 | select('responses.question_id', DB::raw('COUNT(DISTINCT (responses.clean_value_group_id)) AS counts')) 46 | ->where('responses.priority', '<', 0) 47 | ->groupBy('responses.question_id') 48 | ->pluck('counts', 'responses.question_id'); 49 | $totals = Response::select('responses.question_id', DB::raw('COUNT(DISTINCT (responses.clean_value_group_id)) AS counts')) 50 | ->groupBy('responses.question_id') 51 | ->pluck('counts', 'responses.question_id'); 52 | foreach ($totals as $question_id => $q_total) { 53 | $q_finished = $finished[$question_id] ?? 0; 54 | $question = Question::find($question_id); 55 | $question->priority = 1000 - ceil(1000.0 * $q_finished / $q_total); 56 | $question->save(); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /app/Logic/Levels.php: -------------------------------------------------------------------------------- 1 | = $level[0]) { 13 | $result = $level; 14 | } 15 | } 16 | return $result; 17 | } 18 | 19 | public static function levels() 20 | { 21 | return [ 22 | [0, 'info', 'Piou Piou'], 23 | [10, 'info', 'Ourson'], 24 | [25, 'info', 'Flocon'], 25 | [50, 'primary', 'Première étoile'], 26 | [100, 'primary', 'Deuxième étoile'], 27 | [250, 'primary', 'Troisième étoile'], 28 | [400, 'success', 'Etoile de bronze'], 29 | [700, 'success', 'Etoile d\'argent'], 30 | [1000, 'success', 'Etoile d\'or'], 31 | [1500, 'success', 'Fléchette'], 32 | [2000, 'warning', 'Flèche de bronze'], 33 | [3000, 'warning', 'Flèche d\'argent'], 34 | [4000, 'warning', 'Flèche de vermeil'], 35 | [5000, 'warning', 'Flèche d\'or'], 36 | [6000, 'danger', 'Cabri'], 37 | [7000, 'danger', 'Chamois de bronze'], 38 | [8000, 'danger', 'Chamois d\'argent'], 39 | [9000, 'danger', 'Chamois de vermeil'], 40 | [10000, 'danger', 'Chamois d\'or'], 41 | [12000, 'dark', 'Fusée de bronze'], 42 | [14000, 'dark', 'Fusée d\'argent'], 43 | [17000, 'dark', 'Fusée de vermeil'], 44 | [20000, 'dark', 'Fusée d\'or'], 45 | [25000, 'dark', 'Record'], 46 | ]; 47 | } 48 | 49 | public static function todoForNextLevel($score) 50 | { 51 | $levels = self::levels(); 52 | foreach ($levels as $level) { 53 | if ($score < $level[0]) { 54 | return $level[0] - $score; 55 | } 56 | } 57 | return 0; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | mapApiRoutes(); 46 | 47 | $this->mapWebRoutes(); 48 | 49 | // 50 | } 51 | 52 | /** 53 | * Define the "web" routes for the application. 54 | * 55 | * These routes all receive session state, CSRF protection, etc. 56 | * 57 | * @return void 58 | */ 59 | protected function mapWebRoutes() 60 | { 61 | Route::middleware('web') 62 | ->namespace($this->namespace) 63 | ->group(base_path('routes/web.php')); 64 | } 65 | 66 | /** 67 | * Define the "api" routes for the application. 68 | * 69 | * These routes are typically stateless. 70 | * 71 | * @return void 72 | */ 73 | protected function mapApiRoutes() 74 | { 75 | Route::prefix('api') 76 | ->middleware('api') 77 | ->namespace($this->namespace) 78 | ->group(base_path('routes/api.php')); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /app/Console/Commands/RefreshPriorityResponses.php: -------------------------------------------------------------------------------- 1 | info("\n\nHandling question " . $question->id); 46 | $this->handleQuestion($question); 47 | } 48 | } 49 | 50 | private function handleQuestion(Question $question) 51 | { 52 | $responses = Response::where('question_id', $question->id)->whereHas('actions')->get(); 53 | $this->info('Preparing to process ' . count($responses) . ' responses'); 54 | $bar = $this->output->createProgressBar(count($responses)); 55 | $bar->start(); 56 | foreach ($responses as $response) { 57 | $priority = Priority::getFor($response); 58 | if ($priority != $response->$priority) { 59 | // Don't issue an UPDATE query if not necessary 60 | $response->priority = $priority; 61 | $response->save(); 62 | } 63 | $bar->advance(); 64 | } 65 | $bar->finish(); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /database/migrations/2019_01_28_202750_create_debates_tables.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string('name'); 19 | }); 20 | Schema::create('questions', function (Blueprint $table) { 21 | $table->increments('id'); 22 | $table->text('text'); 23 | $table->integer('debate_id'); 24 | $table->foreign('debate_id')->references('id')->on('debates'); 25 | $table->boolean('is_free'); 26 | }); 27 | Schema::create('proposals', function (Blueprint $table) { 28 | $table->increments('id'); 29 | $table->dateTime('published_at'); 30 | $table->text('title'); 31 | $table->integer('debate_id'); 32 | $table->foreign('debate_id')->references('id')->on('debates'); 33 | $table->string('author_id'); 34 | }); 35 | Schema::create('responses', function (Blueprint $table) { 36 | $table->increments('id'); 37 | $table->text('value'); 38 | $table->integer('question_id'); 39 | $table->foreign('question_id')->references('id')->on('questions'); 40 | $table->integer('proposal_id'); 41 | $table->foreign('proposal_id')->references('id')->on('proposals'); 42 | }); 43 | } 44 | 45 | /** 46 | * Reverse the migrations. 47 | * 48 | * @return void 49 | */ 50 | public function down() 51 | { 52 | Schema::dropIfExists('responses'); 53 | Schema::dropIfExists('proposals'); 54 | Schema::dropIfExists('questions'); 55 | Schema::dropIfExists('debates'); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /resources/views/levels.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 | À propos des badges 7 |
8 |
9 | Les badges pour permettent de visualiser votre progression d'une manière ludique. Ils vous sont attribués 10 | au fur et à mesure que vous annotez des réponses. 11 | @auth 12 | Actuellement, vous êtes {{ $level[2] }} 13 | car vous avez annoté {{ $user->scores['total'] . ($user->scores['total'] > 1 ? ' textes' : ' texte') }}. 14 | Pour continuer à progresser, c'est par ici. 15 | @else 16 | Créez un compte ou connectez-vous pour commencer à gravir 17 | les échelons. 18 | @endauth 19 |

20 | 21 | 22 | @for ($i = 0; $i < count($levels); $i++) 23 | 24 | 33 | 36 | @auth 37 | 38 | @endauth 39 | 40 | @endfor 41 | 42 |
25 |   26 | {{ $levels[$i][0] }} 27 | @if ($i == count($levels) - 1) 28 | + 29 | @else 30 | → {{ $levels[$i+1][0] - 1 }} 31 | @endif 32 | 34 | {{ $levels[$i][2] }} 35 | @if ($levels[$i][2] == $level[2]) Votre badge actuel @endif
43 |
44 |
45 | @endsection 46 | -------------------------------------------------------------------------------- /resources/views/tags/delete.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 | Suppression d'une catégorie pour la question {{ $question->text }} 7 |
8 |
9 | @if ($tag->actions()->exists()) 10 |
11 | Attention ! Vous allez supprimer une catégorie que vous avez déjà affectée à des 12 | contributions. Cette catégorie sera retirée des annotations que vous avez réalisées en l'utilisant. 13 | Il se peut que votre score baisse un peu suite à cette manipulation ; mais ça n'est pas très grave ! 14 | En supprimant d'anciennes catégories que vous ne souhaitez plus utiliser, vous simplifiez votre 15 | interface et cela vous permet d'aller plus vite dans le processus d'annotation. 16 |
17 | @else 18 |
19 | Vous allez supprimer une catégorie que vous n'avez pas encore utilisée. C'est absolument sans 20 | risque, vous pouvez y aller ! 21 |
22 | @endif 23 | {!! Form::open(['url' => 'tags/' . $tag->id, 'method' => 'delete']) !!} 24 |
25 | 26 | 27 |
28 | 31 | 32 | Annuler 33 | 34 | {!! Form::close() !!} 35 |
36 |
37 | @include('layouts.back_tags') 38 | @endsection 39 | -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | 10 | define('LARAVEL_START', microtime(true)); 11 | 12 | /* 13 | |-------------------------------------------------------------------------- 14 | | Register The Auto Loader 15 | |-------------------------------------------------------------------------- 16 | | 17 | | Composer provides a convenient, automatically generated class loader for 18 | | our application. We just need to utilize it! We'll simply require it 19 | | into the script here so that we don't have to worry about manual 20 | | loading any of our classes later on. It feels great to relax. 21 | | 22 | */ 23 | 24 | require __DIR__.'/../vendor/autoload.php'; 25 | 26 | /* 27 | |-------------------------------------------------------------------------- 28 | | Turn On The Lights 29 | |-------------------------------------------------------------------------- 30 | | 31 | | We need to illuminate PHP development, so let us turn on the lights. 32 | | This bootstraps the framework and gets it ready for use, then it 33 | | will load up this application so that we can run it and send 34 | | the responses back to the browser and delight our users. 35 | | 36 | */ 37 | 38 | $app = require_once __DIR__.'/../bootstrap/app.php'; 39 | 40 | /* 41 | |-------------------------------------------------------------------------- 42 | | Run The Application 43 | |-------------------------------------------------------------------------- 44 | | 45 | | Once we have the application, we can handle the incoming request 46 | | through the kernel, and send the associated response back to 47 | | the client's browser allowing them to enjoy the creative 48 | | and wonderful application we have prepared for them. 49 | | 50 | */ 51 | 52 | $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class); 53 | 54 | $response = $kernel->handle( 55 | $request = Illuminate\Http\Request::capture() 56 | ); 57 | 58 | $response->send(); 59 | 60 | $kernel->terminate($request, $response); 61 | -------------------------------------------------------------------------------- /app/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | command('command:dump_actions')->dailyAt('03:05'); 40 | $schedule->command('command:dump_results')->dailyAt('03:15'); 41 | $schedule->command('command:dump_texts')->dailyAt('03:25'); 42 | // Only the master virtual machine runs database update tasks. 43 | // (There is no need for the other virtual machines to run the same tasks, and it could be risky.) 44 | if (config('app.is_master_server')) { 45 | $schedule->command('command:compute_results')->dailyAt('02:05'); 46 | $schedule->command('command:cache_scores')->dailyAt('02:35'); 47 | $schedule->command('command:refresh_priority_questions')->hourly(); 48 | } 49 | } 50 | 51 | /** 52 | * Register the commands for the application. 53 | * 54 | * @return void 55 | */ 56 | protected function commands() 57 | { 58 | $this->load(__DIR__.'/Commands'); 59 | 60 | require base_path('routes/console.php'); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /app/Http/Controllers/MyOverviewController.php: -------------------------------------------------------------------------------- 1 | user(); 17 | $ongoing = []; 18 | $done = []; 19 | if ($user != null) { 20 | $counts = Action::join('responses', 'responses.id', 'actions.response_id') 21 | ->select('question_id', DB::raw('COUNT(DISTINCT clean_value_group_id) AS count')) 22 | ->where('actions.user_id', $user->id) 23 | ->groupBy('question_id') 24 | ->pluck('count', 'question_id') 25 | ->all(); 26 | foreach ($counts as $question_id => $count) { 27 | $question = Question::find($question_id); 28 | if ($question->status == 'open') { 29 | if ($count < 300) { 30 | $ongoing[] = [ 31 | 'question' => $question, 32 | 'count' => $count, 33 | 'rank' => $question->debate_id * 1000 + $question->order, 34 | ]; 35 | } else { 36 | $done[] = [ 37 | 'question' => $question, 38 | 'count' => $count, 39 | 'stats' => Stats::getForUserQuestion($user, $question), 40 | 'rank' => $question->debate_id * 1000 + $question->order, 41 | ]; 42 | } 43 | } 44 | } 45 | $ongoing = collect($ongoing)->sort(function ($a, $b) { return $a['rank'] < $b['rank'] ? -1 : (($a['rank'] == $b['rank']) ? 0 : 1); })->toArray(); 46 | $done = collect($done)->sort(function ($a, $b) { return $a['rank'] < $b['rank'] ? -1 : (($a['rank'] == $b['rank']) ? 0 : 1); })->toArray(); 47 | } 48 | return view('users.my-overview', compact('done', 'ongoing', 'user')); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /app/Logic/Weights.php: -------------------------------------------------------------------------------- 1 | select('proposals.author_id', DB::raw('COUNT(*) AS counts')) 18 | ->where('responses.question_id', $question->id) 19 | ->groupBy('proposals.author_id') 20 | ->pluck('counts', 'author_id'); 21 | } 22 | 23 | public static function getP2ByGroupId($question) 24 | { 25 | $countAllByGroup = Response::select('clean_value_group_id', DB::raw('COUNT(*) AS counts')) 26 | ->groupBy('clean_value_group_id') 27 | ->where('question_id', $question->id) 28 | ->pluck('counts', 'clean_value_group_id'); 29 | $countWithActionsByGroup = Response::select('clean_value_group_id', DB::raw('COUNT(*) AS counts')) 30 | ->groupBy('clean_value_group_id') 31 | ->where('question_id', $question->id) 32 | ->whereHas('actions') 33 | ->pluck('counts', 'clean_value_group_id'); 34 | $totalResponses = $question->responses()->count(); 35 | $singleResponses = self::countOnes($countAllByGroup); 36 | $singleResponsesWithActions = self::countOnes($countWithActionsByGroup); 37 | if ($singleResponsesWithActions < $singleResponses) { 38 | # See doc/MATH.md 39 | $draws = log(1 - $singleResponsesWithActions / $singleResponses) / log(1 - 1 / $singleResponses) * $totalResponses / $singleResponses; 40 | } else { 41 | # Infinite number of draws 42 | $draws = -1; 43 | } 44 | $weights = []; 45 | foreach ($countWithActionsByGroup as $group_id => $count) { 46 | # See doc/MATH.md 47 | $weights[$group_id] = $draws <= 0 ? 1.0 : 1.0 / (1.0 - pow(1 - $count / $totalResponses, $draws)); 48 | } 49 | return $weights; 50 | } 51 | 52 | private static function countOnes($array) 53 | { 54 | $result = 0; 55 | foreach ($array as $key => $value) { 56 | if ($value === 1) { 57 | $result += 1; 58 | } 59 | } 60 | return $result; 61 | } 62 | } -------------------------------------------------------------------------------- /config/filesystems.php: -------------------------------------------------------------------------------- 1 | env('FILESYSTEM_DRIVER', 'local'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Default Cloud Filesystem Disk 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Many applications store files both locally and in the cloud. For this 24 | | reason, you may specify a default "cloud" driver here. This driver 25 | | will be bound as the Cloud disk implementation in the container. 26 | | 27 | */ 28 | 29 | 'cloud' => env('FILESYSTEM_CLOUD', 's3'), 30 | 31 | /* 32 | |-------------------------------------------------------------------------- 33 | | Filesystem Disks 34 | |-------------------------------------------------------------------------- 35 | | 36 | | Here you may configure as many filesystem "disks" as you wish, and you 37 | | may even configure multiple disks of the same driver. Defaults have 38 | | been setup for each driver as an example of the required options. 39 | | 40 | | Supported Drivers: "local", "ftp", "sftp", "s3", "rackspace" 41 | | 42 | */ 43 | 44 | 'disks' => [ 45 | 46 | 'local' => [ 47 | 'driver' => 'local', 48 | 'root' => storage_path('app'), 49 | ], 50 | 51 | 'public' => [ 52 | 'driver' => 'local', 53 | 'root' => storage_path('app/public'), 54 | 'url' => env('APP_URL').'/storage', 55 | 'visibility' => 'public', 56 | ], 57 | 58 | 's3' => [ 59 | 'driver' => 's3', 60 | 'key' => env('AWS_ACCESS_KEY_ID'), 61 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 62 | 'region' => env('AWS_DEFAULT_REGION'), 63 | 'bucket' => env('AWS_BUCKET'), 64 | 'url' => env('AWS_URL'), 65 | ], 66 | 67 | ], 68 | 69 | ]; 70 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/RegisterController.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 42 | } 43 | 44 | /** 45 | * Get a validator for an incoming registration request. 46 | * 47 | * @param array $data 48 | * @return \Illuminate\Contracts\Validation\Validator 49 | */ 50 | protected function validator(array $data) 51 | { 52 | return Validator::make($data, [ 53 | 'name' => ['required', 'string', 'max:255'], 54 | 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 55 | 'password' => ['required', 'string', 'min:8', 'confirmed'], 56 | ]); 57 | } 58 | 59 | /** 60 | * Create a new user instance after a valid registration. 61 | * 62 | * @param array $data 63 | * @return \App\User 64 | */ 65 | protected function create(array $data) 66 | { 67 | return User::create([ 68 | 'name' => $data['name'], 69 | 'email' => $data['email'], 70 | 'password' => Hash::make($data['password']), 71 | ]); 72 | } 73 | 74 | public function showRegistrationForm(Request $request) 75 | { 76 | $demo = $request->has('demo'); 77 | return view('auth.register', compact('demo')); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /app/Logic/Priority.php: -------------------------------------------------------------------------------- 1 | actions; 13 | $users_count = $actions->map(function ($action) { return $action->user_id; })->unique()->count(); 14 | if ($users_count >= 5) { 15 | // Stop tagging if 5 users have given their opinion (whether they agree or not) 16 | $priority = self::oneTagPresent($actions, $users_count) ? -5 : -1; 17 | } elseif ($users_count < 3) { 18 | // Continue tagging if only 1 or 2 users have given their opinion 19 | $priority = 5; 20 | if ($users_count == 1 && $response->question_id == 165) { 21 | $priority = 4; 22 | } 23 | } else { 24 | // If 3 to 4 users have given their opinion, continue tagging if we have not settled all tags 25 | $priority = (self::allTagsSettled($actions, $users_count) && self::oneTagPresent($actions, $users_count)) ? -10 : 5; 26 | } 27 | return $priority; 28 | } 29 | 30 | private static function allTagsSettled($actions, $users_count) 31 | { 32 | // We say that a tag is "settled" if there is a majority of users by a margin of at least 2 who agree that the 33 | // tag is (or is not) associated with the given text. 34 | $tags = $actions->map(function ($action) { return $action->tag_id; })->unique()->all(); 35 | foreach ($tags as $tag) { 36 | $users_agree = $actions->filter(function ($action) use ($tag) { return $action->tag_id == $tag; })->count(); 37 | $users_disagree = $users_count - $users_agree; 38 | if (abs($users_agree - $users_disagree) < 2) { 39 | return false; 40 | } 41 | } 42 | return true; 43 | } 44 | 45 | private static function oneTagPresent($actions, $users_count) 46 | { 47 | // We say that a tag is "present" if a majority of users agree with it being associated to the given text. 48 | $tags = $actions->map(function ($action) { return $action->tag_id; })->unique()->all(); 49 | foreach ($tags as $tag) { 50 | $users_agree = $actions->filter(function ($action) use ($tag) { return $action->tag_id == $tag; })->count(); 51 | $users_disagree = $users_count - $users_agree; 52 | if ($users_agree > $users_disagree) { 53 | return true; 54 | } 55 | } 56 | return false; 57 | } 58 | } -------------------------------------------------------------------------------- /app/Http/Kernel.php: -------------------------------------------------------------------------------- 1 | [ 31 | \App\Http\Middleware\EncryptCookies::class, 32 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, 33 | \Illuminate\Session\Middleware\StartSession::class, 34 | // \Illuminate\Session\Middleware\AuthenticateSession::class, 35 | \Illuminate\View\Middleware\ShareErrorsFromSession::class, 36 | \App\Http\Middleware\VerifyCsrfToken::class, 37 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 38 | ], 39 | 40 | 'api' => [ 41 | 'throttle:60,1', 42 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 43 | ], 44 | ]; 45 | 46 | /** 47 | * The application's route middleware. 48 | * 49 | * These middleware may be assigned to groups or used individually. 50 | * 51 | * @var array 52 | */ 53 | protected $routeMiddleware = [ 54 | 'auth' => \App\Http\Middleware\Authenticate::class, 55 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 56 | 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, 57 | 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 58 | 'can' => \Illuminate\Auth\Middleware\Authorize::class, 59 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 60 | 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, 61 | 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, 62 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 63 | 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 64 | ]; 65 | } 66 | -------------------------------------------------------------------------------- /resources/js/components/Sample.vue: -------------------------------------------------------------------------------- 1 | 27 | 28 | 75 | -------------------------------------------------------------------------------- /app/Console/Commands/PrintStats.php: -------------------------------------------------------------------------------- 1 | get(); 44 | foreach ($debates as $debate) { 45 | $questions = $debate->questions()->where('status', 'open')->orderBy('order')->get(); 46 | foreach ($questions as $question) { 47 | $this->handleQuestion($question); 48 | } 49 | } 50 | } 51 | 52 | private function handleQuestion($question) 53 | { 54 | $countAllByGroup = Response::select('clean_value_group_id', DB::raw('COUNT(*) AS counts')) 55 | ->groupBy('clean_value_group_id') 56 | ->where('question_id', $question->id) 57 | ->pluck('counts', 'clean_value_group_id'); 58 | $countWithActionsByGroup = Response::select('clean_value_group_id', DB::raw('COUNT(*) AS counts')) 59 | ->groupBy('clean_value_group_id') 60 | ->where('question_id', $question->id) 61 | ->whereHas('actions') 62 | ->pluck('counts', 'clean_value_group_id'); 63 | $totalResponses = $question->responses()->count(); 64 | $singleResponses = self::countOnes($countAllByGroup); 65 | $singleResponsesWithActions = self::countOnes($countWithActionsByGroup); 66 | if ($singleResponsesWithActions < $singleResponses) { 67 | # See doc/MATH.md 68 | $draws = log(1 - $singleResponsesWithActions / $singleResponses) / log(1 - 1 / $singleResponses) * $totalResponses / $singleResponses; 69 | } else { 70 | # Infinite number of draws 71 | $draws = -1; 72 | } 73 | $this->info($question->id . ';' . $draws); 74 | } 75 | 76 | private static function countOnes($array) 77 | { 78 | $result = 0; 79 | foreach ($array as $key => $value) { 80 | if ($value === 1) { 81 | $result += 1; 82 | } 83 | } 84 | return $result; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /app/Console/Commands/DumpTexts.php: -------------------------------------------------------------------------------- 1 | generateCsvDump($fileName); 44 | $this->generateArchive($fileName); 45 | } 46 | 47 | private function generateCsvDump($fileName) 48 | { 49 | $handle = fopen($fileName . '.csv', 'w'); 50 | fputcsv($handle, ["Debat", "Question", "Annotateur", "Texte"]); 51 | $debates = Debate::orderBy('id')->get(); 52 | foreach ($debates as $debate) { 53 | $questions = $debate->questions()->where('status', 'open')->orderBy('order')->get(); 54 | foreach ($questions as $question) { 55 | $this->info('Processing question #' . $question->id); 56 | $this->dumpQuestion($question, $handle); 57 | } 58 | } 59 | fclose($handle); 60 | } 61 | 62 | private function dumpQuestion($question, $handle) 63 | { 64 | $debate_id = $question->debate->id; 65 | $question_id = $question->id; 66 | DB::table('texts') 67 | ->where('question_id', $question->id) 68 | ->orderBy('user_id') 69 | ->chunk(10000, function ($actions) use ($handle, $debate_id, $question_id) { 70 | foreach ($actions as $fields) { 71 | fputcsv($handle, 72 | [ 73 | $debate_id, 74 | $question_id, 75 | $fields->user_id, 76 | $fields->content, 77 | ]); 78 | } 79 | }); 80 | } 81 | 82 | private function generateArchive($fileName) 83 | { 84 | $zip = new \ZipArchive(); 85 | $zip->open($fileName . '.zip', \ZipArchive::CREATE); 86 | $zip->addFile('public/resources/LICENSE.txt', 'LICENSE.txt'); 87 | $zip->addFile($fileName . '.csv', 'texts.csv'); 88 | $zip->close(); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /config/queue.php: -------------------------------------------------------------------------------- 1 | env('QUEUE_CONNECTION', 'sync'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Queue Connections 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure the connection information for each server that 24 | | is used by your application. A default configuration has been added 25 | | for each back-end shipped with Laravel. You are free to add more. 26 | | 27 | | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'sync' => [ 34 | 'driver' => 'sync', 35 | ], 36 | 37 | 'database' => [ 38 | 'driver' => 'database', 39 | 'table' => 'jobs', 40 | 'queue' => 'default', 41 | 'retry_after' => 90, 42 | ], 43 | 44 | 'beanstalkd' => [ 45 | 'driver' => 'beanstalkd', 46 | 'host' => 'localhost', 47 | 'queue' => 'default', 48 | 'retry_after' => 90, 49 | ], 50 | 51 | 'sqs' => [ 52 | 'driver' => 'sqs', 53 | 'key' => env('SQS_KEY', 'your-public-key'), 54 | 'secret' => env('SQS_SECRET', 'your-secret-key'), 55 | 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), 56 | 'queue' => env('SQS_QUEUE', 'your-queue-name'), 57 | 'region' => env('SQS_REGION', 'us-east-1'), 58 | ], 59 | 60 | 'redis' => [ 61 | 'driver' => 'redis', 62 | 'connection' => 'default', 63 | 'queue' => env('REDIS_QUEUE', 'default'), 64 | 'retry_after' => 90, 65 | 'block_for' => null, 66 | ], 67 | 68 | ], 69 | 70 | /* 71 | |-------------------------------------------------------------------------- 72 | | Failed Queue Jobs 73 | |-------------------------------------------------------------------------- 74 | | 75 | | These options configure the behavior of failed queue job logging so you 76 | | can control which database and table are used to store the jobs that 77 | | have failed. You may change them to any database / table you wish. 78 | | 79 | */ 80 | 81 | 'failed' => [ 82 | 'database' => env('DB_CONNECTION', 'mysql'), 83 | 'table' => 'failed_jobs', 84 | ], 85 | 86 | ]; 87 | -------------------------------------------------------------------------------- /resources/views/auth/passwords/reset.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
Réinitialisation du mot de passe
6 | 7 |
8 |
9 | @csrf 10 | 11 | 12 | 13 |
14 | 15 | 16 |
17 | 20 | 21 | @if ($errors->has('email')) 22 | 23 | {{ $errors->first('email') }} 24 | 25 | @endif 26 |
27 |
28 | 29 |
30 | 31 | 32 |
33 | 36 | 37 | @if ($errors->has('password')) 38 | 39 | {{ $errors->first('password') }} 40 | 41 | @endif 42 |
43 |
44 | 45 |
46 | 48 | 49 |
50 | 52 |
53 |
54 | 55 |
56 |
57 | 60 |
61 |
62 |
63 |
64 |
65 | @endsection 66 | -------------------------------------------------------------------------------- /resources/views/layouts/visitor.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Grande Annotation 7 | 8 | 9 | @yield('scripts') 10 | 11 | 69 | 70 | 71 | 72 | @include('layouts.navbar') 73 | 74 |
75 |
76 |
77 |
78 |
79 | @yield('jumbo') 80 |
81 |
82 |
83 |
84 |
85 | 86 | 87 |
88 |
89 |
90 | @yield('center') 91 |
92 |
93 |
94 | 95 | 96 |
97 |
98 |
99 | @yield('bottom') 100 |
101 |
102 |
103 | 104 | @include('layouts.footer') 105 | 106 | 107 | -------------------------------------------------------------------------------- /config/logging.php: -------------------------------------------------------------------------------- 1 | env('LOG_CHANNEL', 'stack'), 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Log Channels 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Here you may configure the log channels for your application. Out of 27 | | the box, Laravel uses the Monolog PHP logging library. This gives 28 | | you a variety of powerful log handlers / formatters to utilize. 29 | | 30 | | Available Drivers: "single", "daily", "slack", "syslog", 31 | | "errorlog", "monolog", 32 | | "custom", "stack" 33 | | 34 | */ 35 | 36 | 'channels' => [ 37 | 'stack' => [ 38 | 'driver' => 'stack', 39 | 'channels' => ['daily'], 40 | 'ignore_exceptions' => false, 41 | ], 42 | 43 | 'single' => [ 44 | 'driver' => 'single', 45 | 'path' => storage_path('logs/laravel.log'), 46 | 'level' => 'debug', 47 | ], 48 | 49 | 'daily' => [ 50 | 'driver' => 'daily', 51 | 'path' => storage_path('logs/laravel.log'), 52 | 'level' => 'debug', 53 | 'days' => 14, 54 | ], 55 | 56 | 'slack' => [ 57 | 'driver' => 'slack', 58 | 'url' => env('LOG_SLACK_WEBHOOK_URL'), 59 | 'username' => 'Laravel Log', 60 | 'emoji' => ':boom:', 61 | 'level' => 'critical', 62 | ], 63 | 64 | 'papertrail' => [ 65 | 'driver' => 'monolog', 66 | 'level' => 'debug', 67 | 'handler' => SyslogUdpHandler::class, 68 | 'handler_with' => [ 69 | 'host' => env('PAPERTRAIL_URL'), 70 | 'port' => env('PAPERTRAIL_PORT'), 71 | ], 72 | ], 73 | 74 | 'stderr' => [ 75 | 'driver' => 'monolog', 76 | 'handler' => StreamHandler::class, 77 | 'formatter' => env('LOG_STDERR_FORMATTER'), 78 | 'with' => [ 79 | 'stream' => 'php://stderr', 80 | ], 81 | ], 82 | 83 | 'syslog' => [ 84 | 'driver' => 'syslog', 85 | 'level' => 'debug', 86 | ], 87 | 88 | 'errorlog' => [ 89 | 'driver' => 'errorlog', 90 | 'level' => 'debug', 91 | ], 92 | ], 93 | 94 | ]; 95 | -------------------------------------------------------------------------------- /resources/views/texts/create.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
Rédaction d'un nouveau texte
6 |
7 |
8 | Cet écran vous permet d'écrire un texte libre de synthèse sur une question pour laquelle vous avez lu 9 | beaucoup de réponses. Vous pourrez modifier ce texte par la suite en cliquant sur le petit stylo sur 10 | la page du texte. Vous ne pouvez créer qu'un seul texte par question, mais il vous est bien sûr possible 11 | de le modifier. Si vous avez beaucoup lu plusieurs questions, vous pouvez créer plusieurs textes 12 | (un texte par question). Pour mettre en forme légèrement votre texte (gras, italique, listes, titres, 13 | liens, etc.) vous pouvez utiliser la syntaxe Markdown. 14 |
15 | @if (count($options) > 0) 16 | {!! Form::open(['url' => 'texts']) !!} 17 |
18 | 19 | {{ Form::select('question', $options, null, ['class' => 'form-control', 'required' => 'required']) }} 20 |
21 |
22 | 23 | 25 |
26 | @include('texts.legal-warning') 27 | 30 | {!! Form::close() !!} 31 | @else 32 |
33 | Pour l'instant, vous ne pouvez pas saisir de texte libre pour de nouvelles questions. Pour modifier 34 | vos textes libres déjà écrits, cliquez sur le petit stylo directement sur la page du texte. Pour 35 | obtenir le droit de saisir un texte de synthèse sur une nouvelle question, vous devez lire et 36 | annoter au moins {{ \App\Policies\TextPolicy::MIN_SCORE_PER_QUESTION }} réponses à 37 | cette question. Vous pouvez suivre votre progression dans la page de chaque thème. Écrire 38 | un résumé pertinent de ce qui s'est dit sur une thématique nécessite d'avoir lu beaucoup pour 39 | prendre du recul. Bon courage ! En moyenne, il faut quelques heures de lecture et d'annotation pour 40 | arriver à ce niveau. 41 |
42 | @endif 43 |
44 |
45 | @endsection 46 | -------------------------------------------------------------------------------- /config/cache.php: -------------------------------------------------------------------------------- 1 | env('CACHE_DRIVER', 'file'), 21 | 22 | /* 23 | |-------------------------------------------------------------------------- 24 | | Cache Stores 25 | |-------------------------------------------------------------------------- 26 | | 27 | | Here you may define all of the cache "stores" for your application as 28 | | well as their drivers. You may even define multiple stores for the 29 | | same cache driver to group types of items stored in your caches. 30 | | 31 | */ 32 | 33 | 'stores' => [ 34 | 35 | 'apc' => [ 36 | 'driver' => 'apc', 37 | ], 38 | 39 | 'array' => [ 40 | 'driver' => 'array', 41 | ], 42 | 43 | 'database' => [ 44 | 'driver' => 'database', 45 | 'table' => 'cache', 46 | 'connection' => null, 47 | ], 48 | 49 | 'file' => [ 50 | 'driver' => 'file', 51 | 'path' => storage_path('framework/cache/data'), 52 | ], 53 | 54 | 'memcached' => [ 55 | 'driver' => 'memcached', 56 | 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), 57 | 'sasl' => [ 58 | env('MEMCACHED_USERNAME'), 59 | env('MEMCACHED_PASSWORD'), 60 | ], 61 | 'options' => [ 62 | // Memcached::OPT_CONNECT_TIMEOUT => 2000, 63 | ], 64 | 'servers' => [ 65 | [ 66 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'), 67 | 'port' => env('MEMCACHED_PORT', 11211), 68 | 'weight' => 100, 69 | ], 70 | ], 71 | ], 72 | 73 | 'redis' => [ 74 | 'driver' => 'redis', 75 | 'connection' => 'cache', 76 | ], 77 | 78 | ], 79 | 80 | /* 81 | |-------------------------------------------------------------------------- 82 | | Cache Key Prefix 83 | |-------------------------------------------------------------------------- 84 | | 85 | | When utilizing a RAM based store such as APC or Memcached, there might 86 | | be other applications utilizing the same cache. So, we'll specify a 87 | | value to get prefixed to all our keys so we can avoid collisions. 88 | | 89 | */ 90 | 91 | 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'), 92 | 93 | ]; 94 | -------------------------------------------------------------------------------- /resources/views/questions/show.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 | Catégorisation pour la question {{ $question->text }} 7 |
8 |
9 | 15 |
16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | @foreach ($tags as $tag) 27 | 28 | @if ($tag->isCustom()) 29 | 30 | @else 31 | 32 | @endif 33 | 34 | 47 | 48 | @endforeach 49 | 50 | 51 | 52 | 53 | 58 | 59 |
Libellé
{{ $tag->getLabel() }}{{ $tag->getLabel() }}{{ $counts[$tag->id] ?? 0 }} 35 | @can('update', $tag) 36 | 37 | @can('inject', $tag) 38 | 39 | @endcan 40 | @if ($tag->isCustom() || (($counts[$tag->id] ?? 0) == 0)) 41 | 42 | @endif 43 | @else 44 | Catégorie commune 45 | @endcan 46 |
54 | @can('create', [\App\Models\Tag::class, $question]) 55 | 56 | @endcan 57 |
60 | 61 | Accéder au module de recherche 62 | 63 |
64 |
65 | @include('layouts.back_questions') 66 | @endsection 67 | -------------------------------------------------------------------------------- /resources/views/home.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |

8 | La consultation du Grand débat national est articulée autour de quatre thèmes officiels. 9 | Chaque thème est sous-divisé en 10 à 30 questions. Certaines sont des questions fermées 10 | (à choix multiples) et donc très faciles à analyser. Nous nous concentrons donc ici sur les 11 | questions ouvertes (à texte libre) pour lesquelles la lecture est indispensable. 12 |

13 |

14 | Vous pouvez naviguer ici par thème puis par question, ou vous laisser porter au hasard. 15 | Certains thèmes ou questions ne sont pas encore ouverts à l'annotation car le travail 16 | de préparation des catégories par défaut est encore en cours. N'hésitez pas à revenir 17 | régulièrement. 18 |

19 |
20 | 26 |
27 |
28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | @foreach ($debates as $debate) 37 | 38 | 41 | 56 | 57 | @endforeach 58 | 59 |
Intitulé du thèmeÉtape
39 | {{ $debate->name }} 40 | 42 | @if ($debate->status == 'open') 43 | Ouvert aux annotations 44 | @auth 45 | {{ \Illuminate\Support\Facades\Auth::user()->scores['debates'][$debate->id] }} 46 | @endauth 47 | @else 48 | En préparation 49 | @auth 50 | @if (\Illuminate\Support\Facades\Auth::user()->role == 'admin') 51 | {{ \Illuminate\Support\Facades\Auth::user()->scores['debates'][$debate->id] }} 52 | @endif 53 | @endauth 54 | @endif 55 |
60 |
61 |
62 | @endsection 63 | -------------------------------------------------------------------------------- /resources/sass/app.scss: -------------------------------------------------------------------------------- 1 | // Variables 2 | @import 'variables'; 3 | // Bootstrap 4 | @import '~bootstrap/scss/bootstrap'; 5 | @import '~@fortawesome/fontawesome-free/css/all'; 6 | 7 | // Fonts Nunito 8 | /* nunito-regular - latin */ 9 | @font-face { 10 | font-family: 'Nunito'; 11 | font-style: normal; 12 | font-weight: 400; 13 | src: url('/fonts/nunito-v10-latin-regular.eot'); /* IE9 Compat Modes */ 14 | src: local('Nunito Regular'), local('Nunito-Regular'), 15 | url('/fonts/nunito-v10-latin-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ 16 | url('/fonts/nunito-v10-latin-regular.woff2') format('woff2'), /* Super Modern Browsers */ 17 | url('/fonts/nunito-v10-latin-regular.woff') format('woff'), /* Modern Browsers */ 18 | url('/fonts/nunito-v10-latin-regular.ttf') format('truetype'), /* Safari, Android, iOS */ 19 | url('/fonts/nunito-v10-latin-regular.svg#Nunito') format('svg'); /* Legacy iOS */ 20 | } 21 | /* nunito-italic - latin */ 22 | @font-face { 23 | font-family: 'Nunito'; 24 | font-style: italic; 25 | font-weight: 400; 26 | src: url('/fonts/nunito-v10-latin-italic.eot'); /* IE9 Compat Modes */ 27 | src: local('Nunito Italic'), local('Nunito-Italic'), 28 | url('/fonts/nunito-v10-latin-italic.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ 29 | url('/fonts/nunito-v10-latin-italic.woff2') format('woff2'), /* Super Modern Browsers */ 30 | url('/fonts/nunito-v10-latin-italic.woff') format('woff'), /* Modern Browsers */ 31 | url('/fonts/nunito-v10-latin-italic.ttf') format('truetype'), /* Safari, Android, iOS */ 32 | url('/fonts/nunito-v10-latin-italic.svg#Nunito') format('svg'); /* Legacy iOS */ 33 | } 34 | /* nunito-900 - latin */ 35 | @font-face { 36 | font-family: 'Nunito'; 37 | font-style: normal; 38 | font-weight: 900; 39 | src: url('/fonts/nunito-v10-latin-900.eot'); /* IE9 Compat Modes */ 40 | src: local('Nunito Black'), local('Nunito-Black'), 41 | url('/fonts/nunito-v10-latin-900.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ 42 | url('/fonts/nunito-v10-latin-900.woff2') format('woff2'), /* Super Modern Browsers */ 43 | url('/fonts/nunito-v10-latin-900.woff') format('woff'), /* Modern Browsers */ 44 | url('/fonts/nunito-v10-latin-900.ttf') format('truetype'), /* Safari, Android, iOS */ 45 | url('/fonts/nunito-v10-latin-900.svg#Nunito') format('svg'); /* Legacy iOS */ 46 | } 47 | 48 | html { 49 | position: relative; 50 | min-height: 100%; 51 | } 52 | 53 | .btn-soft { 54 | @include button-variant(#bddcfd, #bddcfd); 55 | } 56 | 57 | body { 58 | /* Margin bottom by footer height */ 59 | margin-bottom: 40px; 60 | } 61 | 62 | .footer { 63 | position: absolute; 64 | bottom: 0; 65 | width: 100%; 66 | height: 40px; 67 | line-height: 40px; 68 | background-color: #eaf3f9; 69 | } 70 | 71 | .navbar-laravel { 72 | background-color: #fff; 73 | box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04); 74 | } 75 | 76 | blockquote { 77 | background: #f9f9f9; 78 | border-left: 10px solid #ccc; 79 | margin: 8px 0 0 0; 80 | quotes: "\201C""\201D""\2018""\2019"; 81 | padding: 10px 14px; 82 | line-height: 1.5; 83 | } 84 | 85 | footer { 86 | margin: 0; 87 | text-align: right; 88 | font-size: 1em; 89 | font-style: italic; 90 | } 91 | 92 | h4 { 93 | color: #636b6f; 94 | font-weight: 800 !important; 95 | } -------------------------------------------------------------------------------- /resources/views/legal.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
Mentions légales
6 |
7 |

8 | GrandeAnnotation.fr est un site non commercial non professionnel édité par une personne physique. Il a pour 9 | but de permettre l'annotation collective et manuelle, par des humains, 10 | des milliers de contributions au Grand Débat National initié 11 | sur le site officiel granddebat.fr. 12 | GrandeAnnotation.fr n'est ni le site officiel, ni un site gouvernemental. 13 |

14 |

Hébergement

15 |

16 | Ce site est hébergé par OVH, SAS au capital de 10 069 020 €, RCS Lille Métropole 424 761 419 00045, dont 17 | le siège social est sis 2 rue Kellermann, 59100 Roubaix, France. 18 |

19 |

Cookies

20 |

21 | Ce site n'utilise aucun cookie lié à de la mesure d'audience, de la publicité ou des réseaux sociaux. 22 | Les seuls cookies déposés dans votre navigateurs sont ceux indispensables au fonctionnement du site et 23 | liés à l'authentification et à la gestion de votre session. 24 |

25 |

Données personnelles

26 |

27 | Lors de votre inscription, vous saisissez un pseudonyme librement et une adresse électronique. 28 | Celle-ci n'est utilisée que pour vous permettre de ré-initialiser votre mot de passe en cas de perte. 29 | Vous ne recevrez aucun autre courriel de notre part. 30 |

31 |

32 | Vous pouvez à tout moment supprimer définitivement votre compte (depuis le menu "Mon compte" de la barre 33 | de navigation en haut à droite de l'écran, puis avec le lien "Supprimer mon compte"). Votre pseudonyme 34 | et votre adresse électronique sont alors immédiatement effacés de la base de données. Vos annotations 35 | seront alors liées au pseudonyme Utilisateur supprimé. 36 |

37 |

38 | Le code source de cette plateforme est ouvert et libre. Vous pourrez y constater notre bonne foi ! 39 |

40 |

Origine des données

41 |

42 | Cette plateforme d'annotation repose sur les données du site 43 | https://granddebat.fr. Ces données ont été téléchargées dans leur 44 | version du 21 mars 2019, depuis la page 45 | https://granddebat.fr/pages/donnees-ouvertes. 46 | Ces données sont couvertes par la 47 | Licence Ouverte / Open License 48 | conçue par Etalab qui 49 | facilite et encourage la réutilisation des données publiques mises à disposition gratuitement. 50 |

51 |
52 |
53 | @endsection 54 | -------------------------------------------------------------------------------- /routes/web.php: -------------------------------------------------------------------------------- 1 | name('home'); 29 | Route::get('/proposals/{proposal}', 'ProposalController@show'); 30 | Route::get('/questions/{question}/read', 'QuestionController@read'); 31 | Route::get('/questions/{question}', 'QuestionController@show'); 32 | Route::get('/ai-limits', 'HomeController@limits'); 33 | Route::get('/book', 'HomeController@book'); 34 | Route::get('/random', 'HomeController@random'); 35 | Route::get('/tags/{tag}', 'TagController@show'); 36 | 37 | Route::get('/api/debates/{debate}', 'Api\DebateController@show'); 38 | Route::get('/api/questions/{question}/next', 'Api\ResponseController@next'); 39 | Route::get('/api/questions/{question}/tags', 'Api\QuestionController@tags'); 40 | Route::get('/api/responses/random', 'Api\ResponseController@random'); 41 | 42 | Route::group(['middleware' => ['auth']], function () { 43 | 44 | Route::resource('texts', 'TextController'); 45 | 46 | Route::get('/account', 'Auth\UserController@show'); 47 | Route::get('/account/edit', 'Auth\UserController@edit'); 48 | Route::post('/account', 'Auth\UserController@update'); 49 | Route::get('/messages', 'MessageController@index'); 50 | Route::get('/messages/{message}', 'MessageController@show'); 51 | Route::get('/quit', 'Auth\UserController@showQuit'); 52 | Route::post('/quit', 'Auth\UserController@doQuit'); 53 | Route::get('/questions/{question}/search', 'QuestionController@search'); 54 | Route::get('/questions/{question}/tags/create', 'TagController@create'); 55 | Route::post('/questions/{question}/tags', 'TagController@store'); 56 | Route::get('/tags/{tag}/edit', 'TagController@edit'); 57 | Route::get('/tags/{tag}/inject', 'TagController@showInject'); 58 | Route::post('/tags/{tag}/inject', 'TagController@doInject'); 59 | Route::post('/tags/{tag}', 'TagController@update'); 60 | Route::get('/tags/{tag}/delete', 'TagController@showDelete'); 61 | Route::delete('/tags/{tag}', 'TagController@delete'); 62 | 63 | Route::get('/api/responses', 'Api\ResponseController@search'); 64 | Route::get('/api/downloads/search/{query}', 'Api\ResponseController@downloadSearch'); 65 | Route::post('/api/responses', 'Api\ResponseController@update'); 66 | Route::post('/api/tags', 'Api\TagController@store'); 67 | }); 68 | -------------------------------------------------------------------------------- /app/Http/Controllers/TextController.php: -------------------------------------------------------------------------------- 1 | with(['question', 'question.debate', 'user']) 17 | ->join('questions', 'questions.id', 'texts.question_id') 18 | ->join('debates', 'debates.id', 'questions.debate_id') 19 | ->join('users', 'users.id', 'texts.user_id') 20 | ->orderBy('debates.id') 21 | ->orderBy('questions.order') 22 | ->orderBy('users.name') 23 | ->get(); 24 | return view('texts.index', compact('texts')); 25 | } 26 | 27 | public function create(Request $request) 28 | { 29 | $user = $request->user(); 30 | $question_scores = $user->scores['questions']; 31 | $question_ids = []; 32 | foreach ($question_scores as $question_id => $question_score) { 33 | if ($question_score >= TextPolicy::MIN_SCORE_PER_QUESTION) { 34 | $question_ids[] = $question_id; 35 | } 36 | } 37 | $questions = Question::with('debate')->whereIn('id', $question_ids)->get(); 38 | $options = []; 39 | foreach ($questions as $question) { 40 | $options[$question->id] = $question->debate->name . ' / ' . $question->text; 41 | } 42 | return view('texts.create', compact('options')); 43 | } 44 | 45 | public function store(Request $request) 46 | { 47 | $question = Question::find($request->input('question')); 48 | $this->authorize('create', [Text::class, $question]); 49 | $text = new Text(); 50 | $text->user_id = $request->user()->id; 51 | $text->question_id = $request->input('question'); 52 | $text->content = $request->input('content'); 53 | $text->save(); 54 | // Send mail to admin 55 | $message = new Message(); 56 | $message->title = 'Nouveau texte ' . $text->id; 57 | $message->content = 'Un nouveau texte a été créé, de numéro ' . $text->id; 58 | $message->user_id = 1; 59 | $message->save(); 60 | return redirect('/texts/' . $text->id); 61 | } 62 | 63 | public function show(Request $request, Text $text) 64 | { 65 | $user = $request->user(); 66 | return view('texts.show', compact('text', 'user')); 67 | } 68 | 69 | public function edit(Text $text) 70 | { 71 | $this->authorize('update', $text); 72 | return view('texts.edit', compact('text')); 73 | } 74 | 75 | public function update(Request $request, Text $text) 76 | { 77 | $this->authorize('update', $text); 78 | $text->content = $request->input('content'); 79 | $text->save(); 80 | // Send mail to admin 81 | $message = new Message(); 82 | $message->title = 'Texte modifié ' . $text->id; 83 | $message->content = 'Un texte a été modifié, de numéro ' . $text->id; 84 | $message->user_id = 1; 85 | $message->save(); 86 | return redirect('/texts/' . $text->id); 87 | } 88 | 89 | public function destroy(Text $text) 90 | { 91 | // 92 | } 93 | } 94 | --------------------------------------------------------------------------------