diff --git a/project/core/templates/landing.html b/project/core/templates/landing.html index 324150116..abc548547 100644 --- a/project/core/templates/landing.html +++ b/project/core/templates/landing.html @@ -1,6 +1,6 @@ {% extends "base.html" %} {% load static %} -{% load i18n %} +{% load i18n %} {% block extra_css %} @@ -146,7 +146,7 @@

war

&

diff --git a/project/core/templates/static/less/thread.less b/project/core/templates/static/less/thread.less index d8b7703dc..bb639e66c 100644 --- a/project/core/templates/static/less/thread.less +++ b/project/core/templates/static/less/thread.less @@ -1,671 +1,668 @@ -@import 'base'; +@import "base"; @red: #cc5856; .no-state { - background-color: @white; - border: 2px @lightish-gray; - border-radius: 2px; - .text { - color: @light-gray; - } + background-color: @white; + border: 2px @lightish-gray; + border-radius: 2px; + .text { + color: @light-gray; + } } .count-badge { - font-size: 12px; - border-radius: 25px; - background-color: @dark-blue; - font-weight: bold; - padding: 0 8px; + font-size: 12px; + border-radius: 25px; + background-color: @dark-blue; + font-weight: bold; + padding: 0 8px; } .nav-inactive { - color: #cccccc; - cursor: default; + color: #cccccc; + cursor: default; } - body { - // -webkit-font-smoothing: antialiased; - // ::-webkit-scrollbar { - // width: 8px; - // } - // ::-webkit-scrollbar-track { - // background-color: @dark-white; - // } - // ::-webkit-scrollbar-thumb { - // background-color: @light-gray; - // margin-top: 4px; - // margin-bottom: 4px; - // } + // -webkit-font-smoothing: antialiased; + // ::-webkit-scrollbar { + // width: 8px; + // } + // ::-webkit-scrollbar-track { + // background-color: @dark-white; + // } + // ::-webkit-scrollbar-thumb { + // background-color: @light-gray; + // margin-top: 4px; + // margin-bottom: 4px; + // } } .linked { - border: 1px solid #501cb5; + border: 1px solid #501cb5; } - #thread { - .thread-nav { - background-color: transparent; - border-bottom: 1px solid @dark-white; - box-shadow: none; - color: @black; - height: 56px; - // line-height: 40px; - display: inline-block; - - .nav-wrapper { - .nav-item { - - padding-left: 0; - padding-right: 0; - &.nav-categories { - max-width: 1200px !important; - margin-left: auto !important; - margin-right: auto !important; - - padding-left: 16px; - padding-right: 16px; - } + .thread-wiki-holder { + display: none; + } + + .scrollbar { + height: 95vh; + overflow-y: scroll; + } + + .force-overflow { + min-height: 100vh; + } + + .thread-nav { + background-color: transparent; + border-bottom: 1px solid @dark-white; + box-shadow: none; + color: @black; + height: 56px; + // line-height: 40px; + display: inline-block; + + .nav-wrapper { + .nav-item { + padding-left: 0; + padding-right: 0; + &.nav-categories { + max-width: 1200px !important; + margin-left: auto !important; + margin-right: auto !important; + + padding-left: 16px; + padding-right: 16px; + } + } + + #thread-meta { + display: flex; + padding-top: 8px; + .meta-item { + height: 16px; + line-height: 16px; + color: @dark-gray; + font-size: 14px; + + padding-right: 4px; + i { + vertical-align: text-bottom; + line-height: 16px; + height: 16px; + display: inline-block; + font-size: 1.5em; + color: @light-gray; + &:hover { + cursor: pointer; + color: @light-purple; } + } + } - #thread-meta { - display: flex; - padding-top: 8px; - .meta-item { - height: 16px; - line-height: 16px; - color: @dark-gray; - font-size: 14px; - - padding-right: 4px; - i { - vertical-align: text-bottom; - line-height: 16px; - height: 16px; - display: inline-block; - - font-size: 1.5em; - - color: @light-gray; - &:hover { - cursor: pointer; - color: @light-purple; - } - } + .title-item { + width: 68%; + } - } + .thread-title:hover { + cursor: pointer; + } - .title-item { - width: 68%; - } - .dropdown-wrapper { - .dropdown-content { - li { - min-height: 0; - &:hover { - background-color: white; - } - } - - .meta-item { - color: @gray; - height: inherit; - line-height: 14px; - padding-top: 8px; - padding-bottom: 8px; - margin: 0; - &:hover { - color: @light-purple; - background-color: white; - } - &.active { - color: @light-purple; - font-weight: 600; - } - } - } - } + .dropdown-wrapper { + .dropdown-content { + li { + min-height: 0; + &:hover { + background-color: white; + } } - .add-button { - height: 32px; - line-height: 32px; - - float: right; - - margin-left: auto; - .btn{ - font-size: 12px; - padding: 0 8px; - margin-top: 4px; - height: 32px; - - .text { - padding-bottom: 4px; - } - i{ - margin-left: 4px; - margin-right: 4px; - line-height: 32px; - - font-size: 1.7em; - - } - } + .meta-item { + color: @gray; + height: inherit; + line-height: 14px; + padding-top: 8px; + padding-bottom: 8px; + margin: 0; + &:hover { + color: @light-purple; + background-color: white; + } + &.active { + color: @light-purple; + font-weight: 600; + } } + } } - } + } + .add-button { + height: 32px; + line-height: 32px; - .edit-thread-modal { - .action-button { - display: inline-block; - color: @dark-blue; - &:hover { - cursor: pointer; - } + float: right; + + margin-left: auto; + .btn { + font-size: 12px; + padding: 0 8px; + margin-top: 4px; + height: 32px; + + .text { + padding-bottom: 4px; + } + i { + margin-left: 4px; + margin-right: 4px; + line-height: 32px; + + font-size: 1.7em; + } } + } + } + } + + .edit-thread-modal { + .action-button { + display: inline-block; + color: @dark-blue; + &:hover { + cursor: pointer; + } + } + } + .new-civi-card { + .new-civi-container { + margin-bottom: 30px; + + .new-civi-title { + margin-bottom: 6px; + } + + .new-civi-header { + margin-bottom: 4px; + } + + .left-input-field input, + .left-input-field label { + left: 0; + } } - .new-civi-card{ - .new-civi-container { - margin-bottom: 30px; - .new-civi-title { - margin-bottom: 6px; - } + .file-preview { + .preview-item { + white-space: nowrap; + overflow: hidden; + } + } + .civi-type-button { + background-color: @dark-white !important; + color: @purple; + margin-right: 4px; + padding: 0 1rem; + font-size: 12px; + line-height: 12px; + + &.current { + background-color: @purple !important; + color: @white; + } + } + } + + .thread-wiki-holder { + min-height: 100vh; + padding: 0; + } + + .thread-wiki { + max-width: 1200px !important; + margin-left: auto !important; + margin-right: auto !important; + + .wiki-banner { + min-height: 30vh; + padding-bottom: 16px; + margin-bottom: 24px; + background-color: @dark-purple; + box-shadow: 0 2px 5px @box-shadow-gray; + + .wiki-title { + padding-top: 80px; + line-height: 24px; + font-size: 16px; + word-wrap: break-word; + } + + .wiki-stats { + padding-top: 10px; + + .wiki-stat { + margin-right: 4px; + } + } + .wiki-author { + .author-photo-holder { + display: inline-block; + width: 40px; + vertical-align: middle; + + .author-photo { + width: 100%; + height: 40px; + border-radius: 50px; + background-color: @white; + } + } - .new-civi-header { - margin-bottom: 4px; - } + .author-info { + display: inline-block; + vertical-align: middle; + margin-left: 6px; - .left-input-field input, .left-input-field label { - left: 0; - } + .author-name { + font-size: 14px; + line-height: 16px; + color: @light-purple; + } + } + } + + .wiki-edit-actions { + line-height: 40px; + .edit-thread-button { + display: inline; + padding: 4px; + &:hover { + cursor: pointer; + i { + color: @blue; } - - .file-preview { - .preview-item { - white-space: nowrap; - overflow: hidden; - } + .edit-text { + color: @blue; } - .civi-type-button { - background-color: @dark-white !important; - color: @purple; - margin-right: 4px; - padding: 0 1rem; - font-size: 12px; - line-height: 12px; + } + } + i { + color: @dark-blue; + vertical-align: text-top; + } + .edit-text { + font-weight: 700; + font-size: 12px; + color: @dark-blue; + line-height: 14px; + display: inline-block; + } + } + } + .wiki-body { + .wiki-body-header { + font-size: 17px; - &.current { - background-color: @purple !important; - color: @white; - } - } + .wiki-header-inner { + margin-right: 6px; + font-size: 17px; } + .wiki-header-category { + margin-right: 20px; + } + } + .wiki-body-summary { + padding-top: 20px; - .thread-wiki-holder { - min-height: 100vh; - padding: 0; - } - - .thread-wiki { - max-width: 1200px !important; - margin-left: auto !important; - margin-right: auto !important; + .wiki-body-summary-title { + padding-bottom: 4px; + font-size: 17px; + border-bottom: 1px solid @dark-white; + } + .wiki-body-summary-text { + padding-top: 10px; + line-height: 25px; + font-size: 14px; + } + } - .wiki-banner { - min-height: 30vh; - padding-bottom: 16px; - margin-bottom: 24px; - background-color: @dark-purple; - box-shadow: 0 2px 5px @box-shadow-gray; + .wiki-contributors { + padding-top: 20px; - .wiki-title { - padding-top: 80px; - line-height: 24px; - font-size: 16px; - word-wrap: break-word; - } + .wiki-contributors-title { + font-size: 15px; + font-weight: 500; + } - .wiki-stats { - padding-top: 10px; + .wiki-contributors-list { + margin-top: 10px; - .wiki-stat { - margin-right: 4px; - } - } - .wiki-author { - .author-photo-holder { - display: inline-block; - width: 40px; - vertical-align: middle; - - .author-photo { - width: 100%; - height: 40px; - border-radius: 50px; - background-color: @white; - } - } + .profile-button-wrapper { + margin-bottom: 12px; + } - .author-info { - display: inline-block; - vertical-align: middle; - margin-left: 6px; + .wiki-contributors-more { + font-size: 13px; + } + } + } - .author-name { - font-size: 14px; - line-height: 16px; - color: @light-purple; - } - } - } + .wiki-facts { + padding-top: 20px; + margin-bottom: 20px; - .wiki-edit-actions { - line-height: 40px; - .edit-thread-button { - display: inline; - padding: 4px; - &:hover { - cursor: pointer; - i { - color: @blue; - } - .edit-text { - color: @blue; - } - } - } - i { - color: @dark-blue; - vertical-align: text-top; - } - .edit-text { - font-weight: 700; - font-size: 12px; - color: @dark-blue; - line-height: 14px; - display: inline-block; + .wiki-facts-title { + padding-bottom: 4px; + font-size: 17px; + border-bottom: 1px solid @dark-white; + } - } - } + .wiki-facts-list { + padding-top: 10px; + font-size: 13px; + line-height: 22px; } + } + } - .wiki-body { + .wiki-image { + float: right; + max-height: 150px; + + .thread-image-wrapper { + margin-top: 40px; + overflow: visible; + height: 250px; + } + .thread-image-thumb { + height: 100%; + } + .thread-image-wrapper { + overflow: hidden; + } + } - .wiki-body-header { - font-size: 17px; + .wiki-enter-body { + margin: 20px 0; - .wiki-header-inner { - margin-right: 6px; - font-size: 17px; - } + .enter-body { + background-color: @purple; + } + } + } - .wiki-header-category { - margin-right: 20px; - } - } + .thread-body-holder { + height: 100vh; + padding: 0; + } - .wiki-body-summary { - padding-top: 20px; + .thread-body { + max-width: 1200px !important; + margin-left: auto !important; + margin-right: auto !important; - .wiki-body-summary-title { - padding-bottom: 4px; - font-size: 17px; - border-bottom: 1px solid @dark-white; - } + .btn { + background-color: @purple; + } - .wiki-body-summary-text { - padding-top: 10px; - line-height: 25px; - font-size: 14px; - } - } + .body-banner { + display: inline-block; - .wiki-contributors { - padding-top: 20px; + // box-shadow: 0 5px 6px -3px rgba(0, 0, 0, 0.4); + // position: relative; + // z-index: 1; - .wiki-contributors-title { - font-size: 15px; - font-weight: 500; - } + .category-topic { + display: inline-block; + font-size: 16px; + line-height: 36px; + height: 36px; + + i { + display: inline-block; + position: relative; + line-height: 36px; + height: 36px; + } + } + + .thread-title { + margin-top: 8px; + font-size: 16px; + line-height: 16px; + font-weight: 700; + } + + .thread-header, + .response-header { + font-size: 18px; + margin-top: 16px; + + button { + margin-right: 20px; + margin-top: -4px; + margin-bottom: 10px; + font-size: 14px; + padding: 0 20px 0 18px; + + i { + margin-right: 4px; + } + } + } + } - .wiki-contributors-list { - margin-top: 10px; + .nav-column { + // box-shadow: 2px 0 2px @box-shadow-gray; + // box-shadow: 0 5px 6px -3px rgba(0, 0, 0, 0.4); + position: relative; + z-index: 2; + background-color: @white; - .profile-button-wrapper { - margin-bottom: 12px; - } + // border-bottom: 1px solid @dark-white; - .wiki-contributors-more { - font-size: 13px; - } - } - } + width: 25%; + margin-left: auto; + left: auto; + right: auto; - .wiki-facts { - padding-top: 20px; - margin-bottom: 20px; + .background-info-link { + background-color: @dark-purple; + margin: 0 -0.75rem; + padding: 6px 0.75rem 16px 0.75rem; - .wiki-facts-title { - padding-bottom: 4px; - font-size: 17px; - border-bottom: 1px solid @dark-white; - } + .enter-wiki { + font-size: 16px; + font-weight: 600; + cursor: pointer; + color: @blue; - .wiki-facts-list { - padding-top: 10px; - font-size: 13px; - line-height: 22px; - } - } + i { + position: relative; + top: 2px; + } } + } - .wiki-image { - float: right; - max-height: 150px; - - .thread-image-wrapper { - margin-top: 40px; - overflow: visible; - height: 250px; + .issue-outline { + .issue-outline-header { + margin: 10px 15px 0 15px; + padding-bottom: 4px; + border-bottom: 1px solid #ddd; - } - .thread-image-thumb { - height: 100%; + i { + cursor: pointer; + &.expanded { + color: @dark-blue; } - .thread-image-wrapper { - overflow: hidden; - } + } } - - .wiki-enter-body { - margin: 20px 0; - - .enter-body { - background-color: @purple; + .civi-switch { + margin: 4px 8px; + color: @dark-gray; + .count-badge { + background-color: #dddddd; + line-height: 16px; + margin-top: 4px; + } + .label-other { + margin-right: 6px; + } + .label-recommended { + margin-left: 10px; + } + .lever { + margin: 0; + width: 32px; + &:after { + width: 18px; + height: 18px; + border-radius: 18px; + top: -2px; } + } + .badge-other.current { + background-color: @red !important; + } + .badge-recommended.current { + background-color: @dark-blue !important; + } } - } - .thread-body-holder { - height: 100vh; - padding: 0; - } + .civi-outline { + overflow-y: scroll; - .thread-body { - max-width: 1200px !important; - margin-left: auto !important; - margin-right: auto !important; + .civi-nav-header { + border-left: 3px solid rgba(0, 0, 0, 0); + padding-left: 4px; + margin: 10px 8px 0 8px; + line-height: 16px; - .btn { - background-color: @purple; - } - - .body-banner { - display: inline-block; - - // box-shadow: 0 5px 6px -3px rgba(0, 0, 0, 0.4); - // position: relative; - // z-index: 1; - - .category-topic { - display: inline-block; - font-size: 16px; - line-height: 36px; - height:36px; - - i { - display: inline-block; - position: relative; - line-height: 36px; - height:36px; - } + .civi-nav-title { + font-size: 16px; } - .thread-title { - margin-top: 8px; - font-size: 16px; - line-height: 16px; - font-weight: 700; + .civi-nav-count { + font-size: 12px; + border-radius: 25px; + background-color: @dark-blue; + font-weight: bold; + padding: 0 8px; + &.other { + background-color: @red; + } } - .thread-header, .response-header { - font-size: 18px; - margin-top: 16px; - - button { - margin-right: 20px; - margin-top: -4px; - margin-bottom: 10px; - font-size: 14px; - padding: 0 20px 0 18px; - - i { - margin-right: 4px; - } - } + &.current { + color: @dark-blue; + border-color: @dark-blue; } - } - - .nav-column { - // box-shadow: 2px 0 2px @box-shadow-gray; - // box-shadow: 0 5px 6px -3px rgba(0, 0, 0, 0.4); - position: relative; - z-index: 2; - background-color: @white; - - - // border-bottom: 1px solid @dark-white; - - width: 25%; - margin-left: auto; - left: auto; - right: auto; - - - .background-info-link { - background-color: @dark-purple; - margin: 0 -0.75rem; - padding: 6px 0.75rem 16px 0.75rem; - - .enter-wiki { - font-size: 16px; - font-weight: 600; - cursor: pointer; - color: @blue; - - i { - position: relative; - top: 2px; - } + } + + .civi-nav-wrapper { + margin: 0 0px 8px 16px; + height: 100%; + + .civi-nav-indiv { + font-size: 14px; + margin: 8px 0 8px 0; + line-height: 16px; + // + // .voted { + // + // color: #cccccc; + // margin-left: -1rem; + // } + .civi-nav-state { + color: @dark-blue; + margin-left: -1rem; + width: 5%; + // margin-right: 4px; + line-height: 16px; + vertical-align: text-bottom; + &.voted { + color: #cccccc; } - } - - .issue-outline { - - .issue-outline-header { - margin: 10px 15px 0 15px; - padding-bottom: 4px; - border-bottom: 1px solid #ddd; + } - i { - cursor: pointer; - - &.expanded { - color: @dark-blue; - } - } - } - .civi-switch { - margin: 4px 8px; - color: @dark-gray; - .count-badge { - background-color: #dddddd; - line-height: 16px; - margin-top: 4px; - - } - .label-other { - margin-right: 6px; - } - .label-recommended { - margin-left: 10px; - } - .lever { - margin: 0; - width: 32px; - &:after { - width: 18px; - height: 18px; - border-radius: 18px; - top: -2px; - } - } - .badge-other.current{ - background-color: @red !important; - } - .badge-recommended.current{ - background-color: @dark-blue !important; - } - } + .civi-nav-link { + width: 95%; + cursor: pointer; + border-left: 3px solid rgba(0, 0, 0, 0); + padding-left: 4px; + display: inline-block; - .civi-outline { - overflow-y: scroll; - - .civi-nav-header { - border-left: 3px solid rgba(0,0,0,0); - padding-left: 4px; - margin: 10px 8px 0 8px; - line-height: 16px; - - .civi-nav-title { - font-size: 16px; - } - - .civi-nav-count { - font-size: 12px; - border-radius: 25px; - background-color: @dark-blue; - font-weight: bold; - padding: 0 8px; - &.other { - background-color: @red; - } - } - - &.current { - color: @dark-blue; - border-color: @dark-blue; - } - } - - .civi-nav-wrapper { - margin: 0 0px 8px 16px; - height: 100%; - display: none; - - .civi-nav-indiv { - font-size: 14px; - margin: 8px 0 8px 0; - line-height: 16px; - // - // .voted { - // - // color: #cccccc; - // margin-left: -1rem; - // } - .civi-nav-state { - color: @dark-blue; - margin-left: -1rem; - width: 5%; - // margin-right: 4px; - line-height:16px; - vertical-align: text-bottom; - &.voted { - color: #cccccc; - } - } - - - .civi-nav-link { - width: 95%; - cursor: pointer; - border-left: 3px solid rgba(0,0,0,0); - padding-left: 4px; - display: inline-block; - - - &.current { - color: @dark-blue !important; - border-color: @dark-blue; - } - } - } - } + &.current { + color: @dark-blue !important; + border-color: @dark-blue; } + } } + } } + } + } - .main-thread { - // z-index: 1; - overflow-y: scroll; - overflow-x: hidden; - padding: 15px 16px 0 16px; - border-left: 1px solid @dark-white; - border-right: 1px solid @dark-white; - - width: 40%; - margin-left: auto; - left: auto; - right: auto; - } + .main-thread { + // z-index: 1; + overflow-y: scroll; + overflow-x: hidden; + padding: 15px 16px 0 16px; + border-left: 1px solid @dark-white; + border-right: 1px solid @dark-white; + + width: 40%; + margin-left: auto; + left: auto; + right: auto; + } - .responses { - width: 35%; - margin-left: auto; - left: auto; - right: auto; - // z-index: 1; - overflow-y: scroll; - overflow-x: hidden; - padding: 15px 15px 0 15px; - // border-left: 1px solid #ddd; - // box-shadow: 0 2px 5px @box-shadow-gray; - .scroll-padding { - width: 100%; - } - } + .responses { + width: 35%; + margin-left: auto; + left: auto; + right: auto; + // z-index: 1; + overflow-y: scroll; + overflow-x: hidden; + padding: 15px 15px 0 15px; + // border-left: 1px solid #ddd; + // box-shadow: 0 2px 5px @box-shadow-gray; + .scroll-padding { + width: 100%; + } } + } - .civi-load-more { - text-transform: uppercase; - text-align: center; - color: @lightish-gray; - font-size: 12px; - .civi-show-count { - font-size: 10px; - } - .btn-loadmore { - color: @dark-blue; - font-weight: 700; - &:hover { - cursor: pointer; - color: @blue; - } - } + .civi-load-more { + text-transform: uppercase; + text-align: center; + color: @lightish-gray; + font-size: 12px; + .civi-show-count { + font-size: 10px; } - .main-thread .civi-load-more{ - background-color: @dark-white; - border-radius: 5px; - margin-bottom: 24px; - min-height: 160px; - height: 160px; - padding-top: 72px; + .btn-loadmore { + color: @dark-blue; + font-weight: 700; + &:hover { + cursor: pointer; + color: @blue; + } } + } + .main-thread .civi-load-more { + background-color: @dark-white; + border-radius: 5px; + margin-bottom: 24px; + min-height: 160px; + height: 160px; + padding-top: 72px; + } } diff --git a/project/core/templates/static_nav.html b/project/core/templates/static_nav.html index 5e0e8f93a..2754df967 100644 --- a/project/core/templates/static_nav.html +++ b/project/core/templates/static_nav.html @@ -13,20 +13,20 @@ - + menu diff --git a/project/threads/models.py b/project/threads/models.py index 219142dce..0a5429853 100644 --- a/project/threads/models.py +++ b/project/threads/models.py @@ -102,8 +102,8 @@ def image_url(self): # TODO: move this to utils is_draft = models.BooleanField(default=True) num_views = models.IntegerField(default=0) - num_civis = models.IntegerField(default=0) - num_solutions = models.IntegerField(default=0) + num_civis = models.IntegerField(default=0) # TODO To be dropped + num_solutions = models.IntegerField(default=0) # TODO To be dropped objects = ThreadManager() @@ -113,30 +113,25 @@ def created_date_str(self): return f"{month_name[d.month]} {d.day}, {d.year}" @property - def solutions(self): - voted_solutions = Activity.objects.filter( - user=self.author.id, civi__c_type="solution", activity_type__contains="pos" + def contributors(self): + return get_user_model().objects.filter( + pk__in=self.civis.order_by("-created") + .values_list("author", flat=True) + .order_by("author") + .distinct() ) - solution_list = [] - solution_threads = voted_solutions.values("thread__id").distinct() - if self.id in solution_threads: - solution_civis = voted_solutions.filter(thread=self.id).values_list( - "civi__id", flat=True - ) - for civi_id in solution_civis: - c = Civi.objects.get(id=civi_id) - vote = voted_solutions.get(civi__id=civi_id).activity_type - vote_types = {"vote_pos": "Agree", "vote_vpos": "Strongly Agree"} - solution_item = { - "id": c.id, - "title": c.title, - "body": c.body, - "user_vote": vote_types.get(vote), - } - solution_list.append(solution_item) - - return solution_list + @property + def problem_civis(self): + return self.civis.filter(c_type="problem") + + @property + def cause_civis(self): + return self.civis.filter(c_type="cause") + + @property + def solution_civis(self): + return self.civis.filter(c_type="solution") class CiviManager(models.Manager): diff --git a/project/threads/templates/threads/thread.html b/project/threads/templates/threads/thread.html index 5949dd1e5..fabf83087 100644 --- a/project/threads/templates/threads/thread.html +++ b/project/threads/templates/threads/thread.html @@ -1,948 +1,1227 @@ {% extends "base.html" %} {% load static %} {% load i18n %} - -{% block extra_css %} - - - +{% block extra_css%} + + + {% endblock extra_css %} - -{% block backbone_template %} - - - - - - - - - - - - - - - - +