1- <%= form_for @link, url: url do |f| %>
2- <div class ="form-group has-padding-1 ">
3- <%= f . label :label , " Shown label" , class : " form-element" %>
4- < div class ="form-caption "> What is shown in the sidebar. This will be ignored when a post is set.</ div >
5- <%= f . text_area :label , class : " form-element" %>
6- </ div >
7-
8- < div class ="form-group has-padding-1 ">
9- <%= f . label :link , " Target link" , class : " form-element" %>
10- < div class ="form-caption "> What the label is linked to in the sidebar. This will be ignored when a post is set.</ div >
11- <%= f . text_field :link , class : " form-element" %>
12- </ div >
13-
14- <% if current_user . is_global_moderator %>
15- < div class ="form-group has-padding-1 ">
16- <%= f . label :community_id , " Community" , class : " form-element" %>
17- < div class ="form-caption "> Which sidebar this is shown in the sidebar. Global if blank.</ div >
18- <% communities = Community . all %>
19- <% ocs = communities . map { |c | [ c . name , c . id ] } %>
20- <%= f . select :community_id , options_for_select ( ocs , selected : @link . community_id ) ,
21- { include_blank : true } , class : 'form-element' %>
22- </ div >
23- <% end %>
24-
25- < div class ="form-group has-padding-1 ">
26- <%= f . label :post_id , " ID of target post" , class : " form-element" %>
27- < div class ="form-caption "> You can link to a post within this community. Will override label and link.</ div >
28- <%= f . number_field :post_id , class : " form-element" %>
29- </ div >
30-
31- < div class ="form-group has-padding-1 ">
32- <%= f . label :active , " Active?" , class : " form-element" %>
33- <%= f . select :active , options_for_select ( [ [ 'yes' , true ] , [ 'no' , false ] ] , selected : @link . active ) ,
34- { } , class : 'form-element' %>
35- </ div >
36-
37- < div class ="form-group has-padding-1 ">
38- <%= f . label :shown_before , " End date" , class : " form-element" %>
39- < div class ="form-caption "> Link will show until this date. Will be shown in the sidebar.</ div >
40- <%= f . date_field :shown_before , class : " form-element" %>
41- </ div >
42-
43- < div class ="form-group has-padding-1 ">
44- <%= f . label :shown_after , " Start date" , class : " form-element" %>
45- < div class ="form-caption "> Used to display in the sidebar when the event starts. Does not affect visibility - the event
46- will show immediately.</ div >
47- <%= f . date_field :shown_after , class : " form-element" %>
48- </ div >
49-
50- <%= f . submit " Update" , class : " button is-filled" %>
51- <%= link_to " Cancel" , pinned_links_path ( global : params [ :global ] ) , class : " button" , role : 'button' %>
1+ <%= form_for @link, url: url do |f| %>
2+ <div class ="form-group has-padding-1 ">
3+ <%= f . label :label , ' Shown label' , class : ' form-element' %>
4+ < div class ="form-caption "> What is shown in the sidebar. This will be ignored when a post is set.</ div >
5+ <%= f . text_area :label , class : ' form-element' %>
6+ </ div >
7+
8+ < div class ="form-group has-padding-1 ">
9+ <%= f . label :link , ' Target link' , class : ' form-element' %>
10+ < div class ="form-caption "> What the label is linked to in the sidebar. This will be ignored when a post is set.</ div >
11+ <%= f . text_field :link , class : ' form-element' %>
12+ </ div >
13+
14+ <% if current_user . is_global_moderator %>
15+ < div class ="form-group has-padding-1 ">
16+ <%= f . label :community_id , ' Community' , class : ' form-element' %>
17+ < div class ="form-caption "> Which sidebar this is shown in the sidebar. Global if blank.</ div >
18+ <% communities = Community . all %>
19+ <% ocs = communities . map { |c | [ c . name , c . id ] } %>
20+ <%= f . select :community_id , options_for_select ( ocs , selected : @link . community_id ) ,
21+ { include_blank : true } , class : 'form-element' %>
22+ </ div >
23+ <% end %>
24+
25+ < div class ="form-group has-padding-1 ">
26+ <%= f . label :post_id , ' ID of target post' , class : ' form-element' %>
27+ < div class ="form-caption "> You can link to a post within this community. Will override label and link.</ div >
28+ <%= f . number_field :post_id , class : ' form-element' %>
29+ </ div >
30+
31+ < div class ="form-group has-padding-1 ">
32+ <%= f . label :active , ' Active?' , class : ' form-element' %>
33+ <%= f . select :active , options_for_select ( [ [ 'yes' , true ] , [ 'no' , false ] ] , selected : @link . active ) ,
34+ { } , class : 'form-element' %>
35+ </ div >
36+
37+ < div class ="form-group has-padding-1 ">
38+ <%= f . label :shown_before , ' End date' , class : ' form-element' %>
39+ < div class ="form-caption "> Link will show until this date. Will be shown in the sidebar.</ div >
40+ <%= f . date_field :shown_before , class : ' form-element' %>
41+ </ div >
42+
43+ < div class ="form-group has-padding-1 ">
44+ <%= f . label :shown_after , ' Start date' , class : ' form-element' %>
45+ < div class ="form-caption "> Used to display in the sidebar when the event starts. Does not affect visibility - the event
46+ will show immediately.</ div >
47+ <%= f . date_field :shown_after , class : ' form-element' %>
48+ </ div >
49+
50+ <%= f . submit ' Update' , class : ' button is-filled' %>
51+ <%= link_to ' Cancel' , pinned_links_path ( global : params [ :global ] ) , class : ' button' , role : 'button' %>
5252<% end %>
0 commit comments