Commit 8a92f2b388823cb10e520c31c6dc96b148a1f2f3

Authored by Zambom
1 parent bf46f0ba

Changin mural posts style

amadeus/static/css/base/amadeus.css
... ... @@ -947,7 +947,7 @@ li.item .notify_badge {
947 947 .mural .post_make .panel-body {
948 948 padding: 0;
949 949 }
950   -.mural .post_make .user-img {
  950 +.mural .post_make .user-img, .post .post-img {
951 951 padding: 0;
952 952 display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6 */
953 953 display: -moz-box; /* OLD - Firefox 19- (buggy but mostly works) */
... ... @@ -977,4 +977,72 @@ li.item .notify_badge {
977 977 .post-button {
978 978 padding-right: inherit !important;
979 979 padding-left: inherit !important;
  980 +}
  981 +
  982 +.post .post-body {
  983 + padding-right: 0;
  984 +}
  985 +
  986 +.post .post-user {
  987 + margin-top: 0;
  988 + margin-bottom: 5px;
  989 + font-size: 18px;
  990 + font-weight: 700;
  991 +}
  992 +
  993 +.post .post-user .btn-group {
  994 + margin: 0;
  995 +}
  996 +
  997 +.post .post-user .btn-group .btn_menu i {
  998 + font-size: 18px;
  999 +}
  1000 +
  1001 +.post .post-user .user-action {
  1002 + padding-left: 5px;
  1003 + font-size: 16px;
  1004 + font-weight: normal;
  1005 +}
  1006 +
  1007 +.post .post-user .user-action i {
  1008 + font-size: 22px;
  1009 +}
  1010 +
  1011 +.post .time {
  1012 + font-size: 14px;
  1013 +}
  1014 +
  1015 +.post .post-comment {
  1016 + margin-top: 10px;
  1017 + border-top-width: 1px;
  1018 + border-top-style: solid;
  1019 + padding: 10px 0px 8px 0px;
  1020 +}
  1021 +
  1022 +.post .post-comment .user-img {
  1023 + display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6 */
  1024 + display: -moz-box; /* OLD - Firefox 19- (buggy but mostly works) */
  1025 + display: -ms-flexbox; /* TWEENER - IE 10 */
  1026 + display: -webkit-flex; /* NEW - Chrome */
  1027 + display: flex; /* NEW, Spec - Opera 12.1, Firefox 20+ */
  1028 + flex-direction: column;
  1029 + justify-content: center;
  1030 +}
  1031 +
  1032 +.post .post-comment .comment-field {
  1033 + padding-left: 0px;
  1034 +}
  1035 +
  1036 +.post .post-comment .comment-field div {
  1037 + border-width: 1px;
  1038 + border-style: solid;
  1039 +}
  1040 +
  1041 +.post .post-comment .comment-field h4 {
  1042 + margin: 5px 0px;
  1043 + line-height: 1.8em;
  1044 + padding-left: 10px;
  1045 + font-size: 14px;
  1046 + font-style: italic;
  1047 + cursor: text;
980 1048 }
981 1049 \ No newline at end of file
... ...
amadeus/static/css/themes/green.css
... ... @@ -504,10 +504,32 @@ a.add-row {
504 504 color: #CCCCCC;
505 505 }
506 506  
507   -.post_action i {
  507 +.post_action i, .post .post-user .user-action i {
508 508 color: #1d8fe0;
509 509 }
510 510  
  511 +.post .post-user {
  512 + color: #4caf50;
  513 +}
  514 +
  515 +.post .post-user .user-action {
  516 + color: #BBBBBB;
  517 +}
  518 +
  519 +.post .time {
  520 + color: #ABABAB;
  521 +}
  522 +
  523 +.post .post-comment {
  524 + border-top-color: #888888;
  525 + background: #D5D5D5;
  526 +}
  527 +
  528 +.post .post-comment .comment-field div {
  529 + border-color: #888888;
  530 + background: #FFFFFF;
  531 +}
  532 +
511 533 @media(max-width: 768px) {
512 534 .navbar .navbar-nav .dropdown .dropdown-menu li > a {
513 535 color: #333333 !important;
... ...
mural/templates/mural/_view.html
  1 +{% load i18n mural_filters %}
  2 +
1 3 <div class="row panel panel-default">
2   - <div class="panel-body">
3   - {{ post.user }}
  4 + <div class="panel-body post">
  5 + <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 post-img">
  6 + <img src="{{ post.user.image_url }}" class="img-responsive" />
  7 + </div>
  8 + <div class="col-lg-11 col-md-11 col-sm-11 col-xs-11 post-body">
  9 + <h4 class="post-user">
  10 + {{ post.user }}
  11 + <span class="user-action">
  12 + <i class="fa {{ post.action|action_icon }}"></i>
  13 + {{ post.get_action_display }}
  14 + </span>
  15 + {% if request.user == post.user %}
  16 + <span class="btn-group pull-right">
  17 + <button class="btn btn-sm btn_menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  18 + <i class="fa fa-ellipsis-v" aria-hidden="true"></i>
  19 + </button>
  20 + <ul class="dropdown-menu pull-right" aria-labelledby="moreActions">
  21 + <li><a href=""><i class="fa fa-pencil fa-fw" aria-hidden="true"></i> {% trans 'Edit' %}</a></li>
  22 + <li>
  23 + <a href="" aria-hidden="true"><i class="fa fa-trash fa-fw" aria-hidden="true"></i> {% trans 'Remove' %}</a></li>
  24 + </ul>
  25 + </span>
  26 + {% endif %}
  27 + </h4>
  28 + <p class="time">
  29 + <i class="fa fa-clock-o"></i>
  30 + {% trans 'In' %} {{ post.last_update }}
  31 + </p>
  32 +
  33 + {% autoescape off %}
  34 + {{ post.post }}
  35 + {% endautoescape %}
  36 +
  37 + {% if post.image %}
  38 + <img src="{{ post.image.url }}" class="img-responsive center-block" />
  39 + {% endif %}
  40 +
  41 + </div>
  42 + <div class="col-md-12 post-comment">
  43 + <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 user-img">
  44 + <img src="{{ request.user.image_url }}" class="img-responsive" />
  45 + </div>
  46 + <div class="col-lg-11 col-md-11 col-sm-11 col-xs-11 comment-field">
  47 + <div>
  48 + <h4 data-url="{% url 'mural:create_general' %}">{% trans 'Make a comment...' %}</h4>
  49 + </div>
  50 + </div>
  51 + </div>
4 52 </div>
5 53 </div>
6 54 \ No newline at end of file
... ...
mural/templates/mural/list.html
... ... @@ -73,11 +73,14 @@
73 73 var frm = $('#post-form');
74 74  
75 75 frm.submit(function () {
  76 + var formData = new FormData($(this)[0]);
  77 +
76 78 $.ajax({
77 79 type: frm.attr('method'),
78 80 url: frm.attr('action'),
79   - data: frm.serialize(),
  81 + data: formData,
80 82 dataType: "json",
  83 + async: false,
81 84 success: function (data) {
82 85 $('.posts').prepend(data.view);
83 86  
... ... @@ -90,7 +93,10 @@
90 93 error: function(data) {
91 94 $(".modal").html(data.responseText);
92 95 setPostFormSubmit();
93   - }
  96 + },
  97 + cache: false,
  98 + contentType: false,
  99 + processData: false
94 100 });
95 101  
96 102 return false;
... ...
mural/templatetags/__init__.py 0 → 100644
mural/templatetags/mural_filters.py 0 → 100644
... ... @@ -0,0 +1,12 @@
  1 +from django import template
  2 +
  3 +register = template.Library()
  4 +
  5 +@register.filter(name = 'action_icon')
  6 +def action_icon(action):
  7 + if action == "comment":
  8 + icon = "fa-commenting-o"
  9 + elif action == "help":
  10 + icon = "fa-comments-o"
  11 +
  12 + return icon
0 13 \ No newline at end of file
... ...
mural/views.py
... ... @@ -27,7 +27,7 @@ class GeneralIndex(LoginRequiredMixin, generic.ListView):
27 27 def get_queryset(self):
28 28 user = self.request.user
29 29  
30   - general = GeneralPost.objects.all()
  30 + general = GeneralPost.objects.extra(select={"most_recent": "greatest(last_update, (select max(mural_comment.last_update) from mural_comment where mural_comment.post_id = mural_generalpost.mural_ptr_id))"}).order_by("-most_recent")
31 31  
32 32 self.totals['general'] = MuralVisualizations.objects.filter(Q(user = user) & Q(viewed = False) & (Q(post__generalpost__isnull = False) | Q(comment__post__generalpost__isnull = False))).distinct().count()
33 33 self.totals['category'] = MuralVisualizations.objects.filter(Q(user = user) & Q(viewed = False) & (Q(post__categorypost__space__coordinators = user) | Q(comment__post__categorypost__space__coordinators = user) | Q(post__categorypost__space__subject_category__professor = user) | Q(post__categorypost__space__subject_category__students = user) | Q(comment__post__categorypost__space__subject_category__professor = user) | Q(comment__post__categorypost__space__subject_category__students = user))).distinct().count()
... ...