Giter Site home page Giter Site logo

friendsofflarum / mason Goto Github PK

View Code? Open in Web Editor NEW
20.0 3.0 14.0 1003 KB

Add custom fields to discussions

Home Page: https://discuss.flarum.org/d/7028

License: MIT License

PHP 41.51% JavaScript 54.43% Less 1.99% TypeScript 2.07%
flarum-extension flagrow mason custom-fields

mason's Introduction

Mason by FriendsOfFlarum

License Latest Stable Version

Add custom fields to your discussions. Features:

  • Create custom fields with name, icon and description
  • Fields can be required or optional
  • Fields accept a dropdown selector or user-provided answers
  • User answers can be validated with custom Laravel Validator rules
  • You can choose the number of columns of the layout
  • (experimental) show the tags field as a Mason field

Note: due to the way the Flarum discussion composer works, it currently cannot be automatically resized to fit all fields. If you have many fields you will have to manually increase the composer height with the mouse handle.

Installation

composer require fof/mason

Updating

composer require fof/mason
php flarum migrate
php flarum cache:clear

Configuration

Once enabled, a new Mason tab will show up in the admin.

Fields

Fields can be created, edited and reordered on the page. New fields are immediately visible in the frontend.

If you delete a field, it will be removed from all discussion that used it. Fields use a "soft delete" feature so the data is preserved in the database even if you delete it. You can bring the field and its answers back by editing the database if you need.

Answers

Answers are pre-made answers for a field. If you want to keep an answer visible but prevent new discussions from using it, you can change its suggestion state. If the field accepts user values, these will show up as non-suggested answers.

You can rename an answer (either admin or user made) and it will be updated everywhere it's used.

Deleting an answer will permanently remove it from all discussion using it. Unlike fields it doesn't use "soft deletes" and as such cannot be recovered.

Permissions

The extension comes with several permissions to choose who can interact with custom fields. Check the Permissions tab to configure them.

Usage

The custom fields form will display on the discussion composer, on the first post of the discussion and as an option in the discussion edit menu. The layout can be customized via the settings available in the Mason page of the admin panel.

Updating from Flagrow

This extension replaces Flagrow Mason.

Please backup your data before attempting the update!

You can upgrade from any of the older versions of the Flagrow extension.

Then upgrade from the old extension to the new one:

composer remove flagrow/mason
composer require fof/mason

When you enable the new extension, the permissions, settings and the data from Flagrow Mason will be moved to FoF Mason.

Links

An extension by FriendsOfFlarum

mason's People

Contributors

clarkwinkelmann avatar davwheat avatar dependabot[bot] avatar flarum-bot avatar imorland avatar luceos avatar rob006 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mason's Issues

Does not display correctly on mobile

When viewing the drop-downs on mobile phones the post new discussion box isn't displayed correctly with this plugin and 3 questions enabled. Thanks for looking into it!

The answer field sandwiched by extra commas

Bug Report

Current Behavior

the answer field is followed by and follows a comma.

Steps to Reproduce

make any test post as https://bookclubforgrads.com/d/5-test

Expected Behavior

no extra comma

Screenshots

8bbb61c530b6c40da76d6599d5a6cfa

Environment

  • Flarum version: 1.0.4
  • Extension version: 1.0.1
  • Website URL: bookclubforgrads.com
  • Webserver: Unknown
  • Hosting environment: shared
  • PHP version: 7.4.11
  • Browser: all
