Install

grab js/pgi.js and user/pgi_config.js. Add them as scripts in your project.

<script src="./user/pgi_config.js" />
<script src="./js/pgi.js" />
Then Configure...

download code

Configure

  1. edit pgi_config.js file : more info about this below,
  2. Please double read warning about the token you will use,
  3. add .pgiButton class to any element that will launch the issue form.

warning installation instructions

Contribute

You may help the project by forking it, or using it and post issues. Contact the author for any question.

code post issue

!! WARNING !!

This is a very fast way to enable issues posting to your gitlab hosted project. It's also a pretty INSECURE way to make this. Using your own personal token with full privilege here CAN NOT BE SECURE. It can be grabbed by any (even very noob) hacker and give him access to your whole projects on gitlab.

So you SHOULD create a secondary account with ONLY GUEST PRIVILEGE and grab corresponding token here. This way the hacker will "only" spam your issue box until you reset token.

Configuration details

Dependencies

For now, script will need jQuery and Font Awesome to be installed in your page. You can add them to your own repo or load them from a free cdn like jsdelivr.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/normalize/3.0.3/normalize.min.css" media="all" type="text/css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/fontawesome/4.6.1/css/font-awesome.min.css" media="all" type="text/css">

about integration

By default, PGI form is hidden. It will be shown when clicking on any element with the .pgiButton class. The script will create a new div called "pgiDiv" with "pgiDiv" class at the end of your document containing the comment form you can customize style by creating a stylesheet declaring styles for #pgiDiv or .pgiDiv elements.

about pgi_config parameters

  • gitlab is the url of your gitlab instance ("gitlab.com","framagit.org",...)
  • usgroup is the gitlab username or group name where the project is stored
  • project is the project id. Should not contains . nor %2E
  • token is the token of the secondary account used to post issues. Did I tell you about WARNING?
  • form is a table containing all form fields definitions. For each :
    • name is the name of the field
    • type is one of the accepted html type of fields
    • destination is one of the accepted gitlab issue field
    • default is default value for the field
    • required is a boolean telling if the field is mandatory
    • hidden is a boolean telling if the field is hidden
  • intro is the text displayed above the submission form
  • thanks is the text displayed after submission
  • autoclose can be defined to false if you want the user to close the form by himself or to any value in ms if you want it to close automatically.

eating my own dogfood

post issue