module ForumHelper
def topic_info(topic)
cu = current_user
+ is_guest = cu.is_guest?
icon_text = 'Normal icon'
item_status = ''
icon_type = 'icon'
@@ -21,7 +22,7 @@ module ForumHelper
end
subject_new_posts = ''
- if !cu.is_guest? and topic.last_post > cu.last_visit and topic.moved_to.nil?
+ if !is_guest and topic.last_post > cu.last_visit and topic.moved_to.nil?
icon_text += ' ' + 'New icon'
item_status += ' inew'
icon_type = 'icon inew'
@@ -29,7 +30,7 @@ module ForumHelper
subject_new_posts = '<span class="newtext">[ '+link_to('New posts', {:controller => 'topic', :action => 'view', :id => topic.id, :new_posts => true}, {:title => 'New posts info'})+' ]</span>'
end
- if !cu.is_guest? and Settings.show_dot == true
+ if !is_guest and Settings.show_dot == true
subject = (topic.posts.find_by_poster_id(cu.id) != nil ? '<strong>·</strong> ' : ' ') + subject
end
<%
cu = current_user
+ is_guest = cu.is_guest?
content_for :head_links do
-%>
<ul class="conr">
end
content_for :foot_links do
- if cu.is_guest?
+ if is_guest
if User.guest.group.g_search
-%>
<dl id="searchlinks" class="conl">
# if we have o, we draw it now, as forum is "the next current forum"
# o may be null in the first iteration
if o
- if !cu.is_guest? && o.last_post && cu.last_visit && o.last_post > cu.last_visit
+ if !is_guest && o.last_post && cu.last_visit && o.last_post > cu.last_visit
item_status = 'inew'
icon_text = 'New icon'
icon_type = 'icon new'
+<%
+is_guest = @group.is_guest?
+is_mod = @group.is_mod?
+is_admin = @group.is_admin?
+-%>
<div class="blockform">
<h2><span>Group settings</span></h2>
<div class="box">
<span>This title will override any rank users in this group have attained. Leave blank to use default title or rank.</span>
</td>
</tr>
-<% unless @group.is_admin? -%>
+<% unless is_admin -%>
<tr>
<th scope="row">Read board</th>
<td>
<span>Allow users in this group to post new topics.</span>
</td>
</tr>
-<% unless @group.is_guest? -%>
+<% unless is_guest -%>
<tr>
<th scope="row">Edit posts</th>
<td>
<span>Allow users in this group to freetext search for users in the user list.</span>
</td>
</tr>
-<% unless @group.is_guest? -%>
+<% unless is_guest -%>
<tr>
<th scope="row">Edit subjects interval</th>
<td>
<% end -%>
<% end -%>
</table>
-<% if @group.is_mod? -%>
+<% if is_mod -%>
<p class="warntext">Please note that in order for a user in this group to have moderator abilities, he/she must be assigned to moderate one or more forums. This is done via the user administration page of the user's profile.</p>
<% end -%>
</div>
<%
cu = current_user
+is_admin = cu.is_admin?
content_for :header do
-%>
<link rel="stylesheet" type="text/css" href="/style/imports/base_admin.css" />
@@ -29,7 +30,7 @@ captions = {
'maintenance' => 'Maintenance',
'reports' => 'Reports'
}
-if cu.is_admin?
+if is_admin
items = [ 'index', 'categories', 'forums', 'users', 'groups', 'options', 'permissions', 'censoring', 'ranks', 'bans', 'prune', 'maintenance', 'reports']
else
if Settings.mod_ban_users == true
@@ -43,7 +44,7 @@ inside_layout 'application' do
-%>
<div id="adminconsole" class="block2col">
<div id="adminmenu" class="blockmenu">
- <h2><span><%= cu.is_admin? ? 'Administrator' : 'Moderator' %> menu</span></h2>
+ <h2><span><%= is_admin ? 'Administrator' : 'Moderator' %> menu</span></h2>
<div class="box">
<div class="inbox">
<ul>
<%
cu = current_user
can_moderate = cu.can_moderate?
+is_guest = cu.is_guest?
-%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
@@ -30,7 +31,7 @@ can_moderate = cu.can_moderate?
<% if Settings.rules -%>
<li id="navrules"><%= link_to "Rules", :controller => "user", :action => "list" %></li>
<% end -%>
-<% if cu.is_guest? -%>
+<% if is_guest -%>
<% if User.guest.group.g_search -%>
<li id="navsearch"><%= link_to "Search", :controller => "search" %></li>
<% end -%>
@@ -50,7 +51,7 @@ can_moderate = cu.can_moderate?
<% end -%>
</ul>
</div>
-<% if !cu.is_guest? -%>
+<% if !is_guest -%>
<div id="brdwelcome" class="inbox">
<ul class="conl">
<li>Logged in as <strong><%=h cu.username %></strong></li>
cu = current_user
can_moderate_forum = cu.can_moderate_forum? @topic.forum
can_reply = @topic.can_reply? cu
+ is_guest = cu.is_guest?
if can_moderate_forum
content_for :foot_links do
-%>
<dd>Posts: <%= o.poster_user.num_posts %></dd>
<% end -%>
<dd>
-<% if !cu.is_guest? and o.poster_user.email_setting == false -%>
+<% if !is_guest and o.poster_user.email_setting == false -%>
<a href="mailto:<%= o.poster_user.email -%>">Email</a>
-<% elsif o.poster_user.email_setting == true and !cu.is_guest? -%>
+<% elsif o.poster_user.email_setting == true and !is_guest -%>
<a href="<%= url_for :controller => 'user', :action => 'email', :id => o.poster_id %>">Email</a>
<% end -%>
<% if o.poster_user.url -%>
</div>
<div class="postfootright">
<ul>
-<% if !cu.is_guest? -%>
+<% if !is_guest -%>
<li class="postreport"><%= link_to "Report", :action => 'report_post', :id => o.id %></li>
<% end -%>
<% if @topic.closed == false -%>
<%
cu = current_user
+is_admin = cu.is_admin?
can_moderate = cu.can_moderate?
-%>
<div class="blockform">
@@ -11,12 +12,12 @@ can_moderate = cu.can_moderate?
<legend>Enter your username and password</legend>
<div class="infldset">
<input type="hidden" name="form_sent" value="1" />
-<% if cu.is_admin? and Settings.mod_rename_users == true -%>
+<% if is_admin and Settings.mod_rename_users == true -%>
<input type="hidden" name="old_username" value="<%=h @user.username %>).'" /><label><strong>Username</strong><br /><input type="text" name="req_username" value="<%=h @user.username %>" size="25" maxlength="25" /><br /></label>
<% else -%>
<p>Username: <%=h @user.username %></p>
<% end -%>
-<% if cu.id == @user.id or cu.is_admin? or (@user.group.id > Settings.group_ids[:pun_mod] and Settings.mod_change_passwords == true) -%>
+<% if cu.id == @user.id or is_admin or (@user.group.id > Settings.group_ids[:pun_mod] and Settings.mod_change_passwords == true) -%>
<p><a href="<%= url_for :action => 'change_password', :id => @user.id %>">Change password</a></p>
<% end -%>
</div>
@@ -59,7 +60,7 @@ can_moderate = cu.can_moderate?
<% end %>
</p>
<p>Last post: <%= @user.last_post %></p>
-<% if cu.is_admin? -%>
+<% if is_admin -%>
<label>Posts<br /><input type="text" name="num_posts" value="<%= @user.num_posts %>" size="8" maxlength="8" /><br /></label><p><a href="<%= url_for :controller => 'search', :action => 'user_posts', :id => @user.id %>">Show posts</a></p>
<% else -%>
<p>Posts: <%= @user.num_posts %> - <a href="<%= url_for :controller => 'search', :action => 'user_posts', :id => @user.id %>">Show posts</a></p>