Compare commits
11 Commits
master
...
permission
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
40337f9e68 | ||
|
|
42722d03a0 | ||
|
|
94fc2bd1a9 | ||
|
|
780598ca6d | ||
|
|
ec085121a4 | ||
|
|
b807a8f4ab | ||
|
|
e7cd6d6e99 | ||
|
|
badb94ff07 | ||
|
|
5a534a4dda | ||
|
|
ac583b7351 | ||
|
|
b4af851ad0 |
@@ -69,7 +69,7 @@ class BlogpostsController < ApplicationController
|
||||
end
|
||||
|
||||
def auth
|
||||
unless mod?
|
||||
unless mod? && current_user.confirmed?
|
||||
flash[:alert] = "You are not allowed to edit posts!"
|
||||
redirect_to @post ? @post : blogposts_path
|
||||
end
|
||||
|
||||
@@ -17,7 +17,7 @@ class ForumgroupsController < ApplicationController
|
||||
end
|
||||
|
||||
def update
|
||||
if admin?
|
||||
if admin? && current_user.confirmed?
|
||||
@group = Forumgroup.find(params[:id])
|
||||
if @group.update_attributes(group_params)
|
||||
flash[:notice] = "Forum group updated"
|
||||
@@ -41,7 +41,7 @@ class ForumgroupsController < ApplicationController
|
||||
end
|
||||
|
||||
def create
|
||||
if admin?
|
||||
if admin? && current_user.confirmed?
|
||||
@group = Forumgroup.new(group_params)
|
||||
if @group.save
|
||||
flash[:notice] = "Forum group created."
|
||||
@@ -57,7 +57,7 @@ class ForumgroupsController < ApplicationController
|
||||
end
|
||||
|
||||
def destroy
|
||||
if admin?
|
||||
if admin? && current_user.confirmed?
|
||||
@group = Forumgroup.find(params[:id])
|
||||
if @group.destroy
|
||||
flash[:notice] = "forum group deleted."
|
||||
|
||||
@@ -34,7 +34,7 @@ class ForumsController < ApplicationController
|
||||
end
|
||||
|
||||
def update
|
||||
if admin?
|
||||
if admin? && current_user.confirmed?
|
||||
if @forum.update_attributes(forum_params)
|
||||
flash[:notice] = "Forum updated"
|
||||
redirect_to @forum
|
||||
@@ -48,7 +48,7 @@ class ForumsController < ApplicationController
|
||||
end
|
||||
|
||||
def create
|
||||
if admin?
|
||||
if admin? && current_user.confirmed?
|
||||
@forum = Forum.new(forum_params([:forumgroup_id]))
|
||||
if @forum.save
|
||||
flash[:notice] = "Forum created."
|
||||
@@ -64,7 +64,7 @@ class ForumsController < ApplicationController
|
||||
end
|
||||
|
||||
def destroy
|
||||
if admin?
|
||||
if admin? && current_user.confirmed?
|
||||
if @forum.destroy
|
||||
flash[:notice] = "Forum deleted."
|
||||
else
|
||||
|
||||
@@ -22,9 +22,9 @@ class InfoController < ApplicationController
|
||||
def create
|
||||
@info = Info.new(info_params)
|
||||
if @info.save
|
||||
redirect_to @info, notice: 'Info has been created.'
|
||||
redirect_to @info, notice: 'The info page has been created!'
|
||||
else
|
||||
flash[:alert] = "Error creating info"
|
||||
flash[:alert] = "An error occured while creating the info page."
|
||||
render action: "new"
|
||||
end
|
||||
end
|
||||
@@ -32,18 +32,18 @@ class InfoController < ApplicationController
|
||||
def update
|
||||
@info.attributes = info_params()
|
||||
if @info.save
|
||||
redirect_to @info, notice: 'Info has been updated.'
|
||||
redirect_to @info, notice: 'The info page has been updated!'
|
||||
else
|
||||
flash[:alert] = "There was a problem while updating the info"
|
||||
flash[:alert] = "An error occured while updating the info page."
|
||||
render action: "edit"
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
if @info.destroy
|
||||
flash[:notice] = "Info deleted!"
|
||||
flash[:notice] = "The info page has been deleted!"
|
||||
else
|
||||
flash[:alert] = "There was a problem while deleting this info"
|
||||
flash[:alert] = "An error occured while deleting the info page."
|
||||
end
|
||||
redirect_to info_index_path
|
||||
end
|
||||
@@ -62,9 +62,9 @@ class InfoController < ApplicationController
|
||||
end
|
||||
|
||||
def auth
|
||||
unless mod?
|
||||
flash[:alert] = "You are not allowed to edit info!"
|
||||
unless mod? && current_user.confirmed?
|
||||
flash[:alert] = "You are not allowed to edit info pages!"
|
||||
redirect_to @info ? @info : info_index_path
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -19,7 +19,11 @@ class UsersController < ApplicationController
|
||||
begin
|
||||
@ban_json = JSON.parse(File.read("/etc/minecraft/redstoner/banned-players.json")).detect {|u| u["uuid"].tr("-", "") == @user.uuid}
|
||||
rescue
|
||||
flash.now[:alert] = "An error occured while checking if this user is banned from the server!"
|
||||
if @user.is?(current_user)
|
||||
flash.now[:alert] = "An error occured while checking if you are banned from the server!"
|
||||
else
|
||||
flash.now[:alert] = "An error occured while checking if this user is banned from the server!"
|
||||
end
|
||||
@ban_json = nil
|
||||
end
|
||||
end
|
||||
@@ -131,7 +135,7 @@ class UsersController < ApplicationController
|
||||
end
|
||||
|
||||
def resend_mail
|
||||
if (@user.is?(current_user) || mod?) && !@user.confirmed?
|
||||
if (@user.is?(current_user) || (mod? && current_user.confirmed?)) && !@user.confirmed?
|
||||
RedstonerMailer.register_mail(@user, false).deliver_now
|
||||
flash[:notice] = "Check your inbox for the confirmation mail."
|
||||
else
|
||||
@@ -141,7 +145,7 @@ class UsersController < ApplicationController
|
||||
end
|
||||
|
||||
def update
|
||||
if (mod? && current_user.role >= @user.role ) || (@user.is?(current_user) && confirmed?)
|
||||
if (mod? && current_user.role >= @user.role && current_user.confirmed?) || (@user.is?(current_user) && confirmed?)
|
||||
if mod?
|
||||
userdata = user_params([:name, :skype, :youtube, :twitter, :about, :role, :badge, :confirmed, :header_scroll, :utc_time, :dark])
|
||||
else
|
||||
@@ -184,7 +188,7 @@ class UsersController < ApplicationController
|
||||
end
|
||||
|
||||
def ban
|
||||
if mod? && current_user.role >= @user.role
|
||||
if mod? && current_user.role >= @user.role && current_user.confirmed?
|
||||
@user.role = Role.get :banned
|
||||
flash[:notice] = "'#{@user.name}' has been banned!"
|
||||
else
|
||||
@@ -194,7 +198,7 @@ class UsersController < ApplicationController
|
||||
end
|
||||
|
||||
def unban
|
||||
if mod? && current_user.role >= @user.role
|
||||
if mod? && current_user.role >= @user.role && current_user.confirmed?
|
||||
@user.role = Role.get :normal
|
||||
flash[:notice] = "\"#{@user.name}\" has been unbanned!"
|
||||
else
|
||||
@@ -204,7 +208,7 @@ class UsersController < ApplicationController
|
||||
end
|
||||
|
||||
def destroy
|
||||
if superadmin?
|
||||
if superadmin? && current_user.confirmed?
|
||||
if @user.destroy
|
||||
flash[:notice] = "User deleted forever."
|
||||
redirect_to users_url
|
||||
@@ -219,28 +223,28 @@ class UsersController < ApplicationController
|
||||
end
|
||||
|
||||
def edit_notifications
|
||||
unless @user.is?(current_user) || admin? && current_user.role > @user.role || superadmin?
|
||||
unless @user.is?(current_user) || (admin? && current_user.role > @user.role) || superadmin?
|
||||
flash[:alert] = "You are not allowed to edit this user's notification settings!"
|
||||
redirect_to @user
|
||||
end
|
||||
end
|
||||
|
||||
def edit_login
|
||||
unless @user.is?(current_user) || admin? && current_user.role > @user.role || superadmin?
|
||||
unless @user.is?(current_user) || (admin? && current_user.role > @user.role) || superadmin?
|
||||
flash[:alert] = "You are not allowed to edit this user's login details!"
|
||||
redirect_to @user
|
||||
end
|
||||
end
|
||||
|
||||
def edit_website_settings
|
||||
unless @user.is?(current_user) || admin? && current_user.role > @user.role || superadmin?
|
||||
unless @user.is?(current_user) || (admin? && current_user.role > @user.role) || superadmin?
|
||||
flash[:alert] = "You are not allowed to edit this user's website settings!"
|
||||
redirect_to @user
|
||||
end
|
||||
end
|
||||
|
||||
def update_login
|
||||
if @user.is?(current_user) || admin? && current_user.role > @user.role || superadmin?
|
||||
if @user.is?(current_user) || (admin? && current_user.role > @user.role && current_user.confirmed?) || (superadmin? && current_user.confirmed?)
|
||||
authenticated = !@user.is?(current_user) || @user.authenticate(params[:current_password])
|
||||
if params[:user][:password].present?
|
||||
@user.password = params[:user][:password]
|
||||
|
||||
@@ -1,10 +1,20 @@
|
||||
<% title "Edit News: #{@post.title}" %>
|
||||
|
||||
<%
|
||||
def can_edit?
|
||||
mod? && current_user.confirmed?
|
||||
end
|
||||
%>
|
||||
|
||||
<h1>Edit post</h1>
|
||||
<%= form_for @post do |f|%>
|
||||
<%= f.text_field :title %>
|
||||
<%= render partial: "md_editor", locals: {name: "blogpost[content]", content: @post.content} %>
|
||||
<p><%= f.submit "Update Post", class: "btn blue left" %></p>
|
||||
<%= f.text_field :title, disabled: !can_edit? %>
|
||||
<%= render partial: "md_editor", locals: {name: "blogpost[content]", content: @post.content, options: {disabled: !can_edit?}} %>
|
||||
<p><%= f.submit "Update Post", class: "btn blue left", disabled: !can_edit? %></p>
|
||||
<% end %>
|
||||
<p><%= button_to "Delete post", @post, method: "delete", data: {confirm: "Delete post & comments forever?"}, class: "btn red right", disabled: !can_edit? %></p>
|
||||
<div class="clear"></div>
|
||||
|
||||
<% if !current_user.confirmed? %>
|
||||
<span class='red-alert'>You must confirm your email before you can edit blog posts.</span>
|
||||
<% end %>
|
||||
<p><%= button_to "Delete post", @post, method: "delete", data: {confirm: "Delete post & comments forever?"}, class: "btn red right" %></p>
|
||||
<div class="clear"></div>
|
||||
@@ -1,9 +1,19 @@
|
||||
<% title "New Blog Post" %>
|
||||
|
||||
<%
|
||||
def can_create?
|
||||
admin? && current_user.confirmed?
|
||||
end
|
||||
%>
|
||||
|
||||
<h1>New Post</h1>
|
||||
<%= form_for @post do |f|%>
|
||||
<%= f.text_field :title, placeholder: "Title" %>
|
||||
<%= render partial: "md_editor", locals: {name: "blogpost[content]", content: @post.content} %>
|
||||
<p><%= f.submit "Create Post", class: "btn blue left" %></p>
|
||||
<%= f.text_field :title, placeholder: "Title", disabled: !can_create? %>
|
||||
<%= render partial: "md_editor", locals: {name: "blogpost[content]", content: @post.content, options: {disabled: !can_create?}} %>
|
||||
<p><%= f.submit "Create Post", class: "btn blue left", disabled: !can_create? %></p>
|
||||
<div class="clear"></div>
|
||||
|
||||
<% if !current_user.confirmed? %>
|
||||
<span class='red-alert'>You must confirm your email before you can create new blog posts.</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
<% title "Manage Forums" %>
|
||||
|
||||
<%
|
||||
def can_edit?
|
||||
admin? && current_user.confirmed?
|
||||
end
|
||||
%>
|
||||
|
||||
<h1>Manage Forums</h1>
|
||||
<div class="item-group">
|
||||
<div class="header">
|
||||
@@ -19,22 +25,26 @@
|
||||
<table>
|
||||
<tr>
|
||||
<td><%= f.label :name %></td>
|
||||
<td><%= f.text_field :name, placeholder: "Name" %></td>
|
||||
<td><%= f.text_field :name, placeholder: "Name", disabled: !can_edit? %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= f.label :position %></td>
|
||||
<td><%= f.number_field :position, placeholder: "Position" %></td>
|
||||
<td><%= f.number_field :position, placeholder: "Position", disabled: !can_edit? %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= f.label :role_read_id, "Min. read role" %></td>
|
||||
<td><%= f.select :role_read_id, role_selection, include_blank: "None" %></td>
|
||||
<td><%= f.select :role_read_id, role_selection, { include_blank: "None" }, { disabled: !can_edit? } %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= f.label :role_write_id, "Min. write role" %></td>
|
||||
<td><%= f.select :role_write_id, role_selection, include_blank: false %></td>
|
||||
<td><%= f.select :role_write_id, role_selection, { include_blank: false }, { disabled: !can_edit? } %></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p><%= f.submit "Update group", class: "btn blue left" %></p>
|
||||
<p><%= f.submit "Update group", class: "btn blue left", disabled: !can_edit? %></p>
|
||||
<% end %>
|
||||
<p><%= button_to "Delete group", @group, :method => "delete", data: {confirm: "Delete group?\nForums + Threads will not be accessible!"}, class: "btn red right", disabled: !can_edit? %></p>
|
||||
<div class="clear"></div>
|
||||
|
||||
<% if !current_user.confirmed? %>
|
||||
<span class='red-alert'>You must confirm your email before you can edit forum groups.</span>
|
||||
<% end %>
|
||||
<p><%= button_to "Delete group", @group, :method => "delete", data: {confirm: "Delete group?\nForums + Threads will not be accessible!"}, class: "btn red right" %></p>
|
||||
<div class="clear"></div>
|
||||
@@ -1,26 +1,36 @@
|
||||
<% title "New Forum: #{@group.name}" %>
|
||||
|
||||
<%
|
||||
def can_create?
|
||||
admin? && current_user.confirmed?
|
||||
end
|
||||
%>
|
||||
|
||||
<h1>New forum group</h1>
|
||||
<% role_selection = Role.all_from_to(:normal, :admin).collect{|p|[p.name, p.id]} %>
|
||||
<%= form_for @group do |f|%>
|
||||
<table>
|
||||
<tr>
|
||||
<td><%= f.label :name %></td>
|
||||
<td><%= f.text_field :name, placeholder: "Name" %></td>
|
||||
<td><%= f.text_field :name, placeholder: "Name", disabled: !can_create? %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= f.label :position %></td>
|
||||
<td><%= f.number_field :position, placeholder: "Position" %></td>
|
||||
<td><%= f.number_field :position, placeholder: "Position", disabled: !can_create? %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= f.label :role_read_id, "Min. read role" %></td>
|
||||
<td><%= f.select :role_read_id, role_selection, include_blank: "None" %></td>
|
||||
<td><%= f.select :role_read_id, role_selection, { include_blank: "None" }, { disabled: !can_create? } %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= f.label :role_write_id, "Min. write role" %></td>
|
||||
<td><%= f.select :role_write_id, role_selection, include_blank: false %></td>
|
||||
<td><%= f.select :role_write_id, role_selection, { include_blank: false }, { disabled: !can_create? } %></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p><%= f.submit "Create group", class: "btn blue left" %></p>
|
||||
<p><%= f.submit "Create group", class: "btn blue left", disabled: !can_create? %></p>
|
||||
<div class="clear"></div>
|
||||
<% end %>
|
||||
|
||||
<% if !current_user.confirmed? %>
|
||||
<span class='red-alert'>You must confirm your email before you can create new forum groups.</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
<% title "Edit Forum: #{@forum.name}" %>
|
||||
|
||||
<%
|
||||
def can_edit?
|
||||
admin? && current_user.confirmed?
|
||||
end
|
||||
%>
|
||||
|
||||
<%= link_to "(Edit) #{@forum.group.name}", edit_forumgroup_path(@forum.group) %> → <%= @forum.name %>
|
||||
<h1>Edit Forum</h1>
|
||||
<% role_selection = Role.all_from_to(:normal, :admin).collect{|p|[p.name, p.id]} %>
|
||||
@@ -7,26 +13,30 @@
|
||||
<table>
|
||||
<tr>
|
||||
<td><%= f.label :name %></td>
|
||||
<td><%= f.text_field :name, placeholder: "Name" %></td>
|
||||
<td><%= f.text_field :name, placeholder: "Name", disabled: !can_edit? %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= f.label :position %></td>
|
||||
<td><%= f.number_field :position, placeholder: "Position" %></td>
|
||||
<td><%= f.number_field :position, placeholder: "Position", disabled: !can_edit? %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= f.label :role_read_id, "Min. read role" %></td>
|
||||
<td><%= f.select :role_read_id, role_selection, include_blank: "None" %></td>
|
||||
<td><%= f.select :role_read_id, role_selection, { include_blank: "None" }, { disabled: !can_edit? } %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= f.label :role_write_id, "Min. write role" %></td>
|
||||
<td><%= f.select :role_write_id, role_selection, include_blank: false %></td>
|
||||
<td><%= f.select :role_write_id, role_selection, { include_blank: false }, { disabled: !can_edit? } %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= f.label :necro_length, "Necropost warning delay (in days)" %></td>
|
||||
<td><%= f.number_field :necro_length, placeholder: "Warning Delay (leave blank for no warning)" %></td>
|
||||
<td><%= f.number_field :necro_length, placeholder: "Warning Delay (leave blank for no warning)", disabled: !can_edit? %></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p><%= f.submit "Update forum", class: "btn blue left" %></p>
|
||||
<p><%= f.submit "Update forum", class: "btn blue left", disabled: !can_edit? %></p>
|
||||
<% end %>
|
||||
<p><%= button_to "Delete forum", @forum, method: "delete", data: {confirm: "Delete forum forever?\nThreads won't be accessible!"}, class: "btn red right" %></p>
|
||||
<p><%= button_to "Delete forum", @forum, method: "delete", data: {confirm: "Delete forum forever?\nThreads won't be accessible!"}, class: "btn red right", disabled: !can_edit? %></p>
|
||||
<div class="clear"></div>
|
||||
|
||||
<% if !current_user.confirmed? %>
|
||||
<span class='red-alert'>You must confirm your email before you can edit forums.</span>
|
||||
<% end %>
|
||||
|
||||
@@ -56,6 +56,4 @@
|
||||
|
||||
<% if admin? %>
|
||||
<%= link_to "New group", new_forumgroup_path, class: "btn blue" %>
|
||||
<% elsif mod? %>
|
||||
<%= link_to "New group", "#", class: "btn blue", disabled: true %>
|
||||
<% end %>
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
<% title "New Forum: #{@forum.group.name}" %>
|
||||
|
||||
<%
|
||||
def can_create?
|
||||
admin? && current_user.confirmed?
|
||||
end
|
||||
%>
|
||||
|
||||
<%= link_to @forum.group, forumgroup_path(@forum.group) %> → New forum
|
||||
<h1>New Forum</h1>
|
||||
<% role_selection = Role.all_from_to(:normal, :admin).collect{|p|[p.name, p.id]} %>
|
||||
@@ -7,26 +13,30 @@
|
||||
<table>
|
||||
<tr>
|
||||
<td><%= f.label :name %></td>
|
||||
<td><%= f.text_field :name, placeholder: "Name" %></td>
|
||||
<td><%= f.text_field :name, placeholder: "Name", disabled: !can_create? %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= f.label :position %></td>
|
||||
<td><%= f.number_field :position, placeholder: "Position" %></td>
|
||||
<td><%= f.number_field :position, placeholder: "Position", disabled: !can_create? %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= f.label :role_read_id, "Min. read role" %></td>
|
||||
<td><%= f.select :role_read_id, role_selection, include_blank: "None" %></td>
|
||||
<td><%= f.select :role_read_id, role_selection, { include_blank: "None"}, { disabled: !can_create? } %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= f.label :role_write_id, "Min. write role" %></td>
|
||||
<td><%= f.select :role_write_id, role_selection, include_blank: false %></td>
|
||||
<td><%= f.select :role_write_id, role_selection, { include_blank: false }, { disabled: !can_create? } %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= f.label :necro_length, "Necropost warning delay (in days)" %></td>
|
||||
<td><%= f.number_field :necro_length, placeholder: "Warning Delay (leave blank for no warning)" %></td>
|
||||
<td><%= f.number_field :necro_length, placeholder: "Warning Delay (leave blank for no warning)", disabled: !can_create? %></td>
|
||||
</tr>
|
||||
</table>
|
||||
<%= f.hidden_field :forumgroup_id %>
|
||||
<p><%= f.submit "Create forum", class: "btn blue left" %></p>
|
||||
<p><%= f.submit "Create forum", class: "btn blue left", disabled: !can_create? %></p>
|
||||
<div class="clear"></div>
|
||||
|
||||
<% if !current_user.confirmed? %>
|
||||
<span class='red-alert'>You must confirm your email before you can create new forums.</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@@ -1,10 +1,20 @@
|
||||
<% title "Edit Info: #{@info.title}" %>
|
||||
|
||||
<%
|
||||
def can_edit?
|
||||
mod? && current_user.confirmed?
|
||||
end
|
||||
%>
|
||||
|
||||
<h1>Edit Info</h1>
|
||||
<%= form_for @info do |f|%>
|
||||
<%= f.text_field :title%>
|
||||
<%= render partial: "md_editor", locals: {name: "info[content]", content: @info.content} %>
|
||||
<p><%= f.submit "Update Info", class: "btn blue left" %></p>
|
||||
<%= f.text_field :title, disabled: !can_edit? %>
|
||||
<%= render partial: "md_editor", locals: {name: "info[content]", content: @info.content, options: {disabled: !can_edit?}} %>
|
||||
<p><%= f.submit "Update Info", class: "btn blue left", disabled: !can_edit? %></p>
|
||||
<% end %>
|
||||
<p><%= button_to "Delete Info", @info, method: "delete", data: {confirm: "Are you sure you want to delete this info page?"}, class: "btn red right", disabled: !can_edit? %></p>
|
||||
<div class="clear"></div>
|
||||
|
||||
<% if !current_user.confirmed? %>
|
||||
<span class='red-alert'>You must confirm your email before you can edit info pages.</span>
|
||||
<% end %>
|
||||
<p><%= button_to "Delete Info", @info, method: "delete", data: {confirm: "Delete Info forever?"}, class: "btn red right" %></p>
|
||||
<div class="clear"></div>
|
||||
@@ -1,9 +1,19 @@
|
||||
<% title "New Info" %>
|
||||
|
||||
<%
|
||||
def can_create?
|
||||
mod? && current_user.confirmed?
|
||||
end
|
||||
%>
|
||||
|
||||
<h1>New Info</h1>
|
||||
<%= form_for @info, url: info_index_path do |f|%>
|
||||
<%= f.text_field :title, placeholder: "Title" %>
|
||||
<%= render partial: "md_editor", locals: {name: "info[content]", content: @info.content} %>
|
||||
<p><%= f.submit "Create Info", class: "btn blue left" %></p>
|
||||
<%= f.text_field :title, placeholder: "Title", disabled: !can_create? %>
|
||||
<%= render partial: "md_editor", locals: {name: "info[content]", content: @info.content, options: {disabled: !can_create?}} %>
|
||||
<p><%= f.submit "Create Info", class: "btn blue left", disabled: !can_create? %></p>
|
||||
<div class="clear"></div>
|
||||
|
||||
<% if !current_user.confirmed? %>
|
||||
<span class='red-alert'>You must confirm your email before you can create new info pages.</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<%
|
||||
def can_edit?
|
||||
(@user.is?(current_user) && confirmed?) || (mod? && current_user.role >= @user.role)
|
||||
(@user.is?(current_user) && confirmed?) || (mod? && current_user.role >= @user.role && current_user.confirmed?)
|
||||
end
|
||||
%>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<td>Role</td>
|
||||
<td>
|
||||
<% if current_user.role >= @user.role %>
|
||||
<%= f.select :role, Role.all_to(current_user.role) %>
|
||||
<%= f.select :role, Role.all_to(current_user.role), {}, { disabled: !can_edit? } %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -31,7 +31,7 @@
|
||||
<td>Badge</td>
|
||||
<td>
|
||||
<% if current_user.role >= Role.get(:mod) %>
|
||||
<%= f.select :badge, Badge.all %>
|
||||
<%= f.select :badge, Badge.all, {}, { disabled: !can_edit? } %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -57,7 +57,7 @@
|
||||
<tr>
|
||||
<td>Twitter username</td>
|
||||
<td>
|
||||
<%= f.text_field :twitter, placeholder: "Twitter username", disabled: !(@user.is?(current_user) && confirmed? || (mod? && current_user.role >= @user.role)) %>
|
||||
<%= f.text_field :twitter, placeholder: "Twitter username", disabled: !can_edit? %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -69,7 +69,7 @@
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p><%= f.submit "Save profile", class: "btn variable-size left", disabled: (!@user.confirmed? && @user.is?(current_user)) %></p>
|
||||
<p><%= f.submit "Save profile", class: "btn variable-size left", disabled: !can_edit? %></p>
|
||||
<p>
|
||||
<%= link_to "Edit login details", edit_login_user_path(@user), class: "btn variable-size right" %>
|
||||
<%= link_to "Notification settings", edit_notifications_user_path(@user), class: "btn variable-size right" %>
|
||||
@@ -77,7 +77,9 @@
|
||||
</p>
|
||||
<div class="clear"></div>
|
||||
|
||||
<% if !@user.confirmed? %>
|
||||
<% if !@user.is?(current_user) && !current_user.confirmed? %>
|
||||
<span class='red-alert'>You must confirm your own email before you can edit other profiles.</span>
|
||||
<% elsif !@user.confirmed? %>
|
||||
<% if @user.is?(current_user) %>
|
||||
<span class='red-alert'>Please confirm your email address first!</span>
|
||||
<% else %>
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
<% title "Edit Notification Settings: #{@user.name}" %>
|
||||
|
||||
<%
|
||||
def can_edit?
|
||||
(@user.is?(current_user) && confirmed?) || (mod? && current_user.role >= @user.role && current_user.confirmed?)
|
||||
end
|
||||
%>
|
||||
|
||||
<%= link_to @user.name, @user %> → Edit Notification Settings
|
||||
<h1>Edit Notification Settings</h1>
|
||||
|
||||
@@ -11,13 +17,13 @@
|
||||
<tr>
|
||||
<td>replies to my thread</td>
|
||||
<td>
|
||||
<%= f.check_box :mail_own_thread_reply %>
|
||||
<%= f.check_box :mail_own_thread_reply, disabled: !can_edit? %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>replies to a thread I already replied to</td>
|
||||
<td>
|
||||
<%= f.check_box :mail_other_thread_reply %>
|
||||
<%= f.check_box :mail_other_thread_reply, disabled: !can_edit? %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -26,13 +32,13 @@
|
||||
<i>(Currently used for staff only)</i>
|
||||
</td>
|
||||
<td>
|
||||
<%= f.check_box :mail_own_blogpost_comment %>
|
||||
<%= f.check_box :mail_own_blogpost_comment, disabled: !can_edit? %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>comments a blog post I already commented</td>
|
||||
<td>
|
||||
<%= f.check_box :mail_other_blogpost_comment %>
|
||||
<%= f.check_box :mail_other_blogpost_comment, disabled: !can_edit? %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -40,14 +46,20 @@
|
||||
mentions me in a thread or comment
|
||||
</td>
|
||||
<td>
|
||||
<%= f.check_box :mail_mention %>
|
||||
<%= f.check_box :mail_mention, disabled: !can_edit? %>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h3>Public Key</h1>
|
||||
<p>All notification emails will be encrypted with this key if you supply it.</p>
|
||||
<%= f.text_area :public_key, placeholder: "-----BEGIN PGP PUBLIC KEY BLOCK-----" %>
|
||||
<p><%= f.submit "Save changes", class: "btn blue left" %></p>
|
||||
<%= f.text_area :public_key, placeholder: "-----BEGIN PGP PUBLIC KEY BLOCK-----", disabled: !can_edit? %>
|
||||
<p><%= f.submit "Save changes", class: "btn blue left", disabled: !can_edit? %></p>
|
||||
<div class="clear"></div>
|
||||
|
||||
<% if !@user.is?(current_user) && !current_user.confirmed? %>
|
||||
<span class='red-alert'>You must confirm your own email before you can edit other user's notification settings.</span>
|
||||
<% elsif !@user.confirmed? && @user.is?(current_user) %>
|
||||
<span class='red-alert'>You need to confirm your email before you can edit your notification settings.</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
<% title "Edit Website Settings: #{@user.name}" %>
|
||||
|
||||
<%
|
||||
def can_edit?
|
||||
(@user.is?(current_user) && confirmed?) || (mod? && current_user.role >= @user.role && current_user.confirmed?)
|
||||
end
|
||||
%>
|
||||
|
||||
<%= link_to @user.name, @user %> → Edit Website Settings
|
||||
<h1>Edit Website Settings</h1>
|
||||
|
||||
@@ -10,25 +16,31 @@
|
||||
<tr>
|
||||
<td>Header moves with scrolling (Experimental - do not report bugs)</td>
|
||||
<td>
|
||||
<%= f.check_box :header_scroll %>
|
||||
<%= f.check_box :header_scroll, disabled: !can_edit? %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Show exact UTC times</td>
|
||||
<td>
|
||||
<%= f.check_box :utc_time %>
|
||||
<%= f.check_box :utc_time, disabled: !can_edit? %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Dark theme*</td>
|
||||
<td>
|
||||
<%= f.check_box :dark %>
|
||||
<%= f.check_box :dark, disabled: !can_edit? %>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><%= f.submit "Save changes", class: "btn blue left" %></p>
|
||||
<p><%= f.submit "Save changes", class: "btn blue left", disabled: !can_edit? %></p>
|
||||
<div class="clear"></div>
|
||||
|
||||
<% if !@user.is?(current_user) && !current_user.confirmed? %>
|
||||
<span class='red-alert'>You must confirm your own email before you can edit other user's website settings.</span>
|
||||
<% elsif !@user.confirmed? && @user.is?(current_user) %>
|
||||
<span class='red-alert'>You need to confirm your email before you can edit your website settings.</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<br><br><br>
|
||||
*Warning: If as a result to enabling this style your eyes get infected with a severe case of eye cancer, we are not reliable for any damage. Please contact your doctor in advance to ensure that in case of infection you will be treated accordingly. Quality theme brought to you by Redempt™.
|
||||
|
||||
@@ -16,16 +16,27 @@
|
||||
|
||||
<div class="clear"></div>
|
||||
<% if @ban_json && (@ban_json["expires"] == "forever" || !(DateTime.parse(@ban_json["expires"]) <= DateTime.now)) %>
|
||||
<span class="user-banned">This user is banned on the server for "<%=@ban_json["reason"]%>"<%=" until #{@ban_json["expires"]}" unless @ban_json["expires"] == "forever"%></span>
|
||||
<% if @user.is?(current_user) %>
|
||||
<span class="user-banned">You are banned on the server for "<%=@ban_json["reason"]%>"<%=" until #{@ban_json["expires"]}" unless @ban_json["expires"] == "forever"%></span>
|
||||
<% else %>
|
||||
<span class="user-banned">This user is banned on the server for "<%=@ban_json["reason"]%>"<%=" until #{@ban_json["expires"]}" unless @ban_json["expires"] == "forever"%></span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if @user.banned? %>
|
||||
<% if @user.is?(current_user) %>
|
||||
<span class="user-banned">You are banned on the website!</span>
|
||||
<% else %>
|
||||
<span class="user-banned">This user is banned on the website!</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<br>
|
||||
<% if !@user.confirmed? %>
|
||||
<% if @user.is?(current_user) || mod? %>
|
||||
<span class="user-unconfirmed">Please confirm your email <u><%= @user.email %></u> !</span>
|
||||
<% if @user.is?(current_user) %>
|
||||
<span class="user-unconfirmed">You haven't confirmed your email "<u><%= @user.email %></u>" yet!</span>
|
||||
<%= button_to "Resend the confirmation mail", resend_mail_user_path, class: "btn dark", form_class: "inline-block", data: {confirm: "Did you check your spam folder?"} %>
|
||||
<% elsif mod? %>
|
||||
<span class="user-unconfirmed">This user hasn't confirmed their email "<u><%= @user.email %></u>" yet!</span>
|
||||
<%= button_to "Resend the confirmation mail", resend_mail_user_path, class: "btn dark", form_class: "inline-block" %>
|
||||
<% else %>
|
||||
<span class="user-unconfirmed">This user hasn't confirmed their email yet!</span>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user