summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2013-07-19 13:06:57 +0200
committerAzul <azul@leap.se>2013-07-24 10:56:45 +0200
commitc0527cc18788fc60180d9293a546c93e6a77b788 (patch)
tree73c04ded5655764c99f63c919bef6d9bbb8b613c
parentc0b88d9e8fe574d6164f48211db50f3b8a4c4d93 (diff)
removed email settings controller and views
PGP setting has been moved into account settings. It's using the API now issueing an Ajax request without any visual feedback. This obviously is not what we want but it hopefully suffices for uploading gpg keys for testing purposes before the Identity UI is in place.
-rw-r--r--app/views/layouts/_navigation.html.haml1
-rw-r--r--users/app/controllers/email_settings_controller.rb41
-rw-r--r--users/app/controllers/v1/users_controller.rb3
-rw-r--r--users/app/views/email_settings/edit.html.haml38
-rw-r--r--users/app/views/users/_edit.html.haml16
5 files changed, 15 insertions, 84 deletions
diff --git a/app/views/layouts/_navigation.html.haml b/app/views/layouts/_navigation.html.haml
index 2f79a22..3d094a6 100644
--- a/app/views/layouts/_navigation.html.haml
+++ b/app/views/layouts/_navigation.html.haml
@@ -1,6 +1,5 @@
%ul.nav.sidenav
= link_to_navigation t(:overview), user_overview_path(@user), :active => controller?(:overviews)
= link_to_navigation t(:account_settings), edit_user_path(@user), :active => controller?(:users)
- = link_to_navigation t(:email_settings), edit_user_email_settings_path(@user), :active => controller?(:email_settings)
= link_to_navigation t(:support_tickets), auto_tickets_path, :active => controller?(:tickets)
= link_to_navigation t(:logout), logout_path, :method => :delete
diff --git a/users/app/controllers/email_settings_controller.rb b/users/app/controllers/email_settings_controller.rb
deleted file mode 100644
index f7d85be..0000000
--- a/users/app/controllers/email_settings_controller.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-class EmailSettingsController < UsersBaseController
-
- before_filter :authorize
- before_filter :fetch_user
-
- def edit
- @email_alias = LocalEmail.new
- end
-
- def update
- @user.attributes = cleanup_params(params[:user])
- if @user.changed?
- if @user.save
- flash[:notice] = t(:changes_saved)
- redirect
- else
- if @user.email_aliases.last && !@user.email_aliases.last.valid?
- # display bad alias in text field:
- @email_alias = @user.email_aliases.pop
- end
- render 'email_settings/edit'
- end
- else
- redirect
- end
- end
-
- private
-
- def redirect
- redirect_to edit_user_email_settings_url(@user)
- end
-
- def cleanup_params(user)
- if !user['email_forward'].nil? && user['email_forward'].empty?
- user.delete('email_forward') # don't allow "" as an email forward
- end
- user
- end
-
-end
diff --git a/users/app/controllers/v1/users_controller.rb b/users/app/controllers/v1/users_controller.rb
index fda56f2..467c9b4 100644
--- a/users/app/controllers/v1/users_controller.rb
+++ b/users/app/controllers/v1/users_controller.rb
@@ -24,9 +24,6 @@ module V1
def update
@user.update_attributes params[:user]
- if @user.valid?
- flash[:notice] = t(:user_updated_successfully)
- end
respond_with @user
end
diff --git a/users/app/views/email_settings/edit.html.haml b/users/app/views/email_settings/edit.html.haml
deleted file mode 100644
index 7757a31..0000000
--- a/users/app/views/email_settings/edit.html.haml
+++ /dev/null
@@ -1,38 +0,0 @@
-- form_options = {:url => user_email_settings_path(@user), :html => {:class => 'form-horizontal'}, :validate => true}
-- alias_error_class = @email_alias.username && !@email_alias.valid? ? 'error' : ''
-
-- content_for :head do
- :css
- table.aliases tr:first-child td {
- border-top: none;
- }
-
-= simple_form_for @user, form_options.dup do |f|
- %legend= t(:email_aliases)
- .control-group
- %label.control-label= t(:current_aliases)
- .controls
- %table.table.table-condensed.no-header.slim.aliases
- - if @user.email_aliases.any?
- - @user.email_aliases.each do |email|
- %tr
- %td= email
- %td= link_to(icon(:remove) + t(:remove), user_email_alias_path(@user, email), :method => :delete)
- - else
- %tr
- %td{:colspan=>2}= t(:none)
- .control-group{:class => alias_error_class}
- %label.control-label= t(:add_email_alias)
- .controls
- = f.simple_fields_for :email_aliases, @email_alias do |e|
- .input-append
- = e.input_field :username
- = e.submit t(:add), :class => 'btn'
- = e.error :username
-
-= simple_form_for @user, form_options do |f|
- %legend= t(:advanced_options)
- = f.input :email_forward
- = f.input :public_key, :as => :text, :hint => t(:use_ascii_key), :input_html => {:class => "full-width", :rows => 4}
- .form-actions
- = f.submit t(:save), :class => 'btn btn-primary'
diff --git a/users/app/views/users/_edit.html.haml b/users/app/views/users/_edit.html.haml
index 0402f37..5f74d32 100644
--- a/users/app/views/users/_edit.html.haml
+++ b/users/app/views/users/_edit.html.haml
@@ -23,6 +23,20 @@
= f.submit t(:save), :class => 'btn btn-primary'
-#
+-# CHANGE PGP KEY
+-#
+-# this will be replaced by a identities controller/view at some point
+-#
+
+- form_options = {:html => {:class => user_form_class('form-horizontal'), :id => 'update_pgp_key'}, :validate => true}
+= simple_form_for [:api, @user], form_options do |f|
+ %legend= t(:advanced_options)
+ = f.input :public_key, :as => :text, :hint => t(:use_ascii_key), :input_html => {:class => "full-width", :rows => 4}
+ .control-group
+ .controls
+ = f.submit t(:save), :class => 'btn'
+
+-#
-# DESTROY ACCOUNT
-#
@@ -48,4 +62,4 @@
%p= t(:enable_description)
= link_to enable_user_path(@user), :method => :post, :class => "btn btn-warning" do
%i.icon-ok.icon-white
- = t(:enable) \ No newline at end of file
+ = t(:enable)