github.com/jancarloviray/community@v0.41.1-0.20170124221257-33a66c87cf2f/core/section/airtable/airtable.go (about)

     1  // Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
     2  //
     3  // This software (Documize Community Edition) is licensed under
     4  // GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
     5  //
     6  // You can operate outside the AGPL restrictions by purchasing
     7  // Documize Enterprise Edition and obtaining a commercial license
     8  // by contacting <sales@documize.com>.
     9  //
    10  // https://documize.com
    11  
    12  package airtable
    13  
    14  import (
    15  	"net/http"
    16  
    17  	"github.com/documize/community/core/section/provider"
    18  )
    19  
    20  // Provider represents Airtable
    21  type Provider struct {
    22  }
    23  
    24  // Meta describes us
    25  func (*Provider) Meta() provider.TypeMeta {
    26  	section := provider.TypeMeta{}
    27  
    28  	section.ID = "3cfa411e-73bf-474c-841a-effd6b00fdd8"
    29  	section.Title = "Airtable"
    30  	section.Description = "Databases, tables, views"
    31  	section.ContentType = "airtable"
    32  	section.PageType = "tab"
    33  
    34  	return section
    35  }
    36  
    37  // Command stub.
    38  func (*Provider) Command(ctx *provider.Context, w http.ResponseWriter, r *http.Request) {
    39  	provider.WriteEmpty(w)
    40  }
    41  
    42  // Render converts markdown data into HTML suitable for browser rendering.
    43  func (*Provider) Render(ctx *provider.Context, config, data string) string {
    44  	return embed(config, data)
    45  }
    46  
    47  // Refresh just sends back data as-is.
    48  func (*Provider) Refresh(ctx *provider.Context, config, data string) string {
    49  	return embed(config, data)
    50  }
    51  
    52  func embed(config, data string) string {
    53  	return data
    54  	// return `
    55  	// <iframe class="airtable-embed"
    56  	// src="https://airtable.com/embed/shrFOcQ6BYrlUe62L?backgroundColor=yellow&viewControls=on"
    57  	// frameborder="0"
    58  	// onmousewheel=""
    59  	// width="100%"
    60  	// height="533"
    61  	// style="background: transparent; border: 1px solid #ccc;"></iframe>
    62  	// `
    63  }