forked from zinc-collective/convene
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
They were interesting but ultimately unsatisfying. I want to focus on the frame and then start filling it with mechanic.
- Loading branch information
Showing
53 changed files
with
264 additions
and
706 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<%- content_for :content do %> | ||
<%= turbo_frame_tag(surveyors_guild, data: { turbo_action: :advance }) do %> | ||
<%= yield %> | ||
<%- end %> | ||
<%- end %> | ||
|
||
<%= render template: "layouts/application" %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<%= turbo_frame_tag(furniture, src: furniture.location, data: { turbo_action: :advance }) do %> | ||
<%= render furniture %> | ||
<%- end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# frozen_string_literal: true | ||
|
||
# @see https://github.com/kzkn/gretel | ||
|
||
crumb :slipvector_survey do |survey| | ||
parent :slipvector_star_system, survey.star_system | ||
link survey.id, survey.location | ||
end | ||
|
||
crumb :slipvector_star_system do |star_system| | ||
parent :slipvector_surveyors_guild, star_system.surveyors_guild | ||
link star_system.name, star_system.location | ||
end | ||
|
||
|
||
crumb :slipvector_surveyors_guild do |surveyors_guild| | ||
parent :room, surveyors_guild.room | ||
link "Surveyors Guild", surveyors_guild.location | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class Slipvector | ||
class Controller < ApplicationController | ||
layout "slipvector" | ||
|
||
expose :surveyors_guild, model: SurveyorsGuild | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class Slipvector | ||
class DataLevel | ||
include ActiveModel::Model | ||
include ActiveModel::Attributes | ||
include ActiveModel::Validations | ||
|
||
attribute :observes, :string | ||
validates :observes, inclusion: {in: [:energy, :life, :materials, :oddities]} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class Slipvector | ||
class DataLevelType < ActiveRecord::Type::Json | ||
def deserialize(string) | ||
return [] if string.nil? | ||
super.map do |data_level| | ||
DataLevel.new(**data_level) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,11 @@ | ||
en: | ||
slipvector: | ||
surveyors_guild: | ||
star_systems: | ||
create: | ||
success: "Registered Star System!" | ||
failure: "Couldn't Register Star System!" | ||
star_system: | ||
surveys: | ||
create: | ||
success: "Launched a Survey in Star System" | ||
failure: "Couldn't Survey Star System" | ||
survey: | ||
rolls: | ||
create: | ||
success: "Experiment Complete!" | ||
failure: "Experiment Failed!" | ||
|
||
star_systems: | ||
create: | ||
success: "Registered Star System!" | ||
failure: "Couldn't Register Star System!" | ||
surveys: | ||
create: | ||
success: "Launched a Survey in Star System" | ||
failure: "Couldn't Survey Star System" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<%= render survey %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class Slipvector | ||
class StarSystem < Record | ||
self.table_name = "slipvector_star_systems" | ||
|
||
belongs_to :surveyors_guild, inverse_of: :star_systems | ||
location(parent: :surveyors_guild) | ||
|
||
attribute :data_levels, DataLevelType.new | ||
|
||
has_many :surveys, inverse_of: :star_system, dependent: :destroy | ||
has_many :active_surveys, -> { active }, class_name: :Survey | ||
|
||
def name | ||
super.presence || id | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class Slipvector | ||
class StarSystemPolicy < ApplicationPolicy | ||
alias_method :star_system, :object | ||
|
||
def create? | ||
person&.operator? || person&.member_of?(star_system.surveyors_guild.space) | ||
end | ||
|
||
alias_method :update?, :create? | ||
|
||
class Scope < ApplicationScope | ||
def resolve | ||
scope.all | ||
end | ||
end | ||
end | ||
end |
22 changes: 22 additions & 0 deletions
22
app/furniture/slipvector/star_systems/_star_system.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<%= render CardComponent.new do |card| %> | ||
<%- card.with_header do %> | ||
<h2><%= star_system.name %></h2> | ||
<%- end %> | ||
|
||
<%- @pagy, @surveys = pagy(policy_scope(star_system.surveys.complete.recent), items: 8) %> | ||
|
||
<div class="grid sm:grid-cols-2"> | ||
<%= render @surveys %> | ||
</div> | ||
|
||
<%== pagy_nav(@pagy, nav_extra: 'flex justify-between') %> | ||
|
||
<%- card.with_footer(variant: :action_bar) do %> | ||
<%- if star_system.active_surveys.present? %> | ||
<%- active_survey = star_system.active_surveys.first %> | ||
<%= link_to "Resume Survey #{active_survey.id}", star_system.active_surveys.first.location, class: "w-full button" %> | ||
<%- else %> | ||
<%= button_to("Begin Survey", star_system.location(child: :surveys), params: { survey: { status: :active } }, form_class: "w-full", class: "w-full") %> | ||
<%- end %> | ||
<%- end %> | ||
<%- end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<%- breadcrumb :slipvector_star_system, star_system%> | ||
<div class="my-4"> | ||
<%= link_to("⬅️ Back to Surveyors Guild", star_system.surveyors_guild.location) %> | ||
</div> | ||
<%= render star_system %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
class Slipvector | ||
class StarSystemsController < Controller | ||
expose :star_system, scope: -> { surveyors_guild.star_systems }, model: StarSystem | ||
|
||
def new | ||
authorize(star_system) | ||
end | ||
|
||
def create | ||
authorize(star_system) | ||
if star_system.save | ||
redirect_to(star_system.surveyors_guild.location, notice: t(".success")) | ||
else | ||
redirect_to(star_system.surveyors_guild.location, error: t(".failure")) | ||
end | ||
end | ||
|
||
def show | ||
authorize(star_system) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class Slipvector | ||
class Survey < Record | ||
self.table_name = "slipvector_surveys" | ||
|
||
belongs_to :star_system, inverse_of: :surveys | ||
location(parent: :star_system) | ||
has_one :surveyors_guild, through: :star_system | ||
|
||
scope :recent, -> { order(updated_at: :desc) } | ||
|
||
enum status: { | ||
preparing: "preparing", | ||
active: "active", | ||
complete: "complete" | ||
} | ||
end | ||
end |
2 changes: 1 addition & 1 deletion
2
...veyors_guild/star_system/survey_policy.rb → app/furniture/slipvector/survey_policy.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
65 changes: 0 additions & 65 deletions
65
app/furniture/slipvector/surveyors_guild/star_system/survey.rb
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.