Page Menu
Home
GRNET
Search
Configure Global Search
Log In
Files
F1969829
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, May 17, 10:50 AM
Size
4 KB
Mime Type
text/x-diff
Expires
Tue, May 19, 10:50 AM (3 h, 33 m)
Engine
blob
Format
Raw Data
Handle
385277
Attached To
rWEBDNS WebDNS (edet4)
View Options
diff --git a/app/controllers/domains_controller.rb b/app/controllers/domains_controller.rb
index 72f9c0b..077ca4c 100644
--- a/app/controllers/domains_controller.rb
+++ b/app/controllers/domains_controller.rb
@@ -1,74 +1,78 @@
class DomainsController < ApplicationController
before_action :authenticate_user!
before_action :domain, only: [:show, :edit, :update, :destroy]
before_action :group, only: [:show, :edit, :update, :destroy]
helper_method :edit_group_scope
# GET /domains
def index
@domains = show_domain_scope.all
end
# GET /domains/1
def show
@record = Record.new(domain_id: @domain.id)
end
# GET /domains/new
def new
- @domain = Domain.new
+ @domain = Domain.new(new_domain_params)
end
# GET /domains/1/edit
def edit
end
# POST /domains
def create
@domain = Domain.new(domain_params)
if @domain.save
notify_domain(@domain, :create)
redirect_to @domain, notice: "#{@domain.name} was successfully created."
else
render :new
end
end
# PATCH/PUT /domains/1
def update
if @domain.update(domain_params)
notify_domain(@domain, :update)
redirect_to @domain, notice: "#{@domain.name} was successfully updated."
else
render :edit
end
end
# DELETE /domains/1
def destroy
@domain.destroy
notify_domain(@domain, :destroy)
redirect_to domains_url, notice: "#{@domain.name} was successfully destroyed."
end
private
def group
domain.group
end
+ def new_domain_params
+ params.permit(:group_id)
+ end
+
def domain_params
params.require(:domain).tap { |d|
# Make sure group id is permitted (belongs to edit_group_scope)
d[:group_id] = edit_group_scope.find_by_id(d[:group_id]).try(:id)
}.permit(:name, :type, :master, :group_id)
end
def notify_domain(*args)
notification.notify_domain(current_user, *args)
end
end
diff --git a/app/views/groups/show.html.erb b/app/views/groups/show.html.erb
index 14d38c0..1417b3a 100644
--- a/app/views/groups/show.html.erb
+++ b/app/views/groups/show.html.erb
@@ -1,78 +1,78 @@
<% content_for :more_breadcrumbs do %>
<li>
<%= link_to_edit edit_admin_group_path(@group) %>
<%= link_to_destroy admin_group_path(@group), method: :delete, data: { confirm: 'Are you sure?' } %>
</li>
<% end if admin? %>
<ul class="nav nav-tabs">
<li role="presentation" class="active"><a data-toggle="tab" href="#domains">Domains</a></li>
<li role="presentation"><a data-toggle="tab" href="#members">Members</a></li>
</ul>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="domains">
<table class="table table-striped table-hover">
<thead>
<tr>
<th colspan="2">Domain</th>
<th colspan="2">Controls</th>
</tr>
</thead>
<tbody>
<% @group.domains.each do |domain| %>
<tr>
<td><%= link_to domain.name, domain %></td>
<td>
<% if domain.reverse? %>
<%= abbr_glyph('chevron-left', 'Reverse') %>
<% else %>
<%= abbr_glyph('chevron-right', 'Forward') %>
<% end %>
<% if domain.slave? %>
<%= abbr_glyph('link', 'Slave') %>
<% end %>
</td>
<td><%= link_to_edit edit_domain_path(domain) %></td>
<td><%= link_to_destroy domain, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
<p>
- <%= link_to 'Add Domain', new_domain_path, class: 'btn btn-primary' %>
+ <%= link_to 'Add Domain', new_domain_path(group_id: @group.id), class: 'btn btn-primary' %>
</p>
</div>
<div role="tabpanel" class="tab-pane" id="members">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Member</th>
<th>Controls</th>
</tr>
</thead>
<tbody>
<% @group.memberships.includes(:user).each do |membership| %>
<tr>
<td><%= membership.user.email %><%= " (you)" if current_user == membership.user %></td>
<td>
<%= link_to_destroy destroy_member_group_path(@group, membership.user_id), method: :delete %>
</td>
</tr>
<% end %>
</tbody>
</table>
<p>
<%= bootstrap_form_tag(url: create_member_group_path(@group), layout: :inline) do |f| %>
<%= f.text_field :email, prepend: 'Add Member', hide_label: true, id: 'js-search-member', data: { group: @group.id } %>
<%= f.submit 'Add', class: 'btn btn-primary' %>
<% end %>
</p>
</div>
</div>
Event Timeline
Log In to Comment