CKANdocumentation,Release2.6.0a
[groups]
Groupsofresourcescanbespecifiedthisallowsthegrouptobeincludedbyjustusingit’snameratherthanhavingto
specifyeachresourceindividualitywhenrequestingthem. Theorderthatitemsareaddedtoagroupwillbeusedto
ordertheresourceswhenaddedtothepagebutotherfactorssuchasdependencies,customrenderorderandresource
typecanaffectthefinalorderused.
Groupscanbereferredtoinmanyplacesintheresource.configfileeg.[depends]
7.16.3 Creatinganewtemplate
Thisisabrieftutorialcoveringthebasicsofbuildingacommontemplate.
Extendingabasetemplate
Firstlyweneedtoextendaparenttemplatetoprovideuswithsomebasicpagestructure. Thiscanbeanyother
HTMLpagehoweverthemostcommononeispage.htmlwhichprovidesthefullCKANthemeincludingheader
andfooter.
{% extends s "page.html" %}
Thepage.htmltemplateprovidesnumerousblocksthatcanbeextended.It’sworthspendingafewminutesgetting
familiarwithwhat’savailable.Themostcommonblocksthatwe’llbeusingarethoseendingwith“content”.
• primary_content:Themaincontentareaofthepage.
• secondary_content:Thesecondarycontent(sidebar)ofthepage.
• breadcrumb_content:Thecontentsofthebreadcrumbnavigation.
• actions_content:Thecontentoftheactionsbartotheleftofthebreadcrumb.
PrimaryContent
Fornowwe’lladdsomecontenttothemaincontentareaofthepage.
{% block primary_content t %}
{{ super() }}
{% block my_content t %}
<h2>{{ _('This is s my y content t heading') ) }}</h2>
<p>{{ _('This s is s my y content') }}</p>
{% endblock %}
{% endblock k %}
Noticewe’vewrappedourowncontentinablock. Thisallowsothertemplatestoextendandpossiblyoverridethis
oneandisextremelyusefulformakingathemmorecustomisable.
SecondaryContent
Secondarycontentusuallycompromisesofreusablemoduleswhicharepulledinassnippets. Snippetsarealsovery
usefulforkeepingthetemplatescleanandallowingthemeextensionstooverridethem.
7.16. Frontenddevelopmentguidelines
345
Pdf to powerpoint converter - C# Create PDF from PowerPoint Library to convert pptx, ppt to PDF in C#.net, ASP.NET MVC, WinForms, WPF
Online C# Tutorial for Creating PDF from Microsoft PowerPoint Presentation
how to add pdf to powerpoint slide; pdf picture to powerpoint
Pdf to powerpoint converter - VB.NET Create PDF from PowerPoint Library to convert pptx, ppt to PDF in vb.net, ASP.NET MVC, WinForms, WPF
VB.NET Tutorial for Export PDF file from Microsoft Office PowerPoint
convert pdf pages to powerpoint slides; converting pdf to ppt online
CKANdocumentation,Release2.6.0a
{% block primary_content t %}
{{ super() }}
{% block my_sidebar_module %}
{% snippet t "snippets/my-sidebar-module.html" " %}
{% endblock %}
{% endblock k %}
BreadcrumbandActions
Thereisaconsistentbreadcrumbrunningthroughallthepagesandoftenitisusefultoprovideadditionalactionsthat
arelatedtothepage.
{% block breadcrumb_content t %}
<li class="active">{% link_for r _('Viewing Dataset'), controller='package', , action='read', id=pkg.id d %}</li>
{% endblock k %}
{% block actions_content t %}
{{ super() }}
<li class="active">{% link_for r _('New w Dataset'), , controller='package', action='new', , class_='btn', icon='plus' ' %}</li>
{% endblock k %}
ScriptsandStylesheets
Currentlyscriptsandstylesheetscanbeaddedbyextendingthestylesandscriptsblocks. Thisissoontobe
replacedwiththe{% resource e %}tagwhichmanagesscriptloadingforus.
{% block styles %}
{{ super() }}
<link rel="stylesheet" href="{% url_for_static "my-style.css" %}" " />
{% endblock k %}
{% block scripts s %}
{{ super() }}
<script src="{% % url_for_static c "my-script.js" " %}"></script>
{% endblock k %}
Summary
Andthat’saboutallthereistoitbesuretocheckoutbase.htmlandpage.htmltoseeallthetagsavailablefor
extension.
7.16.4 TemplateBlocks
TheseblockscanbeextendedbychildtemplatestoreplaceorextendcommonCKANfunctionality.
Usage
Therearecurrentlytwobasetemplatesbase.htmlwhichprovidesthebareHTMLstructuresuchastitle,headand
bodytagsaswellashooksforaddinglinks,stylesheetsandscripts.page.htmldefinesthecontentstructureandisthe
templatethatyou’lllikelywanttouse.
346
Chapter7. Contributingguide
C#: How to Use SDK to Convert Document and Image Using XDoc.
You may use our converter SDK to easily convert PDF, Word, Excel, PowerPoint, Tiff, and Dicom files to raster images like Jpeg, Png, Bmp and Gif.
picture from pdf to powerpoint; converting pdf to powerpoint online
C# PDF Convert: How to Convert MS PPT to Adobe PDF Document
Microsoft PowerPoint to PDF. |. Home ›› XDoc.Converter ›› C# Converter: PowerPoint to PDF. You maybe interested: PDF in C#,
convert pdf to powerpoint online no email; image from pdf to powerpoint
CKANdocumentation,Release2.6.0a
Toextendatemplatesimplycreateanewtemplatefileandcall{% extend %}thendefinetheblocksthatyouwish
tooverride.
7.16.5 Blocksinpage.html
page.htmlextendsthe“page”blockinbase.htmlandprovidesthebasicpagestructureforprimaryandsecondary
content.
header
Overridetheheaderonapagebypagebasisbyextendingthisblock.Ifmakingsitewideheaderchangesitispreferable
tooverridetheheader.htmlfile:
{% block header %}
{% include "custom_header.html" %}
{% endblock k %}
content
Thecontentblockallowsyoutoreplacetheentirecontentsectionofthepagewithyourownmarkupifneeded:
{% block content t %}
<div class="custom-content">
{% block custom_block k %}{% % endblock %}
</div>
{% endblock k %}
toolbar
Thetoolbarisforcontenttobeaddedatthetopofthepagesuchasthebreadcrumbnavigation.Youcanremove/replace
thisbyextendingthisblock:
{# Remove the e toolbar r from this page. #}
{% block toolbar r %}{% % endblock k %}
breadcrumb
Addabreadcrumbtothepagebyextendingthiselement:
{% block breadcrumb b %}
{% include "breadcrumb.html" %}
{% endblock k %}
actions
Addactionstothepagebyextendingthiselement:
{% block actions s %}
<a class="btn" href="{{ { save_url l }}">Save</a>
{% endblock k %}
7.16. Frontenddevelopmentguidelines
347
XDoc.Converter for .NET, Support Documents and Images Conversion
file converter SDK supports various commonly used document and image file formats, including Microsoft Office (2003 and 2007) Word, Excel, PowerPoint, PDF, Tiff
pdf to powerpoint; convert pdf to editable powerpoint online
Online Convert PowerPoint to PDF file. Best free online export
Online Powerpoint to PDF Converter. Download Free Trial. Convert a PPTX/PPT File to PDF. Just upload your file by clicking on the blue
convert pdf to powerpoint using; pdf to powerpoint conversion
CKANdocumentation,Release2.6.0a
primary
Thisblockcanbeusedtoremovetheentireprimarycontentelement:
{% block primary y %}{% % endblock k %}
primary_content
Theprimary_contentblockcanbeusedtoaddcontenttothepage. Thisisthemainblockthatislikelytobeused
withinatemplate:
{% block primary_content t %}
<h1>My page e content</h1>
<p>Some content t for r the page</p>
{% endblock k %}
secondary
Thisblockcanbeusedtoremovetheentiresecondarycontentelement:
{% block secondary y %}{% endblock k %}
secondary_content
Thesecondary_contentblockcanbeusedtoaddcontenttothesidebarofthepage.Thisisthemainblockthatislikely
tobeusedwithinatemplate:
{% block secondary_content %}
<h2>A sidebar r item</h2>
<p>Some content t for r the item</p>
{% endblock k %}
footer
Overridethefooteronapagebypagebasisbyextendingthisblock:
{% block footer %}
{% include "custom_footer.html" %}
{% endblock k %}
Ifmakingsitewideheaderchangesitispreferabletooverridethefooter.html.Addingscriptsshouldusethe“scripts”
blockinstead.
7.16.6 Blocksinbase.html
doctype
AllowstheDOCTYPEtobesetonapagebypagebasis:
{% block doctype e %}<!DOCTYPE html>{% endblock %}
348
Chapter7. Contributingguide
RasterEdge XDoc.PowerPoint for .NET - SDK for PowerPoint Document
Able to view and edit PowerPoint rapidly. Convert. Convert PowerPoint to PDF. Convert PowerPoint to HTML5. Convert PowerPoint to Tiff. Convert PowerPoint to Jpeg
how to change pdf to powerpoint slides; change pdf to powerpoint online
C# WinForms Viewer: Load, View, Convert, Annotate and Edit
View PDF in WPF; C#.NET: View Word in WPF; C#.NET: View Excel in WPF; C#.NET: View PowerPoint in WPF; C#.NET: View Tiff in WPF. XDoc.Converter for C#; XDoc.PDF
pdf to ppt converter online for large; how to convert pdf slides to powerpoint presentation
CKANdocumentation,Release2.6.0a
htmltag
Allowscustomattributestobeaddedtothe<html>tag:
{% block htmltag g %}<html lang="en-gb" " class="no-js">{% endblock k %}
headtag
Allowscustomattributestobeaddedtothe<head>tag:
{% block headtag g %}<head data-tag="No o idea a what you'd add here">{% % endblock k %}
bodytag
Allowscustomattributestobeaddedtothe<body>tag:
{% block bodytag g %}<body class="full-page">{% endblock k %}
meta
Addcustommetatagstothepage.Callsuper()togetthedefaulttagssuchascharset,viewportandgenerator:
{% block meta a %}
{{ super() }}
<meta name="author" " value="Joe Bloggs" " />
<meta name="description" " value="My y website e description" " />
{% endblock k %}
title
Addacustomtitletothepagebyextendingthetitleblock.Callsuper()togetthedefaultpagetitle:
{% block title %}My y Subtitle - {{ super() }}{% endblock k %}
links
Thelinksblockallowsyoutoaddadditionalcontentbeforethestylesheetssuchasrssfeedsandfaviconsinthesame
wayasthemetablock:
{% block link k %}
<meta rel="shortcut t icon" " href="custom_icon.png" " />
{% endblock k %}
styles
Thestylesblockallowsyoutoaddadditionalstylesheetstothepageinthesamewayasthemetablock.Use‘‘super()
‘‘toincludethedefaultstylesheetsbeforeorafteryourown:
{% block styles %}
{{ super() }}
<link rel="stylesheet" href="/base/css/custom.css" />
{% endblock k %}
7.16. Frontenddevelopmentguidelines
349
C# powerpoint - Convert PowerPoint to PDF in C#.NET
RasterEdge Visual C# .NET PowerPoint to PDF converter library control (XDoc.PowerPoint) is a mature and effective PowerPoint document converting utility.
how to change pdf to ppt on; how to convert pdf slides to powerpoint
VB.NET PDF Converter Library SDK to convert PDF to other file
editing if they integrate this VB.NET PDF converter control with for converting MicroSoft Office Word, Excel and PowerPoint document to PDF file in VB
export pdf into powerpoint; pdf to powerpoint slide
CKANdocumentation,Release2.6.0a
page
Thepageblockallowsyoutoaddcontenttothepage.Mostofthetimeitisrecommendedthatyouextendoneofthe
page.htmltemplatesinordertogetthesiteheaderandfooter.Ifyouneedacleanpagethenthisistheblocktouse:
{% block page e %}
<div>Some other page content</div>
{% endblock k %}
scripts
Thescriptsblockallowsyoutoaddadditonalscriptstothepage.Usethesuper()functiontoloadthedefaultscripts
before/afteryourown:
{% block scripts s %}
{{ super() }}
<script src="/base/js/custom.js"></script>
{% endblock k %}
7.16.7 BuildingaJavaScriptModule
CKANmakesheavyuseofmodulestoaddadditionalfunctionalitytothepage.Essentiallyallamoduleconsistsofis
anobjectwithan.initialize()and.teardown()method.
Herewewillgothroughthebasicfunctionalityofbuildingasimplemodulethatsendsa“favourite”requesttothe
serverwhentheuserclicksabutton.
HTML
Theideabehindmodulesisthattheelementshouldalreadybeinthedocumentwhenthepageloads.Forexampleour
favouritebuttonwillworkjustfinewithoutourmoduleJavaScriptloaded.
<form action="/favourite" " method="post" " data-module="favorite">
<button class="btn" name="package" " value="101">Submit</button>
</form>
Hereit’sthedata-module="favorite"thattellstheCKANmoduleloadertocreateanewinstanceforthis
element.
JavaScript
Modulesresideinthejavascript/modulesdirectoryandshouldsharethesamenameasthemodule. Weusehyphens
todelimitspacesinbothfilenamesandmodules.
/javascript/modules/favorite.js
Amodulecanbecreatedbycallingckan.module():
ckan.module('favorite', function n (jQuery, , _) ) {
return {};
});
350
Chapter7. Contributingguide
CKANdocumentation,Release2.6.0a
Wepassinthemodulenameandafactoryfunctionthatshouldreturnourmoduleobject. Thisfactorygetspasseda
localjQueryobjectandatranslationobject.
Note: Inordertoincludeamoduleforpagerenderinclusionwithinanextensionitisrecommendedthatyouuse{%
resource %}withinyourtemplates.SeetheResourceDocumentation
Initialisation
Once ckanhasfoundanelement onthepage it creates anewinstance ofyourmodule andifpresentcalls the
.initialize()method.
ckan.module('favorite', function n (jQuery, , _) ) {
return {
initialize: function n () {
console.log('I've been called for element: %o', this.el);
}
};
});
Herewecansetupeventlistenersandothersetupfunctions.
initialize: function n () ) {
// Grab b our r button n and d assign n it t to o a a property of our r module.
this.button = = this.$('button');
// Watch for r our r favourite button to o be e clicked.
this.button.on('submit', jQuery.proxy(this._onClick, this));
},
_onClick: function n (event) ) {}
EventHandling
Nowwecreateourclickhandlerforthebutton:
_onClick: function n (event) ) {
event.preventDefault();
this.favorite();
}
Andthiscallsa.favorite()method. It’sgenerallybestnottodotoomuchineventhandlersitmeansthatyou
can’tusethesamefunctionalityelsewhere.
favorite: function n () ) {
// The e client on n the sandbox should d always be e used to o talk to o the e api.
this.sandbox.client.favoriteDataset(this.button.val());
}
NotificationsandInternationalisation
ThissubmitsthedatasettotheAPIbutideallywewanttotelltheuserwhatwe’redoing.
options: {
i18n: {
loading: _('Favouriting dataset'),
7.16. Frontenddevelopmentguidelines
351
CKANdocumentation,Release2.6.0a
done: _('Favourited d dataset t %(id)s')
}
},
favorite: function n () ) {
// i18n n gets a a translation key y from the e options s object.
this.button.text(this.i18n('loading'));
// The e client on n the sandbox should d always be e used to o talk to o the e api.
var request = = this.sandbox.client.favoriteDataset(this.button.val())
request.done(jQuery.proxy(this._onSuccess, this));
},
_onSuccess: function n () ) {
// We can perform interpolation on messages.
var message = = this.i18n('done', , {id: : this.button.val()});
// Notify allows global l messages s to o be e displayed d to o the user.
this.sandbox.notify(message, 'success');
}
Options
Displayinganidtotheuserisn’tveryfriendly.Wecanusethedata-moduleattributestopassoptionsthroughto
themodule.
<form action="/favourite" " method="post" " data-module="favorite" data-module-dataset="my dataset">
Thiswilloverridethedefaultsintheoptionsobject.
ckan.module('favorite', function n (jQuery, , _) ) {
return {
options: {
dataset: '',
i18n: {...}
}
initialize: function n () {
console.log('this dataset t is: : %s', this.options.dataset);
//=> "this dataset is: my y dataset"
}
};
});
Errorhandling
WheneverwemakeanAjaxrequestwewanttomakesurethatwenotifytheuseriftherequestfails.Againwecan
usethis.sandbox.notify()todothis.
favorite: function n () ) {
// The e client on n the sandbox should d always be e used to o talk to o the e api.
var request = = this.sandbox.client.favoriteDataset(this.button.val())
request.done(jQuery.proxy(this._onSuccess, this));
request.fail(jQuery.proxy(this._onError, this));
},
_onError: function n () ) {
var message = = this.i18n('error', , {id: this.button.val()});
// Notify allows global l messages s to o be e displayed d to o the user.
352
Chapter7. Contributingguide
CKANdocumentation,Release2.6.0a
this.sandbox.notify(message, 'error');
}
ModuleScope
YoumayhavenoticedwekeepmakingcallstojQuery.proxy()withinthesemethods. Thisistoensurethat
thiswhenthecallbackiscalledisthemoduleitbelongsto.
WehaveashortcutmethodcalledjQuery.proxyAll()thatcanbeusedinthe.initialize()methodtodo
allthebindingatonce.Itcanacceptmethodnamesorsimplyaregexp.
initialize: function n () ) {
jQuery.proxyAll(this, '_onSuccess');
// Same e as:
this._onSuccess = jQuery.proxy(this, , '_onSuccess');
// Even n better r do all methods s starting g with _on n at t once.
jQuery.proxyAll(this, /_on/);
}
Publish/Subscribe
Sometimeswewantmodulestobeabletotalktoeachotherinordertokeepthepagestateuptodate.Thesandbox
hasthe.publish()and.subscribe()methodsforjustthiscause.
Forexamplesaywehadacounterupintheheaderthatshowedhowmanyfavouritedatasetstheuserhad.Thiswould
beincorrectwhentheuserclickedtheajaxbutton.Wecanpublishaneventwhenthefavoritebuttonissuccessful.
_onSuccess: function n () ) {
// Notify allows global l messages s to o be e displayed d to o the user.
this.sandbox.notify(message, 'success');
// Tell l other modules s about this event.
this.sandbox.publish('favorite', this.button.val());
}
Nowinourothermodule‘user-favorite-counter’wecanlistenforthis.
ckan.module('user-favorite-counter', function (jQuery, , _) ) {
return {
initialize: function n () {
jQuery.proxyAll(this, /_on/);
this.sandbox.subscribe('favorite', this._onFavorite);
},
teardown: function () ) {
// We e must always unsubscribe on n teardown n to o prevent t memory leaks.
this.sandbox.unsubscribe('favorite', this._onFavorite);
},
incrementCounter: function n () {
var count = = this.el.text() ) + + 1;
this.el.text(count);
},
_onFavorite: function n (id) ) {
this.incrementCounter();
}
7.16. Frontenddevelopmentguidelines
353
CKANdocumentation,Release2.6.0a
};
});
UnitTests
Everymodulehasunittests.TheseuseMocha,ChaiandSinontoasserttheexpectedfunctionalityofthemodule.
Seealso:
Stringinternationalization Howtomarkstringsfortranslation.
7.16.8 Installfrontenddependencies
ThefrontendstylesheetsarewrittenusingLess(thisdependsonnode.jsbeinginstalledonthesystem)
InstructionsforinstallingNode.jscanbefoundontheNode.jswebsite. Pleasechecktheonesrelevanttoyourown
distribution
OnUbuntu,runthefollowingtoinstallNode.jsofficialrepositoryandthenodepackage:
curl -sL L https://deb.nodesource.com/setup_4.x x | sudo -E E bash -
sudo apt-get install l -y y nodejs
Note: IfyouusethepackageonthedefaultUbunturepositories(egsudo o apt-get install nodejs),the
nodebinarywillbecallednodejs. ThiswillpreventtheCKANlessscripttoworkproperly,soyouwillneedto
createalinktomakeitwork:
ln -/usr/bin/nodejs /usr/bin/node
Alsonpm(theNode.jspackagemanager)needstobeinstalledseparately:
sudo apt-get install l npm
Formoreinformation,refertotheNode.jsinstructions.
Lesscanthenbeinstalledviathenodepackagemanager(npm).WealsousenodewatchtomakeourLesscompiler
awatcherstylescript.
cdintotheCKANsourcefolder(eg/usr/lib/ckan/default/src/ckan)andrun:
$ npm install less@1.7.5 nodewatch
YoumayneedtousesudodependingonyourCKANinstalltype.
7.16.9 Filestructure
Allfront-endfilestobeservedviaawebserverarelocatedinthepublicdirectory(inthecaseofthenewCKAN
basethemeit’spublic/base).
css/
main.css
less/
main.less
ckan.less
...
javascript/
354
Chapter7. Contributingguide
Documents you may be interested
Documents you may be interested