diff --git a/frappe/build.py b/frappe/build.py index b7c56356d2..13373ae897 100644 --- a/frappe/build.py +++ b/frappe/build.py @@ -98,7 +98,9 @@ def pack(target, sources, no_compress, verbose): for f in sources: suffix = None if ':' in f: f, suffix = f.split(':') - if not os.path.exists(f) or os.path.isdir(f): continue + if not os.path.exists(f) or os.path.isdir(f): + print "did not find " + f + continue timestamps[f] = os.path.getmtime(f) try: with open(f, 'r') as sourcefile: diff --git a/frappe/core/doctype/comment/test_records.json b/frappe/core/doctype/comment/test_records.json index 2c213721dc..5552a3fcec 100644 --- a/frappe/core/doctype/comment/test_records.json +++ b/frappe/core/doctype/comment/test_records.json @@ -1,6 +1,7 @@ [ { "doctype": "Comment", - "name": "_Test Comment 1" + "name": "_Test Comment 1", + "comment": "test comment" } ] diff --git a/frappe/core/doctype/doctype/doctype.py b/frappe/core/doctype/doctype/doctype.py index 2be779b001..a5326199e5 100644 --- a/frappe/core/doctype/doctype/doctype.py +++ b/frappe/core/doctype/doctype/doctype.py @@ -229,12 +229,16 @@ def validate_fields(fields): frappe.throw(_("Options 'Dynamic Link' type of field must point to another Link Field with options as 'DocType'")) def check_fold(fields): + fold_exists = False for i, f in enumerate(fields): if f.fieldtype=="Fold": - prev = fields[i-1] - if prev.fieldtype != "Section Break" \ - or (prev.fieldtype=="Section Break" and not prev.label): - frappe.throw(_("Fold must come after labelled Section Break")) + if fold_exists: + frappe.throw(_("There can be only one Fold in a form")) + fold_exists = True + nxt = fields[i+1] + if nxt.fieldtype != "Section Break" \ + or (nxt.fieldtype=="Section Break" and not nxt.label): + frappe.throw(_("Fold must come before a labelled Section Break")) for d in fields: if not d.permlevel: d.permlevel = 0 diff --git a/frappe/model/document.py b/frappe/model/document.py index 530693504c..069e184cf6 100644 --- a/frappe/model/document.py +++ b/frappe/model/document.py @@ -576,3 +576,4 @@ class Document(BaseDocument): "comment_docname": self.name, "comment": text or comment_type }).insert(ignore_permissions=True) + return comment diff --git a/frappe/public/build.json b/frappe/public/build.json index 3fdab1d5c5..422ecdeb60 100644 --- a/frappe/public/build.json +++ b/frappe/public/build.json @@ -33,6 +33,7 @@ "public/css/tag-it.css", "public/css/bootstrap.css", "public/css/font-awesome.css", + "public/css/octicons/octicons.css", "public/css/desk.css", "public/css/appframe.css", "public/css/app_icon.css", diff --git a/frappe/public/css/desk.css b/frappe/public/css/desk.css index 83138bf4cb..14b1adf873 100644 --- a/frappe/public/css/desk.css +++ b/frappe/public/css/desk.css @@ -115,21 +115,16 @@ div#freeze { margin-top: 3px; } -.icon-in-circle { - color: #b7b7b7; - background-color: white; - border-radius:50%; - text-align: center; - width: 20px; - height: 20px; - font-size: 20px; - display: inline-block; -} - .form-layout { /*margin-top: -15px;*/ } +.form-print-wrapper { + margin: 0px -15px -15px -15px; + background-color: #ddd; + padding: 0px 15px 30px 15px; +} + .form-page-header { border-top: 1px solid #eee; margin: 15px -15px -15px -15px; @@ -302,7 +297,7 @@ div#freeze { color: #fff; height: 29px; width: 29px; - padding: 7px 9px; + padding: 8px 9px 7px 9px; border-radius: 50%; background-color: #d7d7d7; text-align: center; @@ -363,6 +358,14 @@ ul.linked-with-list li { cursor: pointer; } +.data-row { + margin-left: -20px; +} + +.row-index { + text-align: right; +} + .grid-row .panel { background-color: #fffff8; } diff --git a/frappe/public/css/octicons/LICENSE.txt b/frappe/public/css/octicons/LICENSE.txt new file mode 100755 index 0000000000..259b43d14d --- /dev/null +++ b/frappe/public/css/octicons/LICENSE.txt @@ -0,0 +1,9 @@ +(c) 2012-2014 GitHub + +When using the GitHub logos, be sure to follow the GitHub logo guidelines (https://github.com/logos) + +Font License: SIL OFL 1.1 (http://scripts.sil.org/OFL) +Applies to all font files + +Code License: MIT (http://choosealicense.com/licenses/mit/) +Applies to all other files diff --git a/frappe/public/css/octicons/README.md b/frappe/public/css/octicons/README.md new file mode 100755 index 0000000000..1007073350 --- /dev/null +++ b/frappe/public/css/octicons/README.md @@ -0,0 +1 @@ +If you intend to install Octicons locally, install `octicons-local.ttf`. It should appear as “github-octicons” in your font list. It is specially designed not to conflict with GitHub's web fonts. diff --git a/frappe/public/css/octicons/octicons-local.ttf b/frappe/public/css/octicons/octicons-local.ttf new file mode 100755 index 0000000000..62bcbb3ae0 Binary files /dev/null and b/frappe/public/css/octicons/octicons-local.ttf differ diff --git a/frappe/public/css/octicons/octicons.css b/frappe/public/css/octicons/octicons.css new file mode 100755 index 0000000000..dd05c96320 --- /dev/null +++ b/frappe/public/css/octicons/octicons.css @@ -0,0 +1,245 @@ +@font-face { + font-family: 'octicons'; + src: url('/assets/frappe/css/octicons/octicons.eot?#iefix') format('embedded-opentype'), + url('/assets/frappe/css/octicons/octicons.woff') format('woff'), + url('/assets/frappe/css/octicons/octicons.ttf') format('truetype'), + url('/assets/frappe/css/octicons/octicons.svg#octicons') format('svg'); + font-weight: normal; + font-style: normal; +} + +/* + +.octicon is optimized for 16px. +.mega-octicon is optimized for 32px but can be used larger. + +*/ +.octicon { + font: normal normal 16px octicons; + line-height: 1; + display: inline-block; + text-decoration: none; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} +.mega-octicon { + font: normal normal 32px octicons; + line-height: 1; + display: inline-block; + text-decoration: none; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.octicon-alert:before { content: '\f02d'} /* */ +.octicon-alignment-align:before { content: '\f08a'} /* */ +.octicon-alignment-aligned-to:before { content: '\f08e'} /* */ +.octicon-alignment-unalign:before { content: '\f08b'} /* */ +.octicon-arrow-down:before { content: '\f03f'} /* */ +.octicon-arrow-left:before { content: '\f040'} /* */ +.octicon-arrow-right:before { content: '\f03e'} /* */ +.octicon-arrow-small-down:before { content: '\f0a0'} /* */ +.octicon-arrow-small-left:before { content: '\f0a1'} /* */ +.octicon-arrow-small-right:before { content: '\f071'} /* */ +.octicon-arrow-small-up:before { content: '\f09f'} /* */ +.octicon-arrow-up:before { content: '\f03d'} /* */ +.octicon-beer:before { content: '\f069'} /* */ +.octicon-book:before { content: '\f007'} /* */ +.octicon-bookmark:before { content: '\f07b'} /* */ +.octicon-briefcase:before { content: '\f0d3'} /* */ +.octicon-broadcast:before { content: '\f048'} /* */ +.octicon-browser:before { content: '\f0c5'} /* */ +.octicon-bug:before { content: '\f091'} /* */ +.octicon-calendar:before { content: '\f068'} /* */ +.octicon-check:before { content: '\f03a'} /* */ +.octicon-checklist:before { content: '\f076'} /* */ +.octicon-chevron-down:before { content: '\f0a3'} /* */ +.octicon-chevron-left:before { content: '\f0a4'} /* */ +.octicon-chevron-right:before { content: '\f078'} /* */ +.octicon-chevron-up:before { content: '\f0a2'} /* */ +.octicon-circle-slash:before { content: '\f084'} /* */ +.octicon-circuit-board:before { content: '\f0d6'} /* */ +.octicon-clippy:before { content: '\f035'} /* */ +.octicon-clock:before { content: '\f046'} /* */ +.octicon-cloud-download:before { content: '\f00b'} /* */ +.octicon-cloud-upload:before { content: '\f00c'} /* */ +.octicon-code:before { content: '\f05f'} /* */ +.octicon-color-mode:before { content: '\f065'} /* */ +.octicon-comment-add:before, +.octicon-comment:before { content: '\f02b'} /* */ +.octicon-comment-discussion:before { content: '\f04f'} /* */ +.octicon-credit-card:before { content: '\f045'} /* */ +.octicon-dash:before { content: '\f0ca'} /* */ +.octicon-dashboard:before { content: '\f07d'} /* */ +.octicon-database:before { content: '\f096'} /* */ +.octicon-device-camera:before { content: '\f056'} /* */ +.octicon-device-camera-video:before { content: '\f057'} /* */ +.octicon-device-desktop:before { content: '\f27c'} /* */ +.octicon-device-mobile:before { content: '\f038'} /* */ +.octicon-diff:before { content: '\f04d'} /* */ +.octicon-diff-added:before { content: '\f06b'} /* */ +.octicon-diff-ignored:before { content: '\f099'} /* */ +.octicon-diff-modified:before { content: '\f06d'} /* */ +.octicon-diff-removed:before { content: '\f06c'} /* */ +.octicon-diff-renamed:before { content: '\f06e'} /* */ +.octicon-ellipsis:before { content: '\f09a'} /* */ +.octicon-eye-unwatch:before, +.octicon-eye-watch:before, +.octicon-eye:before { content: '\f04e'} /* */ +.octicon-file-binary:before { content: '\f094'} /* */ +.octicon-file-code:before { content: '\f010'} /* */ +.octicon-file-directory:before { content: '\f016'} /* */ +.octicon-file-media:before { content: '\f012'} /* */ +.octicon-file-pdf:before { content: '\f014'} /* */ +.octicon-file-submodule:before { content: '\f017'} /* */ +.octicon-file-symlink-directory:before { content: '\f0b1'} /* */ +.octicon-file-symlink-file:before { content: '\f0b0'} /* */ +.octicon-file-text:before { content: '\f011'} /* */ +.octicon-file-zip:before { content: '\f013'} /* */ +.octicon-flame:before { content: '\f0d2'} /* */ +.octicon-fold:before { content: '\f0cc'} /* */ +.octicon-gear:before { content: '\f02f'} /* */ +.octicon-gift:before { content: '\f042'} /* */ +.octicon-gist:before { content: '\f00e'} /* */ +.octicon-gist-secret:before { content: '\f08c'} /* */ +.octicon-git-branch-create:before, +.octicon-git-branch-delete:before, +.octicon-git-branch:before { content: '\f020'} /* */ +.octicon-git-commit:before { content: '\f01f'} /* */ +.octicon-git-compare:before { content: '\f0ac'} /* */ +.octicon-git-merge:before { content: '\f023'} /* */ +.octicon-git-pull-request-abandoned:before, +.octicon-git-pull-request:before { content: '\f009'} /* */ +.octicon-globe:before { content: '\f0b6'} /* */ +.octicon-graph:before { content: '\f043'} /* */ +.octicon-heart:before { content: '\2665'} /* ♥ */ +.octicon-history:before { content: '\f07e'} /* */ +.octicon-home:before { content: '\f08d'} /* */ +.octicon-horizontal-rule:before { content: '\f070'} /* */ +.octicon-hourglass:before { content: '\f09e'} /* */ +.octicon-hubot:before { content: '\f09d'} /* */ +.octicon-inbox:before { content: '\f0cf'} /* */ +.octicon-info:before { content: '\f059'} /* */ +.octicon-issue-closed:before { content: '\f028'} /* */ +.octicon-issue-opened:before { content: '\f026'} /* */ +.octicon-issue-reopened:before { content: '\f027'} /* */ +.octicon-jersey:before { content: '\f019'} /* */ +.octicon-jump-down:before { content: '\f072'} /* */ +.octicon-jump-left:before { content: '\f0a5'} /* */ +.octicon-jump-right:before { content: '\f0a6'} /* */ +.octicon-jump-up:before { content: '\f073'} /* */ +.octicon-key:before { content: '\f049'} /* */ +.octicon-keyboard:before { content: '\f00d'} /* */ +.octicon-law:before { content: '\f0d8'} /* */ +.octicon-light-bulb:before { content: '\f000'} /* */ +.octicon-link:before { content: '\f05c'} /* */ +.octicon-link-external:before { content: '\f07f'} /* */ +.octicon-list-ordered:before { content: '\f062'} /* */ +.octicon-list-unordered:before { content: '\f061'} /* */ +.octicon-location:before { content: '\f060'} /* */ +.octicon-gist-private:before, +.octicon-mirror-private:before, +.octicon-git-fork-private:before, +.octicon-lock:before { content: '\f06a'} /* */ +.octicon-logo-github:before { content: '\f092'} /* */ +.octicon-mail:before { content: '\f03b'} /* */ +.octicon-mail-read:before { content: '\f03c'} /* */ +.octicon-mail-reply:before { content: '\f051'} /* */ +.octicon-mark-github:before { content: '\f00a'} /* */ +.octicon-markdown:before { content: '\f0c9'} /* */ +.octicon-megaphone:before { content: '\f077'} /* */ +.octicon-mention:before { content: '\f0be'} /* */ +.octicon-microscope:before { content: '\f089'} /* */ +.octicon-milestone:before { content: '\f075'} /* */ +.octicon-mirror-public:before, +.octicon-mirror:before { content: '\f024'} /* */ +.octicon-mortar-board:before { content: '\f0d7'} /* */ +.octicon-move-down:before { content: '\f0a8'} /* */ +.octicon-move-left:before { content: '\f074'} /* */ +.octicon-move-right:before { content: '\f0a9'} /* */ +.octicon-move-up:before { content: '\f0a7'} /* */ +.octicon-mute:before { content: '\f080'} /* */ +.octicon-no-newline:before { content: '\f09c'} /* */ +.octicon-octoface:before { content: '\f008'} /* */ +.octicon-organization:before { content: '\f037'} /* */ +.octicon-package:before { content: '\f0c4'} /* */ +.octicon-paintcan:before { content: '\f0d1'} /* */ +.octicon-pencil:before { content: '\f058'} /* */ +.octicon-person-add:before, +.octicon-person-follow:before, +.octicon-person:before { content: '\f018'} /* */ +.octicon-pin:before { content: '\f041'} /* */ +.octicon-playback-fast-forward:before { content: '\f0bd'} /* */ +.octicon-playback-pause:before { content: '\f0bb'} /* */ +.octicon-playback-play:before { content: '\f0bf'} /* */ +.octicon-playback-rewind:before { content: '\f0bc'} /* */ +.octicon-plug:before { content: '\f0d4'} /* */ +.octicon-repo-create:before, +.octicon-gist-new:before, +.octicon-file-directory-create:before, +.octicon-file-add:before, +.octicon-plus:before { content: '\f05d'} /* */ +.octicon-podium:before { content: '\f0af'} /* */ +.octicon-primitive-dot:before { content: '\f052'} /* */ +.octicon-primitive-square:before { content: '\f053'} /* */ +.octicon-pulse:before { content: '\f085'} /* */ +.octicon-puzzle:before { content: '\f0c0'} /* */ +.octicon-question:before { content: '\f02c'} /* */ +.octicon-quote:before { content: '\f063'} /* */ +.octicon-radio-tower:before { content: '\f030'} /* */ +.octicon-repo-delete:before, +.octicon-repo:before { content: '\f001'} /* */ +.octicon-repo-clone:before { content: '\f04c'} /* */ +.octicon-repo-force-push:before { content: '\f04a'} /* */ +.octicon-gist-fork:before, +.octicon-repo-forked:before { content: '\f002'} /* */ +.octicon-repo-pull:before { content: '\f006'} /* */ +.octicon-repo-push:before { content: '\f005'} /* */ +.octicon-rocket:before { content: '\f033'} /* */ +.octicon-rss:before { content: '\f034'} /* */ +.octicon-ruby:before { content: '\f047'} /* */ +.octicon-screen-full:before { content: '\f066'} /* */ +.octicon-screen-normal:before { content: '\f067'} /* */ +.octicon-search-save:before, +.octicon-search:before { content: '\f02e'} /* */ +.octicon-server:before { content: '\f097'} /* */ +.octicon-settings:before { content: '\f07c'} /* */ +.octicon-log-in:before, +.octicon-sign-in:before { content: '\f036'} /* */ +.octicon-log-out:before, +.octicon-sign-out:before { content: '\f032'} /* */ +.octicon-split:before { content: '\f0c6'} /* */ +.octicon-squirrel:before { content: '\f0b2'} /* */ +.octicon-star-add:before, +.octicon-star-delete:before, +.octicon-star:before { content: '\f02a'} /* */ +.octicon-steps:before { content: '\f0c7'} /* */ +.octicon-stop:before { content: '\f08f'} /* */ +.octicon-repo-sync:before, +.octicon-sync:before { content: '\f087'} /* */ +.octicon-tag-remove:before, +.octicon-tag-add:before, +.octicon-tag:before { content: '\f015'} /* */ +.octicon-telescope:before { content: '\f088'} /* */ +.octicon-terminal:before { content: '\f0c8'} /* */ +.octicon-three-bars:before { content: '\f05e'} /* */ +.octicon-tools:before { content: '\f031'} /* */ +.octicon-trashcan:before { content: '\f0d0'} /* */ +.octicon-triangle-down:before { content: '\f05b'} /* */ +.octicon-triangle-left:before { content: '\f044'} /* */ +.octicon-triangle-right:before { content: '\f05a'} /* */ +.octicon-triangle-up:before { content: '\f0aa'} /* */ +.octicon-unfold:before { content: '\f039'} /* */ +.octicon-unmute:before { content: '\f0ba'} /* */ +.octicon-versions:before { content: '\f064'} /* */ +.octicon-remove-close:before, +.octicon-x:before { content: '\f081'} /* */ +.octicon-zap:before { content: '\26A1'} /* ⚡ */ diff --git a/frappe/public/css/octicons/octicons.eot b/frappe/public/css/octicons/octicons.eot new file mode 100755 index 0000000000..a3aef43c6e Binary files /dev/null and b/frappe/public/css/octicons/octicons.eot differ diff --git a/frappe/public/css/octicons/octicons.less b/frappe/public/css/octicons/octicons.less new file mode 100755 index 0000000000..78ef46ead8 --- /dev/null +++ b/frappe/public/css/octicons/octicons.less @@ -0,0 +1,244 @@ +@octicons-font-path: "."; +@octicons-version: "897b19cdb9c4473f9166329e039ba8337c77d561"; + +@font-face { + font-family: 'octicons'; + src: ~"url('@{octicons-font-path}/octicons.eot?#iefix&v=@{octicons-version}') format('embedded-opentype')", + ~"url('@{octicons-font-path}/octicons.woff?v=@{octicons-version}') format('woff')", + ~"url('@{octicons-font-path}/octicons.ttf?v=@{octicons-version}') format('truetype')", + ~"url('@{octicons-font-path}/octicons.svg?v=@{octicons-version}#octicons') format('svg')"; + font-weight: normal; + font-style: normal; +} + +// .octicon is optimized for 16px. +// .mega-octicon is optimized for 32px but can be used larger. +.octicon { + font: normal normal 16px octicons; + line-height: 1; + display: inline-block; + text-decoration: none; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} +.mega-octicon { + font: normal normal 32px octicons; + line-height: 1; + display: inline-block; + text-decoration: none; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.octicon-alert:before { content: '\f02d'} /* */ +.octicon-alignment-align:before { content: '\f08a'} /* */ +.octicon-alignment-aligned-to:before { content: '\f08e'} /* */ +.octicon-alignment-unalign:before { content: '\f08b'} /* */ +.octicon-arrow-down:before { content: '\f03f'} /* */ +.octicon-arrow-left:before { content: '\f040'} /* */ +.octicon-arrow-right:before { content: '\f03e'} /* */ +.octicon-arrow-small-down:before { content: '\f0a0'} /* */ +.octicon-arrow-small-left:before { content: '\f0a1'} /* */ +.octicon-arrow-small-right:before { content: '\f071'} /* */ +.octicon-arrow-small-up:before { content: '\f09f'} /* */ +.octicon-arrow-up:before { content: '\f03d'} /* */ +.octicon-beer:before { content: '\f069'} /* */ +.octicon-book:before { content: '\f007'} /* */ +.octicon-bookmark:before { content: '\f07b'} /* */ +.octicon-briefcase:before { content: '\f0d3'} /* */ +.octicon-broadcast:before { content: '\f048'} /* */ +.octicon-browser:before { content: '\f0c5'} /* */ +.octicon-bug:before { content: '\f091'} /* */ +.octicon-calendar:before { content: '\f068'} /* */ +.octicon-check:before { content: '\f03a'} /* */ +.octicon-checklist:before { content: '\f076'} /* */ +.octicon-chevron-down:before { content: '\f0a3'} /* */ +.octicon-chevron-left:before { content: '\f0a4'} /* */ +.octicon-chevron-right:before { content: '\f078'} /* */ +.octicon-chevron-up:before { content: '\f0a2'} /* */ +.octicon-circle-slash:before { content: '\f084'} /* */ +.octicon-circuit-board:before { content: '\f0d6'} /* */ +.octicon-clippy:before { content: '\f035'} /* */ +.octicon-clock:before { content: '\f046'} /* */ +.octicon-cloud-download:before { content: '\f00b'} /* */ +.octicon-cloud-upload:before { content: '\f00c'} /* */ +.octicon-code:before { content: '\f05f'} /* */ +.octicon-color-mode:before { content: '\f065'} /* */ +.octicon-comment-add:before, +.octicon-comment:before { content: '\f02b'} /* */ +.octicon-comment-discussion:before { content: '\f04f'} /* */ +.octicon-credit-card:before { content: '\f045'} /* */ +.octicon-dash:before { content: '\f0ca'} /* */ +.octicon-dashboard:before { content: '\f07d'} /* */ +.octicon-database:before { content: '\f096'} /* */ +.octicon-device-camera:before { content: '\f056'} /* */ +.octicon-device-camera-video:before { content: '\f057'} /* */ +.octicon-device-desktop:before { content: '\f27c'} /* */ +.octicon-device-mobile:before { content: '\f038'} /* */ +.octicon-diff:before { content: '\f04d'} /* */ +.octicon-diff-added:before { content: '\f06b'} /* */ +.octicon-diff-ignored:before { content: '\f099'} /* */ +.octicon-diff-modified:before { content: '\f06d'} /* */ +.octicon-diff-removed:before { content: '\f06c'} /* */ +.octicon-diff-renamed:before { content: '\f06e'} /* */ +.octicon-ellipsis:before { content: '\f09a'} /* */ +.octicon-eye-unwatch:before, +.octicon-eye-watch:before, +.octicon-eye:before { content: '\f04e'} /* */ +.octicon-file-binary:before { content: '\f094'} /* */ +.octicon-file-code:before { content: '\f010'} /* */ +.octicon-file-directory:before { content: '\f016'} /* */ +.octicon-file-media:before { content: '\f012'} /* */ +.octicon-file-pdf:before { content: '\f014'} /* */ +.octicon-file-submodule:before { content: '\f017'} /* */ +.octicon-file-symlink-directory:before { content: '\f0b1'} /* */ +.octicon-file-symlink-file:before { content: '\f0b0'} /* */ +.octicon-file-text:before { content: '\f011'} /* */ +.octicon-file-zip:before { content: '\f013'} /* */ +.octicon-flame:before { content: '\f0d2'} /* */ +.octicon-fold:before { content: '\f0cc'} /* */ +.octicon-gear:before { content: '\f02f'} /* */ +.octicon-gift:before { content: '\f042'} /* */ +.octicon-gist:before { content: '\f00e'} /* */ +.octicon-gist-secret:before { content: '\f08c'} /* */ +.octicon-git-branch-create:before, +.octicon-git-branch-delete:before, +.octicon-git-branch:before { content: '\f020'} /* */ +.octicon-git-commit:before { content: '\f01f'} /* */ +.octicon-git-compare:before { content: '\f0ac'} /* */ +.octicon-git-merge:before { content: '\f023'} /* */ +.octicon-git-pull-request-abandoned:before, +.octicon-git-pull-request:before { content: '\f009'} /* */ +.octicon-globe:before { content: '\f0b6'} /* */ +.octicon-graph:before { content: '\f043'} /* */ +.octicon-heart:before { content: '\2665'} /* ♥ */ +.octicon-history:before { content: '\f07e'} /* */ +.octicon-home:before { content: '\f08d'} /* */ +.octicon-horizontal-rule:before { content: '\f070'} /* */ +.octicon-hourglass:before { content: '\f09e'} /* */ +.octicon-hubot:before { content: '\f09d'} /* */ +.octicon-inbox:before { content: '\f0cf'} /* */ +.octicon-info:before { content: '\f059'} /* */ +.octicon-issue-closed:before { content: '\f028'} /* */ +.octicon-issue-opened:before { content: '\f026'} /* */ +.octicon-issue-reopened:before { content: '\f027'} /* */ +.octicon-jersey:before { content: '\f019'} /* */ +.octicon-jump-down:before { content: '\f072'} /* */ +.octicon-jump-left:before { content: '\f0a5'} /* */ +.octicon-jump-right:before { content: '\f0a6'} /* */ +.octicon-jump-up:before { content: '\f073'} /* */ +.octicon-key:before { content: '\f049'} /* */ +.octicon-keyboard:before { content: '\f00d'} /* */ +.octicon-law:before { content: '\f0d8'} /* */ +.octicon-light-bulb:before { content: '\f000'} /* */ +.octicon-link:before { content: '\f05c'} /* */ +.octicon-link-external:before { content: '\f07f'} /* */ +.octicon-list-ordered:before { content: '\f062'} /* */ +.octicon-list-unordered:before { content: '\f061'} /* */ +.octicon-location:before { content: '\f060'} /* */ +.octicon-gist-private:before, +.octicon-mirror-private:before, +.octicon-git-fork-private:before, +.octicon-lock:before { content: '\f06a'} /* */ +.octicon-logo-github:before { content: '\f092'} /* */ +.octicon-mail:before { content: '\f03b'} /* */ +.octicon-mail-read:before { content: '\f03c'} /* */ +.octicon-mail-reply:before { content: '\f051'} /* */ +.octicon-mark-github:before { content: '\f00a'} /* */ +.octicon-markdown:before { content: '\f0c9'} /* */ +.octicon-megaphone:before { content: '\f077'} /* */ +.octicon-mention:before { content: '\f0be'} /* */ +.octicon-microscope:before { content: '\f089'} /* */ +.octicon-milestone:before { content: '\f075'} /* */ +.octicon-mirror-public:before, +.octicon-mirror:before { content: '\f024'} /* */ +.octicon-mortar-board:before { content: '\f0d7'} /* */ +.octicon-move-down:before { content: '\f0a8'} /* */ +.octicon-move-left:before { content: '\f074'} /* */ +.octicon-move-right:before { content: '\f0a9'} /* */ +.octicon-move-up:before { content: '\f0a7'} /* */ +.octicon-mute:before { content: '\f080'} /* */ +.octicon-no-newline:before { content: '\f09c'} /* */ +.octicon-octoface:before { content: '\f008'} /* */ +.octicon-organization:before { content: '\f037'} /* */ +.octicon-package:before { content: '\f0c4'} /* */ +.octicon-paintcan:before { content: '\f0d1'} /* */ +.octicon-pencil:before { content: '\f058'} /* */ +.octicon-person-add:before, +.octicon-person-follow:before, +.octicon-person:before { content: '\f018'} /* */ +.octicon-pin:before { content: '\f041'} /* */ +.octicon-playback-fast-forward:before { content: '\f0bd'} /* */ +.octicon-playback-pause:before { content: '\f0bb'} /* */ +.octicon-playback-play:before { content: '\f0bf'} /* */ +.octicon-playback-rewind:before { content: '\f0bc'} /* */ +.octicon-plug:before { content: '\f0d4'} /* */ +.octicon-repo-create:before, +.octicon-gist-new:before, +.octicon-file-directory-create:before, +.octicon-file-add:before, +.octicon-plus:before { content: '\f05d'} /* */ +.octicon-podium:before { content: '\f0af'} /* */ +.octicon-primitive-dot:before { content: '\f052'} /* */ +.octicon-primitive-square:before { content: '\f053'} /* */ +.octicon-pulse:before { content: '\f085'} /* */ +.octicon-puzzle:before { content: '\f0c0'} /* */ +.octicon-question:before { content: '\f02c'} /* */ +.octicon-quote:before { content: '\f063'} /* */ +.octicon-radio-tower:before { content: '\f030'} /* */ +.octicon-repo-delete:before, +.octicon-repo:before { content: '\f001'} /* */ +.octicon-repo-clone:before { content: '\f04c'} /* */ +.octicon-repo-force-push:before { content: '\f04a'} /* */ +.octicon-gist-fork:before, +.octicon-repo-forked:before { content: '\f002'} /* */ +.octicon-repo-pull:before { content: '\f006'} /* */ +.octicon-repo-push:before { content: '\f005'} /* */ +.octicon-rocket:before { content: '\f033'} /* */ +.octicon-rss:before { content: '\f034'} /* */ +.octicon-ruby:before { content: '\f047'} /* */ +.octicon-screen-full:before { content: '\f066'} /* */ +.octicon-screen-normal:before { content: '\f067'} /* */ +.octicon-search-save:before, +.octicon-search:before { content: '\f02e'} /* */ +.octicon-server:before { content: '\f097'} /* */ +.octicon-settings:before { content: '\f07c'} /* */ +.octicon-log-in:before, +.octicon-sign-in:before { content: '\f036'} /* */ +.octicon-log-out:before, +.octicon-sign-out:before { content: '\f032'} /* */ +.octicon-split:before { content: '\f0c6'} /* */ +.octicon-squirrel:before { content: '\f0b2'} /* */ +.octicon-star-add:before, +.octicon-star-delete:before, +.octicon-star:before { content: '\f02a'} /* */ +.octicon-steps:before { content: '\f0c7'} /* */ +.octicon-stop:before { content: '\f08f'} /* */ +.octicon-repo-sync:before, +.octicon-sync:before { content: '\f087'} /* */ +.octicon-tag-remove:before, +.octicon-tag-add:before, +.octicon-tag:before { content: '\f015'} /* */ +.octicon-telescope:before { content: '\f088'} /* */ +.octicon-terminal:before { content: '\f0c8'} /* */ +.octicon-three-bars:before { content: '\f05e'} /* */ +.octicon-tools:before { content: '\f031'} /* */ +.octicon-trashcan:before { content: '\f0d0'} /* */ +.octicon-triangle-down:before { content: '\f05b'} /* */ +.octicon-triangle-left:before { content: '\f044'} /* */ +.octicon-triangle-right:before { content: '\f05a'} /* */ +.octicon-triangle-up:before { content: '\f0aa'} /* */ +.octicon-unfold:before { content: '\f039'} /* */ +.octicon-unmute:before { content: '\f0ba'} /* */ +.octicon-versions:before { content: '\f064'} /* */ +.octicon-remove-close:before, +.octicon-x:before { content: '\f081'} /* */ +.octicon-zap:before { content: '\26A1'} /* ⚡ */ diff --git a/frappe/public/css/octicons/octicons.svg b/frappe/public/css/octicons/octicons.svg new file mode 100755 index 0000000000..ea3e0f1615 --- /dev/null +++ b/frappe/public/css/octicons/octicons.svg @@ -0,0 +1,198 @@ + + + diff --git a/frappe/public/css/octicons/octicons.ttf b/frappe/public/css/octicons/octicons.ttf new file mode 100755 index 0000000000..7111762d8b Binary files /dev/null and b/frappe/public/css/octicons/octicons.ttf differ diff --git a/frappe/public/css/octicons/octicons.woff b/frappe/public/css/octicons/octicons.woff new file mode 100755 index 0000000000..a3989c84a3 Binary files /dev/null and b/frappe/public/css/octicons/octicons.woff differ diff --git a/frappe/public/css/octicons/sprockets-octicons.scss b/frappe/public/css/octicons/sprockets-octicons.scss new file mode 100755 index 0000000000..f2c1664ede --- /dev/null +++ b/frappe/public/css/octicons/sprockets-octicons.scss @@ -0,0 +1,241 @@ +@font-face { + font-family: 'octicons'; + src: font-url('octicons.eot?#iefix') format('embedded-opentype'), + font-url('octicons.woff') format('woff'), + font-url('octicons.ttf') format('truetype'), + font-url('octicons.svg#octicons') format('svg'); + font-weight: normal; + font-style: normal; +} + +// .octicon is optimized for 16px. +// .mega-octicon is optimized for 32px but can be used larger. +.octicon { + font: normal normal 16px octicons; + line-height: 1; + display: inline-block; + text-decoration: none; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} +.mega-octicon { + font: normal normal 32px octicons; + line-height: 1; + display: inline-block; + text-decoration: none; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.octicon-alert:before { content: '\f02d'} /* */ +.octicon-alignment-align:before { content: '\f08a'} /* */ +.octicon-alignment-aligned-to:before { content: '\f08e'} /* */ +.octicon-alignment-unalign:before { content: '\f08b'} /* */ +.octicon-arrow-down:before { content: '\f03f'} /* */ +.octicon-arrow-left:before { content: '\f040'} /* */ +.octicon-arrow-right:before { content: '\f03e'} /* */ +.octicon-arrow-small-down:before { content: '\f0a0'} /* */ +.octicon-arrow-small-left:before { content: '\f0a1'} /* */ +.octicon-arrow-small-right:before { content: '\f071'} /* */ +.octicon-arrow-small-up:before { content: '\f09f'} /* */ +.octicon-arrow-up:before { content: '\f03d'} /* */ +.octicon-beer:before { content: '\f069'} /* */ +.octicon-book:before { content: '\f007'} /* */ +.octicon-bookmark:before { content: '\f07b'} /* */ +.octicon-briefcase:before { content: '\f0d3'} /* */ +.octicon-broadcast:before { content: '\f048'} /* */ +.octicon-browser:before { content: '\f0c5'} /* */ +.octicon-bug:before { content: '\f091'} /* */ +.octicon-calendar:before { content: '\f068'} /* */ +.octicon-check:before { content: '\f03a'} /* */ +.octicon-checklist:before { content: '\f076'} /* */ +.octicon-chevron-down:before { content: '\f0a3'} /* */ +.octicon-chevron-left:before { content: '\f0a4'} /* */ +.octicon-chevron-right:before { content: '\f078'} /* */ +.octicon-chevron-up:before { content: '\f0a2'} /* */ +.octicon-circle-slash:before { content: '\f084'} /* */ +.octicon-circuit-board:before { content: '\f0d6'} /* */ +.octicon-clippy:before { content: '\f035'} /* */ +.octicon-clock:before { content: '\f046'} /* */ +.octicon-cloud-download:before { content: '\f00b'} /* */ +.octicon-cloud-upload:before { content: '\f00c'} /* */ +.octicon-code:before { content: '\f05f'} /* */ +.octicon-color-mode:before { content: '\f065'} /* */ +.octicon-comment-add:before, +.octicon-comment:before { content: '\f02b'} /* */ +.octicon-comment-discussion:before { content: '\f04f'} /* */ +.octicon-credit-card:before { content: '\f045'} /* */ +.octicon-dash:before { content: '\f0ca'} /* */ +.octicon-dashboard:before { content: '\f07d'} /* */ +.octicon-database:before { content: '\f096'} /* */ +.octicon-device-camera:before { content: '\f056'} /* */ +.octicon-device-camera-video:before { content: '\f057'} /* */ +.octicon-device-desktop:before { content: '\f27c'} /* */ +.octicon-device-mobile:before { content: '\f038'} /* */ +.octicon-diff:before { content: '\f04d'} /* */ +.octicon-diff-added:before { content: '\f06b'} /* */ +.octicon-diff-ignored:before { content: '\f099'} /* */ +.octicon-diff-modified:before { content: '\f06d'} /* */ +.octicon-diff-removed:before { content: '\f06c'} /* */ +.octicon-diff-renamed:before { content: '\f06e'} /* */ +.octicon-ellipsis:before { content: '\f09a'} /* */ +.octicon-eye-unwatch:before, +.octicon-eye-watch:before, +.octicon-eye:before { content: '\f04e'} /* */ +.octicon-file-binary:before { content: '\f094'} /* */ +.octicon-file-code:before { content: '\f010'} /* */ +.octicon-file-directory:before { content: '\f016'} /* */ +.octicon-file-media:before { content: '\f012'} /* */ +.octicon-file-pdf:before { content: '\f014'} /* */ +.octicon-file-submodule:before { content: '\f017'} /* */ +.octicon-file-symlink-directory:before { content: '\f0b1'} /* */ +.octicon-file-symlink-file:before { content: '\f0b0'} /* */ +.octicon-file-text:before { content: '\f011'} /* */ +.octicon-file-zip:before { content: '\f013'} /* */ +.octicon-flame:before { content: '\f0d2'} /* */ +.octicon-fold:before { content: '\f0cc'} /* */ +.octicon-gear:before { content: '\f02f'} /* */ +.octicon-gift:before { content: '\f042'} /* */ +.octicon-gist:before { content: '\f00e'} /* */ +.octicon-gist-secret:before { content: '\f08c'} /* */ +.octicon-git-branch-create:before, +.octicon-git-branch-delete:before, +.octicon-git-branch:before { content: '\f020'} /* */ +.octicon-git-commit:before { content: '\f01f'} /* */ +.octicon-git-compare:before { content: '\f0ac'} /* */ +.octicon-git-merge:before { content: '\f023'} /* */ +.octicon-git-pull-request-abandoned:before, +.octicon-git-pull-request:before { content: '\f009'} /* */ +.octicon-globe:before { content: '\f0b6'} /* */ +.octicon-graph:before { content: '\f043'} /* */ +.octicon-heart:before { content: '\2665'} /* ♥ */ +.octicon-history:before { content: '\f07e'} /* */ +.octicon-home:before { content: '\f08d'} /* */ +.octicon-horizontal-rule:before { content: '\f070'} /* */ +.octicon-hourglass:before { content: '\f09e'} /* */ +.octicon-hubot:before { content: '\f09d'} /* */ +.octicon-inbox:before { content: '\f0cf'} /* */ +.octicon-info:before { content: '\f059'} /* */ +.octicon-issue-closed:before { content: '\f028'} /* */ +.octicon-issue-opened:before { content: '\f026'} /* */ +.octicon-issue-reopened:before { content: '\f027'} /* */ +.octicon-jersey:before { content: '\f019'} /* */ +.octicon-jump-down:before { content: '\f072'} /* */ +.octicon-jump-left:before { content: '\f0a5'} /* */ +.octicon-jump-right:before { content: '\f0a6'} /* */ +.octicon-jump-up:before { content: '\f073'} /* */ +.octicon-key:before { content: '\f049'} /* */ +.octicon-keyboard:before { content: '\f00d'} /* */ +.octicon-law:before { content: '\f0d8'} /* */ +.octicon-light-bulb:before { content: '\f000'} /* */ +.octicon-link:before { content: '\f05c'} /* */ +.octicon-link-external:before { content: '\f07f'} /* */ +.octicon-list-ordered:before { content: '\f062'} /* */ +.octicon-list-unordered:before { content: '\f061'} /* */ +.octicon-location:before { content: '\f060'} /* */ +.octicon-gist-private:before, +.octicon-mirror-private:before, +.octicon-git-fork-private:before, +.octicon-lock:before { content: '\f06a'} /* */ +.octicon-logo-github:before { content: '\f092'} /* */ +.octicon-mail:before { content: '\f03b'} /* */ +.octicon-mail-read:before { content: '\f03c'} /* */ +.octicon-mail-reply:before { content: '\f051'} /* */ +.octicon-mark-github:before { content: '\f00a'} /* */ +.octicon-markdown:before { content: '\f0c9'} /* */ +.octicon-megaphone:before { content: '\f077'} /* */ +.octicon-mention:before { content: '\f0be'} /* */ +.octicon-microscope:before { content: '\f089'} /* */ +.octicon-milestone:before { content: '\f075'} /* */ +.octicon-mirror-public:before, +.octicon-mirror:before { content: '\f024'} /* */ +.octicon-mortar-board:before { content: '\f0d7'} /* */ +.octicon-move-down:before { content: '\f0a8'} /* */ +.octicon-move-left:before { content: '\f074'} /* */ +.octicon-move-right:before { content: '\f0a9'} /* */ +.octicon-move-up:before { content: '\f0a7'} /* */ +.octicon-mute:before { content: '\f080'} /* */ +.octicon-no-newline:before { content: '\f09c'} /* */ +.octicon-octoface:before { content: '\f008'} /* */ +.octicon-organization:before { content: '\f037'} /* */ +.octicon-package:before { content: '\f0c4'} /* */ +.octicon-paintcan:before { content: '\f0d1'} /* */ +.octicon-pencil:before { content: '\f058'} /* */ +.octicon-person-add:before, +.octicon-person-follow:before, +.octicon-person:before { content: '\f018'} /* */ +.octicon-pin:before { content: '\f041'} /* */ +.octicon-playback-fast-forward:before { content: '\f0bd'} /* */ +.octicon-playback-pause:before { content: '\f0bb'} /* */ +.octicon-playback-play:before { content: '\f0bf'} /* */ +.octicon-playback-rewind:before { content: '\f0bc'} /* */ +.octicon-plug:before { content: '\f0d4'} /* */ +.octicon-repo-create:before, +.octicon-gist-new:before, +.octicon-file-directory-create:before, +.octicon-file-add:before, +.octicon-plus:before { content: '\f05d'} /* */ +.octicon-podium:before { content: '\f0af'} /* */ +.octicon-primitive-dot:before { content: '\f052'} /* */ +.octicon-primitive-square:before { content: '\f053'} /* */ +.octicon-pulse:before { content: '\f085'} /* */ +.octicon-puzzle:before { content: '\f0c0'} /* */ +.octicon-question:before { content: '\f02c'} /* */ +.octicon-quote:before { content: '\f063'} /* */ +.octicon-radio-tower:before { content: '\f030'} /* */ +.octicon-repo-delete:before, +.octicon-repo:before { content: '\f001'} /* */ +.octicon-repo-clone:before { content: '\f04c'} /* */ +.octicon-repo-force-push:before { content: '\f04a'} /* */ +.octicon-gist-fork:before, +.octicon-repo-forked:before { content: '\f002'} /* */ +.octicon-repo-pull:before { content: '\f006'} /* */ +.octicon-repo-push:before { content: '\f005'} /* */ +.octicon-rocket:before { content: '\f033'} /* */ +.octicon-rss:before { content: '\f034'} /* */ +.octicon-ruby:before { content: '\f047'} /* */ +.octicon-screen-full:before { content: '\f066'} /* */ +.octicon-screen-normal:before { content: '\f067'} /* */ +.octicon-search-save:before, +.octicon-search:before { content: '\f02e'} /* */ +.octicon-server:before { content: '\f097'} /* */ +.octicon-settings:before { content: '\f07c'} /* */ +.octicon-log-in:before, +.octicon-sign-in:before { content: '\f036'} /* */ +.octicon-log-out:before, +.octicon-sign-out:before { content: '\f032'} /* */ +.octicon-split:before { content: '\f0c6'} /* */ +.octicon-squirrel:before { content: '\f0b2'} /* */ +.octicon-star-add:before, +.octicon-star-delete:before, +.octicon-star:before { content: '\f02a'} /* */ +.octicon-steps:before { content: '\f0c7'} /* */ +.octicon-stop:before { content: '\f08f'} /* */ +.octicon-repo-sync:before, +.octicon-sync:before { content: '\f087'} /* */ +.octicon-tag-remove:before, +.octicon-tag-add:before, +.octicon-tag:before { content: '\f015'} /* */ +.octicon-telescope:before { content: '\f088'} /* */ +.octicon-terminal:before { content: '\f0c8'} /* */ +.octicon-three-bars:before { content: '\f05e'} /* */ +.octicon-tools:before { content: '\f031'} /* */ +.octicon-trashcan:before { content: '\f0d0'} /* */ +.octicon-triangle-down:before { content: '\f05b'} /* */ +.octicon-triangle-left:before { content: '\f044'} /* */ +.octicon-triangle-right:before { content: '\f05a'} /* */ +.octicon-triangle-up:before { content: '\f0aa'} /* */ +.octicon-unfold:before { content: '\f039'} /* */ +.octicon-unmute:before { content: '\f0ba'} /* */ +.octicon-versions:before { content: '\f064'} /* */ +.octicon-remove-close:before, +.octicon-x:before { content: '\f081'} /* */ +.octicon-zap:before { content: '\26A1'} /* ⚡ */ diff --git a/frappe/public/js/frappe/form/attachments.js b/frappe/public/js/frappe/form/attachments.js index 985903b398..8cd9dffc1e 100644 --- a/frappe/public/js/frappe/form/attachments.js +++ b/frappe/public/js/frappe/form/attachments.js @@ -129,6 +129,8 @@ frappe.ui.form.Attachments = Class.extend({ } me.remove_fileid(fileid); me.frm.toolbar.show_infobar(); + me.frm.get_docinfo().comments.push(r.message); + me.frm.comments.refresh(); if(callback) callback(); } }); @@ -153,7 +155,10 @@ frappe.ui.form.Attachments = Class.extend({ callback: function(attachment, r) { me.dialog.hide(); me.update_attachment(attachment); - if(fieldname) this.frm.set_value(fieldname, attachment.file_url); + me.frm.get_docinfo().comments.push(r.message.comment); + me.frm.comments.refresh(); + + if(fieldname) me.frm.set_value(fieldname, attachment.file_url); }, onerror: function() { me.dialog.hide(); diff --git a/frappe/public/js/frappe/form/comments.js b/frappe/public/js/frappe/form/comments.js index 1c78aa885d..139f42f12d 100644 --- a/frappe/public/js/frappe/form/comments.js +++ b/frappe/public/js/frappe/form/comments.js @@ -66,6 +66,9 @@ frappe.ui.form.Comments = Class.extend({ "Assignment Completed": "icon-ok", "Comment": "icon-comment", "Workflow": "icon-arrow-right", + "Label": "icon-tag", + "Attachment": "icon-paper-clip", + "Attachment Removed": "icon-paper-clip" }[c.comment_type] c.icon_bg = { @@ -74,11 +77,21 @@ frappe.ui.form.Comments = Class.extend({ "Cancelled": "#c0392b", "Assigned": "#f39c12", "Assignment Completed": "#16a085", - "Comment": "#7f8c8d", - "Workflow": "#2c3e50" + "Comment": "#f39c12", + "Workflow": "#2c3e50", + "Label": "#2c3e50", + "Attachment": "#7f8c8d", + "Attachment Removed": "#eee" + }[c.comment_type]; + + c.icon_fg = { + "Attachment Removed": "#333", }[c.comment_type] - if(c.comment_type==="Workflow") { + if(!c.icon_fg) c.icon_fg = "#fff"; + + // label view + if(c.comment_type==="Workflow" || c.comment_type==="Label") { c.comment_html = repl('%(text)s', { style: frappe.utils.guess_style(c.comment), text: c.comment @@ -87,13 +100,20 @@ frappe.ui.form.Comments = Class.extend({ c.comment_html = frappe.markdown(c.comment); } + // icon centering -- pixed perfect + if(in_list(["Comment"], c.comment_type)) { + c.padding = "padding-left: 8px;"; + } else { + c.padding = ""; + } + $(repl('
'+__("Tags")+'
\\
\ @@ -49,13 +45,14 @@ frappe.ui.form.Footer = Class.extend({
' - + (df.options ? (' ') : "") + + (df.options ? (' ') : "") + '' + __(this.labelled_section_count) + ". " + __(df.label) + "
") diff --git a/frappe/public/js/frappe/form/print.js b/frappe/public/js/frappe/form/print.js index e949d42fb5..1ba17628ef 100644 --- a/frappe/public/js/frappe/form/print.js +++ b/frappe/public/js/frappe/form/print.js @@ -7,7 +7,7 @@ frappe.ui.form.PrintPreview = Class.extend({ this.bind_events(); }, make: function() { - this.wrapper = $('{% if (doc.fieldtype==="Section Break") { %}{% } %} diff --git a/frappe/templates/pages/print.py b/frappe/templates/pages/print.py index 8cbfc9bef9..233ad17d11 100644 --- a/frappe/templates/pages/print.py +++ b/frappe/templates/pages/print.py @@ -172,6 +172,10 @@ def make_layout(doc, meta): layout = [filter(lambda s: any(filter(lambda c: any(c), s)), page) for page in layout] return layout +def is_visible(df): + no_display = ("Section Break", "Column Break", "Button") + return (df.fieldtype not in no_display) and not df.get("__print_hide") and not df.print_hide + def has_value(df, doc): value = doc.get(df.fieldname) if value in (None, ""): diff --git a/frappe/utils/file_manager.py b/frappe/utils/file_manager.py index 2e991ba601..c3366bbd26 100644 --- a/frappe/utils/file_manager.py +++ b/frappe/utils/file_manager.py @@ -34,10 +34,16 @@ def upload(): elif file_url: filedata = save_url(file_url, dt, dn) + + if dt and dn: + comment = frappe.get_doc(dt, dn).add_comment("Attachment", + _("Added {0}").format("{file_name}".format(**filedata.as_dict()))) + return { "name": filedata.name, "file_name": filedata.file_name, - "file_url": filedata.file_url + "file_url": filedata.file_url, + "comment": comment.as_dict() } def save_uploaded(dt, dn): @@ -177,16 +183,21 @@ def remove_all(dt, dn): def remove_file(fid, attached_to_doctype=None, attached_to_name=None): """Remove file and File Data entry""" if not (attached_to_doctype and attached_to_name): - attached = frappe.db.get_value("File Data", fid, ["attached_to_doctype", "attached_to_name"]) + attached = frappe.db.get_value("File Data", fid, + ["attached_to_doctype", "attached_to_name", "file_name"]) if attached: - attached_to_doctype, attached_to_name = attached + attached_to_doctype, attached_to_name, file_name = attached - ignore_permissions = False + ignore_permissions, comment = False, None if attached_to_doctype and attached_to_name: - ignore_permissions = frappe.get_doc(attached_to_doctype, attached_to_name).has_permission("write") or False + doc = frappe.get_doc(attached_to_doctype, attached_to_name) + ignore_permissions = doc.has_permission("write") or False + comment = doc.add_comment("Attachment Removed", _("Removed {0}").format(file_name)) frappe.delete_doc("File Data", fid, ignore_permissions=ignore_permissions) + return comment + def delete_file_data_content(doc): method = get_hook_method('delete_file_data_content', fallback=delete_file_from_filesystem) method(doc) diff --git a/frappe/widgets/form/load.py b/frappe/widgets/form/load.py index 93dfeec038..d9356acc90 100644 --- a/frappe/widgets/form/load.py +++ b/frappe/widgets/form/load.py @@ -77,9 +77,9 @@ def get_meta_bundle(doctype): def get_docinfo(doc): frappe.response["docinfo"] = { - "attachments": add_attachments(doc.doctype, doc.name), - "comments": add_comments(doc.doctype, doc.name), - "assignments": add_assignments(doc.doctype, doc.name), + "attachments": get_attachments(doc.doctype, doc.name), + "comments": get_comments(doc.doctype, doc.name), + "assignments": get_assignments(doc.doctype, doc.name), "permissions": get_doc_permissions(doc) } @@ -90,7 +90,7 @@ def get_user_permissions(meta): out[df.options] = all_user_permissions[df.options] return out -def add_attachments(dt, dn): +def get_attachments(dt, dn): attachments = [] for f in frappe.db.sql("""select name, file_name, file_url from `tabFile Data` where attached_to_name=%s and attached_to_doctype=%s""", @@ -103,14 +103,14 @@ def add_attachments(dt, dn): return attachments -def add_comments(dt, dn, limit=20): +def get_comments(dt, dn, limit=20): cl = frappe.db.sql("""select name, comment, comment_by, creation, comment_type from `tabComment` where comment_doctype=%s and comment_docname=%s order by creation asc limit %s""" % ('%s','%s', limit), (dt, dn), as_dict=1) return cl -def add_assignments(dt, dn): +def get_assignments(dt, dn): cl = frappe.db.sql("""select owner, description from `tabToDo` where reference_type=%(doctype)s and reference_name=%(name)s and status="Open" order by modified desc limit 5""", { diff --git a/frappe/widgets/form/utils.py b/frappe/widgets/form/utils.py index faccf33291..1440671cc6 100644 --- a/frappe/widgets/form/utils.py +++ b/frappe/widgets/form/utils.py @@ -13,7 +13,7 @@ def remove_attach(): """remove attachment""" import frappe.utils.file_manager fid = frappe.form_dict.get('fid') - frappe.utils.file_manager.remove_file(fid) + return frappe.utils.file_manager.remove_file(fid) @frappe.whitelist() def get_fields():