Flarum core 1.0.4
PHP version: 7.4.11
Loaded extensions: Core, date, libxml, openssl, pcre, zlib, bz2, calendar, ctype, curl, hash, filter, ftp, gettext, gmp, SPL, iconv, pcntl, readline, Reflection, session, standard, shmop, SimpleXML, mbstring, tokenizer, xml, bcmath, dom, fileinfo, gd, imagick, imap, intl, json, exif, mysqlnd, mysqli, PDO, pdo_mysql, pdo_sqlite, Phar, posix, soap, sockets, sqlite3, tidy, timezonedb, xmlreader, xmlrpc, xmlwriter, xsl, zip, Zend OPcache
+----------------------+---------+--------+
| Flarum Extensions    |         |        |
+----------------------+---------+--------+
| ID                   | Version | Commit |
+----------------------+---------+--------+
| flarum-flags         | v1.0.0  |        |
| flarum-approval      | v1.0.0  |        |
| flarum-tags          | v1.0.3  |        |
| flarum-nicknames     | v1.0.0  |        |
| the-turk-mathren     | 0.3.7   |        |
| fof-links            | 1.0.0   |        |
| afrux-asirem         | v0.1.1  |        |
| fof-mason            | 1.0.1   |        |
| flarum-bbcode        | v1.0.0  |        |
| flarum-emoji         | v1.0.0  |        |
| flarum-lang-english  | v1.0.0  |        |
| flarum-likes         | v1.0.0  |        |
| flarum-lock          | v1.0.0  |        |
| flarum-markdown      | v1.0.1  |        |
| flarum-mentions      | v1.0.0  |        |
| flarum-statistics    | v1.0.0  |        |
| flarum-sticky        | v1.0.0  |        |
| flarum-subscriptions | v1.0.0  |        |
| flarum-suspend       | v1.0.0  |        |
| fof-formatting       | 1.0.0   |        |
| fof-pages            | 1.0.1   |        |
| flarum-pusher        | v1.0.0  |        |
+----------------------+---------+--------+
Base URL: https://bookclubforgrads.com
Installation path: /home/u102019608/domains/bookclubforgrads.com/public_html
Debug mode: off

Page not loading after installing mason

So recently I installed it with composer, after enabling it, everything stops working...
Tried clearing cache/ctrl+f5

Browser's console returns "TypeError: module is undefined" on line
if (module.default) module.default(app);

Can't work on Flarum 1.3.1

Bug Report

Current Behavior
Composer works weirdly after updated to 1.3.1 and enabled Mason. Mason field not displaying in discussions.

Steps to Reproduce

  1. Install Flarum 1.3.1.
  2. Install FoF Mason.
  3. Enable Mason.
  4. Click Start a Discussion button.

Expected Behavior
Composer works properly and Mason field is displayed in discussions.

Screenshots

For convenience, I recorded this GIF on freeflarum. I got same errors on my self-hosted Flarum.

Environment

  • Flarum version: 1.3.1
  • Extension version: 1.0.1
  • Website URL: http://example.com
  • Webserver: [nginx]
  • Hosting environment: [vps]
  • PHP version: 7.4.20
  • Browser: [chrome 102.0.5005.115]
Output of "php flarum info", run this in terminal in your Flarum directory.

Possible solution(s)

Additional Context
Errors in console after clicked Start a Discussion button:

