0.0.71 • Published 2 years ago

assignment-launch v0.0.71

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Instancy Assignment Launch

Instancy assignment launch component for web applications. Easy to integrate and use.

Table of Contents

  1. Getting Started
  2. Installation
  3. Usage

Getting Started

Installation

  1. The assignment launch package is published on the npm Registry.
  2. Install the package: npm install assignment-launch
  3. Once installed import AssignmentLaunchModule from the installed package into your module as follows:
  4. We have dependency of Angular Material
    • Install the package: ng add @angular/material
  5. We need to add froala library, add in index.html file
  6. import style.css file in styles.css or styles.scss of the project
    • @import url('../node_modules/assignment-launch/src/lib/styles/style.css');

Usage

Import AssignmentLaunchModule into NgModule in app.module.ts.

In case if you get error with Angular Material Controls import MatButtonModule MatIconModule MatSidenavModule MatCardModule MatDividerModule MatTabsModule MatFormFieldModule MatInputModule

Above Mention Angular Material Control used in library

import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
import { MatSidenavModule } from '@angular/material/sidenav';
import { MatCardModule } from '@angular/material/card';
import { MatDividerModule } from '@angular/material/divider';
import { MatTabsModule } from '@angular/material/tabs';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';

import { AssignmentLaunchModule } from "assignment-launch";

const materialModules = [
  MatButtonModule,
  MatIconModule,
  MatSidenavModule,
  MatCardModule,
  MatDividerModule,
  MatTabsModule,
  MatFormFieldModule,
  MatInputModule,
];

@NgModule({
  // ...
  imports: [
    ...materialModules,
    AssignmentLaunchModule,
  ],
  exports: [...materialModules]
  // ...
})

Declare the component data variables and options in your component where you want to consume the assignment launch component.

import { Component, OnInit } from '@angular/core';

export class AppComponent implements OnInit {

  answerHtmlData: string = "<p>Assignment Answer</p>";

  instructions: string = "<p>Assignment Instruction</p>";

  feedbackList: any = [];

  config = {
    user: 'Adam Levine',
    clientURL: '',
    froalaKey: 'froala_key',
    requestHeaders: '',
    imageUploadURL: '',
    imageUploadParams: '',
    imageMaxSize: 10 * 1024 * 1024,
    imageUploadMethod: 'POST',
    videoUploadURL: '',
    videoUploadParams: '',
    videoUploadMethod: '',
    videoMaxSize: 50 * 1024 * 1024,
    fileUploadURL: '',
    fileUploadParams: '',
    fileUploadMethod: '',
  };

  // get answer
  sendAnswer(editorHtml: string) {
    this.editorData.emit({
      html: editorHtml,
    });
  }

  // get feedback list
  getFeedbackListData(list: any) {
    this.getFeedbackList.emit(list);
  }

  // add new feedback
  addNewFeedback(feedback: any) {
    this.addFeedback.emit(feedback);
  }

  // add new reply
  addNewReply(reply: any) {
    this.addReply.emit(reply);
  }

  // edited feedback details
  getEditedFeedback(feedback: any) {
    this.editFeedback.emit(feedback);
  }

  // edited reply feeback
  getEditedReply(reply: any) {
    this.editReply.emit(reply);
  }

  // delete feedback
  deleteFeedback(feedback: any) {
    this.deletedFeedback.emit(feedback);
  }

  // delete reply
  deleteReply(reply: any) {
    this.deletedReply.emit(reply);
  }

  //score
  getScore(score: any) {
    this.score.emit(score);
  }

  // is assignment accepted
  assignmentAccepted(accepted: boolean) {
    this.isAccepted.emit(accepted);
  }

  // is assignment rejected
  assignmentRejected(rejected: boolean) {
    this.isRejected.emit(rejected);
  }

}

Add the following component tag in you template

<instancy-assignment-launch
    [instructions]="instructions"
    (editorData)="getEditorData($event)"
    [setEditorData]="answerHtmlData"
    (getFeedbackList)="getFeedbackList($event)"
    (addFeedback)="addNewFeedback($event)"
    (editFeedback)="editFeedback($event)"
    [config]="config"
    [feedbackList]="feedbackList"
    (deletedFeedback)="deleteFeedback($event)"
    (score)="getScore($event)"
    (isAccepted)="assignmentAccepted($event)"
    (isRejected)="assignmentRejected($event)"
  >
  </instancy-assignment-launch>

We need to add froala library, add in index.html file

<link
      href="https://cdn.jsdelivr.net/npm/froala-editor@3.1.0/css/froala_editor.pkgd.min.css"
      rel="stylesheet"
      type="text/css"
    />

    <!-- Include Code Mirror CSS. -->
    <link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.3.0/codemirror.min.css"
    />

    <script
      type="text/javascript"
      src="https://cdn.jsdelivr.net/npm/froala-editor@3.1.0/js/froala_editor.pkgd.min.js"
    ></script>
    <!-- Include Code Mirror JS. -->
    <script
      type="text/javascript"
      src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.3.0/codemirror.min.js"
    ></script>
    <script
      type="text/javascript"
      src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.3.0/mode/xml/xml.min.js"
    ></script>

    <!-- Include PDF export JS lib. -->
    <script
      type="text/javascript"
      src="https://raw.githack.com/eKoopmans/html2pdf/master/dist/html2pdf.bundle.js"
    ></script>

Config Variable

The following list of settings are supported by the component. Configure the settings to meet your requirement.

SettingsTypeDescriptionSuggestion
userstringPass use current user name valueNo suggestion
userIDnumberPass the current user idNo suggestion
isEditablebooleanAllow answer to be editable or read-only modePass true or false
isAdminbooleanIs user is Admin/ReviewerPass true or false
clientURLstringPass the application url (host url)No suggestion
froalaKeystringPass the froala license key you got at the time of the froala subscriptionNo suggestion
requestHeadersobjectPass the required header for API callNo Suggestion
imageUploadURLstringPass the image upload API urlNo suggestion
imageUploadParamsobjectPass the required params to upload the image{SiteId: '', LocaleId: ''}
imageMaxSizenumberPass the image max size in kb10 1024 1024
imageAllowedTypesarrayPass the image upload types'jpeg', 'jpg', 'png', 'gif'
imageUploadMethodstringPass the method'POST'
videoUploadURLstringPass the video upload API urlNo suggestion
videoUploadParamsobjectPass the required params to upload the video{SiteId: '', LocaleId: ''}
videoMaxSizenumberPass the image max size in kb50 1024 1024
videoAllowedTypesarrayPass the video upload types'mp4', 'wmv', 'avi', 'flv', 'mov', 'ogg', 'webm'
videoUploadMethodstringPass the method'POST'
fileUploadURLstringPass the file upload API urlNo suggestion
fileUploadParamsobjectPass the required params to upload the file{SiteId: '', LocaleId: ''}
fileMaxSizenumberPass the image max size in kb5 1024 1024
fileAllowedTypesarrayPass the video upload types'*'
fileUploadMethodstringPass the method'POST'

Events

EventDescription
getFeedbackListTo get all the feedback list
addFeedbackTo add new feedback, it returns added feedback data
editFeedbackTo edit the feedback, it returns edited feedback data
deletedFeedbackTo delete the feedback, it returns deleted feedback data
scoreProvide score for assignment, it returns score value (between 0 - 100)
isAcceptedIt returns true(boolean) if assignment accepted
isRejectedIt returns true(boolean) if assignment rejected
feedbackOpenedIt returns, if feedback panel is opened true or else false

Pass Data to the Libraray

EventDescription
instructionsTo pass the instructions data
setEditorDataTo set the editor data (Answer Data)
configTo pass the configuration for editor and feedback
feedbackListTo pass the feedback data
setScoreTo pass the value to set score

Themes and Theming

import style.css file in styles.css or styles.scss of the project - @import url('../node_modules/assignment-launch/src/lib/styles/style.css');

0.0.70

2 years ago

0.0.71

2 years ago

0.0.69

2 years ago

0.0.62

2 years ago

0.0.63

2 years ago

0.0.64

2 years ago

0.0.65

2 years ago

0.0.66

2 years ago

0.0.68

2 years ago

0.0.60

2 years ago

0.0.61

2 years ago

0.0.59

2 years ago

0.0.51

2 years ago

0.0.52

2 years ago

0.0.53

2 years ago

0.0.54

2 years ago

0.0.55

2 years ago

0.0.56

2 years ago

0.0.57

2 years ago

0.0.58

2 years ago

0.0.50

2 years ago

0.0.49

2 years ago

0.0.40

3 years ago

0.0.41

3 years ago

0.0.42

3 years ago

0.0.43

3 years ago

0.0.44

3 years ago

0.0.45

3 years ago

0.0.46

3 years ago

0.0.37

3 years ago

0.0.38

3 years ago

0.0.39

3 years ago

0.0.35

3 years ago

0.0.36

3 years ago

0.0.48

3 years ago

0.0.32

3 years ago

0.0.33

3 years ago

0.0.34

3 years ago

0.0.31

3 years ago

0.0.30

3 years ago

0.0.29

3 years ago

0.0.28

3 years ago

0.0.27

3 years ago

0.0.26

3 years ago

0.0.25

3 years ago

0.0.24

3 years ago

0.0.22

3 years ago

0.0.21

3 years ago

0.0.20

3 years ago

0.0.19

3 years ago

0.0.18

3 years ago

0.0.17

3 years ago

0.0.16

3 years ago

0.0.15

3 years ago

0.0.14

3 years ago

0.0.13

3 years ago

0.0.12

3 years ago

0.0.11

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago