diff --git a/frappe/public/js/frappe/social/components/Post.vue b/frappe/public/js/frappe/social/components/Post.vue index e4de0ede52..8d1709a193 100644 --- a/frappe/public/js/frappe/social/components/Post.vue +++ b/frappe/public/js/frappe/social/components/Post.vue @@ -1,42 +1,42 @@ + + diff --git a/frappe/public/js/frappe/social/components/PostAction.vue b/frappe/public/js/frappe/social/components/PostAction.vue index 2aacd6cf83..a29dbca8e3 100644 --- a/frappe/public/js/frappe/social/components/PostAction.vue +++ b/frappe/public/js/frappe/social/components/PostAction.vue @@ -2,25 +2,20 @@
-
+
-
- - {{ reply_count }} +
+ Like
-
- - - +
+ Comment +
+
+ + . + {{ comment_count }} comments
@@ -30,7 +25,7 @@ export default { 'liked_by': { 'type': String, }, - 'reply_count': { + 'comment_count': { 'type': Number, 'default': 0, }, @@ -68,12 +63,12 @@ export default { diff --git a/frappe/public/js/frappe/social/pages/Profile.vue b/frappe/public/js/frappe/social/pages/Profile.vue index 524061f456..e4b69702e2 100644 --- a/frappe/public/js/frappe/social/pages/Profile.vue +++ b/frappe/public/js/frappe/social/pages/Profile.vue @@ -28,12 +28,7 @@
- + @@ -56,15 +51,9 @@ export default { } }, computed: { - pinned_posts() { - return this.user_posts.filter(post => post.is_pinned) - }, - other_posts() { - return this.user_posts.filter(post => !post.is_pinned) - }, current_list() { if(this.show_list == 'user_posts') { - return this.other_posts; + return this.user_posts; } else { return this.liked_posts; } @@ -105,7 +94,7 @@ export default { .profile-sidebar { margin-top: 50px; } -.pinned-posts { +.right-sidebar { margin-top: 5px; } .list-options { diff --git a/frappe/public/js/frappe/social/pages/Wall.vue b/frappe/public/js/frappe/social/pages/Wall.vue index 79daba79bd..c0556d922d 100644 --- a/frappe/public/js/frappe/social/pages/Wall.vue +++ b/frappe/public/js/frappe/social/pages/Wall.vue @@ -6,17 +6,18 @@ {{ new_posts_count + ' new post'}}
- - + +
+
+ No Posts Yet ! +
+ +
Loading old posts
That's all folks
- @@ -56,7 +57,7 @@ export default { return this.posts.filter((post) => post.is_globally_pinned) }, user_posts() { - return this.posts.filter((post) => !post.is_globally_pinned) + return this.posts; } }, methods: { diff --git a/frappe/public/js/frappe/social/social_home.js b/frappe/public/js/frappe/social/social_home.js index c1b2029648..dbf6e50b27 100644 --- a/frappe/public/js/frappe/social/social_home.js +++ b/frappe/public/js/frappe/social/social_home.js @@ -25,46 +25,31 @@ frappe.social.Home = class SocialHome { } set_primary_action() { this.page.set_primary_action(__('Post'), () => { - frappe.social.post_dialog.open(); + frappe.social.post_dialog.show(); }); } }; -frappe.social.post_dialog = { - open(title=__('Create Post'), button_label=__('Post'), reply_to=null) { - const d = new frappe.ui.Dialog({ - title, - fields: [ - { - fieldtype: "Text Editor", - fieldname: "content", - label: __("Content"), - reqd: 1 - }, - { - fieldtype: "Link", - fieldname: "reply_to", - label: __("Reply"), - hidden: 1, - default: reply_to - } - ], - primary_action_label: title, - primary_action: (values) => { - const post = frappe.model.get_new_doc('Post'); - post.content = values.content; - if (values.reply_to) { - post.reply_to = values.reply_to; - } - frappe.db.insert(post).then(() => { - d.hide(); - }); - } +frappe.social.post_dialog = new frappe.ui.Dialog({ + title: __('Create Post'), + fields: [ + { + fieldtype: "Text Editor", + fieldname: "content", + label: __("Content"), + reqd: 1 + } + ], + primary_action_label: __('Post'), + primary_action: (values) => { + const post = frappe.model.get_new_doc('Post'); + post.content = values.content; + frappe.db.insert(post).then(() => { + frappe.social.post_dialog.clear(); + frappe.social.post_dialog.hide(); }); - - d.show(); } -}; +}); frappe.social.update_user_image = new frappe.ui.Dialog({ title: __("User Image"), @@ -78,8 +63,7 @@ frappe.social.update_user_image = new frappe.ui.Dialog({ }, ], primary_action_label: __('Set Image'), - primary_action: () => { - const values = frappe.social.update_user_image.get_values(); + primary_action: (values) => { frappe.db.set_value('User', frappe.session.user, 'user_image', values.image) .then((resp) => { frappe.boot.user_info[frappe.session.user].image = resp.message.user_image; diff --git a/frappe/public/less/social.less b/frappe/public/less/social.less index 3db4558f5a..5979c974e4 100644 --- a/frappe/public/less/social.less +++ b/frappe/public/less/social.less @@ -2,6 +2,10 @@ @import (reference) 'common.less'; body[data-route*="social"] { + .page-container { + background: #FAFBFC; + } + .layout-main-section { border: none; } @@ -16,15 +20,18 @@ body[data-route*="social"] { .wall-container { display: flex; font-size: 12px; + .no-post { + .icon { + font-size: 40px; + } + } .post-sidebar { flex: 20% } .post-container { - width: 500px; + flex: 45%; display: flex; - margin: 0 20px; - margin-top: 24px; - padding-top: 10px; + padding: 20px; flex-direction: column; .new_posts_count { cursor: pointer; @@ -33,7 +40,7 @@ body[data-route*="social"] { margin-bottom: 10px; } } - .pinned-posts { + .right-sidebar { padding: 0px; flex: 35% } @@ -47,27 +54,25 @@ body[data-route*="social"] { .post-container { flex: 45% } - .pinned-posts { + .right-sidebar { padding: 0px; flex: 35% } } .generic-card() { + background: white; font-size: 12px; margin-bottom: 10px; - max-width: 500px; - max-height: 500px; min-height: 70px; overflow: scroll; border: 1px solid @border-color; - border-radius: 3px; - padding: 10px 10px 5px 10px; + border-radius: 4px; .content { font-size: 14px; img, iframe { border-radius: 5px; - border: none; + border: 1px solid @light-border-color; margin: 5px 0; } img { @@ -79,41 +84,28 @@ body[data-route*="social"] { } } - .event-card { - .generic-card(); - .content { - text-align: center; - clear: both; - } - } - .post-card { .generic-card(); - .user-name { - font-weight: 400; - } - .user-avatar { - float: left; - margin-right: 5px; - .avatar { - width: 48px; - height: 48px; + .post-body { + padding: 10px; + .user-name { + font-weight: 500; } - .avatar-frame, .standard-image { - border-radius: 50%; + .user-avatar { + float: left; + margin-right: 5px; + } + .user-avatar, .user-name { + cursor: pointer; + } + .content { + margin: 10px 0 0 46px; } } - .user-name { - margin-bottom: 5px; - } - .user-avatar, .user-name { - cursor: pointer; - } - .content { - margin-left: 58px; - } - .post-reply { - margin-left: 20px; + .post-action-container { + padding-left: 46px; + background-color: #F6F6F6; + border-top: 1px solid @border-color; } } diff --git a/frappe/social/doctype/post/post.json b/frappe/social/doctype/post/post.json index 558c763f12..0f6ef25e95 100644 --- a/frappe/social/doctype/post/post.json +++ b/frappe/social/doctype/post/post.json @@ -1,5 +1,6 @@ { "allow_copy": 0, + "allow_events_in_timeline": 0, "allow_guest_to_view": 0, "allow_import": 0, "allow_rename": 0, @@ -51,8 +52,8 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "reply_to", - "fieldtype": "Link", + "fieldname": "comments", + "fieldtype": "Table", "hidden": 1, "ignore_user_permissions": 0, "ignore_xss_filter": 0, @@ -60,43 +61,10 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Reply To", + "label": "comments", "length": 0, "no_copy": 0, - "options": "Post", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "type", - "fieldtype": "Select", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Type", - "length": 0, - "no_copy": 0, - "options": "post\nevent", + "options": "Post Comment", "permlevel": 0, "precision": "", "print_hide": 0, @@ -142,38 +110,6 @@ "translatable": 0, "unique": 0 }, - { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "is_globally_pinned", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Is Globally Pinned ", - "length": 0, - "no_copy": 0, - "permlevel": 1, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, { "allow_bulk_edit": 0, "allow_in_quick_entry": 0, @@ -205,6 +141,38 @@ "set_only_once": 0, "translatable": 0, "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "is_globally_pinned", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Is Globally Pinned", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 } ], "has_web_view": 0, @@ -217,7 +185,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2018-10-05 10:56:45.871676", + "modified": "2018-10-14 10:20:35.430108", "modified_by": "Administrator", "module": "Social", "name": "Post", diff --git a/frappe/social/doctype/post/post.py b/frappe/social/doctype/post/post.py index 0ec4ec102d..f9783e7523 100644 --- a/frappe/social/doctype/post/post.py +++ b/frappe/social/doctype/post/post.py @@ -15,10 +15,7 @@ class Post(Document): def after_insert(self): - if self.reply_to: - frappe.publish_realtime('new_post_reply' + self.reply_to, self, after_commit=True) - else: - frappe.publish_realtime('new_post', self.owner, after_commit=True) + frappe.publish_realtime('new_post', self.owner, after_commit=True) @frappe.whitelist() def get_profile_data(post_user): @@ -30,7 +27,7 @@ def get_profile_data(post_user): user_post = frappe.db.get_list( 'Post', fields=['name', 'content', 'owner', 'creation', 'liked_by', 'is_pinned'], - filters={"owner":['like',post_user]} + filters={"owner":['like', post_user]} ) return { 'liked_posts': liked_post, diff --git a/frappe/social/doctype/post_comment/__init__.py b/frappe/social/doctype/post_comment/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/frappe/social/doctype/post_comment/post_comment.js b/frappe/social/doctype/post_comment/post_comment.js new file mode 100644 index 0000000000..bb0a198a05 --- /dev/null +++ b/frappe/social/doctype/post_comment/post_comment.js @@ -0,0 +1,8 @@ +// Copyright (c) 2018, Frappe Technologies and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Post Comment', { + refresh: function(frm) { + + } +}); diff --git a/frappe/social/doctype/post_comment/post_comment.json b/frappe/social/doctype/post_comment/post_comment.json new file mode 100644 index 0000000000..940147c9af --- /dev/null +++ b/frappe/social/doctype/post_comment/post_comment.json @@ -0,0 +1,114 @@ +{ + "allow_copy": 0, + "allow_events_in_timeline": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2018-10-14 10:16:22.852930", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "content", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Content", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2018-10-15 07:46:12.504396", + "modified_by": "Administrator", + "module": "Social", + "name": "Post Comment", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + }, + { + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 0, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "All", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 0, + "track_seen": 0, + "track_views": 0 +} \ No newline at end of file diff --git a/frappe/social/doctype/post_comment/post_comment.py b/frappe/social/doctype/post_comment/post_comment.py new file mode 100644 index 0000000000..d29ed160c1 --- /dev/null +++ b/frappe/social/doctype/post_comment/post_comment.py @@ -0,0 +1,11 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, Frappe Technologies and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class PostComment(Document): + def after_insert(self): + frappe.publish_realtime('new_post_comment' + self.parent, self, after_commit=True)