mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-16 03:29:16 +00:00
moved directory structure
This commit is contained in:
1
home/page/activity/__init__.py
Normal file
1
home/page/activity/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
||||
23
home/page/activity/activity.css
Normal file
23
home/page/activity/activity.css
Normal file
@@ -0,0 +1,23 @@
|
||||
#activity-list .label {
|
||||
display: inline-block;
|
||||
width: 100px;
|
||||
margin-right: 7px;
|
||||
}
|
||||
|
||||
#activity-list .label-info {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#activity-list .user-info {
|
||||
float: right;
|
||||
color: #777;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
#activity-list .date-sep {
|
||||
margin-bottom: 11px;
|
||||
padding: 5px 0px;
|
||||
border-bottom: 1px solid #aaa;
|
||||
color: #555;
|
||||
font-size: 10px;
|
||||
}
|
||||
7
home/page/activity/activity.html
Normal file
7
home/page/activity/activity.html
Normal file
@@ -0,0 +1,7 @@
|
||||
<div class="layout-wrapper layout-wrapper-appframe">
|
||||
<div class="layout-appframe"></div>
|
||||
<div class="layout-main">
|
||||
<div id="activity-list">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
67
home/page/activity/activity.js
Normal file
67
home/page/activity/activity.js
Normal file
@@ -0,0 +1,67 @@
|
||||
wn.pages['activity'].onload = function(wrapper) {
|
||||
wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.layout-appframe'));
|
||||
wrapper.appframe.title('Activity');
|
||||
var list = new wn.ui.Listing({
|
||||
appframe: wrapper.appframe,
|
||||
method: 'home.page.activity.activity.get_feed',
|
||||
parent: $('#activity-list'),
|
||||
render_row: function(row, data) {
|
||||
new erpnext.ActivityFeed(row, data);
|
||||
}
|
||||
});
|
||||
list.run();
|
||||
}
|
||||
|
||||
erpnext.last_feed_date = false;
|
||||
erpnext.ActivityFeed = Class.extend({
|
||||
init: function(row, data) {
|
||||
this.scrub_data(data);
|
||||
this.add_date_separator(row, data);
|
||||
$(row).append(sprintf('<div style="margin: 0px">\
|
||||
<span class="avatar-small"><img src="%(imgsrc)s" /></span> \
|
||||
<span %(onclick)s class="label %(add_class)s">%(feed_type)s</span>\
|
||||
%(link)s %(subject)s <span class="user-info">%(by)s</span></div>', data));
|
||||
},
|
||||
scrub_data: function(data) {
|
||||
data.by = wn.user_info(data.owner).fullname;
|
||||
data.imgsrc = wn.user_info(data.owner).image;
|
||||
|
||||
// feedtype
|
||||
if(!data.feed_type) {
|
||||
data.feed_type = get_doctype_label(data.doc_type);
|
||||
data.add_class = "label-info";
|
||||
data.onclick = repl('onclick="window.location.href=\'#!List/%(feed_type)s\';"', data)
|
||||
}
|
||||
|
||||
// color for comment
|
||||
if(data.feed_type=='Comment') {
|
||||
data.add_class = "label-important";
|
||||
}
|
||||
|
||||
if(data.feed_type=='Assignment') {
|
||||
data.add_class = "label-warning";
|
||||
}
|
||||
|
||||
// link
|
||||
if(data.doc_name && data.feed_type!='Login') {
|
||||
data.link = repl('<a href="#!Form/%(doc_type)s/%(doc_name)s">%(doc_name)s</a>', data)
|
||||
}
|
||||
},
|
||||
add_date_separator: function(row, data) {
|
||||
var date = dateutil.str_to_obj(data.modified);
|
||||
var last = erpnext.last_feed_date;
|
||||
|
||||
if((last && dateutil.obj_to_str(last) != dateutil.obj_to_str(date)) || (!last)) {
|
||||
var diff = dateutil.get_day_diff(new Date(), date);
|
||||
if(diff < 1) {
|
||||
pdate = 'Today';
|
||||
} else if(diff < 2) {
|
||||
pdate = 'Yesterday';
|
||||
} else {
|
||||
pdate = dateutil.global_date_format(date);
|
||||
}
|
||||
$(row).html(repl('<div class="date-sep">%(date)s</div>', {date: pdate}));
|
||||
}
|
||||
erpnext.last_feed_date = date;
|
||||
}
|
||||
})
|
||||
17
home/page/activity/activity.py
Normal file
17
home/page/activity/activity.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_feed(arg=None):
|
||||
"""get feed"""
|
||||
return webnotes.conn.sql("""select
|
||||
distinct t1.name, t1.feed_type, t1.doc_type, t1.doc_name, t1.subject, t1.owner,
|
||||
t1.modified
|
||||
from tabFeed t1, tabDocPerm t2
|
||||
where t1.doc_type = t2.parent
|
||||
and t2.role in ('%s')
|
||||
and ifnull(t2.`read`,0) = 1
|
||||
order by t1.modified desc
|
||||
limit %s, %s""" % ("','".join(webnotes.get_roles()),
|
||||
webnotes.form_dict['limit_start'], webnotes.form_dict['limit_page_length']),
|
||||
as_dict=1)
|
||||
28
home/page/activity/activity.txt
Normal file
28
home/page/activity/activity.txt
Normal file
@@ -0,0 +1,28 @@
|
||||
# Page, activity
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-02-29 11:59:13',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-02-29 12:11:46',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all Page
|
||||
{
|
||||
'doctype': 'Page',
|
||||
'module': u'Home',
|
||||
'name': '__common__',
|
||||
'page_name': u'activity',
|
||||
'standard': u'Yes',
|
||||
'title': u'Activity'
|
||||
},
|
||||
|
||||
# Page, activity
|
||||
{
|
||||
'doctype': 'Page',
|
||||
'name': u'activity'
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user