cartodb/app/views/admin/organizations/settings.html.erb
2020-06-15 10:58:47 +08:00

211 lines
15 KiB
Plaintext

<% content_for :settings_body do %>
<div class="FormAccount-container">
<%= form_for @organization, url: CartoDB.url(self, 'organization_settings_update', user: current_user), multipart: true do |f| %>
<%= csrf_meta_tags %>
<div class="FormAccount-row js-avatarSelector">
<div class="FormAccount-rowLabel">
<label class="CDB-Text CDB-Size-medium is-semibold u-mainTextColor">Organization logo</label>
</div>
<div class="FormAccount-rowData FormAccount-avatar">
<div class="FormAccount-avatarPreview">
<% if @organization.avatar_url.present? %>
<img src="<%= @organization.avatar_url %>" title="<%= current_user.username %>" alt="<%= current_user.username %>" class="FormAccount-avatarPreviewImage" />
<% else %>
<svg width="100px" height="100px" viewBox="0 0 100 100" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" class="FormAccount-avatarPreviewImage">
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Group-2">
<rect id="Rectangle" fill="#F9F9F9" x="0" y="0" width="100" height="100"></rect>
<g id="seats-icon" transform="translate(21.093750, 25.000000)" fill="#B1B8C1">
<g id="Group">
<path d="M13.0696615,16.6666666 L1.18815104,16.6666666 C0.532291666,16.6666666 0,17.2 0,17.8571429 L0,25 C0,27.5785714 0.7984375,29.1190477 2.37630209,29.6 L2.37630209,39.2857143 C2.37630209,39.9428571 2.90859375,40.4761905 3.56445312,40.4761905 L10.6933594,40.4761905 C11.3492187,40.4761905 11.8815104,39.9428571 11.8815104,39.2857143 L11.8815104,29.6 C13.4569987,29.1190477 14.2554362,27.5785714 14.2578125,25 L14.2578125,17.8571429 C14.2578125,17.2 13.7255209,16.6666666 13.0696615,16.6666666 L13.0696615,16.6666666 L13.0696615,16.6666666 Z M11.8815104,25 C11.8791341,27.3809523 11.2208984,27.3809523 10.6933594,27.3809523 C10.0375,27.3809523 9.50520836,27.9142857 9.50520836,28.5714286 L9.50520836,38.0952381 L4.75260416,38.0952381 L4.75260416,28.5714286 C4.75260416,27.9142857 4.2203125,27.3809523 3.56445312,27.3809523 C3.03453776,27.3809523 2.37630209,27.3809523 2.37630209,25 L2.37630209,19.0476191 L11.8815104,19.0476191 L11.8815104,25 L11.8815104,25 L11.8815104,25 Z M55.843099,16.6666666 L43.9615885,16.6666666 C43.3057291,16.6666666 42.7734375,17.2 42.7734375,17.8571429 L42.7734375,25 C42.7734375,27.5785714 43.571875,29.1190477 45.1497396,29.6 L45.1497396,39.2857143 C45.1497396,39.9428571 45.6820313,40.4761905 46.3378906,40.4761905 L53.4667969,40.4761905 C54.1226562,40.4761905 54.6549479,39.9428571 54.6549479,39.2857143 L54.6549479,29.6 C56.2304362,29.1190477 57.0288737,27.5785714 57.03125,25 L57.03125,17.8571429 C57.03125,17.2 56.4989584,16.6666666 55.843099,16.6666666 L55.843099,16.6666666 L55.843099,16.6666666 Z M54.6549479,25 C54.6525716,27.3809523 53.9943359,27.3809523 53.4667969,27.3809523 C52.8109375,27.3809523 52.2786459,27.9142857 52.2786459,28.5714286 L52.2786459,38.0952381 L47.5260416,38.0952381 L47.5260416,28.5714286 C47.5260416,27.9142857 46.99375,27.3809523 46.3378906,27.3809523 C45.8079752,27.3809523 45.1497396,27.3809523 45.1497396,25 L45.1497396,19.0476191 L54.6549479,19.0476191 L54.6549479,25 L54.6549479,25 L54.6549479,25 Z M36.8326823,16.6666666 L20.1985677,16.6666666 C19.5427084,16.6666666 19.0104166,17.2 19.0104166,17.8571429 L19.0104166,29.7619048 C19.0104166,32.6380952 21.0540365,35.0404762 23.7630209,35.5952381 L23.7630209,48.8095238 C23.7630209,49.4666666 24.2953125,50 24.9511719,50 L32.0800781,50 C32.7359375,50 33.2682291,49.4666666 33.2682291,48.8095238 L33.2682291,35.5952381 C35.9772135,35.0428571 38.0208334,32.6380952 38.0208334,29.7619048 L38.0208334,17.8571429 C38.0208334,17.2 37.4885416,16.6666666 36.8326823,16.6666666 L36.8326823,16.6666666 L36.8326823,16.6666666 Z M35.6445312,29.7619048 C35.6445312,31.7309523 34.0452799,33.3333334 32.0800781,33.3333334 C31.4242188,33.3333334 30.8919271,33.8666666 30.8919271,34.5238095 L30.8919271,47.6190477 L26.1393229,47.6190477 L26.1393229,34.5238095 C26.1393229,33.8666666 25.6070312,33.3333334 24.9511719,33.3333334 C22.9859701,33.3333334 21.3867188,31.7309523 21.3867188,29.7619048 L21.3867188,19.0476191 L35.6445312,19.0476191 L35.6445312,29.7619048 L35.6445312,29.7619048 L35.6445312,29.7619048 Z M7.12890625,14.2857143 C9.74996742,14.2857143 11.8815104,12.15 11.8815104,9.52380953 C11.8815104,6.89523809 9.74996742,4.76190477 7.12890625,4.76190477 C4.50784505,4.76190477 2.37630209,6.89523809 2.37630209,9.52380953 C2.37630209,12.15 4.50784505,14.2857143 7.12890625,14.2857143 L7.12890625,14.2857143 L7.12890625,14.2857143 Z M7.12890625,7.14285714 C8.43824867,7.14285714 9.50520836,8.21190477 9.50520836,9.52380953 C9.50520836,10.8357143 8.43824867,11.9047619 7.12890625,11.9047619 C5.8195638,11.9047619 4.75260416,10.8357143 4.75260416,9.52380953 C4.75260416,8.21190477 5.8195638,7.14285714 7.12890625,7.14285714 L7.12890625,7.14285714 L7.12890625,7.14285714 Z M49.9023438,14.2857143 C52.5234049,14.2857143 54.6549479,12.15 54.6549479,9.52380953 C54.6549479,6.89523809 52.5234049,4.76190477 49.9023438,4.76190477 C47.2812826,4.76190477 45.1497396,6.89523809 45.1497396,9.52380953 C45.1497396,12.15 47.2812826,14.2857143 49.9023438,14.2857143 L49.9023438,14.2857143 L49.9023438,14.2857143 Z M49.9023438,7.14285714 C51.2116862,7.14285714 52.2786459,8.21190477 52.2786459,9.52380953 C52.2786459,10.8357143 51.2116862,11.9047619 49.9023438,11.9047619 C48.5930013,11.9047619 47.5260416,10.8357143 47.5260416,9.52380953 C47.5260416,8.21190477 48.5930013,7.14285714 49.9023438,7.14285714 L49.9023438,7.14285714 L49.9023438,7.14285714 Z M28.515625,14.2857143 C32.4460287,14.2857143 35.6445312,11.0809523 35.6445312,7.14285714 C35.6445312,3.20476191 32.4460287,0 28.515625,0 C24.5852213,0 21.3867188,3.20476191 21.3867188,7.14285714 C21.3867188,11.0809523 24.5852213,14.2857143 28.515625,14.2857143 L28.515625,14.2857143 L28.515625,14.2857143 Z M28.515625,2.38095238 C31.1366862,2.38095238 33.2682291,4.51428571 33.2682291,7.14285714 C33.2682291,9.76904766 31.1366862,11.9047619 28.515625,11.9047619 C25.8945638,11.9047619 23.7630209,9.76904766 23.7630209,7.14285714 C23.7630209,4.51428571 25.8945638,2.38095238 28.515625,2.38095238 L28.515625,2.38095238 L28.515625,2.38095238 Z" id="Shape"></path>
</g>
</g>
</g>
</g>
</svg>
<% end %>
</div>
<div class="FormAccount-avatar--input">
<%= f.file_field :avatar_url, :class => "FormAccount-fileAvatar js-fileAvatar", :value => "Change image" %>
<div class="FormAccount-rowInfo FormAccount-rowInfo--marginLeft">
<p class="FormAccount-rowInfoText FormAccount-rowInfoText--smaller">Recommended images should be 128x128 pixels of size</p>
</div>
</div>
</div>
</div>
<div class="FormAccount-row IconPicker js-iconPicker">
</div>
<div class="FormAccount-row">
<div class="FormAccount-rowLabel">
<label class="CDB-Text CDB-Size-medium is-semibold u-mainTextColor">Display name</label>
</div>
<div class="FormAccount-rowData">
<%= f.text_field :display_name, :class => "CDB-InputText CDB-Text FormAccount-input FormAccount-input--med" %>
<div class="FormAccount-rowInfo FormAccount-rowInfo--marginLeft">
<p class="CDB-Text CDB-Size-small u-altTextColor">Check your <a href="<%= CartoDB.base_url(@organization.name) %>">public page</a></p>
</div>
</div>
</div>
<div class="FormAccount-row">
<div class="FormAccount-rowLabel">
<label class="CDB-Text CDB-Size-medium is-semibold u-mainTextColor">Website</label>
</div>
<div class="FormAccount-rowData">
<%= f.text_field :website, :class => "CDB-InputText CDB-Text FormAccount-input FormAccount-input--med" %>
</div>
<div class="FormAccount-rowInfo">
<p class="FormAccount-rowInfoText"></p>
</div>
</div>
<div class="FormAccount-row">
<div class="FormAccount-rowLabel">
<label class="CDB-Text CDB-Size-medium is-semibold u-mainTextColor">Description</label>
</div>
<div class="FormAccount-rowData">
<%= f.text_area :description, :class => "CDB-Textarea CDB-Text FormAccount-textarea FormAccount-input FormAccount-input--totalwidth" %>
</div>
<div class="FormAccount-rowInfo">
<p class="FormAccount-rowInfoText"></p>
</div>
</div>
<div class="FormAccount-row">
<div class="FormAccount-rowLabel">
<label class="CDB-Text CDB-Size-medium is-semibold u-mainTextColor">Twitter username</label>
</div>
<div class="FormAccount-rowData">
<%= f.text_field :twitter_username, :class => "CDB-InputText CDB-Text FormAccount-input FormAccount-input--med" %>
</div>
<div class="FormAccount-rowInfo">
<p class="FormAccount-rowInfoText"></p>
</div>
</div>
<div class="FormAccount-row">
<div class="FormAccount-rowLabel">
<label class="CDB-Text CDB-Size-medium is-semibold u-mainTextColor">Disqus shortname</label>
</div>
<div class="FormAccount-rowData">
<%= f.text_field :discus_shortname, :class => "CDB-InputText CDB-Text FormAccount-input FormAccount-input--med", :placeholder => "If empty, CARTO will moderate them for you" %>
<div class="FormAccount-rowInfo FormAccount-rowInfo--marginLeft">
<p class="CDB-Text CDB-Size-small u-altTextColor">Be notified by new comments in your pages</p>
</div>
</div>
</div>
<div class="FormAccount-row">
<div class="FormAccount-rowLabel">
<label class="CDB-Text CDB-Size-medium is-semibold u-mainTextColor">Internal support email</label>
</div>
<div class="FormAccount-rowData">
<%= f.text_field :admin_email, :class => "CDB-InputText CDB-Text FormAccount-input FormAccount-input--med", :placeholder => "if empty, we will use your email" %>
<div class="FormAccount-rowInfo FormAccount-rowInfo--marginLeft">
<p class="CDB-Text CDB-Size-small u-altTextColor">Email you will use to give support to your users</p>
</div>
</div>
</div>
<div class="FormAccount-row">
<div class="FormAccount-rowLabel">
<label class="CDB-Text CDB-Size-medium is-semibold u-mainTextColor">Default new user quota</label>
</div>
<div class="FormAccount-rowData">
<%= f.text_field :default_quota_in_bytes, :value => "#{ ( @organization[:default_quota_in_bytes].to_i / (1024 * 1024) ) if !@organization[:default_quota_in_bytes].blank? }", :class => "CDB-InputText CDB-Text FormAccount-input FormAccount-input--med #{ 'has-error' if @organization.errors[:default_quota_in_bytes].present? } js-userQuota" %>
<div class="FormAccount-rowInfo FormAccount-rowInfo--marginLeft">
<% if (@organization.errors[:default_quota_in_bytes].present?) %>
<p class="FormAccount-rowInfoText FormAccount-rowInfoText--error u-tSpace"><%= @organization.errors[:default_quota_in_bytes].first %></p>
<% else %>
<p class="CDB-Text CDB-Size-small u-altTextColor">Set (in MB) the quota of new users in your organization</p>
<% end %>
</div>
</div>
</div>
<% if @organization.engine_enabled %>
<div class="FormAccount-row">
<p class="CDB-Text CDB-Size-large u-bSpace--xl">Users API key</p>
<div class="FormAccount-rowData">
<button class="CDB-Button CDB-Button--secondary js-regenerateOrgUsersApiKey" data-current_username="<%= current_user.username %>">
<span class="CDB-Button-Text CDB-Text is-semibold CDB-Size-small u-upperCase">Regenerate all API keys</span>
</button>
<div class="FormAccount-rowInfo FormAccount-rowInfo--marginLeft">
<p class="CDB-Text CDB-Size-small u-altTextColor">This involves all your organization users API keys</p>
</div>
</div>
</div>
<% end %>
<% if current_user.google_maps_geocoder_enabled? && current_user.organization_owner? %>
<div class="FormAccount-title">
<p class="FormAccount-titleText">Configure API keys from external providers</p>
</div>
<span class="FormAccount-separator"></span>
<div class="FormAccount-row">
<div class="FormAccount-rowLabel">
<label class="CDB-Text CDB-Size-medium is-semibold u-mainTextColor">Google Maps query string</label>
</div>
<div class="FormAccount-rowData">
<%= f.text_field :google_maps_key, class: "FormAccount-input FormAccount-input--long is-disabled CDB-InputText CDB-Text", :readonly => "true" %>
</div>
<div class="FormAccount-rowInfo">
<p class="FormAccount-rowInfoText CDB-Text CDB-Size-small u-altTextColor">
This is the <%= @organization.name %> Google Maps query string.
Contact with <a href="mailto:support@carto.com">support@carto.com</a> to change it.
</p>
</div>
</div>
<div class="FormAccount-row">
<div class="FormAccount-rowLabel">
<label class="CDB-Text CDB-Size-medium is-semibold u-mainTextColor">Google Maps private key</label>
</div>
<div class="FormAccount-rowData">
<%= f.text_field :google_maps_private_key, class: "FormAccount-input FormAccount-input--long is-disabled CDB-InputText CDB-Text", :readonly => "true" %>
</div>
<div class="FormAccount-rowInfo">
<p class="FormAccount-rowInfoText CDB-Text CDB-Size-small u-altTextColor">
This is the <%= @organization.name %> Google Maps private key
contact with <a href="mailto:support@carto.com">support@carto.com</a> to change it.
</p>
</div>
</div>
<% end %>
<div class="FormAccount-footer">
<p class="FormAccount-footerText"></p>
<button type="submit" class="CDB-Button CDB-Button--primary js-save">
<span class="CDB-Button-Text CDB-Text is-semibold CDB-Size-small u-upperCase">Save changes</span>
</button>
</div>
<% end %>
<% if !saas? && current_user.organization_owner? %>
<div class="FormAccount-title">
<p class="FormAccount-titleText">Delete organization</p>
</div>
<span class="FormAccount-separator"></span>
<div class="FormAccount-row FormAccount-row--wideMarginBottom">
<div class="FormAccount-rowLabel">
<label class="CDB-Text CDB-Size-medium is-semibold u-mainTextColor">Are you sure?</label>
</div>
<div class="FormAccount-rowData">
<span class="FormAccount-button--deleteOrganization CDB-Size-medium js-deleteOrganization">Delete organization, including all users and data</span>
</div>
</div>
<% end %>
</div>
<% end %>
<%= render template: 'admin/organizations/_organization_settings', locals: { title: 'settings' } %>