forum.js?v=115bc3d5:sourcemap:2 TypeError: t.suggested_answers(...).forEach is not a function
at forum.js?v=115bc3d5:sourcemap:383:11233
at Array.forEach (<anonymous>)
at n.oninit (forum.js?v=115bc3d5:sourcemap:383:11190)
at Function.a (forum.js?v=115bc3d5:sourcemap:2:145019)
at j (forum.js?v=115bc3d5:sourcemap:2:156895)
at forum.js?v=115bc3d5:sourcemap:2:146713
at forum.js?v=115bc3d5:sourcemap:2:146916
at c (forum.js?v=115bc3d5:sourcemap:2:147039)
at l (forum.js?v=115bc3d5:sourcemap:2:145183)
at forum.js?v=115bc3d5:sourcemap:2:146031
a @ forum.js?v=115bc3d5:sourcemap:2
e.show @ forum.js?v=115bc3d5:sourcemap:2
(anonymous) @ forum.js?v=115bc3d5:sourcemap:2
n.newDiscussionAction @ forum.js?v=115bc3d5:sourcemap:2
onclick @ forum.js?v=115bc3d5:sourcemap:2
L.handleEvent @ forum.js?v=115bc3d5:sourcemap:2
forum.js?v=115bc3d5:sourcemap:2 TypeError: Cannot read properties of undefined (reading 'onbeforeupdate')
at forum.js?v=115bc3d5:sourcemap:2:149948
at p (forum.js?v=115bc3d5:sourcemap:2:150156)
at f (forum.js?v=115bc3d5:sourcemap:2:149572)
at forum.js?v=115bc3d5:sourcemap:2:151356
at p (forum.js?v=115bc3d5:sourcemap:2:151394)
at f (forum.js?v=115bc3d5:sourcemap:2:148072)
at forum.js?v=115bc3d5:sourcemap:2:151356
at p (forum.js?v=115bc3d5:sourcemap:2:151394)
at f (forum.js?v=115bc3d5:sourcemap:2:149572)
at forum.js?v=115bc3d5:sourcemap:2:151356
a @ forum.js?v=115bc3d5:sourcemap:2
(anonymous) @ forum.js?v=115bc3d5:sourcemap:2
requestAnimationFrame (async)
u @ forum.js?v=115bc3d5:sourcemap:2
(anonymous) @ forum.js?v=115bc3d5:sourcemap:2
dispatch @ forum.js?v=115bc3d5:sourcemap:2
v.handle @ forum.js?v=115bc3d5:sourcemap:2
trigger @ forum.js?v=115bc3d5:sourcemap:2
simulate @ forum.js?v=115bc3d5:sourcemap:2
n @ forum.js?v=115bc3d5:sourcemap:2
handler @ forum.js?v=115bc3d5:sourcemap:2
dispatch @ forum.js?v=115bc3d5:sourcemap:2
v.handle @ forum.js?v=115bc3d5:sourcemap:2
trigger @ forum.js?v=115bc3d5:sourcemap:2
(anonymous) @ forum.js?v=115bc3d5:sourcemap:2
each @ forum.js?v=115bc3d5:sourcemap:2
each @ forum.js?v=115bc3d5:sourcemap:2
trigger @ forum.js?v=115bc3d5:sourcemap:2
C.each.C.fn.<computed> @ forum.js?v=115bc3d5:sourcemap:2
n.focus @ forum.js?v=115bc3d5:sourcemap:2
(anonymous) @ forum.js?v=115bc3d5:sourcemap:2
l @ forum.js?v=115bc3d5:sourcemap:2
c @ forum.js?v=115bc3d5:sourcemap:2
setTimeout (async)
(anonymous) @ forum.js?v=115bc3d5:sourcemap:2
u @ forum.js?v=115bc3d5:sourcemap:2
fireWith @ forum.js?v=115bc3d5:sourcemap:2
fire @ forum.js?v=115bc3d5:sourcemap:2
u @ forum.js?v=115bc3d5:sourcemap:2
fireWith @ forum.js?v=115bc3d5:sourcemap:2
a @ forum.js?v=115bc3d5:sourcemap:2
u @ forum.js?v=115bc3d5:sourcemap:2
fireWith @ forum.js?v=115bc3d5:sourcemap:2
fire @ forum.js?v=115bc3d5:sourcemap:2
dequeue @ forum.js?v=115bc3d5:sourcemap:2
r.complete @ forum.js?v=115bc3d5:sourcemap:2
u @ forum.js?v=115bc3d5:sourcemap:2
fireWith @ forum.js?v=115bc3d5:sourcemap:2
u @ forum.js?v=115bc3d5:sourcemap:2
C.fx.tick @ forum.js?v=115bc3d5:sourcemap:2
ue @ forum.js?v=115bc3d5:sourcemap:2
requestAnimationFrame (async)
ue @ forum.js?v=115bc3d5:sourcemap:2
requestAnimationFrame (async)
ue @ forum.js?v=115bc3d5:sourcemap:2
requestAnimationFrame (async)
ue @ forum.js?v=115bc3d5:sourcemap:2
requestAnimationFrame (async)
ue @ forum.js?v=115bc3d5:sourcemap:2
requestAnimationFrame (async)
ue @ forum.js?v=115bc3d5:sourcemap:2
requestAnimationFrame (async)
ue @ forum.js?v=115bc3d5:sourcemap:2
C.fx.start @ forum.js?v=115bc3d5:sourcemap:2
C.fx.timer @ forum.js?v=115bc3d5:sourcemap:2
he @ forum.js?v=115bc3d5:sourcemap:2
s @ forum.js?v=115bc3d5:sourcemap:2
dequeue @ forum.js?v=115bc3d5:sourcemap:2
(anonymous) @ forum.js?v=115bc3d5:sourcemap:2
each @ forum.js?v=115bc3d5:sourcemap:2
each @ forum.js?v=115bc3d5:sourcemap:2
queue @ forum.js?v=115bc3d5:sourcemap:2
animate @ forum.js?v=115bc3d5:sourcemap:2
n.animateHeightChange @ forum.js?v=115bc3d5:sourcemap:2
n.show @ forum.js?v=115bc3d5:sourcemap:2
n.animatePositionChange @ forum.js?v=115bc3d5:sourcemap:2
n.onupdate @ forum.js?v=115bc3d5:sourcemap:2
a @ forum.js?v=115bc3d5:sourcemap:2
(anonymous) @ forum.js?v=115bc3d5:sourcemap:2
a @ forum.js?v=115bc3d5:sourcemap:2
(anonymous) @ forum.js?v=115bc3d5:sourcemap:2
requestAnimationFrame (async)
u @ forum.js?v=115bc3d5:sourcemap:2
L.handleEvent @ forum.js?v=115bc3d5:sourcemap:2
forum.js?v=115bc3d5:sourcemap:2 TypeError: Cannot read properties of undefined (reading 'onbeforeupdate')
at forum.js?v=115bc3d5:sourcemap:2:149948
at p (forum.js?v=115bc3d5:sourcemap:2:150156)
at f (forum.js?v=115bc3d5:sourcemap:2:149572)
at forum.js?v=115bc3d5:sourcemap:2:151356
at p (forum.js?v=115bc3d5:sourcemap:2:151394)
at f (forum.js?v=115bc3d5:sourcemap:2:148072)
at forum.js?v=115bc3d5:sourcemap:2:151356
at p (forum.js?v=115bc3d5:sourcemap:2:151394)
at f (forum.js?v=115bc3d5:sourcemap:2:149572)
at forum.js?v=115bc3d5:sourcemap:2:151356
a @ forum.js?v=115bc3d5:sourcemap:2
(anonymous) @ forum.js?v=115bc3d5:sourcemap:2
requestAnimationFrame (async)
u @ forum.js?v=115bc3d5:sourcemap:2
(anonymous) @ forum.js?v=115bc3d5:sourcemap:2
dispatch @ forum.js?v=115bc3d5:sourcemap:2
v.handle @ forum.js?v=115bc3d5:sourcemap:2
trigger @ forum.js?v=115bc3d5:sourcemap:2
simulate @ forum.js?v=115bc3d5:sourcemap:2
n @ forum.js?v=115bc3d5:sourcemap:2

It will shows more errors if click on buttons on composer.

When mason fields are in Banner, DiscussionPage-nav not showing properly

If you choose "Show fields in the discussion banner instead of the "first post" , in any discussion page, the right navigator will not render properly .(because of it's <ul> has position:fixed , a quick change to position:absolute would fix the problem* )

I do not know whether this issue is related to flarum/core or this extension.

  • I realised shortly after I changed that the behaviour changes (the nav isn't sticky anymore which is not cool ๐Ÿ˜ข ) if we do this, please ignore this fix.

Permissions Not Working Correctly

It appears that permissions for Mason aren't quite working. I have it set so that anyone can view the contents of fields on posts, however when logged in as another user (on a separate session), I'm unable to view the contents of the fields. I've included a screenshot of what I see when I'm signed in as admin vs what I see when signed in as another user, and also the configuration on my permissions page.

image
Logged in as another user

image
Logged in as admin

image
Permission settings

Flarum Version: 0.1.0-beta.13
PHP Version: 7.3.23
MySQL Version: 10.5.6-MariaDB

TypeError: T(...) is not a function - mount-redraw.js:15

Bug Report

Current Behavior
Gives javascript error in google chrome console, on starting a discussion.

Steps to Reproduce

  1. Go to homepag
  2. keep open the google chrome console
  3. Start a discussion
  4. Then see error in the google chrome console

Expected Behavior
There should be no error in console

Screenshots
image

Environment

  • Flarum version: 1.0
  • Extension version: dev-master
  • Website URL: http://example.com
  • Webserver: [e.g. apache, nginx]
  • Hosting environment: [e.g. shared, vps]
  • PHP version: 7.3.21
  • Browser: [e.g. chrome 67, safari 11]
Output of "php flarum info", run this in terminal in your Flarum directory.

Possible solution(s)

Additional Context
Add any other context about the problem here.

Not all text is translatable

I have made a russian translation of Mason, but some text labels are hardcoded: Field setting, Field answers, New answer :)

2019-07-29_175814

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.