GithubHelp home page GithubHelp logo

mauriora / model-announcement-extended Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 27 KB

Shared model for the announcement (title, body, expires) extended with the properties urgent, start date, url and owner.

License: MIT License

TypeScript 100.00%

model-announcement-extended's Introduction

Model-Announcement-Extended

Shared model of the standard Announcement (title, body, expires) extended with the properties urgent, start date, url and owner.

Contains the typescript model implementation and the sharepoint provisioning files.

Please refer to the root workspace documentation as well

This is part of the hybrid repro MVC SharePoint example implementation

Table of content

Sharepoint provisioning files

In the sharepoint folder are the following provisioning files:

React example

This shows how to load all the announcements and display them as MessageBars.

import { AnnouncementExtended } from '@mauriora/model-announcement-extended';
import { getCreateByIdOrTitle } from '@mauriora/controller-sharepoint-list';

const newController = await getCreateByIdOrTitle(listName, siteUrl);

const now: string = new Date().toISOString();

const newModel = await newController.addModel(
    AnnouncementExtended,
    `(StartDate le datetime'${now}' or StartDate eq null) and ` + 
    `(Expires ge datetime'${now}' or Expires eq null)`
);
await newModel.loadAllRecords();

return <Stack>
    {newModel.records.map(announcement =>
        <StackItem key={`announcement-stack-item-${announcement.id}`}>
            <MessageBar
                messageBarType={(announcement.urgent ? MessageBarType.error : MessageBarType.warning)}
            >
            <Stack horizontal horizontalAlign='space-between'>
                <StackItem>
                    <Text variant='large'>{announcement.title}</Text>&nbsp;
                </StackItem>
                <StackItem>
                    <span
                        style={{ whiteSpace: 'normal' }}
                        dangerouslySetInnerHTML={{ __html: announcement.body }}
                    />
                </StackItem>
                {announcement.url &&
                    <StackItem>
                        <Link href={announcement.url.url} target="_blank">
                            {announcement.url.description ?? announcement.url.url}
                        </Link>
                    </StackItem>
                }
            </Stack>
            </MessageBar>
        </StackItem>
    )}
</Stack>;

model-announcement-extended's People

Contributors

denniskuhn avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.