summaryrefslogtreecommitdiff
path: root/users/app/views
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2012-12-07 08:28:23 +0100
committerAzul <azul@leap.se>2012-12-07 08:28:23 +0100
commit1ec55c4f562a4fdd57c50077ff286ef08e9978a1 (patch)
tree16203d2ca4f32e24d38fef6062aa9534cecb3bfe /users/app/views
parenteffa6b0f84cfe954cc9dd73f592663b743b0d857 (diff)
parenta3dce077881c7e97090e5e560b1fb004952d5b23 (diff)
Merge branch 'develop'
Diffstat (limited to 'users/app/views')
-rw-r--r--users/app/views/sessions/_admin_nav.html.haml6
-rw-r--r--users/app/views/sessions/_nav.html.haml13
-rw-r--r--users/app/views/sessions/new.html.haml15
-rw-r--r--users/app/views/sessions/new.json.erb3
-rw-r--r--users/app/views/users/_cancel_account.html.haml6
-rw-r--r--users/app/views/users/_form.html.haml15
-rw-r--r--users/app/views/users/_user.html.haml10
-rw-r--r--users/app/views/users/edit.html.haml5
-rw-r--r--users/app/views/users/index.html.haml17
-rw-r--r--users/app/views/users/new.html.haml13
10 files changed, 86 insertions, 17 deletions
diff --git a/users/app/views/sessions/_admin_nav.html.haml b/users/app/views/sessions/_admin_nav.html.haml
new file mode 100644
index 0000000..14dfbdc
--- /dev/null
+++ b/users/app/views/sessions/_admin_nav.html.haml
@@ -0,0 +1,6 @@
+%a#admin-menu{"data-toggle" => "dropdown", :role => :button}
+ Admin
+%ul.dropdown-menu{:role => "menu", "aria-labelledby" => "admin-menu"}
+ %li
+ = link_to Ticket.model_name.human(:count => ""), tickets_path, {:tabindex => -1}
+ = link_to User.model_name.human(:count => ""), users_path, {:tabindex => -1}
diff --git a/users/app/views/sessions/_nav.html.haml b/users/app/views/sessions/_nav.html.haml
new file mode 100644
index 0000000..5306d0e
--- /dev/null
+++ b/users/app/views/sessions/_nav.html.haml
@@ -0,0 +1,13 @@
+- if logged_in?
+ - if admin?
+ %li.dropdown
+ = render 'sessions/admin_nav'
+ %li
+ = link_to current_user.login, edit_user_path(current_user)
+ %li
+ = link_to t(:logout), logout_path
+- else
+ %li
+ = link_to t(:login), login_path
+ %li
+ = link_to t(:signup), signup_path
diff --git a/users/app/views/sessions/new.html.haml b/users/app/views/sessions/new.html.haml
index 39ee7bf..a04f584 100644
--- a/users/app/views/sessions/new.html.haml
+++ b/users/app/views/sessions/new.html.haml
@@ -1,7 +1,8 @@
-%h2=t :login
-= simple_form_for :session, :url => sessions_path, :html => { :id => :new_session } 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
+.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
diff --git a/users/app/views/sessions/new.json.erb b/users/app/views/sessions/new.json.erb
new file mode 100644
index 0000000..36154b8
--- /dev/null
+++ b/users/app/views/sessions/new.json.erb
@@ -0,0 +1,3 @@
+{
+"errors": <%= raw @errors.to_json %>
+}
diff --git a/users/app/views/users/_cancel_account.html.haml b/users/app/views/users/_cancel_account.html.haml
new file mode 100644
index 0000000..41580b0
--- /dev/null
+++ b/users/app/views/users/_cancel_account.html.haml
@@ -0,0 +1,6 @@
+%legend
+ =t :cancel_account
+ %small You will not be able to login anymore.
+= link_to user_path(@user), :method => :delete, :class => "btn btn-danger" do
+ %i.icon-remove.icon-white
+ Remove my Account
diff --git a/users/app/views/users/_form.html.haml b/users/app/views/users/_form.html.haml
new file mode 100644
index 0000000..39e26a6
--- /dev/null
+++ b/users/app/views/users/_form.html.haml
@@ -0,0 +1,15 @@
+- only = local_assigns[:only]
+- html = {:class => 'form-horizontal user form ' + (@user.new_record? ? 'new' : 'edit')}
+= simple_form_for @user, :validate => true, :format => :json, :html => html do |f|
+ %legend
+ = t(only || :signup_message)
+ - if !only || only == :change_login
+ = f.input :login, :input_html => { :id => :srp_username }
+ - if !only || only == :change_password
+ = f.input :password, :required => true, :validate => true, :input_html => { :id => :srp_password }
+ = f.input :password_confirmation, :required => true, :input_html => { :id => :srp_password_confirmation }
+ .pull-right
+ = f.button :submit, :class => 'btn-primary'
+ - unless only
+ = link_to t(:cancel), root_url, :class => :btn
+ .clearfix
diff --git a/users/app/views/users/_user.html.haml b/users/app/views/users/_user.html.haml
new file mode 100644
index 0000000..7db0041
--- /dev/null
+++ b/users/app/views/users/_user.html.haml
@@ -0,0 +1,10 @@
+%tr
+ %td= user.login
+ %td= time_ago_in_words(user.created_at) + " ago"
+ %td
+ = link_to edit_user_path(user), :class => "btn btn-mini btn-primary" do
+ %i.icon-edit.icon-white
+ Edit
+ = link_to user_path(user), :method => :delete, :class => "btn btn-danger btn-mini" do
+ %i.icon-remove.icon-white
+ Remove
diff --git a/users/app/views/users/edit.html.haml b/users/app/views/users/edit.html.haml
new file mode 100644
index 0000000..25da71a
--- /dev/null
+++ b/users/app/views/users/edit.html.haml
@@ -0,0 +1,5 @@
+.span8.offset2
+ %h2=t :settings
+ = render :partial => 'form', :locals => {:only => :change_login}
+ = render :partial => 'form', :locals => {:only => :change_password}
+ = render 'cancel_account' if @user == current_user
diff --git a/users/app/views/users/index.html.haml b/users/app/views/users/index.html.haml
new file mode 100644
index 0000000..9e6a179
--- /dev/null
+++ b/users/app/views/users/index.html.haml
@@ -0,0 +1,17 @@
+.page-header
+ %h1= User.model_name.human(:count =>User.count)
+.row
+ .span8
+ %h2= params[:query] ? "Users starting with '#{params[:query]}'" : "Last users who signed up"
+ %table.table.table-hover
+ %tr
+ %th Login
+ %th Created
+ %th Action
+ = render @users.all
+ .span4
+ %h4 Find user
+ = form_tag users_path, :method => :get, :class => "form-search" do
+ .input-append
+ = text_field_tag :query, "", :class => "user typeahead span2 search-query", :autocomplete => :off
+ %button.btn{:type => :submit} Search
diff --git a/users/app/views/users/new.html.haml b/users/app/views/users/new.html.haml
index f6ece3a..c1c4208 100644
--- a/users/app/views/users/new.html.haml
+++ b/users/app/views/users/new.html.haml
@@ -1,10 +1,3 @@
-%h2=t :signup
-= simple_form_for @user do |f|
- %legend=t :signup_message
- = f.input :login, :input_html => { :id => :srp_username }
- = f.input :password, :required => true, :input_html => { :id => :srp_password }
- = f.input :password_confirmation, :required => true, :input_html => { :id => :srp_password_confirmation }
- = f.input :password_verifier, :as => :hidden, :input_html => { :id => :srp_password_verifier }
- = f.input :password_salt, :as => :hidden, :input_html => { :id => :srp_salt }
- = f.button :submit, :value => t(:signup), :class => 'btn-primary'
- = link_to t(:cancel), root_url, :class => :btn
+.span8.offset2
+ %h2=t :signup
+ = render 'form'