- <%= link_to 'New Label', new_admin_account_label_path(@profile.account_id), class: 'btn btn-success' %>
+ <%= link_to 'New Label', new_admin_account_label_path(@account.id), class: 'btn btn-success' %>
@@ -96,8 +128,8 @@
<%= label.key %> |
<%= label.value %> |
<%= label.scope %> |
- <%= link_to 'Edit', edit_admin_account_label_path(id: label.id, account_id: @profile.account_id), class: 'btn btn-primary btn-sm' %> |
- <%= link_to 'Delete', admin_account_label_path(id: label.id, account_id: @profile.account_id), class: 'btn btn-danger btn-sm', method: :delete, data: {confirm: 'Are you sure?'} %> |
+ <%= link_to 'Edit', edit_admin_account_label_path(id: label.id, account_id: @account.id), class: 'btn btn-primary btn-sm' %> |
+ <%= link_to 'Delete', admin_account_label_path(id: label.id, account_id: @account.id), class: 'btn btn-danger btn-sm', method: :delete, data: {confirm: 'Are you sure?'} %> |
<% end %>
diff --git a/app/views/admin/profiles/_form.html.erb b/app/views/admin/profiles/_form.html.erb
new file mode 100644
index 000000000..e7bb9cbc7
--- /dev/null
+++ b/app/views/admin/profiles/_form.html.erb
@@ -0,0 +1,47 @@
+<%= form_with(model: [:admin, @profile], local: false) do |form| %>
+ <% if profile.errors.any? %>
+
+
<%= pluralize(profile.errors.count, "error") %> prohibited this website from being saved:
+
+
+ <% profile.errors.full_messages.each do |message| %>
+ - <%= message %>
+ <% end %>
+
+
+ <% end %>
+
+ <%= form.label :first_name, class: 'control-label'%>
+ <%= form.text_field :first_name, class: 'form-control col-sm-10'%>
+
+
+ <%= form.label :last_name, class: 'control-label'%>
+ <%= form.text_field :last_name, class: 'form-control col-sm-10'%>
+
+
+ <%= form.label :dob, class: 'control-label'%>
+ <%= form.text_field :dob, class: 'form-control col-sm-10'%>
+
+
+ <%= form.label :address, class: 'control-label'%>
+ <%= form.text_field :address, class: 'form-control col-sm-10'%>
+
+
+ <%= form.label :postcode, class: 'control-label'%>
+ <%= form.text_field :postcode, class: 'form-control col-sm-10'%>
+
+
+ <%= form.label :city, class: 'control-label'%>
+ <%= form.text_field :city, class: 'form-control col-sm-10'%>
+
+
+ <%= form.label :country, class: 'control-label'%>
+ <%= form.text_field :country, class: 'form-control col-sm-10'%>
+
+
+ <%= form.submit 'Submit', class: 'btn btn-primary' %>
+
+
+
+
+<% end %>
diff --git a/app/views/admin/profiles/edit.html.erb b/app/views/admin/profiles/edit.html.erb
new file mode 100644
index 000000000..12b30111c
--- /dev/null
+++ b/app/views/admin/profiles/edit.html.erb
@@ -0,0 +1,5 @@
+
+
Editing profile
+ <%= render 'form', profile: @profile %>
+
+
diff --git a/app/views/admin/profiles/index.html.erb b/app/views/admin/profiles/index.html.erb
deleted file mode 100644
index c81de36da..000000000
--- a/app/views/admin/profiles/index.html.erb
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
Profiles
-
-
- Filter by state:
-
-
-
-
-
-
-
-
-
- ID |
- State |
- First name |
- Last name |
- Country |
- |
-
-
-
- <% @profiles.each do |profile| %>
-
- <%= profile.id %> |
- <%= profile.state %> |
- <%= profile.first_name %> |
- <%= profile.last_name %> |
- <%= profile.country %> |
- <%= link_to 'Show', admin_profile_path(profile), class: 'btn btn-info btn-sm' %> |
-
- <% end %>
-
-
- <%= paginate @profiles %>
-
diff --git a/app/views/admin/shared/_navigation.html.erb b/app/views/admin/shared/_navigation.html.erb
index a43db2e4f..0ccb2db8b 100644
--- a/app/views/admin/shared/_navigation.html.erb
+++ b/app/views/admin/shared/_navigation.html.erb
@@ -9,12 +9,6 @@
<% end %>
- <% if can? :read, Profile %>
-
- <%= link_to 'Profiles', admin_profiles_path, class: 'nav-link' %>
-
- <% end %>
-
<% if current_account.role.admin? %>
<%= link_to 'Applications', oauth_applications_path, class: 'nav-link' %>
diff --git a/config/routes.rb b/config/routes.rb
index 08fd6b8c8..e5c1c01de 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -24,11 +24,11 @@
namespace :admin do
get '/', to: 'accounts#index', as: :accounts
- resources :accounts, except: %i[new create show] do
+ resources :accounts, except: %i[new create] do
resources :labels, except: %i[index show]
end
resources :websites
- resources :profiles, only: %i[index show] do
+ resources :profiles, except: %i[index new show] do
put :change_state, on: :member
end
end