Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
lynnfaraday committed Oct 27, 2020
2 parents 534d878 + 64e842f commit ddb799c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
11 changes: 7 additions & 4 deletions plugins/idle/web/roster_request_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@ module Idle
class RosterRequestHandler
def handle(request)

group = Global.read_config("website", "character_gallery_group") || "Faction"
groups = Character.all.select { |c| c.on_roster? }.group_by { |c| c.group(group) || "" }
gallery_group = Global.read_config("website", "character_gallery_group") || "Faction"
groups = Character.all.select { |c| c.on_roster? }.group_by { |c| c.group(gallery_group) || "" }

fields = Global.read_config("idle", "roster_fields").select { |f| f['field'] != 'name' }
titles = fields.map { |f| f['title'] }

roster = []

groups.each do |group, chars|
groups.each_with_index do |(group, chars), index|
name = group.blank? ? "No #{gallery_group}" : group
roster << {
name: group,
key: name.parameterize(),
name: name,
active_class: index == 0 ? "active" : "",
chars: chars.sort_by { |c| c.name }.map { |c| build_profile(c, fields) }
}
end
Expand Down
8 changes: 5 additions & 3 deletions plugins/scenes/public/plot_link.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ class PlotLink < Ohm::Model
index :scene
index :plot


def self.find_link(plot, scene)
PlotLink.all.select { |l| l.plot == plot && l.scene == scene }.first
PlotLink.find(plot_id: plot.id).combine(scene_id: scene.id).first
end

def self.find_by_plot(plot)
PlotLink.all.select { |l| l.plot == plot }
PlotLink.find(plot_id: plot.id)
end

def self.find_by_scene(scene)
PlotLink.all.select { |l| l.scene == scene }
PlotLink.find(scene_id: scene.id)
end

end
end
7 changes: 4 additions & 3 deletions plugins/scenes/web/get_plots_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ module AresMUSH
module Scenes
class PlotsRequestHandler
def handle(request)
Plot.all.to_a.sort_by { |p| [ p.end_date || "", p.start_date || "" ]}.reverse.map { |p| {
plots = Plot.all.to_a.map { |p| {
id: p.id,
title: p.title,
summary: Website.format_markdown_for_html(p.summary),
start_date: p.start_date,
end_date: p.end_date,
start_date: p.start_date || "",
end_date: p.end_date || "",
completed: p.completed,
content_warning: p.content_warning,
storytellers: get_storytellers(p)
}}
plots.sort_by { |p| [ p[:end_date], p[:start_date] ] }.reverse
end

def get_storytellers(plot)
Expand Down

0 comments on commit ddb799c

Please sign in to comment.