From 16d954bb624b55cb5b1b9a853deb7283bf12f721 Mon Sep 17 00:00:00 2001 From: Adabriand Furtado Date: Tue, 12 Jul 2016 15:06:59 -0300 Subject: [PATCH] Remoção da pasta assets da estrutura do projeto. --- main.py | 2 +- validador.py | 4 ++-- view/assets/css/main.css | 175 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- view/assets/css/ranking.css | 124 ---------------------------------------------------------------------------------------------------------------------------- view/assets/fonts/roboto/Roboto-Black.ttf | Bin 163488 -> 0 bytes view/assets/fonts/roboto/Roboto-BlackItalic.ttf | Bin 165444 -> 0 bytes view/assets/fonts/roboto/Roboto-Bold.ttf | Bin 162464 -> 0 bytes view/assets/fonts/roboto/Roboto-BoldItalic.ttf | Bin 163644 -> 0 bytes view/assets/fonts/roboto/Roboto-Italic.ttf | Bin 161484 -> 0 bytes view/assets/fonts/roboto/Roboto-Light.ttf | Bin 162420 -> 0 bytes view/assets/fonts/roboto/Roboto-LightItalic.ttf | Bin 166492 -> 0 bytes view/assets/fonts/roboto/Roboto-Medium.ttf | Bin 162588 -> 0 bytes view/assets/fonts/roboto/Roboto-MediumItalic.ttf | Bin 165636 -> 0 bytes view/assets/fonts/roboto/Roboto-Regular.ttf | Bin 162876 -> 0 bytes view/assets/fonts/roboto/Roboto-Thin.ttf | Bin 163132 -> 0 bytes view/assets/fonts/roboto/Roboto-ThinItalic.ttf | Bin 168276 -> 0 bytes view/assets/fonts/titilliumweb/TitilliumWeb-Black.ttf | Bin 49356 -> 0 bytes view/assets/fonts/titilliumweb/TitilliumWeb-Bold.ttf | Bin 59908 -> 0 bytes view/assets/fonts/titilliumweb/TitilliumWeb-BoldItalic.ttf | Bin 69796 -> 0 bytes view/assets/fonts/titilliumweb/TitilliumWeb-ExtraLight.ttf | Bin 63124 -> 0 bytes view/assets/fonts/titilliumweb/TitilliumWeb-ExtraLightItalic.ttf | Bin 67788 -> 0 bytes view/assets/fonts/titilliumweb/TitilliumWeb-Italic.ttf | Bin 72416 -> 0 bytes view/assets/fonts/titilliumweb/TitilliumWeb-Light.ttf | Bin 64032 -> 0 bytes view/assets/fonts/titilliumweb/TitilliumWeb-LightItalic.ttf | Bin 71720 -> 0 bytes view/assets/fonts/titilliumweb/TitilliumWeb-Regular.ttf | Bin 63752 -> 0 bytes view/assets/fonts/titilliumweb/TitilliumWeb-SemiBold.ttf | Bin 63044 -> 0 bytes view/assets/fonts/titilliumweb/TitilliumWeb-SemiBoldItalic.ttf | Bin 71812 -> 0 bytes view/assets/img/correct.png | Bin 5097 -> 0 bytes view/assets/img/finish.svg | 17 ----------------- view/assets/img/incorrect.png | Bin 5002 -> 0 bytes view/assets/img/loading.gif | Bin 79842 -> 0 bytes view/assets/img/ranking/bronze-star-icon.png | Bin 343 -> 0 bytes view/assets/img/ranking/gold-star-icon.png | Bin 338 -> 0 bytes view/assets/img/ranking/signs-icon.png | Bin 2115 -> 0 bytes view/assets/img/ranking/silver-star-icon.png | Bin 337 -> 0 bytes view/assets/img/ranking/trophy-icon.png | Bin 1392 -> 0 bytes view/assets/img/ranking/user-shape.png | Bin 4174 -> 0 bytes view/assets/img/skip.svg | 17 ----------------- view/assets/img/thumbnail.png | Bin 35402 -> 0 bytes view/assets/js/external-libs/js.cookie.js | 145 ------------------------------------------------------------------------------------------------------------------------------------------------- view/assets/js/helpers/load-html-helper.js | 21 --------------------- view/assets/js/helpers/pybossa-api-helper.js | 44 -------------------------------------------- view/assets/js/ranking.js | 163 ------------------------------------------------------------------------------------------------------------------------------------------------------------------- view/assets/js/validador.js | 265 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- view/assets/templates/ranking/ranking.html | 47 ----------------------------------------------- view/css/main.css | 175 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ view/css/ranking.css | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ view/fonts/roboto/Roboto-Black.ttf | Bin 0 -> 163488 bytes view/fonts/roboto/Roboto-BlackItalic.ttf | Bin 0 -> 165444 bytes view/fonts/roboto/Roboto-Bold.ttf | Bin 0 -> 162464 bytes view/fonts/roboto/Roboto-BoldItalic.ttf | Bin 0 -> 163644 bytes view/fonts/roboto/Roboto-Italic.ttf | Bin 0 -> 161484 bytes view/fonts/roboto/Roboto-Light.ttf | Bin 0 -> 162420 bytes view/fonts/roboto/Roboto-LightItalic.ttf | Bin 0 -> 166492 bytes view/fonts/roboto/Roboto-Medium.ttf | Bin 0 -> 162588 bytes view/fonts/roboto/Roboto-MediumItalic.ttf | Bin 0 -> 165636 bytes view/fonts/roboto/Roboto-Regular.ttf | Bin 0 -> 162876 bytes view/fonts/roboto/Roboto-Thin.ttf | Bin 0 -> 163132 bytes view/fonts/roboto/Roboto-ThinItalic.ttf | Bin 0 -> 168276 bytes view/fonts/titilliumweb/TitilliumWeb-Black.ttf | Bin 0 -> 49356 bytes view/fonts/titilliumweb/TitilliumWeb-Bold.ttf | Bin 0 -> 59908 bytes view/fonts/titilliumweb/TitilliumWeb-BoldItalic.ttf | Bin 0 -> 69796 bytes view/fonts/titilliumweb/TitilliumWeb-ExtraLight.ttf | Bin 0 -> 63124 bytes view/fonts/titilliumweb/TitilliumWeb-ExtraLightItalic.ttf | Bin 0 -> 67788 bytes view/fonts/titilliumweb/TitilliumWeb-Italic.ttf | Bin 0 -> 72416 bytes view/fonts/titilliumweb/TitilliumWeb-Light.ttf | Bin 0 -> 64032 bytes view/fonts/titilliumweb/TitilliumWeb-LightItalic.ttf | Bin 0 -> 71720 bytes view/fonts/titilliumweb/TitilliumWeb-Regular.ttf | Bin 0 -> 63752 bytes view/fonts/titilliumweb/TitilliumWeb-SemiBold.ttf | Bin 0 -> 63044 bytes view/fonts/titilliumweb/TitilliumWeb-SemiBoldItalic.ttf | Bin 0 -> 71812 bytes view/img/correct.png | Bin 0 -> 5097 bytes view/img/finish.svg | 17 +++++++++++++++++ view/img/incorrect.png | Bin 0 -> 5002 bytes view/img/loading.gif | Bin 0 -> 79842 bytes view/img/ranking/bronze-star-icon.png | Bin 0 -> 343 bytes view/img/ranking/gold-star-icon.png | Bin 0 -> 338 bytes view/img/ranking/signs-icon.png | Bin 0 -> 2115 bytes view/img/ranking/silver-star-icon.png | Bin 0 -> 337 bytes view/img/ranking/trophy-icon.png | Bin 0 -> 1392 bytes view/img/ranking/user-shape.png | Bin 0 -> 4174 bytes view/img/skip.svg | 17 +++++++++++++++++ view/img/thumbnail.png | Bin 0 -> 35402 bytes view/js/external-libs/js.cookie.js | 145 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ view/js/helpers/load-html-helper.js | 23 +++++++++++++++++++++++ view/js/helpers/pybossa-api-helper.js | 44 ++++++++++++++++++++++++++++++++++++++++++++ view/js/ranking.js | 163 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ view/js/validador.js | 265 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ view/template.html | 120 ------------------------------------------------------------------------------------------------------------------------ view/templates/index.html | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ view/templates/ranking/ranking.html | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 90 files changed, 1143 insertions(+), 1141 deletions(-) delete mode 100755 view/assets/css/main.css delete mode 100644 view/assets/css/ranking.css delete mode 100644 view/assets/fonts/roboto/Roboto-Black.ttf delete mode 100644 view/assets/fonts/roboto/Roboto-BlackItalic.ttf delete mode 100644 view/assets/fonts/roboto/Roboto-Bold.ttf delete mode 100644 view/assets/fonts/roboto/Roboto-BoldItalic.ttf delete mode 100644 view/assets/fonts/roboto/Roboto-Italic.ttf delete mode 100644 view/assets/fonts/roboto/Roboto-Light.ttf delete mode 100644 view/assets/fonts/roboto/Roboto-LightItalic.ttf delete mode 100644 view/assets/fonts/roboto/Roboto-Medium.ttf delete mode 100644 view/assets/fonts/roboto/Roboto-MediumItalic.ttf delete mode 100644 view/assets/fonts/roboto/Roboto-Regular.ttf delete mode 100644 view/assets/fonts/roboto/Roboto-Thin.ttf delete mode 100644 view/assets/fonts/roboto/Roboto-ThinItalic.ttf delete mode 100644 view/assets/fonts/titilliumweb/TitilliumWeb-Black.ttf delete mode 100644 view/assets/fonts/titilliumweb/TitilliumWeb-Bold.ttf delete mode 100644 view/assets/fonts/titilliumweb/TitilliumWeb-BoldItalic.ttf delete mode 100644 view/assets/fonts/titilliumweb/TitilliumWeb-ExtraLight.ttf delete mode 100644 view/assets/fonts/titilliumweb/TitilliumWeb-ExtraLightItalic.ttf delete mode 100644 view/assets/fonts/titilliumweb/TitilliumWeb-Italic.ttf delete mode 100644 view/assets/fonts/titilliumweb/TitilliumWeb-Light.ttf delete mode 100644 view/assets/fonts/titilliumweb/TitilliumWeb-LightItalic.ttf delete mode 100644 view/assets/fonts/titilliumweb/TitilliumWeb-Regular.ttf delete mode 100644 view/assets/fonts/titilliumweb/TitilliumWeb-SemiBold.ttf delete mode 100644 view/assets/fonts/titilliumweb/TitilliumWeb-SemiBoldItalic.ttf delete mode 100755 view/assets/img/correct.png delete mode 100755 view/assets/img/finish.svg delete mode 100755 view/assets/img/incorrect.png delete mode 100755 view/assets/img/loading.gif delete mode 100644 view/assets/img/ranking/bronze-star-icon.png delete mode 100644 view/assets/img/ranking/gold-star-icon.png delete mode 100644 view/assets/img/ranking/signs-icon.png delete mode 100644 view/assets/img/ranking/silver-star-icon.png delete mode 100644 view/assets/img/ranking/trophy-icon.png delete mode 100644 view/assets/img/ranking/user-shape.png delete mode 100755 view/assets/img/skip.svg delete mode 100755 view/assets/img/thumbnail.png delete mode 100755 view/assets/js/external-libs/js.cookie.js delete mode 100644 view/assets/js/helpers/load-html-helper.js delete mode 100644 view/assets/js/helpers/pybossa-api-helper.js delete mode 100644 view/assets/js/ranking.js delete mode 100755 view/assets/js/validador.js delete mode 100644 view/assets/templates/ranking/ranking.html create mode 100755 view/css/main.css create mode 100644 view/css/ranking.css create mode 100644 view/fonts/roboto/Roboto-Black.ttf create mode 100644 view/fonts/roboto/Roboto-BlackItalic.ttf create mode 100644 view/fonts/roboto/Roboto-Bold.ttf create mode 100644 view/fonts/roboto/Roboto-BoldItalic.ttf create mode 100644 view/fonts/roboto/Roboto-Italic.ttf create mode 100644 view/fonts/roboto/Roboto-Light.ttf create mode 100644 view/fonts/roboto/Roboto-LightItalic.ttf create mode 100644 view/fonts/roboto/Roboto-Medium.ttf create mode 100644 view/fonts/roboto/Roboto-MediumItalic.ttf create mode 100644 view/fonts/roboto/Roboto-Regular.ttf create mode 100644 view/fonts/roboto/Roboto-Thin.ttf create mode 100644 view/fonts/roboto/Roboto-ThinItalic.ttf create mode 100644 view/fonts/titilliumweb/TitilliumWeb-Black.ttf create mode 100644 view/fonts/titilliumweb/TitilliumWeb-Bold.ttf create mode 100644 view/fonts/titilliumweb/TitilliumWeb-BoldItalic.ttf create mode 100644 view/fonts/titilliumweb/TitilliumWeb-ExtraLight.ttf create mode 100644 view/fonts/titilliumweb/TitilliumWeb-ExtraLightItalic.ttf create mode 100644 view/fonts/titilliumweb/TitilliumWeb-Italic.ttf create mode 100644 view/fonts/titilliumweb/TitilliumWeb-Light.ttf create mode 100644 view/fonts/titilliumweb/TitilliumWeb-LightItalic.ttf create mode 100644 view/fonts/titilliumweb/TitilliumWeb-Regular.ttf create mode 100644 view/fonts/titilliumweb/TitilliumWeb-SemiBold.ttf create mode 100644 view/fonts/titilliumweb/TitilliumWeb-SemiBoldItalic.ttf create mode 100755 view/img/correct.png create mode 100755 view/img/finish.svg create mode 100755 view/img/incorrect.png create mode 100755 view/img/loading.gif create mode 100644 view/img/ranking/bronze-star-icon.png create mode 100644 view/img/ranking/gold-star-icon.png create mode 100644 view/img/ranking/signs-icon.png create mode 100644 view/img/ranking/silver-star-icon.png create mode 100644 view/img/ranking/trophy-icon.png create mode 100644 view/img/ranking/user-shape.png create mode 100755 view/img/skip.svg create mode 100755 view/img/thumbnail.png create mode 100755 view/js/external-libs/js.cookie.js create mode 100644 view/js/helpers/load-html-helper.js create mode 100644 view/js/helpers/pybossa-api-helper.js create mode 100644 view/js/ranking.js create mode 100755 view/js/validador.js delete mode 100755 view/template.html create mode 100755 view/templates/index.html create mode 100644 view/templates/ranking/ranking.html diff --git a/main.py b/main.py index e175c50..061a1ab 100644 --- a/main.py +++ b/main.py @@ -49,7 +49,7 @@ def read_settings(app): def setup_controller(): global controller read_settings(app) - env = Environment(loader=PackageLoader('main', 'view')) + env = Environment(loader=PackageLoader('main', 'view/templates')) controller = Validador(app.config, env) def setup_static_files_service(app): diff --git a/validador.py b/validador.py index 6b45033..4d7017b 100644 --- a/validador.py +++ b/validador.py @@ -33,9 +33,9 @@ class Validador: pbclient.create_task(project.id, task) def __update_project_info(self, project): - template = self.env.get_template('template.html') + template = self.env.get_template('index.html') project.info['task_presenter'] = template.render(server=self.config['HOST_STATIC_FILES_ENDPOINT'], server_backend=self.config['HOST_ENDPOINT'], app_shortname=self.config['PYBOSSA_APP_SHORT_NAME']) - project.info['thumbnail'] = self.config['HOST_STATIC_FILES_ENDPOINT'] + "/assets/img/thumbnail.png" + project.info['thumbnail'] = self.config['HOST_STATIC_FILES_ENDPOINT'] + "/img/thumbnail.png" project.info['sched'] = "incremental" project.info['published'] = True project.allow_anonymous_contributors = False diff --git a/view/assets/css/main.css b/view/assets/css/main.css deleted file mode 100755 index f296a47..0000000 --- a/view/assets/css/main.css +++ /dev/null @@ -1,175 +0,0 @@ -@import url("ranking.css"); - -@font-face { - font-family: 'Titillium Web'; - src: url('../fonts/titilliumweb/TitilliumWeb-SemiBold.ttf') - format('truetype'); -} - -#alert-container { - padding: 0px; -} - -#alert-container .alert-actions a { - padding: 10px 15px 10px 0px; -} - -#main-container { - font-family: 'Titillium Web', sans-serif; -} - -/* Navbar */ -#validador-navbar { - padding-top: 10px; -} - -#validador-navbar .ranking-button { - font-size: 20px; - font-weight: bold; -} - -/* Validador */ -.video-body { - height: 338px; - width: 85%; - background-color: #000000; -} - -.video-container { - padding-left: 40px; - padding-right: 0px; -} - -.row { - margin-left: 0%; - margin-right: 0%; -} - -.line-separator, .btn-default { - box-shadow: 2px 2px 2px rgba(215, 217, 221, 1.0); - -webkit-box-shadow: 2px 2px 2px rgba(215, 217, 221, 1.0); - -moz-box-shadow: 2px 2px 2px rgba(215, 217, 221, 1.0); -} - -#validador-header { - padding-left: 15px; -} - -#validador-header .validador-question { - margin-top: 0px; -} - -.body-container { - background: rgba(236, 238, 242, 1.0); - padding: 0px 0px 10px 0px; -} - -.line-separator { - height: 2px; - width: 100%; - background-color: rgba(145, 200, 206, 1.0); -} - -h1, h2, h3, h4, h5, h6 { - color: rgba(144, 164, 174, 1.0); -} - -h6 { - font-size: 20px; -} - -.btn-default { - background-color: rgba(94, 199, 189, 1.0); -} - -.btn-default { - color: rgba(255, 255, 255, 1.0); -} - -.icon { - width: 50px; - height: 50px; -} - -#finish-task-container { - padding-right: 15px; -} - -.finish-padding-top { - padding-top: 10px; -} - -.finish-padding-top-adjust { - padding-top: 70px; -} - -.finish-task-button { - float: right; - padding-bottom: 0px; - padding-left: 25px; - color: rgba(94, 199, 189, 1.0); -} - -.enabled-button:hover { - cursor: pointer; - filter: alpha(opacity = 50); - opacity: 0.5; -} - -.disabled-button { - filter: alpha(opacity = 50); - opacity: 0.5; -} - -.radio-options span { - padding-right: 5px; -} - -.radio-options input[type=radio] { - width: 18px; - height: 18px; -} - -.correct-answer-container { - padding-right: 10px; - float: left; -} - -.correct-answer-label { - color: #5fc64e; -} - -.incorrect-answer-label { - color: #ec2327; -} - -#comment-ref { - display: none; - padding-right: 40px; -} - -#comment-avatar { - display: none; -} - -.mask { - filter: alpha(opacity = 50); - opacity: 0.5; -} - -#loading-container { - display: none; - position: fixed; - top: 0; - right: 0; - bottom: 0; - left: 0; - z-index: 1040; -} - -#loading-container img { - position: absolute; - width: 80px; - top: 37%; - left: 47%; -} \ No newline at end of file diff --git a/view/assets/css/ranking.css b/view/assets/css/ranking.css deleted file mode 100644 index 7dde662..0000000 --- a/view/assets/css/ranking.css +++ /dev/null @@ -1,124 +0,0 @@ -@font-face { - font-family: 'Roboto'; - src: url('../fonts/roboto/Roboto-Light.ttf') format('truetype'); -} - -#ranking-container { - display: none; - background-color: #ffffff; - border-radius: 5px; - -moz-border-radius: 5px; - -webkit-border-radius: 5px; - padding-right: 0px; - overflow: hidden; - font-family: 'Roboto'; - padding-left: 15px; - margin: 10px 15px 5px 15px; -} - -#ranking-info-container { - padding-left: 0px; -} - -#ranking-info-container .title { - color: #000000; - font-size: 50px; -} - -#ranking-info-container .avatar-info { - text-align: center; - padding-top: 30px; -} - -#ranking-info-container .avatar-container { - display: none; -} - -#ranking-info-container .avatar-info img { - width: 100%; -} - -#ranking-info-container .achievement-info { - color: #028c12; -} - -#ranking-info-container .progress-container { - padding-left: 100px; - margin-top: 10px; -} - -#ranking-info-container .achievements-container { - position: relative; - padding: 10px 0px 0px 0px; - word-wrap: break-word; -} - -#ranking-info-container .progress-label { - position: absolute; - left: 0px; -} - -#ranking-info-container .done-tasks { - color: #84DC76; -} - -#ranking-info-container .total-tasks { - color: #f0ad4e; -} - -#ranking-info-container .tooltip-inner { - font-size: 16px; - max-width: 220px; -} - -#leaderboard-container { - background-color: #fefcfc; - padding: 0px; - min-height: 560px; -} - -#leaderboard-container table { - margin-bottom: 0px; -} - -#leaderboard-container .table-striped>tbody>tr:nth-of-type(odd) { - background-color: #f1f2f2; -} - -#leaderboard-container .table-striped>tbody>tr:hover { - background-color: #e0e0e0; -} - -#leaderboard-container .table-striped>tbody>tr.highlight { - background-color: #fbefa3; -} - -#leaderboard-container .table-striped>tbody>tr.highlight:hover { - background-color: #f7e783; -} - -#leaderboard-container th { - text-align: center; - border: 0px; - padding-bottom: 15px; -} - -#leaderboard-container td { - text-align: center; - border: 0px; -} - -#leaderboard-container td:nth-of-type(1), #leaderboard-container td:nth-of-type(2) - { - width: 75px; -} - -#leaderboard-container td:nth-of-type(2), #leaderboard-container th:nth-of-type(2), - #leaderboard-container td:nth-of-type(3), #leaderboard-container th:nth-of-type(3) - { - text-align: left; -} - -#leaderboard-container th:nth-of-type(3) img { - padding-left: 20px; -} \ No newline at end of file diff --git a/view/assets/fonts/roboto/Roboto-Black.ttf b/view/assets/fonts/roboto/Roboto-Black.ttf deleted file mode 100644 index fbde625..0000000 Binary files a/view/assets/fonts/roboto/Roboto-Black.ttf and /dev/null differ diff --git a/view/assets/fonts/roboto/Roboto-BlackItalic.ttf b/view/assets/fonts/roboto/Roboto-BlackItalic.ttf deleted file mode 100644 index 60f7782..0000000 Binary files a/view/assets/fonts/roboto/Roboto-BlackItalic.ttf and /dev/null differ diff --git a/view/assets/fonts/roboto/Roboto-Bold.ttf b/view/assets/fonts/roboto/Roboto-Bold.ttf deleted file mode 100644 index a355c27..0000000 Binary files a/view/assets/fonts/roboto/Roboto-Bold.ttf and /dev/null differ diff --git a/view/assets/fonts/roboto/Roboto-BoldItalic.ttf b/view/assets/fonts/roboto/Roboto-BoldItalic.ttf deleted file mode 100644 index 3c9a7a3..0000000 Binary files a/view/assets/fonts/roboto/Roboto-BoldItalic.ttf and /dev/null differ diff --git a/view/assets/fonts/roboto/Roboto-Italic.ttf b/view/assets/fonts/roboto/Roboto-Italic.ttf deleted file mode 100644 index ff6046d..0000000 Binary files a/view/assets/fonts/roboto/Roboto-Italic.ttf and /dev/null differ diff --git a/view/assets/fonts/roboto/Roboto-Light.ttf b/view/assets/fonts/roboto/Roboto-Light.ttf deleted file mode 100644 index 94c6bcc..0000000 Binary files a/view/assets/fonts/roboto/Roboto-Light.ttf and /dev/null differ diff --git a/view/assets/fonts/roboto/Roboto-LightItalic.ttf b/view/assets/fonts/roboto/Roboto-LightItalic.ttf deleted file mode 100644 index 04cc002..0000000 Binary files a/view/assets/fonts/roboto/Roboto-LightItalic.ttf and /dev/null differ diff --git a/view/assets/fonts/roboto/Roboto-Medium.ttf b/view/assets/fonts/roboto/Roboto-Medium.ttf deleted file mode 100644 index 39c63d7..0000000 Binary files a/view/assets/fonts/roboto/Roboto-Medium.ttf and /dev/null differ diff --git a/view/assets/fonts/roboto/Roboto-MediumItalic.ttf b/view/assets/fonts/roboto/Roboto-MediumItalic.ttf deleted file mode 100644 index dc743f0..0000000 Binary files a/view/assets/fonts/roboto/Roboto-MediumItalic.ttf and /dev/null differ diff --git a/view/assets/fonts/roboto/Roboto-Regular.ttf b/view/assets/fonts/roboto/Roboto-Regular.ttf deleted file mode 100644 index 8c082c8..0000000 Binary files a/view/assets/fonts/roboto/Roboto-Regular.ttf and /dev/null differ diff --git a/view/assets/fonts/roboto/Roboto-Thin.ttf b/view/assets/fonts/roboto/Roboto-Thin.ttf deleted file mode 100644 index d695550..0000000 Binary files a/view/assets/fonts/roboto/Roboto-Thin.ttf and /dev/null differ diff --git a/view/assets/fonts/roboto/Roboto-ThinItalic.ttf b/view/assets/fonts/roboto/Roboto-ThinItalic.ttf deleted file mode 100644 index 07172ff..0000000 Binary files a/view/assets/fonts/roboto/Roboto-ThinItalic.ttf and /dev/null differ diff --git a/view/assets/fonts/titilliumweb/TitilliumWeb-Black.ttf b/view/assets/fonts/titilliumweb/TitilliumWeb-Black.ttf deleted file mode 100644 index fc5c4b5..0000000 Binary files a/view/assets/fonts/titilliumweb/TitilliumWeb-Black.ttf and /dev/null differ diff --git a/view/assets/fonts/titilliumweb/TitilliumWeb-Bold.ttf b/view/assets/fonts/titilliumweb/TitilliumWeb-Bold.ttf deleted file mode 100644 index 0af0fe7..0000000 Binary files a/view/assets/fonts/titilliumweb/TitilliumWeb-Bold.ttf and /dev/null differ diff --git a/view/assets/fonts/titilliumweb/TitilliumWeb-BoldItalic.ttf b/view/assets/fonts/titilliumweb/TitilliumWeb-BoldItalic.ttf deleted file mode 100644 index 77425ea..0000000 Binary files a/view/assets/fonts/titilliumweb/TitilliumWeb-BoldItalic.ttf and /dev/null differ diff --git a/view/assets/fonts/titilliumweb/TitilliumWeb-ExtraLight.ttf b/view/assets/fonts/titilliumweb/TitilliumWeb-ExtraLight.ttf deleted file mode 100644 index 2b506ef..0000000 Binary files a/view/assets/fonts/titilliumweb/TitilliumWeb-ExtraLight.ttf and /dev/null differ diff --git a/view/assets/fonts/titilliumweb/TitilliumWeb-ExtraLightItalic.ttf b/view/assets/fonts/titilliumweb/TitilliumWeb-ExtraLightItalic.ttf deleted file mode 100644 index c1be5ba..0000000 Binary files a/view/assets/fonts/titilliumweb/TitilliumWeb-ExtraLightItalic.ttf and /dev/null differ diff --git a/view/assets/fonts/titilliumweb/TitilliumWeb-Italic.ttf b/view/assets/fonts/titilliumweb/TitilliumWeb-Italic.ttf deleted file mode 100644 index 42f2c10..0000000 Binary files a/view/assets/fonts/titilliumweb/TitilliumWeb-Italic.ttf and /dev/null differ diff --git a/view/assets/fonts/titilliumweb/TitilliumWeb-Light.ttf b/view/assets/fonts/titilliumweb/TitilliumWeb-Light.ttf deleted file mode 100644 index ca67971..0000000 Binary files a/view/assets/fonts/titilliumweb/TitilliumWeb-Light.ttf and /dev/null differ diff --git a/view/assets/fonts/titilliumweb/TitilliumWeb-LightItalic.ttf b/view/assets/fonts/titilliumweb/TitilliumWeb-LightItalic.ttf deleted file mode 100644 index 2ea724f..0000000 Binary files a/view/assets/fonts/titilliumweb/TitilliumWeb-LightItalic.ttf and /dev/null differ diff --git a/view/assets/fonts/titilliumweb/TitilliumWeb-Regular.ttf b/view/assets/fonts/titilliumweb/TitilliumWeb-Regular.ttf deleted file mode 100644 index 6da8219..0000000 Binary files a/view/assets/fonts/titilliumweb/TitilliumWeb-Regular.ttf and /dev/null differ diff --git a/view/assets/fonts/titilliumweb/TitilliumWeb-SemiBold.ttf b/view/assets/fonts/titilliumweb/TitilliumWeb-SemiBold.ttf deleted file mode 100644 index dfdcdbe..0000000 Binary files a/view/assets/fonts/titilliumweb/TitilliumWeb-SemiBold.ttf and /dev/null differ diff --git a/view/assets/fonts/titilliumweb/TitilliumWeb-SemiBoldItalic.ttf b/view/assets/fonts/titilliumweb/TitilliumWeb-SemiBoldItalic.ttf deleted file mode 100644 index b68a669..0000000 Binary files a/view/assets/fonts/titilliumweb/TitilliumWeb-SemiBoldItalic.ttf and /dev/null differ diff --git a/view/assets/img/correct.png b/view/assets/img/correct.png deleted file mode 100755 index 3340434..0000000 Binary files a/view/assets/img/correct.png and /dev/null differ diff --git a/view/assets/img/finish.svg b/view/assets/img/finish.svg deleted file mode 100755 index f6d4e0c..0000000 --- a/view/assets/img/finish.svg +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - diff --git a/view/assets/img/incorrect.png b/view/assets/img/incorrect.png deleted file mode 100755 index be2d49f..0000000 Binary files a/view/assets/img/incorrect.png and /dev/null differ diff --git a/view/assets/img/loading.gif b/view/assets/img/loading.gif deleted file mode 100755 index 0fcd282..0000000 Binary files a/view/assets/img/loading.gif and /dev/null differ diff --git a/view/assets/img/ranking/bronze-star-icon.png b/view/assets/img/ranking/bronze-star-icon.png deleted file mode 100644 index d1cf5af..0000000 Binary files a/view/assets/img/ranking/bronze-star-icon.png and /dev/null differ diff --git a/view/assets/img/ranking/gold-star-icon.png b/view/assets/img/ranking/gold-star-icon.png deleted file mode 100644 index cbb5b6f..0000000 Binary files a/view/assets/img/ranking/gold-star-icon.png and /dev/null differ diff --git a/view/assets/img/ranking/signs-icon.png b/view/assets/img/ranking/signs-icon.png deleted file mode 100644 index f99f05d..0000000 Binary files a/view/assets/img/ranking/signs-icon.png and /dev/null differ diff --git a/view/assets/img/ranking/silver-star-icon.png b/view/assets/img/ranking/silver-star-icon.png deleted file mode 100644 index 121e773..0000000 Binary files a/view/assets/img/ranking/silver-star-icon.png and /dev/null differ diff --git a/view/assets/img/ranking/trophy-icon.png b/view/assets/img/ranking/trophy-icon.png deleted file mode 100644 index c048eb8..0000000 Binary files a/view/assets/img/ranking/trophy-icon.png and /dev/null differ diff --git a/view/assets/img/ranking/user-shape.png b/view/assets/img/ranking/user-shape.png deleted file mode 100644 index f2ffb8f..0000000 Binary files a/view/assets/img/ranking/user-shape.png and /dev/null differ diff --git a/view/assets/img/skip.svg b/view/assets/img/skip.svg deleted file mode 100755 index 2d006dc..0000000 --- a/view/assets/img/skip.svg +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - diff --git a/view/assets/img/thumbnail.png b/view/assets/img/thumbnail.png deleted file mode 100755 index ead10bc..0000000 Binary files a/view/assets/img/thumbnail.png and /dev/null differ diff --git a/view/assets/js/external-libs/js.cookie.js b/view/assets/js/external-libs/js.cookie.js deleted file mode 100755 index afd524d..0000000 --- a/view/assets/js/external-libs/js.cookie.js +++ /dev/null @@ -1,145 +0,0 @@ -/*! - * JavaScript Cookie v2.0.4 - * https://github.com/js-cookie/js-cookie - * - * Copyright 2006, 2015 Klaus Hartl & Fagner Brack - * Released under the MIT license - */ -(function (factory) { - if (typeof define === 'function' && define.amd) { - define(factory); - } else if (typeof exports === 'object') { - module.exports = factory(); - } else { - var _OldCookies = window.Cookies; - var api = window.Cookies = factory(); - api.noConflict = function () { - window.Cookies = _OldCookies; - return api; - }; - } -}(function () { - function extend () { - var i = 0; - var result = {}; - for (; i < arguments.length; i++) { - var attributes = arguments[ i ]; - for (var key in attributes) { - result[key] = attributes[key]; - } - } - return result; - } - - function init (converter) { - function api (key, value, attributes) { - var result; - - // Write - - if (arguments.length > 1) { - attributes = extend({ - path: '/' - }, api.defaults, attributes); - - if (typeof attributes.expires === 'number') { - var expires = new Date(); - expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5); - attributes.expires = expires; - } - - try { - result = JSON.stringify(value); - if (/^[\{\[]/.test(result)) { - value = result; - } - } catch (e) {} - - if (!converter.write) { - value = encodeURIComponent(String(value)) - .replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent); - } else { - value = converter.write(value, key); - } - - key = encodeURIComponent(String(key)); - key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent); - key = key.replace(/[\(\)]/g, escape); - - return (document.cookie = [ - key, '=', value, - attributes.expires && '; expires=' + attributes.expires.toUTCString(), // use expires attribute, max-age is not supported by IE - attributes.path && '; path=' + attributes.path, - attributes.domain && '; domain=' + attributes.domain, - attributes.secure ? '; secure' : '' - ].join('')); - } - - // Read - - if (!key) { - result = {}; - } - - // To prevent the for loop in the first place assign an empty array - // in case there are no cookies at all. Also prevents odd result when - // calling "get()" - var cookies = document.cookie ? document.cookie.split('; ') : []; - var rdecode = /(%[0-9A-Z]{2})+/g; - var i = 0; - - for (; i < cookies.length; i++) { - var parts = cookies[i].split('='); - var name = parts[0].replace(rdecode, decodeURIComponent); - var cookie = parts.slice(1).join('='); - - if (cookie.charAt(0) === '"') { - cookie = cookie.slice(1, -1); - } - - try { - cookie = converter.read ? - converter.read(cookie, name) : converter(cookie, name) || - cookie.replace(rdecode, decodeURIComponent); - - if (this.json) { - try { - cookie = JSON.parse(cookie); - } catch (e) {} - } - - if (key === name) { - result = cookie; - break; - } - - if (!key) { - result[name] = cookie; - } - } catch (e) {} - } - - return result; - } - - api.get = api.set = api; - api.getJSON = function () { - return api.apply({ - json: true - }, [].slice.call(arguments)); - }; - api.defaults = {}; - - api.remove = function (key, attributes) { - api(key, '', extend(attributes, { - expires: -1 - })); - }; - - api.withConverter = init; - - return api; - } - - return init(function () {}); -})); diff --git a/view/assets/js/helpers/load-html-helper.js b/view/assets/js/helpers/load-html-helper.js deleted file mode 100644 index 7eddf6a..0000000 --- a/view/assets/js/helpers/load-html-helper.js +++ /dev/null @@ -1,21 +0,0 @@ -(function(loadHtmlHelper, $, undefined) { - - var baseUrl = ''; - - function _preprocessHtml(data) { - return data.replace(/{{ server }}/g, baseUrl); - } - - loadHtmlHelper.load = function(target, url, callback) { - var completeUrl = baseUrl + url; - $.get(completeUrl, function(data) { - $(target).html(_preprocessHtml(data)); - callback && callback(); - }); - } - - loadHtmlHelper.setup = function(url) { - baseUrl = url; - }; - -}(window.loadHtmlHelper = window.loadHtmlHelper || {}, jQuery)); diff --git a/view/assets/js/helpers/pybossa-api-helper.js b/view/assets/js/helpers/pybossa-api-helper.js deleted file mode 100644 index 8a79e28..0000000 --- a/view/assets/js/helpers/pybossa-api-helper.js +++ /dev/null @@ -1,44 +0,0 @@ -(function(pybossaApiHelper, $, undefined) { - - var pybossaEndpoint = ''; - var projectName = ''; - - function _getProjectId() { - return $.ajax({ - url : pybossaEndpoint + '/api/project?short_name=' + projectName - }); - } - - function _getUserProgress() { - return $.ajax({ - url : pybossaEndpoint + '/api/project/' + projectName + '/userprogress', - cache : false, - dataType : 'json' - }); - } - - function _getAnswers(projectId, userId) { - return $.ajax({ - url : pybossaEndpoint + '/api/taskrun?project_id=' + projectId - + '&user_id=' + userId - }); - } - - pybossaApiHelper.setup = function(endpoint, name) { - pybossaEndpoint = endpoint; - projectName = name; - } - - pybossaApiHelper.getProjectId = function() { - return _getProjectId(); - } - - pybossaApiHelper.getUserProgress = function() { - return _getUserProgress(); - } - - pybossaApiHelper.getAnswers = function(projectId, userId) { - return _getAnswers(projectId, userId); - } - -}(window.pybossaApiHelper = window.pybossaApiHelper || {}, jQuery)); diff --git a/view/assets/js/ranking.js b/view/assets/js/ranking.js deleted file mode 100644 index bcb8623..0000000 --- a/view/assets/js/ranking.js +++ /dev/null @@ -1,163 +0,0 @@ -(function(ranking, $, undefined) { - - var NUMBER_OF_TOP_USERS = 10; - var STARS_MAP = ['', 'gold', 'silver', 'bronze']; - var baseUrl = ''; - var pybossaEndpoint = ''; - var projectName = ''; - var loggedUser = {}; - var totalTasks = 0; - var doneTasks = 0; - var showingRanking = false; - var tasksEnded = false; - - function _getRankingData(callback) { - $.ajax({ - url : pybossaEndpoint + '/api/leaderboard?limit=' - + NUMBER_OF_TOP_USERS, - success : function(response) { - callback(typeof response == 'object' ? response[projectName] - : ''); - }, - error : function(xhr, textStatus, error) { - alert(xhr.responseText); - } - }); - } - - function _processRankingRow(rowData) { - var rank = rowData.rank; - if (rank < 0) { - return ''; - } - var starHTML = ''; - if (rank > 0 && rank < 4) { - starHTML = ''; - } - var trHTML = ''; - if (rowData.name === loggedUser.name) { - trHTML = ''; - loggedUser.rank = rowData.rank; - } - rank = rank == 0 ? '-' : rank + '.'; - return trHTML + '' + starHTML + '' + rank - + '' + rowData.fullname + '' - + rowData.score + ''; - } - - function _updateRanking() { - _getRankingData(function(data) { - if (data === '') - return; - - var rowsHTML = ''; - for (var i = 0; i < data.length; i++) { - rowsHTML += _processRankingRow(data[i]); - } - $('#leaderboard-container tbody').html(rowsHTML); - $('#ranking-info-container .rank-position').html(loggedUser.rank); - $('#ranking-info-container .username').html(loggedUser.fullName); - if (loggedUser.avatarUrl != '') { - $('#ranking-info-container .avatar-container img').attr('src', - loggedUser.avatarUrl); - $('#ranking-info-container .avatar-placeholder').hide(); - $('#ranking-info-container .avatar-container').show(); - } - if (loggedUser.rank === 0) { - $('#ranking-info-container .rank-position-container').hide(); - } - _updateProgress(); - }); - } - - function _getUserData() { - return $.ajax({ - url : pybossaEndpoint + '/api/user?name=' + loggedUser.name - }); - } - - function _getAvatarUrl(data) { - return !data || typeof data.avatar === 'undefined' || typeof data.container === 'undefined' ? - '' : pybossaEndpoint + '/uploads/' + data.container + '/' + data.avatar; - } - - function _updateProgress() { - pybossaApiHelper - .getUserProgress() - .done( - function(response) { - totalTasks = response.total; - doneTasks = response.done; - var percentage = (doneTasks / totalTasks) * 100; - $('#ranking-info-container .progress-bar').attr( - 'aria-valuenow', percentage).css('width', - percentage + '%'); - $('#ranking-container [data-toggle="tooltip"]') - .tooltip( - { - title : '' - + doneTasks - + ' / ' - + totalTasks - + ' sinais ensinados.', - placement : 'bottom', - trigger : 'manual' - }); - }); - } - - function _loadRankingData() { - _getUserData().done(function(response) { - if (typeof response == 'undefined' || response.length < 1) { - return; - } - loggedUser.fullName = response[0].fullname; - loggedUser.avatarUrl = _getAvatarUrl(response[0].info); - _updateRanking(); - }); - } - - function _showRanking() { - $('#validador-container').hide(); - $('#ranking-container').show(); - $('#validador-navbar .ranking-button').html("Voltar"); - if (doneTasks > 0) { - $('#ranking-container [data-toggle="tooltip"]').tooltip('show'); - } - showingRanking = true; - } - - function _hideRanking() { - $('#ranking-container').hide(); - $('#validador-navbar .ranking-button').html("Ver Ranking"); - showingRanking = false; - - if (!tasksEnded) { - $('#validador-container').show(); - } - } - - ranking.toggle = function() { - if (showingRanking) { - _hideRanking(); - } else { - _showRanking(); - } - }; - - ranking.tasksEnded = function() { - tasksEnded = true; - }; - - ranking.setup = function(serverUrl, endpoint, name, user) { - baseUrl = serverUrl; - pybossaEndpoint = endpoint; - projectName = name; - loggedUser.name = user; - loadHtmlHelper.load('#ranking-container', '/assets/templates/ranking/ranking.html', - _loadRankingData); - }; - -}(window.ranking = window.ranking || {}, jQuery)); diff --git a/view/assets/js/validador.js b/view/assets/js/validador.js deleted file mode 100755 index bf12e50..0000000 --- a/view/assets/js/validador.js +++ /dev/null @@ -1,265 +0,0 @@ -(function(validador, $, undefined) { - - var baseUrl = ''; - var serverBackendUrl = ''; - var videosUrl = ''; - var pybossaEndpoint = ''; - var projectName = ''; - var currentTaskId = -1; - - function _getLoggedUser() { - var pybossaRememberToken = Cookies.get('remember_token'); - var splittedTokenId = pybossaRememberToken.split('|'); - return splittedTokenId.length > 0 ? splittedTokenId[0] : 'anonymous'; - } - - function _disableFinishButton() { - $('#finish-button').off('click'); - $('#finish-button').removeClass('enabled-button'); - $('#finish-button').addClass('disabled-button'); - } - - function _enableFinishButton(task, deferred) { - $('#finish-button').removeClass('disabled-button'); - $('#finish-button').addClass('enabled-button'); - $('#finish-button').off('click').on('click', function() { - _readAnswer(task, deferred, false); - }); - } - - function _hideCommentAvatar() { - $('#comment-avatar').hide(); - $('#finish-task-container').removeClass('finish-padding-top-adjust'); - } - - function _hideCommentRef() { - $('#comment-ref').hide(); - } - - function resetComments() { - $('#comment-avatar textarea').val('') - $('#comment-ref textarea').val(''); - _hideCommentAvatar(); - _hideCommentRef(); - } - - function _enableLoading() { - $('#loading-container').show(); - $('#main-container').addClass('mask'); - } - - function _disableLoading() { - $('#loading-container').hide(); - $('#main-container').removeClass('mask'); - } - - function _handleAvatarRadioClick(el, task, deferred) { - var isIncorrectButton = $(el).val() == 'INCORRECT'; - if (isIncorrectButton) { - _hideCommentRef(); - $('#comment-avatar').show(); - $('#finish-task-container').addClass('finish-padding-top-adjust'); - } else { - _hideCommentAvatar(); - } - var isRefChecked = $('#ref-radio-answers input[type=radio]').is( - ':checked'); - if (isRefChecked) { - _enableFinishButton(task, deferred); - } else { - _disableFinishButton(); - } - } - - function _handleRefRadioClick(el, task, deferred) { - var isIncorrectButton = $(el).val() == 'INCORRECT'; - if (isIncorrectButton) { - $('#incorrect-avatar-button').prop('checked', true); - $('#comment-ref').show(); - _hideCommentAvatar(); - } else { - var isAvatarDisabled = $('#avatar-radio-answers input[type=radio]') - .is(':disabled'); - if (isAvatarDisabled) { - $('#incorrect-avatar-button').prop('checked', false); - } - _hideCommentRef(); - } - $('#avatar-radio-answers input[type=radio]').prop('disabled', - isIncorrectButton); - var isAvatarChecked = $('#avatar-radio-answers input[type=radio]').is( - ':checked'); - if (isAvatarChecked) { - _enableFinishButton(task, deferred); - } else { - _disableFinishButton(); - } - } - - function _setupGUI(task, deferred) { - resetComments(); - _disableFinishButton(); - $('#avatar-radio-answers input[type=radio]').prop('disabled', false); - $('#avatar-radio-answers input[type=radio]').prop('checked', false); - $('#ref-radio-answers input[type=radio]').prop('checked', false); - $('#avatar-radio-answers input[type=radio]').off('click').on('click', - function() { - _handleAvatarRadioClick(this, task, deferred); - }); - $('#ref-radio-answers input[type=radio]').off('click').on('click', - function() { - _handleRefRadioClick(this, task, deferred); - }); - $('#skip-button').off('click').on('click', function() { - _readAnswer(task, deferred, true); - }); - } - - function _readAnswer(task, deferred, hasSkipped) { - var status = ''; - var avatarAnswer = $('#avatar-radio-answers input[type=radio]:checked') - .val(); - var refAnswer = $('#ref-radio-answers input[type=radio]:checked').val(); - if (hasSkipped) { - status = 'SKIPPED'; - } else if (refAnswer == 'INCORRECT') { - status = 'REF_DISAPPROVED'; - } else if (avatarAnswer == 'INCORRECT') { - status = 'AVATAR_DISAPPROVED'; - } else { - status = 'AVATAR_APPROVED'; - } - _submitAnswer(task, deferred, status, hasSkipped); - } - - function _createAnswer(task, status) { - var answer = {}; - var lastAnswer = task.info.last_answer; - var hasLastAnswer = typeof lastAnswer != 'undefined'; - if (hasLastAnswer) { - answer = lastAnswer; - } else { - answer = { - 'number_of_approval' : 0, - 'number_of_avatar_disapproval' : 0, - 'number_of_ref_disapproval' : 0 - }; - } - answer['status'] = status; - answer['comment_avatar'] = ''; - answer['comment_ref'] = ''; - if (status == 'AVATAR_APPROVED') { - answer['number_of_approval'] = answer.number_of_approval + 1; - } else if (status == 'AVATAR_DISAPPROVED') { - answer['number_of_avatar_disapproval'] = answer.number_of_avatar_disapproval + 1; - var commentAvatar = $('#comment-avatar textarea').val(); - if (commentAvatar.trim() != '') { - answer['comment_avatar'] = commentAvatar; - } - } else if (status == 'REF_DISAPPROVED') { - answer['number_of_ref_disapproval'] = answer.number_of_ref_disapproval + 1; - var comment_ref = $('#comment-ref textarea').val(); - if (comment_ref.trim() != '') { - answer['comment_ref'] = comment_ref; - } - } - return answer; - } - - function _finishTask(task, deferred, answer) { - _enableLoading(); - $ - .ajax({ - type : 'POST', - url : serverBackendUrl + '/finish_task', - data : { - 'task_id' : task.id, - 'project_id' : task.project_id, - 'sign_name' : task.info.sign_name, - 'number_of_approval' : answer.number_of_approval, - 'number_of_avatar_disapproval' : answer.number_of_avatar_disapproval, - 'number_of_ref_disapproval' : answer.number_of_ref_disapproval - }, - success : function(response) { - pybossa.saveTask(task.id, answer).done(function() { - _disableLoading(); - $('#success').fadeIn(500); - $('#validador-container').hide(); - setTimeout(function() { - deferred.resolve(); - }, 2000); - }); - }, - error : function(xhr, textStatus, error) { - _disableLoading(); - alert(xhr.responseText); - } - }); - } - - function _submitAnswer(task, deferred, status, hasSkipped) { - var answer = _createAnswer(task, status); - if (hasSkipped) { - _saveAnswer(task, deferred, answer); - } else { - _finishTask(task, deferred, answer); - } - } - - function _saveAnswer(task, deferred, answer) { - pybossa.saveTask(task.id, answer).done(function() { - $('#success').fadeIn(500); - $('#validador-container').hide(); - setTimeout(function() { - deferred.resolve(); - }, 2000); - }); - } - - function _loadTaskInfo(task) { - currentTaskId = task.id; - var signName = task.info.sign_name; - var avatarVidLink = videosUrl + signName + '_AVATAR.webm'; - var refVidLink = videosUrl + signName + '_REF.webm'; - $('.sign-label').text(signName); - $('#avatar-video').attr('src', avatarVidLink); - $('#ref-video').attr('src', refVidLink); - } - - function _loadMainComponents() { - pybossaApiHelper.setup(pybossaEndpoint, projectName); - loadHtmlHelper.setup(baseUrl); - ranking.setup(baseUrl, pybossaEndpoint, projectName, _getLoggedUser()); - } - - pybossa.presentTask(function(task, deferred) { - _loadMainComponents(); - if (!$.isEmptyObject(task) && currentTaskId != task.id) { - _loadTaskInfo(task); - _setupGUI(task, deferred); - $('#success').hide(); - $('#validador-container').fadeIn(500); - } else { - $('#validador-container').hide(); - $('#finish').fadeIn(500); - ranking.tasksEnded(); - } - }); - - // Private methods - function _run(projectname) { - pybossa.setEndpoint(pybossaEndpoint); - pybossa.run(projectname); - } - - // Public methods - validador.run = function(serverhost, serverbackend, projname) { - baseUrl = serverhost; - serverBackendUrl = serverbackend; - videosUrl = baseUrl + '/videos/'; - pybossaEndpoint = '/pybossa'; - projectName = projname; - _run(projectName); - }; - -}(window.validador = window.validador || {}, jQuery)); \ No newline at end of file diff --git a/view/assets/templates/ranking/ranking.html b/view/assets/templates/ranking/ranking.html deleted file mode 100644 index c5ee136..0000000 --- a/view/assets/templates/ranking/ranking.html +++ /dev/null @@ -1,47 +0,0 @@ -
-
WikiRanking
-
Lorem Ipsum é apenas uma simulação de texto da indústria - tipográfica e de impressos, e vem sendo utilizado desde o século XVI.
-
-
- -
-
- -
-
-
-
- º Posição -
-
-
-
-
-
-
-
-
-
- Progresso: -
-
-
-
- - - - - - - - - - - -
# -
Membro
-
Sinais
-
\ No newline at end of file diff --git a/view/css/main.css b/view/css/main.css new file mode 100755 index 0000000..f296a47 --- /dev/null +++ b/view/css/main.css @@ -0,0 +1,175 @@ +@import url("ranking.css"); + +@font-face { + font-family: 'Titillium Web'; + src: url('../fonts/titilliumweb/TitilliumWeb-SemiBold.ttf') + format('truetype'); +} + +#alert-container { + padding: 0px; +} + +#alert-container .alert-actions a { + padding: 10px 15px 10px 0px; +} + +#main-container { + font-family: 'Titillium Web', sans-serif; +} + +/* Navbar */ +#validador-navbar { + padding-top: 10px; +} + +#validador-navbar .ranking-button { + font-size: 20px; + font-weight: bold; +} + +/* Validador */ +.video-body { + height: 338px; + width: 85%; + background-color: #000000; +} + +.video-container { + padding-left: 40px; + padding-right: 0px; +} + +.row { + margin-left: 0%; + margin-right: 0%; +} + +.line-separator, .btn-default { + box-shadow: 2px 2px 2px rgba(215, 217, 221, 1.0); + -webkit-box-shadow: 2px 2px 2px rgba(215, 217, 221, 1.0); + -moz-box-shadow: 2px 2px 2px rgba(215, 217, 221, 1.0); +} + +#validador-header { + padding-left: 15px; +} + +#validador-header .validador-question { + margin-top: 0px; +} + +.body-container { + background: rgba(236, 238, 242, 1.0); + padding: 0px 0px 10px 0px; +} + +.line-separator { + height: 2px; + width: 100%; + background-color: rgba(145, 200, 206, 1.0); +} + +h1, h2, h3, h4, h5, h6 { + color: rgba(144, 164, 174, 1.0); +} + +h6 { + font-size: 20px; +} + +.btn-default { + background-color: rgba(94, 199, 189, 1.0); +} + +.btn-default { + color: rgba(255, 255, 255, 1.0); +} + +.icon { + width: 50px; + height: 50px; +} + +#finish-task-container { + padding-right: 15px; +} + +.finish-padding-top { + padding-top: 10px; +} + +.finish-padding-top-adjust { + padding-top: 70px; +} + +.finish-task-button { + float: right; + padding-bottom: 0px; + padding-left: 25px; + color: rgba(94, 199, 189, 1.0); +} + +.enabled-button:hover { + cursor: pointer; + filter: alpha(opacity = 50); + opacity: 0.5; +} + +.disabled-button { + filter: alpha(opacity = 50); + opacity: 0.5; +} + +.radio-options span { + padding-right: 5px; +} + +.radio-options input[type=radio] { + width: 18px; + height: 18px; +} + +.correct-answer-container { + padding-right: 10px; + float: left; +} + +.correct-answer-label { + color: #5fc64e; +} + +.incorrect-answer-label { + color: #ec2327; +} + +#comment-ref { + display: none; + padding-right: 40px; +} + +#comment-avatar { + display: none; +} + +.mask { + filter: alpha(opacity = 50); + opacity: 0.5; +} + +#loading-container { + display: none; + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: 1040; +} + +#loading-container img { + position: absolute; + width: 80px; + top: 37%; + left: 47%; +} \ No newline at end of file diff --git a/view/css/ranking.css b/view/css/ranking.css new file mode 100644 index 0000000..7dde662 --- /dev/null +++ b/view/css/ranking.css @@ -0,0 +1,124 @@ +@font-face { + font-family: 'Roboto'; + src: url('../fonts/roboto/Roboto-Light.ttf') format('truetype'); +} + +#ranking-container { + display: none; + background-color: #ffffff; + border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + padding-right: 0px; + overflow: hidden; + font-family: 'Roboto'; + padding-left: 15px; + margin: 10px 15px 5px 15px; +} + +#ranking-info-container { + padding-left: 0px; +} + +#ranking-info-container .title { + color: #000000; + font-size: 50px; +} + +#ranking-info-container .avatar-info { + text-align: center; + padding-top: 30px; +} + +#ranking-info-container .avatar-container { + display: none; +} + +#ranking-info-container .avatar-info img { + width: 100%; +} + +#ranking-info-container .achievement-info { + color: #028c12; +} + +#ranking-info-container .progress-container { + padding-left: 100px; + margin-top: 10px; +} + +#ranking-info-container .achievements-container { + position: relative; + padding: 10px 0px 0px 0px; + word-wrap: break-word; +} + +#ranking-info-container .progress-label { + position: absolute; + left: 0px; +} + +#ranking-info-container .done-tasks { + color: #84DC76; +} + +#ranking-info-container .total-tasks { + color: #f0ad4e; +} + +#ranking-info-container .tooltip-inner { + font-size: 16px; + max-width: 220px; +} + +#leaderboard-container { + background-color: #fefcfc; + padding: 0px; + min-height: 560px; +} + +#leaderboard-container table { + margin-bottom: 0px; +} + +#leaderboard-container .table-striped>tbody>tr:nth-of-type(odd) { + background-color: #f1f2f2; +} + +#leaderboard-container .table-striped>tbody>tr:hover { + background-color: #e0e0e0; +} + +#leaderboard-container .table-striped>tbody>tr.highlight { + background-color: #fbefa3; +} + +#leaderboard-container .table-striped>tbody>tr.highlight:hover { + background-color: #f7e783; +} + +#leaderboard-container th { + text-align: center; + border: 0px; + padding-bottom: 15px; +} + +#leaderboard-container td { + text-align: center; + border: 0px; +} + +#leaderboard-container td:nth-of-type(1), #leaderboard-container td:nth-of-type(2) + { + width: 75px; +} + +#leaderboard-container td:nth-of-type(2), #leaderboard-container th:nth-of-type(2), + #leaderboard-container td:nth-of-type(3), #leaderboard-container th:nth-of-type(3) + { + text-align: left; +} + +#leaderboard-container th:nth-of-type(3) img { + padding-left: 20px; +} \ No newline at end of file diff --git a/view/fonts/roboto/Roboto-Black.ttf b/view/fonts/roboto/Roboto-Black.ttf new file mode 100644 index 0000000..fbde625 Binary files /dev/null and b/view/fonts/roboto/Roboto-Black.ttf differ diff --git a/view/fonts/roboto/Roboto-BlackItalic.ttf b/view/fonts/roboto/Roboto-BlackItalic.ttf new file mode 100644 index 0000000..60f7782 Binary files /dev/null and b/view/fonts/roboto/Roboto-BlackItalic.ttf differ diff --git a/view/fonts/roboto/Roboto-Bold.ttf b/view/fonts/roboto/Roboto-Bold.ttf new file mode 100644 index 0000000..a355c27 Binary files /dev/null and b/view/fonts/roboto/Roboto-Bold.ttf differ diff --git a/view/fonts/roboto/Roboto-BoldItalic.ttf b/view/fonts/roboto/Roboto-BoldItalic.ttf new file mode 100644 index 0000000..3c9a7a3 Binary files /dev/null and b/view/fonts/roboto/Roboto-BoldItalic.ttf differ diff --git a/view/fonts/roboto/Roboto-Italic.ttf b/view/fonts/roboto/Roboto-Italic.ttf new file mode 100644 index 0000000..ff6046d Binary files /dev/null and b/view/fonts/roboto/Roboto-Italic.ttf differ diff --git a/view/fonts/roboto/Roboto-Light.ttf b/view/fonts/roboto/Roboto-Light.ttf new file mode 100644 index 0000000..94c6bcc Binary files /dev/null and b/view/fonts/roboto/Roboto-Light.ttf differ diff --git a/view/fonts/roboto/Roboto-LightItalic.ttf b/view/fonts/roboto/Roboto-LightItalic.ttf new file mode 100644 index 0000000..04cc002 Binary files /dev/null and b/view/fonts/roboto/Roboto-LightItalic.ttf differ diff --git a/view/fonts/roboto/Roboto-Medium.ttf b/view/fonts/roboto/Roboto-Medium.ttf new file mode 100644 index 0000000..39c63d7 Binary files /dev/null and b/view/fonts/roboto/Roboto-Medium.ttf differ diff --git a/view/fonts/roboto/Roboto-MediumItalic.ttf b/view/fonts/roboto/Roboto-MediumItalic.ttf new file mode 100644 index 0000000..dc743f0 Binary files /dev/null and b/view/fonts/roboto/Roboto-MediumItalic.ttf differ diff --git a/view/fonts/roboto/Roboto-Regular.ttf b/view/fonts/roboto/Roboto-Regular.ttf new file mode 100644 index 0000000..8c082c8 Binary files /dev/null and b/view/fonts/roboto/Roboto-Regular.ttf differ diff --git a/view/fonts/roboto/Roboto-Thin.ttf b/view/fonts/roboto/Roboto-Thin.ttf new file mode 100644 index 0000000..d695550 Binary files /dev/null and b/view/fonts/roboto/Roboto-Thin.ttf differ diff --git a/view/fonts/roboto/Roboto-ThinItalic.ttf b/view/fonts/roboto/Roboto-ThinItalic.ttf new file mode 100644 index 0000000..07172ff Binary files /dev/null and b/view/fonts/roboto/Roboto-ThinItalic.ttf differ diff --git a/view/fonts/titilliumweb/TitilliumWeb-Black.ttf b/view/fonts/titilliumweb/TitilliumWeb-Black.ttf new file mode 100644 index 0000000..fc5c4b5 Binary files /dev/null and b/view/fonts/titilliumweb/TitilliumWeb-Black.ttf differ diff --git a/view/fonts/titilliumweb/TitilliumWeb-Bold.ttf b/view/fonts/titilliumweb/TitilliumWeb-Bold.ttf new file mode 100644 index 0000000..0af0fe7 Binary files /dev/null and b/view/fonts/titilliumweb/TitilliumWeb-Bold.ttf differ diff --git a/view/fonts/titilliumweb/TitilliumWeb-BoldItalic.ttf b/view/fonts/titilliumweb/TitilliumWeb-BoldItalic.ttf new file mode 100644 index 0000000..77425ea Binary files /dev/null and b/view/fonts/titilliumweb/TitilliumWeb-BoldItalic.ttf differ diff --git a/view/fonts/titilliumweb/TitilliumWeb-ExtraLight.ttf b/view/fonts/titilliumweb/TitilliumWeb-ExtraLight.ttf new file mode 100644 index 0000000..2b506ef Binary files /dev/null and b/view/fonts/titilliumweb/TitilliumWeb-ExtraLight.ttf differ diff --git a/view/fonts/titilliumweb/TitilliumWeb-ExtraLightItalic.ttf b/view/fonts/titilliumweb/TitilliumWeb-ExtraLightItalic.ttf new file mode 100644 index 0000000..c1be5ba Binary files /dev/null and b/view/fonts/titilliumweb/TitilliumWeb-ExtraLightItalic.ttf differ diff --git a/view/fonts/titilliumweb/TitilliumWeb-Italic.ttf b/view/fonts/titilliumweb/TitilliumWeb-Italic.ttf new file mode 100644 index 0000000..42f2c10 Binary files /dev/null and b/view/fonts/titilliumweb/TitilliumWeb-Italic.ttf differ diff --git a/view/fonts/titilliumweb/TitilliumWeb-Light.ttf b/view/fonts/titilliumweb/TitilliumWeb-Light.ttf new file mode 100644 index 0000000..ca67971 Binary files /dev/null and b/view/fonts/titilliumweb/TitilliumWeb-Light.ttf differ diff --git a/view/fonts/titilliumweb/TitilliumWeb-LightItalic.ttf b/view/fonts/titilliumweb/TitilliumWeb-LightItalic.ttf new file mode 100644 index 0000000..2ea724f Binary files /dev/null and b/view/fonts/titilliumweb/TitilliumWeb-LightItalic.ttf differ diff --git a/view/fonts/titilliumweb/TitilliumWeb-Regular.ttf b/view/fonts/titilliumweb/TitilliumWeb-Regular.ttf new file mode 100644 index 0000000..6da8219 Binary files /dev/null and b/view/fonts/titilliumweb/TitilliumWeb-Regular.ttf differ diff --git a/view/fonts/titilliumweb/TitilliumWeb-SemiBold.ttf b/view/fonts/titilliumweb/TitilliumWeb-SemiBold.ttf new file mode 100644 index 0000000..dfdcdbe Binary files /dev/null and b/view/fonts/titilliumweb/TitilliumWeb-SemiBold.ttf differ diff --git a/view/fonts/titilliumweb/TitilliumWeb-SemiBoldItalic.ttf b/view/fonts/titilliumweb/TitilliumWeb-SemiBoldItalic.ttf new file mode 100644 index 0000000..b68a669 Binary files /dev/null and b/view/fonts/titilliumweb/TitilliumWeb-SemiBoldItalic.ttf differ diff --git a/view/img/correct.png b/view/img/correct.png new file mode 100755 index 0000000..3340434 Binary files /dev/null and b/view/img/correct.png differ diff --git a/view/img/finish.svg b/view/img/finish.svg new file mode 100755 index 0000000..f6d4e0c --- /dev/null +++ b/view/img/finish.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + diff --git a/view/img/incorrect.png b/view/img/incorrect.png new file mode 100755 index 0000000..be2d49f Binary files /dev/null and b/view/img/incorrect.png differ diff --git a/view/img/loading.gif b/view/img/loading.gif new file mode 100755 index 0000000..0fcd282 Binary files /dev/null and b/view/img/loading.gif differ diff --git a/view/img/ranking/bronze-star-icon.png b/view/img/ranking/bronze-star-icon.png new file mode 100644 index 0000000..d1cf5af Binary files /dev/null and b/view/img/ranking/bronze-star-icon.png differ diff --git a/view/img/ranking/gold-star-icon.png b/view/img/ranking/gold-star-icon.png new file mode 100644 index 0000000..cbb5b6f Binary files /dev/null and b/view/img/ranking/gold-star-icon.png differ diff --git a/view/img/ranking/signs-icon.png b/view/img/ranking/signs-icon.png new file mode 100644 index 0000000..f99f05d Binary files /dev/null and b/view/img/ranking/signs-icon.png differ diff --git a/view/img/ranking/silver-star-icon.png b/view/img/ranking/silver-star-icon.png new file mode 100644 index 0000000..121e773 Binary files /dev/null and b/view/img/ranking/silver-star-icon.png differ diff --git a/view/img/ranking/trophy-icon.png b/view/img/ranking/trophy-icon.png new file mode 100644 index 0000000..c048eb8 Binary files /dev/null and b/view/img/ranking/trophy-icon.png differ diff --git a/view/img/ranking/user-shape.png b/view/img/ranking/user-shape.png new file mode 100644 index 0000000..f2ffb8f Binary files /dev/null and b/view/img/ranking/user-shape.png differ diff --git a/view/img/skip.svg b/view/img/skip.svg new file mode 100755 index 0000000..2d006dc --- /dev/null +++ b/view/img/skip.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + diff --git a/view/img/thumbnail.png b/view/img/thumbnail.png new file mode 100755 index 0000000..ead10bc Binary files /dev/null and b/view/img/thumbnail.png differ diff --git a/view/js/external-libs/js.cookie.js b/view/js/external-libs/js.cookie.js new file mode 100755 index 0000000..afd524d --- /dev/null +++ b/view/js/external-libs/js.cookie.js @@ -0,0 +1,145 @@ +/*! + * JavaScript Cookie v2.0.4 + * https://github.com/js-cookie/js-cookie + * + * Copyright 2006, 2015 Klaus Hartl & Fagner Brack + * Released under the MIT license + */ +(function (factory) { + if (typeof define === 'function' && define.amd) { + define(factory); + } else if (typeof exports === 'object') { + module.exports = factory(); + } else { + var _OldCookies = window.Cookies; + var api = window.Cookies = factory(); + api.noConflict = function () { + window.Cookies = _OldCookies; + return api; + }; + } +}(function () { + function extend () { + var i = 0; + var result = {}; + for (; i < arguments.length; i++) { + var attributes = arguments[ i ]; + for (var key in attributes) { + result[key] = attributes[key]; + } + } + return result; + } + + function init (converter) { + function api (key, value, attributes) { + var result; + + // Write + + if (arguments.length > 1) { + attributes = extend({ + path: '/' + }, api.defaults, attributes); + + if (typeof attributes.expires === 'number') { + var expires = new Date(); + expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5); + attributes.expires = expires; + } + + try { + result = JSON.stringify(value); + if (/^[\{\[]/.test(result)) { + value = result; + } + } catch (e) {} + + if (!converter.write) { + value = encodeURIComponent(String(value)) + .replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent); + } else { + value = converter.write(value, key); + } + + key = encodeURIComponent(String(key)); + key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent); + key = key.replace(/[\(\)]/g, escape); + + return (document.cookie = [ + key, '=', value, + attributes.expires && '; expires=' + attributes.expires.toUTCString(), // use expires attribute, max-age is not supported by IE + attributes.path && '; path=' + attributes.path, + attributes.domain && '; domain=' + attributes.domain, + attributes.secure ? '; secure' : '' + ].join('')); + } + + // Read + + if (!key) { + result = {}; + } + + // To prevent the for loop in the first place assign an empty array + // in case there are no cookies at all. Also prevents odd result when + // calling "get()" + var cookies = document.cookie ? document.cookie.split('; ') : []; + var rdecode = /(%[0-9A-Z]{2})+/g; + var i = 0; + + for (; i < cookies.length; i++) { + var parts = cookies[i].split('='); + var name = parts[0].replace(rdecode, decodeURIComponent); + var cookie = parts.slice(1).join('='); + + if (cookie.charAt(0) === '"') { + cookie = cookie.slice(1, -1); + } + + try { + cookie = converter.read ? + converter.read(cookie, name) : converter(cookie, name) || + cookie.replace(rdecode, decodeURIComponent); + + if (this.json) { + try { + cookie = JSON.parse(cookie); + } catch (e) {} + } + + if (key === name) { + result = cookie; + break; + } + + if (!key) { + result[name] = cookie; + } + } catch (e) {} + } + + return result; + } + + api.get = api.set = api; + api.getJSON = function () { + return api.apply({ + json: true + }, [].slice.call(arguments)); + }; + api.defaults = {}; + + api.remove = function (key, attributes) { + api(key, '', extend(attributes, { + expires: -1 + })); + }; + + api.withConverter = init; + + return api; + } + + return init(function () {}); +})); diff --git a/view/js/helpers/load-html-helper.js b/view/js/helpers/load-html-helper.js new file mode 100644 index 0000000..5e3316f --- /dev/null +++ b/view/js/helpers/load-html-helper.js @@ -0,0 +1,23 @@ +(function(loadHtmlHelper, $, undefined) { + + var baseUrl = ''; + var templatesUrl = ''; + + function _preprocessHtml(data) { + return data.replace(/{{ server }}/g, baseUrl); + } + + loadHtmlHelper.load = function(target, url, callback) { + var completeUrl = templatesUrl + url; + $.get(completeUrl, function(data) { + $(target).html(_preprocessHtml(data)); + callback && callback(); + }); + } + + loadHtmlHelper.setup = function(url) { + baseUrl = url; + templatesUrl = baseUrl + "/templates"; + }; + +}(window.loadHtmlHelper = window.loadHtmlHelper || {}, jQuery)); diff --git a/view/js/helpers/pybossa-api-helper.js b/view/js/helpers/pybossa-api-helper.js new file mode 100644 index 0000000..8a79e28 --- /dev/null +++ b/view/js/helpers/pybossa-api-helper.js @@ -0,0 +1,44 @@ +(function(pybossaApiHelper, $, undefined) { + + var pybossaEndpoint = ''; + var projectName = ''; + + function _getProjectId() { + return $.ajax({ + url : pybossaEndpoint + '/api/project?short_name=' + projectName + }); + } + + function _getUserProgress() { + return $.ajax({ + url : pybossaEndpoint + '/api/project/' + projectName + '/userprogress', + cache : false, + dataType : 'json' + }); + } + + function _getAnswers(projectId, userId) { + return $.ajax({ + url : pybossaEndpoint + '/api/taskrun?project_id=' + projectId + + '&user_id=' + userId + }); + } + + pybossaApiHelper.setup = function(endpoint, name) { + pybossaEndpoint = endpoint; + projectName = name; + } + + pybossaApiHelper.getProjectId = function() { + return _getProjectId(); + } + + pybossaApiHelper.getUserProgress = function() { + return _getUserProgress(); + } + + pybossaApiHelper.getAnswers = function(projectId, userId) { + return _getAnswers(projectId, userId); + } + +}(window.pybossaApiHelper = window.pybossaApiHelper || {}, jQuery)); diff --git a/view/js/ranking.js b/view/js/ranking.js new file mode 100644 index 0000000..390f2d1 --- /dev/null +++ b/view/js/ranking.js @@ -0,0 +1,163 @@ +(function(ranking, $, undefined) { + + var NUMBER_OF_TOP_USERS = 10; + var STARS_MAP = ['', 'gold', 'silver', 'bronze']; + var baseUrl = ''; + var pybossaEndpoint = ''; + var projectName = ''; + var loggedUser = {}; + var totalTasks = 0; + var doneTasks = 0; + var showingRanking = false; + var tasksEnded = false; + + function _getRankingData(callback) { + $.ajax({ + url : pybossaEndpoint + '/api/leaderboard?limit=' + + NUMBER_OF_TOP_USERS, + success : function(response) { + callback(typeof response == 'object' ? response[projectName] + : ''); + }, + error : function(xhr, textStatus, error) { + alert(xhr.responseText); + } + }); + } + + function _processRankingRow(rowData) { + var rank = rowData.rank; + if (rank < 0) { + return ''; + } + var starHTML = ''; + if (rank > 0 && rank < 4) { + starHTML = ''; + } + var trHTML = ''; + if (rowData.name === loggedUser.name) { + trHTML = ''; + loggedUser.rank = rowData.rank; + } + rank = rank == 0 ? '-' : rank + '.'; + return trHTML + '' + starHTML + '' + rank + + '' + rowData.fullname + '' + + rowData.score + ''; + } + + function _updateRanking() { + _getRankingData(function(data) { + if (data === '') + return; + + var rowsHTML = ''; + for (var i = 0; i < data.length; i++) { + rowsHTML += _processRankingRow(data[i]); + } + $('#leaderboard-container tbody').html(rowsHTML); + $('#ranking-info-container .rank-position').html(loggedUser.rank); + $('#ranking-info-container .username').html(loggedUser.fullName); + if (loggedUser.avatarUrl != '') { + $('#ranking-info-container .avatar-container img').attr('src', + loggedUser.avatarUrl); + $('#ranking-info-container .avatar-placeholder').hide(); + $('#ranking-info-container .avatar-container').show(); + } + if (loggedUser.rank === 0) { + $('#ranking-info-container .rank-position-container').hide(); + } + _updateProgress(); + }); + } + + function _getUserData() { + return $.ajax({ + url : pybossaEndpoint + '/api/user?name=' + loggedUser.name + }); + } + + function _getAvatarUrl(data) { + return !data || typeof data.avatar === 'undefined' || typeof data.container === 'undefined' ? + '' : pybossaEndpoint + '/uploads/' + data.container + '/' + data.avatar; + } + + function _updateProgress() { + pybossaApiHelper + .getUserProgress() + .done( + function(response) { + totalTasks = response.total; + doneTasks = response.done; + var percentage = (doneTasks / totalTasks) * 100; + $('#ranking-info-container .progress-bar').attr( + 'aria-valuenow', percentage).css('width', + percentage + '%'); + $('#ranking-container [data-toggle="tooltip"]') + .tooltip( + { + title : '' + + doneTasks + + ' / ' + + totalTasks + + ' sinais ensinados.', + placement : 'bottom', + trigger : 'manual' + }); + }); + } + + function _loadRankingData() { + _getUserData().done(function(response) { + if (typeof response == 'undefined' || response.length < 1) { + return; + } + loggedUser.fullName = response[0].fullname; + loggedUser.avatarUrl = _getAvatarUrl(response[0].info); + _updateRanking(); + }); + } + + function _showRanking() { + $('#validador-container').hide(); + $('#ranking-container').show(); + $('#validador-navbar .ranking-button').html("Voltar"); + if (doneTasks > 0) { + $('#ranking-container [data-toggle="tooltip"]').tooltip('show'); + } + showingRanking = true; + } + + function _hideRanking() { + $('#ranking-container').hide(); + $('#validador-navbar .ranking-button').html("Ver Ranking"); + showingRanking = false; + + if (!tasksEnded) { + $('#validador-container').show(); + } + } + + ranking.toggle = function() { + if (showingRanking) { + _hideRanking(); + } else { + _showRanking(); + } + }; + + ranking.tasksEnded = function() { + tasksEnded = true; + }; + + ranking.setup = function(serverUrl, endpoint, name, user) { + baseUrl = serverUrl; + pybossaEndpoint = endpoint; + projectName = name; + loggedUser.name = user; + loadHtmlHelper.load('#ranking-container', '/ranking/ranking.html', + _loadRankingData); + }; + +}(window.ranking = window.ranking || {}, jQuery)); diff --git a/view/js/validador.js b/view/js/validador.js new file mode 100755 index 0000000..bf12e50 --- /dev/null +++ b/view/js/validador.js @@ -0,0 +1,265 @@ +(function(validador, $, undefined) { + + var baseUrl = ''; + var serverBackendUrl = ''; + var videosUrl = ''; + var pybossaEndpoint = ''; + var projectName = ''; + var currentTaskId = -1; + + function _getLoggedUser() { + var pybossaRememberToken = Cookies.get('remember_token'); + var splittedTokenId = pybossaRememberToken.split('|'); + return splittedTokenId.length > 0 ? splittedTokenId[0] : 'anonymous'; + } + + function _disableFinishButton() { + $('#finish-button').off('click'); + $('#finish-button').removeClass('enabled-button'); + $('#finish-button').addClass('disabled-button'); + } + + function _enableFinishButton(task, deferred) { + $('#finish-button').removeClass('disabled-button'); + $('#finish-button').addClass('enabled-button'); + $('#finish-button').off('click').on('click', function() { + _readAnswer(task, deferred, false); + }); + } + + function _hideCommentAvatar() { + $('#comment-avatar').hide(); + $('#finish-task-container').removeClass('finish-padding-top-adjust'); + } + + function _hideCommentRef() { + $('#comment-ref').hide(); + } + + function resetComments() { + $('#comment-avatar textarea').val('') + $('#comment-ref textarea').val(''); + _hideCommentAvatar(); + _hideCommentRef(); + } + + function _enableLoading() { + $('#loading-container').show(); + $('#main-container').addClass('mask'); + } + + function _disableLoading() { + $('#loading-container').hide(); + $('#main-container').removeClass('mask'); + } + + function _handleAvatarRadioClick(el, task, deferred) { + var isIncorrectButton = $(el).val() == 'INCORRECT'; + if (isIncorrectButton) { + _hideCommentRef(); + $('#comment-avatar').show(); + $('#finish-task-container').addClass('finish-padding-top-adjust'); + } else { + _hideCommentAvatar(); + } + var isRefChecked = $('#ref-radio-answers input[type=radio]').is( + ':checked'); + if (isRefChecked) { + _enableFinishButton(task, deferred); + } else { + _disableFinishButton(); + } + } + + function _handleRefRadioClick(el, task, deferred) { + var isIncorrectButton = $(el).val() == 'INCORRECT'; + if (isIncorrectButton) { + $('#incorrect-avatar-button').prop('checked', true); + $('#comment-ref').show(); + _hideCommentAvatar(); + } else { + var isAvatarDisabled = $('#avatar-radio-answers input[type=radio]') + .is(':disabled'); + if (isAvatarDisabled) { + $('#incorrect-avatar-button').prop('checked', false); + } + _hideCommentRef(); + } + $('#avatar-radio-answers input[type=radio]').prop('disabled', + isIncorrectButton); + var isAvatarChecked = $('#avatar-radio-answers input[type=radio]').is( + ':checked'); + if (isAvatarChecked) { + _enableFinishButton(task, deferred); + } else { + _disableFinishButton(); + } + } + + function _setupGUI(task, deferred) { + resetComments(); + _disableFinishButton(); + $('#avatar-radio-answers input[type=radio]').prop('disabled', false); + $('#avatar-radio-answers input[type=radio]').prop('checked', false); + $('#ref-radio-answers input[type=radio]').prop('checked', false); + $('#avatar-radio-answers input[type=radio]').off('click').on('click', + function() { + _handleAvatarRadioClick(this, task, deferred); + }); + $('#ref-radio-answers input[type=radio]').off('click').on('click', + function() { + _handleRefRadioClick(this, task, deferred); + }); + $('#skip-button').off('click').on('click', function() { + _readAnswer(task, deferred, true); + }); + } + + function _readAnswer(task, deferred, hasSkipped) { + var status = ''; + var avatarAnswer = $('#avatar-radio-answers input[type=radio]:checked') + .val(); + var refAnswer = $('#ref-radio-answers input[type=radio]:checked').val(); + if (hasSkipped) { + status = 'SKIPPED'; + } else if (refAnswer == 'INCORRECT') { + status = 'REF_DISAPPROVED'; + } else if (avatarAnswer == 'INCORRECT') { + status = 'AVATAR_DISAPPROVED'; + } else { + status = 'AVATAR_APPROVED'; + } + _submitAnswer(task, deferred, status, hasSkipped); + } + + function _createAnswer(task, status) { + var answer = {}; + var lastAnswer = task.info.last_answer; + var hasLastAnswer = typeof lastAnswer != 'undefined'; + if (hasLastAnswer) { + answer = lastAnswer; + } else { + answer = { + 'number_of_approval' : 0, + 'number_of_avatar_disapproval' : 0, + 'number_of_ref_disapproval' : 0 + }; + } + answer['status'] = status; + answer['comment_avatar'] = ''; + answer['comment_ref'] = ''; + if (status == 'AVATAR_APPROVED') { + answer['number_of_approval'] = answer.number_of_approval + 1; + } else if (status == 'AVATAR_DISAPPROVED') { + answer['number_of_avatar_disapproval'] = answer.number_of_avatar_disapproval + 1; + var commentAvatar = $('#comment-avatar textarea').val(); + if (commentAvatar.trim() != '') { + answer['comment_avatar'] = commentAvatar; + } + } else if (status == 'REF_DISAPPROVED') { + answer['number_of_ref_disapproval'] = answer.number_of_ref_disapproval + 1; + var comment_ref = $('#comment-ref textarea').val(); + if (comment_ref.trim() != '') { + answer['comment_ref'] = comment_ref; + } + } + return answer; + } + + function _finishTask(task, deferred, answer) { + _enableLoading(); + $ + .ajax({ + type : 'POST', + url : serverBackendUrl + '/finish_task', + data : { + 'task_id' : task.id, + 'project_id' : task.project_id, + 'sign_name' : task.info.sign_name, + 'number_of_approval' : answer.number_of_approval, + 'number_of_avatar_disapproval' : answer.number_of_avatar_disapproval, + 'number_of_ref_disapproval' : answer.number_of_ref_disapproval + }, + success : function(response) { + pybossa.saveTask(task.id, answer).done(function() { + _disableLoading(); + $('#success').fadeIn(500); + $('#validador-container').hide(); + setTimeout(function() { + deferred.resolve(); + }, 2000); + }); + }, + error : function(xhr, textStatus, error) { + _disableLoading(); + alert(xhr.responseText); + } + }); + } + + function _submitAnswer(task, deferred, status, hasSkipped) { + var answer = _createAnswer(task, status); + if (hasSkipped) { + _saveAnswer(task, deferred, answer); + } else { + _finishTask(task, deferred, answer); + } + } + + function _saveAnswer(task, deferred, answer) { + pybossa.saveTask(task.id, answer).done(function() { + $('#success').fadeIn(500); + $('#validador-container').hide(); + setTimeout(function() { + deferred.resolve(); + }, 2000); + }); + } + + function _loadTaskInfo(task) { + currentTaskId = task.id; + var signName = task.info.sign_name; + var avatarVidLink = videosUrl + signName + '_AVATAR.webm'; + var refVidLink = videosUrl + signName + '_REF.webm'; + $('.sign-label').text(signName); + $('#avatar-video').attr('src', avatarVidLink); + $('#ref-video').attr('src', refVidLink); + } + + function _loadMainComponents() { + pybossaApiHelper.setup(pybossaEndpoint, projectName); + loadHtmlHelper.setup(baseUrl); + ranking.setup(baseUrl, pybossaEndpoint, projectName, _getLoggedUser()); + } + + pybossa.presentTask(function(task, deferred) { + _loadMainComponents(); + if (!$.isEmptyObject(task) && currentTaskId != task.id) { + _loadTaskInfo(task); + _setupGUI(task, deferred); + $('#success').hide(); + $('#validador-container').fadeIn(500); + } else { + $('#validador-container').hide(); + $('#finish').fadeIn(500); + ranking.tasksEnded(); + } + }); + + // Private methods + function _run(projectname) { + pybossa.setEndpoint(pybossaEndpoint); + pybossa.run(projectname); + } + + // Public methods + validador.run = function(serverhost, serverbackend, projname) { + baseUrl = serverhost; + serverBackendUrl = serverbackend; + videosUrl = baseUrl + '/videos/'; + pybossaEndpoint = '/pybossa'; + projectName = projname; + _run(projectName); + }; + +}(window.validador = window.validador || {}, jQuery)); \ No newline at end of file diff --git a/view/template.html b/view/template.html deleted file mode 100755 index f839ee2..0000000 --- a/view/template.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - -
-
- - -
-
-
- -
-
-
-
-
Ver Ranking
-
-
-
-
-

