Skip to content

Commit

Permalink
Clean up share box styles
Browse files Browse the repository at this point in the history
  • Loading branch information
Cantido committed Sep 22, 2016
1 parent 2809c3c commit 3252962
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
26 changes: 17 additions & 9 deletions app/views/content/_share.html.erb
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
<div id="share-modal" class="modal">
<div class="modal-content">
<h4>Share</h4>
<p>Copy the text below:</p>
<textarea type="text" readonly onclick="this.focus();this.select()"><%= polymorphic_url(shared_content) %></textarea>
<h4>Share <%= shared_content.name %></h4>

<p>Content must be <b>public</b>, or in a <b>public</b> Universe.</p>
<div class="row">
<div class="input-field col s12">
<input type="text" id="share_url" readonly onclick="this.focus();this.select()" value="<%= polymorphic_url(shared_content) %>">
<label for="share_url">Share URL</label>
</div>
</div>

<div class="row">
<p class="col s12">To be shareable, content must be <b>public</b>, and in a <b>public</b> Universe.</p>
</div>

<% if ((shared_content.respond_to? :universe) && shared_content.universe.present?) %>
<% universe_is_public = true %>
<%= render partial: 'content/form/privacy_toggle', locals: { content: shared_content.universe } %>
<div class="row">
<%= render partial: 'content/form/privacy_toggle', locals: { content: shared_content.universe } %>
</div>
<% end %>
<% if shared_content.respond_to? :privacy %>
<%= render partial: 'content/form/privacy_toggle', locals: { content: shared_content, disabled: universe_is_public } %>
<div class="row">
<%= render partial: 'content/form/privacy_toggle', locals: { content: shared_content } %>
</div>
<% end %>


</div>
<div class="modal-footer">
<a href="#!" class=" modal-action modal-close waves-effect waves-green btn-flat">close</a>
Expand Down
6 changes: 4 additions & 2 deletions app/views/content/form/_privacy_toggle.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@

<%= form_for(content, remote: true, html: {role: :form, 'data-model': content.class.model_name}) do |form|%>
<div class="switch">
<%= content.name %>'s privacy setting:
<label class="right">
<div class="col s6">
<b><%= content.name %></b>’s privacy setting:
</div>
<label class="col s6 right-align">
private
<%= form.check_box :privacy, { onchange: '$(this).submit();' }, 'public', 'private' %>
<span class="lever"></span>
Expand Down

0 comments on commit 3252962

Please sign in to comment.