Skip to content
Snippets Groups Projects
Commit 4244dcb3 authored by ArtOfCode-'s avatar ArtOfCode-
Browse files

Address review comments

parent 38657b55
Branches
Tags
No related merge requests found
...@@ -35,8 +35,7 @@ class PinnedLinksController < ApplicationController ...@@ -35,8 +35,7 @@ class PinnedLinksController < ApplicationController
AuditLog.moderator_audit(event_type: 'pinned_link_create', related: @link, user: current_user, AuditLog.moderator_audit(event_type: 'pinned_link_create', related: @link, user: current_user,
comment: "<<PinnedLink #{attr}>>") comment: "<<PinnedLink #{attr}>>")
flash[:success] = 'Your pinned link has been created. Due to caching, it may take some time, '\ flash[:success] = 'Your pinned link has been created. Due to caching, it may take some time until it is shown.'
'until it is shown.'
redirect_to pinned_links_path redirect_to pinned_links_path
end end
...@@ -60,8 +59,7 @@ class PinnedLinksController < ApplicationController ...@@ -60,8 +59,7 @@ class PinnedLinksController < ApplicationController
AuditLog.moderator_audit(event_type: 'pinned_link_update', related: @link, user: current_user, AuditLog.moderator_audit(event_type: 'pinned_link_update', related: @link, user: current_user,
comment: "from <<PinnedLink #{before}>>\nto <<PinnedLink #{after}>>") comment: "from <<PinnedLink #{before}>>\nto <<PinnedLink #{after}>>")
flash[:success] = 'The pinned link has been updated. Due to caching, it may take some time, ' \ flash[:success] = 'The pinned link has been updated. Due to caching, it may take some time until it is shown.'
'until it is shown.'
redirect_to pinned_links_path redirect_to pinned_links_path
end end
......
...@@ -178,7 +178,7 @@ class PostsController < ApplicationController ...@@ -178,7 +178,7 @@ class PostsController < ApplicationController
attr = @link.attributes.map { |k, v| "#{k}: #{v}" }.join(' ') attr = @link.attributes.map { |k, v| "#{k}: #{v}" }.join(' ')
AuditLog.moderator_audit(event_type: 'pinned_link_create', related: @link, user: current_user, AuditLog.moderator_audit(event_type: 'pinned_link_create', related: @link, user: current_user,
comment: "<<PinnedLink #{attr}>>\n(using moderator tools on post)") comment: "<<PinnedLink #{attr}>>\n(using moderator tools on post)")
flash[:success] = 'Post has been featured. Due to caching it may take some time, until the changes apply.' flash[:success] = 'Post has been featured. Due to caching, it may take some time until the changes apply.'
render json: { success: true } render json: { success: true }
end end
......
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
<div class="form-group"> <div class="form-group">
<%= f.label :asking_guidance_override, class: 'form-element' %> <%= f.label :asking_guidance_override, class: 'form-element' %>
<span class="form-caption"> <span class="form-caption">
This field overrides the default asking guidance and is shown, when a new post is created. Leave blank to use site-default. This field overrides the default asking guidance and is shown when a new post is created. Leave blank to use site-default.
</span> </span>
<%= f.text_area :asking_guidance_override, class: 'form-element' %> <%= f.text_area :asking_guidance_override, class: 'form-element' %>
</div> </div>
...@@ -101,7 +101,7 @@ ...@@ -101,7 +101,7 @@
<div class="form-group"> <div class="form-group">
<%= f.label :answering_guidance_override, class: 'form-element' %> <%= f.label :answering_guidance_override, class: 'form-element' %>
<span class="form-caption"> <span class="form-caption">
This field overrides the default answering guidance and is shown, when a new answer is created. Leave blank to use site-default. This field overrides the default answering guidance and is shown when a new answer is created. Leave blank to use site-default.
</span> </span>
<%= f.text_area :answering_guidance_override, class: 'form-element' %> <%= f.text_area :answering_guidance_override, class: 'form-element' %>
</div> </div>
......
<%= form_for @link, url: url do |f| %>
<div class="form-group has-padding-1">
<%= f.label :label, "Shown label", class: "form-element" %>
<div class="form-caption">What is shown in the sidebar. This will be ignored when a post is set.</div>
<%= f.text_area :label, class: "form-element" %>
</div>
<div class="form-group has-padding-1">
<%= f.label :link, "Target link", class: "form-element" %>
<div class="form-caption">What the label is linked to in the sidebar. This will be ignored when a post is set.</div>
<%= f.text_field :link, class: "form-element" %>
</div>
<% if current_user.is_global_moderator %>
<div class="form-group has-padding-1">
<%= f.label :community, "Community", class: "form-element" %>
<div class="form-caption">Which sidebar this is shown in the sidebar. Global if blank.</div>
<% communities = Community.all %>
<% ocs = communities.map { |c| [c.name, c.id] } %>
<%= f.select :community, options_for_select(ocs, selected: @link.community&.id),
{ include_blank: true }, class: 'form-element' %>
</div>
<% end %>
<div class="form-group has-padding-1">
<%= f.label :post_id, "ID of target post", class: "form-element" %>
<div class="form-caption">You can link to a post within this community. Will override label and link.</div>
<%= f.number_field :post_id, class: "form-element" %>
</div>
<div class="form-group has-padding-1">
<%= f.label :active, "Active?", class: "form-element" %>
<%= f.select :active, options_for_select([['yes', true], ['no', false]], selected: @link.active),
{}, class: 'form-element' %>
</div>
<div class="form-group has-padding-1">
<%= f.label :shown_before, "End date", class: "form-element" %>
<div class="form-caption">Link will show until this date. Will be shown in the sidebar.</div>
<%= f.date_field :shown_before, class: "form-element" %>
</div>
<div class="form-group has-padding-1">
<%= f.label :shown_after, "Start date", class: "form-element" %>
<div class="form-caption">Used to display in the sidebar when the event starts. Does not affect visibility - the event
will show immediately.</div>
<%= f.date_field :shown_after, class: "form-element" %>
</div>
<%= f.submit "Update", class: "button is-filled" %>
<%= link_to "Cancel", pinned_links_path(global: params[:global]), class: "button" %>
<% end %>
\ No newline at end of file
...@@ -11,54 +11,4 @@ ...@@ -11,54 +11,4 @@
</div> </div>
<% end %> <% end %>
<%= form_for @link, url: update_pinned_link_path(global: params[:global]) do |f| %> <%= render 'form', url: update_pinned_link_path(global: params[:global]) %>
<div class="form-group has-padding-1">
<%= f.label :label, "Shown label", class: "form-element" %>
<div class="form-caption">What is shown in the sidebar. This will be ignored, when a post is set.</div>
<%= f.text_area :label, class: "form-element" %>
</div>
<div class="form-group has-padding-1">
<%= f.label :link, "Target link", class: "form-element" %>
<div class="form-caption">What the label is linked to in the sidebar. This will be ignored, when a post is set.</div>
<%= f.text_field :link, class: "form-element" %>
</div>
<% if current_user.is_global_moderator %>
<div class="form-group has-padding-1">
<%= f.label :community, "Community", class: "form-element" %>
<div class="form-caption">Which sidebar this is shown in the sidebar. Global if blank.</div>
<% communities = Community.all %>
<% ocs = communities.map { |c| [c.name, c.id] } %>
<%= f.select :community, options_for_select(ocs, selected: @link.community&.id),
{ include_blank: true }, class: 'form-element' %>
</div>
<% end %>
<div class="form-group has-padding-1">
<%= f.label :post_id, "ID of target post", class: "form-element" %>
<div class="form-caption">You can link to a post of this community. Will override label and link.</div>
<%= f.number_field :post_id, class: "form-element" %>
</div>
<div class="form-group has-padding-1">
<%= f.label :active, "Active?", class: "form-element" %>
<%= f.select :active, options_for_select([['yes', true], ['no', false]], selected: @link.active),
{}, class: 'form-element' %>
</div>
<div class="form-group has-padding-1">
<%= f.label :shown_before, "Shown before", class: "form-element" %>
<div class="form-caption">Link will expire showing on that date. Will be shown in the sidebar as meta data.</div>
<%= f.date_field :shown_before, class: "form-element" %>
</div>
<div class="form-group has-padding-1">
<%= f.label :shown_after, "Begin of Event", class: "form-element" %>
<div class="form-caption">Use only, when shown before is set. Use, when your event spans more than one day. Will indicate, whether the event already started or ended in the sidebar. Does not affect visibility.</div>
<%= f.date_field :shown_after, class: "form-element" %>
</div>
<%= f.submit "Update", class: "button is-filled" %>
<%= link_to "Cancel", pinned_links_path(global: params[:global]), class: "button" %>
<% end %>
...@@ -5,17 +5,23 @@ ...@@ -5,17 +5,23 @@
<% if current_user.is_global_moderator %> <% if current_user.is_global_moderator %>
<div class="grid--cell"> <div class="grid--cell">
<div class="button-list is-gutterless"> <div class="button-list is-gutterless">
<%= link_to "current community", "?global=0&filter="+(params[:filter]||'active'), class: "button is-muted is-outlined #{(params[:global]=='0' || params[:global].nil?) ? 'is-active' : ''}" %> <%= link_to "current community", query_url(global: '0', filter: params[:filter] || 'active'),
<%= link_to "global", "?global=1&filter="+(params[:filter]||'active'), class: "button is-muted is-outlined #{(params[:global]=='1') ? 'is-active' : ''}" %> class: "button is-muted is-outlined #{(params[:global] == '0' || params[:global].nil?) ? 'is-active' : ''}" %>
<%= link_to "everywhere", "?global=2&filter="+(params[:filter]||'active'), class: "button is-muted is-outlined #{(params[:global]=='2') ? 'is-active' : ''}" %> <%= link_to "global", query_url(global: '1', filter: params[:filter] || 'active'),
class: "button is-muted is-outlined #{(params[:global] == '1') ? 'is-active' : ''}" %>
<%= link_to "everywhere", query_url(global: '2', filter: params[:filter] || 'active'),
class: "button is-muted is-outlined #{(params[:global] == '2') ? 'is-active' : ''}" %>
</div> </div>
</div> </div>
<% end %> <% end %>
<div class="grid--cell"> <div class="grid--cell">
<div class="button-list is-gutterless"> <div class="button-list is-gutterless">
<%= link_to "active", "?global="+(params[:global]||'0')+"&filter=active", class: "button is-muted is-outlined #{(params[:filter]=='active' || params[:filter].nil?) ? 'is-active' : ''}" %> <%= link_to "active", query_url(global: params[:global] || '0', filter: 'active'),
<%= link_to "inactive", "?global="+(params[:global]||'0')+"&filter=inactive", class: "button is-muted is-outlined #{(params[:filter]=='inactive') ? 'is-active' : ''}" %> class: "button is-muted is-outlined #{(params[:filter] == 'active' || params[:filter].nil?) ? 'is-active' : ''}" %>
<%= link_to "all", "?global="+(params[:global]||'0')+"&filter=all", class: "button is-muted is-outlined #{(params[:filter]=='all') ? 'is-active' : ''}" %> <%= link_to "inactive", query_url(global: params[:global] || '0', filter: 'inactive'),
class: "button is-muted is-outlined #{(params[:filter] == 'inactive') ? 'is-active' : ''}" %>
<%= link_to "all", query_url(global: params[:global] || '0', filter: 'all'),
class: "button is-muted is-outlined #{(params[:filter] == 'all') ? 'is-active' : ''}" %>
</div> </div>
</div> </div>
<div class="grid--cell is-flexible"> <div class="grid--cell is-flexible">
......
...@@ -11,54 +11,4 @@ ...@@ -11,54 +11,4 @@
</div> </div>
<% end %> <% end %>
<%= form_for @link, url: create_pinned_link_path do |f| %> <%= render 'form', url: create_pinned_link_path %>
<div class="form-group has-padding-1"> \ No newline at end of file
<%= f.label :label, "Shown label", class: "form-element" %>
<div class="form-caption">What is shown in the sidebar. This will be ignored, when a post is set.</div>
<%= f.text_area :label, class: "form-element" %>
</div>
<div class="form-group has-padding-1">
<%= f.label :link, "Target link", class: "form-element" %>
<div class="form-caption">What the label is linked to in the sidebar. This will be ignored, when a post is set.</div>
<%= f.text_field :link, class: "form-element" %>
</div>
<% if current_user.is_global_moderator %>
<div class="form-group has-padding-1">
<%= f.label :community, "Community", class: "form-element" %>
<div class="form-caption">Which sidebar this is shown in the sidebar. Global if blank.</div>
<% communities = Community.all %>
<% ocs = communities.map { |c| [c.name, c.id] } %>
<%= f.select :community, options_for_select(ocs, selected: @link.community&.id),
{ include_blank: true }, class: 'form-element' %>
</div>
<% end %>
<div class="form-group has-padding-1">
<%= f.label :post_id, "ID of target post", class: "form-element" %>
<div class="form-caption">You can link to a post of this community. Will override label and link.</div>
<%= f.number_field :post_id, class: "form-element" %>
</div>
<div class="form-group has-padding-1">
<%= f.label :active, "Active?", class: "form-element" %>
<%= f.select :active, options_for_select([['yes', true], ['no', false]], selected: @link.active),
{}, class: 'form-element' %>
</div>
<div class="form-group has-padding-1">
<%= f.label :shown_before, "Shown before", class: "form-element" %>
<div class="form-caption">Link will expire showing on that date. Will be shown in the sidebar as meta data.</div>
<%= f.date_field :shown_before, class: "form-element" %>
</div>
<div class="form-group has-padding-1">
<%= f.label :shown_after, "Begin of Event", class: "form-element" %>
<div class="form-caption">Use only, when shown before is set. Use, when your event spans more than one day. Will indicate, whether the event already started or ended in the sidebar. Does not affect visibility.</div>
<%= f.date_field :shown_after, class: "form-element" %>
</div>
<%= f.submit "Create", class: "button is-filled" %>
<%= link_to "Cancel", pinned_links_path(global: params[:global]), class: "button" %>
<% end %>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment