Commit Graph

226 Commits

Author SHA1 Message Date
c08b62af80 Refactor translation and validation
We now use Symfony's Translation component. Yay! We get more powerful pluralisation and better a fallback mechanism. Will want to implement the caching mechanism at some point too. The API is replicated in JavaScript, which could definitely use some testing.

Validators have been refactored so that they are decoupled from models completely (i.e. they simply validate arrays of user input). Language packs should include Laravel's validation messages.

ref #267
2015-10-15 22:30:45 +10:30
bdf626b552 Basic parsing of HTML tags in translations
This allows text to be wrapped with a virtual element:

	key: "This is a <test>Test</test>"

	app.trans('key', {test: <a href="#"/>});

closes #574
2015-10-14 15:24:28 +10:30
c7c2d9a755 Fake PATCH/PUT/DELETE requests
closes #502
2015-10-14 12:46:59 +10:30
e3569d39cc Clean up, don't use mixin
PhpStorm/WebStorm doesn't like the mixin syntax, and it's clearer to just use Object.assign.
2015-10-13 16:57:18 +10:30
33dd5fff36 Initialise component state in init() instead of constructor
This allows component state to be overridden via monkey-patch. ref #246
2015-10-13 16:55:56 +10:30
7387dfb7da Concatenate items in {second}, not {first} 2015-10-11 10:09:22 +10:30
bddbf24055 Make punctuate translatable, rename to punctuateSeries 2015-10-08 22:42:03 +10:30
dd67291ce0 Major refactor and improvements
- Reorganised all namespaces and class names for consistency and structure. Following PSR bylaws (Abstract prefix, Interface/Trait suffix).
  - Move models into root of Core, because writing `use Flarum\Core\Discussion` is nice. Namespace the rest by type. (Namespacing by entity was too arbitrary.)
  - Moved some non-domain stuff out of Core: Database, Formatter, Settings.
  - Renamed config table and all references to "settings" for consistency.
  - Remove Core class and add url()/isInstalled()/inDebugMode() as instance methods of Foundation\Application.
  - Cleanup, docblocking, etc.

- Improvements to HTTP architecture
  - API and forum/admin Actions are now actually all the same thing (simple PSR-7 Request handlers), renamed to Controllers.
  - Upgrade to tobscure/json-api 0.2 branch.
  - Where possible, moved generic functionality to tobscure/json-api (e.g. pagination links). I'm quite happy with the backend balance now re: #262

- Improvements to other architecture
  - Use Illuminate's Auth\Access\Gate interface/implementation instead of our old Locked trait. We still use events to actually determine the permissions though. Our Policy classes are actually glorified event subscribers.
  - Extract model validation into Core\Validator classes.
  - Make post visibility permission stuff much more efficient and DRY.

- Renamed Flarum\Event classes for consistency. ref #246
  - `Configure` prefix for events dedicated to configuring an object.
  - `Get` prefix for events whose listeners should return something.
  - `Prepare` prefix when a variable is passed by reference so it can be modified.
  - `Scope` prefix when a query builder is passed.

- Miscellaneous improvements/bug-fixes. I'm easily distracted!
  - Increase default height of post composer.
  - Improve post stream redraw flickering in Safari by keying loading post placeholders with their IDs. ref #451
  - Use a PHP JavaScript minification library for minifying TextFormatter's JavaScript, instead of ClosureCompilerService (can't rely on external service!)
  - Use UrlGenerator properly in various places. closes #123
  - Make Api\Client return Response object. closes #128
  - Allow extensions to specify custom icon images.
  - Allow external API/admin URLs to be optionally specified in config.php. If the value or "url" is an array, we look for the corresponding path inside. Otherwise, we append the path to the base URL, using the corresponding value in "paths" if present. closes #244
2015-10-08 14:28:02 +10:30
a590150698 Fixes core.deleted_username as well. 2015-10-02 16:37:09 +09:00
f5b5d9ca5c Use correct method for notification drawer on mobile
Refs #500.
2015-09-29 01:28:47 +02:00
040ce52724 Return both unread and new notification count from the API
Related to #500.
2015-09-29 01:28:47 +02:00
88372640aa Remove core key reorganization comments 2015-09-24 14:22:32 +09:30
d5d7185794 Primary key renaming
Improved consistency for existing core translation key names.

See flarum/core#265
- Completely overhauled core en.yml
- Replaced existing key names in all core JS files to match
- Extracted a hardcoded string in IndexPage.js
- Combined two app.trans calls in DiscussionControls.js
- Removed hardcoded spaces from LogInModal.js and SignUpModal.js
- Added two new keys from DiscussionControls.js (soft delete)
- Created two new “reused keys” to YML to accommodate same
2015-09-23 14:58:33 +09:00
264725d872 Allow discussions to be hidden and restored 2015-09-22 17:48:21 +09:30
ab6e3351b4 Redraw old data after unsuccessful save 2015-09-22 17:23:28 +09:30
f591851cb2 Patch Mithril with a route shortcut attribute
Instead of:

<a href={app.route.user(user)} config={m.route}>

We can use:

<a route={app.route.user(user)}>
2015-09-22 17:09:38 +09:30
d610ea663f Keep post actions visible when controls dropdown is open
Also show without hover on touch devices
2015-09-22 17:05:14 +09:30
efca923d30 Add "Debug" button to inspect the response of a failed AJAX request
Related to #118
2015-09-18 16:46:46 +09:30
514eec7466 Clean up 2015-09-18 13:29:50 +09:30
0b406a06a1 Patch Mithril with a bidi attribute
Enables quick bidirectional bindings. So instead of this:

<input value={prop()} oninput={m.withAttr('value', prop)}/>

... we can do this:

<input bidi={prop}/>
2015-09-18 13:06:37 +09:30
9767bce1e3 Move dropdown mouseover to correct location
Related to #496.
2015-09-16 09:00:33 +02:00
ffcba1f173 Always use label as tooltip for header icons
Closes #496.
2015-09-16 08:45:45 +02:00
b0da51309e Copy properties when monkey-patching 2015-09-16 16:03:25 +09:30
8414a59908 Don't use a default dropdown label 2015-09-16 10:12:49 +09:30
6beb4fe898 Add external authenticator (social login) API
Allows registrations to be completed with a pre-confirmed email address
and no password.
2015-09-15 11:27:31 +09:30
8cccaaaf6b Improve API error handling
- Change 'path' key to 'source.pointer', as per spec
- Add 500 error detail if debug mode is on
2015-09-14 15:40:07 +09:30
d5b58b3146 Only set XHR authorization header if token isn't empty 2015-09-14 14:49:11 +09:30
6a5427b600 Make unread discussion titles less overwhelming 2015-09-08 10:27:50 +09:30
e8621636c5 Add init hook as a way to effectively monkey patch constructors
Related to #246
2015-09-08 10:27:02 +09:30
f6e21b75e1 Remove unused translations 2015-09-05 16:05:02 +09:30
7a6c48c30b Correct check that a translation is an object
typeof translation === 'object' returns true when translation is null
2015-09-04 12:19:02 +09:30
44f460cb11 Prevent ItemList crash when item is a number 2015-09-04 12:17:01 +09:30
7cce5b02ba Allow non-array value to be passed into listItems
Useful in some scenarios when using JSX
2015-09-04 12:16:23 +09:30
722058f2fb Move generic util into lib
Might come in handy for the admin section later on
2015-09-04 12:15:41 +09:30
70815b024a Make Dropdown and NotificationsDropdown components more extensible 2015-09-04 12:15:11 +09:30
7269385786 Make a copy of props passed into a component
Prevents some rare errors where the props object is read-only, and is
generally safer.
2015-09-04 12:13:55 +09:30
f0c240f863 Add a first empty state to the discussion list 2015-09-03 09:59:33 +02:00
bf83b36882 Remove redundant call 2015-09-01 10:08:37 +09:30
e7f4e5060c Use GroupBadge component to display user badges
closes #277
2015-08-31 13:44:05 +09:30
0474f410a4 Refactor start/endComputation into lazyRedraw method 2015-08-31 12:04:51 +09:30
f44e9f5140 Remove <script> tags from plain post content
closes #362
2015-08-31 10:49:24 +09:30
67f6b8599d Allow string primitives to be added to ItemLists 2015-08-29 15:25:36 +09:30
dea759d5b8 Fix JS docblock 2015-08-26 17:11:54 +09:30
734badb4bc Begin JavaScript cleanup 2015-08-26 16:56:33 +09:30
df385b7df2 Monkey patch mithril so we can use JSX component syntax
<Alert foo="bar"/> instead of Alert.component({foo: 'bar'})
2015-08-26 16:56:32 +09:30
9489173082 Fix some front-end bugs 2015-08-14 12:50:39 +09:30
c3b2fa5a99 Prevent badge tooltips from being cut off
By overflow in the notifications dropdown. closes flarum/core#228
2015-08-13 13:01:13 +09:30
9c7fab5d8c Support running in subdirectory with base_path config 2015-08-13 12:58:59 +09:30
3f809761d3 Improve extensions page
- Allow extensions to define an icon in their flarum.json
- Show a "please wait" modal when enabling/disabling an extension
- Styling tweaks
2015-08-07 08:51:03 +09:30
9def5d2b5d Clean up 2015-08-06 16:00:22 +09:30