* Allow user to have many orgs * Allow users to handle multi orgs in settings * Make rounded buttons inline * Add multi org function to dashboards * Fix merge conflicts * Fix mistake in merge conflict fix oops * Display the correct membership level * Fix accessibility issues * Display organizations for article editors * Handle submitting org id with preact editors * Make listings work with multiple organizations * Allow listings to have multiple orgs on create * Display the correct number of credits for each org * Move script tag to Webpack * Allow multi orgs for purchasing and viewing credits * Use OrganizationMembership as authorization check * Display multiple organizations for notifications * Allow dashboard to be viewable under multi-orgs * Remove unused method * Add multi-org functionality for article editors * Show pro dashboard buttons for member+ org levels * Leave the correct organization * Allow article API to change org id * Add left-out authorization method oops * Make nav buttons a bit more clear * Fix merge conflict * Fix adding org id for /api/articles and tests * Fix tests for org policy * Use proper logic for displaying org members * Update org actions with new authorization * Use correct org when creating a listing * Remove additional payment charge oops * Mark org notifications as read with authorization * Remove deprecated post_as_organization attribute * Use new org_admin syntax * Remove deprecated org logic for article create and update * Default all RSS posts to not belong to any org * Render org_member page for guest users * Update org policy spec to work with multi orgs * Use org_membership for org traits and move identity code * Use org_member trait * Update to work with multi-orgs * Validate article's org_id if param org_id is blank * Make a let variable * Remove unnecessary eager load for credits * Fix HTML structure and org logic for non-org users * Update credits spec for multi-org * Add test for failed payment when purchased by org * Lint listings_spec * Test that the listing was created under the user * Add tests for POST /listings multi-org * Use double quotes for classes * Fix /manage and a few other multi-org bugs * Fix test for multi org * Use correct method SQL exists? not Rails exist? * Fix reads spec for multi-org * Fix org_controller actions to work with multi org * Test only multi org and not old usage and fix leave_org * Fix org showing user profile img test for multi-org * Fix org logic for users with no orgs * Remove switch org functionality * Update tests and add hidden param for org id * Redirect to the specific organization * Test other org button actions * Use settings_notice instead of legacy notice and refactor * Fix weird extra end issue prob from merge conflicts * Test for with new flash key * Fix user_views_org tests for multi-org * Test for new flash message * Update snapshot with new a11y html * Move styling to stylesheet * Add site admins functionality * Move org_member? method in user model and refactor * Use unspent_credits_count for organizations * Add tests for /listings/new and minor bug fixes * Use .present? in case of empty array * Fix a lingering deprecated method * Use greater than 1 for random numbers * Add tests for counting spent and unspent credits
162 lines
8 KiB
Text
162 lines
8 KiB
Text
<script src="https://cdnjs.cloudflare.com/ajax/libs/jscolor/2.0.4/jscolor.min.js"
|
|
integrity="sha256-CJWfUCeP3jLdUMVNUll6yQx37gh9AKmXTRxvRf7jzro=" crossorigin="anonymous"></script>
|
|
|
|
<style>
|
|
.primary-sticky-nav-author, .primary-sticky-nav-author-element {
|
|
border: 1px solid <%= HexComparer.new([user_colors(@organization)[:bg], user_colors(@organization)[:text]]).brightness(0.88) %> !important;
|
|
box-shadow: 3px 4px 0px <%= HexComparer.new([user_colors(@organization)[:bg], user_colors(@organization)[:text]]).brightness(0.88) %> !important;
|
|
}
|
|
|
|
.primary-sticky-nav-author button {
|
|
background-color: <%= user_colors(@organization)[:bg] %> !important;
|
|
color: <%= user_colors(@organization)[:text] %> !important;
|
|
<% if user_colors(@organization)[:bg].downcase == "#ffffff" %>
|
|
border: 1px solid <%= user_colors(@organization)[:text] %> !important;
|
|
<% end %>
|
|
}
|
|
</style>
|
|
<div class="settings-org-members">
|
|
<h3>Organization Members</h3>
|
|
<% @org_organization_memberships.each do |org_membership| %>
|
|
<div class="settings-org-member-row <%= "settings-org-admin-row" if org_membership.type_of_user == "admin" %>">
|
|
<a href="<%= org_membership.user.path %>"><%= org_membership.user.name %></a>
|
|
<div class="settings-org-member-actions">
|
|
<% if org_membership.user == @user && org_membership.type_of_user == "admin" %>
|
|
<button class="settings-org-member settings-org-member-admin-self">you (admin)</button>
|
|
<% elsif org_membership.user != @user && org_membership.type_of_user == "admin" %>
|
|
<button class="settings-org-member settings-org-member-admin-other">admin</button>
|
|
<%= form_tag "/users/remove_org_admin", onsubmit: "return confirm('Are you sure you want to take away admin status from #{org_membership.user.name}?');" do %>
|
|
<%= hidden_field_tag "user_id", org_membership.user_id %>
|
|
<%= hidden_field_tag "organization_id", @organization.id %>
|
|
<button class="settings-org-member settings-org-member-remove" title="Revoke admin status" type="submit">revoke admin status</button>
|
|
<% end %>
|
|
<% else %>
|
|
<button class="settings-org-member settings-org-member-admin-self">org member</button>
|
|
<%= form_tag "/users/add_org_admin", onsubmit: "return confirm('Are you sure you want to give #{org_membership.user.name} admin status?');" do %>
|
|
<%= hidden_field_tag "user_id", org_membership.user_id %>
|
|
<%= hidden_field_tag "organization_id", @organization.id %>
|
|
<button class="settings-org-member settings-org-member-make-admin" title="Make admin" type="submit">make admin</button>
|
|
<% end %>
|
|
<%= form_tag "/users/remove_from_org", onsubmit: "return confirm('Are you sure you want remove #{org_membership.user.name} from the organization?');" do %>
|
|
<%= hidden_field_tag "user_id", org_membership.user_id %>
|
|
<%= hidden_field_tag "organization_id", @organization.id %>
|
|
<button class="settings-org-member settings-org-member-remove" title="Remove from org" type="submit">remove from org</button>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
<h3>Grow the team</h3>
|
|
<h5>Invite teammates by sending them the secret and the following instructions:</h5>
|
|
<ol style="margin-bottom: 30px">
|
|
<li>Sign up at
|
|
<a href="https://<%= ApplicationConfig["APP_DOMAIN"] %>">https://<%= ApplicationConfig["APP_DOMAIN"] %></a></li>
|
|
<li>Navigate to
|
|
<a href="https://<%= ApplicationConfig["APP_DOMAIN"] %>/settings/organization">https://<%= ApplicationConfig["APP_DOMAIN"] %>/settings/organization</a>
|
|
</li>
|
|
<li>Paste the secret code below and click <b>Join Organization</b></li>
|
|
</ol>
|
|
<h5>Your secret: (You should rotate this regularly)</h5>
|
|
<input type="text" class="settings-org-secret" id="settings-org-secret" value="<%= @organization.secret %>" readonly aria-label="Organization secret (to be rotated regularly)">
|
|
<%= form_tag "/organizations/generate_new_secret", onsubmit: "return confirm('Are you sure you want to generate a new secret? All outstanding secrets will be invalid.');" do %>
|
|
<%= hidden_field_tag "organization[id]", @organization.id %>
|
|
<button class="settings-generate-new-secret">Generate New Secret</button>
|
|
<% end %>
|
|
</div>
|
|
<h3>Organization Details</h3>
|
|
<%= form_for(@organization) do |f| %>
|
|
<%= f.hidden_field :id %>
|
|
<div class="field">
|
|
<%= f.label :name %>
|
|
<%= f.text_field :name, maxlength: 50 %>
|
|
</div>
|
|
<div class="field">
|
|
<%= f.label :slug, "Username" %>
|
|
<%= f.text_field :slug, maxlength: 18, minlength: 2 %>
|
|
<i>Your organization's URL is: https://dev.to/<%= @organization.slug %></i>
|
|
</div>
|
|
<%= f.label :profile_image %>
|
|
<div class="field">
|
|
<% if @organization.profile_image_url.present? %>
|
|
<span class="image-present">
|
|
<img alt="<%= @organization.name %> profile image" src="<%= cloudinary(@organization.profile_image_url, 50) %>" />
|
|
<%= f.file_field :profile_image %>
|
|
</span>
|
|
<% else %>
|
|
<%= f.file_field :profile_image %>
|
|
<% end %>
|
|
</div>
|
|
<div class="field">
|
|
<%= f.label :twitter_username, "Twitter Username" %>
|
|
<%= f.text_field :twitter_username %>
|
|
</div>
|
|
<div class="field">
|
|
<%= f.label :github_username, "Github Username" %>
|
|
<%= f.text_field :github_username %>
|
|
</div>
|
|
<div class="field">
|
|
<%= f.label :text_color_hex, "Text color (hex)" %>
|
|
<%= f.text_field :text_color_hex, placeholder: "#ffffff", class: "jscolor {hash:true, required:false}" %>
|
|
</div>
|
|
<div class="field">
|
|
<%= f.label :bg_color_hex, "Background color (hex)" %>
|
|
<%= f.text_field :bg_color_hex, placeholder: "#000000", class: "jscolor {hash:true, required:false}" %>
|
|
</div>
|
|
<div class="field">
|
|
<%= f.label :url, "Site url" %>
|
|
<%= f.url_field :url, maxlength: 64, placeholder: "http://yoursite.com" %>
|
|
</div>
|
|
<div class="field">
|
|
<%= f.label :tag_line %>
|
|
<%= f.text_field :tag_line, maxlength: 60, placeholder: "Limit of 60 characters" %>
|
|
</div>
|
|
<div class="field">
|
|
<%= f.label :summary %>
|
|
<%= f.text_area :summary, maxlength: 250, placeholder: "Limit of 250 characters" %>
|
|
</div>
|
|
<div class="field">
|
|
<%= f.label :location %>
|
|
<%= f.text_field :location, maxlength: 64, placeholder: "Limit of 64 characters" %>
|
|
</div>
|
|
<div class="field">
|
|
<%= f.label :email, "Support Email" %>
|
|
<%= f.text_field :email, maxlength: 64, placeholder: "Limit of 64 characters" %>
|
|
</div>
|
|
<div class="field">
|
|
<%= f.label :company_size, "Organization Size" %>
|
|
<%= f.text_field :company_size, maxlength: 10, placeholder: "Enter a number" %>
|
|
</div>
|
|
<div class="field">
|
|
<%= f.label :story, "Our Story" %>
|
|
<%= f.text_area :story, maxlength: 640, placeholder: "Limit of 640 characters" %>
|
|
</div>
|
|
<div class="field">
|
|
<%= f.label :tech_stack, "Our Stack" %>
|
|
<%= f.text_area :tech_stack, maxlength: 640, placeholder: "Limit of 640 characters" %>
|
|
</div>
|
|
<h2>Call-to-action box</h2>
|
|
<h4 style="margin-top:-25px">Customizable text that appears to the right of every post for your organization</h4>
|
|
<h4 style="margin-top:-15px">See an example from the
|
|
<a href="https://<%= ApplicationConfig["APP_DOMAIN"] %>/devteam/the-dev-badge-is-available-on-font-awesome-2ihe" target="_blank">DEV Team</a>.
|
|
</h4>
|
|
<div class="field">
|
|
<%= f.label :cta_body_markdown, "Body text (Limited markdown — bold/italic/etc)" %>
|
|
<%= f.text_area :cta_body_markdown, maxlength: 256, placeholder: "**This is an example**
|
|
|
|
_italic_ and **bold** is okay. Links, and headers etc. will not show up.
|
|
|
|
256 character limit." %>
|
|
</div>
|
|
<div class="field">
|
|
<%= f.label :cta_button_text, "Link Text" %>
|
|
<%= f.text_field :cta_button_text, maxlength: 20, placeholder: "Limit of 20 characters" %>
|
|
</div>
|
|
<div class="field">
|
|
<%= f.label :cta_button_url, "Link url" %>
|
|
<%= f.text_field :cta_button_url, placeholder: "https://example.com" %>
|
|
</div>
|
|
<div class="field">
|
|
<label></label>
|
|
<%= f.submit "SUBMIT", class: "cta" %>
|
|
</div>
|
|
<% end %>
|