Friday, September 20, 2024 2:56:20 AM
> settings

Customize


Authenticate

> _edit.html.erb
<h1>Modify Community</h1>
<%= form_for current_community, url: community_path(current_community.public_id), html: { id: "edit-community" } do |f| %>
  <%# Community ID %>
  <div class="uk-margin-medium-top">
    <% if !current_community.player_mode_enabled? %>
      <div class="uk-margin-bottom">
        <h3 class="uk-margin-remove-bottom">Community ID</h3>
        <small>
          Your community's unique ID for ESM. This ID is used in commands that require referencing your community or servers.
        </small>
      </div>
      <div class="uk-form-controls">
        <%= f.hidden_field :current_community_id, value: current_community.community_id %>
        <%= f.text_field :community_id, placeholder: current_community.community_id, class: "uk-input uk-form-width-large" %>
        <br>
        <small name="community-id-error"></small>
      </div>
    </div>
  <% end %>
  <% if !current_community.player_mode_enabled? %>
    <%# Logging Channel %>
    <div class="uk-margin-medium-top">
      <div class="uk-margin-bottom">
        <h3 class="uk-margin-remove-bottom">Log Channel</h3>
        <small>
          Which channel should receive messages from your servers, plus notifications below.
          <br>
          <span class="esm-text-color-red">We recommend creating a private channel for this, as it may contain sensitive information</span>
        </small>
      </div>
      <div class="uk-form-controls">
        <%= channel_select("community[logging_channel_id]", current_community.admin_channels, class: "uk-select uk-form-width-large", selected: current_community.logging_channel_id) %>
      </div>
    </div>
    <%# Log Events %>
    <div class="uk-margin-medium-top">
      <div class="uk-margin-bottom">
        <h3 class="uk-margin-remove-bottom">Log Events</h3>
        <small>What types of events do you want to receive to your logging channel?</small>
      </div>
      <div class="uk-form-controls uk-form-controls-text">
        <%# log_reconnect_event %>
        <div class="uk-margin-small">
          <div class="uk-grid uk-grid-collapse uk-switch-grid" uk-grid uk-tooltip="title: Logs whenever your server connects or disconnects to the bot; pos: right">
            <div>
              <label class="uk-switch uk-light" >
                <%= f.check_box :log_reconnect_event %>
                <div class="uk-switch-slider uk-switch-on-off round"></div>
              </label>
            </div>
            <div>
              <p>Server Connect/Disconnect</p>
            </div>
          </div>
        </div>
        <%# log_discord_log_event %>
        <div class="uk-margin-small">
          <div class="uk-grid uk-grid-collapse uk-switch-grid" uk-grid uk-tooltip="title: Logs any messages received from your servers using `ESM_fnc_logToDiscord`. This includes logs from ESM's A3 commands; pos: right">
            <div>
              <label class="uk-switch uk-light">
                <%= f.check_box :log_discord_log_event %>
                <div class="uk-switch-slider uk-switch-on-off round"></div>
              </label>
            </div>
            <div>
              <p>Arma 3 Discord Logs</p>
            </div>
          </div>
        </div>
        <%# log_xm8_event %>
        <div class="uk-margin-small">
          <div class="uk-grid uk-grid-collapse uk-switch-grid" uk-grid uk-tooltip="title: Log XM8 Notification 'receipts'. These messages contain what notification, who it's going to, and why it sent or why it didn't; pos: right">
            <div>
              <label class="uk-switch uk-light">
                <%= f.check_box :log_xm8_event %>
                <div class="uk-switch-slider uk-switch-on-off round"></div>
              </label>
            </div>
            <div>
              <p>XM8 Notifications</p>
            </div>
          </div>
        </div>
      </div>
    </div>
    <%# Territory Management %>
    <div class="uk-margin-medium-top">
      <div class="uk-margin-bottom">
        <h3 class="uk-margin-remove-bottom">
          Territory Management
        </h3>
        <small>
          Users with these roles will be able to run territory based commands as the owner, regardless of them being a member of that territory.
        </small>
      </div>
      <%= tag.div class: "uk-width-3-4@m uk-child-width-1-2@m uk-child-width-1-1 role-selector",
        data: { roles: current_community.roles, selected_roles: current_community.territory_admins },
        id: "role-selector-territory-management",
        "uk-grid": "" do %>
        <div>
          <label class="uk-form-label">Available Roles</label>
          <div class="uk-form-controls">
            <select class="uk-select" uk-tooltip="Roles with Administrator permission automatically have access" v-model="selectedRole">
              <option
                v-for="role of roles"
                :value="role.id"
                :style="{ color: role.selected ? '' : '#' + role.color + ' !important' }"
                :disabled="role.selected">
                {{role.name}}
              </option>
            </select>
            <button class="uk-button esm-button uk-margin-top uk-width-1-1" type="button" :disabled="disableAddButton" @click="addRole">Add</button>
          </div>
        </div>
        <div>
          <label class="uk-form-label">Selected Roles</label>
          <div class="uk-form-controls">
            <table class="uk-table uk-table-small">
              <tbody>
                <tr v-for="role of selectedRoles">
                  <%= f.hidden_field :territory_admin_ids, ":value": "role.id", multiple: true %>
                  <td class="uk-width-4-5" :style="{ color: '#' + role.color + ' !important' }">{{role.name}}</td>
                  <td class="uk-table-shrink uk-width-1-5">
                    <a class="fas fa-times" @click="removeRole(role)"></a>
                  </td>
                </tr>
              </tbody>
            </table>
          </div>
        </div>
      <% end %>
    </div>
  <% end %>
  <%# Server Dashboard Management %>
  <div class="uk-margin-medium-top">
    <div class="uk-margin-bottom">
      <h3 class="uk-margin-remove-bottom">
        Server Dashboard Management
      </h3>
      <small>
        Users with these roles will have full management access to this community's server dashboard. Useful for communities with non-admin developers
      </small>
    </div>
    <%= tag.div class: "uk-width-3-4@m uk-child-width-1-2@m uk-child-width-1-1 role-selector",
      data: { roles: current_community.roles, selected_roles: current_community.dashboard_admins },
      id: "role-selector-dashboard-management",
      "uk-grid": "" do %>
      <div>
        <label class="uk-form-label">Available Roles</label>
        <div class="uk-form-controls">
          <select class="uk-select" uk-tooltip="Roles with Administrator permission automatically have access" v-model="selectedRole">
            <option
              v-for="role of roles"
              :value="role.id"
              :style="{ color: role.selected ? '' : '#' + role.color + ' !important' }"
              :disabled="role.selected">
              {{role.name}}
            </option>
          </select>
          <button class="uk-button esm-button uk-margin-top uk-width-1-1" type="button" :disabled="disableAddButton" @click="addRole">Add</button>
        </div>
      </div>
      <div>
        <label class="uk-form-label">Selected Roles</label>
        <div class="uk-form-controls">
          <table class="uk-table uk-table-small">
            <tbody>
              <tr v-for="role of selectedRoles">
                <%= f.hidden_field :dashboard_access_role_ids, ":value": "role.id", multiple: true %>
                <td class="uk-width-4-5" :style="{ color: '#' + role.color + ' !important' }">{{role.name}}</td>
                <td class="uk-table-shrink uk-width-1-5">
                  <a class="fas fa-times" @click="removeRole(role)"></a>
                </td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
    <% end %>
  </div>
  <%# Welcome Message %>
  <div class="uk-margin-medium-top">
    <div class="uk-margin-bottom">
      <h3 class="uk-margin-remove-bottom">
        <label class="uk-switch uk-light">
          <%= f.check_box :welcome_message_enabled %>
          <div class="uk-switch-slider uk-switch-on-off round"></div>
        </label>
        Welcome Message
      </h3>
      <small>
        When enabled, ESM will automatically greet new members of your Discord server to let them know about ESM and its features.
        <br>
        You may add additional information below that will be included in this welcome message.
      </small>
    </div>
    <div class="uk-form-controls uk-width-2-3" id="character-counter" data-content="<%= current_community.welcome_message %>">
      <%= f.text_area :welcome_message, class: "uk-textarea", rows: 5, disabled: !current_community.welcome_message_enabled, "v-model": "content", "@keydown": "onKeyDown" %>
      <div class="uk-align-right">
        <small :class="{ 'esm-text-color-red': limitReached }">{{ characterCount }}/{{ maxCharacterCount }}</small>
      </div>
    </div>
  </div>
  <div div class="uk-position-bottom-right uk-position-medium uk-visible@m">
    <button class="uk-button esm-button uk-margin-right esm-button-danger" type="button" uk-tooltip="You will be required to confirm deletion" uk-toggle="target: #delete-community" :disabled="processing">Delete Community</button>
    <%= f.submit "Save Changes", class: "uk-button esm-button-confirm" %>
  </div>
  <div class="uk-hidden@m uk-margin-top uk-margin-bottom" uk-margin>
    <button class="uk-button esm-button uk-margin-right esm-button-danger uk-width-1-1" type="button" uk-tooltip="You will be required to confirm deletion" uk-toggle="target: #delete-community" :disabled="processing">Delete Community</button>
    <%= f.submit "Save Changes", class: "uk-button esm-button-confirm" %>
  </div>
<% end %>
All opinions represented herein are my own
- © 2024 itsthedevman
- build 340fbb8