- A animação do sinal "" está correta? -

-
-
-
-
-
-
- ANIMAÇÃO "": -
-
-
- -
-
-
- ESTÁ CORRETO -
-
- ESTÁ ERRADO -
-
-
-
ENVIAR COMENTÁRIO SOBRE A ANIMAÇÃO:
- -
-
-
-
-
- VÍDEO DE REFERÊNCIA “”: -
-
-
- -
-
-
- ESTÁ CORRETO -
-
- ESTÁ ERRADO -
-
-
-
ENVIAR COMENTÁRIO SOBRE O VÍDEO DE REFERÊNCIA:
- -
-
-
- ENVIAR ANÁLISE E FINALIZAR -
-
- PULAR -
-
-
-
-
-
-
- - diff --git a/view/templates/index.html b/view/templates/index.html new file mode 100755 index 0000000..9436abf --- /dev/null +++ b/view/templates/index.html @@ -0,0 +1,120 @@ + + + + + + + + +
+
+ + +
+
+
+ +
+
+
+
+
Ver Ranking
+
+
+
+
+

+ A animação do sinal "" está correta? +

+
+
+
+
+
+
+ ANIMAÇÃO "": +
+
+
+ +
+
+
+ ESTÁ CORRETO +
+
+ ESTÁ ERRADO +
+
+
+
ENVIAR COMENTÁRIO SOBRE A ANIMAÇÃO:
+ +
+
+
+
+
+ VÍDEO DE REFERÊNCIA “”: +
+
+
+ +
+
+
+ ESTÁ CORRETO +
+
+ ESTÁ ERRADO +
+
+
+
ENVIAR COMENTÁRIO SOBRE O VÍDEO DE REFERÊNCIA:
+ +
+
+
+ ENVIAR ANÁLISE E FINALIZAR +
+
+ PULAR +
+
+
+
+
+
+
+ + diff --git a/view/templates/ranking/ranking.html b/view/templates/ranking/ranking.html new file mode 100644 index 0000000..374e8d4 --- /dev/null +++ b/view/templates/ranking/ranking.html @@ -0,0 +1,47 @@ +
+
WikiRanking
+
Lorem Ipsum é apenas uma simulação de texto da indústria + tipográfica e de impressos, e vem sendo utilizado desde o século XVI.
+
+
+ +
+
+ +
+
+
+
+ º Posição +
+
+
+
+
+
+
+
+
+
+ Progresso: +
+
+
+
+ + + + + + + + + + + +
# +
Membro
+
Sinais
+
\ No newline at end of file -- libgit2 0.21.2