1.0.12 • Published 5 years ago

punchlist v1.0.12

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

Punch List Jquery Less

Simple plugin to organize tasks without Jquery

Getting Started

These instructions will get you a copy of the project up and running on your local machine.

Installation

To install punchlist run the following command

npm install

Examples

To run the examples run the following command

npm start

It will start listening on localhost port 3030

Examples:

  1. Example with API Call: http://localhost:3030/example.html
  2. Example without API Call: http://localhost:3030/example_b.html
  3. Example with dev js: http://localhost:3030/example_dev.html

Usage

  1. Include Font Awesome CSS:

     <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.1/css/all.css">
  2. Include Punch List CSS:

     <link rel="stylesheet" href="dist/punchlist.css">
  3. Include Punch List JS:

    <script src="dist/punchlist.all.min.js"></script>
  4. Call the plugin:

    	```javascript
    	punchList.init(options);
    	```

    Options

    Options are used to configure the Punch List. Detailed Options to be send:

PropertyDescription
.containerRequired. Selector for the main container of the Punch List
.titleTitle of the Punch List
.widthWidth of the container. If not set, will expand to the size of the parent
.fillDataCallRestFULL API CALL. Response must be JSON
.fillDataTransformJSON mapping to convert to standarize items. In case that .fillDataCall was used
.addItemHandlerHandler to be called one a item is added Parameters itemId: is the unique id that can be used to return the dom of the object val: is the task value the new item will have
.removeItemHandlerHandler to be called when an item is removed Parameters itemId: is the unique id that can be used to return the dom of the object itemData: is the 'item' data $(#itemId).data('item')
.checkedItemHandlerHandler to be called when an item change is status Parameters itemId: is the unique id that can be used to return the dom of the object itemData: is the 'item' data $(#itemId).data('item') checked: boolean. It tells if the item has been checked or unchecked

Example

var options = {
  width: 600,
  fillDataCall: "json/response.json",
  fillDataTransform: jsonTransform,
  addItemHandler: onAdd,
  removeItemHandler: onDelete,
  checkedItemHandler: onChecked,
  container: "#punchlist-container"
};

See also: working example

JSON Data Transform

In order to be able to use a json not using the format expected in the punch list, a transformation must be made. The transformation information must be set in an object.

PropertyDescription
.taskThis is the userdata property where is the description of the task.
.checkedThis is the userdata property where is a boolean value that inform if the task is complete or not.If not set all task will be in not complete state.
.dataThis is an array of key value pair of field. This data will be added in each task item that is added.This information is send when the task is deteled or change it's complete state.This property is not required.KeyValue Pair Properties:name -> The key property that will be added in data.field -> The property field in the userdata that will be use as value.
.tagsThis is an array of key value pair of field. This data will be shown under the task name to add extra information that could be need.This property is not required.KeyValue Pair Properties:name -> The key property that will be added in data.field -> The property field in the userdata that will be use as value.convert -> Conver the value in case that need. Current there is a unique "date"."date": Convert from String to Date and return localeString of it.
.commentsThis is an object property. It will contain comments of the task that are inside of the userdata.This property is not required.Object Properties:listField : Property in userdata where the Arrays of Comments are.field : The property inside the array where the proper comment is.deletable : Property informing if the comments in userdata can be deleted.tags : See tags.

Example

      var jsonTransform = {
        data: [
        {
          field: "id",
          name: "id"
        }],
        task: "item",
        checked: "index",
        tags: [ 
          { 
            field:"project",
            name:"Project",
            convert: null,
          }, 
          {
            field:"datetime",
            name:"Date",
            convert: "date", 
          }
        ],
        comments: { 
          listField: "comments", 
          field:"comment",
          deletable: false,
          tags: [
            {
              field: "user",
              name: "User",
              convert: null,
            }
          ]
        }
      }   
    };

See also: working example and converted json

Task Data

Data used in function drawItems(data).

PropertyDescription
taskField for the task description
checkedboolean indicating if the task is done or not.
dataAn array of KeyValuePair. This information will be added as data inside the task items and will be sent when the task is deleted or it state is changed.
tagsAn array of KeyValuePair. This information will be shown under the task to provide more context of the task.
commentsAn array of comments that will be shown under the task.

Comments

PropertyDescription
commentString with the comment.
deletableboolean declaring if the comment can be deleted.
tagsAn array of KeyValuePair. This information will be shown under the task to provide more context of the task.

####Example:

```javascript
var tasks = [ {
    task:"Task Description",
    checked:false,
    data: [ {
      name: 'id',
      value: 'TaskUniqueIDonOthePlatform',
      },
      ...
    ],
    tags: [ {
      name: 'User',
      value: 'Boss',
      },
      {
      name: 'Date',
      value: 'Yesterday',
      },
      ...
    ],        
    comments: [ {
      comment: 'This is my comment',
      deletable: false,
      tags: [ {
      name: 'User',
      value: 'Boss',
      },
      {
      name: 'Date',
      value: 'Yesterday',
      },
      ...
      ] },
    ...
    ] ,
    ...
  },
  ...
  ];
```

See also: working example

License

This project is licensed under the MIT License - see the LICENSE.txt file for details

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago