Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable page publish/view page buttons according to published_at #1498

Merged
merged 2 commits into from
Apr 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions app/assets/stylesheets/alchemy/buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ button, input[type="submit"], a.button, input.button {
margin-right: 2 * $default-margin;
color: inherit;
}

&[disabled] {
cursor: not-allowed;

& + label {
display: none;
}
}
}

.icon_button {
Expand Down Expand Up @@ -79,13 +87,18 @@ button, input[type="submit"], a.button, input.button {
}
}

&.disabled {
&.disabled,
&[disabled] {

span {
opacity: 0.3;
cursor: not-allowed;
}

i {
opacity: 0.3;
}

tvdeyen marked this conversation as resolved.
Show resolved Hide resolved
&:hover {
cursor: not-allowed;
}
Expand Down Expand Up @@ -121,7 +134,7 @@ button.icon_button {
margin: 0 2*$default-margin;

&.active, &:active, &:hover {
.icon_button {
.icon_button:not([disabled]) {
background-color: $default-border-color;
cursor: pointer;
}
Expand Down
20 changes: 10 additions & 10 deletions app/views/alchemy/admin/pages/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,6 @@
<% end %>
</div>
<div class="toolbar_spacer"></div>
<% unless @page.layoutpage? %>
<div class="button_with_label">
<%= form_tag alchemy.visit_admin_page_path(@page), id: 'visit_page_form' do %>
<button class="icon_button" title="<%= Alchemy.t('Visit page') %>">
<%= render_icon('external-link-alt') %>
</button>
<label><%= Alchemy.t("Visit page") %></label>
<% end %>
</div>
<% end %>
<div class="button_with_label">
<%= link_to_dialog(
render_icon('info-circle'),
Expand Down Expand Up @@ -76,6 +66,16 @@
<% end %>
</div>
<% end %>
<% unless @page.layoutpage? %>
<div class="button_with_label">
<%= form_tag alchemy.visit_admin_page_path(@page), id: 'visit_page_form' do %>
<%= button_tag class: 'icon_button', disabled: !@page.public? do %>
<%= render_icon('external-link-alt') %>
<% end %>
<label><%= Alchemy.t("Visit page") %></label>
<% end %>
</div>
<% end %>
<% if @page.has_hint? %>
<div class="toolbar_spacer"></div>
<%= render_hint_for(@page) %>
Expand Down