New migration to add better auditing to user_roles and better column names there and on user_blocks. Added a helper for displaying block status messages.
This commit is contained in:
parent
09c5740b5b
commit
ca06b3c7b1
15 changed files with 93 additions and 60 deletions
|
@ -4,21 +4,11 @@
|
|||
<% if show_user_name %>
|
||||
<td class="<%= c1 %>"><%= link_to h(block.user.display_name), :controller => 'user', :action => 'view', :display_name => block.user.display_name %></td>
|
||||
<% end %>
|
||||
<% if show_moderator_name %>
|
||||
<td class="<%= c1 %>"><%= link_to h(block.moderator.display_name), :controller => 'user', :action => 'view', :display_name => block.moderator.display_name %></td>
|
||||
<% if show_creator_name %>
|
||||
<td class="<%= c1 %>"><%= link_to h(block.creator.display_name), :controller => 'user', :action => 'view', :display_name => block.creator.display_name %></td>
|
||||
<% end %>
|
||||
<td class="<%= c1 %>"><%=h truncate(block.reason) %></td>
|
||||
<td class="<%= c1 %>">
|
||||
<% if block.active? %>
|
||||
<% if block.needs_view? %>
|
||||
<%= t'user_block.partial.until_login' %>
|
||||
<% else %>
|
||||
<%= t('user_block.partial.time_future', :time => distance_of_time_in_words_to_now(block.end_at)) %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= t'user_block.partial.not_active' %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="<%= c1 %>"><%=h block_status(block) %></td>
|
||||
<td class="<%= c1 %>">
|
||||
<% if block.revoker_id.nil? %>
|
||||
<%= t('user_block.partial.not_revoked') %>
|
||||
|
@ -27,7 +17,7 @@
|
|||
<% end %>
|
||||
</td>
|
||||
<td class="<%= c1 %>"><%= link_to t('user_block.partial.show'), block %></td>
|
||||
<td class="<%= c1 %>"><% if @user and @user.id == block.moderator_id and block.active? %><%= link_to t('user_block.partial.edit'), edit_user_block_path(block) %><% end %></td>
|
||||
<td class="<%= c1 %>"><% if @user and @user.id == block.creator_id and block.active? %><%= link_to t('user_block.partial.edit'), edit_user_block_path(block) %><% end %></td>
|
||||
<% if show_revoke_link %>
|
||||
<td class="<%= c1 %>"><% if block.active? %><%= link_to t('user_block.partial.revoke'), block, :confirm => t('user_block.partial.confirm'), :action => :revoke %><% end %></td>
|
||||
<% end %>
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
<% if show_user_name %>
|
||||
<th><%= t'user_block.partial.display_name' %></th>
|
||||
<% end %>
|
||||
<% if show_moderator_name %>
|
||||
<th><%= t'user_block.partial.moderator_name' %></th>
|
||||
<% if show_creator_name %>
|
||||
<th><%= t'user_block.partial.creator_name' %></th>
|
||||
<% end %>
|
||||
<th><%= t'user_block.partial.reason' %></th>
|
||||
<th><%= t'user_block.partial.status' %></th>
|
||||
|
@ -15,5 +15,5 @@
|
|||
<th></th>
|
||||
<% end %>
|
||||
</tr>
|
||||
<%= render :partial => 'block', :locals => {:show_revoke_link => show_revoke_link, :show_user_name => show_user_name, :show_moderator_name => show_moderator_name }, :collection => @user_blocks unless @user_blocks.nil? %>
|
||||
<%= render :partial => 'block', :locals => {:show_revoke_link => show_revoke_link, :show_user_name => show_user_name, :show_creator_name => show_creator_name }, :collection => @user_blocks unless @user_blocks.nil? %>
|
||||
</table>
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<h1><%= t('user_block.blocks_by.heading', :name => @this_user.display_name) %></h1>
|
||||
|
||||
<%= render :partial => 'blocks', :locals => { :show_revoke_link => (@user and @user.moderator?), :show_user_name => true, :show_moderator_name => false } %>
|
||||
<%= render :partial => 'blocks', :locals => { :show_revoke_link => (@user and @user.moderator?), :show_user_name => true, :show_creator_name => false } %>
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<h1><%= t('user_block.blocks_on.heading', :name => @this_user.display_name) %></h1>
|
||||
|
||||
<%= render :partial => 'blocks', :locals => { :show_revoke_link => (@user and @user.moderator?), :show_user_name => false, :show_moderator_name => true } %>
|
||||
<%= render :partial => 'blocks', :locals => { :show_revoke_link => (@user and @user.moderator?), :show_user_name => false, :show_creator_name => true } %>
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<h1><%= t('user_block.index.heading') %></h1>
|
||||
|
||||
<%= render :partial => 'blocks', :locals => { :show_revoke_link => (@user and @user.moderator?), :show_user_name => true, :show_moderator_name => true } %>
|
||||
<%= render :partial => 'blocks', :locals => { :show_revoke_link => (@user and @user.moderator?), :show_user_name => true, :show_creator_name => true } %>
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<h1><%= t('user_block.revoke.heading',
|
||||
:block_on => @user_block.user.display_name,
|
||||
:block_by => @user_block.moderator.display_name) %></h1>
|
||||
:block_by => @user_block.creator.display_name) %></h1>
|
||||
|
||||
<% if @user_block.end_at > Time.now %>
|
||||
<% if @user_block.ends_at > Time.now %>
|
||||
<p><b>
|
||||
<%= t('user_block.revoke.time_future', :time => distance_of_time_in_words_to_now(@user_block.end_at)) %>
|
||||
<%= t('user_block.revoke.time_future', :time => distance_of_time_in_words_to_now(@user_block.ends_at)) %>
|
||||
</b></p>
|
||||
|
||||
<% form_for :revoke, :url => { :action => "revoke" } do |f| %>
|
||||
|
@ -20,6 +20,6 @@
|
|||
|
||||
<% else %>
|
||||
<p>
|
||||
<%= t('user_block.revoke.past', :time => distance_of_time_in_words_to_now(@user_block.end_at)) %>
|
||||
<%= t('user_block.revoke.past', :time => distance_of_time_in_words_to_now(@user_block.ends_at)) %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<h1><%= t('user_block.show.heading',
|
||||
:block_on => @user_block.user.display_name,
|
||||
:block_by => @user_block.moderator.display_name) %></h1>
|
||||
:block_by => @user_block.creator.display_name) %></h1>
|
||||
|
||||
<% if @user_block.revoker %>
|
||||
<p>
|
||||
|
@ -9,17 +9,7 @@
|
|||
</p>
|
||||
<% end %>
|
||||
|
||||
<p>
|
||||
<% if @user_block.end_at > Time.now %>
|
||||
<%= t('user_block.show.time_future', :time => distance_of_time_in_words_to_now(@user_block.end_at)) %>
|
||||
<% else %>
|
||||
<%= t('user_block.show.time_past', :time => distance_of_time_in_words_to_now(@user_block.end_at)) %>
|
||||
<% end %>
|
||||
</p>
|
||||
|
||||
<% if @user_block.needs_view %>
|
||||
<p><%= t'user_block.show.needs_view' %></p>
|
||||
<% end %>
|
||||
<p><b><%= t'user_block.show.status' %></b>: <%= block_status(@user_block) %></p>
|
||||
|
||||
<p>
|
||||
<b><%= t'user_block.show.reason' %></b>
|
||||
|
@ -27,8 +17,8 @@
|
|||
</p>
|
||||
|
||||
|
||||
<% if @user_block.end_at > Time.now.getutc %>
|
||||
<% if @user and @user.id == @user_block.moderator_id %>
|
||||
<% if @user_block.ends_at > Time.now.getutc %>
|
||||
<% if @user and @user.id == @user_block.creator_id %>
|
||||
<%= link_to t('user_block.show.edit'), edit_user_block_path(@user_block) %> |
|
||||
<% end %>
|
||||
<% if @user and @user.moderator? %>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue