aboutsummaryrefslogtreecommitdiff
path: root/app/models
Commit message (Collapse)AuthorAgeFilesLines
* [FIX] Use form model to create/edit resources (fixes #4, fixes #5, refs #3)v0.1.10IN COMMON Collective2021-04-083-5/+146
| | | | | | | | | Since we must associate other models (e.g., classifications) to a Resource, we use a composite model to save all changes inside a database transaction. This approach makes it simpler to handle resources and their associations. Work remains to fix the geolocation and reverse geolocation to ensure these are in sync.
* [FIX] Fix User avatarIN COMMON Collective2021-03-221-2/+2
|
* [FIX] Availability of agentshellekin2021-02-112-3/+4
|
* [FIX] Restore REUSE 3.0 compliancehellekin2021-02-021-0/+4
|
* Add syntactic sugarhellekin2021-02-021-0/+6
| | | | | | | | | | | | To some it may be more straightforward to think of the members of an Agent as "users". This commit accepts using `Agent#users` instead of `Agent#members`, but warns developers that they should be using the other method. Since Agent has_many Users, the Principle of Least Surprise warrants that `agent.users` does something. But they're really members.
* [FIX] Account for users without an avatar or grouphellekin2021-02-021-0/+6
| | | | | | | | | | | | | | | 1. Ensure new users belong to an Agent Users may come without the correct group information, leading to a situation where they have no Agent assigned to them. The application cannot handle this, so we ensure new users are at least associated to the new Anonymous Agent. 2. Introduce a default avatar Users coming without an avatar would see a broken view. Now they're assigned a default avatar, which shows the IN COMMON icon logo instead.
* Do not validate associated Agenthellekin2021-01-221-1/+1
|
* Upgrade Rails and add StimulusJS supporthellekin2021-01-222-32/+16
|
* Merged masterhellekin2020-11-1210-0/+40
|\
| * REUSE: Add CC-BY-SA-4.0 to schemahellekin2020-10-291-0/+4
| |
| * REUSE: Add AGPL-3.0-or-later to app/*hellekin2020-10-299-0/+36
| |
* | Add map supporthellekin2020-11-111-0/+4
|/ | | | | | | | | | | | This commit creates a dedicated Map model and moves the JavaScript from view to a Stimulus controller. - Stimulus.js https://stimulusjs.org - Leaflet.js https://leafletjs.org Upcoming resources: - https://discourse.stimulusjs.org/t/leafletjs-with-stimulusjs-on-rails-6/1343/4 - https://github.com/ghybs/leaflet-defaulticon-compatibility
* Fix Resource editionhellekin2020-10-091-2/+13
|
* Add Classifications and Resource validationshellekin2020-10-095-21/+79
| | | | | | | | | | | | | | | | - Turn `has_and_belongs_to_many` into `has_many :through`: now, resources and sections are related through Classifications. - Refactor usage of jsonb column to use ActiveRecord validations - Attention! store_accessor: NOTE: If you are using structured database data types (eg. PostgreSQL hstore/json, or MySQL 5.7+ json) there is no need for the serialization provided by .store. Simply use .store_accessor instead to generate the accessor methods. Be aware that these columns use a string keyed hash and do not allow access using a symbol. NOTE: The default validations with the exception of uniqueness will work. For example, if you want to check for uniqueness with hstore you will need to use a custom validation to handle it. https://api.rubyonrails.org/classes/ActiveRecord/Store.html
* Add categories, sections, and import datahellekin2020-10-082-0/+2
|
* Fix typohellekin2020-10-081-1/+1
|
* Changed 'has_ony' to 'has_one'Nemael2020-10-081-1/+1
|
* Add model foundation for classificationshellekin2020-10-083-0/+41
| | | | | | | | Taxonomy > Category > Section This commit adds models for it. https://doc.incommon.cc/#classifications
* First pass at listing Resourceshellekin2020-10-061-0/+19
| | | | | | This implements resource listing and pagination. See /resources
* Add Resource modelhellekin2020-10-062-0/+7
| | | | | | Resources will be stored as JSON, in the (GeoJSON) :feature column. They are assigned an UUID upon creation if they don't comme with one. They belong to an Agent.
* Add instance methodshellekin2020-10-061-0/+10
| | | | | | | The Agency class can `grant` and `revoke` roles for a given Agent and User. Since it is primarily used in context of both an Agent and User, we add convenience methods so that one can grant or revoke a role simply by passing the desired role to the instance.
* Add Agent and Agency modelshellekin2020-10-052-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since IN COMMON is about collective management of data we're using the concept of Agent to describe a group of users acting together. In ActivityPub terms, Agent will be the Actor when manipulating data, so that any individual User (or application) member of this Agent will be able to manipulate data on behalf of this Agent. Therefore a User has many Agencies, and an Agent as well: the Agency model allows not only to create a joint table between Agents and Users, but also to manage User roles within the related Agent. Roles are defined as: - observer: one who can read and review or flag data - editor: one who create or edit data - maintainer: one who can edit data and manage maps - leader: one who can manage roles A User may have zero or more roles in an Agent. A User without a Agency record for a specific Agent will only be able to 'observe' public data from this Agent. (Note that this is not currently specified, but matches existing reflection on Agents) https://doc.incommon.cc/#agents
* Configure Discourse SSOhellekin2020-10-051-0/+4
| | | | | | | | We're creating a minimal User model that will be filled from SSO. We also configure Inflections so we can use SSO instead of Sso which looks weird for a module named after an acronym. Use Discourse as SSO: https://meta.discourse.org/t/using-discourse-as-a-sso-provider/32974
* rails new incommon-map -d postgresql -C -Thellekin2020-10-052-0/+3