summaryrefslogtreecommitdiff
path: root/users/app
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2013-06-17 01:27:55 -0700
committerelijah <elijah@riseup.net>2013-06-17 01:27:55 -0700
commita089c452a414e7d34d49f0e2703c632141361e2b (patch)
tree9e7a571d2e169dfdbe40871afba967e370437be7 /users/app
parent742f01f1ca5f1006fba3c5c74489f920acca43b3 (diff)
new ui - initial user changes
Diffstat (limited to 'users/app')
-rw-r--r--users/app/controllers/account_settings_controller.rb0
-rw-r--r--users/app/controllers/email_settings_controller.rb0
-rw-r--r--users/app/controllers/overviews_controller.rb9
-rw-r--r--users/app/controllers/users_base_controller.rb18
-rw-r--r--users/app/helpers/users_helper.rb2
-rw-r--r--users/app/views/_login_or_signup.html.haml25
-rw-r--r--users/app/views/emails/edit.html.haml5
-rw-r--r--users/app/views/overviews/show.html.haml15
-rw-r--r--users/app/views/sessions/_new.html.haml7
-rw-r--r--users/app/views/sessions/new.html.haml17
-rw-r--r--users/app/views/users/_login_field.html.haml2
-rw-r--r--users/app/views/users/_new.html.haml7
-rw-r--r--users/app/views/users/_password_fields.html.haml4
-rw-r--r--users/app/views/users/edit.html.haml20
-rw-r--r--users/app/views/users/new.html.haml5
15 files changed, 104 insertions, 32 deletions
diff --git a/users/app/controllers/account_settings_controller.rb b/users/app/controllers/account_settings_controller.rb
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/users/app/controllers/account_settings_controller.rb
diff --git a/users/app/controllers/email_settings_controller.rb b/users/app/controllers/email_settings_controller.rb
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/users/app/controllers/email_settings_controller.rb
diff --git a/users/app/controllers/overviews_controller.rb b/users/app/controllers/overviews_controller.rb
new file mode 100644
index 0000000..52ce267
--- /dev/null
+++ b/users/app/controllers/overviews_controller.rb
@@ -0,0 +1,9 @@
+class OverviewsController < UsersBaseController
+
+ before_filter :authorize
+ before_filter :fetch_user
+
+ def show
+ end
+
+end
diff --git a/users/app/controllers/users_base_controller.rb b/users/app/controllers/users_base_controller.rb
new file mode 100644
index 0000000..dc2fa16
--- /dev/null
+++ b/users/app/controllers/users_base_controller.rb
@@ -0,0 +1,18 @@
+#
+# common base class for all user related controllers
+#
+
+class UsersBaseController < ApplicationController
+
+ protected
+
+ def fetch_user
+ @user = User.find_by_param(params[:user_id] || params[:id])
+ if !@user && admin?
+ redirect_to users_url, :alert => t(:no_such_thing, :thing => 'user')
+ elsif !admin? && @user != current_user
+ access_denied
+ end
+ end
+
+end
diff --git a/users/app/helpers/users_helper.rb b/users/app/helpers/users_helper.rb
index 9feae62..559b3f7 100644
--- a/users/app/helpers/users_helper.rb
+++ b/users/app/helpers/users_helper.rb
@@ -24,7 +24,7 @@ module UsersHelper
end
def user_form_html_classes(options)
- classes = %W/form-horizontal user form/
+ classes = %W/user form/
classes << options[:legend]
classes << (@user.new_record? ? 'new' : 'edit')
classes.compact
diff --git a/users/app/views/_login_or_signup.html.haml b/users/app/views/_login_or_signup.html.haml
new file mode 100644
index 0000000..b353526
--- /dev/null
+++ b/users/app/views/_login_or_signup.html.haml
@@ -0,0 +1,25 @@
+//
+// displays a little widget to login or sign up
+//
+
+%ul.nav.nav-tabs
+ %li.active
+ %a{:href => ''}= t(:login)
+ %li
+ = link_to t(:signup), new_user_path
+
+= render 'sessions/new'
+
+//
+// this is nice, but it doesn't work because both forms have the same names for fields.
+//
+// %ul.nav.nav-tabs
+// %li.active
+// %a{:href => '#login', 'data-toggle' => 'tab'}= t(:login)
+// %li
+// %a{:href => '#signup', 'data-toggle' => 'tab'}= t(:signup)
+// .tab-content
+// #login.tab-pane.active
+// = render 'sessions/new'
+// #signup.tab-pane
+// = render 'users/new'
diff --git a/users/app/views/emails/edit.html.haml b/users/app/views/emails/edit.html.haml
new file mode 100644
index 0000000..b44b569
--- /dev/null
+++ b/users/app/views/emails/edit.html.haml
@@ -0,0 +1,5 @@
+
+
+= user_form_with 'public_key_field', :legend => :public_key
+= user_form_with 'email_forward_field', :legend => :forward_email
+= user_form_with 'email_aliases', :legend => :add_email_alias
diff --git a/users/app/views/overviews/show.html.haml b/users/app/views/overviews/show.html.haml
new file mode 100644
index 0000000..eda9899
--- /dev/null
+++ b/users/app/views/overviews/show.html.haml
@@ -0,0 +1,15 @@
+%p
+ Username:
+ = @user.login
+
+%p
+ User since:
+ = @user.created_at
+
+%p
+ Last update:
+ = @user.updated_at
+
+%p
+ Quota:
+ N/A \ No newline at end of file
diff --git a/users/app/views/sessions/_new.html.haml b/users/app/views/sessions/_new.html.haml
new file mode 100644
index 0000000..640fec5
--- /dev/null
+++ b/users/app/views/sessions/_new.html.haml
@@ -0,0 +1,7 @@
+- @session ||= Session.new
+= simple_form_for @session, :validate => true, :html => { :id => :new_session, :class => '' } do |f|
+ = f.input :login, :required => false, :label => t(:username), :input_html => { :id => :srp_username }
+ = f.input :password, :required => false, :input_html => { :id => :srp_password }
+ .form-actions
+ = f.button :submit, :value => t(:login), :class => 'btn-primary'
+ // = f.button :submit, :value => t(:login), :class => 'btn-primary' \ No newline at end of file
diff --git a/users/app/views/sessions/new.html.haml b/users/app/views/sessions/new.html.haml
index a04f584..4d14801 100644
--- a/users/app/views/sessions/new.html.haml
+++ b/users/app/views/sessions/new.html.haml
@@ -1,8 +1,9 @@
-.span8.offset2
- %h2=t :login
- = simple_form_for @session, :validate => true, :html => { :id => :new_session, :class => 'form-horizontal' } do |f|
- %legend=t :login_message
- = f.input :login, :input_html => { :id => :srp_username }
- = f.input :password, :required => true, :input_html => { :id => :srp_password }
- = f.button :submit, :value => t(:login), :class => 'btn-primary'
- = link_to t(:cancel), root_url, :class => :btn
+//= render 'sessions/new'
+
+%h2=t :login
+= simple_form_for @session, :validate => true, :html => { :id => :new_session, :class => 'form-horizontal' } do |f|
+ %legend=t :login_message
+ = f.input :login, :input_html => { :id => :srp_username }
+ = f.input :password, :required => true, :input_html => { :id => :srp_password }
+ = f.button :submit, :value => t(:login), :class => 'btn-primary'
+ = link_to t(:cancel), root_url, :class => :btn \ No newline at end of file
diff --git a/users/app/views/users/_login_field.html.haml b/users/app/views/users/_login_field.html.haml
index 8ab36c3..e58c36f 100644
--- a/users/app/views/users/_login_field.html.haml
+++ b/users/app/views/users/_login_field.html.haml
@@ -1 +1 @@
-= f.input :login, :input_html => { :id => :srp_username }
+= f.input :login, :label => t(:username), :required => false, :input_html => { :id => :srp_username }
diff --git a/users/app/views/users/_new.html.haml b/users/app/views/users/_new.html.haml
new file mode 100644
index 0000000..3d0f2ac
--- /dev/null
+++ b/users/app/views/users/_new.html.haml
@@ -0,0 +1,7 @@
+- @user ||= User.new
+= user_form do |f|
+ = render :partial => 'users/login_field', :locals => {:f => f}
+ = render :partial => 'users/password_fields', :locals => {:f => f}
+ .form-actions
+ = f.button :submit, :value => t(:signup), :class => 'btn-primary'
+ = link_to t(:cancel), root_url, :class => :btn
diff --git a/users/app/views/users/_password_fields.html.haml b/users/app/views/users/_password_fields.html.haml
index 47b7b07..7b3358d 100644
--- a/users/app/views/users/_password_fields.html.haml
+++ b/users/app/views/users/_password_fields.html.haml
@@ -1,2 +1,2 @@
-= f.input :password, :required => true, :validate => true, :input_html => { :id => :srp_password }
-= f.input :password_confirmation, :required => true, :hint => local_assigns[:password_confirmation_hint], :input_html => { :id => :srp_password_confirmation }
+= f.input :password, :required => false, :validate => true, :input_html => { :id => :srp_password }
+= f.input :password_confirmation, :required => false, :hint => local_assigns[:password_confirmation_hint], :input_html => { :id => :srp_password_confirmation }
diff --git a/users/app/views/users/edit.html.haml b/users/app/views/users/edit.html.haml
index 97bd48d..4e70d69 100644
--- a/users/app/views/users/edit.html.haml
+++ b/users/app/views/users/edit.html.haml
@@ -1,17 +1,3 @@
-.span8.offset2
- %h2=t :settings
- - tabs = []
- - content_for :account do
- = user_form_with 'login_and_password_fields', :legend => :update_login_and_password if @user == current_user
- = render 'cancel_account'
- - tabs << :account
- - if @user == current_user
- - content_for :email do
- %legend=t :email_address
- =t :associated_email
- = render @user.email_address, :as => :span
- = user_form_with 'public_key_field', :legend => :public_key
- = user_form_with 'email_forward_field', :legend => :forward_email
- = user_form_with 'email_aliases', :legend => :add_email_alias
- - tabs << :email
- = render 'tabs/tabs', :tabs => tabs
+= user_form_with 'login_and_password_fields', :legend => :update_login_and_password if @user == current_user
+= render 'cancel_account'
+
diff --git a/users/app/views/users/new.html.haml b/users/app/views/users/new.html.haml
index 98cccb0..d8a43d5 100644
--- a/users/app/views/users/new.html.haml
+++ b/users/app/views/users/new.html.haml
@@ -4,8 +4,7 @@
%legend= t(:signup_message)
= render :partial => 'login_field', :locals => {:f => f}
= render :partial => 'password_fields', :locals => {:f => f}
- .pull-right
- = f.button :submit, :class => 'btn-primary'
+ .form-actions
+ = f.button :submit, :value => t(:signup), :class => 'btn-primary'
= link_to t(:cancel), root_url, :class => :btn
- .clearfix