1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-07 14:35:28 +02:00

coming soon smart sections, markdown-it.js

This commit is contained in:
Harvey Kandola 2016-05-19 12:02:26 -07:00
parent 58a8f9169e
commit 475df58174
38 changed files with 526 additions and 109 deletions

View file

@ -1,17 +1,18 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
// by contacting <sales@documize.com>.
//
// https://documize.com
import Ember from 'ember';
import NotifierMixin from '../../mixins/notifier';
export default Ember.Component.extend({
export default Ember.Component.extend(NotifierMixin, {
title: "",
contentType: "",
@ -41,7 +42,13 @@ export default Ember.Component.extend({
onAction() {
let title = this.get("title");
let contentType = this.get("sections").findBy("selected", true).contentType;
let section = this.get("sections").findBy("selected", true);
let contentType = section.contentType;
if (section.preview) {
this.showNotification("Coming soon!");
return;
}
if (is.empty(title)) {
$("#page-title").addClass("error").focus();
@ -51,4 +58,4 @@ export default Ember.Component.extend({
this.attrs.onAction(title, contentType);
}
}
});
});

View file

@ -248,3 +248,5 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
// show who owner is -- logout
// key really required?
// no private boards?
// pass/save global section config?

View file

@ -33,13 +33,12 @@
list-style: none;
float: left;
cursor: pointer;
width: 100px;
height: 100px;
width: 400px;
height: 80px;
background-color: $color-white;
border: 1px solid $color-border2;
border-radius: 3px;
margin: 0 30px 30px 0;
font-weight: bold;
&:hover {
@extend .z-depth-half;
@ -48,30 +47,46 @@
transition: 0.2s all ease;
}
> .material-icons {
text-align: center;
margin: 20px 0 0 31px;
font-size: 2.5rem;
color: $color-stroke;
}
> .img {
height: 30px;
width: 30px;
text-align: center;
margin: 23px 0 6px 33px;
margin: 17px 10px 0 20px;
display: inline-block;
}
> .title {
font-size: 1rem;
color: $color-stroke;
text-align: center;
margin-top: 5px;
> .details {
vertical-align: top;
display: inline-block;
> .title {
font-size: 1rem;
font-weight: bold;
color: $color-off-black;
margin-top: 18px;
letter-spacing: 0.5px;
.preview {
font-size: 0.7rem;
color: #cc9933;
display: inline-block;
margin-left: 10px;
}
}
> .desc {
color: $color-stroke;
font-size: 0.8rem;
margin-top: 5px;
max-width: 300px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
}
> .selected {
border-color: $color-link;
background-color: $color-card-active;
border: 1px dotted $color-link;
}
}
}

View file

@ -17,15 +17,26 @@
<div class="canvas">
<ul class="list">
{{#each sections as |section|}}
<li title="{{section.description}}" class="item {{if section.selected "selected"}}" {{action 'setOption' section.id}}>
{{#if section.hasImage}}
<img class="img" src="{{section.iconFile}}" />
{{else}}
<i class="material-icons">{{section.iconFont}}</i>
{{/if}}
<div class='title'>{{section.title}}</div>
<li class="item {{if section.selected "selected"}}" {{action 'setOption' section.id}}>
<img class="img" src="{{section.iconFile}}" />
<div class="details">
<div class='title'>
{{section.title}}
{{#if section.preview}}
<div class="preview">coming soon</div>
{{/if}}
</div>
<div class='desc'>{{section.description}}</div>
</div>
</li>
{{/each}}
<li class="item">
<img class="img" src="/sections/suggest.png" />
<div class="details">
<div class='title'>Suggest</div>
<div class='desc'>We'll build the integrations you need - just let us know</div>
</div>
</li>
</ul>
</div>
</div>

View file

@ -1,3 +1,14 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
/* jshint node: true */
module.exports = function(environment) {
@ -9,6 +20,7 @@ module.exports = function(environment) {
baseURL: '/',
apiHost: '',
apiNamespace: '',
contentSecurityPolicyHeader: 'Content-Security-Policy-Report-Only',
EmberENV: {
FEATURES: {}
@ -21,7 +33,7 @@ module.exports = function(environment) {
ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
ENV.apiHost = "https://localhost:5001";
// ENV.apiHost = "https://demo1.dev:5001";
ENV.apiHost = "https://demo1.dev:5001";
}
if (environment === 'test') {
@ -52,6 +64,8 @@ module.exports = function(environment) {
ENV.apiNamespace = "api";
ENV.contentSecurityPolicy = null;
// ENV.contentSecurityPolicy = {
// 'img-src': "'self' data: self https://js.intercomcdn.com",
// 'font-src': "'self' data: fonts.gstatic.com",
@ -61,14 +75,14 @@ module.exports = function(environment) {
// 'default-src': "none"
// };
return ENV;
};
// ENV.contentSecurityPolicy = {
// 'img-src': "'self' data: self",
// 'font-src': "'self' *",
// 'style-src': "'self' *",
// 'script-src': "'self' *",
// 'connect-src': "'self' *",
// 'default-src': "*"
// };
// contentSecurityPolicy: {
// 'img-src': "'self' data: self",
// 'font-src': "'self' data: fonts.gstatic.com",
// 'style-src': "'self' 'unsafe-inline' fonts.googleapis.com",
// 'script-src': "'self' 'unsafe-inline' 'unsafe-eval' *",
// 'connect-src': "'self'",
// 'default-src': "none"
// },
return ENV;
};

View file

@ -1,11 +1,11 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
// by contacting <sales@documize.com>.
//
// https://documize.com
@ -55,6 +55,7 @@ module.exports = function(defaults) {
app.import('vendor/tether.js');
app.import('vendor/drop.js');
app.import('vendor/tooltip.js');
app.import('vendor/markdown-it.min.js');
return app.toTree();
};
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

5
app/vendor/markdown-it.min.js vendored Normal file

File diff suppressed because one or more lines are too long

51
documize/section/asana.go Normal file
View file

@ -0,0 +1,51 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package section
import (
"net/http"
)
type asana struct {
}
func init() {
sectionsMap["asana"] = &asana{}
}
func (*asana) Meta() TypeMeta {
section := TypeMeta{}
section.ID = "3a3f4661-2195-46b1-a69c-546eaccb5f93"
section.Title = "Asana"
section.Description = "Embed tasks and projects"
section.ContentType = "asana"
section.IconFile = "sections/asana.png"
section.Preview = true
return section
}
// Command stub.
func (*asana) Command(w http.ResponseWriter, r *http.Request) {
writeEmpty(w)
}
// Render just sends back HMTL as-is.
func (*asana) Render(config, data string) string {
return data
}
// Refresh just sends back data as-is.
func (*asana) Refresh(config, data string) string {
return data
}

View file

@ -27,9 +27,9 @@ func (*code) Meta() TypeMeta {
section.ID = "4f6f2b02-8397-483d-9bb9-eea1fef13304"
section.Title = "Code"
section.Description = "Code snippets supporting 50+ languages"
section.Description = "Formatted code samples supporting 50+ languages"
section.ContentType = "code"
section.IconFontLigature = "code"
section.IconFile = "sections/code.png"
section.Order = 9997
return section

View file

@ -0,0 +1,51 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package section
import (
"net/http"
)
type docusign struct {
}
func init() {
sectionsMap["docusign"] = &docusign{}
}
func (*docusign) Meta() TypeMeta {
section := TypeMeta{}
section.ID = "a195f983-4bd7-412b-879e-2d71d2f822a7"
section.Title = "DocuSign"
section.Description = "Sign and approve documents"
section.ContentType = "docusign"
section.IconFile = "sections/docusign.png"
section.Preview = true
return section
}
// Command stub.
func (*docusign) Command(w http.ResponseWriter, r *http.Request) {
writeEmpty(w)
}
// Render just sends back HMTL as-is.
func (*docusign) Render(config, data string) string {
return data
}
// Refresh just sends back data as-is.
func (*docusign) Refresh(config, data string) string {
return data
}

View file

@ -53,10 +53,9 @@ func (*gemini) Meta() TypeMeta {
section := TypeMeta{}
section.ID = "23b133f9-4020-4616-9291-a98fb939735f"
section.Title = "Gemini"
section.Description = "Display work items and tickets from Gemini workspaces"
section.Description = "Display work items and tickets from workspaces"
section.ContentType = "gemini"
section.IconFontLigature = ""
section.IconFilePath = "sections/gemini.png"
section.IconFile = "sections/gemini.png"
return section
}

View file

@ -0,0 +1,51 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package section
import (
"net/http"
)
type github struct {
}
func init() {
sectionsMap["github"] = &github{}
}
func (*github) Meta() TypeMeta {
section := TypeMeta{}
section.ID = "38c0e4c5-291c-415e-8a4d-262ee80ba5df"
section.Title = "GitHub"
section.Description = "Code commits and branches"
section.ContentType = "github"
section.IconFile = "sections/github.png"
section.Preview = true
return section
}
// Command stub.
func (*github) Command(w http.ResponseWriter, r *http.Request) {
writeEmpty(w)
}
// Render just sends back HMTL as-is.
func (*github) Render(config, data string) string {
return data
}
// Refresh just sends back data as-is.
func (*github) Refresh(config, data string) string {
return data
}

View file

@ -0,0 +1,51 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package section
import (
"net/http"
)
type intercom struct {
}
func init() {
sectionsMap["intercom"] = &intercom{}
}
func (*intercom) Meta() TypeMeta {
section := TypeMeta{}
section.ID = "bf40314d-3b3c-41f9-b283-517da56aa7e4"
section.Title = "Intercom"
section.Description = "Application events and metrics"
section.ContentType = "intercom"
section.IconFile = "sections/intercom.png"
section.Preview = true
return section
}
// Command stub.
func (*intercom) Command(w http.ResponseWriter, r *http.Request) {
writeEmpty(w)
}
// Render just sends back HMTL as-is.
func (*intercom) Render(config, data string) string {
return data
}
// Refresh just sends back data as-is.
func (*intercom) Refresh(config, data string) string {
return data
}

View file

@ -0,0 +1,51 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package section
import (
"net/http"
)
type mailchimp struct {
}
func init() {
sectionsMap["mailchimp"] = &mailchimp{}
}
func (*mailchimp) Meta() TypeMeta {
section := TypeMeta{}
section.ID = "feab735b-2d02-4bb1-b501-ced825e22465"
section.Title = "Mailchimp"
section.Description = "Email campaigns and results"
section.ContentType = "mailchimp"
section.IconFile = "sections/mailchimp.png"
section.Preview = true
return section
}
// Command stub.
func (*mailchimp) Command(w http.ResponseWriter, r *http.Request) {
writeEmpty(w)
}
// Render just sends back HMTL as-is.
func (*mailchimp) Render(config, data string) string {
return data
}
// Refresh just sends back data as-is.
func (*mailchimp) Refresh(config, data string) string {
return data
}

View file

@ -18,9 +18,9 @@ func (*markdown) Meta() TypeMeta {
section.ID = "1470bb4a-36c6-4a98-a443-096f5658378b"
section.Title = "Markdown"
section.Description = "CommonMark based markdown editing"
section.Description = "CommonMark based markdown content with preview"
section.ContentType = "markdown"
section.IconFontLigature = "functions"
section.IconFile = "sections/markdown.png"
section.Order = 9998
return section

View file

@ -0,0 +1,51 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package section
import (
"net/http"
)
type salesforce struct {
}
func init() {
sectionsMap["salesforce"] = &salesforce{}
}
func (*salesforce) Meta() TypeMeta {
section := TypeMeta{}
section.ID = "2240c0f8-b795-47b0-bcd4-5f6b171a2ffd"
section.Title = "Salesforce"
section.Description = "Customers, contacts and leads"
section.ContentType = "salesforce"
section.IconFile = "sections/salesforce.png"
section.Preview = true
return section
}
// Command stub.
func (*salesforce) Command(w http.ResponseWriter, r *http.Request) {
writeEmpty(w)
}
// Render just sends back HMTL as-is.
func (*salesforce) Render(config, data string) string {
return data
}
// Refresh just sends back data as-is.
func (*salesforce) Refresh(config, data string) string {
return data
}

View file

@ -14,13 +14,13 @@ var sectionsMap = make(map[string]section)
// TypeMeta details a "smart section" that represents a "page" in a document.
type TypeMeta struct {
ID string `json:"id"`
Order int `json:"order"`
ContentType string `json:"contentType"`
Title string `json:"title"`
Description string `json:"description"`
IconFontLigature string `json:"iconFont"` // e.g. 'done_all' see https://design.google.com/icons/
IconFilePath string `json:"iconFile"`
ID string `json:"id"`
Order int `json:"order"`
ContentType string `json:"contentType"`
Title string `json:"title"`
Description string `json:"description"`
IconFile string `json:"iconFile"`
Preview bool `json:"preview"` // coming soon!
}
// section represents a 'page' in a document.

View file

@ -32,7 +32,6 @@ func (*testsection) Meta() TypeMeta {
section.Title = "TestSection"
section.Description = "A Test Section"
section.ContentType = "testsection"
section.IconFontLigature = "border_all"
return section
}

View file

@ -0,0 +1,51 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package section
import (
"net/http"
)
type stripe struct {
}
func init() {
sectionsMap["stripe"] = &stripe{}
}
func (*stripe) Meta() TypeMeta {
section := TypeMeta{}
section.ID = "cb597d8d-c724-4034-b272-e8d9e261444f"
section.Title = "Stripe"
section.Description = "Online and mobile payments, refunds and transfers"
section.ContentType = "stripe"
section.IconFile = "sections/stripe.png"
section.Preview = true
return section
}
// Command stub.
func (*stripe) Command(w http.ResponseWriter, r *http.Request) {
writeEmpty(w)
}
// Render just sends back HMTL as-is.
func (*stripe) Render(config, data string) string {
return data
}
// Refresh just sends back data as-is.
func (*stripe) Refresh(config, data string) string {
return data
}

View file

@ -16,9 +16,9 @@ func (*table) Meta() TypeMeta {
section.ID = "81a2ea93-2dfc-434d-841e-54b832492c92"
section.Title = "Table"
section.Description = "Your standard table"
section.Description = "Table with rows, columns and formatting"
section.ContentType = "table"
section.IconFontLigature = "border_all"
section.IconFile = "sections/table.png"
section.Order = 9996
return section

View file

@ -34,9 +34,9 @@ func (*trello) Meta() TypeMeta {
section := TypeMeta{}
section.ID = "c455a552-202e-441c-ad79-397a8152920b"
section.Title = "Trello"
section.Description = "Trello boards"
section.Description = "Embed cards from boards and lists"
section.ContentType = "trello"
section.IconFontLigature = "dashboard"
section.IconFile = "sections/trello.png"
return section
}
@ -163,46 +163,6 @@ func (*trello) Refresh(config, data string) string {
}
// Helpers
// func cards(w http.ResponseWriter, r *http.Request) {
// defer r.Body.Close()
// body, err := ioutil.ReadAll(r.Body)
//
// if err != nil {
// writeMessage(w, "trello", "Bad body")
// return
// }
//
// var config = trelloConfig{}
// err = json.Unmarshal(body, &config)
//
// if err != nil {
// writeError(w, "trello", err)
// return
// }
//
// config.Clean()
//
// if len(config.AppKey) == 0 {
// writeMessage(w, "trello", "Missing appKey")
// return
// }
//
// if len(config.Token) == 0 {
// writeMessage(w, "trello", "Missing token")
// return
// }
//
// render, err := getCards(config)
//
// if err != nil {
// fmt.Println(err)
// writeError(w, "trello", err)
// return
// }
//
// writeJSON(w, render)
// }
func getBoards(config trelloConfig) (boards []trelloBoard, err error) {
req, err := http.NewRequest("GET", fmt.Sprintf("https://api.trello.com/1/members/me/boards?fields=id,name,url,closed,prefs,idOrganization&key=%s&token=%s", config.AppKey, config.Token), nil)
client := &http.Client{}
@ -441,7 +401,3 @@ const trelloTemplate = `
{{end}}
</div>
`
/*
does server side load up all data? YES!!??
*/

View file

@ -22,7 +22,7 @@ func (*wysiwyg) Meta() TypeMeta {
section.Title = "Rich Text"
section.Description = "WYSIWYG editing with cut-paste image support"
section.ContentType = "wysiwyg"
section.IconFontLigature = "format_bold"
section.IconFile = "sections/wysiwyg.png"
section.Order = 9999
return section

View file

@ -0,0 +1,51 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package section
import (
"net/http"
)
type zendesk struct {
}
func init() {
sectionsMap["zendesk"] = &zendesk{}
}
func (*zendesk) Meta() TypeMeta {
section := TypeMeta{}
section.ID = "05b02331-4ca2-4fc2-a31a-82bc45dceafe"
section.Title = "Zendesk"
section.Description = "Show customer support tickets"
section.ContentType = "zendesk"
section.IconFile = "sections/zendesk.png"
section.Preview = true
return section
}
// Command stub.
func (*zendesk) Command(w http.ResponseWriter, r *http.Request) {
writeEmpty(w)
}
// Render just sends back HMTL as-is.
func (*zendesk) Render(config, data string) string {
return data
}
// Refresh just sends back data as-is.
func (*zendesk) Refresh(config, data string) string {
return data
}